Skip to content

Commit 9fa6f93

Browse files
committed
test: check peak picking for narrow peaks
1 parent 60be3a8 commit 9fa6f93

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/util/__tests__/peakPicking.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,28 @@ describe('peakPicking', () => {
7171
},
7272
});
7373
});
74+
75+
it('max=false, optimize=true, narrow peaks', () => {
76+
const narrowSpectrum = structuredClone(spectrum);
77+
narrowSpectrum.variables.x.data = narrowSpectrum.variables.x.data.map(
78+
(value) => value * 0.01,
79+
);
80+
const peak = peakPicking(narrowSpectrum, 0.06, {
81+
optimize: true,
82+
max: false,
83+
shape: { kind: 'gaussian', fwhm: 0.01 },
84+
});
85+
86+
expect(peak).toBeDeepCloseTo({
87+
x: 0.06,
88+
y: 0,
89+
z: 0,
90+
t: 0,
91+
optimized: {
92+
x: 0.0599663089533847,
93+
y: 2.80563493205562,
94+
shape: { kind: 'gaussian', fwhm: 0.03199263679459118 },
95+
},
96+
});
97+
});
7498
});

0 commit comments

Comments
 (0)