nmrium 1.1.0 → 1.2.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/ExclusionZoneAnnotation.js +1 -1
- package/lib/component/1d/FloatPublicationString.js +2 -2
- package/lib/component/1d/FloatingRanges.js +3 -3
- package/lib/component/1d/FloatingRanges.js.map +1 -1
- package/lib/component/1d/FooterBanner.js +1 -1
- package/lib/component/1d/LinesSeries.js +1 -1
- package/lib/component/1d/PredictionErrorsNotations.js +2 -2
- package/lib/component/1d/inset/DraggableInset.js +2 -2
- package/lib/component/1d/multiAnalysis/AnalysisRange.js +1 -1
- package/lib/component/1d/multiAnalysis/AnalysisRange.js.map +1 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.d.ts +1 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.d.ts.map +1 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +3 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js.map +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js.map +1 -1
- package/lib/component/1d/peaks/Peaks.d.ts.map +1 -1
- package/lib/component/1d/peaks/Peaks.js +1 -1
- package/lib/component/1d/peaks/Peaks.js.map +1 -1
- package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -3
- package/lib/component/1d-2d/tools/BrushXY.js +2 -2
- package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +1 -1
- package/lib/component/2d/SignalDeltaLine.js +1 -1
- package/lib/component/2d/zones/Signal.d.ts.map +1 -1
- package/lib/component/2d/zones/Signal.js +1 -1
- package/lib/component/2d/zones/Signal.js.map +1 -1
- package/lib/component/2d/zones/SignalsGuideLines.js +2 -2
- package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
- package/lib/component/2d/zones/Zone.d.ts.map +1 -1
- package/lib/component/2d/zones/Zone.js +3 -1
- package/lib/component/2d/zones/Zone.js.map +1 -1
- package/lib/component/2d/zones/ZonesAssignmentsLabels.js +1 -1
- package/lib/component/elements/ActionsButtonsPopover.js +4 -4
- package/lib/component/elements/Alert.js +2 -2
- package/lib/component/elements/AssignmentsCell.js +1 -1
- package/lib/component/elements/Button.js +10 -10
- package/lib/component/elements/Button.js.map +1 -1
- package/lib/component/elements/DraggableDialog.js +3 -3
- package/lib/component/elements/EditableColumn.js +3 -3
- package/lib/component/elements/EmptyText.js +2 -2
- package/lib/component/elements/Footer.js +9 -9
- package/lib/component/elements/Footer.js.map +1 -1
- package/lib/component/elements/MoleculeSelection.js +19 -19
- package/lib/component/elements/MoleculeSelection.js.map +1 -1
- package/lib/component/elements/NextPrev.js +15 -15
- package/lib/component/elements/NextPrev.js.map +1 -1
- package/lib/component/elements/ReactTable/BaseReactTable.js +6 -6
- package/lib/component/elements/ReadOnly.js +8 -8
- package/lib/component/elements/ReadOnly.js.map +1 -1
- package/lib/component/elements/Sections.js +29 -29
- package/lib/component/elements/Sections.js.map +1 -1
- package/lib/component/elements/Select.js +10 -10
- package/lib/component/elements/Select.js.map +1 -1
- package/lib/component/elements/StyledDialogBody.js +1 -1
- package/lib/component/elements/StyledDialogBody.js.map +1 -1
- package/lib/component/elements/Tab/DeleteButton.js +5 -5
- package/lib/component/elements/Tab/Tabs.js +5 -5
- package/lib/component/elements/dropDownButton/DropDownList.js +6 -6
- package/lib/component/elements/export/ExportManager.d.ts.map +1 -1
- package/lib/component/elements/export/ExportManager.js +12 -1
- package/lib/component/elements/export/ExportManager.js.map +1 -1
- package/lib/component/elements/resizer/SVGResizer.js +1 -1
- package/lib/component/header/Header.js +1 -1
- package/lib/component/hooks/useExport.d.ts.map +1 -1
- package/lib/component/hooks/useExport.js +25 -10
- package/lib/component/hooks/useExport.js.map +1 -1
- package/lib/component/hooks/useFilter.d.ts.map +1 -1
- package/lib/component/hooks/useFilter.js +4 -5
- package/lib/component/hooks/useFilter.js.map +1 -1
- package/lib/component/hooks/useSaveSettings.js +2 -2
- package/lib/component/loader/DefaultSpinnerComponent.js +9 -9
- package/lib/component/loader/DropZone.js +8 -8
- package/lib/component/main/ErrorOverlay.js +4 -4
- package/lib/component/main/InnerNMRiumContents.js +3 -3
- package/lib/component/modal/AboutPredictionModal.js +2 -2
- package/lib/component/modal/AboutSpectrumSimulationModal.js +2 -2
- package/lib/component/modal/MultipletAnalysisModal.js +12 -12
- package/lib/component/modal/PredictSpectraModal.js +4 -4
- package/lib/component/modal/PublicationStringModal.js +2 -2
- package/lib/component/modal/aboutUs/AboutUsModal.js +3 -3
- package/lib/component/modal/changeSum/ChangeSumModalContents.js +1 -1
- package/lib/component/modal/changeSum/SelectMolecule.js +5 -5
- package/lib/component/modal/changeSum/SelectMolecule.js.map +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +5 -5
- package/lib/component/panels/Panels.js +2 -2
- package/lib/component/panels/PanelsBar.js +3 -3
- package/lib/component/panels/PanelsBar.js.map +1 -1
- package/lib/component/panels/RangesPanel/RangesTable.js +6 -6
- package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
- package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +9 -9
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/Confirmation.js +5 -5
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +11 -11
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +7 -7
- package/lib/component/panels/SummaryPanel/Overview.js +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts.map +1 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -5
- package/lib/component/panels/SummaryPanel/SummaryPanel.js.map +1 -1
- package/lib/component/panels/ZonesPanel/ZonesTable.js +6 -6
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.d.ts.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js +11 -3
- package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js.map +1 -1
- package/lib/component/panels/filtersPanel/Filters/InnerFilterHeader.js +1 -1
- package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +4 -4
- package/lib/component/panels/predictionPanel/PredictionPanel.js +6 -6
- package/lib/component/panels/predictionPanel/PredictionPanel.js.map +1 -1
- package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
- package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +54 -28
- package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
- package/lib/component/workspaces/assignment.d.ts.map +1 -1
- package/lib/component/workspaces/assignment.js +1 -0
- package/lib/component/workspaces/assignment.js.map +1 -1
- package/lib/component/workspaces/basic.d.ts.map +1 -1
- package/lib/component/workspaces/basic.js +1 -0
- package/lib/component/workspaces/basic.js.map +1 -1
- package/lib/component/workspaces/embedded.d.ts.map +1 -1
- package/lib/component/workspaces/embedded.js +1 -0
- package/lib/component/workspaces/embedded.js.map +1 -1
- package/lib/component/workspaces/exercise.d.ts.map +1 -1
- package/lib/component/workspaces/exercise.js +1 -0
- package/lib/component/workspaces/exercise.js.map +1 -1
- package/lib/component/workspaces/prediction.d.ts.map +1 -1
- package/lib/component/workspaces/prediction.js +1 -0
- package/lib/component/workspaces/prediction.js.map +1 -1
- package/lib/component/workspaces/process1D.d.ts.map +1 -1
- package/lib/component/workspaces/process1D.js +1 -0
- package/lib/component/workspaces/process1D.js.map +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
- package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
- package/lib/data/PredictionManager.d.ts.map +1 -1
- package/lib/data/PredictionManager.js +7 -21
- package/lib/data/PredictionManager.js.map +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.js.map +1 -1
- package/lib/data/data2d/Spectrum2D/getMissingProjection.d.ts +1 -1
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
- package/lib/data/utilities/generateColor.d.ts.map +1 -1
- package/lib/data/utilities/generateColor.js +1 -1
- package/lib/data/utilities/generateColor.js.map +1 -1
- package/lib/data/utilities/isNumber.js +1 -1
- package/lib/data/utilities/isNumber.js.map +1 -1
- package/lib/utils/clipboard/clipboardComponents.js +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +41 -36
- package/src/component/1d/ExclusionZoneAnnotation.tsx +1 -1
- package/src/component/1d/FloatPublicationString.tsx +2 -2
- package/src/component/1d/FloatingRanges.tsx +3 -3
- package/src/component/1d/FooterBanner.tsx +1 -1
- package/src/component/1d/LinesSeries.tsx +1 -1
- package/src/component/1d/PredictionErrorsNotations.tsx +2 -2
- package/src/component/1d/inset/DraggableInset.tsx +2 -2
- package/src/component/1d/multiAnalysis/AnalysisRange.tsx +1 -1
- package/src/component/1d/multiAnalysis/MultiAnalysisRanges.tsx +3 -1
- package/src/component/1d/multiplicityTree/MultiplicityTree.tsx +1 -1
- package/src/component/1d/peaks/Peaks.tsx +2 -6
- package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +3 -3
- package/src/component/1d-2d/tools/BrushXY.tsx +2 -2
- package/src/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.tsx +1 -1
- package/src/component/2d/SignalDeltaLine.tsx +1 -1
- package/src/component/2d/zones/Signal.tsx +2 -1
- package/src/component/2d/zones/SignalsGuideLines.tsx +2 -2
- package/src/component/2d/zones/Zone.tsx +2 -1
- package/src/component/2d/zones/ZonesAssignmentsLabels.tsx +1 -1
- package/src/component/elements/ActionsButtonsPopover.tsx +4 -4
- package/src/component/elements/Alert.tsx +2 -2
- package/src/component/elements/AssignmentsCell.tsx +1 -1
- package/src/component/elements/Button.tsx +10 -10
- package/src/component/elements/DraggableDialog.tsx +3 -3
- package/src/component/elements/EditableColumn.tsx +3 -3
- package/src/component/elements/EmptyText.tsx +2 -2
- package/src/component/elements/Footer.tsx +9 -9
- package/src/component/elements/MoleculeSelection.tsx +19 -19
- package/src/component/elements/NextPrev.tsx +15 -15
- package/src/component/elements/ReactTable/BaseReactTable.tsx +6 -6
- package/src/component/elements/ReadOnly.tsx +8 -8
- package/src/component/elements/Sections.tsx +29 -29
- package/src/component/elements/Select.tsx +10 -10
- package/src/component/elements/StyledDialogBody.tsx +1 -1
- package/src/component/elements/Tab/DeleteButton.tsx +5 -5
- package/src/component/elements/Tab/Tabs.tsx +5 -5
- package/src/component/elements/dropDownButton/DropDownList.tsx +6 -6
- package/src/component/elements/export/ExportManager.tsx +13 -3
- package/src/component/elements/resizer/SVGResizer.tsx +1 -1
- package/src/component/header/Header.tsx +1 -1
- package/src/component/hooks/useExport.tsx +21 -10
- package/src/component/hooks/useFilter.ts +4 -6
- package/src/component/hooks/useSaveSettings.tsx +2 -2
- package/src/component/loader/DefaultSpinnerComponent.tsx +9 -9
- package/src/component/loader/DropZone.tsx +8 -8
- package/src/component/main/ErrorOverlay.tsx +4 -4
- package/src/component/main/InnerNMRiumContents.tsx +3 -3
- package/src/component/modal/AboutPredictionModal.tsx +2 -2
- package/src/component/modal/AboutSpectrumSimulationModal.tsx +2 -2
- package/src/component/modal/MultipletAnalysisModal.tsx +12 -12
- package/src/component/modal/PredictSpectraModal.tsx +4 -4
- package/src/component/modal/PublicationStringModal.tsx +2 -2
- package/src/component/modal/aboutUs/AboutUsModal.tsx +3 -3
- package/src/component/modal/changeSum/ChangeSumModalContents.tsx +1 -1
- package/src/component/modal/changeSum/SelectMolecule.tsx +5 -5
- package/src/component/modal/setting/GeneralSettings.tsx +5 -5
- package/src/component/panels/Panels.tsx +2 -2
- package/src/component/panels/PanelsBar.tsx +3 -3
- package/src/component/panels/RangesPanel/RangesTable.tsx +6 -6
- package/src/component/panels/RangesPanel/TableColumns/ActionsColumn.tsx +1 -1
- package/src/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.tsx +9 -9
- package/src/component/panels/SummaryPanel/CorrelationTable/editLink/Confirmation.tsx +5 -5
- package/src/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.tsx +11 -11
- package/src/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.tsx +7 -7
- package/src/component/panels/SummaryPanel/Overview.tsx +1 -1
- package/src/component/panels/SummaryPanel/SummaryPanel.tsx +6 -5
- package/src/component/panels/ZonesPanel/ZonesTable.tsx +6 -6
- package/src/component/panels/filtersPanel/Filters/FiltersSectionsPanel.tsx +12 -3
- package/src/component/panels/filtersPanel/Filters/InnerFilterHeader.tsx +1 -1
- package/src/component/panels/multipleAnalysisPanel/AlignSpectra.tsx +4 -4
- package/src/component/panels/predictionPanel/PredictionPanel.tsx +6 -6
- package/src/component/panels/predictionPanel/PredictionSimpleOptions.tsx +1 -1
- package/src/component/reducer/actions/FiltersActions.ts +162 -81
- package/src/component/workspaces/assignment.ts +1 -0
- package/src/component/workspaces/basic.ts +1 -0
- package/src/component/workspaces/embedded.ts +1 -0
- package/src/component/workspaces/exercise.ts +1 -0
- package/src/component/workspaces/prediction.ts +1 -0
- package/src/component/workspaces/process1D.ts +1 -0
- package/src/component/workspaces/workspaceDefaultProperties.ts +1 -0
- package/src/data/PredictionManager.ts +8 -23
- package/src/data/data1d/Spectrum1D/ranges/resurrectSpectrum.ts +1 -1
- package/src/data/utilities/generateColor.ts +5 -3
- package/src/data/utilities/isNumber.ts +1 -1
- package/src/utils/clipboard/clipboardComponents.tsx +1 -1
- package/src/versionInfo.ts +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
AirplsOptions,
|
|
2
3
|
Apodization1DOptions,
|
|
3
4
|
BaselineCorrectionOptions,
|
|
4
5
|
Filter1DEntry,
|
|
@@ -6,6 +7,7 @@ import type {
|
|
|
6
7
|
Filter2DEntry,
|
|
7
8
|
Filter2DOptions,
|
|
8
9
|
MatrixOptions,
|
|
10
|
+
PolynomialOptions,
|
|
9
11
|
} from '@zakodium/nmr-types';
|
|
10
12
|
import type { Spectrum1D, Spectrum2D, Spectrum } from '@zakodium/nmrium-core';
|
|
11
13
|
import type { NmrData1D, NmrData2DFt } from 'cheminfo-types';
|
|
@@ -444,10 +446,16 @@ function rollbackSpectrumByFilter(
|
|
|
444
446
|
const filterIndex = spectrum.filters.findIndex((f) => f[searchBy] === key);
|
|
445
447
|
if (filterIndex === -1 || reset) {
|
|
446
448
|
if (draft.tempData) {
|
|
447
|
-
|
|
449
|
+
const activeFilterIndex = toolData.activeFilterID
|
|
450
|
+
? spectrum.filters.findIndex((f) => f.id === toolData.activeFilterID)
|
|
451
|
+
: spectrum.filters.length - 1;
|
|
452
|
+
const filters = spectrum.filters.slice(0, activeFilterIndex);
|
|
453
|
+
reapplyFilters(spectrum, filters);
|
|
448
454
|
}
|
|
455
|
+
|
|
449
456
|
//if the filter is not exists, create a clone of the current data
|
|
450
457
|
draft.tempData = structuredClone(current(draft).data);
|
|
458
|
+
|
|
451
459
|
draft.tempData[index] = spectrum;
|
|
452
460
|
spectrum = structuredClone(spectrum);
|
|
453
461
|
|
|
@@ -576,6 +584,12 @@ function rollbackSpectrum(
|
|
|
576
584
|
afterRollback(draft, filterKey);
|
|
577
585
|
}
|
|
578
586
|
|
|
587
|
+
function hasBaselineZones(
|
|
588
|
+
filterOptions,
|
|
589
|
+
): filterOptions is PolynomialOptions | AirplsOptions {
|
|
590
|
+
return 'zones' in filterOptions;
|
|
591
|
+
}
|
|
592
|
+
|
|
579
593
|
function getTwoDimensionFilterOptions(
|
|
580
594
|
draft: Draft<State>,
|
|
581
595
|
): TwoDimensionPhaseCorrection['traces'] | null {
|
|
@@ -692,17 +706,20 @@ function beforeRollback(draft: Draft<State>, filterKey) {
|
|
|
692
706
|
const baselineCorrectionFilter = datum.filters.find(
|
|
693
707
|
(filter) => filter.name === Filters1D.baselineCorrection.name,
|
|
694
708
|
);
|
|
709
|
+
|
|
710
|
+
const filterOptions = baselineCorrectionFilter?.value;
|
|
711
|
+
|
|
695
712
|
if (
|
|
696
|
-
|
|
697
|
-
(
|
|
698
|
-
|
|
713
|
+
filterOptions &&
|
|
714
|
+
hasBaselineZones(filterOptions) &&
|
|
715
|
+
filterOptions.zones.length > 0
|
|
699
716
|
) {
|
|
700
|
-
draft.toolOptions.data.baselineCorrection.zones =
|
|
701
|
-
|
|
702
|
-
} else {
|
|
703
|
-
draft.toolOptions.data.baselineCorrection.zones =
|
|
704
|
-
baselineCorrectionFilter.value.zones;
|
|
717
|
+
draft.toolOptions.data.baselineCorrection.zones = filterOptions.zones;
|
|
718
|
+
return;
|
|
705
719
|
}
|
|
720
|
+
|
|
721
|
+
draft.toolOptions.data.baselineCorrection.zones =
|
|
722
|
+
getBaselineZonesByDietrich(datum.data as NmrData1D);
|
|
706
723
|
}
|
|
707
724
|
break;
|
|
708
725
|
}
|
|
@@ -833,6 +850,7 @@ function handleApplyZeroFillingFilter(
|
|
|
833
850
|
draft: Draft<State>,
|
|
834
851
|
action: ZeroFillingFilterAction,
|
|
835
852
|
) {
|
|
853
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
836
854
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
837
855
|
|
|
838
856
|
if (!activeSpectrum || !draft.tempData) {
|
|
@@ -847,9 +865,12 @@ function handleApplyZeroFillingFilter(
|
|
|
847
865
|
enabled: true,
|
|
848
866
|
},
|
|
849
867
|
];
|
|
850
|
-
Filters1DManager.applyFilters(draft.tempData[index], filters);
|
|
851
|
-
draft.data[index] = draft.tempData[index];
|
|
852
868
|
|
|
869
|
+
Filters1DManager.applyFilters(draft.tempData[index], filters, {
|
|
870
|
+
filterIndex: activeFilterIndex,
|
|
871
|
+
forceReapply: activeFilterIndex !== -1,
|
|
872
|
+
});
|
|
873
|
+
draft.data[index] = draft.tempData[index];
|
|
853
874
|
updateView(draft, zeroFilling.domainUpdateRules);
|
|
854
875
|
}
|
|
855
876
|
//action
|
|
@@ -857,6 +878,7 @@ function handleApplyZeroFillingDimensionOneFilter(
|
|
|
857
878
|
draft: Draft<State>,
|
|
858
879
|
action: ZeroFillingDimensionOneFilterAction,
|
|
859
880
|
) {
|
|
881
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
860
882
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
861
883
|
|
|
862
884
|
if (!activeSpectrum || !draft.tempData) {
|
|
@@ -871,7 +893,10 @@ function handleApplyZeroFillingDimensionOneFilter(
|
|
|
871
893
|
enabled: true,
|
|
872
894
|
},
|
|
873
895
|
];
|
|
874
|
-
Filters2DManager.applyFilters(draft.tempData[index], filters
|
|
896
|
+
Filters2DManager.applyFilters(draft.tempData[index], filters, {
|
|
897
|
+
filterIndex: activeFilterIndex,
|
|
898
|
+
forceReapply: activeFilterIndex !== -1,
|
|
899
|
+
});
|
|
875
900
|
draft.data[index] = draft.tempData[index];
|
|
876
901
|
|
|
877
902
|
updateView(draft, Filters2D.zeroFillingDimension1.domainUpdateRules);
|
|
@@ -881,6 +906,7 @@ function handleApplyZeroFillingDimensionTwoFilter(
|
|
|
881
906
|
draft: Draft<State>,
|
|
882
907
|
action: ZeroFillingDimensionTwoFilterAction,
|
|
883
908
|
) {
|
|
909
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
884
910
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
885
911
|
|
|
886
912
|
if (!activeSpectrum || !draft.tempData) {
|
|
@@ -895,7 +921,10 @@ function handleApplyZeroFillingDimensionTwoFilter(
|
|
|
895
921
|
enabled: true,
|
|
896
922
|
},
|
|
897
923
|
];
|
|
898
|
-
Filters2DManager.applyFilters(draft.tempData[index], filters
|
|
924
|
+
Filters2DManager.applyFilters(draft.tempData[index], filters, {
|
|
925
|
+
filterIndex: activeFilterIndex,
|
|
926
|
+
forceReapply: activeFilterIndex !== -1,
|
|
927
|
+
});
|
|
899
928
|
draft.data[index] = draft.tempData[index];
|
|
900
929
|
|
|
901
930
|
updateView(draft, Filters2D.zeroFillingDimension2.domainUpdateRules);
|
|
@@ -1148,6 +1177,7 @@ function handleApplyApodizationFilter(
|
|
|
1148
1177
|
draft: Draft<State>,
|
|
1149
1178
|
action: ApodizationFilterAction,
|
|
1150
1179
|
) {
|
|
1180
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1151
1181
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
1152
1182
|
|
|
1153
1183
|
if (!activeSpectrum || !draft.tempData) {
|
|
@@ -1156,12 +1186,16 @@ function handleApplyApodizationFilter(
|
|
|
1156
1186
|
|
|
1157
1187
|
const index = activeSpectrum.index;
|
|
1158
1188
|
|
|
1159
|
-
Filters1DManager.applyFilters(
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1189
|
+
Filters1DManager.applyFilters(
|
|
1190
|
+
draft.tempData[index],
|
|
1191
|
+
[
|
|
1192
|
+
{
|
|
1193
|
+
name: 'apodization',
|
|
1194
|
+
value: action.payload.options,
|
|
1195
|
+
},
|
|
1196
|
+
],
|
|
1197
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
1198
|
+
);
|
|
1165
1199
|
draft.data[index] = draft.tempData[index];
|
|
1166
1200
|
|
|
1167
1201
|
updateView(draft, apodization.domainUpdateRules);
|
|
@@ -1171,6 +1205,7 @@ function handleApplyApodizationDimensionOneFilter(
|
|
|
1171
1205
|
draft: Draft<State>,
|
|
1172
1206
|
action: ApodizationDimensionOneFilterAction,
|
|
1173
1207
|
) {
|
|
1208
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1174
1209
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
1175
1210
|
|
|
1176
1211
|
if (!activeSpectrum || !draft.tempData) {
|
|
@@ -1179,12 +1214,16 @@ function handleApplyApodizationDimensionOneFilter(
|
|
|
1179
1214
|
|
|
1180
1215
|
const index = activeSpectrum.index;
|
|
1181
1216
|
|
|
1182
|
-
Filters2DManager.applyFilters(
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1217
|
+
Filters2DManager.applyFilters(
|
|
1218
|
+
draft.tempData[index],
|
|
1219
|
+
[
|
|
1220
|
+
{
|
|
1221
|
+
name: 'apodizationDimension1',
|
|
1222
|
+
value: action.payload.options,
|
|
1223
|
+
},
|
|
1224
|
+
],
|
|
1225
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
1226
|
+
);
|
|
1188
1227
|
draft.data[index] = draft.tempData[index];
|
|
1189
1228
|
|
|
1190
1229
|
updateView(draft, apodization.domainUpdateRules);
|
|
@@ -1194,6 +1233,7 @@ function handleApplyApodizationDimensionTwoFilter(
|
|
|
1194
1233
|
draft: Draft<State>,
|
|
1195
1234
|
action: ApodizationDimensionTwoFilterAction,
|
|
1196
1235
|
) {
|
|
1236
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1197
1237
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
1198
1238
|
|
|
1199
1239
|
if (!activeSpectrum || !draft.tempData) {
|
|
@@ -1202,12 +1242,16 @@ function handleApplyApodizationDimensionTwoFilter(
|
|
|
1202
1242
|
|
|
1203
1243
|
const index = activeSpectrum.index;
|
|
1204
1244
|
|
|
1205
|
-
Filters2DManager.applyFilters(
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1245
|
+
Filters2DManager.applyFilters(
|
|
1246
|
+
draft.tempData[index],
|
|
1247
|
+
[
|
|
1248
|
+
{
|
|
1249
|
+
name: 'apodizationDimension2',
|
|
1250
|
+
value: action.payload.options,
|
|
1251
|
+
},
|
|
1252
|
+
],
|
|
1253
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
1254
|
+
);
|
|
1211
1255
|
draft.data[index] = draft.tempData[index];
|
|
1212
1256
|
|
|
1213
1257
|
updateView(draft, apodization.domainUpdateRules);
|
|
@@ -1215,6 +1259,7 @@ function handleApplyApodizationDimensionTwoFilter(
|
|
|
1215
1259
|
|
|
1216
1260
|
//action
|
|
1217
1261
|
function handleApplyFFTFilter(draft: Draft<State>) {
|
|
1262
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1218
1263
|
const activeSpectrum = getActiveSpectrum(draft);
|
|
1219
1264
|
|
|
1220
1265
|
if (!activeSpectrum) {
|
|
@@ -1222,12 +1267,12 @@ function handleApplyFFTFilter(draft: Draft<State>) {
|
|
|
1222
1267
|
}
|
|
1223
1268
|
|
|
1224
1269
|
const { index } = activeSpectrum;
|
|
1225
|
-
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1226
1270
|
|
|
1227
1271
|
//apply filter into the spectrum
|
|
1228
1272
|
Filters1DManager.applyFilters(
|
|
1229
1273
|
activeFilterIndex !== -1 ? draft.tempData[index] : draft.data[index],
|
|
1230
1274
|
[{ name: 'fft', value: {} }],
|
|
1275
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
1231
1276
|
);
|
|
1232
1277
|
|
|
1233
1278
|
if (activeFilterIndex !== -1) {
|
|
@@ -1265,9 +1310,11 @@ function applyFFTTwoDimensionFilter(
|
|
|
1265
1310
|
const targetSpectrum =
|
|
1266
1311
|
activeFilterIndex !== -1 ? draft.tempData[index] : draft.data[index];
|
|
1267
1312
|
|
|
1268
|
-
Filters2DManager.applyFilters(
|
|
1269
|
-
|
|
1270
|
-
|
|
1313
|
+
Filters2DManager.applyFilters(
|
|
1314
|
+
targetSpectrum,
|
|
1315
|
+
[{ name: filterName, value: {} }],
|
|
1316
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
1317
|
+
);
|
|
1271
1318
|
|
|
1272
1319
|
if (activeFilterIndex !== -1) {
|
|
1273
1320
|
draft.data[index] = draft.tempData[index];
|
|
@@ -1312,17 +1359,22 @@ function handleApplyManualPhaseCorrectionFilter(
|
|
|
1312
1359
|
if (!activeSpectrum || !draft.tempData) {
|
|
1313
1360
|
return;
|
|
1314
1361
|
}
|
|
1362
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1315
1363
|
|
|
1316
1364
|
const { index } = activeSpectrum;
|
|
1317
1365
|
const { ph0, ph1 } = action.payload;
|
|
1318
1366
|
draft.data = draft.tempData;
|
|
1319
1367
|
|
|
1320
|
-
Filters1DManager.applyFilters(
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1368
|
+
Filters1DManager.applyFilters(
|
|
1369
|
+
draft.tempData[index],
|
|
1370
|
+
[
|
|
1371
|
+
{
|
|
1372
|
+
name: 'phaseCorrection',
|
|
1373
|
+
value: { ph0, ph1 },
|
|
1374
|
+
},
|
|
1375
|
+
],
|
|
1376
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
1377
|
+
);
|
|
1326
1378
|
draft.data[index] = draft.tempData[index];
|
|
1327
1379
|
|
|
1328
1380
|
updateView(draft, phaseCorrection.domainUpdateRules);
|
|
@@ -1457,15 +1509,20 @@ function handleApplyAbsoluteFilter(draft: Draft<State>) {
|
|
|
1457
1509
|
if (!activeSpectrum || !draft.tempData) {
|
|
1458
1510
|
return;
|
|
1459
1511
|
}
|
|
1512
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1460
1513
|
|
|
1461
1514
|
const { index } = activeSpectrum;
|
|
1462
1515
|
|
|
1463
|
-
Filters1DManager.applyFilters(
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1516
|
+
Filters1DManager.applyFilters(
|
|
1517
|
+
draft.tempData[index],
|
|
1518
|
+
[
|
|
1519
|
+
{
|
|
1520
|
+
name: 'phaseCorrection',
|
|
1521
|
+
value: { absolute: true },
|
|
1522
|
+
},
|
|
1523
|
+
],
|
|
1524
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
1525
|
+
);
|
|
1469
1526
|
draft.data[index] = draft.tempData[index];
|
|
1470
1527
|
|
|
1471
1528
|
updateView(draft, phaseCorrection.domainUpdateRules);
|
|
@@ -1478,15 +1535,19 @@ function handleApplyAutoPhaseCorrectionFilter(draft: Draft<State>) {
|
|
|
1478
1535
|
if (!activeSpectrum || !draft.tempData) {
|
|
1479
1536
|
return;
|
|
1480
1537
|
}
|
|
1481
|
-
|
|
1538
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1482
1539
|
const { index } = activeSpectrum;
|
|
1483
1540
|
|
|
1484
|
-
Filters1DManager.applyFilters(
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1541
|
+
Filters1DManager.applyFilters(
|
|
1542
|
+
draft.tempData[index],
|
|
1543
|
+
[
|
|
1544
|
+
{
|
|
1545
|
+
name: 'phaseCorrection',
|
|
1546
|
+
value: {},
|
|
1547
|
+
},
|
|
1548
|
+
],
|
|
1549
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
1550
|
+
);
|
|
1490
1551
|
|
|
1491
1552
|
draft.data[index] = draft.tempData[index];
|
|
1492
1553
|
|
|
@@ -1503,19 +1564,24 @@ function handleBaseLineCorrectionFilter(
|
|
|
1503
1564
|
if (!activeSpectrum || !draft.tempData) {
|
|
1504
1565
|
return;
|
|
1505
1566
|
}
|
|
1567
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1506
1568
|
|
|
1507
1569
|
const { index } = activeSpectrum;
|
|
1508
1570
|
const { zones } = draft.toolOptions.data.baselineCorrection;
|
|
1509
1571
|
const { options } = action.payload;
|
|
1510
|
-
Filters1DManager.applyFilters(
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1572
|
+
Filters1DManager.applyFilters(
|
|
1573
|
+
draft.tempData[index],
|
|
1574
|
+
[
|
|
1575
|
+
{
|
|
1576
|
+
name: 'baselineCorrection',
|
|
1577
|
+
value: {
|
|
1578
|
+
...options,
|
|
1579
|
+
zones,
|
|
1580
|
+
},
|
|
1581
|
+
} as Extract<Filter1D, { name: 'baseLineCorrection' }>,
|
|
1582
|
+
],
|
|
1583
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
1584
|
+
);
|
|
1519
1585
|
draft.data[index] = draft.tempData[index];
|
|
1520
1586
|
|
|
1521
1587
|
updateView(draft, baselineCorrection.domainUpdateRules);
|
|
@@ -1753,13 +1819,18 @@ function handleApplyExclusionZone(
|
|
|
1753
1819
|
if (!isSpectrum1D(datum)) {
|
|
1754
1820
|
return;
|
|
1755
1821
|
}
|
|
1822
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1756
1823
|
|
|
1757
|
-
Filters1DManager.applyFilters(
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1824
|
+
Filters1DManager.applyFilters(
|
|
1825
|
+
datum,
|
|
1826
|
+
[
|
|
1827
|
+
{
|
|
1828
|
+
name: 'exclusionZones',
|
|
1829
|
+
value: zones,
|
|
1830
|
+
},
|
|
1831
|
+
],
|
|
1832
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
1833
|
+
);
|
|
1763
1834
|
|
|
1764
1835
|
const { updateXDomain, updateYDomain } = exclusionZones.domainUpdateRules;
|
|
1765
1836
|
|
|
@@ -1978,17 +2049,22 @@ function handleApplyManualTowDimensionsPhaseCorrectionFilter(
|
|
|
1978
2049
|
if (!activeSpectrum || !draft.tempData) {
|
|
1979
2050
|
return;
|
|
1980
2051
|
}
|
|
2052
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
1981
2053
|
|
|
1982
2054
|
const { index } = activeSpectrum;
|
|
1983
2055
|
draft.data = draft.tempData;
|
|
1984
2056
|
const filterOptions = getTwoDimensionsPhaseCorrectionOptions(draft);
|
|
1985
2057
|
|
|
1986
|
-
Filters2DManager.applyFilters(
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
2058
|
+
Filters2DManager.applyFilters(
|
|
2059
|
+
draft.tempData[index],
|
|
2060
|
+
[
|
|
2061
|
+
{
|
|
2062
|
+
name: 'phaseCorrectionTwoDimensions',
|
|
2063
|
+
value: filterOptions,
|
|
2064
|
+
},
|
|
2065
|
+
],
|
|
2066
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
2067
|
+
);
|
|
1992
2068
|
draft.data[index] = draft.tempData[index];
|
|
1993
2069
|
|
|
1994
2070
|
updateView(draft, phaseCorrectionTwoDimensions.domainUpdateRules);
|
|
@@ -2003,15 +2079,20 @@ function handleApplyAutoPhaseCorrectionTwoDimensionsFilter(
|
|
|
2003
2079
|
if (!activeSpectrum || !draft.tempData) {
|
|
2004
2080
|
return;
|
|
2005
2081
|
}
|
|
2082
|
+
const activeFilterIndex = getActiveFilterIndex(draft);
|
|
2006
2083
|
|
|
2007
2084
|
const { index } = activeSpectrum;
|
|
2008
2085
|
|
|
2009
|
-
Filters2DManager.applyFilters(
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2086
|
+
Filters2DManager.applyFilters(
|
|
2087
|
+
draft.tempData[index],
|
|
2088
|
+
[
|
|
2089
|
+
{
|
|
2090
|
+
name: 'phaseCorrectionTwoDimensions',
|
|
2091
|
+
value: {},
|
|
2092
|
+
},
|
|
2093
|
+
],
|
|
2094
|
+
{ filterIndex: activeFilterIndex, forceReapply: activeFilterIndex !== -1 },
|
|
2095
|
+
);
|
|
2015
2096
|
|
|
2016
2097
|
draft.data[index] = draft.tempData[index];
|
|
2017
2098
|
|
|
@@ -10,7 +10,8 @@ import type {
|
|
|
10
10
|
PredictionBase2D,
|
|
11
11
|
} from 'nmr-processing';
|
|
12
12
|
import {
|
|
13
|
-
|
|
13
|
+
calculateRelativeFrequency,
|
|
14
|
+
getRelativeFrequency,
|
|
14
15
|
predict,
|
|
15
16
|
signals2DToZ,
|
|
16
17
|
signalsToRanges,
|
|
@@ -254,7 +255,10 @@ function generated1DSpectrum(params: {
|
|
|
254
255
|
frequency: freq,
|
|
255
256
|
} = options;
|
|
256
257
|
const SpectrumName = generateName(name, { frequency: freq, experiment });
|
|
257
|
-
const frequency =
|
|
258
|
+
const frequency = getRelativeFrequency(nucleus, {
|
|
259
|
+
frequency: freq,
|
|
260
|
+
nucleus,
|
|
261
|
+
});
|
|
258
262
|
const { x, y } = signalsToXY(signals, {
|
|
259
263
|
...options['1d'][nucleus],
|
|
260
264
|
frequency,
|
|
@@ -294,7 +298,7 @@ function generated1DSpectrum(params: {
|
|
|
294
298
|
{},
|
|
295
299
|
);
|
|
296
300
|
datum.ranges.values = mapRanges(
|
|
297
|
-
signalsToRanges(joinedSignals, { frequency
|
|
301
|
+
signalsToRanges(joinedSignals, { frequency }),
|
|
298
302
|
datum,
|
|
299
303
|
);
|
|
300
304
|
updateIntegralsRelativeValues(datum);
|
|
@@ -335,7 +339,7 @@ function generated2DSpectrum(params: {
|
|
|
335
339
|
const yOption = options['1d'][nuclei[1]];
|
|
336
340
|
|
|
337
341
|
const width = get2DWidth(nuclei);
|
|
338
|
-
const frequency =
|
|
342
|
+
const frequency = calculateRelativeFrequency(nuclei, options.frequency);
|
|
339
343
|
|
|
340
344
|
const minMaxContent = signals2DToZ(signals, {
|
|
341
345
|
from: { x: xOption.from, y: yOption.from },
|
|
@@ -399,22 +403,3 @@ function getSpectralWidth(experiment: string, options: PredictionOptions) {
|
|
|
399
403
|
return [];
|
|
400
404
|
}
|
|
401
405
|
}
|
|
402
|
-
|
|
403
|
-
function calculateFrequency(
|
|
404
|
-
nucleus: string | string[],
|
|
405
|
-
frequency: number,
|
|
406
|
-
): number | number[] {
|
|
407
|
-
if (typeof nucleus === 'string') {
|
|
408
|
-
return getFrequency(nucleus, { nucleus: '1H', frequency });
|
|
409
|
-
} else if (nucleus[0] === nucleus[1]) {
|
|
410
|
-
return [frequency, frequency];
|
|
411
|
-
} else {
|
|
412
|
-
return [
|
|
413
|
-
frequency,
|
|
414
|
-
getFrequency(nucleus[1], {
|
|
415
|
-
nucleus: nucleus[0],
|
|
416
|
-
frequency,
|
|
417
|
-
}),
|
|
418
|
-
];
|
|
419
|
-
}
|
|
420
|
-
}
|
|
@@ -96,7 +96,7 @@ function resurrectSpectrumFromSignals(
|
|
|
96
96
|
for (const signal of signals) {
|
|
97
97
|
const { nbAtoms, atoms } = signal;
|
|
98
98
|
if (nbAtoms !== undefined) {
|
|
99
|
-
totalIntegration +=
|
|
99
|
+
totalIntegration += nbAtoms;
|
|
100
100
|
} else if (atoms !== undefined) {
|
|
101
101
|
totalIntegration += atoms.length;
|
|
102
102
|
}
|
|
@@ -50,9 +50,11 @@ export function generateColor(options: Options) {
|
|
|
50
50
|
return resetColors[0] + percentToHex(opacity);
|
|
51
51
|
} else {
|
|
52
52
|
const lum = -0.25;
|
|
53
|
-
let hex =
|
|
54
|
-
`#${Math.random().toString(16).slice(2, 8).toUpperCase()}
|
|
55
|
-
|
|
53
|
+
let hex =
|
|
54
|
+
`#${Math.random().toString(16).slice(2, 8).toUpperCase()}`.replaceAll(
|
|
55
|
+
/[^\da-f]/gi,
|
|
56
|
+
'',
|
|
57
|
+
);
|
|
56
58
|
if (hex.length < 6) {
|
|
57
59
|
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
58
60
|
}
|
package/src/versionInfo.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v1.
|
|
1
|
+
export default { version: 'v1.2.0' };
|