Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"ml-array-mean": "^2.0.0",
"ml-array-median": "^2.0.0",
"ml-conrec": "^6.0.0",
"ml-gsd": "^14.2.0",
"ml-gsd": "^14.2.1",
"ml-signal-processing": "^2.2.2",
"ml-spectra-processing": "^14.29.1",
"ml-tree-similarity": "^2.2.0",
Expand Down
9 changes: 1 addition & 8 deletions src/component/panels/PeaksPanel/PeaksPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,7 @@ function PeaksPanelInner(props: PeaksPanelInnerProps) {
const filterPeaks = peaks.values.filter((peak) =>
isInRange(peak.x, { from, to }),
);
if (filterPeaks.length <= 15) {
dispatch({ type: 'OPTIMIZE_PEAKS', payload: { peaks: filterPeaks } });
} else {
toaster.show({
message: 'optimization can be done on no more than 15 peaks',
intent: 'danger',
});
}
dispatch({ type: 'OPTIMIZE_PEAKS', payload: { peaks: filterPeaks } });
};

function toggleViewProperty(key: keyof FilterType<PeaksViewState, boolean>) {
Expand Down
1 change: 1 addition & 0 deletions src/component/reducer/actions/RangesActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ function handleAutoRangesDetection(
broadWidth: 0.05,
thresholdFactor: 8,
minMaxRatio,
maxAbsoluteRatio: minMaxRatio,
direction: lookNegative ? 'both' : 'positive',
},
};
Expand Down
1 change: 1 addition & 0 deletions src/data/data1d/Spectrum1D/peaks/autoPeakPicking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function autoPeakPicking(
sensitivity: 100,
shape: defaultPeakShape,
noiseLevel: noise * noiseFactor,
maxAbsoluteRatio: minMaxRatio, // Threshold to determine if a given peak should be considered as a noise
minMaxRatio, // Threshold to determine if a given peak should be considered as a noise
realTopDetection: true,
smoothY: false,
Expand Down
65 changes: 35 additions & 30 deletions src/data/data1d/Spectrum1D/peaks/optimizePeaks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,105 +36,110 @@ export function optimizePeaks(
groupingFactor: 10,
stages: [
{
// Stage 1: local stabilization
factorLimits: 2,
maxNumberOfPeaks: 40,
optimization: {
kind: 'lm',
options: { maxIterations: 20, errorTolerance: 1e-3 },
},
parameters: {
fwhm: {
optimize: true,
min: (peak: any) => (peak.shape?.fwhm ?? 0) / 2,
min: (peak: any) => (peak.shape?.fwhm ?? 0) * 0.5,
max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
},
mu: { optimize: false },
x: { optimize: false },
y: {
optimize: true,
init: (peak: any) => peak.y * 0.8,
init: (peak: any) => peak.y,
},
},
},
{
factorLimits: 2,
maxNumberOfPeaks: 40,
optimization: {
kind: 'lm',
options: { maxIterations: 20, errorTolerance: 5e-4 },
options: { maxIterations: 20, errorTolerance: 1e-3 },
},
parameters: {
fwhm: {
optimize: true,
min: (peak: any) => (peak.shape?.fwhm ?? 0) / 2,
min: (peak: any) => (peak.shape?.fwhm ?? 0) * 0.5,
max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
},
mu: { optimize: false },
x: { optimize: false },
y: {
optimize: true,
init: (peak: any) => peak.y,
},
},
},
{
// Stage 2: regroup into the real overlapping cluster
factorLimits: 2,
maxNumberOfPeaks: 40,
optimization: {
kind: 'lm',
options: { maxIterations: 20, errorTolerance: 1e-5 },
options: { maxIterations: 25, errorTolerance: 1e-4 },
},
parameters: {
fwhm: {
optimize: true,
min: (peak: any) => (peak.shape?.fwhm ?? 0) / 2,
min: (peak: any) => (peak.shape?.fwhm ?? 0) * 0.5,
max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
},
mu: { optimize: true },
x: { optimize: false },
y: {
optimize: true,
},
y: { optimize: true },
},
},
{
// Stage 3: final polish
factorLimits: 2,
maxNumberOfPeaks: 40,
optimization: {
kind: 'lm',
options: { maxIterations: 20, errorTolerance: 5e-4 },
options: { maxIterations: 30, errorTolerance: 1e-5 },
},
parameters: {
fwhm: {
optimize: true,
min: (peak: any) => (peak.shape?.fwhm ?? 0) / 3,
max: (peak: any) => (peak.shape?.fwhm ?? 0) * 3,
min: (peak: any) => (peak.shape?.fwhm ?? 0) * 0.5,
max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
},
mu: { optimize: true },
x: { optimize: true },
y: { optimize: true },
},
},
{
optimization: {
kind: 'lm',
options: { maxIterations: 20, errorTolerance: 1e-4 },
},
parameters: {
fwhm: {
x: {
optimize: true,
min: (peak: any) => (peak.shape?.fwhm ?? 0) / 2,
max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
min: (peak: any) => peak.x - (peak.shape?.fwhm ?? 0) / 4,
max: (peak: any) => peak.x + (peak.shape?.fwhm ?? 0) / 4,
},
mu: { optimize: false },
x: { optimize: true },
y: { optimize: true },
},
},
{
// Stage 3: final polish
factorLimits: 2,
maxNumberOfPeaks: 40,
optimization: {
kind: 'lm',
options: { maxIterations: 20, errorTolerance: 1e-8 },
options: { maxIterations: 30, errorTolerance: 1e-5 },
},
parameters: {
fwhm: {
optimize: true,
min: (peak: any) => (peak.shape?.fwhm ?? 0) / 2,
min: (peak: any) => (peak.shape?.fwhm ?? 0) * 0.5,
max: (peak: any) => (peak.shape?.fwhm ?? 0) * 2,
},
mu: { optimize: true },
x: { optimize: true },
x: {
optimize: true,
min: (peak: any) => peak.x - (peak.shape?.fwhm ?? 0) / 4,
max: (peak: any) => peak.x + (peak.shape?.fwhm ?? 0) / 4,
},
y: { optimize: true },
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function detectSignalsByMultipletAnalysis(
to,
frequency,
minMaxRatio: 0.1,
maxAbsoluteRatio: 0.1,
broadWidth: 0.25,
broadRatio: 0.0025,
optimize: true,
Expand Down
Loading