Skip to content

Commit

Permalink
feat: update ml-peak-shape-generator to 2.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jobo322 committed Aug 10, 2021
1 parent d432ecc commit 98128b8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
"nodemon": "^2.0.7",
"prettier": "^2.3.0",
"rollup": "^2.50.1",
"spectrum-generator": "^4.7.1",
"spectrum-generator": "^5.0.0",
"xy-parser": "^3.1.1"
},
"dependencies": {
"ml-peak-shape-generator": "^1.0.0",
"ml-peak-shape-generator": "^2.0.1",
"ml-savitzky-golay-generalized": "2.0.3",
"ml-spectra-fitting": "^1.0.0",
"ml-spectra-processing": "^6.6.0"
Expand Down
32 changes: 21 additions & 11 deletions src/__tests__/simulated.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ describe('Global spectra deconvolution with simulated spectra', () => {
];

const data = generateSpectrum(peaks, {
from: -1,
to: 1,
nbPoints: 1001,
factor: 6,
generator: {
from: -1,
to: 1,
nbPoints: 1001,
},
peaks: {
factor: 6,
},
});

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

const data = generateSpectrum(peaks, { from: -1, to: 1, nbPoints: 10001 });
const data = generateSpectrum(peaks, {
generator: { from: -1, to: 1, nbPoints: 10001 },
});

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

const data = generateSpectrum(peaks, { from: -1, to: 1, nbPoints: 10001 });
const data = generateSpectrum(peaks, {
generator: { from: -1, to: 1, nbPoints: 10001 },
});

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

const data = generateSpectrum(peaks, {
from: -0.5,
to: 0.5,
nbPoints: 10001,
shape: {
kind: 'gaussian',
generator: {
from: -0.5,
to: 0.5,
nbPoints: 10001,
shape: {
kind: 'gaussian',
},
},
});

Expand Down
4 changes: 2 additions & 2 deletions src/gsd.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getShapeGenerator } from 'ml-peak-shape-generator';
import { getShape1D } from 'ml-peak-shape-generator';
import SG from 'ml-savitzky-golay-generalized';

/**
Expand Down Expand Up @@ -172,7 +172,7 @@ export function gsd(data, options = {}) {
}

let widthProcessor = shape.kind
? getShapeGenerator(shape.kind, shape.options).widthToFWHM
? getShape1D(shape.kind, shape.options).widthToFWHM
: (x) => x;

let signals = [];
Expand Down
12 changes: 7 additions & 5 deletions src/post/__tests__/optimizePeaks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ describe('optimizePeaks', () => {
const peaks = [{ x: 0, y: 1, width: 0.12 }];

const data = generateSpectrum(peaks, {
from: -0.5,
to: 0.5,
nbPoints: 101,
shape: {
kind: 'gaussian',
generator: {
from: -0.5,
to: 0.5,
nbPoints: 101,
shape: {
kind: 'gaussian',
},
},
});

Expand Down

0 comments on commit 98128b8

Please sign in to comment.