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.
Files changed (232) hide show
  1. package/lib/component/1d/ExclusionZoneAnnotation.js +1 -1
  2. package/lib/component/1d/FloatPublicationString.js +2 -2
  3. package/lib/component/1d/FloatingRanges.js +3 -3
  4. package/lib/component/1d/FloatingRanges.js.map +1 -1
  5. package/lib/component/1d/FooterBanner.js +1 -1
  6. package/lib/component/1d/LinesSeries.js +1 -1
  7. package/lib/component/1d/PredictionErrorsNotations.js +2 -2
  8. package/lib/component/1d/inset/DraggableInset.js +2 -2
  9. package/lib/component/1d/multiAnalysis/AnalysisRange.js +1 -1
  10. package/lib/component/1d/multiAnalysis/AnalysisRange.js.map +1 -1
  11. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.d.ts +1 -1
  12. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.d.ts.map +1 -1
  13. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +3 -1
  14. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js.map +1 -1
  15. package/lib/component/1d/multiplicityTree/MultiplicityTree.js +1 -1
  16. package/lib/component/1d/multiplicityTree/MultiplicityTree.js.map +1 -1
  17. package/lib/component/1d/peaks/Peaks.d.ts.map +1 -1
  18. package/lib/component/1d/peaks/Peaks.js +1 -1
  19. package/lib/component/1d/peaks/Peaks.js.map +1 -1
  20. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.js +3 -3
  21. package/lib/component/1d-2d/tools/BrushXY.js +2 -2
  22. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +1 -1
  23. package/lib/component/2d/SignalDeltaLine.js +1 -1
  24. package/lib/component/2d/zones/Signal.d.ts.map +1 -1
  25. package/lib/component/2d/zones/Signal.js +1 -1
  26. package/lib/component/2d/zones/Signal.js.map +1 -1
  27. package/lib/component/2d/zones/SignalsGuideLines.js +2 -2
  28. package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
  29. package/lib/component/2d/zones/Zone.d.ts.map +1 -1
  30. package/lib/component/2d/zones/Zone.js +3 -1
  31. package/lib/component/2d/zones/Zone.js.map +1 -1
  32. package/lib/component/2d/zones/ZonesAssignmentsLabels.js +1 -1
  33. package/lib/component/elements/ActionsButtonsPopover.js +4 -4
  34. package/lib/component/elements/Alert.js +2 -2
  35. package/lib/component/elements/AssignmentsCell.js +1 -1
  36. package/lib/component/elements/Button.js +10 -10
  37. package/lib/component/elements/Button.js.map +1 -1
  38. package/lib/component/elements/DraggableDialog.js +3 -3
  39. package/lib/component/elements/EditableColumn.js +3 -3
  40. package/lib/component/elements/EmptyText.js +2 -2
  41. package/lib/component/elements/Footer.js +9 -9
  42. package/lib/component/elements/Footer.js.map +1 -1
  43. package/lib/component/elements/MoleculeSelection.js +19 -19
  44. package/lib/component/elements/MoleculeSelection.js.map +1 -1
  45. package/lib/component/elements/NextPrev.js +15 -15
  46. package/lib/component/elements/NextPrev.js.map +1 -1
  47. package/lib/component/elements/ReactTable/BaseReactTable.js +6 -6
  48. package/lib/component/elements/ReadOnly.js +8 -8
  49. package/lib/component/elements/ReadOnly.js.map +1 -1
  50. package/lib/component/elements/Sections.js +29 -29
  51. package/lib/component/elements/Sections.js.map +1 -1
  52. package/lib/component/elements/Select.js +10 -10
  53. package/lib/component/elements/Select.js.map +1 -1
  54. package/lib/component/elements/StyledDialogBody.js +1 -1
  55. package/lib/component/elements/StyledDialogBody.js.map +1 -1
  56. package/lib/component/elements/Tab/DeleteButton.js +5 -5
  57. package/lib/component/elements/Tab/Tabs.js +5 -5
  58. package/lib/component/elements/dropDownButton/DropDownList.js +6 -6
  59. package/lib/component/elements/export/ExportManager.d.ts.map +1 -1
  60. package/lib/component/elements/export/ExportManager.js +12 -1
  61. package/lib/component/elements/export/ExportManager.js.map +1 -1
  62. package/lib/component/elements/resizer/SVGResizer.js +1 -1
  63. package/lib/component/header/Header.js +1 -1
  64. package/lib/component/hooks/useExport.d.ts.map +1 -1
  65. package/lib/component/hooks/useExport.js +25 -10
  66. package/lib/component/hooks/useExport.js.map +1 -1
  67. package/lib/component/hooks/useFilter.d.ts.map +1 -1
  68. package/lib/component/hooks/useFilter.js +4 -5
  69. package/lib/component/hooks/useFilter.js.map +1 -1
  70. package/lib/component/hooks/useSaveSettings.js +2 -2
  71. package/lib/component/loader/DefaultSpinnerComponent.js +9 -9
  72. package/lib/component/loader/DropZone.js +8 -8
  73. package/lib/component/main/ErrorOverlay.js +4 -4
  74. package/lib/component/main/InnerNMRiumContents.js +3 -3
  75. package/lib/component/modal/AboutPredictionModal.js +2 -2
  76. package/lib/component/modal/AboutSpectrumSimulationModal.js +2 -2
  77. package/lib/component/modal/MultipletAnalysisModal.js +12 -12
  78. package/lib/component/modal/PredictSpectraModal.js +4 -4
  79. package/lib/component/modal/PublicationStringModal.js +2 -2
  80. package/lib/component/modal/aboutUs/AboutUsModal.js +3 -3
  81. package/lib/component/modal/changeSum/ChangeSumModalContents.js +1 -1
  82. package/lib/component/modal/changeSum/SelectMolecule.js +5 -5
  83. package/lib/component/modal/changeSum/SelectMolecule.js.map +1 -1
  84. package/lib/component/modal/setting/GeneralSettings.js +5 -5
  85. package/lib/component/panels/Panels.js +2 -2
  86. package/lib/component/panels/PanelsBar.js +3 -3
  87. package/lib/component/panels/PanelsBar.js.map +1 -1
  88. package/lib/component/panels/RangesPanel/RangesTable.js +6 -6
  89. package/lib/component/panels/RangesPanel/TableColumns/ActionsColumn.js +1 -1
  90. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.js +9 -9
  91. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/Confirmation.js +5 -5
  92. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.js +11 -11
  93. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.js +7 -7
  94. package/lib/component/panels/SummaryPanel/Overview.js +1 -1
  95. package/lib/component/panels/SummaryPanel/SummaryPanel.d.ts.map +1 -1
  96. package/lib/component/panels/SummaryPanel/SummaryPanel.js +6 -5
  97. package/lib/component/panels/SummaryPanel/SummaryPanel.js.map +1 -1
  98. package/lib/component/panels/ZonesPanel/ZonesTable.js +6 -6
  99. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.d.ts.map +1 -1
  100. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js +11 -3
  101. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js.map +1 -1
  102. package/lib/component/panels/filtersPanel/Filters/InnerFilterHeader.js +1 -1
  103. package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +4 -4
  104. package/lib/component/panels/predictionPanel/PredictionPanel.js +6 -6
  105. package/lib/component/panels/predictionPanel/PredictionPanel.js.map +1 -1
  106. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
  107. package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
  108. package/lib/component/reducer/actions/FiltersActions.js +54 -28
  109. package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
  110. package/lib/component/workspaces/assignment.d.ts.map +1 -1
  111. package/lib/component/workspaces/assignment.js +1 -0
  112. package/lib/component/workspaces/assignment.js.map +1 -1
  113. package/lib/component/workspaces/basic.d.ts.map +1 -1
  114. package/lib/component/workspaces/basic.js +1 -0
  115. package/lib/component/workspaces/basic.js.map +1 -1
  116. package/lib/component/workspaces/embedded.d.ts.map +1 -1
  117. package/lib/component/workspaces/embedded.js +1 -0
  118. package/lib/component/workspaces/embedded.js.map +1 -1
  119. package/lib/component/workspaces/exercise.d.ts.map +1 -1
  120. package/lib/component/workspaces/exercise.js +1 -0
  121. package/lib/component/workspaces/exercise.js.map +1 -1
  122. package/lib/component/workspaces/prediction.d.ts.map +1 -1
  123. package/lib/component/workspaces/prediction.js +1 -0
  124. package/lib/component/workspaces/prediction.js.map +1 -1
  125. package/lib/component/workspaces/process1D.d.ts.map +1 -1
  126. package/lib/component/workspaces/process1D.js +1 -0
  127. package/lib/component/workspaces/process1D.js.map +1 -1
  128. package/lib/component/workspaces/workspaceDefaultProperties.d.ts.map +1 -1
  129. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -0
  130. package/lib/component/workspaces/workspaceDefaultProperties.js.map +1 -1
  131. package/lib/data/PredictionManager.d.ts.map +1 -1
  132. package/lib/data/PredictionManager.js +7 -21
  133. package/lib/data/PredictionManager.js.map +1 -1
  134. package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.js +1 -1
  135. package/lib/data/data1d/Spectrum1D/ranges/resurrectSpectrum.js.map +1 -1
  136. package/lib/data/data2d/Spectrum2D/getMissingProjection.d.ts +1 -1
  137. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
  138. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
  139. package/lib/data/utilities/generateColor.d.ts.map +1 -1
  140. package/lib/data/utilities/generateColor.js +1 -1
  141. package/lib/data/utilities/generateColor.js.map +1 -1
  142. package/lib/data/utilities/isNumber.js +1 -1
  143. package/lib/data/utilities/isNumber.js.map +1 -1
  144. package/lib/utils/clipboard/clipboardComponents.js +1 -1
  145. package/lib/versionInfo.js +1 -1
  146. package/package.json +41 -36
  147. package/src/component/1d/ExclusionZoneAnnotation.tsx +1 -1
  148. package/src/component/1d/FloatPublicationString.tsx +2 -2
  149. package/src/component/1d/FloatingRanges.tsx +3 -3
  150. package/src/component/1d/FooterBanner.tsx +1 -1
  151. package/src/component/1d/LinesSeries.tsx +1 -1
  152. package/src/component/1d/PredictionErrorsNotations.tsx +2 -2
  153. package/src/component/1d/inset/DraggableInset.tsx +2 -2
  154. package/src/component/1d/multiAnalysis/AnalysisRange.tsx +1 -1
  155. package/src/component/1d/multiAnalysis/MultiAnalysisRanges.tsx +3 -1
  156. package/src/component/1d/multiplicityTree/MultiplicityTree.tsx +1 -1
  157. package/src/component/1d/peaks/Peaks.tsx +2 -6
  158. package/src/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.tsx +3 -3
  159. package/src/component/1d-2d/tools/BrushXY.tsx +2 -2
  160. package/src/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.tsx +1 -1
  161. package/src/component/2d/SignalDeltaLine.tsx +1 -1
  162. package/src/component/2d/zones/Signal.tsx +2 -1
  163. package/src/component/2d/zones/SignalsGuideLines.tsx +2 -2
  164. package/src/component/2d/zones/Zone.tsx +2 -1
  165. package/src/component/2d/zones/ZonesAssignmentsLabels.tsx +1 -1
  166. package/src/component/elements/ActionsButtonsPopover.tsx +4 -4
  167. package/src/component/elements/Alert.tsx +2 -2
  168. package/src/component/elements/AssignmentsCell.tsx +1 -1
  169. package/src/component/elements/Button.tsx +10 -10
  170. package/src/component/elements/DraggableDialog.tsx +3 -3
  171. package/src/component/elements/EditableColumn.tsx +3 -3
  172. package/src/component/elements/EmptyText.tsx +2 -2
  173. package/src/component/elements/Footer.tsx +9 -9
  174. package/src/component/elements/MoleculeSelection.tsx +19 -19
  175. package/src/component/elements/NextPrev.tsx +15 -15
  176. package/src/component/elements/ReactTable/BaseReactTable.tsx +6 -6
  177. package/src/component/elements/ReadOnly.tsx +8 -8
  178. package/src/component/elements/Sections.tsx +29 -29
  179. package/src/component/elements/Select.tsx +10 -10
  180. package/src/component/elements/StyledDialogBody.tsx +1 -1
  181. package/src/component/elements/Tab/DeleteButton.tsx +5 -5
  182. package/src/component/elements/Tab/Tabs.tsx +5 -5
  183. package/src/component/elements/dropDownButton/DropDownList.tsx +6 -6
  184. package/src/component/elements/export/ExportManager.tsx +13 -3
  185. package/src/component/elements/resizer/SVGResizer.tsx +1 -1
  186. package/src/component/header/Header.tsx +1 -1
  187. package/src/component/hooks/useExport.tsx +21 -10
  188. package/src/component/hooks/useFilter.ts +4 -6
  189. package/src/component/hooks/useSaveSettings.tsx +2 -2
  190. package/src/component/loader/DefaultSpinnerComponent.tsx +9 -9
  191. package/src/component/loader/DropZone.tsx +8 -8
  192. package/src/component/main/ErrorOverlay.tsx +4 -4
  193. package/src/component/main/InnerNMRiumContents.tsx +3 -3
  194. package/src/component/modal/AboutPredictionModal.tsx +2 -2
  195. package/src/component/modal/AboutSpectrumSimulationModal.tsx +2 -2
  196. package/src/component/modal/MultipletAnalysisModal.tsx +12 -12
  197. package/src/component/modal/PredictSpectraModal.tsx +4 -4
  198. package/src/component/modal/PublicationStringModal.tsx +2 -2
  199. package/src/component/modal/aboutUs/AboutUsModal.tsx +3 -3
  200. package/src/component/modal/changeSum/ChangeSumModalContents.tsx +1 -1
  201. package/src/component/modal/changeSum/SelectMolecule.tsx +5 -5
  202. package/src/component/modal/setting/GeneralSettings.tsx +5 -5
  203. package/src/component/panels/Panels.tsx +2 -2
  204. package/src/component/panels/PanelsBar.tsx +3 -3
  205. package/src/component/panels/RangesPanel/RangesTable.tsx +6 -6
  206. package/src/component/panels/RangesPanel/TableColumns/ActionsColumn.tsx +1 -1
  207. package/src/component/panels/SummaryPanel/CorrelationTable/CorrelationTable.tsx +9 -9
  208. package/src/component/panels/SummaryPanel/CorrelationTable/editLink/Confirmation.tsx +5 -5
  209. package/src/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.tsx +11 -11
  210. package/src/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.tsx +7 -7
  211. package/src/component/panels/SummaryPanel/Overview.tsx +1 -1
  212. package/src/component/panels/SummaryPanel/SummaryPanel.tsx +6 -5
  213. package/src/component/panels/ZonesPanel/ZonesTable.tsx +6 -6
  214. package/src/component/panels/filtersPanel/Filters/FiltersSectionsPanel.tsx +12 -3
  215. package/src/component/panels/filtersPanel/Filters/InnerFilterHeader.tsx +1 -1
  216. package/src/component/panels/multipleAnalysisPanel/AlignSpectra.tsx +4 -4
  217. package/src/component/panels/predictionPanel/PredictionPanel.tsx +6 -6
  218. package/src/component/panels/predictionPanel/PredictionSimpleOptions.tsx +1 -1
  219. package/src/component/reducer/actions/FiltersActions.ts +162 -81
  220. package/src/component/workspaces/assignment.ts +1 -0
  221. package/src/component/workspaces/basic.ts +1 -0
  222. package/src/component/workspaces/embedded.ts +1 -0
  223. package/src/component/workspaces/exercise.ts +1 -0
  224. package/src/component/workspaces/prediction.ts +1 -0
  225. package/src/component/workspaces/process1D.ts +1 -0
  226. package/src/component/workspaces/workspaceDefaultProperties.ts +1 -0
  227. package/src/data/PredictionManager.ts +8 -23
  228. package/src/data/data1d/Spectrum1D/ranges/resurrectSpectrum.ts +1 -1
  229. package/src/data/utilities/generateColor.ts +5 -3
  230. package/src/data/utilities/isNumber.ts +1 -1
  231. package/src/utils/clipboard/clipboardComponents.tsx +1 -1
  232. 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
