Skip to content

Commit 98128b8

Browse files
committed
feat: update ml-peak-shape-generator to 2.0.1
1 parent d432ecc commit 98128b8

File tree

4 files changed

+32
-20
lines changed

4 files changed

+32
-20
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@
6868
"nodemon": "^2.0.7",
6969
"prettier": "^2.3.0",
7070
"rollup": "^2.50.1",
71-
"spectrum-generator": "^4.7.1",
71+
"spectrum-generator": "^5.0.0",
7272
"xy-parser": "^3.1.1"
7373
},
7474
"dependencies": {
75-
"ml-peak-shape-generator": "^1.0.0",
75+
"ml-peak-shape-generator": "^2.0.1",
7676
"ml-savitzky-golay-generalized": "2.0.3",
7777
"ml-spectra-fitting": "^1.0.0",
7878
"ml-spectra-processing": "^6.6.0"

src/__tests__/simulated.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ describe('Global spectra deconvolution with simulated spectra', () => {
1010
];
1111

1212
const data = generateSpectrum(peaks, {
13-
from: -1,
14-
to: 1,
15-
nbPoints: 1001,
16-
factor: 6,
13+
generator: {
14+
from: -1,
15+
to: 1,
16+
nbPoints: 1001,
17+
},
18+
peaks: {
19+
factor: 6,
20+
},
1721
});
1822

1923
let peakList = gsd(data, {
@@ -49,7 +53,9 @@ describe('Global spectra deconvolution with simulated spectra', () => {
4953
{ x: 0.5, y: 1, width: 0.1 },
5054
];
5155

52-
const data = generateSpectrum(peaks, { from: -1, to: 1, nbPoints: 10001 });
56+
const data = generateSpectrum(peaks, {
57+
generator: { from: -1, to: 1, nbPoints: 10001 },
58+
});
5359

5460
let peakList = gsd(data, {
5561
minMaxRatio: 0,
@@ -84,7 +90,9 @@ describe('Global spectra deconvolution with simulated spectra', () => {
8490
{ x: 0.5, y: 1, width: 0.1 },
8591
];
8692

87-
const data = generateSpectrum(peaks, { from: -1, to: 1, nbPoints: 10001 });
93+
const data = generateSpectrum(peaks, {
94+
generator: { from: -1, to: 1, nbPoints: 10001 },
95+
});
8896

8997
let peakList = gsd(data, {
9098
minMaxRatio: 0,
@@ -116,11 +124,13 @@ describe('Global spectra deconvolution with simulated spectra', () => {
116124
const peaks = [{ x: 0, y: 1, width: 0.12 }];
117125

118126
const data = generateSpectrum(peaks, {
119-
from: -0.5,
120-
to: 0.5,
121-
nbPoints: 10001,
122-
shape: {
123-
kind: 'gaussian',
127+
generator: {
128+
from: -0.5,
129+
to: 0.5,
130+
nbPoints: 10001,
131+
shape: {
132+
kind: 'gaussian',
133+
},
124134
},
125135
});
126136

src/gsd.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getShapeGenerator } from 'ml-peak-shape-generator';
1+
import { getShape1D } from 'ml-peak-shape-generator';
22
import SG from 'ml-savitzky-golay-generalized';
33

44
/**
@@ -172,7 +172,7 @@ export function gsd(data, options = {}) {
172172
}
173173

174174
let widthProcessor = shape.kind
175-
? getShapeGenerator(shape.kind, shape.options).widthToFWHM
175+
? getShape1D(shape.kind, shape.options).widthToFWHM
176176
: (x) => x;
177177

178178
let signals = [];

src/post/__tests__/optimizePeaks.test.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ describe('optimizePeaks', () => {
1010
const peaks = [{ x: 0, y: 1, width: 0.12 }];
1111

1212
const data = generateSpectrum(peaks, {
13-
from: -0.5,
14-
to: 0.5,
15-
nbPoints: 101,
16-
shape: {
17-
kind: 'gaussian',
13+
generator: {
14+
from: -0.5,
15+
to: 0.5,
16+
nbPoints: 101,
17+
shape: {
18+
kind: 'gaussian',
19+
},
1820
},
1921
});
2022

0 commit comments

Comments
 (0)