Skip to content

Commit

Permalink
fix: update dependencies (#106)
Browse files Browse the repository at this point in the history
* fix: update dependencies

* chore: fix format
  • Loading branch information
jobo322 authored Mar 6, 2024
1 parent 966da43 commit 4dec6dc
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 70 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,24 @@
},
"homepage": "https://github.com/mljs/spectra-fitting",
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.21.2",
"@babel/preset-typescript": "^7.21.0",
"@types/jest": "^29.5.0",
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@types/jest": "^29.5.12",
"cheminfo-build": "^1.2.0",
"eslint": "^8.36.0",
"eslint-config-cheminfo-typescript": "^11.3.1",
"jest": "^29.5.0",
"eslint": "^8.57.0",
"eslint-config-cheminfo-typescript": "^12.2.0",
"jest": "^29.7.0",
"jest-matcher-deep-close-to": "^3.0.2",
"prettier": "^2.8.7",
"spectrum-generator": "^8.0.6",
"typescript": "^5.0.2"
"prettier": "^3.2.5",
"spectrum-generator": "^8.0.9",
"typescript": "^5.3.3"
},
"dependencies": {
"cheminfo-types": "^1.4.0",
"cheminfo-types": "^1.7.2",
"ml-array-max": "^1.2.4",
"ml-direct": "^0.1.1",
"ml-levenberg-marquardt": "^4.1.0",
"ml-direct": "^0.1.3",
"ml-levenberg-marquardt": "^4.1.3",
"ml-peak-shape-generator": "^4.1.2",
"ml-spectra-processing": "^12.0.0"
"ml-spectra-processing": "^14.0.0"
}
}
2 changes: 1 addition & 1 deletion src/__tests__/globalOptimization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('Optimize sum of Gaussians', () => {
},
});

