nmrium 0.29.0 → 0.31.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/README.md +12 -2
- package/lib/component/1d/ApodizationLine.d.ts +3 -0
- package/lib/component/1d/ApodizationLine.js +49 -0
- package/lib/component/1d/Chart1D.js +4 -2
- package/lib/component/1d/ExclusionZoneAnnotation.d.ts +1 -1
- package/lib/component/1d/ExclusionZoneAnnotation.js +14 -7
- package/lib/component/1d/FooterBanner.js +3 -1
- package/lib/component/1d/IntegralResizable.js +5 -4
- package/lib/component/1d/IntegralsSeries.js +3 -1
- package/lib/component/1d/LinesSeries.js +7 -5
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +10 -13
- package/lib/component/1d/database/DatabaseElements.js +2 -2
- package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
- package/lib/component/1d/database/ResurrectedDatabaseRanges.js +3 -3
- package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +16 -14
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +6 -5
- package/lib/component/1d/{PeakAnnotation.d.ts → peaks/PeakAnnotation.d.ts} +1 -2
- package/lib/component/1d/{PeakAnnotation.js → peaks/PeakAnnotation.js} +8 -9
- package/lib/component/1d/{PeakAnnotations.d.ts → peaks/PeakAnnotations.d.ts} +0 -0
- package/lib/component/1d/peaks/PeakAnnotations.js +28 -0
- package/lib/component/1d/peaks/PeaksShapes.d.ts +3 -0
- package/lib/component/1d/peaks/PeaksShapes.js +37 -0
- package/lib/component/1d/peaks/usePeakShapesPath.d.ts +13 -0
- package/lib/component/1d/peaks/usePeakShapesPath.js +49 -0
- package/lib/component/1d/ranges/Range.js +4 -4
- 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 +3 -1
- package/lib/component/2d/FooterBanner.js +5 -3
- package/lib/component/2d/Viewer2D.js +6 -6
- 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/Signal.d.ts +3 -2
- package/lib/component/2d/zones/Signal.js +3 -3
- package/lib/component/2d/zones/Zone.d.ts +1 -1
- package/lib/component/2d/zones/Zone.js +4 -4
- package/lib/component/2d/zones/Zones.js +14 -19
- package/lib/component/EventsTrackers/KeysListenerTracker.js +91 -52
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/assignment/AssignmentsContext.d.ts +1 -1
- package/lib/component/context/GlobalContext.d.ts +1 -1
- package/lib/component/context/GlobalContext.js +3 -3
- package/lib/component/elements/ActiveButton.d.ts +17 -0
- package/lib/component/elements/ActiveButton.js +28 -0
- package/lib/component/elements/Button.d.ts +6 -6
- package/lib/component/elements/Button.js +5 -5
- package/lib/component/elements/ButtonToolTip.js +1 -1
- package/lib/component/elements/CheckBox.d.ts +2 -6
- package/lib/component/elements/CheckBox.js +4 -6
- package/lib/component/elements/Input.d.ts +5 -4
- package/lib/component/elements/Input.js +1 -1
- package/lib/component/elements/Label.d.ts +8 -6
- package/lib/component/elements/Label.js +3 -3
- package/lib/component/elements/MoleculeSelection.d.ts +2 -2
- package/lib/component/elements/MoleculeSelection.js +1 -1
- package/lib/component/elements/NextPrev.js +1 -1
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +2 -2
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +2 -2
- package/lib/component/elements/ReactTable/ReactTable.d.ts +2 -2
- package/lib/component/elements/Select.d.ts +7 -11
- package/lib/component/elements/Select.js +6 -8
- package/lib/component/elements/Tab/Tab.js +1 -1
- package/lib/component/elements/Table/Table.d.ts +1 -2
- package/lib/component/elements/Table/Table.js +2 -2
- package/lib/component/elements/ToggleButton.d.ts +1 -2
- package/lib/component/elements/ToggleButton.js +3 -2
- package/lib/component/elements/accordion/AccordionItem.js +2 -2
- package/lib/component/elements/formik/FormikNumberInput.d.ts +1 -1
- package/lib/component/elements/formik/FormikOnChange.d.ts +3 -2
- package/lib/component/elements/formik/FormikOnChange.js +11 -5
- package/lib/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
- package/lib/component/elements/popup/Modal/Provider.js +8 -11
- package/lib/component/elements/resizer/DivResizer.js +3 -3
- package/lib/component/elements/resizer/Resizer.d.ts +1 -0
- package/lib/component/elements/resizer/SVGResizer.js +3 -3
- package/lib/component/header/ApodizationOptionsPanel.d.ts +2 -0
- package/lib/component/header/ApodizationOptionsPanel.js +81 -0
- package/lib/component/header/AutoPeakPickingOptionPanel.d.ts +2 -1
- package/lib/component/header/AutoPeakPickingOptionPanel.js +40 -36
- package/lib/component/header/BaseLineCorrectionPanel.d.ts +1 -2
- package/lib/component/header/BaseLineCorrectionPanel.js +84 -52
- package/lib/component/header/Header.js +5 -2
- package/lib/component/header/HeaderContainer.d.ts +7 -0
- package/lib/component/header/HeaderContainer.js +10 -0
- package/lib/component/header/ManualPhaseCorrectionPanel.js +27 -29
- package/lib/component/header/RangesPickingOptionPanel.js +19 -21
- package/lib/component/header/ZeroFillingOptionsPanel.js +52 -47
- package/lib/component/header/Zones2DOptionPanel.js +11 -13
- package/lib/component/highlight/index.d.ts +27 -10
- package/lib/component/highlight/index.js +19 -17
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +10 -1
- package/lib/component/hooks/useCheckToolsVisibility.js +31 -1
- 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/useFilter.d.ts +1 -0
- package/lib/component/hooks/useFilter.js +7 -0
- 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/hooks/useToolsFunctions.js +1 -1
- package/lib/component/loader/DropZone.js +8 -148
- package/lib/component/modal/AlignSpectraModal.js +1 -2
- package/lib/component/modal/EditPeakShapeModal.d.ts +9 -0
- package/lib/component/modal/EditPeakShapeModal.js +85 -0
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts +3 -3
- package/lib/component/modal/MoleculeStructureEditorModal.js +2 -3
- package/lib/component/modal/MultipleSpectraFiltersModal/index.js +1 -2
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.d.ts +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +9 -11
- package/lib/component/modal/changeSum/SelectMolecule.js +2 -2
- package/lib/component/modal/editRange/EditRangeModal.js +3 -3
- package/lib/component/modal/editRange/forms/components/CouplingsTable.js +4 -9
- package/lib/component/modal/setting/DatabasesTabContent.js +2 -2
- package/lib/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib/component/modal/setting/FormattingTabContent.js +2 -2
- package/lib/component/modal/setting/GeneralSettings.js +1 -1
- package/lib/component/modal/setting/ToolsTabContent.js +17 -13
- package/lib/component/modal/setting/WorkspaceItem.d.ts +2 -2
- package/lib/component/modal/setting/WorkspaceItem.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.d.ts +3 -3
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +3 -3
- package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +5 -4
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +13 -10
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +4 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -2
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts +5 -3
- package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +12 -4
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/Panels.js +3 -3
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +47 -22
- package/lib/component/panels/PeaksPanel/PeaksPreferences.js +17 -0
- package/lib/component/panels/PeaksPanel/PeaksTable.js +44 -13
- 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/RangesPanel/RangesTableRow.js +4 -4
- package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +3 -2
- package/lib/component/panels/RangesPanel/TableColumns/SignalAssignmentsColumn.d.ts +3 -3
- package/lib/component/panels/RangesPanel/hooks/useMapRanges.js +3 -3
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumListItem.js +1 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
- package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +4 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +4 -4
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -2
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +2 -3
- package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js +5 -13
- package/lib/component/panels/databasePanel/DatabaseTable.js +3 -3
- package/lib/component/panels/filtersPanel/FilterPanel.js +1 -1
- package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib/component/panels/header/DefaultPanelHeader.js +3 -12
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +2 -1
- package/lib/component/panels/predictionPanel/PredictionOptions.js +2 -2
- package/lib/component/panels/predictionPanel/PredictionPanel.js +15 -3
- package/lib/component/reducer/IgnoreActions.js +5 -0
- package/lib/component/reducer/Reducer.d.ts +141 -51
- package/lib/component/reducer/Reducer.js +69 -45
- package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
- package/lib/component/reducer/actions/DomainActions.js +11 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +13 -7
- package/lib/component/reducer/actions/FiltersActions.js +326 -204
- package/lib/component/reducer/actions/IntegralsActions.js +15 -10
- 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 +48 -19
- package/lib/component/reducer/actions/PeaksActions.d.ts +4 -1
- package/lib/component/reducer/actions/PeaksActions.js +52 -13
- package/lib/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +3 -3
- package/lib/component/reducer/actions/RangesActions.js +87 -29
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +14 -11
- package/lib/component/reducer/actions/ToolsActions.js +47 -95
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +68 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- 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.d.ts +7 -0
- package/lib/component/reducer/helper/getStrongestPeak.js +15 -0
- package/lib/component/reducer/preferences/actions/addWorkspace.js +2 -2
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +3 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +23 -15
- package/lib/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib/component/reducer/types/Types.d.ts +12 -0
- package/lib/component/reducer/types/Types.js +12 -0
- package/lib/component/tool/BrushX.js +1 -1
- package/lib/component/tool/BrushXY.js +4 -3
- package/lib/component/tool/CrossLinePointer.js +5 -4
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +8 -2
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +22 -7
- package/lib/component/tool/FloatMoleculeStructures/index.d.ts +3 -2
- package/lib/component/tool/FloatMoleculeStructures/index.js +19 -6
- package/lib/component/toolbar/BasicToolBar.js +7 -14
- package/lib/component/toolbar/FunctionToolBar.js +13 -23
- package/lib/component/toolbar/ToolTypes.d.ts +7 -1
- package/lib/component/toolbar/ToolTypes.js +119 -9
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/Workspace.d.ts +4 -1
- package/lib/component/workspaces/basic.js +12 -11
- package/lib/component/workspaces/embedded.js +14 -13
- package/lib/component/workspaces/exercise.js +10 -6
- package/lib/component/workspaces/prediction.js +14 -13
- package/lib/component/workspaces/process1D.js +20 -19
- package/lib/component/workspaces/workspaceDefaultProperties.js +14 -15
- package/lib/constants.js +1 -1
- package/lib/data/Filters.d.ts +2 -2
- package/lib/data/Filters.js +2 -2
- package/lib/data/FiltersManager.js +3 -3
- package/lib/data/PredictionManager.d.ts +0 -1
- package/lib/data/PredictionManager.js +15 -15
- package/lib/data/SpectraManager.d.ts +2 -5
- package/lib/data/SpectraManager.js +4 -95
- package/lib/data/constants/SignalsKinds.d.ts +0 -1
- package/lib/data/constants/SignalsKinds.js +0 -8
- package/lib/data/data1d/Data1DManager.js +5 -5
- package/lib/data/data1d/Spectrum1D/SumManager.d.ts +5 -5
- package/lib/data/data1d/Spectrum1D/SumManager.js +18 -12
- package/lib/data/data1d/Spectrum1D/generateJGraphData.js +2 -2
- package/lib/data/data1d/Spectrum1D/index.d.ts +2 -1
- package/lib/data/data1d/Spectrum1D/index.js +2 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
- package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +5 -2
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +1 -1
- package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +15 -16
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts +8 -0
- package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +24 -0
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +3 -3
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +2 -0
- package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +3 -3
- package/lib/data/data1d/database.js +4 -6
- package/lib/data/data1d/filter1d/apodization.d.ts +25 -0
- package/lib/data/data1d/filter1d/apodization.js +63 -0
- package/lib/data/data1d/filter1d/baselineCorrection.d.ts +24 -7
- package/lib/data/data1d/filter1d/baselineCorrection.js +10 -17
- package/lib/data/data1d/filter1d/fft.js +11 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
- package/lib/data/data1d/filter1d/zeroFillingAndApodization.d.ts +9 -0
- package/lib/data/data1d/filter1d/zeroFillingAndApodization.js +24 -0
- package/lib/data/data2d/Processing2D.d.ts +3 -3
- package/lib/data/data2d/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +3 -3
- package/lib/data/data2d/Spectrum2D/zones/detectZones.js +3 -3
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.js +3 -3
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +20 -6
- package/lib/data/molecules/Molecule.js +5 -8
- package/lib/data/molecules/MoleculeManager.d.ts +4 -4
- package/lib/data/molecules/MoleculeManager.js +5 -5
- package/lib/data/types/data1d/SumOptions.d.ts +1 -1
- package/lib/data/utilities/generateNumbersPowerOfX.d.ts +0 -1
- package/lib/data/utilities/generateNumbersPowerOfX.js +0 -1
- package/lib/data/utilities/isInRange.d.ts +7 -0
- package/lib/data/utilities/isInRange.js +4 -0
- package/lib/types/NMRiumDataReturn.d.ts +2 -2
- package/lib/types/NMRiumGeneralPreferences.d.ts +0 -2
- package/lib/types/NMRiumToolBarPreferences.d.ts +14 -13
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +77 -0
- package/lib-cjs/component/1d/Chart1D.js +4 -2
- package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +15 -8
- package/lib-cjs/component/1d/FooterBanner.js +3 -1
- package/lib-cjs/component/1d/IntegralResizable.js +4 -3
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
- package/lib-cjs/component/1d/LinesSeries.js +6 -4
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +10 -13
- package/lib-cjs/component/1d/database/DatabaseElements.js +1 -1
- package/lib-cjs/component/1d/database/DatabaseSpectrum.js +2 -2
- package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +2 -2
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib-cjs/component/1d/multiAnalysis/AnalysisRange.js +15 -13
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +4 -3
- package/lib-cjs/component/1d/{PeakAnnotation.js → peaks/PeakAnnotation.js} +8 -9
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +33 -0
- package/lib-cjs/component/1d/peaks/PeaksShapes.js +42 -0
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +53 -0
- package/lib-cjs/component/1d/ranges/Range.js +3 -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 +3 -1
- package/lib-cjs/component/2d/FooterBanner.js +5 -3
- package/lib-cjs/component/2d/Viewer2D.js +6 -6
- 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/Signal.js +3 -3
- package/lib-cjs/component/2d/zones/Zone.js +3 -3
- package/lib-cjs/component/2d/zones/Zones.js +13 -18
- package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +89 -50
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/context/GlobalContext.js +4 -4
- package/lib-cjs/component/elements/ActiveButton.js +33 -0
- package/lib-cjs/component/elements/Button.js +5 -5
- package/lib-cjs/component/elements/ButtonToolTip.js +1 -1
- package/lib-cjs/component/elements/CheckBox.js +3 -5
- package/lib-cjs/component/elements/Input.js +1 -1
- package/lib-cjs/component/elements/Label.js +3 -3
- package/lib-cjs/component/elements/MoleculeSelection.js +1 -1
- package/lib-cjs/component/elements/NextPrev.js +1 -1
- package/lib-cjs/component/elements/ReactTable/Elements/ReactTableRow.js +1 -1
- package/lib-cjs/component/elements/Select.js +6 -8
- package/lib-cjs/component/elements/Tab/Tab.js +1 -1
- package/lib-cjs/component/elements/Table/Table.js +2 -2
- package/lib-cjs/component/elements/ToggleButton.js +3 -2
- package/lib-cjs/component/elements/accordion/AccordionItem.js +2 -2
- package/lib-cjs/component/elements/formik/FormikOnChange.js +10 -4
- package/lib-cjs/component/elements/popup/Modal/ConfirmDialog.js +1 -1
- package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
- package/lib-cjs/component/elements/resizer/DivResizer.js +3 -3
- package/lib-cjs/component/elements/resizer/SVGResizer.js +2 -2
- package/lib-cjs/component/header/ApodizationOptionsPanel.js +110 -0
- package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +39 -35
- package/lib-cjs/component/header/BaseLineCorrectionPanel.js +82 -49
- package/lib-cjs/component/header/Header.js +5 -2
- package/lib-cjs/component/header/HeaderContainer.js +14 -0
- package/lib-cjs/component/header/ManualPhaseCorrectionPanel.js +26 -28
- package/lib-cjs/component/header/RangesPickingOptionPanel.js +19 -21
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +73 -45
- package/lib-cjs/component/header/Zones2DOptionPanel.js +11 -13
- package/lib-cjs/component/highlight/index.js +20 -18
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib-cjs/component/hooks/useCheckToolsVisibility.js +31 -1
- package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib-cjs/component/hooks/useExport.js +0 -16
- package/lib-cjs/component/hooks/useFilter.js +14 -0
- 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/hooks/useToolsFunctions.js +1 -1
- package/lib-cjs/component/loader/DropZone.js +7 -150
- package/lib-cjs/component/modal/AlignSpectraModal.js +1 -2
- package/lib-cjs/component/modal/EditPeakShapeModal.js +113 -0
- package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +2 -3
- package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +1 -2
- package/lib-cjs/component/modal/PredictSpectraModal.js +1 -1
- package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +9 -11
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +2 -2
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +3 -3
- package/lib-cjs/component/modal/editRange/forms/components/CouplingsTable.js +3 -8
- package/lib-cjs/component/modal/setting/DatabasesTabContent.js +2 -2
- package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
- package/lib-cjs/component/modal/setting/FormattingTabContent.js +2 -2
- package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +17 -13
- package/lib-cjs/component/modal/setting/WorkspaceItem.js +2 -2
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +3 -3
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +12 -9
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
- package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +11 -3
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib-cjs/component/panels/Panels.js +3 -3
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +45 -20
- package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +17 -0
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +42 -11
- 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/RangesPanel/RangesTableRow.js +3 -3
- package/lib-cjs/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/TableColumns/RangeAssignmentsColumn.js +2 -1
- package/lib-cjs/component/panels/RangesPanel/hooks/useMapRanges.js +3 -6
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumListItem.js +1 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/ColorIndicator.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/ShowHideMarkersButton.js +4 -1
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +4 -4
- package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +1 -2
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +2 -3
- package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib-cjs/component/panels/ZonesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -13
- package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +2 -2
- package/lib-cjs/component/panels/filtersPanel/FilterPanel.js +1 -1
- package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
- package/lib-cjs/component/panels/header/DefaultPanelHeader.js +3 -12
- package/lib-cjs/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +2 -2
- package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +15 -3
- package/lib-cjs/component/reducer/IgnoreActions.js +5 -0
- package/lib-cjs/component/reducer/Reducer.js +72 -50
- package/lib-cjs/component/reducer/actions/DomainActions.js +11 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +332 -205
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +15 -10
- package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +49 -19
- package/lib-cjs/component/reducer/actions/PeaksActions.js +54 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +87 -29
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +14 -11
- package/lib-cjs/component/reducer/actions/ToolsActions.js +46 -94
- package/lib-cjs/component/reducer/actions/ZonesActions.js +71 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- 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 +19 -0
- package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +2 -5
- package/lib-cjs/component/reducer/preferences/panelsPreferencesDefaultValues.js +3 -0
- package/lib-cjs/component/reducer/preferences/preferencesReducer.js +1 -1
- package/lib-cjs/component/reducer/types/Types.js +15 -3
- package/lib-cjs/component/tool/BrushX.js +1 -1
- package/lib-cjs/component/tool/BrushXY.js +4 -3
- package/lib-cjs/component/tool/CrossLinePointer.js +5 -4
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +21 -6
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +19 -6
- package/lib-cjs/component/toolbar/BasicToolBar.js +7 -14
- package/lib-cjs/component/toolbar/FunctionToolBar.js +12 -22
- package/lib-cjs/component/toolbar/ToolTypes.js +119 -9
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/basic.js +12 -11
- package/lib-cjs/component/workspaces/embedded.js +14 -13
- package/lib-cjs/component/workspaces/exercise.js +10 -6
- package/lib-cjs/component/workspaces/prediction.js +14 -13
- package/lib-cjs/component/workspaces/process1D.js +20 -19
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +14 -15
- package/lib-cjs/constants.js +1 -1
- package/lib-cjs/data/Filters.js +3 -3
- package/lib-cjs/data/FiltersManager.js +3 -6
- package/lib-cjs/data/PredictionManager.js +15 -15
- package/lib-cjs/data/SpectraManager.js +5 -100
- package/lib-cjs/data/constants/SignalsKinds.js +0 -8
- package/lib-cjs/data/data1d/Data1DManager.js +5 -5
- package/lib-cjs/data/data1d/Spectrum1D/SumManager.js +18 -12
- package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +2 -5
- package/lib-cjs/data/data1d/Spectrum1D/index.js +3 -1
- package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +5 -2
- package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +15 -19
- package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +28 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +3 -3
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +2 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +1 -1
- package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +2 -5
- package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +3 -6
- package/lib-cjs/data/data1d/database.js +4 -6
- package/lib-cjs/data/data1d/filter1d/apodization.js +70 -0
- package/lib-cjs/data/data1d/filter1d/baselineCorrection.js +11 -18
- package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/data/data1d/filter1d/zeroFillingAndApodization.js +30 -0
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +3 -6
- package/lib-cjs/data/data2d/Spectrum2D/zones/detectZones.js +3 -6
- package/lib-cjs/data/data2d/Spectrum2D/zones/detectZonesManual.js +3 -6
- package/lib-cjs/data/molecules/Molecule.js +5 -8
- package/lib-cjs/data/molecules/MoleculeManager.js +5 -5
- package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +0 -1
- package/lib-cjs/data/utilities/isInRange.js +7 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +36 -35
- package/lib/component/1d/PeakAnnotations.js +0 -41
- 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/lineBroadening.d.ts +0 -14
- package/lib/data/data1d/filter1d/lineBroadening.js +0 -57
- package/lib/data/migration/MigrationManager.d.ts +0 -2
- package/lib/data/migration/MigrationManager.js +0 -17
- 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/utilities/generateID.d.ts +0 -1
- package/lib/data/utilities/generateID.js +0 -9
- package/lib-cjs/component/1d/PeakAnnotations.js +0 -46
- 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 -48
- 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/lineBroadening.js +0 -63
- package/lib-cjs/data/migration/MigrationManager.js +0 -24
- 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/utilities/generateID.js +0 -12
|
@@ -26,188 +26,226 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.resetSpectrumByFilter = exports.filterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.deleteSpectraFilter = exports.deleteFilter = exports.enableFilter = exports.handleMultipleSpectraFilter = exports.calculateBaseLineCorrection = exports.calculateManualPhaseCorrection = exports.applyAbsoluteFilter = exports.applyAutoPhaseCorrectionFilter = exports.applyManualPhaseCorrectionFilter = exports.applyFFTFilter = exports.applyZeroFillingFilter = exports.shiftSpectrumAlongXAxis = void 0;
|
|
29
|
+
exports.setFilterChanges = exports.handleDisableFilterLivePreview = exports.handleDeleteExclusionZone = exports.handleAddExclusionZone = exports.resetSpectrumByFilter = exports.filterSnapshotHandler = exports.handleBaseLineCorrectionFilter = exports.deleteSpectraFilter = exports.deleteFilter = exports.enableFilter = exports.handleMultipleSpectraFilter = exports.calculateZeroFillingFilter = exports.calculateApodizationFilter = exports.calculateBaseLineCorrection = exports.calculateManualPhaseCorrection = exports.applyAbsoluteFilter = exports.applyAutoPhaseCorrectionFilter = exports.applyManualPhaseCorrectionFilter = exports.applyFFTFilter = exports.applyApodizationFilter = exports.applyZeroFillingFilter = exports.shiftSpectrumAlongXAxis = void 0;
|
|
30
|
+
const uuid_1 = require("@lukeed/uuid");
|
|
30
31
|
const immer_1 = require("immer");
|
|
31
32
|
const Filters = __importStar(require("../../../data/Filters"));
|
|
32
33
|
const FiltersManager = __importStar(require("../../../data/FiltersManager"));
|
|
33
34
|
const Spectrum1D_1 = require("../../../data/data1d/Spectrum1D");
|
|
35
|
+
const apodization_1 = require("../../../data/data1d/filter1d/apodization");
|
|
34
36
|
const autoPhaseCorrection_1 = require("../../../data/data1d/filter1d/autoPhaseCorrection");
|
|
35
37
|
const baselineCorrection_1 = require("../../../data/data1d/filter1d/baselineCorrection");
|
|
36
38
|
const phaseCorrection_1 = require("../../../data/data1d/filter1d/phaseCorrection");
|
|
39
|
+
const zeroFilling_1 = require("../../../data/data1d/filter1d/zeroFilling");
|
|
37
40
|
const Spectrum2D_1 = require("../../../data/data2d/Spectrum2D");
|
|
38
|
-
const
|
|
41
|
+
const ToolTypes_1 = require("../../toolbar/ToolTypes");
|
|
39
42
|
const getSpectraByNucleus_1 = require("../../utility/getSpectraByNucleus");
|
|
40
43
|
const nucleusToString_1 = __importDefault(require("../../utility/nucleusToString"));
|
|
41
44
|
const ZoomHistoryManager_1 = __importDefault(require("../helper/ZoomHistoryManager"));
|
|
45
|
+
const getActiveSpectrumOrFail_1 = require("../helper/getActiveSpectrumOrFail");
|
|
42
46
|
const getRange_1 = __importDefault(require("../helper/getRange"));
|
|
47
|
+
const getStrongestPeak_1 = require("../helper/getStrongestPeak");
|
|
43
48
|
const DomainActions_1 = require("./DomainActions");
|
|
44
49
|
const PreferencesActions_1 = require("./PreferencesActions");
|
|
45
50
|
const ToolsActions_1 = require("./ToolsActions");
|
|
46
51
|
function shiftSpectrumAlongXAxis(draft, shiftValue) {
|
|
47
52
|
//apply filter into the spectrum
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
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);
|
|
57
61
|
}
|
|
58
62
|
exports.shiftSpectrumAlongXAxis = shiftSpectrumAlongXAxis;
|
|
59
|
-
function applyZeroFillingFilter(draft,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
63
|
+
function applyZeroFillingFilter(draft, action) {
|
|
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);
|
|
74
77
|
}
|
|
75
78
|
exports.applyZeroFillingFilter = applyZeroFillingFilter;
|
|
79
|
+
function calculateApodizationFilter(draft, action) {
|
|
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;
|
|
90
|
+
}
|
|
91
|
+
exports.calculateApodizationFilter = calculateApodizationFilter;
|
|
92
|
+
function applyApodizationFilter(draft, action) {
|
|
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);
|
|
106
|
+
}
|
|
107
|
+
exports.applyApodizationFilter = applyApodizationFilter;
|
|
108
|
+
function calculateZeroFillingFilter(draft, action) {
|
|
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]];
|
|
120
|
+
}
|
|
121
|
+
exports.calculateZeroFillingFilter = calculateZeroFillingFilter;
|
|
76
122
|
function applyFFTFilter(draft) {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
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);
|
|
88
133
|
}
|
|
89
134
|
exports.applyFFTFilter = applyFFTFilter;
|
|
90
135
|
function applyManualPhaseCorrectionFilter(draft, filterOptions) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
136
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
137
|
+
const { index } = activeSpectrum;
|
|
138
|
+
const { ph0, ph1 } = filterOptions;
|
|
139
|
+
FiltersManager.applyFilter(draft.data[index], [
|
|
140
|
+
{ name: Filters.phaseCorrection.id, options: { ph0, ph1 } },
|
|
141
|
+
]);
|
|
142
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
143
|
+
draft.tempData = null;
|
|
144
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
101
145
|
}
|
|
102
146
|
exports.applyManualPhaseCorrectionFilter = applyManualPhaseCorrectionFilter;
|
|
103
147
|
function applyAbsoluteFilter(draft) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
148
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
149
|
+
const { index } = activeSpectrum;
|
|
150
|
+
FiltersManager.applyFilter(draft.data[index], [
|
|
151
|
+
{ name: Filters.absolute.id, options: {} },
|
|
152
|
+
]);
|
|
153
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
154
|
+
draft.tempData = null;
|
|
155
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
113
156
|
}
|
|
114
157
|
exports.applyAbsoluteFilter = applyAbsoluteFilter;
|
|
115
158
|
function applyAutoPhaseCorrectionFilter(draft) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
159
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
160
|
+
const { index } = activeSpectrum;
|
|
161
|
+
const { ph0, ph1 } = (0, autoPhaseCorrection_1.apply)(draft.data[index]);
|
|
162
|
+
FiltersManager.applyFilter(draft.data[index], [
|
|
163
|
+
{ name: Filters.phaseCorrection.id, options: { ph0, ph1 } },
|
|
164
|
+
]);
|
|
165
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
166
|
+
draft.tempData = null;
|
|
167
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
126
168
|
}
|
|
127
169
|
exports.applyAutoPhaseCorrectionFilter = applyAutoPhaseCorrectionFilter;
|
|
128
170
|
function calculateBaseLineCorrection(draft, action) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
let _data = { data: { x, re, im }, info };
|
|
141
|
-
(0, baselineCorrection_1.apply)(_data, {
|
|
142
|
-
zones,
|
|
143
|
-
...filterOptions,
|
|
144
|
-
});
|
|
145
|
-
const { im: newIm, re: newRe } = _data.data;
|
|
146
|
-
draft.tempData[index].data.im = newIm;
|
|
147
|
-
draft.tempData[index].data.re = newRe;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
exports.calculateBaseLineCorrection = calculateBaseLineCorrection;
|
|
152
|
-
function calculateManualPhaseCorrection(draft, filterOptions) {
|
|
153
|
-
if (draft.activeSpectrum) {
|
|
154
|
-
const { index } = draft.activeSpectrum;
|
|
155
|
-
const { data: { x, re, im }, info, } = draft.data[index];
|
|
156
|
-
const { ph0, ph1 } = filterOptions;
|
|
171
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
172
|
+
const { index } = activeSpectrum;
|
|
173
|
+
const { data: { x, re, im }, info, } = draft.data[index];
|
|
174
|
+
// save the baseline options temporary
|
|
175
|
+
draft.toolOptions.data.baselineCorrection = {
|
|
176
|
+
...draft.toolOptions.data.baselineCorrection,
|
|
177
|
+
...(action?.options ? { options: action.options } : {}),
|
|
178
|
+
};
|
|
179
|
+
const { zones, options } = draft.toolOptions.data.baselineCorrection;
|
|
180
|
+
const { livePreview, ...filterOptions } = options;
|
|
181
|
+
if (livePreview) {
|
|
157
182
|
let _data = { data: { x, re, im }, info };
|
|
158
|
-
(0,
|
|
183
|
+
(0, baselineCorrection_1.apply)(_data, {
|
|
184
|
+
zones,
|
|
185
|
+
...filterOptions,
|
|
186
|
+
});
|
|
159
187
|
const { im: newIm, re: newRe } = _data.data;
|
|
160
188
|
draft.tempData[index].data.im = newIm;
|
|
161
189
|
draft.tempData[index].data.re = newRe;
|
|
162
190
|
}
|
|
163
191
|
}
|
|
192
|
+
exports.calculateBaseLineCorrection = calculateBaseLineCorrection;
|
|
193
|
+
function calculateManualPhaseCorrection(draft, filterOptions) {
|
|
194
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
195
|
+
const { index } = activeSpectrum;
|
|
196
|
+
const { data: { x, re, im }, info, } = draft.data[index];
|
|
197
|
+
const { ph0, ph1 } = filterOptions;
|
|
198
|
+
let _data = { data: { x, re, im }, info };
|
|
199
|
+
(0, phaseCorrection_1.apply)(_data, { ph0, ph1 });
|
|
200
|
+
const { im: newIm, re: newRe } = _data.data;
|
|
201
|
+
draft.tempData[index].data.im = newIm;
|
|
202
|
+
draft.tempData[index].data.re = newRe;
|
|
203
|
+
}
|
|
164
204
|
exports.calculateManualPhaseCorrection = calculateManualPhaseCorrection;
|
|
165
205
|
function enableFilter(draft, filterID, checked) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
206
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
207
|
+
const { index } = activeSpectrum;
|
|
208
|
+
//apply filter into the spectrum
|
|
209
|
+
FiltersManager.enableFilter(draft.data[index], filterID, checked);
|
|
210
|
+
if (draft.data[index].info?.dimension === 1) {
|
|
211
|
+
(0, Spectrum1D_1.updateXShift)(draft.data[index]);
|
|
212
|
+
}
|
|
213
|
+
else if (draft.data[index].info?.dimension === 2) {
|
|
214
|
+
(0, Spectrum2D_1.updateShift)(draft.data[index]);
|
|
215
|
+
}
|
|
216
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
217
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
218
|
+
(0, DomainActions_1.setMode)(draft);
|
|
219
|
+
const zoomHistory = (0, ZoomHistoryManager_1.default)(draft.zoom.history, draft.view.spectra.activeTab);
|
|
220
|
+
const zoomValue = zoomHistory.getLast();
|
|
221
|
+
if (zoomValue) {
|
|
222
|
+
draft.xDomain = zoomValue.xDomain;
|
|
223
|
+
draft.yDomain = zoomValue.yDomain;
|
|
185
224
|
}
|
|
186
225
|
}
|
|
187
226
|
exports.enableFilter = enableFilter;
|
|
188
227
|
function deleteFilter(draft, actions) {
|
|
189
228
|
const filterID = actions.payload.id;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
else if (draft.data[index].info?.dimension === 2) {
|
|
198
|
-
(0, Spectrum2D_1.updateShift)(draft.data[index]);
|
|
199
|
-
}
|
|
200
|
-
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
201
|
-
(0, DomainActions_1.setDomain)(draft);
|
|
202
|
-
(0, DomainActions_1.setMode)(draft);
|
|
229
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
230
|
+
const { index } = activeSpectrum;
|
|
231
|
+
//apply filter into the spectrum
|
|
232
|
+
FiltersManager.deleteFilter(draft.data[index], filterID);
|
|
233
|
+
if (draft.data[index].info?.dimension === 1) {
|
|
234
|
+
(0, Spectrum1D_1.updateXShift)(draft.data[index]);
|
|
203
235
|
}
|
|
236
|
+
else if (draft.data[index].info?.dimension === 2) {
|
|
237
|
+
(0, Spectrum2D_1.updateShift)(draft.data[index]);
|
|
238
|
+
}
|
|
239
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
240
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
241
|
+
(0, DomainActions_1.setMode)(draft);
|
|
204
242
|
}
|
|
205
243
|
exports.deleteFilter = deleteFilter;
|
|
206
244
|
function deleteSpectraFilter(draft, actions) {
|
|
207
245
|
const filterType = actions.payload.filterType;
|
|
208
|
-
if (draft.activeTab) {
|
|
246
|
+
if (draft.view.spectra.activeTab) {
|
|
209
247
|
for (const datum of draft.data) {
|
|
210
|
-
if ((0, nucleusToString_1.default)(datum?.info?.nucleus) === draft.activeTab) {
|
|
248
|
+
if ((0, nucleusToString_1.default)(datum?.info?.nucleus) === draft.view.spectra.activeTab) {
|
|
211
249
|
const filtersResult = datum.filters?.filter((filter) => filter.name === filterType) || [];
|
|
212
250
|
filtersResult.forEach((filter) => {
|
|
213
251
|
FiltersManager.deleteFilter(datum, filter.id);
|
|
@@ -227,93 +265,91 @@ function deleteSpectraFilter(draft, actions) {
|
|
|
227
265
|
}
|
|
228
266
|
exports.deleteSpectraFilter = deleteSpectraFilter;
|
|
229
267
|
function handleBaseLineCorrectionFilter(draft, action) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
268
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
269
|
+
const { index } = activeSpectrum;
|
|
270
|
+
const { zones } = draft.toolOptions.data.baselineCorrection;
|
|
271
|
+
const { livePreview, ...options } = action.options;
|
|
272
|
+
FiltersManager.applyFilter(draft.data[index], [
|
|
273
|
+
{
|
|
274
|
+
name: Filters.baselineCorrection.id,
|
|
275
|
+
options: {
|
|
276
|
+
zones,
|
|
277
|
+
...options,
|
|
240
278
|
},
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
279
|
+
},
|
|
280
|
+
]);
|
|
281
|
+
const xDomainSnapshot = draft.xDomain.slice();
|
|
282
|
+
(0, ToolsActions_1.resetSelectedTool)(draft);
|
|
283
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
284
|
+
draft.xDomain = xDomainSnapshot;
|
|
247
285
|
}
|
|
248
286
|
exports.handleBaseLineCorrectionFilter = handleBaseLineCorrectionFilter;
|
|
249
287
|
/**
|
|
250
288
|
* reset spectrum data for specific point of time (Filter)
|
|
251
289
|
* @param {object} draft
|
|
252
|
-
* @param {string} id Filter id
|
|
253
290
|
* @param {object} options
|
|
291
|
+
* @param {string} options.id Filter id
|
|
254
292
|
* @param {boolean=} options.resetTool
|
|
255
293
|
* @param {boolean=} options.updateDomain
|
|
256
294
|
* @param {boolean=} options.rollback
|
|
257
295
|
*/
|
|
258
|
-
function resetSpectrumByFilter(draft,
|
|
259
|
-
const { updateDomain = true, rollback = false, searchBy = 'id',
|
|
296
|
+
function resetSpectrumByFilter(draft, options) {
|
|
297
|
+
const { updateDomain = true, rollback = false, searchBy = 'id', applyFilter = false, // the filter that we rollback and return the affect data for the selected spectrum
|
|
298
|
+
filterId, } = options || {};
|
|
260
299
|
let currentDatum = null;
|
|
261
|
-
const currentActiveSpectrum =
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
if (
|
|
265
|
-
const
|
|
266
|
-
|
|
267
|
-
if (
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (
|
|
281
|
-
|
|
282
|
-
const newDatum = (0, immer_1.current)(draft).data[index];
|
|
283
|
-
if (newDatum.info?.dimension === 1) {
|
|
284
|
-
FiltersManager.applyFilter(newDatum, [{ name, options }]);
|
|
285
|
-
}
|
|
286
|
-
currentDatum = { datum: newDatum, index };
|
|
300
|
+
const currentActiveSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
301
|
+
const index = currentActiveSpectrum.index;
|
|
302
|
+
const datum = draft.data[index];
|
|
303
|
+
if (filterId && draft.toolOptions.data.activeFilterID !== filterId) {
|
|
304
|
+
const filterIndex = datum.filters.findIndex((f) => f[searchBy] === filterId);
|
|
305
|
+
let filters = [];
|
|
306
|
+
if (filterIndex !== -1) {
|
|
307
|
+
filters = datum.filters.slice(0, rollback ? filterIndex : filterIndex + 1);
|
|
308
|
+
if (filters.length >= 1) {
|
|
309
|
+
draft.toolOptions.data.activeFilterID =
|
|
310
|
+
datum.filters[rollback ? filterIndex - 1 : filterIndex]?.id;
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
draft.toolOptions.data.activeFilterID = null;
|
|
314
|
+
}
|
|
315
|
+
FiltersManager.reapplyFilters(datum, filters);
|
|
316
|
+
if (applyFilter) {
|
|
317
|
+
const { name, value: options } = datum.filters[filterIndex];
|
|
318
|
+
const newDatum = (0, immer_1.current)(draft).data[index];
|
|
319
|
+
if (newDatum.info?.dimension === 1) {
|
|
320
|
+
FiltersManager.applyFilter(newDatum, [{ name, options }]);
|
|
287
321
|
}
|
|
322
|
+
currentDatum = { datum: newDatum, index };
|
|
288
323
|
}
|
|
289
324
|
}
|
|
290
|
-
else {
|
|
291
|
-
//close filter snapshot mode and replay all enabled filters
|
|
292
|
-
draft.toolOptions.data.activeFilterID = null;
|
|
293
|
-
FiltersManager.reapplyFilters(datum);
|
|
294
|
-
}
|
|
295
|
-
if (datum.info?.dimension === 1) {
|
|
296
|
-
(0, Spectrum1D_1.updateXShift)(datum);
|
|
297
|
-
}
|
|
298
|
-
else if (datum.info?.dimension === 2) {
|
|
299
|
-
(0, Spectrum2D_1.updateShift)(datum);
|
|
300
|
-
}
|
|
301
|
-
if (updateDomain) {
|
|
302
|
-
(0, DomainActions_1.setDomain)(draft);
|
|
303
|
-
(0, DomainActions_1.setMode)(draft);
|
|
304
|
-
}
|
|
305
325
|
}
|
|
306
|
-
|
|
326
|
+
else {
|
|
327
|
+
//close filter snapshot mode and replay all enabled filters
|
|
328
|
+
draft.toolOptions.data.activeFilterID = null;
|
|
329
|
+
FiltersManager.reapplyFilters(datum);
|
|
330
|
+
}
|
|
331
|
+
if (datum.info?.dimension === 1) {
|
|
332
|
+
(0, Spectrum1D_1.updateXShift)(datum);
|
|
333
|
+
}
|
|
334
|
+
else if (datum.info?.dimension === 2) {
|
|
335
|
+
(0, Spectrum2D_1.updateShift)(datum);
|
|
336
|
+
}
|
|
337
|
+
if (updateDomain) {
|
|
338
|
+
(0, DomainActions_1.setDomain)(draft);
|
|
339
|
+
(0, DomainActions_1.setMode)(draft);
|
|
340
|
+
}
|
|
341
|
+
if (applyFilter) {
|
|
307
342
|
return currentDatum;
|
|
308
343
|
}
|
|
309
344
|
}
|
|
310
345
|
exports.resetSpectrumByFilter = resetSpectrumByFilter;
|
|
311
346
|
function filterSnapshotHandler(draft, action) {
|
|
312
|
-
|
|
347
|
+
const { filterId } = action.payload;
|
|
348
|
+
resetSpectrumByFilter(draft, { filterId });
|
|
313
349
|
}
|
|
314
350
|
exports.filterSnapshotHandler = filterSnapshotHandler;
|
|
315
351
|
function handleMultipleSpectraFilter(draft, action) {
|
|
316
|
-
const spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.activeTab, draft.data);
|
|
352
|
+
const spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.view.spectra.activeTab, draft.data);
|
|
317
353
|
if (spectra && spectra.length > 0 && Array.isArray(action.payload)) {
|
|
318
354
|
const exclusions = spectra[0].filters.find((f) => f.name === Filters.exclusionZones.id)
|
|
319
355
|
?.value || [];
|
|
@@ -337,12 +373,14 @@ function handleAddExclusionZone(draft, action) {
|
|
|
337
373
|
const { from: startX, to: endX } = action.payload;
|
|
338
374
|
const range = (0, getRange_1.default)(draft, { startX, endX });
|
|
339
375
|
let spectra;
|
|
340
|
-
|
|
341
|
-
|
|
376
|
+
// todo: refactor this
|
|
377
|
+
const activeSpectrum = draft.view.spectra.activeSpectra[draft.view.spectra.activeTab];
|
|
378
|
+
if (activeSpectrum?.id) {
|
|
379
|
+
const index = activeSpectrum?.index;
|
|
342
380
|
spectra = [draft.data[index]];
|
|
343
381
|
}
|
|
344
382
|
else {
|
|
345
|
-
spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.activeTab, draft.data);
|
|
383
|
+
spectra = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.view.spectra.activeTab, draft.data);
|
|
346
384
|
}
|
|
347
385
|
for (const spectrum of spectra) {
|
|
348
386
|
FiltersManager.applyFilter(spectrum, [
|
|
@@ -350,7 +388,7 @@ function handleAddExclusionZone(draft, action) {
|
|
|
350
388
|
name: Filters.exclusionZones.id,
|
|
351
389
|
options: [
|
|
352
390
|
{
|
|
353
|
-
id: (0,
|
|
391
|
+
id: (0, uuid_1.v4)(),
|
|
354
392
|
from: range[0],
|
|
355
393
|
to: range[1],
|
|
356
394
|
},
|
|
@@ -362,17 +400,106 @@ function handleAddExclusionZone(draft, action) {
|
|
|
362
400
|
}
|
|
363
401
|
exports.handleAddExclusionZone = handleAddExclusionZone;
|
|
364
402
|
function handleDeleteExclusionZone(draft, action) {
|
|
365
|
-
const {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
403
|
+
const { zone, spectrumID } = action.payload;
|
|
404
|
+
// if spectrum id exists, remove the selected exclusive zone in the spectrum
|
|
405
|
+
if (spectrumID) {
|
|
406
|
+
const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === spectrumID);
|
|
407
|
+
const filter = draft.data[spectrumIndex].filters.find((_filter) => _filter.name === Filters.exclusionZones.id);
|
|
408
|
+
if (filter) {
|
|
409
|
+
if (filter.value.length === 1) {
|
|
410
|
+
FiltersManager.deleteFilter(draft.data[spectrumIndex], filter.id);
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
filter.value = filter.value.filter((_zone) => _zone.id !== zone?.id);
|
|
414
|
+
FiltersManager.reapplyFilters(draft.data[spectrumIndex]);
|
|
415
|
+
}
|
|
371
416
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
// remove all exclusive zone that have the same range in all spectra
|
|
420
|
+
const data = (0, getSpectraByNucleus_1.getSpectraByNucleus)(draft.view.spectra.activeTab, draft.data);
|
|
421
|
+
for (const datum of data) {
|
|
422
|
+
for (const filter of datum.filters) {
|
|
423
|
+
if (filter.name === Filters.exclusionZones.id) {
|
|
424
|
+
filter.value = filter.value.filter((_zone) => zone.from !== _zone.from && zone.to !== _zone.to);
|
|
425
|
+
FiltersManager.reapplyFilters(datum);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
375
428
|
}
|
|
376
429
|
}
|
|
377
430
|
}
|
|
378
431
|
exports.handleDeleteExclusionZone = handleDeleteExclusionZone;
|
|
432
|
+
function handleDisableFilterLivePreview(draft, action) {
|
|
433
|
+
const { selectedTool } = action.payload;
|
|
434
|
+
setFilterChanges(draft, selectedTool);
|
|
435
|
+
if (selectedTool === ToolTypes_1.options.zeroFilling.id) {
|
|
436
|
+
(0, DomainActions_1.setDomain)(draft, { yDomain: { isChanged: false } });
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
exports.handleDisableFilterLivePreview = handleDisableFilterLivePreview;
|
|
440
|
+
function checkFilterHasTempData(selectedToolId) {
|
|
441
|
+
return [
|
|
442
|
+
ToolTypes_1.options.phaseCorrection.id,
|
|
443
|
+
ToolTypes_1.options.baselineCorrection.id,
|
|
444
|
+
ToolTypes_1.options.apodization.id,
|
|
445
|
+
ToolTypes_1.options.zeroFilling.id,
|
|
446
|
+
].includes(selectedToolId);
|
|
447
|
+
}
|
|
448
|
+
function setFilterChanges(draft, selectedFilterID) {
|
|
449
|
+
const activeSpectrum = (0, getActiveSpectrumOrFail_1.getActiveSpectrumOrFail)(draft);
|
|
450
|
+
const activeSpectrumId = activeSpectrum.id;
|
|
451
|
+
// 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
|
|
452
|
+
if (checkFilterHasTempData(selectedFilterID)) {
|
|
453
|
+
//return back the spectra data to point of time before applying a specific filter
|
|
454
|
+
const isPhaseCorrection = selectedFilterID === ToolTypes_1.options.phaseCorrection.id;
|
|
455
|
+
const updateDomain = [
|
|
456
|
+
ToolTypes_1.options.zeroFilling.id,
|
|
457
|
+
ToolTypes_1.options.apodization.id,
|
|
458
|
+
].includes(selectedFilterID);
|
|
459
|
+
const rollbackSpectrumData = resetSpectrumByFilter(draft, {
|
|
460
|
+
updateDomain,
|
|
461
|
+
rollback: true,
|
|
462
|
+
searchBy: 'name',
|
|
463
|
+
filterId: selectedFilterID,
|
|
464
|
+
applyFilter: isPhaseCorrection,
|
|
465
|
+
});
|
|
466
|
+
// create a temporary clone of the data
|
|
467
|
+
draft.tempData = (0, immer_1.current)(draft).data;
|
|
468
|
+
if (rollbackSpectrumData) {
|
|
469
|
+
draft.tempData[rollbackSpectrumData?.index] = rollbackSpectrumData?.datum;
|
|
470
|
+
}
|
|
471
|
+
switch (selectedFilterID) {
|
|
472
|
+
case ToolTypes_1.options.phaseCorrection.id: {
|
|
473
|
+
// look for the strongest peak to set it as a pivot
|
|
474
|
+
const { xValue, index } = (0, getStrongestPeak_1.getStrongestPeak)(draft) || {
|
|
475
|
+
xValue: 0,
|
|
476
|
+
index: 0,
|
|
477
|
+
};
|
|
478
|
+
draft.toolOptions.data.pivot = { value: xValue, index };
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
case ToolTypes_1.options.baselineCorrection.id: {
|
|
482
|
+
const baselineCorrectionFilter = (0, immer_1.current)(draft).data[activeSpectrum.index].filters.find((filter) => filter.name === ToolTypes_1.options.baselineCorrection.id);
|
|
483
|
+
if (baselineCorrectionFilter) {
|
|
484
|
+
draft.toolOptions.data.baselineCorrection.zones =
|
|
485
|
+
baselineCorrectionFilter
|
|
486
|
+
? baselineCorrectionFilter.value.zones
|
|
487
|
+
: [];
|
|
488
|
+
}
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
case ToolTypes_1.options.apodization.id: {
|
|
492
|
+
draft.toolOptions.data.apodizationOptions = apodization_1.defaultApodizationOptions;
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
default:
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
else if (checkFilterHasTempData(draft.toolOptions.selectedTool)) {
|
|
500
|
+
draft.toolOptions.data.activeFilterID = null;
|
|
501
|
+
const spectrumIndex = draft.data.findIndex((spectrum) => spectrum.id === activeSpectrumId);
|
|
502
|
+
draft.data[spectrumIndex].data = draft.tempData[spectrumIndex].data;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
exports.setFilterChanges = setFilterChanges;
|