nmrium 0.38.1 → 0.38.2

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 (439) hide show
  1. package/lib/component/1d/ApodizationLine.js +27 -4
  2. package/lib/component/1d/ExclusionZoneAnnotation.js +1 -1
  3. package/lib/component/1d/ExclusionZonesAnnotations.js +1 -1
  4. package/lib/component/1d/FooterBanner.js +5 -5
  5. package/lib/component/1d/SpectraLegends.js +2 -3
  6. package/lib/component/1d/Viewer1D.js +1 -1
  7. package/lib/component/1d/integral/Integral.d.ts +1 -1
  8. package/lib/component/1d/integral/IntegralResizable.d.ts +1 -1
  9. package/lib/component/1d/jCouplingGraph/JsCouplings.d.ts +1 -1
  10. package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +2 -2
  11. package/lib/component/1d/multiplicityTree/LevelNode.d.ts +1 -1
  12. package/lib/component/1d/multiplicityTree/MultiplicityTree.d.ts +1 -1
  13. package/lib/component/1d/multiplicityTree/StringNode.d.ts +1 -1
  14. package/lib/component/1d/multiplicityTree/buildTreeNode.d.ts +1 -1
  15. package/lib/component/1d/peaks/usePeakShapesPath.d.ts +2 -1
  16. package/lib/component/1d/ranges/Range.d.ts +1 -1
  17. package/lib/component/1d/tool/PeakPointer.js +6 -6
  18. package/lib/component/1d/tool/XLabelPointer.js +5 -5
  19. package/lib/component/1d-2d/components/FloatMoleculeStructures/DraggableStructure.d.ts +1 -1
  20. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
  21. package/lib/component/1d-2d/tools/BrushX.js +2 -3
  22. package/lib/component/1d-2d/tools/BrushXY.js +2 -3
  23. package/lib/component/1d-2d/tools/CrossLinePointer.js +4 -5
  24. package/lib/component/2d/Chart2D.js +4 -4
  25. package/lib/component/2d/FooterBanner.js +5 -5
  26. package/lib/component/2d/Viewer2D.js +1 -1
  27. package/lib/component/2d/tools/XYLabelPointer.js +5 -5
  28. package/lib/component/2d/zones/Signal.d.ts +1 -1
  29. package/lib/component/2d/zones/SignalCrosshair.d.ts +1 -1
  30. package/lib/component/2d/zones/Zone.d.ts +1 -1
  31. package/lib/component/EventsTrackers/BrushTracker.d.ts +20 -12
  32. package/lib/component/EventsTrackers/BrushTracker.js +35 -22
  33. package/lib/component/EventsTrackers/MouseTracker.d.ts +6 -2
  34. package/lib/component/EventsTrackers/MouseTracker.js +4 -1
  35. package/lib/component/NMRium.d.ts +4 -5
  36. package/lib/component/NMRium.js +11 -14
  37. package/lib/component/assignment/AssignmentsReducer.d.ts +2 -2
  38. package/lib/component/context/PreferencesContext.d.ts +6 -6
  39. package/lib/component/elements/Button.d.ts +13 -11
  40. package/lib/component/elements/Button.js +16 -25
  41. package/lib/component/elements/ColorInput.d.ts +0 -1
  42. package/lib/component/elements/ColorInput.js +2 -2
  43. package/lib/component/elements/EditableColumn.js +5 -2
  44. package/lib/component/elements/Input.js +2 -4
  45. package/lib/component/elements/Label.d.ts +1 -0
  46. package/lib/component/elements/Label.js +2 -2
  47. package/lib/component/elements/MolecularFormulaInput.d.ts +2 -2
  48. package/lib/component/elements/MolecularFormulaInput.js +15 -18
  49. package/lib/component/elements/NextPrev.d.ts +5 -3
  50. package/lib/component/elements/NextPrev.js +26 -8
  51. package/lib/component/elements/NumberInput.js +2 -2
  52. package/lib/component/elements/ReactTable/ReactTable.js +4 -4
  53. package/lib/component/elements/formik/FormikCheckBox.d.ts +2 -1
  54. package/lib/component/elements/formik/FormikCheckBox.js +2 -2
  55. package/lib/component/elements/formik/FormikColumnFormatField.d.ts +4 -0
  56. package/lib/component/elements/formik/FormikColumnFormatField.js +19 -16
  57. package/lib/component/elements/formik/FormikInput.js +10 -6
  58. package/lib/component/elements/formik/FormikSelect.js +1 -1
  59. package/lib/component/header/ApodizationOptionsPanel.js +4 -3
  60. package/lib/component/header/AutoPeakPickingOptionPanel.js +16 -7
  61. package/lib/component/header/BaseLineCorrectionPanel.js +5 -2
  62. package/lib/component/header/PhaseCorrectionPanel.js +5 -2
  63. package/lib/component/header/RangesPickingOptionPanel.js +15 -7
  64. package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
  65. package/lib/component/highlight/index.d.ts +1 -1
  66. package/lib/component/hooks/useActiveSpectra.d.ts +1 -1
  67. package/lib/component/hooks/useActiveSpectrum.d.ts +1 -1
  68. package/lib/component/hooks/useActiveSpectrumPeaksViewState.d.ts +1 -1
  69. package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +2 -0
  70. package/lib/component/hooks/useCheckPointsNumberInWindowArea.js +17 -0
  71. package/lib/component/hooks/useCheckToolsVisibility.d.ts +2 -2
  72. package/lib/component/hooks/useDatumWithSpectraStatistics.d.ts +3 -2
  73. package/lib/component/hooks/useExport.js +1 -1
  74. package/lib/component/hooks/useFilter.d.ts +2 -1
  75. package/lib/component/hooks/usePanelPreferences.d.ts +3 -3
  76. package/lib/component/hooks/usePanelPreferences.js +4 -0
  77. package/lib/component/hooks/useSaveSettings.d.ts +1 -1
  78. package/lib/component/hooks/useSaveSettings.js +1 -1
  79. package/lib/component/hooks/useVerticalAlign.d.ts +1 -1
  80. package/lib/component/loader/DropZone.js +1 -2
  81. package/lib/component/modal/EditPeakShapeModal.d.ts +2 -2
  82. package/lib/component/modal/LoadJCAMPModal.d.ts +3 -3
  83. package/lib/component/modal/LoadJCAMPModal.js +35 -66
  84. package/lib/component/modal/ModalStyle.js +0 -10
  85. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +2 -1
  86. package/lib/component/modal/MoleculeStructureEditorModal.js +12 -6
  87. package/lib/component/modal/MultipletAnalysisModal.d.ts +2 -2
  88. package/lib/component/modal/PredictSpectraModal.d.ts +4 -2
  89. package/lib/component/modal/PredictSpectraModal.js +43 -105
  90. package/lib/component/modal/SaveAsModal.d.ts +2 -0
  91. package/lib/component/modal/SaveAsModal.js +21 -14
  92. package/lib/component/modal/changeSum/ChangeSumModal.js +25 -38
  93. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +1 -1
  94. package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -0
  95. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +2 -2
  96. package/lib/component/modal/metaImportation/MetaImportationModal.js +15 -5
  97. package/lib/component/modal/setting/GeneralSettings.js +1 -6
  98. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  99. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
  100. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  101. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +7 -15
  102. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +2 -2
  103. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +1 -11
  104. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +20 -25
  105. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +6 -11
  106. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +71 -81
  107. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
  108. package/lib/component/panels/MoleculesPanel/Utilities.js +3 -1
  109. package/lib/component/panels/MultipleSpectraAnalysisPanel/base/AnalysisColumnHeader.js +6 -6
  110. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
  111. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/index.js +2 -2
  112. package/lib/component/panels/PeaksPanel/PeaksPanel.d.ts +1 -1
  113. package/lib/component/panels/RangesPanel/RangesHeader.js +39 -53
  114. package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +1 -1
  115. package/lib/component/panels/RangesPanel/RangesPreferences.js +7 -22
  116. package/lib/component/panels/RangesPanel/RangesTable.d.ts +2 -2
  117. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +2 -2
  118. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.d.ts +1 -1
  119. package/lib/component/panels/RangesPanel/hooks/useMapRanges.d.ts +1 -1
  120. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +5 -1
  121. package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +10 -4
  122. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.d.ts +2 -2
  123. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +1 -1
  124. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
  125. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +1 -1
  126. package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts +1 -1
  127. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
  128. package/lib/component/panels/databasePanel/DatabasePanel.js +5 -24
  129. package/lib/component/panels/databasePanel/DatabasePreferences.js +2 -2
  130. package/lib/component/panels/header/DefaultPanelHeader.d.ts +2 -3
  131. package/lib/component/panels/header/DefaultPanelHeader.js +18 -26
  132. package/lib/component/panels/header/PanelHeader.d.ts +7 -0
  133. package/lib/component/panels/header/PanelHeader.js +12 -0
  134. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.d.ts +9 -0
  135. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +94 -0
  136. package/lib/component/panels/predictionPanel/PredictionPanel.d.ts +1 -1
  137. package/lib/component/panels/predictionPanel/PredictionPanel.js +107 -37
  138. package/lib/component/panels/predictionPanel/PredictionPreferences.d.ts +3 -0
  139. package/lib/component/panels/predictionPanel/PredictionPreferences.js +24 -0
  140. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.d.ts +2 -0
  141. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +44 -0
  142. package/lib/component/reducer/Reducer.d.ts +5 -87
  143. package/lib/component/reducer/Reducer.js +1 -29
  144. package/lib/component/reducer/actions/FiltersActions.d.ts +1 -2
  145. package/lib/component/reducer/actions/FiltersActions.js +47 -52
  146. package/lib/component/reducer/actions/HistoryActions.d.ts +4 -0
  147. package/lib/component/reducer/actions/HistoryActions.js +40 -0
  148. package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
  149. package/lib/component/reducer/actions/LoadActions.d.ts +1 -2
  150. package/lib/component/reducer/actions/LoadActions.js +1 -1
  151. package/lib/component/reducer/actions/MoleculeActions.d.ts +7 -4
  152. package/lib/component/reducer/actions/MoleculeActions.js +57 -28
  153. package/lib/component/reducer/actions/PeaksActions.d.ts +1 -2
  154. package/lib/component/reducer/actions/PeaksActions.js +3 -3
  155. package/lib/component/reducer/actions/RangesActions.d.ts +4 -5
  156. package/lib/component/reducer/actions/RangesActions.js +5 -27
  157. package/lib/component/reducer/actions/SpectrumsActions.js +2 -2
  158. package/lib/component/reducer/actions/ToolsActions.d.ts +2 -2
  159. package/lib/component/reducer/actions/ZonesActions.d.ts +2 -1
  160. package/lib/component/reducer/actions/ZonesActions.js +1 -2
  161. package/lib/component/reducer/helper/getActiveSpectra.d.ts +1 -1
  162. package/lib/component/reducer/helper/getActiveSpectrum.d.ts +1 -1
  163. package/lib/component/reducer/helper/getVerticalAlign.d.ts +1 -1
  164. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +1 -1
  165. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  166. package/lib/component/reducer/preferences/utilities/getActiveWorkspace.d.ts +1 -1
  167. package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +2 -3
  168. package/lib/component/reducer/preferences/utilities/initWorkspace.d.ts +1 -1
  169. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +1 -1
  170. package/lib/component/reducer/preferences/utilities/mapWorkspaces.d.ts +1 -1
  171. package/lib/component/toolbar/BasicToolBar.js +6 -11
  172. package/lib/component/toolbar/ToolTypes.d.ts +2 -2
  173. package/lib/component/toolbar/ToolTypes.js +1 -1
  174. package/lib/component/workspaces/assignment.d.ts +1 -1
  175. package/lib/component/workspaces/basic.d.ts +1 -1
  176. package/lib/component/workspaces/embedded.d.ts +1 -1
  177. package/lib/component/workspaces/exercise.d.ts +1 -1
  178. package/lib/component/workspaces/index.d.ts +6 -6
  179. package/lib/component/workspaces/prediction.d.ts +1 -1
  180. package/lib/component/workspaces/prediction.js +193 -0
  181. package/lib/component/workspaces/process1D.d.ts +1 -1
  182. package/lib/component/workspaces/workspaceDefaultProperties.d.ts +1 -1
  183. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
  184. package/lib/data/PredictionManager.js +16 -2
  185. package/lib/data/SpectraManager.d.ts +1 -2
  186. package/lib/data/constants/DefaultApodizationOptions.d.ts +2 -0
  187. package/lib/data/constants/DefaultApodizationOptions.js +5 -0
  188. package/lib/data/data1d/Spectrum1D/SumManager.d.ts +1 -1
  189. package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.d.ts +2 -2
  190. package/lib/data/data1d/Spectrum1D/generateJGraphData.d.ts +1 -1
  191. package/lib/data/data1d/Spectrum1D/index.d.ts +1 -5
  192. package/lib/data/data1d/Spectrum1D/index.js +1 -5
  193. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
  194. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +2 -1
  195. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +1 -1
  196. package/lib/data/data1d/Spectrum1D/isRangeAssigned.d.ts +1 -1
  197. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.d.ts +2 -1
  198. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -2
  199. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +3 -2
  200. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +1 -1
  201. package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.d.ts +2 -2
  202. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts +2 -1
  203. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +1 -2
  204. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +7 -7
  205. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -24
  206. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.d.ts +2 -1
  207. package/lib/data/data1d/Spectrum1D/ranges/changeRange.d.ts +2 -1
  208. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
  209. package/lib/data/data1d/Spectrum1D/ranges/checkRangeKind.d.ts +1 -1
  210. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  211. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.js +1 -2
  212. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +37 -2
  213. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +1 -1
  214. package/lib/data/data1d/database.js +2 -4
  215. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +3 -30
  216. package/lib/data/data1d/multipleSpectraAnalysis.js +4 -15
  217. package/lib/data/data2d/Spectrum2D/getMissingProjection.d.ts +3 -2
  218. package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
  219. package/lib/data/data2d/Spectrum2D/getSlice.d.ts +1 -1
  220. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  221. package/lib/data/data2d/Spectrum2D/zones/detectZones.d.ts +1 -1
  222. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +1 -1
  223. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +3 -2
  224. package/lib/data/data2d/Spectrum2D/zones/isZoneExists.d.ts +2 -1
  225. package/lib/data/data2d/Spectrum2D/zones/mapZones.d.ts +3 -2
  226. package/lib/data/getDefaultMatrixFilters.d.ts +1 -1
  227. package/lib/data/types/data1d/ComplexData1D.d.ts +2 -2
  228. package/lib/data/types/data1d/RangeDetectionResult.d.ts +1 -1
  229. package/lib/data/utilities/FindUtilities.d.ts +2 -1
  230. package/lib/data/utilities/RangeUtilities.d.ts +1 -1
  231. package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
  232. package/lib/data/utilities/calculateSanPlot.d.ts +2 -2
  233. package/lib/types/NMRiumDataReturn.d.ts +1 -3
  234. package/lib/versionInfo.js +1 -1
  235. package/lib-cjs/component/1d/ApodizationLine.js +28 -5
  236. package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +3 -26
  237. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +5 -28
  238. package/lib-cjs/component/1d/FooterBanner.js +2 -2
  239. package/lib-cjs/component/1d/SpectraLegends.js +1 -2
  240. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +2 -2
  241. package/lib-cjs/component/1d/tool/PeakPointer.js +3 -3
  242. package/lib-cjs/component/1d/tool/XLabelPointer.js +2 -2
  243. package/lib-cjs/component/1d-2d/tools/BrushX.js +1 -2
  244. package/lib-cjs/component/1d-2d/tools/BrushXY.js +1 -2
  245. package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +2 -3
  246. package/lib-cjs/component/2d/Chart2D.js +4 -4
  247. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  248. package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
  249. package/lib-cjs/component/EventsTrackers/BrushTracker.js +36 -22
  250. package/lib-cjs/component/EventsTrackers/MouseTracker.js +4 -1
  251. package/lib-cjs/component/NMRium.js +8 -11
  252. package/lib-cjs/component/elements/Button.js +16 -25
  253. package/lib-cjs/component/elements/ColorInput.js +2 -2
  254. package/lib-cjs/component/elements/EditableColumn.js +5 -2
  255. package/lib-cjs/component/elements/Input.js +2 -4
  256. package/lib-cjs/component/elements/Label.js +2 -2
  257. package/lib-cjs/component/elements/MolecularFormulaInput.js +14 -16
  258. package/lib-cjs/component/elements/NextPrev.js +26 -8
  259. package/lib-cjs/component/elements/NumberInput.js +2 -2
  260. package/lib-cjs/component/elements/ReactTable/ReactTable.js +4 -4
  261. package/lib-cjs/component/elements/formik/FormikCheckBox.js +2 -2
  262. package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +20 -16
  263. package/lib-cjs/component/elements/formik/FormikInput.js +10 -6
  264. package/lib-cjs/component/elements/formik/FormikSelect.js +1 -1
  265. package/lib-cjs/component/header/ApodizationOptionsPanel.js +6 -5
  266. package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +15 -6
  267. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +6 -3
  268. package/lib-cjs/component/header/PhaseCorrectionPanel.js +6 -26
  269. package/lib-cjs/component/header/RangesPickingOptionPanel.js +15 -7
  270. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +2 -25
  271. package/lib-cjs/component/hooks/useCheckPointsNumberInWindowArea.js +24 -0
  272. package/lib-cjs/component/hooks/useExport.js +1 -1
  273. package/lib-cjs/component/hooks/usePanelPreferences.js +4 -0
  274. package/lib-cjs/component/hooks/useSaveSettings.js +1 -1
  275. package/lib-cjs/component/loader/DropZone.js +1 -2
  276. package/lib-cjs/component/modal/LoadJCAMPModal.js +60 -67
  277. package/lib-cjs/component/modal/ModalStyle.js +0 -10
  278. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +12 -6
  279. package/lib-cjs/component/modal/PredictSpectraModal.js +43 -126
  280. package/lib-cjs/component/modal/SaveAsModal.js +22 -14
  281. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +24 -37
  282. package/lib-cjs/component/modal/editRange/forms/components/DeltaInput.js +2 -0
  283. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +15 -5
  284. package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -6
  285. package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +6 -14
  286. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +2 -2
  287. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +19 -24
  288. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +76 -86
  289. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +3 -1
  290. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/base/AnalysisColumnHeader.js +6 -6
  291. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
  292. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/index.js +2 -2
  293. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +38 -52
  294. package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +5 -20
  295. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +5 -1
  296. package/lib-cjs/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +10 -4
  297. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +1 -1
  298. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
  299. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -24
  300. package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +25 -2
  301. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +18 -26
  302. package/lib-cjs/component/panels/header/PanelHeader.js +15 -0
  303. package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +122 -0
  304. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +107 -37
  305. package/lib-cjs/component/panels/predictionPanel/PredictionPreferences.js +29 -0
  306. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +72 -0
  307. package/lib-cjs/component/reducer/Reducer.js +2 -31
  308. package/lib-cjs/component/reducer/actions/FiltersActions.js +66 -94
  309. package/lib-cjs/component/reducer/actions/HistoryActions.js +45 -0
  310. package/lib-cjs/component/reducer/actions/MoleculeActions.js +58 -32
  311. package/lib-cjs/component/reducer/actions/PeaksActions.js +3 -3
  312. package/lib-cjs/component/reducer/actions/RangesActions.js +7 -52
  313. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +4 -27
  314. package/lib-cjs/component/reducer/actions/ZonesActions.js +4 -28
  315. package/lib-cjs/component/toolbar/BasicToolBar.js +5 -10
  316. package/lib-cjs/component/toolbar/ToolTypes.js +9 -32
  317. package/lib-cjs/component/workspaces/prediction.js +193 -0
  318. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +21 -44
  319. package/lib-cjs/data/PredictionManager.js +16 -2
  320. package/lib-cjs/data/constants/DefaultApodizationOptions.js +8 -0
  321. package/lib-cjs/data/data1d/Spectrum1D/index.js +7 -11
  322. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +9 -32
  323. package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +2 -2
  324. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -2
  325. package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +2 -2
  326. package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +1 -2
  327. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +7 -26
  328. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
  329. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +2 -2
  330. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRanges.js +3 -4
  331. package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +2 -2
  332. package/lib-cjs/data/data1d/database.js +2 -4
  333. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +5 -16
  334. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +3 -26
  335. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +2 -25
  336. package/lib-cjs/versionInfo.js +1 -1
  337. package/package.json +25 -25
  338. package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +0 -7
  339. package/lib/component/panels/predictionPanel/PredictionOptions.js +0 -74
  340. package/lib/component/workspaces/Workspace.d.ts +0 -188
  341. package/lib/component/workspaces/Workspace.js +0 -1
  342. package/lib/data/Filters.d.ts +0 -12
  343. package/lib/data/Filters.js +0 -12
  344. package/lib/data/FiltersManager.d.ts +0 -30
  345. package/lib/data/FiltersManager.js +0 -175
  346. package/lib/data/data1d/Spectrum1D/getShiftX.d.ts +0 -2
  347. package/lib/data/data1d/Spectrum1D/getShiftX.js +0 -6
  348. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +0 -2
  349. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +0 -4
  350. package/lib/data/data1d/Spectrum1D/integrals/checkIntegralKind.d.ts +0 -7
  351. package/lib/data/data1d/Spectrum1D/integrals/checkIntegralKind.js +0 -9
  352. package/lib/data/data1d/Spectrum1D/integrals/mapIntegrals.d.ts +0 -12
  353. package/lib/data/data1d/Spectrum1D/integrals/mapIntegrals.js +0 -36
  354. package/lib/data/data1d/Spectrum1D/integrals/updateIntegrals.d.ts +0 -2
  355. package/lib/data/data1d/Spectrum1D/integrals/updateIntegrals.js +0 -6
  356. package/lib/data/data1d/Spectrum1D/integrals/updateIntegralsRelativeValues.d.ts +0 -2
  357. package/lib/data/data1d/Spectrum1D/integrals/updateIntegralsRelativeValues.js +0 -5
  358. package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.d.ts +0 -2
  359. package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +0 -26
  360. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +0 -3
  361. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +0 -45
  362. package/lib/data/data1d/Spectrum1D/peaks/updatePeaks.d.ts +0 -2
  363. package/lib/data/data1d/Spectrum1D/peaks/updatePeaks.js +0 -7
  364. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +0 -4
  365. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +0 -78
  366. package/lib/data/data1d/Spectrum1D/ranges/updateRanges.d.ts +0 -2
  367. package/lib/data/data1d/Spectrum1D/ranges/updateRanges.js +0 -9
  368. package/lib/data/data1d/Spectrum1D/ranges/updateRangesRelativeValues.d.ts +0 -2
  369. package/lib/data/data1d/Spectrum1D/ranges/updateRangesRelativeValues.js +0 -5
  370. package/lib/data/data1d/filter1d/apodization.d.ts +0 -27
  371. package/lib/data/data1d/filter1d/apodization.js +0 -81
  372. package/lib/data/data1d/filter1d/baselineCorrection.d.ts +0 -33
  373. package/lib/data/data1d/filter1d/baselineCorrection.js +0 -51
  374. package/lib/data/data1d/filter1d/digitalFilter.d.ts +0 -20
  375. package/lib/data/data1d/filter1d/digitalFilter.js +0 -44
  376. package/lib/data/data1d/filter1d/equallySpaced.d.ts +0 -33
  377. package/lib/data/data1d/filter1d/equallySpaced.js +0 -52
  378. package/lib/data/data1d/filter1d/exclusionZones.d.ts +0 -15
  379. package/lib/data/data1d/filter1d/exclusionZones.js +0 -32
  380. package/lib/data/data1d/filter1d/fft.d.ts +0 -18
  381. package/lib/data/data1d/filter1d/fft.js +0 -90
  382. package/lib/data/data1d/filter1d/phaseCorrection.d.ts +0 -26
  383. package/lib/data/data1d/filter1d/phaseCorrection.js +0 -64
  384. package/lib/data/data1d/filter1d/shiftX.d.ts +0 -20
  385. package/lib/data/data1d/filter1d/shiftX.js +0 -26
  386. package/lib/data/data1d/filter1d/signalProcessing.d.ts +0 -26
  387. package/lib/data/data1d/filter1d/signalProcessing.js +0 -65
  388. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +0 -2
  389. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +0 -35
  390. package/lib/data/data1d/filter1d/zeroFilling.d.ts +0 -22
  391. package/lib/data/data1d/filter1d/zeroFilling.js +0 -60
  392. package/lib/data/data2d/filter2d/shiftX.d.ts +0 -18
  393. package/lib/data/data2d/filter2d/shiftX.js +0 -27
  394. package/lib/data/data2d/filter2d/shiftY.d.ts +0 -18
  395. package/lib/data/data2d/filter2d/shiftY.js +0 -27
  396. package/lib/data/types/view-state/PeaksViewState.d.ts +0 -17
  397. package/lib/data/types/view-state/PeaksViewState.js +0 -1
  398. package/lib/types/NMRiumGeneralPreferences.d.ts +0 -7
  399. package/lib/types/NMRiumGeneralPreferences.js +0 -1
  400. package/lib/types/NMRiumPanelPreferences.d.ts +0 -17
  401. package/lib/types/NMRiumPanelPreferences.js +0 -1
  402. package/lib/types/NMRiumToolBarPreferences.d.ts +0 -22
  403. package/lib/types/NMRiumToolBarPreferences.js +0 -1
  404. package/lib/types/PanelPreferencesType.d.ts +0 -4
  405. package/lib/types/PanelPreferencesType.js +0 -1
  406. package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +0 -102
  407. package/lib-cjs/component/workspaces/Workspace.js +0 -2
  408. package/lib-cjs/data/Filters.js +0 -38
  409. package/lib-cjs/data/FiltersManager.js +0 -206
  410. package/lib-cjs/data/data1d/Spectrum1D/getShiftX.js +0 -33
  411. package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +0 -8
  412. package/lib-cjs/data/data1d/Spectrum1D/integrals/checkIntegralKind.js +0 -13
  413. package/lib-cjs/data/data1d/Spectrum1D/integrals/mapIntegrals.js +0 -40
  414. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateIntegrals.js +0 -10
  415. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateIntegralsRelativeValues.js +0 -9
  416. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +0 -30
  417. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +0 -49
  418. package/lib-cjs/data/data1d/Spectrum1D/peaks/updatePeaks.js +0 -11
  419. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +0 -82
  420. package/lib-cjs/data/data1d/Spectrum1D/ranges/updateRanges.js +0 -13
  421. package/lib-cjs/data/data1d/Spectrum1D/ranges/updateRangesRelativeValues.js +0 -9
  422. package/lib-cjs/data/data1d/filter1d/apodization.js +0 -88
  423. package/lib-cjs/data/data1d/filter1d/baselineCorrection.js +0 -60
  424. package/lib-cjs/data/data1d/filter1d/digitalFilter.js +0 -50
  425. package/lib-cjs/data/data1d/filter1d/equallySpaced.js +0 -61
  426. package/lib-cjs/data/data1d/filter1d/exclusionZones.js +0 -38
  427. package/lib-cjs/data/data1d/filter1d/fft.js +0 -96
  428. package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +0 -70
  429. package/lib-cjs/data/data1d/filter1d/shiftX.js +0 -32
  430. package/lib-cjs/data/data1d/filter1d/signalProcessing.js +0 -95
  431. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +0 -39
  432. package/lib-cjs/data/data1d/filter1d/zeroFilling.js +0 -66
  433. package/lib-cjs/data/data2d/filter2d/shiftX.js +0 -33
  434. package/lib-cjs/data/data2d/filter2d/shiftY.js +0 -33
  435. package/lib-cjs/data/types/view-state/PeaksViewState.js +0 -2
  436. package/lib-cjs/types/NMRiumGeneralPreferences.js +0 -2
  437. package/lib-cjs/types/NMRiumPanelPreferences.js +0 -2
  438. package/lib-cjs/types/NMRiumToolBarPreferences.js +0 -2
  439. package/lib-cjs/types/PanelPreferencesType.js +0 -2
