nmrium 0.30.0 → 0.32.0
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/ApodizationLine.js +3 -1
- package/lib/component/1d/FooterBanner.js +20 -11
- package/lib/component/1d/IntegralsSeries.js +3 -1
- package/lib/component/1d/LinesSeries.js +3 -1
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +3 -1
- package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib/component/1d/ranges/Ranges.js +8 -2
- package/lib/component/1d/tool/PeakPointer.js +3 -1
- package/lib/component/1d/tool/XLabelPointer.js +3 -1
- package/lib/component/2d/Contours.js +4 -2
- package/lib/component/2d/FooterBanner.js +3 -1
- package/lib/component/2d/Left1DChart.js +1 -1
- package/lib/component/2d/Top1DChart.js +1 -1
- package/lib/component/2d/Viewer2D.js +4 -4
- package/lib/component/2d/XAxis.js +2 -2
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib/component/2d/zones/IndicationLines.js +1 -1
- package/lib/component/2d/zones/Zones.js +14 -19
- package/lib/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/SplitPaneWrapper.js +1 -1
- package/lib/component/elements/EditableColumn.d.ts +3 -1
- package/lib/component/elements/EditableColumn.js +18 -3
- package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
- package/lib/component/elements/popup/Modal/Provider.js +8 -11
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
- package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib/component/hooks/useExport.d.ts +0 -1
- package/lib/component/hooks/useExport.js +1 -17
- package/lib/component/hooks/useIntegralPath.js +5 -2
- package/lib/component/hooks/useNucleus.js +4 -4
- package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib/component/hooks/useSpectrum.js +3 -1
- package/lib/component/loader/DropZone.js +15 -147
- package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +110 -96
- package/lib/component/reducer/Reducer.js +45 -41
- package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
- package/lib/component/reducer/actions/DomainActions.js +12 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +227 -232
- package/lib/component/reducer/actions/IntegralsActions.js +14 -8
- package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
- package/lib/component/reducer/actions/LoadActions.js +19 -34
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
- package/lib/component/reducer/actions/MoleculeActions.js +22 -6
- package/lib/component/reducer/actions/PeaksActions.js +19 -12
- package/lib/component/reducer/actions/PreferencesActions.js +9 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +4 -4
- package/lib/component/reducer/actions/RangesActions.js +89 -29
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +14 -10
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +44 -27
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +69 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -2
- package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/component/reducer/types/Types.d.ts +5 -0
- package/lib/component/reducer/types/Types.js +5 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib/component/toolbar/BasicToolBar.js +12 -13
- package/lib/component/toolbar/FunctionToolBar.js +3 -1
- package/lib/component/utility/Export.js +7 -1
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/Workspace.d.ts +1 -1
- package/lib/component/workspaces/exercise.js +9 -3
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/Filters.d.ts +1 -2
- package/lib/data/Filters.js +1 -2
- package/lib/data/SpectraManager.d.ts +0 -4
- package/lib/data/SpectraManager.js +2 -87
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib/data/data1d/filter1d/fft.js +11 -0
- package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
- package/lib/data/data2d/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +5 -0
- package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
- package/lib/data/utilities/calculateSanPlot.js +31 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +3 -1
- package/lib-cjs/component/1d/FooterBanner.js +19 -10
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
- package/lib-cjs/component/1d/LinesSeries.js +3 -1
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +3 -1
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
- package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
- package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
- package/lib-cjs/component/2d/Contours.js +4 -2
- package/lib-cjs/component/2d/FooterBanner.js +3 -1
- package/lib-cjs/component/2d/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/Top1DChart.js +1 -1
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/2d/XAxis.js +2 -2
- package/lib-cjs/component/2d/YAxis.js +2 -2
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
- package/lib-cjs/component/2d/zones/Zones.js +13 -18
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/SplitPaneWrapper.js +1 -1
- package/lib-cjs/component/elements/EditableColumn.js +18 -3
- package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +3 -3
- package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib-cjs/component/hooks/useExport.js +0 -16
- package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
- package/lib-cjs/component/hooks/useNucleus.js +4 -4
- package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib-cjs/component/hooks/useSpectrum.js +3 -1
- package/lib-cjs/component/loader/DropZone.js +14 -149
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
- package/lib-cjs/component/reducer/Reducer.js +48 -43
- package/lib-cjs/component/reducer/actions/DomainActions.js +12 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +228 -233
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +14 -8
- package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
- package/lib-cjs/component/reducer/actions/PeaksActions.js +19 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +9 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +89 -29
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -10
- package/lib-cjs/component/reducer/actions/ToolsActions.js +44 -27
- package/lib-cjs/component/reducer/actions/ZonesActions.js +72 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
- package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib-cjs/component/reducer/types/Types.js +8 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib-cjs/component/toolbar/BasicToolBar.js +11 -12
- package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
- package/lib-cjs/component/utility/Export.js +7 -1
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/exercise.js +9 -3
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib-cjs/data/Filters.js +1 -3
- package/lib-cjs/data/SpectraManager.js +3 -92
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
- package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +26 -25
- package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
- package/lib/component/utility/nmredataToNmrium.js +0 -66
- package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
- package/lib/component/utility/nmriumToNmredata.js +0 -80
- package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addRanges.js +0 -52
- package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
- package/lib/component/utility/util/nmredata/addSource.js +0 -54
- package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addZones.js +0 -41
- package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
- package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
- package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
- package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
- package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
- package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
- package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
- package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
- package/lib/component/utility/util/nmredata/getLabels.js +0 -66
- package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getToFix.js +0 -19
- package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
- package/lib/data/data1d/filter1d/absolute.js +0 -26
- package/lib/data/migration/MigrationManager.d.ts +0 -2
- package/lib/data/migration/MigrationManager.js +0 -19
- package/lib/data/migration/changeKeys.d.ts +0 -1
- package/lib/data/migration/changeKeys.js +0 -9
- package/lib/data/migration/migrateToVersion1.d.ts +0 -11
- package/lib/data/migration/migrateToVersion1.js +0 -32
- package/lib/data/migration/migrateToVersion2.d.ts +0 -1
- package/lib/data/migration/migrateToVersion2.js +0 -111
- package/lib/data/migration/migrateToVersion3.d.ts +0 -1
- package/lib/data/migration/migrateToVersion3.js +0 -55
- package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
- package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
- package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
- package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
- package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
- package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
- package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
- package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
- package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
- package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
- package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
- package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
- package/lib-cjs/data/migration/MigrationManager.js +0 -26
- package/lib-cjs/data/migration/changeKeys.js +0 -13
- package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
- package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
- package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { buildCorrelationData } from 'nmr-correlation';
|
|
2
|
-
import { addJcamps
|
|
2
|
+
import { addJcamps } from '../../../data/SpectraManager';
|
|
3
|
+
import { initiateDatum1D } from '../../../data/data1d/Spectrum1D';
|
|
4
|
+
import { initiateDatum2D } from '../../../data/data2d/Spectrum2D';
|
|
3
5
|
import * as MoleculeManager from '../../../data/molecules/MoleculeManager';
|
|
4
6
|
import { DefaultTolerance } from '../../panels/SummaryPanel/CorrelationTable/Constants';
|
|
5
7
|
import { getInitialState } from '../Reducer';
|
|
6
|
-
import { INITIATE, LOAD_JSON_FILE
|
|
8
|
+
import { INITIATE, LOAD_JSON_FILE } from '../types/Types';
|
|
7
9
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
8
10
|
import { setActiveTab } from './ToolsActions';
|
|
9
11
|
function setIsLoading(draft, isLoading) {
|
|
@@ -80,15 +82,6 @@ function initiate(draft, action) {
|
|
|
80
82
|
state.actionType = INITIATE;
|
|
81
83
|
return state;
|
|
82
84
|
}
|
|
83
|
-
function loadJDFFile(draft, actions) {
|
|
84
|
-
const { files } = actions;
|
|
85
|
-
const spectra = addJDFs(files, draft.usedColors);
|
|
86
|
-
for (const spectrum of spectra) {
|
|
87
|
-
draft.data.push(spectrum);
|
|
88
|
-
}
|
|
89
|
-
setActiveTab(draft);
|
|
90
|
-
draft.isLoading = false;
|
|
91
|
-
}
|
|
92
85
|
function loadJcampFile(draft, actions) {
|
|
93
86
|
const { files } = actions;
|
|
94
87
|
const spectra = addJcamps(files, draft.usedColors);
|
|
@@ -111,30 +104,22 @@ function handleLoadJsonFile(draft, action) {
|
|
|
111
104
|
state.actionType = LOAD_JSON_FILE;
|
|
112
105
|
return state;
|
|
113
106
|
}
|
|
114
|
-
function
|
|
115
|
-
const {
|
|
116
|
-
|
|
117
|
-
|
|
107
|
+
function loadDropFiles(draft, actions) {
|
|
108
|
+
const { data, usedColors } = actions;
|
|
109
|
+
const { spectra, molecules } = data;
|
|
110
|
+
for (let spectrum of spectra) {
|
|
111
|
+
const { info } = spectrum;
|
|
112
|
+
if (info.dimension === 1) {
|
|
113
|
+
draft.data.push(initiateDatum1D(spectrum, usedColors));
|
|
114
|
+
}
|
|
115
|
+
else if (info.dimension === 2) {
|
|
116
|
+
draft.data.push(initiateDatum2D(spectrum, usedColors));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
for (let molecule of molecules) {
|
|
120
|
+
MoleculeManager.addMolfile(draft.molecules, molecule.molfile);
|
|
118
121
|
}
|
|
119
|
-
draft.isLoading = false;
|
|
120
|
-
}
|
|
121
|
-
function handleLoadZIPFile(draft, action) {
|
|
122
|
-
const { data, usedColors } = action.payload;
|
|
123
|
-
draft.data = draft.data.concat(data);
|
|
124
|
-
setColors(draft, usedColors);
|
|
125
122
|
setActiveTab(draft);
|
|
126
|
-
changeSpectrumVerticalAlignment(draft, { align: 'auto-check' });
|
|
127
123
|
draft.isLoading = false;
|
|
128
124
|
}
|
|
129
|
-
|
|
130
|
-
const state = getInitialState();
|
|
131
|
-
setData(state, action.payload);
|
|
132
|
-
setActiveTab(state);
|
|
133
|
-
changeSpectrumVerticalAlignment(state, { align: 'auto-check' });
|
|
134
|
-
state.isLoading = false;
|
|
135
|
-
state.width = draft.width;
|
|
136
|
-
state.height = draft.height;
|
|
137
|
-
state.actionType = LOAD_NMREDATA_FILE;
|
|
138
|
-
return state;
|
|
139
|
-
}
|
|
140
|
-
export { setIsLoading, initiate, loadJcampFile, loadJDFFile, handleLoadJsonFile, handleLoadNmredata, handleLoadMOLFile, handleLoadZIPFile, };
|
|
125
|
+
export { setIsLoading, initiate, loadJcampFile, loadDropFiles, handleLoadJsonFile, };
|
|
@@ -5,5 +5,6 @@ declare function setMoleculeHandler(draft: Draft<State>, action: any): void;
|
|
|
5
5
|
declare function deleteMoleculeHandler(draft: Draft<State>, action: any): void;
|
|
6
6
|
declare function predictSpectraFromMoleculeHandler(draft: Draft<State>, action: any): void;
|
|
7
7
|
declare function floatMoleculeOverSpectrum(draft: Draft<State>, action: any): void;
|
|
8
|
+
declare function changeFloatMoleculePosition(draft: Draft<State>, action: any): void;
|
|
8
9
|
declare function changeMoleculeLabel(draft: Draft<State>, action: any): void;
|
|
9
|
-
export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeMoleculeLabel, };
|
|
10
|
+
export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeFloatMoleculePosition, changeMoleculeLabel, };
|
|
@@ -2,6 +2,7 @@ import { generateSpectra } from '../../../data/PredictionManager';
|
|
|
2
2
|
import { changeSpectraRelativeSum } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
3
3
|
import * as MoleculeManager from '../../../data/molecules/MoleculeManager';
|
|
4
4
|
import getColor from '../../../data/utilities/getColor';
|
|
5
|
+
import { DRAGGABLE_STRUCTURE_INITIAL_POSITION } from '../../tool/FloatMoleculeStructures/DraggableStructure';
|
|
5
6
|
import nucleusToString from '../../utility/nucleusToString';
|
|
6
7
|
import { DISPLAYER_MODE } from '../core/Constants';
|
|
7
8
|
import { handleUnlinkRange } from './RangesActions';
|
|
@@ -65,10 +66,11 @@ function predictSpectraFromMoleculeHandler(draft, action) {
|
|
|
65
66
|
const color = getColor(false, draft.usedColors['1d']);
|
|
66
67
|
for (const spectrum of generateSpectra(data, options, color)) {
|
|
67
68
|
draft.data.push(spectrum);
|
|
68
|
-
draft.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
draft.view.spectra.activeSpectra[nucleusToString(spectrum.info.nucleus)] =
|
|
70
|
+
{
|
|
71
|
+
id: spectrum.id,
|
|
72
|
+
index: draft.data.length - 1,
|
|
73
|
+
};
|
|
72
74
|
}
|
|
73
75
|
draft.usedColors['1d'].push(color);
|
|
74
76
|
}
|
|
@@ -84,7 +86,21 @@ function floatMoleculeOverSpectrum(draft, action) {
|
|
|
84
86
|
!draft.view.floatingMolecules[moleculeIndex].visible;
|
|
85
87
|
}
|
|
86
88
|
else {
|
|
87
|
-
draft.view.floatingMolecules.push({
|
|
89
|
+
draft.view.floatingMolecules.push({
|
|
90
|
+
id,
|
|
91
|
+
visible: true,
|
|
92
|
+
position: DRAGGABLE_STRUCTURE_INITIAL_POSITION,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function changeFloatMoleculePosition(draft, action) {
|
|
97
|
+
const { id, position } = action.payload;
|
|
98
|
+
const molecule = draft.view.floatingMolecules.find((m) => m.id === id);
|
|
99
|
+
if (molecule) {
|
|
100
|
+
molecule.position = position;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
throw new Error(`Molecule ${id} does not exist`);
|
|
88
104
|
}
|
|
89
105
|
}
|
|
90
106
|
function changeMoleculeLabel(draft, action) {
|
|
@@ -92,4 +108,4 @@ function changeMoleculeLabel(draft, action) {
|
|
|
92
108
|
const moleculeIndex = draft.molecules.findIndex((molecule) => molecule.id === id);
|
|
93
109
|
draft.molecules[moleculeIndex].label = label;
|
|
94
110
|
}
|
|
95
|
-
export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeMoleculeLabel, };
|
|
111
|
+
export { addMoleculeHandler, setMoleculeHandler, deleteMoleculeHandler, predictSpectraFromMoleculeHandler, floatMoleculeOverSpectrum, changeFloatMoleculePosition, changeMoleculeLabel, };
|
|
@@ -3,11 +3,13 @@ import { original } from 'immer';
|
|
|
3
3
|
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
4
4
|
import { getShiftX, lookupPeak, autoPeakPicking, optimizePeaks, } from '../../../data/data1d/Spectrum1D';
|
|
5
5
|
import { options } from '../../toolbar/ToolTypes';
|
|
6
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
6
7
|
import getRange from '../helper/getRange';
|
|
7
8
|
function addPeak(draft, mouseCoordinates) {
|
|
9
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
8
10
|
const state = original(draft);
|
|
9
|
-
if (
|
|
10
|
-
const { index } =
|
|
11
|
+
if (activeSpectrum?.id && state) {
|
|
12
|
+
const { index } = activeSpectrum;
|
|
11
13
|
const xShift = 10;
|
|
12
14
|
const startX = mouseCoordinates.x - xShift;
|
|
13
15
|
const endX = mouseCoordinates.x + xShift;
|
|
@@ -31,8 +33,9 @@ function addPeak(draft, mouseCoordinates) {
|
|
|
31
33
|
}
|
|
32
34
|
function addPeaks(draft, action) {
|
|
33
35
|
const state = original(draft);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
37
|
+
if (activeSpectrum) {
|
|
38
|
+
const { index } = activeSpectrum;
|
|
36
39
|
const datumOriginal = state.data[index];
|
|
37
40
|
const { startX, endX } = action;
|
|
38
41
|
const [from, to] = getRange(draft, { startX, endX });
|
|
@@ -53,8 +56,9 @@ function addPeaks(draft, action) {
|
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
function deletePeak(draft, peakData) {
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
60
|
+
if (activeSpectrum) {
|
|
61
|
+
const { index } = activeSpectrum;
|
|
58
62
|
const state = original(draft);
|
|
59
63
|
if (peakData == null) {
|
|
60
64
|
draft.data[index].peaks.values = [];
|
|
@@ -67,8 +71,9 @@ function deletePeak(draft, peakData) {
|
|
|
67
71
|
}
|
|
68
72
|
function handleOptimizePeaks(draft, action) {
|
|
69
73
|
const { peaks } = action.payload;
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
75
|
+
if (activeSpectrum?.id) {
|
|
76
|
+
const { index } = activeSpectrum;
|
|
72
77
|
const datum = draft.data[index];
|
|
73
78
|
const [from, to] = draft.xDomain;
|
|
74
79
|
const newPeaks = optimizePeaks(draft.data[index], {
|
|
@@ -80,10 +85,11 @@ function handleOptimizePeaks(draft, action) {
|
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
87
|
function handleAutoPeakPicking(draft, autOptions) {
|
|
83
|
-
|
|
88
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
89
|
+
if (activeSpectrum?.id) {
|
|
84
90
|
draft.toolOptions.selectedTool = options.zoom.id;
|
|
85
91
|
draft.toolOptions.selectedOptionPanel = null;
|
|
86
|
-
const { index } =
|
|
92
|
+
const { index } = activeSpectrum;
|
|
87
93
|
const datum = draft.data[index];
|
|
88
94
|
const [from, to] = draft.xDomain;
|
|
89
95
|
const windowFromIndex = xFindClosestIndex(datum.data.x, from);
|
|
@@ -98,8 +104,9 @@ function handleAutoPeakPicking(draft, autOptions) {
|
|
|
98
104
|
}
|
|
99
105
|
function changePeakShapeHandler(draft, action) {
|
|
100
106
|
const { shape, id } = action.payload;
|
|
101
|
-
|
|
102
|
-
|
|
107
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
108
|
+
if (activeSpectrum?.id) {
|
|
109
|
+
const { index } = activeSpectrum;
|
|
103
110
|
const datum = draft.data[index];
|
|
104
111
|
const peakIndex = datum.peaks.values.findIndex((peak) => peak.id === id);
|
|
105
112
|
if (peakIndex !== -1) {
|
|
@@ -2,6 +2,7 @@ import cloneDeep from 'lodash/cloneDeep';
|
|
|
2
2
|
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
3
3
|
import nucleusToString from '../../utility/nucleusToString';
|
|
4
4
|
import { DEFAULT_YAXIS_SHIFT_VALUE, DISPLAYER_MODE } from '../core/Constants';
|
|
5
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
5
6
|
import { setDomain } from './DomainActions';
|
|
6
7
|
function changeSpectrumVerticalAlignment(draft, options) {
|
|
7
8
|
function stack(spectra = []) {
|
|
@@ -25,7 +26,7 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
25
26
|
if (['auto-check', 'stack'].includes(options.align || '')) {
|
|
26
27
|
dataPerNucleus = draft.data.filter((datum) => datum.info.nucleus === options?.activeTab
|
|
27
28
|
? options.activeTab
|
|
28
|
-
: draft.activeTab && datum.info.dimension === 1);
|
|
29
|
+
: draft.view.spectra.activeTab && datum.info.dimension === 1);
|
|
29
30
|
}
|
|
30
31
|
switch (options.align) {
|
|
31
32
|
case 'auto-check': {
|
|
@@ -53,21 +54,21 @@ function changeSpectrumVerticalAlignment(draft, options) {
|
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
function setKeyPreferencesHandler(draft, keyCode) {
|
|
56
|
-
const {
|
|
57
|
-
|
|
57
|
+
const { data, zoom, xDomain, xDomains, yDomain, yDomains, originDomain, margin, displayerMode, view, } = draft;
|
|
58
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
59
|
+
if (view.spectra.activeTab) {
|
|
58
60
|
const groupByNucleus = groupByInfoKey('nucleus');
|
|
59
61
|
const spectrumsGroupsList = groupByNucleus(data);
|
|
60
62
|
const level = displayerMode === DISPLAYER_MODE.DM_2D
|
|
61
|
-
? spectrumsGroupsList[activeTab].reduce((acc, datum) => {
|
|
63
|
+
? spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
|
|
62
64
|
acc[datum.id] = datum.processingController.getLevel();
|
|
63
65
|
return acc;
|
|
64
66
|
}, {})
|
|
65
67
|
: null;
|
|
66
68
|
draft.keysPreferences[keyCode] = {
|
|
67
|
-
activeTab,
|
|
68
69
|
activeSpectrum,
|
|
69
70
|
displayerMode,
|
|
70
|
-
|
|
71
|
+
view,
|
|
71
72
|
zoom,
|
|
72
73
|
xDomain,
|
|
73
74
|
xDomains,
|
|
@@ -76,7 +77,7 @@ function setKeyPreferencesHandler(draft, keyCode) {
|
|
|
76
77
|
originDomain,
|
|
77
78
|
level,
|
|
78
79
|
margin,
|
|
79
|
-
data: spectrumsGroupsList[activeTab].reduce((acc, datum) => {
|
|
80
|
+
data: spectrumsGroupsList[view.spectra.activeTab].reduce((acc, datum) => {
|
|
80
81
|
acc[datum.id] = {
|
|
81
82
|
display: {
|
|
82
83
|
color: datum.display.color,
|
|
@@ -92,15 +93,13 @@ function setKeyPreferencesHandler(draft, keyCode) {
|
|
|
92
93
|
function applyKeyPreferencesHandler(draft, keyCode) {
|
|
93
94
|
const preferences = draft.keysPreferences[keyCode];
|
|
94
95
|
if (preferences) {
|
|
95
|
-
draft.activeTab = preferences.activeTab;
|
|
96
96
|
draft.data.forEach((datum, index) => {
|
|
97
97
|
if (nucleusToString(datum.info.nucleus) === preferences.activeTab) {
|
|
98
98
|
draft.data[index].display = Object.assign(cloneDeep(datum.display), preferences.data[datum.id].display);
|
|
99
99
|
}
|
|
100
100
|
});
|
|
101
|
+
draft.view = preferences.view;
|
|
101
102
|
draft.displayerMode = preferences.displayerMode;
|
|
102
|
-
draft.tabActiveSpectrum = preferences.tabActiveSpectrum;
|
|
103
|
-
draft.activeSpectrum = preferences.activeSpectrum;
|
|
104
103
|
draft.margin = preferences.margin;
|
|
105
104
|
setDomain(draft);
|
|
106
105
|
draft.xDomain = preferences.xDomain;
|
|
@@ -13,9 +13,9 @@ declare function handleChangeRangeSum(draft: Draft<State>, options: any): void;
|
|
|
13
13
|
declare function handleAddRange(draft: Draft<State>, action: any): void;
|
|
14
14
|
declare function handleChangeRangeRelativeValue(draft: any, action: any): void;
|
|
15
15
|
declare function handleChangeRangeSignalValue(draft: any, action: any): void;
|
|
16
|
-
declare function handleChangeRangesSumFlag(draft:
|
|
16
|
+
declare function handleChangeRangesSumFlag(draft: Draft<State>, action: any): void;
|
|
17
17
|
declare function handleUpdateRange(draft: Draft<State>, action: any): void;
|
|
18
|
-
declare function handleShowMultiplicityTrees(draft: Draft<State
|
|
19
|
-
declare function handleShowRangesIntegrals(draft: Draft<State
|
|
20
|
-
declare function handleShowJGraph(draft: Draft<State
|
|
18
|
+
declare function handleShowMultiplicityTrees(draft: Draft<State>, action: any): void;
|
|
19
|
+
declare function handleShowRangesIntegrals(draft: Draft<State>, action: any): void;
|
|
20
|
+
declare function handleShowJGraph(draft: Draft<State>, action: any): void;
|
|
21
21
|
export { handleAutoRangesDetection, handleDeleteRange, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
|
|
@@ -8,15 +8,26 @@ import { DatumKind, SignalKindsToInclude, } from '../../../data/constants/Signal
|
|
|
8
8
|
import { addRange, changeRangeSignal, detectRanges, updateRangesRelativeValues, changeRange, changeRangeRelativeValue, updateXShift, } from '../../../data/data1d/Spectrum1D';
|
|
9
9
|
import { setSumOptions } from '../../../data/data1d/Spectrum1D/SumManager';
|
|
10
10
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/RangeUtilities';
|
|
11
|
+
import { rangeStateInit } from '../Reducer';
|
|
12
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
11
13
|
import getRange from '../helper/getRange';
|
|
12
14
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
13
15
|
import { setDomain, setIntegralsYDomain } from './DomainActions';
|
|
14
16
|
import { resetSelectedTool } from './ToolsActions';
|
|
15
17
|
function handleAutoRangesDetection(draft, options) {
|
|
16
|
-
const {
|
|
18
|
+
const { data, xDomain, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
19
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
17
20
|
if (activeSpectrum?.id) {
|
|
18
|
-
const { index } = activeSpectrum;
|
|
21
|
+
const { index, id } = activeSpectrum;
|
|
19
22
|
const datum = data[index];
|
|
23
|
+
// add range intial state
|
|
24
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
25
|
+
if (!range) {
|
|
26
|
+
draft.view.ranges.push({
|
|
27
|
+
spectrumID: id,
|
|
28
|
+
...rangeStateInit,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
20
31
|
const [from, to] = xDomain;
|
|
21
32
|
const windowFromIndex = xFindClosestIndex(datum.data.x, from);
|
|
22
33
|
const windowToIndex = xFindClosestIndex(datum.data.x, to);
|
|
@@ -50,7 +61,7 @@ function handleAutoSpectraRangesDetection(draft) {
|
|
|
50
61
|
clean: true,
|
|
51
62
|
keepPeaks: true,
|
|
52
63
|
};
|
|
53
|
-
const { data, activeTab: nucleus, molecules } = draft;
|
|
64
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
54
65
|
for (const datum of data) {
|
|
55
66
|
if (datum.info.dimension === 1) {
|
|
56
67
|
detectRanges(datum, { peakPicking, molecules, nucleus });
|
|
@@ -62,8 +73,9 @@ function getRangeIndex(draft, spectrumIndex, rangeID) {
|
|
|
62
73
|
return draft.data[spectrumIndex].ranges.values.findIndex((range) => range.id === rangeID);
|
|
63
74
|
}
|
|
64
75
|
function handleDeleteRange(draft, action) {
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
77
|
+
if (activeSpectrum?.id) {
|
|
78
|
+
const { index } = activeSpectrum;
|
|
67
79
|
const { data, resetSelectTool = false } = action.payload;
|
|
68
80
|
const { id = null, assignmentData } = data;
|
|
69
81
|
const datum = draft.data[index];
|
|
@@ -85,8 +97,9 @@ function handleDeleteRange(draft, action) {
|
|
|
85
97
|
}
|
|
86
98
|
function handleChangeRangeSignalKind(draft, action) {
|
|
87
99
|
const state = original(draft);
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
101
|
+
if (activeSpectrum?.id) {
|
|
102
|
+
const { index } = activeSpectrum;
|
|
90
103
|
const { rowData, value } = action.payload.data;
|
|
91
104
|
const rangeIndex = getRangeIndex(state, index, rowData.id);
|
|
92
105
|
const _range = draft.data[index].ranges.values[rangeIndex];
|
|
@@ -102,8 +115,9 @@ function handleChangeRangeSignalKind(draft, action) {
|
|
|
102
115
|
}
|
|
103
116
|
function handleSaveEditedRange(draft, action) {
|
|
104
117
|
const state = original(draft);
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
119
|
+
if (activeSpectrum?.id) {
|
|
120
|
+
const { index } = activeSpectrum;
|
|
107
121
|
const { editedRowData, assignmentData } = action.payload;
|
|
108
122
|
// remove assignments in global state
|
|
109
123
|
const _editedRowData = unlink(editedRowData);
|
|
@@ -144,8 +158,9 @@ function handleDeleteSignal(draft, action) {
|
|
|
144
158
|
}
|
|
145
159
|
}
|
|
146
160
|
function handleUnlinkRange(draft, action) {
|
|
147
|
-
|
|
148
|
-
|
|
161
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
162
|
+
if (activeSpectrum?.id) {
|
|
163
|
+
const { index } = activeSpectrum;
|
|
149
164
|
const { assignmentData, rangeData = null, signalIndex = -1, } = action.payload;
|
|
150
165
|
// remove assignments in global state
|
|
151
166
|
if (rangeData) {
|
|
@@ -178,8 +193,9 @@ function handleUnlinkRange(draft, action) {
|
|
|
178
193
|
}
|
|
179
194
|
}
|
|
180
195
|
function handleSetDiaIDRange(draft, action) {
|
|
181
|
-
|
|
182
|
-
|
|
196
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
197
|
+
if (activeSpectrum?.id) {
|
|
198
|
+
const { index } = activeSpectrum;
|
|
183
199
|
const { rangeData, diaIDs, signalIndex, nbAtoms } = action.payload;
|
|
184
200
|
const getNbAtoms = (input, current = 0) => input + current;
|
|
185
201
|
const rangeIndex = getRangeIndex(draft, index, rangeData.id);
|
|
@@ -196,13 +212,15 @@ function handleSetDiaIDRange(draft, action) {
|
|
|
196
212
|
}
|
|
197
213
|
}
|
|
198
214
|
function handleResizeRange(draft, action) {
|
|
199
|
-
|
|
200
|
-
|
|
215
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
216
|
+
if (activeSpectrum?.id) {
|
|
217
|
+
const { index } = activeSpectrum;
|
|
201
218
|
changeRange(draft.data[index], action.data);
|
|
202
219
|
}
|
|
203
220
|
}
|
|
204
221
|
function handleChangeRangeSum(draft, options) {
|
|
205
|
-
const { data,
|
|
222
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
223
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
206
224
|
if (activeSpectrum?.id) {
|
|
207
225
|
const { index } = activeSpectrum;
|
|
208
226
|
const datum = data[index];
|
|
@@ -213,10 +231,19 @@ function handleChangeRangeSum(draft, options) {
|
|
|
213
231
|
function addNewRange(draft, props) {
|
|
214
232
|
const { startX, endX, id } = props;
|
|
215
233
|
const range = getRange(draft, { startX, endX });
|
|
216
|
-
const {
|
|
234
|
+
const { view: { spectra: { activeTab: nucleus }, }, molecules, } = draft;
|
|
235
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
217
236
|
if (activeSpectrum?.id) {
|
|
218
237
|
const { index } = activeSpectrum;
|
|
219
238
|
const [from, to] = range;
|
|
239
|
+
// add range intial state
|
|
240
|
+
const rangeState = draft.view.ranges.find((r) => r.spectrumID === activeSpectrum.id);
|
|
241
|
+
if (!rangeState) {
|
|
242
|
+
draft.view.ranges.push({
|
|
243
|
+
spectrumID: activeSpectrum.id,
|
|
244
|
+
...rangeStateInit,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
220
247
|
addRange(draft.data[index], {
|
|
221
248
|
from,
|
|
222
249
|
to,
|
|
@@ -269,15 +296,17 @@ function handleOnChangeRangesData(draft) {
|
|
|
269
296
|
}
|
|
270
297
|
function handleChangeRangesSumFlag(draft, action) {
|
|
271
298
|
const flag = action.payload;
|
|
272
|
-
|
|
273
|
-
|
|
299
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
300
|
+
if (activeSpectrum?.id) {
|
|
301
|
+
const { index } = activeSpectrum;
|
|
274
302
|
draft.data[index].ranges.options.isSumConstant = !flag;
|
|
275
303
|
}
|
|
276
304
|
}
|
|
277
305
|
function handleUpdateRange(draft, action) {
|
|
278
306
|
const { range, resetSelectTool = false } = action.payload;
|
|
279
|
-
|
|
280
|
-
|
|
307
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
308
|
+
if (activeSpectrum?.id && range.id) {
|
|
309
|
+
const datum = draft.data[activeSpectrum?.index];
|
|
281
310
|
const index = datum.ranges.values.findIndex((_range) => _range.id === range.id);
|
|
282
311
|
datum.ranges.values[index] = range;
|
|
283
312
|
}
|
|
@@ -285,15 +314,46 @@ function handleUpdateRange(draft, action) {
|
|
|
285
314
|
resetSelectedTool(draft);
|
|
286
315
|
}
|
|
287
316
|
}
|
|
288
|
-
function handleShowMultiplicityTrees(draft) {
|
|
289
|
-
|
|
290
|
-
|
|
317
|
+
function handleShowMultiplicityTrees(draft, action) {
|
|
318
|
+
const { id } = action.payload;
|
|
319
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
320
|
+
if (range) {
|
|
321
|
+
range.showMultiplicityTrees = !range.showMultiplicityTrees;
|
|
322
|
+
}
|
|
323
|
+
else {
|
|
324
|
+
draft.view.ranges.push({
|
|
325
|
+
spectrumID: id,
|
|
326
|
+
...rangeStateInit,
|
|
327
|
+
showMultiplicityTrees: !rangeStateInit.showMultiplicityTrees,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
291
330
|
}
|
|
292
|
-
function handleShowRangesIntegrals(draft) {
|
|
293
|
-
|
|
294
|
-
|
|
331
|
+
function handleShowRangesIntegrals(draft, action) {
|
|
332
|
+
const { id } = action.payload;
|
|
333
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
334
|
+
if (range) {
|
|
335
|
+
range.showRangesIntegrals = !range.showRangesIntegrals;
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
draft.view.ranges.push({
|
|
339
|
+
spectrumID: id,
|
|
340
|
+
...rangeStateInit,
|
|
341
|
+
showRangesIntegrals: !rangeStateInit.showRangesIntegrals,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
295
344
|
}
|
|
296
|
-
function handleShowJGraph(draft) {
|
|
297
|
-
|
|
345
|
+
function handleShowJGraph(draft, action) {
|
|
346
|
+
const { id } = action.payload;
|
|
347
|
+
const range = draft.view.ranges.find((r) => r.spectrumID === id);
|
|
348
|
+
if (range) {
|
|
349
|
+
range.showJGraph = !range.showJGraph;
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
draft.view.ranges.push({
|
|
353
|
+
spectrumID: id,
|
|
354
|
+
...rangeStateInit,
|
|
355
|
+
showJGraph: !rangeStateInit.showJGraph,
|
|
356
|
+
});
|
|
357
|
+
}
|
|
298
358
|
}
|
|
299
359
|
export { handleAutoRangesDetection, handleDeleteRange, handleDeleteSignal, handleChangeRangeSum, handleAddRange, handleResizeRange, handleChangeRangeRelativeValue, handleChangeRangeSignalValue, handleChangeRangeSignalKind, handleSaveEditedRange, handleUnlinkRange, handleSetDiaIDRange, handleChangeRangesSumFlag, handleUpdateRange, handleShowMultiplicityTrees, handleShowRangesIntegrals, handleAutoSpectraRangesDetection, handleShowJGraph, };
|
|
@@ -5,28 +5,28 @@ function analyzeSpectra(draft, action) {
|
|
|
5
5
|
MultipleAnalysis.analyzeSpectra(draft.data, draft.spectraAnalysis, {
|
|
6
6
|
from,
|
|
7
7
|
to,
|
|
8
|
-
nucleus: draft.activeTab,
|
|
8
|
+
nucleus: draft.view.spectra.activeTab,
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
function handleDeleteSpectraRanges(draft, action) {
|
|
12
12
|
const { colKey } = action;
|
|
13
|
-
MultipleAnalysis.deleteSpectraAnalysis(draft.spectraAnalysis, colKey, draft.activeTab);
|
|
13
|
+
MultipleAnalysis.deleteSpectraAnalysis(draft.spectraAnalysis, colKey, draft.view.spectra.activeTab);
|
|
14
14
|
}
|
|
15
15
|
function handleResizeSpectraRange(draft, action) {
|
|
16
16
|
const { columnKey, from, to } = action.payload;
|
|
17
17
|
MultipleAnalysis.analyzeSpectra(draft.data, draft.spectraAnalysis, {
|
|
18
18
|
from,
|
|
19
19
|
to,
|
|
20
|
-
nucleus: draft.activeTab,
|
|
20
|
+
nucleus: draft.view.spectra.activeTab,
|
|
21
21
|
columnKey,
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
function handleSetColumns(draft, action) {
|
|
25
25
|
const data = action.payload;
|
|
26
|
-
MultipleAnalysis.setColumn(draft.spectraAnalysis, draft.activeTab, data);
|
|
26
|
+
MultipleAnalysis.setColumn(draft.spectraAnalysis, draft.view.spectra.activeTab, data);
|
|
27
27
|
}
|
|
28
28
|
function handleFilterColumn(draft, action) {
|
|
29
29
|
const { columnKey, valueKey } = action.payload;
|
|
30
|
-
MultipleAnalysis.changeColumnValueKey(draft.spectraAnalysis, draft.activeTab, columnKey, valueKey);
|
|
30
|
+
MultipleAnalysis.changeColumnValueKey(draft.spectraAnalysis, draft.view.spectra.activeTab, columnKey, valueKey);
|
|
31
31
|
}
|
|
32
32
|
export { analyzeSpectra, handleDeleteSpectraRanges, handleResizeSpectraRange, handleSetColumns, handleFilterColumn, };
|
|
@@ -6,6 +6,7 @@ import { getMissingProjection } from '../../../data/data2d/Spectrum2D';
|
|
|
6
6
|
import { options } from '../../toolbar/ToolTypes';
|
|
7
7
|
import groupByInfoKey from '../../utility/GroupByInfoKey';
|
|
8
8
|
import { setZoom } from '../helper/Zoom1DManager';
|
|
9
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
9
10
|
import { setDomain, setMode } from './DomainActions';
|
|
10
11
|
import { resetSpectrumByFilter } from './FiltersActions';
|
|
11
12
|
import { setTab, setActiveTab } from './ToolsActions';
|
|
@@ -65,10 +66,10 @@ function handleChangePeaksMarkersVisibility(draft, data) {
|
|
|
65
66
|
}
|
|
66
67
|
function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
67
68
|
let refreshDomain = false;
|
|
68
|
-
const currentActiveSpectrum = draft
|
|
69
|
+
const currentActiveSpectrum = getActiveSpectrum(draft);
|
|
69
70
|
if (activeSpectrum) {
|
|
70
71
|
const newIndex = draft.data.findIndex((d) => d.id === activeSpectrum.id);
|
|
71
|
-
const oldIndex = draft.data.findIndex((d) => d.id ===
|
|
72
|
+
const oldIndex = draft.data.findIndex((d) => d.id === currentActiveSpectrum?.id);
|
|
72
73
|
if (newIndex !== -1) {
|
|
73
74
|
const newActiveSpectrum = draft.data[newIndex];
|
|
74
75
|
newActiveSpectrum.display.isVisible = true;
|
|
@@ -82,8 +83,8 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
activeSpectrum = { ...activeSpectrum, index: newIndex };
|
|
85
|
-
draft.
|
|
86
|
-
|
|
86
|
+
draft.view.spectra.activeSpectra[draft.view.spectra.activeTab] =
|
|
87
|
+
activeSpectrum;
|
|
87
88
|
}
|
|
88
89
|
else {
|
|
89
90
|
if (currentActiveSpectrum) {
|
|
@@ -93,8 +94,7 @@ function handleChangeActiveSpectrum(draft, activeSpectrum) {
|
|
|
93
94
|
else {
|
|
94
95
|
refreshDomain = false;
|
|
95
96
|
}
|
|
96
|
-
draft.
|
|
97
|
-
draft.tabActiveSpectrum[draft.activeTab] = null;
|
|
97
|
+
draft.view.spectra.activeSpectra[draft.view.spectra.activeTab] = null;
|
|
98
98
|
}
|
|
99
99
|
if (options[draft.toolOptions.selectedTool].isFilter) {
|
|
100
100
|
draft.toolOptions.selectedTool = options.zoom.id;
|
|
@@ -137,13 +137,17 @@ function handleDeleteSpectra(draft, action) {
|
|
|
137
137
|
else {
|
|
138
138
|
draft.data = [];
|
|
139
139
|
}
|
|
140
|
-
setActiveTab(draft, {
|
|
140
|
+
setActiveTab(draft, {
|
|
141
|
+
tab: draft.view.spectra.activeTab,
|
|
142
|
+
refreshActiveTab: true,
|
|
143
|
+
});
|
|
141
144
|
}
|
|
142
145
|
function addMissingProjectionHandler(draft, action) {
|
|
143
146
|
const state = original(draft);
|
|
144
147
|
const { nucleus } = action;
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
149
|
+
if (activeSpectrum?.id) {
|
|
150
|
+
const { index } = activeSpectrum;
|
|
147
151
|
for (let n of nucleus) {
|
|
148
152
|
const datum1D = getMissingProjection(state.data[index], n, draft.usedColors);
|
|
149
153
|
draft.data.push(datum1D);
|
|
@@ -159,7 +163,7 @@ function alignSpectraHandler(draft, action) {
|
|
|
159
163
|
if (draft.data && draft.data.length > 0) {
|
|
160
164
|
for (let datum of draft.data) {
|
|
161
165
|
if (datum.info?.dimension === 1 &&
|
|
162
|
-
datum.info.nucleus === draft.activeTab &&
|
|
166
|
+
datum.info.nucleus === draft.view.spectra.activeTab &&
|
|
163
167
|
!datum.info?.isFid) {
|
|
164
168
|
const shift = getReferenceShift(datum, { ...action.payload });
|
|
165
169
|
applyFilter(datum, [
|
|
@@ -11,7 +11,7 @@ declare function handleAddBaseLineZone(draft: Draft<State>, { from, to }: {
|
|
|
11
11
|
to: any;
|
|
12
12
|
}): void;
|
|
13
13
|
declare function handleDeleteBaseLineZone(draft: Draft<State>, id: any): void;
|
|
14
|
-
declare function handleToggleRealImaginaryVisibility(draft:
|
|
14
|
+
declare function handleToggleRealImaginaryVisibility(draft: Draft<State>): void;
|
|
15
15
|
declare function handleBrushEnd(draft: Draft<State>, action: any): void;
|
|
16
16
|
declare function setVerticalIndicatorXPosition(draft: Draft<State>, position: any): void;
|
|
17
17
|
declare function handleZoom(draft: Draft<State>, action: any): void;
|