Skip to content

Commit

Permalink
fix: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Mar 24, 2023
1 parent 33e0519 commit 01f862e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 36 deletions.
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,32 @@
"trailingComma": "all"
},
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.17.9",
"@babel/preset-typescript": "^7.16.7",
"@types/jest": "^27.5.0",
"@babel/plugin-transform-modules-commonjs": "^7.21.2",
"@babel/preset-typescript": "^7.21.0",
"@types/jest": "^29.5.0",
"chemcalc": "^3.4.1",
"cheminfo-build": "^1.1.11",
"eslint": "^8.14.0",
"eslint-config-cheminfo-typescript": "^10.4.0",
"eslint-plugin-jest": "^26.1.5",
"cheminfo-build": "^1.2.0",
"eslint": "^8.36.0",
"eslint-config-cheminfo-typescript": "^11.3.1",
"eslint-plugin-jest": "^27.2.1",
"esm": "^3.2.25",
"jest": "^28.1.0",
"jest": "^29.5.0",
"jest-matcher-deep-close-to": "^3.0.2",
"mf-global": "^1.4.24",
"mf-global": "^2.1.2",
"ml-stat": "^1.3.3",
"nodemon": "^2.0.16",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
"spectrum-generator": "^8.0.1",
"typescript": "^4.6.4",
"xy-parser": "^5.0.2"
"nodemon": "^2.0.22",
"prettier": "^2.8.7",
"rimraf": "^4.4.1",
"spectrum-generator": "^8.0.6",
"typescript": "^5.0.2",
"xy-parser": "^5.0.4"
},
"dependencies": {
"@lukeed/uuid": "^2.0.0",
"cheminfo-types": "^1.1.0",
"ml-peak-shape-generator": "^4.1.1",
"cheminfo-types": "^1.4.0",
"ml-peak-shape-generator": "^4.1.2",
"ml-savitzky-golay-generalized": "^4.0.1",
"ml-spectra-fitting": "^4.1.1",
"ml-spectra-processing": "^11.6.0"
"ml-spectra-fitting": "^4.2.1",
"ml-spectra-processing": "^12.0.0"
}
}
12 changes: 5 additions & 7 deletions src/gsd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { DataXY } from 'cheminfo-types';
import { sgg, SGGOptions } from 'ml-savitzky-golay-generalized';
import {
xIsEquallySpaced,
xIsMonotoneIncreasing,
xIsMonotonic,
xMinValue,
xMaxValue,
xNoiseStandardDeviation,
Expand Down Expand Up @@ -71,7 +71,7 @@ export function gsd(data: DataXY, options: GSDOptions = {}): GSDPeakID[] {
} = options;

let { x, y } = data;
if (!xIsMonotoneIncreasing(x)) {
if (xIsMonotonic(x) !== 1) {
throw new Error('GSD only accepts monotone increasing x values');
}
//rescale;
Expand All @@ -92,13 +92,11 @@ export function gsd(data: DataXY, options: GSDOptions = {}): GSDPeakID[] {
} else {
noiseLevel = 0;
}
} else {
if (maxCriteria === false) {
noiseLevel *= -1;
}
} else if (!maxCriteria) {
noiseLevel *= -1;
}

if (maxCriteria === false) {
if (!maxCriteria) {
for (let i = 0; i < y.length; i++) {
y[i] *= -1;
}
Expand Down
3 changes: 2 additions & 1 deletion src/post/broadenPeaks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ export function broadenPeaks<T extends GSDPeakOptionalShape>(
let nextPeak = peaks[i + 1];
if (peak.to.x > nextPeak.from.x) {
// we do it proportional to the width of the peaks
peak.to.x = nextPeak.from.x =
peak.to.x =
(peak.width / (nextPeak.width + peak.width)) * (nextPeak.x - peak.x) +
peak.x;
nextPeak.from.x = peak.to.x;
}
}
}
Expand Down
12 changes: 3 additions & 9 deletions src/utils/optimizeTop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,22 @@ export function optimizeTop<T extends { index: number; x: number; y: number }>(
y[currentIndex - 1] >= y[currentIndex]
) {
currentIndex--;
} else {
if (
} else if (
y[currentIndex + 1] >= y[currentIndex] &&
y[currentIndex + 1] >= y[currentIndex + 2]
) {
currentIndex++;
} else {
if (
} else if (
y[currentIndex - 2] >= y[currentIndex - 3] &&
y[currentIndex - 2] >= y[currentIndex - 1]
) {
currentIndex -= 2;
} else {
if (
} else if (
y[currentIndex + 2] >= y[currentIndex + 1] &&
y[currentIndex + 2] >= y[currentIndex + 3]
) {
currentIndex += 2;
}
}
}
}
// interpolation to a sin() function
if (
y[currentIndex - 1] > 0 &&
Expand Down

0 comments on commit 01f862e

Please sign in to comment.