nmrium 0.19.0 → 0.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/component/1d/Chart1D.js +3 -3
- package/lib/component/1d/ExclusionZoneAnnotation.d.ts +11 -0
- package/lib/component/1d/ExclusionZoneAnnotation.js +18 -0
- package/lib/component/1d/ExclusionZonesAnnotations.d.ts +3 -0
- package/lib/component/1d/ExclusionZonesAnnotations.js +28 -0
- package/lib/component/1d/Line.js +11 -23
- package/lib/component/1d/Viewer1D.js +36 -5
- package/lib/component/1d/ranges/Ranges.js +3 -3
- package/lib/component/1d/{BaseLineZones.d.ts → tool/BaseLineZones.d.ts} +0 -0
- package/lib/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
- package/lib/component/1d/utilities/useIntegralPath.js +9 -10
- package/lib/component/2d/Contours.js +12 -11
- package/lib/component/2d/Left1DChart.js +7 -9
- package/lib/component/2d/Top1DChart.js +7 -7
- package/lib/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
- package/lib/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
- package/lib/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib/component/EventsTrackers/KeysListenerTracker.js +12 -3
- package/lib/component/NMRium.d.ts +1 -1
- package/lib/component/NMRium.js +28 -25
- package/lib/component/elements/NumberInput.d.ts +1 -2
- package/lib/component/elements/Tab/Tab.js +1 -0
- package/lib/component/hooks/useActiveSpectrumStyleOptions.d.ts +6 -0
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +15 -0
- package/lib/component/hooks/useXYReduce.d.ts +2 -1
- package/lib/component/loader/DropZone.js +1 -1
- package/lib/component/modal/ModalStyle.js +5 -2
- package/lib/component/modal/MoleculeStructureEditorModal.js +3 -2
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -0
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +35 -0
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +49 -51
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -23
- package/lib/component/panels/Panels.js +10 -0
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +5 -5
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/Utilities.d.ts +7 -7
- package/lib/component/panels/ZonesPanel/ZonesTable.js +9 -2
- package/lib/component/reducer/Reducer.d.ts +11 -27
- package/lib/component/reducer/Reducer.js +4 -5
- package/lib/component/reducer/actions/CorrelationsActions.d.ts +7 -7
- package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -1
- package/lib/component/reducer/actions/FiltersActions.js +60 -18
- package/lib/component/reducer/actions/LoadActions.js +2 -3
- package/lib/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib/component/reducer/actions/PreferencesActions.js +4 -7
- package/lib/component/reducer/actions/RangesActions.js +1 -1
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -3
- package/lib/component/reducer/actions/ToolsActions.js +1 -30
- package/lib/component/reducer/helper/getRange.d.ts +6 -1
- package/lib/component/reducer/helper/getRange.js +1 -1
- package/lib/component/toolbar/FunctionToolBar.js +2 -5
- package/lib/component/utility/PathBuilder.d.ts +7 -0
- package/lib/component/utility/PathBuilder.js +17 -0
- package/lib/component/utility/getSpectraByNucleus.d.ts +3 -0
- package/lib/component/utility/getSpectraByNucleus.js +4 -0
- package/lib/data/Filters.d.ts +2 -1
- package/lib/data/Filters.js +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.d.ts +3 -2
- package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +23 -15
- package/lib/data/data1d/filter1d/exclusionZones.d.ts +16 -0
- package/lib/data/data1d/filter1d/exclusionZones.js +28 -0
- package/lib/data/types/data1d/ExclusionZone.d.ts +5 -0
- package/lib/data/types/data1d/ExclusionZone.js +1 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +3 -3
- package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +23 -0
- package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +52 -0
- package/lib-cjs/component/1d/Line.js +11 -23
- package/lib-cjs/component/1d/Viewer1D.js +36 -5
- package/lib-cjs/component/1d/ranges/Ranges.js +1 -1
- package/lib-cjs/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
- package/lib-cjs/component/1d/utilities/useIntegralPath.js +9 -10
- package/lib-cjs/component/2d/Contours.js +12 -11
- package/lib-cjs/component/2d/Left1DChart.js +7 -9
- package/lib-cjs/component/2d/Top1DChart.js +7 -7
- package/lib-cjs/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
- package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +2 -2
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +12 -3
- package/lib-cjs/component/NMRium.js +28 -25
- package/lib-cjs/component/elements/Tab/Tab.js +1 -0
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +21 -0
- package/lib-cjs/component/loader/DropZone.js +1 -1
- package/lib-cjs/component/modal/ModalStyle.js +5 -2
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +3 -2
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
- package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +40 -0
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +49 -51
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -22
- package/lib-cjs/component/panels/Panels.js +10 -0
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -1
- package/lib-cjs/component/reducer/Reducer.js +4 -5
- package/lib-cjs/component/reducer/actions/FiltersActions.js +62 -18
- package/lib-cjs/component/reducer/actions/LoadActions.js +2 -3
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +4 -7
- package/lib-cjs/component/reducer/actions/RangesActions.js +1 -1
- package/lib-cjs/component/reducer/actions/ToolsActions.js +1 -32
- package/lib-cjs/component/reducer/helper/getRange.js +1 -1
- package/lib-cjs/component/toolbar/FunctionToolBar.js +2 -5
- package/lib-cjs/component/utility/PathBuilder.js +21 -0
- package/lib-cjs/component/utility/getSpectraByNucleus.js +11 -0
- package/lib-cjs/data/Filters.js +3 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +24 -15
- package/lib-cjs/data/data1d/filter1d/exclusionZones.js +34 -0
- package/lib-cjs/data/types/data1d/ExclusionZone.js +2 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +28 -29
- package/lib/component/1d/ExclusionZone.d.ts +0 -8
- package/lib/component/1d/ExclusionZone.js +0 -30
- package/lib/component/1d/ExclusionZones.d.ts +0 -2
- package/lib/component/1d/ExclusionZones.js +0 -10
- package/lib-cjs/component/1d/ExclusionZone.js +0 -32
- package/lib-cjs/component/1d/ExclusionZones.js +0 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import {
|
|
2
|
+
import { CorrelationData } from 'nmr-correlation';
|
|
3
3
|
import { SpectraAnalysis } from '../../data/data1d/MultipleAnalysis';
|
|
4
4
|
import { Molecule } from '../../data/molecules/Molecule';
|
|
5
5
|
import { Range } from '../../data/types/data1d';
|
|
@@ -20,11 +20,6 @@ export interface Margin {
|
|
|
20
20
|
left: number;
|
|
21
21
|
}
|
|
22
22
|
export declare const initialState: State;
|
|
23
|
-
export interface ExclusionZoneState {
|
|
24
|
-
id: string;
|
|
25
|
-
from: number;
|
|
26
|
-
to: number;
|
|
27
|
-
}
|
|
28
23
|
export declare type VerticalAlignment = 'bottom' | 'center' | 'stack';
|
|
29
24
|
export interface VerticalAlign {
|
|
30
25
|
align: VerticalAlignment;
|
|
@@ -164,7 +159,7 @@ export interface State {
|
|
|
164
159
|
/**
|
|
165
160
|
* Correlation data
|
|
166
161
|
*/
|
|
167
|
-
correlations:
|
|
162
|
+
correlations: CorrelationData;
|
|
168
163
|
/**
|
|
169
164
|
* Zoom Manager for vertical scale for spectra, integral, And undo zoom in per tab (nucleus)
|
|
170
165
|
* @default {history: {},spectra: {},integral: {}}
|
|
@@ -203,10 +198,6 @@ export interface State {
|
|
|
203
198
|
* list of zones for Baseline correction filter
|
|
204
199
|
*/
|
|
205
200
|
baseLineZones: any;
|
|
206
|
-
/**
|
|
207
|
-
* list of exclusive zones per nucleus
|
|
208
|
-
*/
|
|
209
|
-
exclusionZones: Record<string, Array<ExclusionZoneState>>;
|
|
210
201
|
/**
|
|
211
202
|
* pivot point for manual phase correction
|
|
212
203
|
* @default {value:0,index:0}
|
|
@@ -323,9 +314,6 @@ export declare const spectrumReducer: (base: {
|
|
|
323
314
|
readonly id: string;
|
|
324
315
|
readonly originalX: number;
|
|
325
316
|
readonly kind?: string | undefined;
|
|
326
|
-
readonly x: number;
|
|
327
|
-
readonly y: number;
|
|
328
|
-
readonly width: number;
|
|
329
317
|
readonly fwhm?: number | undefined;
|
|
330
318
|
readonly shape?: {
|
|
331
319
|
readonly kind: "gaussian";
|
|
@@ -339,6 +327,9 @@ export declare const spectrumReducer: (base: {
|
|
|
339
327
|
readonly fwhm?: number | undefined;
|
|
340
328
|
readonly mu?: number | undefined;
|
|
341
329
|
} | undefined;
|
|
330
|
+
readonly x: number;
|
|
331
|
+
readonly y: number;
|
|
332
|
+
readonly width: number;
|
|
342
333
|
}[];
|
|
343
334
|
readonly options: any;
|
|
344
335
|
};
|
|
@@ -388,9 +379,6 @@ export declare const spectrumReducer: (base: {
|
|
|
388
379
|
readonly integration?: number | undefined;
|
|
389
380
|
readonly peaks?: readonly {
|
|
390
381
|
readonly kind?: string | undefined;
|
|
391
|
-
readonly x: number;
|
|
392
|
-
readonly y: number;
|
|
393
|
-
readonly width: number;
|
|
394
382
|
readonly fwhm?: number | undefined;
|
|
395
383
|
readonly shape?: {
|
|
396
384
|
readonly kind: "gaussian";
|
|
@@ -404,6 +392,9 @@ export declare const spectrumReducer: (base: {
|
|
|
404
392
|
readonly fwhm?: number | undefined;
|
|
405
393
|
readonly mu?: number | undefined;
|
|
406
394
|
} | undefined;
|
|
395
|
+
readonly x: number;
|
|
396
|
+
readonly y: number;
|
|
397
|
+
readonly width: number;
|
|
407
398
|
}[] | undefined;
|
|
408
399
|
readonly statistic?: {
|
|
409
400
|
readonly mean: number;
|
|
@@ -718,13 +709,6 @@ export declare const spectrumReducer: (base: {
|
|
|
718
709
|
readonly selectedOptionPanel: string | null;
|
|
719
710
|
readonly data: {
|
|
720
711
|
readonly baseLineZones: any;
|
|
721
|
-
readonly exclusionZones: {
|
|
722
|
-
readonly [x: string]: readonly {
|
|
723
|
-
readonly id: string;
|
|
724
|
-
readonly from: number;
|
|
725
|
-
readonly to: number;
|
|
726
|
-
}[];
|
|
727
|
-
};
|
|
728
712
|
readonly pivot: {
|
|
729
713
|
readonly value: number;
|
|
730
714
|
readonly index: number;
|
|
@@ -757,9 +741,6 @@ export declare const spectrumReducer: (base: {
|
|
|
757
741
|
readonly integration?: number | undefined;
|
|
758
742
|
readonly peaks?: readonly {
|
|
759
743
|
readonly kind?: string | undefined;
|
|
760
|
-
readonly x: number;
|
|
761
|
-
readonly y: number;
|
|
762
|
-
readonly width: number;
|
|
763
744
|
readonly fwhm?: number | undefined;
|
|
764
745
|
readonly shape?: {
|
|
765
746
|
readonly kind: "gaussian";
|
|
@@ -773,6 +754,9 @@ export declare const spectrumReducer: (base: {
|
|
|
773
754
|
readonly fwhm?: number | undefined;
|
|
774
755
|
readonly mu?: number | undefined;
|
|
775
756
|
} | undefined;
|
|
757
|
+
readonly x: number;
|
|
758
|
+
readonly y: number;
|
|
759
|
+
readonly width: number;
|
|
776
760
|
}[] | undefined;
|
|
777
761
|
readonly statistic?: {
|
|
778
762
|
readonly mean: number;
|
|
@@ -85,7 +85,6 @@ export const initialState = {
|
|
|
85
85
|
selectedOptionPanel: null,
|
|
86
86
|
data: {
|
|
87
87
|
baseLineZones: [],
|
|
88
|
-
exclusionZones: {},
|
|
89
88
|
pivot: { value: 0, index: 0 },
|
|
90
89
|
zonesNoiseFactor: 1,
|
|
91
90
|
activeFilterID: null,
|
|
@@ -249,6 +248,10 @@ function innerSpectrumReducer(draft, action) {
|
|
|
249
248
|
return FiltersActions.filterSnapshotHandler(draft, action);
|
|
250
249
|
case types.APPLY_MULTIPLE_SPECTRA_FILTER:
|
|
251
250
|
return FiltersActions.handleMultipleSpectraFilter(draft, action);
|
|
251
|
+
case types.ADD_EXCLUSION_ZONE:
|
|
252
|
+
return FiltersActions.handleAddExclusionZone(draft, action);
|
|
253
|
+
case types.DELETE_EXCLUSION_ZONE:
|
|
254
|
+
return FiltersActions.handleDeleteExclusionZone(draft, action);
|
|
252
255
|
case types.CHANGE_VISIBILITY:
|
|
253
256
|
return SpectrumsActions.handleSpectrumVisibility(draft, action);
|
|
254
257
|
case types.CHANGE_PEAKS_MARKERS_VISIBILITY:
|
|
@@ -349,10 +352,6 @@ function innerSpectrumReducer(draft, action) {
|
|
|
349
352
|
return ToolsActions.handleAddBaseLineZone(draft, action.zone);
|
|
350
353
|
case types.DELETE_BASE_LINE_ZONE:
|
|
351
354
|
return ToolsActions.handleDeleteBaseLineZone(draft, action.id);
|
|
352
|
-
case types.ADD_EXCLUSION_ZONE:
|
|
353
|
-
return ToolsActions.handleAddExclusionZone(draft, action);
|
|
354
|
-
case types.DELETE_EXCLUSION_ZONE:
|
|
355
|
-
return ToolsActions.handleDeleteExclusionZone(draft, action);
|
|
356
355
|
case types.APPLY_BASE_LINE_CORRECTION_FILTER:
|
|
357
356
|
return FiltersActions.handleBaseLineCorrectionFilter(draft, action);
|
|
358
357
|
case types.SET_KEY_PREFERENCES:
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
-
import {
|
|
2
|
+
import { Tolerance, Options as CorrelationOptions, Correlation, Values as CorrelationValues } from 'nmr-correlation';
|
|
3
3
|
import { State } from '../Reducer';
|
|
4
4
|
declare function handleUpdateCorrelations(draft: Draft<State>): void;
|
|
5
5
|
declare function handleSetMF(draft: Draft<State>, payload: {
|
|
6
6
|
mf: string;
|
|
7
7
|
}): void;
|
|
8
8
|
declare function handleSetTolerance(draft: Draft<State>, payload: {
|
|
9
|
-
tolerance:
|
|
9
|
+
tolerance: Tolerance;
|
|
10
10
|
}): void;
|
|
11
11
|
declare function handleSetCorrelation(draft: Draft<State>, payload: {
|
|
12
12
|
id: string;
|
|
13
|
-
correlation:
|
|
14
|
-
options:
|
|
13
|
+
correlation: Correlation;
|
|
14
|
+
options: CorrelationOptions;
|
|
15
15
|
}): void;
|
|
16
16
|
declare function handleSetCorrelations(draft: Draft<State>, payload: {
|
|
17
|
-
correlations:
|
|
18
|
-
options:
|
|
17
|
+
correlations: CorrelationValues;
|
|
18
|
+
options: CorrelationOptions;
|
|
19
19
|
}): void;
|
|
20
20
|
declare function handleDeleteCorrelation(draft: Draft<State>, payload: {
|
|
21
|
-
correlation:
|
|
21
|
+
correlation: Correlation;
|
|
22
22
|
assignmentData: any;
|
|
23
23
|
}): void;
|
|
24
24
|
export { handleDeleteCorrelation, handleSetCorrelation, handleSetCorrelations, handleSetMF, handleSetTolerance, handleUpdateCorrelations, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { original } from 'immer';
|
|
2
2
|
import lodashCloneDeep from 'lodash/cloneDeep';
|
|
3
|
-
import { buildCorrelationData, setCorrelation } from 'nmr-correlation';
|
|
3
|
+
import { buildCorrelationData, setCorrelation, } from 'nmr-correlation';
|
|
4
4
|
import { findRange, findSignal1D, findSignal2D, findSpectrum, findZone, } from '../../../data/utilities/FindUtilities';
|
|
5
5
|
import { handleDeleteSignal as handleDeleteSignal1D } from './RangesActions';
|
|
6
6
|
import { handleDeleteSignal as handleDeleteSignal2D } from './ZonesActions';
|
|
@@ -29,4 +29,6 @@ declare function resetSpectrumByFilter(draft: any, id?: string | null, options?:
|
|
|
29
29
|
}, activeSpectrum?: ActiveSpectrum | null): any;
|
|
30
30
|
declare function filterSnapshotHandler(draft: Draft<State>, action: any): void;
|
|
31
31
|
declare function handleMultipleSpectraFilter(draft: Draft<State>, action: any): void;
|
|
32
|
-
|
|
32
|
+
declare function handleAddExclusionZone(draft: Draft<State>, action: any): void;
|
|
33
|
+
declare function handleDeleteExclusionZone(draft: Draft<State>, action: any): void;
|
|
34
|
+
export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, resetSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, };
|
|
@@ -5,8 +5,11 @@ import { updateXShift } from '../../../data/data1d/Spectrum1D';
|
|
|
5
5
|
import { apply as autoPhaseCorrection } from '../../../data/data1d/filter1d/autoPhaseCorrection';
|
|
6
6
|
import { apply as phaseCorrection } from '../../../data/data1d/filter1d/phaseCorrection';
|
|
7
7
|
import { updateShift as update2dShift } from '../../../data/data2d/Spectrum2D';
|
|
8
|
+
import generateID from '../../../data/utilities/generateID';
|
|
9
|
+
import { getSpectraByNucleus } from '../../utility/getSpectraByNucleus';
|
|
8
10
|
import nucleusToString from '../../utility/nucleusToString';
|
|
9
11
|
import zoomHistoryManager from '../helper/ZoomHistoryManager';
|
|
12
|
+
import getRange from '../helper/getRange';
|
|
10
13
|
import { setDomain, setMode } from './DomainActions';
|
|
11
14
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
12
15
|
import { resetSelectedTool } from './ToolsActions';
|
|
@@ -243,25 +246,64 @@ function filterSnapshotHandler(draft, action) {
|
|
|
243
246
|
resetSpectrumByFilter(draft, action.id);
|
|
244
247
|
}
|
|
245
248
|
function handleMultipleSpectraFilter(draft, action) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
FiltersManager.applyFilter(datum, filters);
|
|
262
|
-
}
|
|
249
|
+
const spectra = getSpectraByNucleus(draft.activeTab, draft.data);
|
|
250
|
+
if (spectra && spectra.length > 0 && Array.isArray(action.payload)) {
|
|
251
|
+
const exclusions = spectra[0].filters.find((f) => f.name === Filters.exclusionZones.id)
|
|
252
|
+
?.value || [];
|
|
253
|
+
for (const spectrum of spectra) {
|
|
254
|
+
const filters = action.payload.map((filter) => {
|
|
255
|
+
if (filter.name === Filters.equallySpaced.id) {
|
|
256
|
+
return {
|
|
257
|
+
...filter,
|
|
258
|
+
options: { ...filter.options, exclusions },
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
return filter;
|
|
262
|
+
});
|
|
263
|
+
FiltersManager.applyFilter(spectrum, filters);
|
|
263
264
|
}
|
|
264
265
|
}
|
|
265
266
|
setDomain(draft);
|
|
266
267
|
}
|
|
267
|
-
|
|
268
|
+
function handleAddExclusionZone(draft, action) {
|
|
269
|
+
const { from: startX, to: endX } = action.payload;
|
|
270
|
+
const range = getRange(draft, { startX, endX });
|
|
271
|
+
let spectra;
|
|
272
|
+
if (draft.activeSpectrum?.id) {
|
|
273
|
+
const index = draft.activeSpectrum?.index;
|
|
274
|
+
spectra = [draft.data[index]];
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
spectra = getSpectraByNucleus(draft.activeTab, draft.data);
|
|
278
|
+
}
|
|
279
|
+
for (const spectrum of spectra) {
|
|
280
|
+
FiltersManager.applyFilter(spectrum, [
|
|
281
|
+
{
|
|
282
|
+
name: Filters.exclusionZones.id,
|
|
283
|
+
options: [
|
|
284
|
+
{
|
|
285
|
+
id: generateID(),
|
|
286
|
+
from: range[0],
|
|
287
|
+
to: range[1],
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
},
|
|
291
|
+
]);
|
|
292
|
+
}
|
|
293
|
+
setDomain(draft);
|
|
294
|
+
}
|
|
295
|
+
function handleDeleteExclusionZone(draft, action) {
|
|
296
|
+
const { id, spectrumID } = action.payload;
|
|
297
|
+
const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
|
|
298
|
+
const exclusionZonesFilter = draft.data[spectrumIndex].filters.find((filter) => filter.name === Filters.exclusionZones.id);
|
|
299
|
+
if (exclusionZonesFilter) {
|
|
300
|
+
if (exclusionZonesFilter.value.length === 1) {
|
|
301
|
+
FiltersManager.deleteFilter(draft.data[spectrumIndex], exclusionZonesFilter.id);
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
exclusionZonesFilter.value = exclusionZonesFilter.value.filter((zone) => zone.id !== id);
|
|
305
|
+
FiltersManager.reapplyFilters(draft.data[spectrumIndex]);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
export { shiftSpectrumAlongXAxis, applyZeroFillingFilter, applyFFTFilter, applyManualPhaseCorrectionFilter, applyAutoPhaseCorrectionFilter, applyAbsoluteFilter, calculateManualPhaseCorrection, handleMultipleSpectraFilter, enableFilter, deleteFilter, deleteSpectraFilter, handleBaseLineCorrectionFilter, filterSnapshotHandler, resetSpectrumByFilter, handleAddExclusionZone, handleDeleteExclusionZone, };
|
|
@@ -12,17 +12,16 @@ function setColors(draft, colors) {
|
|
|
12
12
|
draft.usedColors['2d'] = draft.usedColors['2d'].concat(colors['2d']);
|
|
13
13
|
}
|
|
14
14
|
function setData(draft, data) {
|
|
15
|
-
const { spectra, molecules, correlations,
|
|
15
|
+
const { spectra, molecules, correlations, usedColors } = data || {
|
|
16
16
|
spectra: [],
|
|
17
17
|
molecules: [],
|
|
18
18
|
correlations: {},
|
|
19
19
|
multipleAnalysis: {},
|
|
20
|
-
exclusionZones:
|
|
20
|
+
exclusionZones: [],
|
|
21
21
|
};
|
|
22
22
|
setColors(draft, usedColors);
|
|
23
23
|
draft.data = spectra;
|
|
24
24
|
draft.molecules = MoleculeManager.fromJSON(molecules);
|
|
25
|
-
draft.toolOptions.data.exclusionZones = exclusionZones;
|
|
26
25
|
if (!correlations || Object.keys(correlations).length === 0) {
|
|
27
26
|
draft.correlations = buildCorrelationData([], {
|
|
28
27
|
tolerance: DefaultTolerance,
|
|
@@ -13,8 +13,8 @@ function addMoleculeHandler(draft, molfile) {
|
|
|
13
13
|
* if it's the first creation of a molecule after the molecules list was empty,
|
|
14
14
|
* set the relative sum for ranges and integrals base on the first molecule
|
|
15
15
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const molecule = draft.molecules[0] || null;
|
|
17
|
+
if (isEmpty && molecule) {
|
|
18
18
|
changeSpectraRelativeSum(draft, molecule.key, molecule);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { original } from 'immer';
|
|
2
1
|
import cloneDeep from 'lodash/cloneDeep';
|
|
3
2
|
import GroupByInfoKey from '../../utility/GroupByInfoKey';
|
|
4
3
|
import nucleusToString from '../../utility/nucleusToString';
|
|
@@ -43,8 +42,7 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
function setKeyPreferencesHandler(draft, keyCode) {
|
|
46
|
-
const
|
|
47
|
-
const { activeTab, data, activeSpectrum, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, tabActiveSpectrum, } = state;
|
|
45
|
+
const { activeTab, data, activeSpectrum, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, tabActiveSpectrum, } = draft;
|
|
48
46
|
if (activeTab) {
|
|
49
47
|
const groupByNucleus = GroupByInfoKey('nucleus');
|
|
50
48
|
const spectrumsGroupsList = groupByNucleus(data);
|
|
@@ -81,11 +79,10 @@ function setKeyPreferencesHandler(draft, keyCode) {
|
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
function applyKeyPreferencesHandler(draft, keyCode) {
|
|
84
|
-
const
|
|
85
|
-
const preferences = state.keysPreferences[keyCode];
|
|
82
|
+
const preferences = draft.keysPreferences[keyCode];
|
|
86
83
|
if (preferences) {
|
|
87
84
|
draft.activeTab = preferences.activeTab;
|
|
88
|
-
|
|
85
|
+
draft.data.forEach((datum, index) => {
|
|
89
86
|
if (nucleusToString(datum.info.nucleus) === preferences.activeTab) {
|
|
90
87
|
draft.data[index].display = Object.assign(cloneDeep(datum.display), preferences.data[datum.id].display);
|
|
91
88
|
}
|
|
@@ -103,7 +100,7 @@ function applyKeyPreferencesHandler(draft, keyCode) {
|
|
|
103
100
|
if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
104
101
|
for (const datumID of Object.keys(preferences.level)) {
|
|
105
102
|
const { levelPositive, levelNegative } = preferences.level[datumID];
|
|
106
|
-
const index =
|
|
103
|
+
const index = draft.data.findIndex((datum) => datum.id === datumID);
|
|
107
104
|
const processController = draft.data[index]
|
|
108
105
|
.processingController;
|
|
109
106
|
processController.setLevel(levelPositive, levelNegative);
|
|
@@ -202,7 +202,7 @@ function handleChangeRangeSum(draft, options) {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
function handleAddRange(draft, action) {
|
|
205
|
-
const { startX, endX } = action;
|
|
205
|
+
const { startX, endX } = action.payload;
|
|
206
206
|
const { activeSpectrum, activeTab: nucleus, molecules } = draft;
|
|
207
207
|
const range = getRange(draft, { startX, endX });
|
|
208
208
|
if (activeSpectrum?.id) {
|
|
@@ -30,6 +30,4 @@ declare function levelChangeHandler(draft: Draft<State>, { deltaY, shiftKey }: {
|
|
|
30
30
|
}): void;
|
|
31
31
|
declare function setSpectraSameTopHandler(draft: Draft<State>): void;
|
|
32
32
|
declare function resetSpectraScale(draft: Draft<State>): void;
|
|
33
|
-
|
|
34
|
-
declare function handleDeleteExclusionZone(draft: Draft<State>, action: any): void;
|
|
35
|
-
export { resetSelectedTool, setSelectedTool, setSelectedOptionPanel, setSpectrumsVerticalAlign, handleChangeSpectrumDisplayMode, handleAddBaseLineZone, handleDeleteBaseLineZone, handleToggleRealImaginaryVisibility, handleBrushEnd, setVerticalIndicatorXPosition, handleZoom, zoomOut, handelSetActiveTab, levelChangeHandler, setActiveTab, setTab, setSpectraSameTopHandler, resetSpectraScale, handleAddExclusionZone, handleDeleteExclusionZone, };
|
|
33
|
+
export { resetSelectedTool, setSelectedTool, setSelectedOptionPanel, setSpectrumsVerticalAlign, handleChangeSpectrumDisplayMode, handleAddBaseLineZone, handleDeleteBaseLineZone, handleToggleRealImaginaryVisibility, handleBrushEnd, setVerticalIndicatorXPosition, handleZoom, zoomOut, handelSetActiveTab, levelChangeHandler, setActiveTab, setTab, setSpectraSameTopHandler, resetSpectraScale, };
|
|
@@ -450,33 +450,4 @@ function resetSpectraScale(draft) {
|
|
|
450
450
|
draft.yDomain = draft.originDomain.yDomain;
|
|
451
451
|
setZoom(draft, { scale: 0.8 });
|
|
452
452
|
}
|
|
453
|
-
|
|
454
|
-
const { from, to } = action.payload;
|
|
455
|
-
const scaleX = getXScale(draft);
|
|
456
|
-
const start = scaleX.invert(from);
|
|
457
|
-
const end = scaleX.invert(to);
|
|
458
|
-
let zone = [];
|
|
459
|
-
if (start > end) {
|
|
460
|
-
zone = [end, start];
|
|
461
|
-
}
|
|
462
|
-
else {
|
|
463
|
-
zone = [start, end];
|
|
464
|
-
}
|
|
465
|
-
const newExclusionZone = {
|
|
466
|
-
id: generateID(),
|
|
467
|
-
from: zone[0],
|
|
468
|
-
to: zone[1],
|
|
469
|
-
};
|
|
470
|
-
if (draft.toolOptions.data.exclusionZones[draft.activeTab]) {
|
|
471
|
-
draft.toolOptions.data.exclusionZones[draft.activeTab].push(newExclusionZone);
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
draft.toolOptions.data.exclusionZones[draft.activeTab] = [newExclusionZone];
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
function handleDeleteExclusionZone(draft, action) {
|
|
478
|
-
const id = action.payload.id;
|
|
479
|
-
const index = draft.toolOptions.data.exclusionZones[draft.activeTab].findIndex((zone) => zone.id === id);
|
|
480
|
-
draft.toolOptions.data.exclusionZones[draft.activeTab].splice(index, 1);
|
|
481
|
-
}
|
|
482
|
-
export { resetSelectedTool, setSelectedTool, setSelectedOptionPanel, setSpectrumsVerticalAlign, handleChangeSpectrumDisplayMode, handleAddBaseLineZone, handleDeleteBaseLineZone, handleToggleRealImaginaryVisibility, handleBrushEnd, setVerticalIndicatorXPosition, handleZoom, zoomOut, handelSetActiveTab, levelChangeHandler, setActiveTab, setTab, setSpectraSameTopHandler, resetSpectraScale, handleAddExclusionZone, handleDeleteExclusionZone, };
|
|
453
|
+
export { resetSelectedTool, setSelectedTool, setSelectedOptionPanel, setSpectrumsVerticalAlign, handleChangeSpectrumDisplayMode, handleAddBaseLineZone, handleDeleteBaseLineZone, handleToggleRealImaginaryVisibility, handleBrushEnd, setVerticalIndicatorXPosition, handleZoom, zoomOut, handelSetActiveTab, levelChangeHandler, setActiveTab, setTab, setSpectraSameTopHandler, resetSpectraScale, };
|
|
@@ -37,9 +37,6 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, displ
|
|
|
37
37
|
const isButtonVisible = useCallback((toolKey) => {
|
|
38
38
|
return !lodashGet(preferences, `display.toolBarButtons.${toolKey}`);
|
|
39
39
|
}, [preferences]);
|
|
40
|
-
const isPanelVisible = useCallback((panelKey) => {
|
|
41
|
-
return !lodashGet(preferences, `display.panels.${panelKey}`);
|
|
42
|
-
}, [preferences]);
|
|
43
40
|
return (_jsxs(_Fragment, { children: [_jsxs(ToggleButtonGroup, { value: option, onChange: handleChange, children: [isButtonVisible('hideZoomTool') && (_jsx(ToggleButton, { value: options.zoom.id, id: "zoomIn", title: `${options.zoom.label} ( Press z )`, children: _jsx("div", { style: { fontSize: 14 }, children: _jsx(FaSearchPlus, {}, void 0) }, void 0) }, options.zoom.id)), isButtonVisible('hideZoomOutTool') && (_jsx(Toolbar.Item, { id: "zoom-out", onClick: handleFullZoomOut, title: "Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )", children: _jsx("div", { style: { fontSize: 14 }, children: _jsx(FaExpand, {}, void 0) }, void 0) }, void 0)), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
44
41
|
isButtonVisible('hidePeakTool') && (_jsx(ToggleButton, { value: options.peakPicking.id, title: `${options.peakPicking.label} ( Press p )`, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "peakPicking", children: _jsx(SvgNmrPeakPicking, {}, void 0) }, options.peakPicking.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
45
42
|
isButtonVisible('hideIntegralTool') && (_jsx(ToggleButton, { value: options.integral.id, isVisible: activeSpectrum && !info?.isFid ? true : false, id: "integralPicking", title: `${options.integral.label} ( Press i )`, children: _jsx(SvgNmrIntegrate, {}, void 0) }, options.integral.id)), displayerMode === DISPLAYER_MODE.DM_2D &&
|
|
@@ -61,8 +58,8 @@ function FunctionToolBarInner({ defaultValue, activeSpectrum, info, datum, displ
|
|
|
61
58
|
? true
|
|
62
59
|
: false, children: _jsx(SvgNmrBaselineCorrection, {}, void 0) }, options.baseLineCorrection.id)), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
63
60
|
isButtonVisible('hideExclusionZonesTool') &&
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
!info?.isFid &&
|
|
62
|
+
ftCounter > 0 && (_jsx(ToggleButton, { value: options.exclusionZones.id, title: `${options.exclusionZones.label} ( Press e )`, id: "exclusionZones", children: _jsx("div", { style: { fontSize: 18 }, children: _jsx(SvgNmrMultipleAnalysis, {}, void 0) }, void 0) }, options.exclusionZones.id))] }, void 0), displayerMode === DISPLAYER_MODE.DM_1D &&
|
|
66
63
|
isButtonVisible('hideFFTTool') &&
|
|
67
64
|
info &&
|
|
68
65
|
Filters.fft.isApplicable({ info }) && (_jsx(Toolbar.Item, { id: "fft-filter", className: "cheminfo", title: "FFT Filter", onClick: handleOnFFTFilter, children: _jsx(SvgNmrFourierTransform, {}, void 0) }, void 0))] }, void 0));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class PathBuilder {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.array = [];
|
|
4
|
+
}
|
|
5
|
+
moveTo(x, y) {
|
|
6
|
+
this.array.push(`M ${x} ${y}`);
|
|
7
|
+
}
|
|
8
|
+
lineTo(x, y) {
|
|
9
|
+
this.array.push(`L ${x} ${y}`);
|
|
10
|
+
}
|
|
11
|
+
closePath() {
|
|
12
|
+
this.array.push('Z');
|
|
13
|
+
}
|
|
14
|
+
toString() {
|
|
15
|
+
return this.array.join(' ');
|
|
16
|
+
}
|
|
17
|
+
}
|
package/lib/data/Filters.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import * as baselineCorrection from './data1d/filter1d/baselineCorrection';
|
|
|
4
4
|
import * as centerMean from './data1d/filter1d/centerMean';
|
|
5
5
|
import * as digitalFilter from './data1d/filter1d/digitalFilter';
|
|
6
6
|
import * as equallySpaced from './data1d/filter1d/equallySpaced';
|
|
7
|
+
import * as exclusionZones from './data1d/filter1d/exclusionZones';
|
|
7
8
|
import * as fft from './data1d/filter1d/fft';
|
|
8
9
|
import * as fromTo from './data1d/filter1d/fromTo';
|
|
9
10
|
import * as lineBroadening from './data1d/filter1d/lineBroadening';
|
|
@@ -14,4 +15,4 @@ import * as standardDeviation from './data1d/filter1d/standardDeviation';
|
|
|
14
15
|
import * as zeroFilling from './data1d/filter1d/zeroFilling';
|
|
15
16
|
import * as shift2DX from './data2d/filter2d/shiftX';
|
|
16
17
|
import * as shift2DY from './data2d/filter2d/shiftY';
|
|
17
|
-
export { absolute, baselineCorrection, lineBroadening, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, shift2DX, shift2DY, };
|
|
18
|
+
export { absolute, baselineCorrection, lineBroadening, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
|
package/lib/data/Filters.js
CHANGED
|
@@ -4,6 +4,7 @@ import * as baselineCorrection from './data1d/filter1d/baselineCorrection';
|
|
|
4
4
|
import * as centerMean from './data1d/filter1d/centerMean';
|
|
5
5
|
import * as digitalFilter from './data1d/filter1d/digitalFilter';
|
|
6
6
|
import * as equallySpaced from './data1d/filter1d/equallySpaced';
|
|
7
|
+
import * as exclusionZones from './data1d/filter1d/exclusionZones';
|
|
7
8
|
import * as fft from './data1d/filter1d/fft';
|
|
8
9
|
import * as fromTo from './data1d/filter1d/fromTo';
|
|
9
10
|
import * as lineBroadening from './data1d/filter1d/lineBroadening';
|
|
@@ -14,4 +15,4 @@ import * as standardDeviation from './data1d/filter1d/standardDeviation';
|
|
|
14
15
|
import * as zeroFilling from './data1d/filter1d/zeroFilling';
|
|
15
16
|
import * as shift2DX from './data2d/filter2d/shiftX';
|
|
16
17
|
import * as shift2DY from './data2d/filter2d/shiftY';
|
|
17
|
-
export { absolute, baselineCorrection, lineBroadening, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, shift2DX, shift2DY, };
|
|
18
|
+
export { absolute, baselineCorrection, lineBroadening, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
|
|
@@ -9,14 +9,17 @@ export function addRange(datum, options) {
|
|
|
9
9
|
const { from, to, molecules, nucleus } = options;
|
|
10
10
|
const { x, re } = datum.data;
|
|
11
11
|
const absolute = xyIntegration({ x, y: re }, { from, to, reverse: true });
|
|
12
|
-
|
|
12
|
+
// detectSignal use the advance multiplet-analysis that can crash if too many points
|
|
13
|
+
const signal = detectSignal(x, re, from, to, datum.info.originFrequency);
|
|
14
|
+
if (!signal)
|
|
15
|
+
return;
|
|
13
16
|
try {
|
|
14
17
|
const range = {
|
|
15
18
|
id: generateID(),
|
|
16
19
|
from,
|
|
17
20
|
to,
|
|
18
21
|
absolute,
|
|
19
|
-
signals: [{ id: generateID(), ...
|
|
22
|
+
signals: [{ id: generateID(), ...signal }],
|
|
20
23
|
kind: DatumKind.signal,
|
|
21
24
|
integration: 0,
|
|
22
25
|
};
|
|
@@ -30,12 +30,17 @@ export default function autoRangesDetection(datum1D, options = {}) {
|
|
|
30
30
|
re = re.slice(windowFromIndex, windowToIndex);
|
|
31
31
|
}
|
|
32
32
|
if (originFrequency) {
|
|
33
|
-
|
|
33
|
+
// we calculate the number of points per Hz
|
|
34
|
+
let pointsPerHz = 1 / originFrequency / (x[1] - x[0]);
|
|
35
|
+
// we can consider a peak with of 0.5 Hz for the windowSize
|
|
36
|
+
let ws = Math.max(Math.round(pointsPerHz / 2), 5);
|
|
34
37
|
peakPickingOptions.sgOptions = {
|
|
35
38
|
windowSize: ws - (ws % 2) + 1,
|
|
36
39
|
polynomial: 3,
|
|
37
40
|
};
|
|
38
41
|
}
|
|
42
|
+
peakPickingOptions.smoothY = undefined;
|
|
43
|
+
peakPickingOptions.sgOptions = undefined;
|
|
39
44
|
const ranges = xyAutoRangesPicking({ x, y: re }, {
|
|
40
45
|
peakPicking: peakPickingOptions,
|
|
41
46
|
ranges: rangesOptions,
|
|
@@ -5,7 +5,6 @@ export function detectRange(datum, options) {
|
|
|
5
5
|
const { from, to } = options;
|
|
6
6
|
const { x, re: y } = datum.data;
|
|
7
7
|
const absolute = xyIntegration({ x, y }, { from, to, reverse: true });
|
|
8
|
-
// @ts-expect-error Types will be fixed in ml-spectra-processing.
|
|
9
8
|
const min = xyMinYPoint({ x, y }, { from, to }).y;
|
|
10
9
|
const max = xyMaxYPoint({ x, y }, { from, to }).y;
|
|
11
10
|
const shiftX = getShiftX(datum);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const MAX_LENGTH = 2048;
|
|
2
|
+
export default function detectSignal(x: Float64Array, re: Float64Array, from: any, to: any, frequency: any): {
|
|
2
3
|
multiplicity: any;
|
|
3
4
|
kind: string;
|
|
4
5
|
delta: any;
|
|
5
6
|
js: any;
|
|
6
|
-
};
|
|
7
|
+
} | undefined;
|
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
import { xGetFromToIndex } from 'ml-spectra-processing';
|
|
2
2
|
import { analyseMultiplet } from 'multiplet-analysis';
|
|
3
|
+
export const MAX_LENGTH = 2048;
|
|
3
4
|
export default function detectSignal(x, re, from, to, frequency) {
|
|
4
5
|
const { fromIndex, toIndex } = xGetFromToIndex(x, {
|
|
5
6
|
from: from,
|
|
6
7
|
to: to,
|
|
7
8
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
9
|
+
if (toIndex - fromIndex <= MAX_LENGTH) {
|
|
10
|
+
const data = {
|
|
11
|
+
x: x.subarray(fromIndex, toIndex),
|
|
12
|
+
y: re.subarray(fromIndex, toIndex),
|
|
13
|
+
};
|
|
14
|
+
const result = analyseMultiplet(data, {
|
|
15
|
+
frequency: frequency,
|
|
16
|
+
takeBestPartMultiplet: true,
|
|
17
|
+
symmetrizeEachStep: true,
|
|
18
|
+
});
|
|
19
|
+
if (result && result.chemShift === undefined)
|
|
20
|
+
return;
|
|
21
|
+
return {
|
|
22
|
+
multiplicity: result.js.map((j) => j.multiplicity).join(''),
|
|
23
|
+
kind: 'signal',
|
|
24
|
+
delta: result.chemShift,
|
|
25
|
+
js: result.js,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new Error(`length of signal should not exceed ${MAX_LENGTH} points`);
|
|
30
|
+
}
|
|
23
31
|
}
|