Skip to content

Commit 4e1c5d0

Browse files
committed
feat: add range in logs of optimization
1 parent db9f945 commit 4e1c5d0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/post/optimizePeaks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface OptimizePeaksOptions {
1313
*/
1414
shape?: Shape1D;
1515
/**
16-
* Number of times the width determining if the peaks have to be grouped and therefore optimized together
16+
* Number of times we should multiply the width determining if the peaks have to be grouped and therefore optimized together
1717
* @default 1
1818
*/
1919
groupingFactor?: number;

src/post/optimizePeaksWithLogs.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ export function optimizePeaksWithLogs(
6262
? data.y.subarray(fromIndex, toIndex)
6363
: data.y.slice(fromIndex, toIndex);
6464

65+
const log = {
66+
range: { from, to },
67+
parameters: optimization,
68+
groupSize: peakGroup.length,
69+
time: Date.now() - start,
70+
};
71+
6572
if (x.length > 5) {
6673
const {
6774
iterations,
@@ -81,20 +88,17 @@ export function optimizePeaksWithLogs(
8188
});
8289
}
8390
logs.push({
91+
...log,
8492
iterations,
8593
error,
86-
parameters: optimization,
8794
message: 'optimization successful',
88-
groupSize: peakGroup.length,
89-
time: `${Date.now() - start}ms`,
9095
});
9196
} else {
9297
results = results.concat(peaks);
9398
logs.push({
99+
...log,
94100
iterations: 0,
95101
message: 'x length too small for optimization',
96-
groupSize: peakGroup.length,
97-
time: `${Date.now() - start}ms`,
98102
});
99103
}
100104
});

0 commit comments

Comments
 (0)