let result = optimize(
const result = optimize(
data,
[
{
Expand Down
18 changes: 9 additions & 9 deletions src/__tests__/mixShapes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ expect.extend({ toBeDeepCloseTo, toMatchCloseTo });

describe('Sum of a mix of distributions', () => {
it('2 peaks', () => {
let peaks = [
const peaks = [
{
x: -0.5,
y: 0.001,
Expand All @@ -28,7 +28,7 @@ describe('Sum of a mix of distributions', () => {
},
});

let result = optimize(
const result = optimize(
data,
[
{
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('Sum of a mix of distributions', () => {
}
});
it('2 peaks same position', () => {
let peaks = [
const peaks = [
{
x: 0,
y: 1,
Expand All @@ -76,7 +76,7 @@ describe('Sum of a mix of distributions', () => {
},
});

let result = optimize(data, [
const result = optimize(data, [
{
x: -0.1,
y: 1.2,
Expand All @@ -96,7 +96,7 @@ describe('Sum of a mix of distributions', () => {
});
it('20 peaks with overlap', () => {
const nbPeaks = 5;
let peaks = [];
const peaks = [];
for (let i = 0; i < nbPeaks; i++) {
peaks.push({
x: i,
Expand All @@ -112,10 +112,10 @@ describe('Sum of a mix of distributions', () => {
},
});

let guess = JSON.parse(JSON.stringify(peaks));
const guess = JSON.parse(JSON.stringify(peaks));
guess.forEach((peak: any) => (peak.x += Math.random() / 10));

Check warning on line 116 in src/__tests__/mixShapes.test.ts

View workflow job for this annotation

GitHub Actions / nodejs / lint-eslint

Unexpected any. Specify a different type

let result = optimize(data, guess, {
const result = optimize(data, guess, {
optimization: { options: { maxIterations: 10 } },
});
// we have a little bit more error on mu
Expand All @@ -126,7 +126,7 @@ describe('Sum of a mix of distributions', () => {
}
});
it('6 peaks', () => {
let peaks = [
const peaks = [
{
x: 0,
y: 0.001,
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('Sum of a mix of distributions', () => {
},
});

let result = optimize(
const result = optimize(
data,
[
{
Expand Down
16 changes: 8 additions & 8 deletions src/__tests__/oneShape.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { optimize } from '../index';

expect.extend({ toBeDeepCloseTo, toMatchCloseTo });

let nbPoints = 31;
let xFactor = 0.1;
let x = new Float64Array(nbPoints);
const nbPoints = 31;
const xFactor = 0.1;
const x = new Float64Array(nbPoints);
for (let i = 0; i < nbPoints; i++) {
x[i] = (i - nbPoints / 2) * xFactor;
}
Expand All @@ -31,7 +31,7 @@ describe('One Shape tested', () => {
},
});

let result = optimize(data, [
const result = optimize(data, [
{
x: -0.52,
y: 0.0009,
Expand All @@ -42,7 +42,7 @@ describe('One Shape tested', () => {
});

it('Lorentzian', () => {
let peaks = [
const peaks = [
{
x: -0.5,
y: 0.001,
Expand All @@ -63,7 +63,7 @@ describe('One Shape tested', () => {
},
});

let result = optimize(data, [
const result = optimize(data, [
{
x: -0.52,
y: 0.0009,
Expand All @@ -75,7 +75,7 @@ describe('One Shape tested', () => {
});

it('Pseudo Voigt', () => {
let peaks = [
const peaks = [
{
x: 0,
y: 0.001,
Expand All @@ -91,7 +91,7 @@ describe('One Shape tested', () => {
},
});

let result = optimize(data, [
const result = optimize(data, [
{
x: 0.001,
y: 0.0009,
Expand Down
8 changes: 4 additions & 4 deletions src/__tests__/specifyShapeInOptimize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Optimize sum of Gaussians', () => {
},
});

let result = optimize(data, [
const result = optimize(data, [
{
id: 'first',
x: -0.55,
Expand Down Expand Up @@ -66,7 +66,7 @@ describe('Optimize sum of Gaussians', () => {
},
});

let result = optimize(data, [
const result = optimize(data, [
{ x: -0.52, y: 0.9, shape: { kind: 'gaussian', fwhm: 0.2 } },
{ x: 0.52, y: 0.9, shape: { kind: 'lorentzian', fwhm: 0.6 } },
]);
Expand All @@ -91,7 +91,7 @@ describe('Optimize sum of Lorentzians', () => {
},
});

let result = optimize(
const result = optimize(
data,
[
{ x: -0.52, y: 0.9 },
Expand Down Expand Up @@ -125,7 +125,7 @@ describe('Optimize sum of PseudoVoigts', () => {
},
});

let result = optimize(
const result = optimize(
data,
[
{ x: -0.52, y: 0.9 },
Expand Down
39 changes: 19 additions & 20 deletions src/__tests__/specifyShapeInPeaks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { optimize, Peak } from '../index';

expect.extend({ toBeDeepCloseTo, toMatchCloseTo });

let nbPoints = 31;
let xFactor = 0.1;
let x = new Float64Array(nbPoints);
const nbPoints = 31;
const xFactor = 0.1;
const x = new Float64Array(nbPoints);
for (let i = 0; i < nbPoints; i++) {
x[i] = (i - nbPoints / 2) * xFactor;
}
Expand All @@ -31,7 +31,7 @@ describe('Optimize sum of Lorentzians', () => {
});

it('positive maxima peaks', () => {
let initialPeaks: Peak[] = [
const initialPeaks: Peak[] = [
{
x: -0.52,
y: 0.9,
Expand All @@ -43,23 +43,22 @@ describe('Optimize sum of Lorentzians', () => {
shape: { kind: 'lorentzian' as const, fwhm: 0.08 },
},
];
let result = optimize(data, initialPeaks);
const result = optimize(data, initialPeaks);
for (let i = 0; i < 2; i++) {
expect(result.peaks[i]).toMatchCloseTo(peaks[i], 3);
}
});

it('shifted baseline up by two', () => {
let shiftedPeaks = JSON.parse(JSON.stringify(peaks));
const shiftedPeaks = JSON.parse(JSON.stringify(peaks));
for (const shiftedPeak of shiftedPeaks) {
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
shiftedPeak.y = shiftedPeak.y + 2;
}
let yShiftedData = {
const yShiftedData = {
x: data.x,
y: data.y.map((el: number) => el + 2),
};
let result = optimize(yShiftedData, [
const result = optimize(yShiftedData, [
{
x: -0.52,
y: 2.9,
Expand All @@ -77,11 +76,11 @@ describe('Optimize sum of Lorentzians', () => {
});

it('negative maxima peaks', () => {
let shiftedPeaks = JSON.parse(JSON.stringify(peaks));
const shiftedPeaks = JSON.parse(JSON.stringify(peaks));
for (const shiftedPeak of shiftedPeaks) {
shiftedPeak.y = shiftedPeak.y - 2;
}
let yShiftedPeaks = [
const yShiftedPeaks = [
{
x: -0.52,
y: -1,
Expand All @@ -94,12 +93,12 @@ describe('Optimize sum of Lorentzians', () => {
},
];

let yShiftedData = {
const yShiftedData = {
x: data.x.slice(),
y: data.y.map((el: number) => el - 2),
};

let result = optimize(yShiftedData, yShiftedPeaks);
const result = optimize(yShiftedData, yShiftedPeaks);
for (let i = 0; i < 2; i++) {
expect(result.peaks[i]).toMatchCloseTo(shiftedPeaks[i], 3);
}
Expand All @@ -124,7 +123,7 @@ describe('Optimize sum of Gaussians', () => {
});

it('positive maxima peaks', () => {
let peakList: Peak[] = [
const peakList: Peak[] = [
{
x: -0.52,
y: 0.9,
Expand All @@ -136,24 +135,24 @@ describe('Optimize sum of Gaussians', () => {
shape: { kind: 'gaussian' as const, fwhm: 0.08 },
},
];
let result = optimize(data, peakList);
const result = optimize(data, peakList);
for (let i = 0; i < 2; i++) {
expect(result.peaks[i]).toMatchCloseTo(peaks[i], 3);
}
});

it('negative maxima peaks', () => {
let shiftedPeaks = JSON.parse(JSON.stringify(peaks));
const shiftedPeaks = JSON.parse(JSON.stringify(peaks));
for (const shiftedPeak of shiftedPeaks) {
shiftedPeak.y = shiftedPeak.y - 2;
}

let yShiftedData = {
const yShiftedData = {
x: data.x.slice(),
y: data.y.map((el: number) => el - 2),
};

let result = optimize(
const result = optimize(
yShiftedData,
[
{
Expand Down Expand Up @@ -216,7 +215,7 @@ describe('Sum of Pseudo Voigts', () => {
});

it('positive maxima peaks', () => {
let peakList: Peak[] = [
const peakList: Peak[] = [
{
x: -0.3,
y: 0.0009,
Expand All @@ -236,7 +235,7 @@ describe('Sum of Pseudo Voigts', () => {
},
},
];
let result = optimize(data, peakList, {
const result = optimize(data, peakList, {
optimization: {
kind: 'lm',
options: { maxIterations: 100, damping: 0.5, errorTolerance: 1e-8 },
Expand Down
Loading

0 comments on commit 4dec6dc

Please sign in to comment.