@@ -1,51 +0,0 @@
1
- import airPLS from 'ml-airpls';
2
- import equallySpaced from 'ml-array-xy-equally-spaced';
3
- import baselineRegression from 'ml-baseline-correction-regression';
4
- export const id = 'baselineCorrection';
5
- export const name = 'Baseline correction';
6
- export const DOMAIN_UPDATE_RULES = {
7
- updateXDomain: false,
8
- updateYDomain: true,
9
- };
10
- export function apply(datum1D, options) {
11
- if (!isApplicable(datum1D)) {
12
- throw new Error('baselineCorrection not applicable on this data');
13
- }
14
- const { algorithm } = options;
15
- let { x, re } = datum1D.data;
16
- let corrected;
17
- switch (algorithm) {
18
- case 'airpls':
19
- corrected = airPLS(x, re, options).corrected;
20
- break;
21
- case 'polynomial':
22
- {
23
- const { degree, zones } = options;
24
- let reduced = equallySpaced({ x, y: re }, { numberOfPoints: 4096, zones });
25
- let result = baselineRegression(reduced.x, reduced.y, {
26
- regressionOptions: degree,
27
- });
28
- let { regression } = result;
29
- corrected = new Float64Array(x.length);
30
- for (let i = 0; i < re.length; i++) {
31
- corrected[i] = re[i] - regression.predict(x[i]);
32
- }
33
- }
34
- break;
35
- default:
36
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
37
- throw new Error(`baselineCorrection: algorithm unknown: ${algorithm}`);
38
- }
39
- Object.assign(datum1D.data, { re: corrected });
40
- }
41
- export function isApplicable(datum1D) {
42
- if (!datum1D.info.isFid)
43
- return true;
44
- return false;
45
- }
46
- export function reduce(previousValue, newValue) {
47
- return {
48
- once: true,
49
- reduce: newValue,
50
- };
51
- }
@@ -1,20 +0,0 @@
1
- import { Data1D, Spectrum1D } from 'nmr-load-save';
2
- import { FilterDomainUpdateRules } from '../../FiltersManager';
3
- export declare const id = "digitalFilter";
4
- export declare const name = "Digital filter";
5
- export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
6
- /**
7
- * Move points from the beginning to the end of FID and performs a first order phase correction
8
- * @param {Datum1d} spectrum
9
- */
10
- export interface DigitalFilterOptions {
11
- digitalFilterValue?: number;
12
- }
13
- export declare function apply(spectrum: Spectrum1D, options?: DigitalFilterOptions): void;
14
- export declare function isApplicable(spectrum: Spectrum1D): spectrum is Spectrum1D & {
15
- data: Required<Data1D>;
16
- };
17
- export declare function reduce(): {
18
- once: boolean;
19
- reduce: undefined;
20
- };
@@ -1,44 +0,0 @@
1
- export const id = 'digitalFilter';
2
- export const name = 'Digital filter';
3
- export const DOMAIN_UPDATE_RULES = {
4
- updateXDomain: true,
5
- updateYDomain: true,
6
- };
7
- export function apply(spectrum, options = {}) {
8
- if (!isApplicable(spectrum)) {
9
- throw new Error('Digital Filter is not applicable on this data');
10
- }
11
- let { digitalFilterValue } = options;
12
- if (!digitalFilterValue) {
13
- digitalFilterValue = spectrum.info.digitalFilter || 0;
14
- const filter = spectrum.filters.find((filter) => filter.name === id);
15
- if (filter) {
16
- filter.value = { digitalFilterValue };
17
- }
18
- }
19
- let re = new Float64Array(spectrum.data.re);
20
- let im = new Float64Array(spectrum.data.im);
21
- let pointsToShift = Math.floor(digitalFilterValue);
22
- const skip = 0;
23
- pointsToShift += 0;
24
- const newRe = new Float64Array(re.length);
25
- const newIm = new Float64Array(im.length);
26
- newRe.set(re.slice(pointsToShift));
27
- newRe.set(re.slice(skip, pointsToShift), re.length - pointsToShift);
28
- newIm.set(im.slice(pointsToShift));
29
- newIm.set(im.slice(skip, pointsToShift), im.length - pointsToShift);
30
- spectrum.data.re = newRe;
31
- spectrum.data.im = newIm;
32
- }
33
- export function isApplicable(spectrum) {
34
- if (spectrum.info.isComplex && spectrum.info.isFid) {
35
- return true;
36
- }
37
- return false;
38
- }
39
- export function reduce() {
40
- return {
41
- once: true,
42
- reduce: undefined,
43
- };
44
- }
@@ -1,33 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- export declare const id = "equallySpaced";
3
- export declare const name = "Equally spaced";
4
- /**
5
- * Equally Spaced
6
- * **
7
- * Function that returns a Number array of equally spaced numberOfPoints
8
- * containing a representation of intensities of the spectra arguments x
9
- * and y.
10
- *
11
- * The options parameter contains an object in the following form:
12
- * from: starting point
13
- * to: last point
14
- * numberOfPoints: number of points between from and to
15
- * variant: "slot" or "smooth" - smooth is the default option
16
- *
17
- * The slot variant consist that each point in the new array is calculated
18
- * averaging the existing points between the slot that belongs to the current
19
- * value. The smooth variant is the same but takes the integral of the range
20
- * of the slot and divide by the step size between two points in the new array.
21
- *
22
- * @param {Spectrum1D} spectrum
23
- * @param {Object} options.from
24
- * @param {number} options.to
25
- * @param {number} options.numberOfPoints
26
- * @param {Array<{from:number;to:number}>} options.exclusions
27
- */
28
- export declare function apply(spectrum: Spectrum1D, options?: any): void;
29
- export declare function isApplicable(spectrum: Spectrum1D): boolean;
30
- export declare function reduce(): {
31
- once: boolean;
32
- reduce: null;
33
- };
@@ -1,52 +0,0 @@
1
- import equallySpaced from 'ml-array-xy-equally-spaced';
2
- export const id = 'equallySpaced';
3
- export const name = 'Equally spaced';
4
- /**
5
- * Equally Spaced
6
- * **
7
- * Function that returns a Number array of equally spaced numberOfPoints
8
- * containing a representation of intensities of the spectra arguments x
9
- * and y.
10
- *
11
- * The options parameter contains an object in the following form:
12
- * from: starting point
13
- * to: last point
14
- * numberOfPoints: number of points between from and to
15
- * variant: "slot" or "smooth" - smooth is the default option
16
- *
17
- * The slot variant consist that each point in the new array is calculated
18
- * averaging the existing points between the slot that belongs to the current
19
- * value. The smooth variant is the same but takes the integral of the range
20
- * of the slot and divide by the step size between two points in the new array.
21
- *
22
- * @param {Spectrum1D} spectrum
23
- * @param {Object} options.from
24
- * @param {number} options.to
25
- * @param {number} options.numberOfPoints
26
- * @param {Array<{from:number;to:number}>} options.exclusions
27
- */
28
- export function apply(spectrum, options = {}) {
29
- if (!isApplicable(spectrum)) {
30
- throw new Error('Equally Spaced is not applicable on this data');
31
- }
32
- const { from, to, numberOfPoints, exclusions } = options;
33
- const { x, re, im } = spectrum.data;
34
- const XREdata = equallySpaced({ x, y: re }, { from, to, numberOfPoints, exclusions });
35
- spectrum.data.x = XREdata.x;
36
- spectrum.data.re = XREdata.y;
37
- if (im) {
38
- const XIMdata = equallySpaced({ x, y: re }, { from, to, numberOfPoints, exclusions });
39
- spectrum.data.im = XIMdata.y;
40
- }
41
- }
42
- export function isApplicable(spectrum) {
43
- if (spectrum.info.isComplex && !spectrum.info.isFid)
44
- return true;
45
- return false;
46
- }
47
- export function reduce() {
48
- return {
49
- once: false,
50
- reduce: null,
51
- };
52
- }
@@ -1,15 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- import { FilterDomainUpdateRules } from '../../FiltersManager';
3
- export declare const id = "exclusionZones";
4
- export declare const name = "Exclusion zones";
5
- export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
6
- /**
7
- *
8
- * @param {Spectrum1D} spectrum
9
- */
10
- export declare function apply(spectrum: Spectrum1D, zones?: never[]): void;
11
- export declare function isApplicable(spectrum: Spectrum1D): boolean;
12
- export declare function reduce(previousValue: any, newValue: any): {
13
- once: boolean;
14
- reduce: import("cheminfo-types").FromTo[];
15
- };
@@ -1,32 +0,0 @@
1
- import { xySetYValue, zonesNormalize } from 'ml-spectra-processing';
2
- export const id = 'exclusionZones';
3
- export const name = 'Exclusion zones';
4
- export const DOMAIN_UPDATE_RULES = {
5
- updateXDomain: false,
6
- updateYDomain: false,
7
- };
8
- /**
9
- *
10
- * @param {Spectrum1D} spectrum
11
- */
12
- export function apply(spectrum, zones = []) {
13
- if (!isApplicable(spectrum)) {
14
- throw new Error('Exclusion Zones filter not applicable on this data');
15
- }
16
- const { x, re, im } = spectrum.data;
17
- spectrum.data.re = Float64Array.from(xySetYValue({ x, y: re }, { zones }).y);
18
- spectrum.data.im = im
19
- ? Float64Array.from(xySetYValue({ x, y: re }, { zones }).y)
20
- : im;
21
- }
22
- export function isApplicable(spectrum) {
23
- if (spectrum.info.isFt)
24
- return true;
25
- return false;
26
- }
27
- export function reduce(previousValue, newValue) {
28
- return {
29
- once: true,
30
- reduce: zonesNormalize(previousValue.concat(newValue)),
31
- };
32
- }
@@ -1,18 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- import { Data1D } from 'nmr-load-save/lib/types/Data1D';
3
- import { FilterDomainUpdateRules } from '../../FiltersManager';
4
- export declare const id = "fft";
5
- export declare const name = "FFT";
6
- export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
7
- /**
8
- *
9
- * @param {Spectrum1D} spectrum
10
- */
11
- export declare function apply(spectrum: Spectrum1D): void;
12
- export declare function isApplicable(spectrum: Spectrum1D): spectrum is Spectrum1D & {
13
- data: Required<Data1D>;
14
- };
15
- export declare function reduce(): {
16
- once: boolean;
17
- reduce: undefined;
18
- };
@@ -1,90 +0,0 @@
1
- import { reimFFT, reimPhaseCorrection, xMean, } from 'ml-spectra-processing';
2
- import { padDataToNextPowerOfTwo } from './utils/padDataToNextPowerOfTwo';
3
- export const id = 'fft';
4
- export const name = 'FFT';
5
- export const DOMAIN_UPDATE_RULES = {
6
- updateXDomain: true,
7
- updateYDomain: true,
8
- };
9
- /**
10
- *
11
- * @param {Spectrum1D} spectrum
12
- */
13
- export function apply(spectrum) {
14
- if (!isApplicable(spectrum)) {
15
- throw new Error('fft not applicable on this data');
16
- }
17
- checkSameLength(spectrum);
18
- let digitalFilterApplied = spectrum.filters.some((e) => e.name === 'digitalFilter' && e.flag);
19
- const { info: { aqMod }, } = spectrum;
20
- if (aqMod === 1) {
21
- removeDCOffset(spectrum, digitalFilterApplied);
22
- }
23
- if (!isPowerOfTwo(spectrum.data.x.length)) {
24
- padDataToNextPowerOfTwo(spectrum, digitalFilterApplied);
25
- }
26
- const { data, info } = spectrum;
27
- Object.assign(data, reimFFT({
28
- re: data.re,
29
- im: data.im,
30
- }, { applyZeroShift: true }));
31
- if (digitalFilterApplied) {
32
- let { digitalFilter = 0 } = info;
33
- let ph1 = (digitalFilter - Math.floor(digitalFilter)) * Math.PI * 2;
34
- Object.assign(data, reimPhaseCorrection(data, 0, -ph1, { reverse: true }));
35
- }
36
- data.x = generateXAxis(spectrum);
37
- spectrum.info = { ...info, isFid: false, isFt: true };
38
- }
39
- export function isApplicable(spectrum) {
40
- if (spectrum.info.isComplex && spectrum.info.isFid)
41
- return true;
42
- return false;
43
- }
44
- export function reduce() {
45
- return {
46
- once: true,
47
- reduce: undefined,
48
- };
49
- }
50
- function generateXAxis(datum1D) {
51
- const info = datum1D.info;
52
- const baseFrequency = Number.parseFloat(info.baseFrequency);
53
- const frequencyOffset = Number.parseFloat(info.frequencyOffset);
54
- const spectralWidth = Number.parseFloat(info.spectralWidth);
55
- const offset = frequencyOffset / baseFrequency;
56
- let spectralHalfWidth = 0.5 * spectralWidth;
57
- let nbPoints = datum1D.data.x.length;
58
- let firstPoint = offset - spectralHalfWidth;
59
- let dx = spectralWidth / (nbPoints - 1);
60
- const xAxis = new Float64Array(nbPoints);
61
- for (let i = 0; i < nbPoints; i++) {
62
- xAxis[i] = firstPoint;
63
- firstPoint += dx;
64
- }
65
- return xAxis;
66
- }
67
- function isPowerOfTwo(n) {
68
- return n !== 0 && (n & (n - 1)) === 0;
69
- }
70
- function removeDCOffset(spectrum, digitalFilterApplied) {
71
- let { digitalFilter = 0 } = digitalFilterApplied ? spectrum.info : {};
72
- const data = spectrum.data;
73
- const nbPoints = data.re.length;
74
- const newRe = new Float64Array(data.re);
75
- const newIm = new Float64Array(data.im);
76
- const averageRe = xMean(data.re.slice((nbPoints * 0.75) >> 0, nbPoints - digitalFilter));
77
- const averageIm = xMean(data.im.slice((nbPoints * 0.75) >> 0, nbPoints - digitalFilter));
78
- for (let i = digitalFilterApplied ? 0 : digitalFilter; i < nbPoints - digitalFilter; i++) {
79
- newRe[i] -= averageRe;
80
- newIm[i] -= averageIm;
81
- }
82
- Object.assign(spectrum.data, { re: newRe, im: newIm });
83
- return spectrum;
84
- }
85
- function checkSameLength(spectrum) {
86
- const { data } = spectrum;
87
- if (data.x.length !== data.re.length || data.x.length !== data.im?.length) {
88
- throw new Error('The length of data should be equal');
89
- }
90
- }
@@ -1,26 +0,0 @@
1
- import { Data1D, Spectrum1D } from 'nmr-load-save';
2
- import { FilterDomainUpdateRules } from '../../FiltersManager';
3
- export declare const id = "phaseCorrection";
4
- export declare const name = "Phase correction";
5
- export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
6
- /**
7
- *
8
- * @param {Spectrum1D} spectrum
9
- * @param {Object} [options={}]
10
- * @param {number} [options.ph0=0]
11
- * @param {number} [options.ph1=0]
12
- */
13
- interface PhaseCorrectionOptions {
14
- ph0?: number;
15
- ph1?: number;
16
- absolute?: boolean;
17
- }
18
- export declare function apply(spectrum: Spectrum1D, options: PhaseCorrectionOptions): void;
19
- export declare function isApplicable(spectrum: Spectrum1D): spectrum is Spectrum1D & {
20
- data: Required<Data1D>;
21
- };
22
- export declare function reduce(previousValue: any, newValue: any): {
23
- once: boolean;
24
- reduce: any;
25
- };
26
- export {};
@@ -1,64 +0,0 @@
1
- import { reimAbsolute, reimPhaseCorrection, reimAutoPhaseCorrection, } from 'ml-spectra-processing';
2
- export const id = 'phaseCorrection';
3
- export const name = 'Phase correction';
4
- export const DOMAIN_UPDATE_RULES = {
5
- updateXDomain: false,
6
- updateYDomain: false,
7
- };
8
- export function apply(spectrum, options) {
9
- if (!isApplicable(spectrum)) {
10
- throw new Error('phaseCorrection not applicable on this data');
11
- }
12
- const { absolute = false } = options;
13
- const filter = spectrum.filters?.find((filter) => filter.name === id);
14
- if (absolute) {
15
- spectrum.data.re = reimAbsolute(spectrum.data);
16
- spectrum.data.im = new Float64Array(0);
17
- if (filter) {
18
- filter.value = { ...filter.value, ph0: 0, ph1: 0, absolute };
19
- }
20
- }
21
- else if ('ph0' in options && 'ph1' in options) {
22
- let { ph0, ph1 } = options;
23
- phaseCorrection(spectrum, { ph0, ph1 });
24
- if (filter) {
25
- filter.value = { ...filter.value, absolute };
26
- }
27
- }
28
- else {
29
- let { ph0, ph1 } = autoPhaseCorrection(spectrum);
30
- phaseCorrection(spectrum, { ph0, ph1 });
31
- if (filter) {
32
- filter.value = { ...filter.value, absolute, ph0, ph1 };
33
- }
34
- }
35
- }
36
- export function isApplicable(spectrum) {
37
- if (spectrum.info.isComplex && !spectrum.info.isFid)
38
- return true;
39
- return false;
40
- }
41
- export function reduce(previousValue, newValue) {
42
- return {
43
- once: true,
44
- reduce: newValue,
45
- };
46
- }
47
- function phaseCorrection(spectrum, { ph0, ph1 }) {
48
- ph0 *= Math.PI / 180;
49
- ph1 *= Math.PI / 180;
50
- spectrum.data = {
51
- ...spectrum.data,
52
- ...reimPhaseCorrection(spectrum.data, ph0, ph1, { reverse: true }),
53
- };
54
- }
55
- function autoPhaseCorrection(spectrum, options = {}) {
56
- const { minRegSize = 5, maxDistanceToJoin = 128, magnitudeMode = true, factorNoise = 5, reverse = true, } = options;
57
- return reimAutoPhaseCorrection(spectrum.data, {
58
- minRegSize,
59
- maxDistanceToJoin,
60
- magnitudeMode,
61
- factorNoise,
62
- reverse,
63
- });
64
- }
@@ -1,20 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- import { FilterDomainUpdateRules } from '../../FiltersManager';
3
- /**
4
- *
5
- * @param {Spectrum1D} spectrum
6
- * @param {number} [shiftValue=0]
7
- */
8
- export declare const id = "shiftX";
9
- export declare const name = "Shift X";
10
- export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
11
- export declare function apply(spectrum: Spectrum1D, options?: {
12
- shift?: number;
13
- }): void;
14
- export declare function isApplicable(): boolean;
15
- export declare function reduce(previous: any, next: any): {
16
- once: boolean;
17
- reduce: {
18
- shift: any;
19
- };
20
- };
@@ -1,26 +0,0 @@
1
- /**
2
- *
3
- * @param {Spectrum1D} spectrum
4
- * @param {number} [shiftValue=0]
5
- */
6
- export const id = 'shiftX';
7
- export const name = 'Shift X';
8
- export const DOMAIN_UPDATE_RULES = {
9
- updateXDomain: true,
10
- updateYDomain: false,
11
- };
12
- export function apply(spectrum, options = {}) {
13
- const { shift = 0 } = options;
14
- spectrum.data.x = spectrum.data.x.map((val) => val + shift);
15
- }
16
- export function isApplicable() {
17
- return true;
18
- }
19
- export function reduce(previous, next) {
20
- const { shift: previousValue = 0 } = previous;
21
- const { shift: nextShift = 0 } = next;
22
- return {
23
- once: true,
24
- reduce: { shift: previousValue + nextShift },
25
- };
26
- }
@@ -1,26 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- import { FilterDomainUpdateRules } from '../../FiltersManager';
3
- import { MatrixOptions } from '../../types/data1d/MatrixOptions';
4
- export declare const id = "signalProcessing";
5
- export declare const name = "Signal processing";
6
- export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
7
- /**
8
- *
9
- * @param {Spectrum1D} spectrum
10
- * @param {MatrixOptions} options
11
- */
12
- export declare function apply(spectrum: Spectrum1D, options: MatrixOptions): void;
13
- export declare function isApplicable(spectrum: Spectrum1D): boolean;
14
- export declare function reduce(previousValue: any, newValue: any): {
15
- once: boolean;
16
- reduce: any;
17
- };
18
- /**
19
- * Apply filters on {x:[], y:[]}
20
- * @returns A very important number
21
- */
22
- export declare function filterXY(spectrum: Spectrum1D, options: MatrixOptions): {
23
- x: Float64Array;
24
- re: Float64Array;
25
- im: Float64Array | undefined;
26
- };
@@ -1,65 +0,0 @@
1
- import * as Filters from 'ml-signal-processing';
2
- export const id = 'signalProcessing';
3
- export const name = 'Signal processing';
4
- export const DOMAIN_UPDATE_RULES = {
5
- updateXDomain: true,
6
- updateYDomain: true,
7
- };
8
- /**
9
- *
10
- * @param {Spectrum1D} spectrum
11
- * @param {MatrixOptions} options
12
- */
13
- export function apply(spectrum, options) {
14
- if (!isApplicable(spectrum)) {
15
- throw new Error('Signal Processing is not applicable on this data');
16
- }
17
- spectrum.data = filterXY(spectrum, options);
18
- }
19
- export function isApplicable(spectrum) {
20
- if (spectrum.info.isFt)
21
- return true;
22
- return false;
23
- }
24
- export function reduce(previousValue, newValue) {
25
- return {
26
- once: true,
27
- reduce: newValue,
28
- };
29
- }
30
- /**
31
- * Apply filters on {x:[], y:[]}
32
- * @returns A very important number
33
- */
34
- export function filterXY(spectrum, options) {
35
- let x = spectrum.data.x.slice(0);
36
- let cloneX = spectrum.data.x.slice(0);
37
- let re = spectrum.data.re.slice(0);
38
- let im = spectrum.data.im?.slice(0);
39
- const filters = options.filters.slice();
40
- const { range: { from, to }, numberOfPoints, exclusionsZones: exclusions, } = options;
41
- filters.push({
42
- name: 'equallySpaced',
43
- options: { from, to, numberOfPoints, exclusions },
44
- properties: {},
45
- });
46
- for (const filter of filters) {
47
- // eslint-disable-next-line import/namespace
48
- const filterFunction = Filters[filter.name];
49
- if (!filterFunction) {
50
- throw new Error(`Unknown filter: ${filter.name}`);
51
- }
52
- const filterOptions = filter?.options || {};
53
- // @ts-expect-error some method have options and some other ones don't have any options
54
- const realResult = filterFunction({ x, y: re }, filterOptions);
55
- x = realResult.data.x;
56
- re = realResult.data.y;
57
- if (im) {
58
- const imaginaryResult = filterFunction({ x: cloneX, y: im },
59
- // @ts-expect-error some method have options and some other ones don't have any options
60
- filterOptions);
61
- im = imaginaryResult.data.y;
62
- }
63
- }
64
- return { x, re, im };
65
- }
@@ -1,2 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- export declare function padDataToNextPowerOfTwo(spectrum: Spectrum1D, digitalFilterApplied: boolean): void;
@@ -1,35 +0,0 @@
1
- import { xSequentialFill } from 'ml-spectra-processing';
2
- export function padDataToNextPowerOfTwo(spectrum, digitalFilterApplied) {
3
- const { x, re, im } = spectrum.data;
4
- const size = nextPowerOfTwo(x.length);
5
- let newRE = new Float64Array(size);
6
- let newIM = new Float64Array(size);
7
- const pointsToShift = getPointsToShift(spectrum);
8
- newRE.set(re.slice(0, size - pointsToShift));
9
- newIM.set(im.slice(0, size - pointsToShift));
10
- if (pointsToShift > 0 && digitalFilterApplied) {
11
- newRE.set(re.slice(re.length - pointsToShift), size - pointsToShift);
12
- newIM.set(im.slice(re.length - pointsToShift), size - pointsToShift);
13
- }
14
- const newX = xSequentialFill({
15
- from: x[0],
16
- size,
17
- step: x[1] - x[0],
18
- });
19
- spectrum.data = { ...spectrum.data, re: newRE, im: newIM, x: newX };
20
- }
21
- function getPointsToShift(spectrum) {
22
- let grpdly = spectrum.info?.digitalFilter || 0;
23
- return grpdly > 0 ? Math.floor(grpdly) : 0;
24
- }
25
- function nextPowerOfTwo(n) {
26
- if (n === 0)
27
- return 1;
28
- n--;
29
- n |= n >> 1;
30
- n |= n >> 2;
31
- n |= n >> 4;
32
- n |= n >> 8;
33
- n |= n >> 16;
34
- return n + 1;
35
- }
@@ -1,22 +0,0 @@
1
- import { Data1D, Spectrum1D } from 'nmr-load-save';
2
- import { FilterDomainUpdateRules } from '../../FiltersManager';
3
- export declare const id = "zeroFilling";
4
- export declare const name = "Zero filling";
5
- export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
6
- /**
7
- *
8
- * @param {Spectrum1D} spectrum
9
- * @param {Object} [nbPoints]
10
- */
11
- export interface ZeroFillingOptions {
12
- nbPoints?: number;
13
- factor?: number;
14
- }
15
- export declare function apply(spectrum: Spectrum1D, options: ZeroFillingOptions): void;
16
- export declare function isApplicable(spectrum: Spectrum1D): spectrum is Spectrum1D & {
17
- data: Required<Data1D>;
18
- };
19
- export declare function reduce(_previousValue: any, newValue: any): {
20
- once: boolean;
21
- reduce: any;
22
- };