- reapplyFilters(spectrum);
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
- !baselineCorrectionFilter ||
697
- (baselineCorrectionFilter &&
698
- baselineCorrectionFilter.value.zones?.length === 0)
713
+ filterOptions &&
714
+ hasBaselineZones(filterOptions) &&
715
+ filterOptions.zones.length > 0
699
716
  ) {
700
- draft.toolOptions.data.baselineCorrection.zones =
701
- getBaselineZonesByDietrich(datum.data as NmrData1D);
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(draft.tempData[index], [
1160
- {
1161
- name: 'apodization',
1162
- value: action.payload.options,
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(draft.tempData[index], [
1183
- {
1184
- name: 'apodizationDimension1',
1185
- value: action.payload.options,
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(draft.tempData[index], [
1206
- {
1207
- name: 'apodizationDimension2',
1208
- value: action.payload.options,
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(targetSpectrum, [
1269
- { name: filterName, value: {} },
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(draft.tempData[index], [
1321
- {
1322
- name: 'phaseCorrection',
1323
- value: { ph0, ph1 },
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(draft.tempData[index], [
1464
- {
1465
- name: 'phaseCorrection',
1466
- value: { absolute: true },
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(draft.tempData[index], [
1485
- {
1486
- name: 'phaseCorrection',
1487
- value: {},
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(draft.tempData[index], [
1511
- {
1512
- name: 'baselineCorrection',
1513
- value: {
1514
- ...options,
1515
- zones,
1516
- },
1517
- } as Extract<Filter1D, { name: 'baseLineCorrection' }>,
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(datum, [
1758
- {
1759
- name: 'exclusionZones',
1760
- value: zones,
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(draft.tempData[index], [
1987
- {
1988
- name: 'phaseCorrectionTwoDimensions',
1989
- value: filterOptions,
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(draft.tempData[index], [
2010
- {
2011
- name: 'phaseCorrectionTwoDimensions',
2012
- value: {},
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
 
@@ -29,6 +29,7 @@ export const assignment: InnerWorkspace = {
29
29
  phaseCorrection: true,
30
30
  baselineCorrection: true,
31
31
  autoRangeAndZonePicking: true,
32
+ inset: true,
32
33
  },
33
34
  },
34
35
  };
@@ -35,6 +35,7 @@ export const basic: InnerWorkspace = {
35
35
  autoRangeAndZonePicking: true,
36
36
  fftDimension1: true,
37
37
  fftDimension2: true,
38
+ inset: true,
38
39
  },
39
40
  },
40
41
  };
@@ -46,6 +46,7 @@ export const embedded: InnerWorkspace = {
46
46
  autoRangeAndZonePicking: true,
47
47
  fftDimension1: true,
48
48
  fftDimension2: true,
49
+ inset: true,
49
50
  },
50
51
  },
51
52
  };
@@ -26,6 +26,7 @@ export const exercise: InnerWorkspace = {
26
26
  spectraStackAlignments: true,
27
27
  fftDimension1: true,
28
28
  fftDimension2: true,
29
+ inset: true,
29
30
  },
30
31
  },
31
32
  general: {
@@ -46,6 +46,7 @@ export const prediction: InnerWorkspace = {
46
46
  autoRangeAndZonePicking: true,
47
47
  fftDimension1: true,
48
48
  fftDimension2: true,
49
+ inset: true,
49
50
  },
50
51
  },
51
52
  nuclei: [],
@@ -32,6 +32,7 @@ export const process1D: InnerWorkspace = {
32
32
  autoRangeAndZonePicking: true,
33
33
  fftDimension1: true,
34
34
  fftDimension2: true,
35
+ inset: true,
35
36
  },
36
37
  },
37
38
  };
@@ -59,6 +59,7 @@ export const workspaceDefaultProperties: Required<WorkspacePreferences> = {
59
59
  autoRangeAndZonePicking: false,
60
60
  fftDimension1: false,
61
61
  fftDimension2: false,
62
+ inset: false,
62
63
  },
63
64
  },
64
65
 
@@ -10,7 +10,8 @@ import type {
10
10
  PredictionBase2D,
11
11
  } from 'nmr-processing';
12
12
  import {
13
- getFrequency,
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 = calculateFrequency(nucleus, freq);
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: frequency as number }),
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 = calculateFrequency(nuclei, options.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 += Number(nbAtoms);
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 = String(
54
- `#${Math.random().toString(16).slice(2, 8).toUpperCase()}`,
55
- ).replaceAll(/[^\da-f]/gi, '');
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
  }
@@ -1,3 +1,3 @@
1
1
  export function isNumber(value: any): value is number {
2
- return typeof value === 'number' && Number(value).toString() !== 'NaN';
2
+ return typeof value === 'number' && value.toString() !== 'NaN';
3
3
  }
@@ -11,7 +11,7 @@ import type { ClipboardMode } from './types.js';
11
11
  const ClipboardForm = styled.form`
12
12
  padding: 0.5rem;
13
13
 
14
- & > label {
14
+ > label {
15
15
  display: flex;
16
16
  flex-direction: column;
17
17
  gap: 0.5rem;
@@ -1 +1 @@
1
- export default { version: 'v1.1.0' };
1
+ export default { version: 'v1.2.0' };