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
|
@@ -42,6 +42,7 @@ const ToolTypes_1 = require("../../toolbar/ToolTypes");
|
|
|
42
42
|
const getSpectraByNucleus_1 = require("../../utility/getSpectraByNucleus");
|
|
43
43
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
44
44
|
const ZoomHistoryManager_1 = __importDefault(require("../helper/ZoomHistoryManager"));
|
|
45
|
+
const getActiveSpectrumOrFail_1 = require("../helper/getActiveSpectrumOrFail");
|
|
45
46
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
46
47
|
const getStrongestPeak_1 = require("../helper/getStrongestPeak");
|
|
47
48
|
const DomainActions_1 = require("./DomainActions");
|
|
@@ -49,215 +50,211 @@ const PreferencesActions_1 = require("./PreferencesActions");
|
|
|
49
50
|
const ToolsActions_1 = require("./ToolsActions");
|
|
50
51
|
function shiftSpectrumAlongXAxis(draft, shiftValue) {
|
|
51
52
|
//apply filter into the spectrum
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
53
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
54
|
+
const index = activeSpectrum?.index;
|
|
55
|
+
FiltersManager.applyFilter(draft.data[index], [
|
|
56
|
+
{ name: Filters.shiftX.id, options: shiftValue },
|
|
57
|
+
]);
|
|
58
|
+
(0, Spectrum1D_1.updateXShift)(draft.data[index]);
|
|
59
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
60
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
61
61
|
}
|
|
62
62
|
exports.shiftSpectrumAlongXAxis = shiftSpectrumAlongXAxis;
|
|
63
63
|
function applyZeroFillingFilter(draft, action) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
64
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
65
|
+
const index = activeSpectrum.index;
|
|
66
|
+
const { size } = action.payload;
|
|
67
|
+
const filters = [
|
|
68
|
+
{
|
|
69
|
+
name: Filters.zeroFilling.id,
|
|
70
|
+
options: size,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
FiltersManager.applyFilter(draft.data[index], filters);
|
|
74
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
75
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
76
|
+
(0, DomainActions_1.setMode)(draft);
|
|
78
77
|
}
|
|
79
78
|
exports.applyZeroFillingFilter = applyZeroFillingFilter;
|
|
80
79
|
function calculateApodizationFilter(draft, action) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
80
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
81
|
+
const index = activeSpectrum.index;
|
|
82
|
+
const options = action.payload;
|
|
83
|
+
const { data: { x, re, im }, info, } = draft.data[index];
|
|
84
|
+
let _data = { data: { x, re, im }, info };
|
|
85
|
+
draft.toolOptions.data.apodizationOptions = options;
|
|
86
|
+
(0, apodization_1.apply)(_data, options);
|
|
87
|
+
const { im: newIm, re: newRe } = _data.data;
|
|
88
|
+
draft.tempData[index].data.im = newIm;
|
|
89
|
+
draft.tempData[index].data.re = newRe;
|
|
92
90
|
}
|
|
93
91
|
exports.calculateApodizationFilter = calculateApodizationFilter;
|
|
94
92
|
function applyApodizationFilter(draft, action) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
93
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
94
|
+
const index = activeSpectrum.index;
|
|
95
|
+
const options = action.payload;
|
|
96
|
+
const filters = [
|
|
97
|
+
{
|
|
98
|
+
name: Filters.apodization.id,
|
|
99
|
+
options,
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
FiltersManager.applyFilter(draft.data[index], filters);
|
|
103
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
104
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
105
|
+
(0, DomainActions_1.setMode)(draft);
|
|
109
106
|
}
|
|
110
107
|
exports.applyApodizationFilter = applyApodizationFilter;
|
|
111
108
|
function calculateZeroFillingFilter(draft, action) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
109
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
110
|
+
const index = activeSpectrum.index;
|
|
111
|
+
const { size } = action.payload;
|
|
112
|
+
const { data: { x, re, im }, filters, info, } = draft.data[index];
|
|
113
|
+
let _data = { data: { x, re, im }, filters, info };
|
|
114
|
+
(0, zeroFilling_1.apply)(_data, size);
|
|
115
|
+
const { im: newIm, re: newRe, x: newX } = _data.data;
|
|
116
|
+
draft.tempData[index].data.x = newX;
|
|
117
|
+
draft.tempData[index].data.im = newIm;
|
|
118
|
+
draft.tempData[index].data.re = newRe;
|
|
119
|
+
draft.xDomain = [newX[0], newX[newX.length - 1]];
|
|
124
120
|
}
|
|
125
121
|
exports.calculateZeroFillingFilter = calculateZeroFillingFilter;
|
|
126
122
|
function applyFFTFilter(draft) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
123
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
124
|
+
const { index } = activeSpectrum;
|
|
125
|
+
//apply filter into the spectrum
|
|
126
|
+
FiltersManager.applyFilter(draft.data[index], [
|
|
127
|
+
{ name: Filters.fft.id, options: {} },
|
|
128
|
+
]);
|
|
129
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
130
|
+
(0, PreferencesActions_1.changeSpectrumVerticalAlignment)(draft, { align: 'bottom' });
|
|
131
|
+
(0, DomainActions_1.setDomain)(draft, { yDomain: { isChanged: true } });
|
|
132
|
+
(0, DomainActions_1.setMode)(draft);
|
|
138
133
|
}
|
|
139
134
|
exports.applyFFTFilter = applyFFTFilter;
|
|
140
135
|
function applyManualPhaseCorrectionFilter(draft, filterOptions) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
136
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
137
|
+
const { index } = activeSpectrum;
|
|
138
|
+
const { ph0, ph1 } = filterOptions;
|
|
139
|
+
FiltersManager.applyFilter(draft.data[index], [
|
|
140
|
+
{
|
|
141
|
+
name: Filters.phaseCorrection.id,
|
|
142
|
+
options: { ph0, ph1, absolute: false },
|
|
143
|
+
},
|
|
144
|
+
]);
|
|
145
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
146
|
+
draft.tempData = null;
|
|
147
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
151
148
|
}
|
|
152
149
|
exports.applyManualPhaseCorrectionFilter = applyManualPhaseCorrectionFilter;
|
|
153
150
|
function applyAbsoluteFilter(draft) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
151
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
152
|
+
const { index } = activeSpectrum;
|
|
153
|
+
FiltersManager.applyFilter(draft.data[index], [
|
|
154
|
+
{
|
|
155
|
+
name: Filters.phaseCorrection.id,
|
|
156
|
+
options: { absolute: true, ph0: 0, ph1: 0 },
|
|
157
|
+
},
|
|
158
|
+
]);
|
|
159
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
160
|
+
draft.tempData = null;
|
|
161
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
163
162
|
}
|
|
164
163
|
exports.applyAbsoluteFilter = applyAbsoluteFilter;
|
|
165
164
|
function applyAutoPhaseCorrectionFilter(draft) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
165
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
166
|
+
const { index } = activeSpectrum;
|
|
167
|
+
const { ph0, ph1 } = (0, autoPhaseCorrection_1.apply)(draft.data[index]);
|
|
168
|
+
FiltersManager.applyFilter(draft.data[index], [
|
|
169
|
+
{
|
|
170
|
+
name: Filters.phaseCorrection.id,
|
|
171
|
+
options: { ph0, ph1, absolute: false },
|
|
172
|
+
},
|
|
173
|
+
]);
|
|
174
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
175
|
+
draft.tempData = null;
|
|
176
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
176
177
|
}
|
|
177
178
|
exports.applyAutoPhaseCorrectionFilter = applyAutoPhaseCorrectionFilter;
|
|
178
179
|
function calculateBaseLineCorrection(draft, action) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
let _data = { data: { x, re, im }, info };
|
|
191
|
-
(0, baselineCorrection_1.apply)(_data, {
|
|
192
|
-
zones,
|
|
193
|
-
...filterOptions,
|
|
194
|
-
});
|
|
195
|
-
const { im: newIm, re: newRe } = _data.data;
|
|
196
|
-
draft.tempData[index].data.im = newIm;
|
|
197
|
-
draft.tempData[index].data.re = newRe;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
exports.calculateBaseLineCorrection = calculateBaseLineCorrection;
|
|
202
|
-
function calculateManualPhaseCorrection(draft, filterOptions) {
|
|
203
|
-
if (draft.activeSpectrum) {
|
|
204
|
-
const { index } = draft.activeSpectrum;
|
|
205
|
-
const { data: { x, re, im }, info, } = draft.data[index];
|
|
206
|
-
const { ph0, ph1 } = filterOptions;
|
|
180
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
181
|
+
const { index } = activeSpectrum;
|
|
182
|
+
const { data: { x, re, im }, info, } = draft.data[index];
|
|
183
|
+
// save the baseline options temporary
|
|
184
|
+
draft.toolOptions.data.baselineCorrection = {
|
|
185
|
+
...draft.toolOptions.data.baselineCorrection,
|
|
186
|
+
...(action?.options ? { options: action.options } : {}),
|
|
187
|
+
};
|
|
188
|
+
const { zones, options } = draft.toolOptions.data.baselineCorrection;
|
|
189
|
+
const { livePreview, ...filterOptions } = options;
|
|
190
|
+
if (livePreview) {
|
|
207
191
|
let _data = { data: { x, re, im }, info };
|
|
208
|
-
(0,
|
|
192
|
+
(0, baselineCorrection_1.apply)(_data, {
|
|
193
|
+
zones,
|
|
194
|
+
...filterOptions,
|
|
195
|
+
});
|
|
209
196
|
const { im: newIm, re: newRe } = _data.data;
|
|
210
197
|
draft.tempData[index].data.im = newIm;
|
|
211
198
|
draft.tempData[index].data.re = newRe;
|
|
212
199
|
}
|
|
213
200
|
}
|
|
201
|
+
exports.calculateBaseLineCorrection = calculateBaseLineCorrection;
|
|
202
|
+
function calculateManualPhaseCorrection(draft, filterOptions) {
|
|
203
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
204
|
+
const { index } = activeSpectrum;
|
|
205
|
+
const { data: { x, re, im }, info, } = draft.data[index];
|
|
206
|
+
const { ph0, ph1 } = filterOptions;
|
|
207
|
+
let _data = { data: { x, re, im }, info };
|
|
208
|
+
(0, phaseCorrection_1.apply)(_data, { ph0, ph1 });
|
|
209
|
+
const { im: newIm, re: newRe } = _data.data;
|
|
210
|
+
draft.tempData[index].data.im = newIm;
|
|
211
|
+
draft.tempData[index].data.re = newRe;
|
|
212
|
+
}
|
|
214
213
|
exports.calculateManualPhaseCorrection = calculateManualPhaseCorrection;
|
|
215
214
|
function enableFilter(draft, filterID, checked) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
215
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
216
|
+
const { index } = activeSpectrum;
|
|
217
|
+
//apply filter into the spectrum
|
|
218
|
+
FiltersManager.enableFilter(draft.data[index], filterID, checked);
|
|
219
|
+
if (draft.data[index].info?.dimension === 1) {
|
|
220
|
+
(0, Spectrum1D_1.updateXShift)(draft.data[index]);
|
|
221
|
+
}
|
|
222
|
+
else if (draft.data[index].info?.dimension === 2) {
|
|
223
|
+
(0, Spectrum2D_1.updateShift)(draft.data[index]);
|
|
224
|
+
}
|
|
225
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
226
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
227
|
+
(0, DomainActions_1.setMode)(draft);
|
|
228
|
+
const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.view.spectra.activeTab);
|
|
229
|
+
const zoomValue = zoomHistory.getLast();
|
|
230
|
+
if (zoomValue) {
|
|
231
|
+
draft.xDomain = zoomValue.xDomain;
|
|
232
|
+
draft.yDomain = zoomValue.yDomain;
|
|
235
233
|
}
|
|
236
234
|
}
|
|
237
235
|
exports.enableFilter = enableFilter;
|
|
238
236
|
function deleteFilter(draft, actions) {
|
|
239
237
|
const filterID = actions.payload.id;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
251
|
-
(0, DomainActions_1.setDomain)(draft);
|
|
252
|
-
(0, DomainActions_1.setMode)(draft);
|
|
238
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
239
|
+
const { index } = activeSpectrum;
|
|
240
|
+
//apply filter into the spectrum
|
|
241
|
+
FiltersManager.deleteFilter(draft.data[index], filterID);
|
|
242
|
+
if (draft.data[index].info?.dimension === 1) {
|
|
243
|
+
(0, Spectrum1D_1.updateXShift)(draft.data[index]);
|
|
244
|
+
}
|
|
245
|
+
else if (draft.data[index].info?.dimension === 2) {
|
|
246
|
+
(0, Spectrum2D_1.updateShift)(draft.data[index]);
|
|
253
247
|
}
|
|
248
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
249
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
250
|
+
(0, DomainActions_1.setMode)(draft);
|
|
254
251
|
}
|
|
255
252
|
exports.deleteFilter = deleteFilter;
|
|
256
253
|
function deleteSpectraFilter(draft, actions) {
|
|
257
254
|
const filterType = actions.payload.filterType;
|
|
258
|
-
if (draft.activeTab) {
|
|
255
|
+
if (draft.view.spectra.activeTab) {
|
|
259
256
|
for (const datum of draft.data) {
|
|
260
|
-
if ((0, nucleusToString_1.default)(datum?.info?.nucleus) === draft.activeTab) {
|
|
257
|
+
if ((0, nucleusToString_1.default)(datum?.info?.nucleus) === draft.view.spectra.activeTab) {
|
|
261
258
|
const filtersResult = datum.filters?.filter((filter) => filter.name === filterType) || [];
|
|
262
259
|
filtersResult.forEach((filter) => {
|
|
263
260
|
FiltersManager.deleteFilter(datum, filter.id);
|
|
@@ -277,24 +274,23 @@ function deleteSpectraFilter(draft, actions) {
|
|
|
277
274
|
}
|
|
278
275
|
exports.deleteSpectraFilter = deleteSpectraFilter;
|
|
279
276
|
function handleBaseLineCorrectionFilter(draft, action) {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
},
|
|
277
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
278
|
+
const { index } = activeSpectrum;
|
|
279
|
+
const { zones } = draft.toolOptions.data.baselineCorrection;
|
|
280
|
+
const { livePreview, ...options } = action.options;
|
|
281
|
+
FiltersManager.applyFilter(draft.data[index], [
|
|
282
|
+
{
|
|
283
|
+
name: Filters.baselineCorrection.id,
|
|
284
|
+
options: {
|
|
285
|
+
zones,
|
|
286
|
+
...options,
|
|
291
287
|
},
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
288
|
+
},
|
|
289
|
+
]);
|
|
290
|
+
const xDomainSnapshot = draft.xDomain.slice();
|
|
291
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
292
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
293
|
+
draft.xDomain = xDomainSnapshot;
|
|
298
294
|
}
|
|
299
295
|
exports.handleBaseLineCorrectionFilter = handleBaseLineCorrectionFilter;
|
|
300
296
|
/**
|
|
@@ -310,48 +306,46 @@ function resetSpectrumByFilter(draft, options) {
|
|
|
310
306
|
const { updateDomain = true, rollback = false, searchBy = 'id', applyFilter = false, // the filter that we rollback and return the affect data for the selected spectrum
|
|
311
307
|
filterId, } = options || {};
|
|
312
308
|
let currentDatum = null;
|
|
313
|
-
const currentActiveSpectrum = draft
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
FiltersManager.applyFilter(newDatum, [{ name, options }]);
|
|
335
|
-
}
|
|
336
|
-
currentDatum = { datum: newDatum, index };
|
|
309
|
+
const currentActiveSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
310
|
+
const index = currentActiveSpectrum.index;
|
|
311
|
+
const datum = draft.data[index];
|
|
312
|
+
if (filterId && draft.toolOptions.data.activeFilterID !== filterId) {
|
|
313
|
+
const filterIndex = datum.filters.findIndex((f) => f[searchBy] === filterId);
|
|
314
|
+
let filters = [];
|
|
315
|
+
if (filterIndex !== -1) {
|
|
316
|
+
filters = datum.filters.slice(0, rollback ? filterIndex : filterIndex + 1);
|
|
317
|
+
if (filters.length >= 1) {
|
|
318
|
+
draft.toolOptions.data.activeFilterID =
|
|
319
|
+
datum.filters[rollback ? filterIndex - 1 : filterIndex]?.id;
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
draft.toolOptions.data.activeFilterID = null;
|
|
323
|
+
}
|
|
324
|
+
FiltersManager.reapplyFilters(datum, filters);
|
|
325
|
+
if (applyFilter) {
|
|
326
|
+
const { name, value: options } = datum.filters[filterIndex];
|
|
327
|
+
const newDatum = (0, immer_1.current)(draft).data[index];
|
|
328
|
+
if (newDatum.info?.dimension === 1) {
|
|
329
|
+
FiltersManager.applyFilter(newDatum, [{ name, options }]);
|
|
337
330
|
}
|
|
331
|
+
currentDatum = { datum: newDatum, index };
|
|
338
332
|
}
|
|
339
333
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
//close filter snapshot mode and replay all enabled filters
|
|
337
|
+
draft.toolOptions.data.activeFilterID = null;
|
|
338
|
+
FiltersManager.reapplyFilters(datum);
|
|
339
|
+
}
|
|
340
|
+
if (datum.info?.dimension === 1) {
|
|
341
|
+
(0, Spectrum1D_1.updateXShift)(datum);
|
|
342
|
+
}
|
|
343
|
+
else if (datum.info?.dimension === 2) {
|
|
344
|
+
(0, Spectrum2D_1.updateShift)(datum);
|
|
345
|
+
}
|
|
346
|
+
if (updateDomain) {
|
|
347
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
348
|
+
(0, DomainActions_1.setMode)(draft);
|
|
355
349
|
}
|
|
356
350
|
if (applyFilter) {
|
|
357
351
|
return currentDatum;
|
|
@@ -364,7 +358,7 @@ function filterSnapshotHandler(draft, action) {
|
|
|
364
358
|
}
|
|
365
359
|
exports.filterSnapshotHandler = filterSnapshotHandler;
|
|
366
360
|
function handleMultipleSpectraFilter(draft, action) {
|
|
367
|
-
const spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.activeTab, draft.data);
|
|
361
|
+
const spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.view.spectra.activeTab, draft.data);
|
|
368
362
|
if (spectra && spectra.length > 0 && Array.isArray(action.payload)) {
|
|
369
363
|
const exclusions = spectra[0].filters.find((f) => f.name === Filters.exclusionZones.id)
|
|
370
364
|
?.value || [];
|
|
@@ -388,12 +382,14 @@ function handleAddExclusionZone(draft, action) {
|
|
|
388
382
|
const { from: startX, to: endX } = action.payload;
|
|
389
383
|
const range = (0, getRange_1.default)(draft, { startX, endX });
|
|
390
384
|
let spectra;
|
|
391
|
-
|
|
392
|
-
|
|
385
|
+
// todo: refactor this
|
|
386
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
387
|
+
if (activeSpectrum?.id) {
|
|
388
|
+
const index = activeSpectrum?.index;
|
|
393
389
|
spectra = [draft.data[index]];
|
|
394
390
|
}
|
|
395
391
|
else {
|
|
396
|
-
spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.activeTab, draft.data);
|
|
392
|
+
spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.view.spectra.activeTab, draft.data);
|
|
397
393
|
}
|
|
398
394
|
for (const spectrum of spectra) {
|
|
399
395
|
FiltersManager.applyFilter(spectrum, [
|
|
@@ -430,7 +426,7 @@ function handleDeleteExclusionZone(draft, action) {
|
|
|
430
426
|
}
|
|
431
427
|
else {
|
|
432
428
|
// remove all exclusive zone that have the same range in all spectra
|
|
433
|
-
const data = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.activeTab, draft.data);
|
|
429
|
+
const data = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.view.spectra.activeTab, draft.data);
|
|
434
430
|
for (const datum of data) {
|
|
435
431
|
for (const filter of datum.filters) {
|
|
436
432
|
if (filter.name === Filters.exclusionZones.id) {
|
|
@@ -459,7 +455,8 @@ function checkFilterHasTempData(selectedToolId) {
|
|
|
459
455
|
].includes(selectedToolId);
|
|
460
456
|
}
|
|
461
457
|
function setFilterChanges(draft, selectedFilterID) {
|
|
462
|
-
const
|
|
458
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
459
|
+
const activeSpectrumId = activeSpectrum.id;
|
|
463
460
|
// If the user selects the filter from the filters list or selects its tool and has a record in the filter list for preview and edit
|
|
464
461
|
if (checkFilterHasTempData(selectedFilterID)) {
|
|
465
462
|
//return back the spectra data to point of time before applying a specific filter
|
|
@@ -491,14 +488,12 @@ function setFilterChanges(draft, selectedFilterID) {
|
|
|
491
488
|
break;
|
|
492
489
|
}
|
|
493
490
|
case ToolTypes_1.options.baselineCorrection.id: {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
baselineCorrectionFilter
|
|
499
|
-
|
|
500
|
-
: [];
|
|
501
|
-
}
|
|
491
|
+
const baselineCorrectionFilter = (0, immer_1.current)(draft).data[activeSpectrum.index].filters.find((filter) => filter.name === ToolTypes_1.options.baselineCorrection.id);
|
|
492
|
+
if (baselineCorrectionFilter) {
|
|
493
|
+
draft.toolOptions.data.baselineCorrection.zones =
|
|
494
|
+
baselineCorrectionFilter
|
|
495
|
+
? baselineCorrectionFilter.value.zones
|
|
496
|
+
: [];
|
|
502
497
|
}
|
|
503
498
|
break;
|
|
504
499
|
}
|
|
@@ -9,10 +9,12 @@ const immer_1 = require("immer");
|
|
|
9
9
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
10
10
|
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
11
11
|
const SumManager_1 = require("../../../data/data1d/Spectrum1D/SumManager");
|
|
12
|
+
const getActiveSpectrum_1 = require("../helper/getActiveSpectrum");
|
|
12
13
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
13
14
|
const DomainActions_1 = require("./DomainActions");
|
|
14
15
|
function handleChangeIntegralSum(draft, options) {
|
|
15
|
-
const { data,
|
|
16
|
+
const { data, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
17
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
16
18
|
if (activeSpectrum?.id) {
|
|
17
19
|
const { index } = activeSpectrum;
|
|
18
20
|
const datum = data[index];
|
|
@@ -23,7 +25,8 @@ function handleChangeIntegralSum(draft, options) {
|
|
|
23
25
|
exports.handleChangeIntegralSum = handleChangeIntegralSum;
|
|
24
26
|
function addIntegral(draft, action) {
|
|
25
27
|
const { startX, endX } = action;
|
|
26
|
-
const { data, molecules, activeTab: nucleus,
|
|
28
|
+
const { data, molecules, view: { spectra: { activeTab: nucleus }, }, } = draft;
|
|
29
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
27
30
|
const [from, to] = (0, getRange_1.default)(draft, { startX, endX });
|
|
28
31
|
if (activeSpectrum?.id) {
|
|
29
32
|
const datum = data[activeSpectrum.index];
|
|
@@ -49,9 +52,10 @@ function addIntegral(draft, action) {
|
|
|
49
52
|
}
|
|
50
53
|
exports.addIntegral = addIntegral;
|
|
51
54
|
function deleteIntegral(draft, action) {
|
|
52
|
-
|
|
55
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
56
|
+
if (activeSpectrum) {
|
|
53
57
|
const state = (0, immer_1.original)(draft);
|
|
54
|
-
const { index } =
|
|
58
|
+
const { index } = activeSpectrum;
|
|
55
59
|
const { integralID } = action;
|
|
56
60
|
const datum = draft.data[index];
|
|
57
61
|
if (integralID == null) {
|
|
@@ -66,10 +70,11 @@ function deleteIntegral(draft, action) {
|
|
|
66
70
|
}
|
|
67
71
|
exports.deleteIntegral = deleteIntegral;
|
|
68
72
|
function changeIntegral(draft, action) {
|
|
73
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
69
74
|
const state = (0, immer_1.original)(draft);
|
|
70
75
|
const integral = action.payload.data;
|
|
71
|
-
if (
|
|
72
|
-
const { index } =
|
|
76
|
+
if (activeSpectrum?.id) {
|
|
77
|
+
const { index } = activeSpectrum;
|
|
73
78
|
const originalDatum = state.data[index];
|
|
74
79
|
const datum = draft.data[index];
|
|
75
80
|
const { x, re } = originalDatum.data;
|
|
@@ -87,9 +92,10 @@ function changeIntegral(draft, action) {
|
|
|
87
92
|
}
|
|
88
93
|
exports.changeIntegral = changeIntegral;
|
|
89
94
|
function handleChangeIntegralsRelativeValue(draft, action) {
|
|
95
|
+
const activeSpectrum = (0, getActiveSpectrum_1.getActiveSpectrum)(draft);
|
|
90
96
|
const data = action.payload.data;
|
|
91
|
-
if (
|
|
92
|
-
const { index } =
|
|
97
|
+
if (activeSpectrum?.id) {
|
|
98
|
+
const { index } = activeSpectrum;
|
|
93
99
|
(0, Spectrum1D_1.changeIntegralsRelative)(draft.data[index], data);
|
|
94
100
|
}
|
|
95
101
|
}
|