Skip to content

Commit 149ffdd

Browse files
committed
chore: fix eslint
1 parent 4802116 commit 149ffdd

File tree

4 files changed

+30
-17
lines changed

4 files changed

+30
-17
lines changed

examples/example.js

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ install vscode plugin `liveserver` and right click on index.html and `Open with
55
`npm run example``
66
*/
77

8+
import { writeFileSync } from 'fs';
9+
import { join } from 'path';
10+
11+
import { generateSpectrum } from 'spectrum-generator';
12+
813
import { gsd, optimizePeaks } from '../src';
9-
import { writeFileSync } from 'fs'
10-
import { join } from 'path'
11-
import { generateSpectrum } from 'spectrum-generator'
1214

1315
const peaks = [
1416
{ x: -0.1, y: 0.2, width: 0.3 },
@@ -17,7 +19,6 @@ const peaks = [
1719

1820
const original = generateSpectrum(peaks, { from: -1, to: 1, nbPoints: 101 });
1921

20-
2122
let peakList = gsd(original, {
2223
minMaxRatio: 0,
2324
realTopDetection: false,
@@ -26,24 +27,38 @@ let peakList = gsd(original, {
2627
shape: { kind: 'gaussian' },
2728
});
2829

29-
3030
let optimizedPeaks = optimizePeaks(original, peakList);
3131

32-
let labels = optimizedPeaks.map(peak => ({ x: peak.x, y: peak.y, dy: '-10px', dx: '3px', text: peak.x.toPrecision(4) + ' / ' + peak.y.toPrecision(4) }));
33-
let lines = optimizedPeaks.map(peak => ([{ x: peak.x, y: peak.y }, { x: peak.x, y: peak.y, dy: '-20px' }]));
32+
let labels = optimizedPeaks.map((peak) => ({
33+
x: peak.x,
34+
y: peak.y,
35+
dy: '-10px',
36+
dx: '3px',
37+
text: `${peak.x.toPrecision(4)} / ${peak.y.toPrecision(4)}`,
38+
}));
39+
let lines = optimizedPeaks.map((peak) => [
40+
{ x: peak.x, y: peak.y },
41+
{ x: peak.x, y: peak.y, dy: '-20px' },
42+
]);
3443
let polygons = [];
3544
for (const peak of optimizedPeaks) {
36-
const peaksSpectrum = generateSpectrum([peak], { from: peak.x - peak.width * 5, to: peak.x + peak.width * 5, nbPoints: 501 });
45+
const peaksSpectrum = generateSpectrum([peak], {
46+
from: peak.x - peak.width * 5,
47+
to: peak.x + peak.width * 5,
48+
nbPoints: 501,
49+
});
3750
const polygon = [];
3851
for (let i = 0; i < peaksSpectrum.x.length; i++) {
39-
polygon.push({ x: peaksSpectrum.x[i], y: peaksSpectrum.y[i] })
52+
polygon.push({ x: peaksSpectrum.x[i], y: peaksSpectrum.y[i] });
4053
}
4154
polygons.push(polygon);
4255
}
4356

57+
original.x = Array.from(original.x);
58+
original.y = Array.from(original.y);
4459

45-
46-
original.x = Array.from(original.x)
47-
original.y = Array.from(original.y)
48-
49-
writeFileSync(join(__dirname, 'data.json'), JSON.stringify({ data: original, labels, lines, polygons }), 'utf8')
60+
writeFileSync(
61+
join(__dirname, 'data.json'),
62+
JSON.stringify({ data: original, labels, lines, polygons }),
63+
'utf8',
64+
);

examples/index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ <h1>A spectrum-generator module usage example</h1>
9696
const shape = graph.newShape('line', {
9797
position: line,
9898
});
99-
console.log(line);
10099
shape.draw();
101100
}
102101
}

examples/mf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// to execute with `node -r esm ./mf.js`
22

33
import { IsotopicDistribution } from 'mf-global';
4+
45
import { gsd, optimizePeaks } from '../src';
56

67
// generate a sample spectrum of the form {x:[], y:[]}

src/__tests__/simulated.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ describe('Global spectra deconvolution with simulated spectra', () => {
2121

2222
let optimizedPeaks = optimizePeaks(data, peakList);
2323

24-
console.log(optimizedPeaks);
25-
2624
expect(peakList[0].x).toBeCloseTo(-0.1, 2);
2725
expect(peakList[0].y).toBeCloseTo(0.2, 2);
2826
expect(peakList[0].width).toBeCloseTo(0.3, 2);

0 commit comments

Comments
 (0)