nmrium 0.38.1 → 0.39.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 (474) 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/KeysListenerTracker.js +90 -67
  34. package/lib/component/EventsTrackers/MouseTracker.d.ts +6 -2
  35. package/lib/component/EventsTrackers/MouseTracker.js +4 -1
  36. package/lib/component/NMRium.d.ts +5 -5
  37. package/lib/component/NMRium.js +15 -16
  38. package/lib/component/assignment/AssignmentsReducer.d.ts +2 -2
  39. package/lib/component/context/LoggerContext.js +5 -0
  40. package/lib/component/context/PreferencesContext.d.ts +10 -8
  41. package/lib/component/elements/Button.d.ts +13 -11
  42. package/lib/component/elements/Button.js +16 -25
  43. package/lib/component/elements/ColorInput.d.ts +0 -1
  44. package/lib/component/elements/ColorInput.js +2 -2
  45. package/lib/component/elements/EditableColumn.js +5 -2
  46. package/lib/component/elements/Input.js +2 -4
  47. package/lib/component/elements/Label.d.ts +1 -0
  48. package/lib/component/elements/Label.js +2 -2
  49. package/lib/component/elements/MolecularFormulaInput.d.ts +2 -2
  50. package/lib/component/elements/MolecularFormulaInput.js +15 -18
  51. package/lib/component/elements/NextPrev.d.ts +5 -3
  52. package/lib/component/elements/NextPrev.js +26 -8
  53. package/lib/component/elements/NumberInput.js +2 -2
  54. package/lib/component/elements/ReactTable/ReactTable.js +4 -4
  55. package/lib/component/elements/formik/FormikCheckBox.d.ts +2 -1
  56. package/lib/component/elements/formik/FormikCheckBox.js +2 -2
  57. package/lib/component/elements/formik/FormikColumnFormatField.d.ts +4 -0
  58. package/lib/component/elements/formik/FormikColumnFormatField.js +19 -16
  59. package/lib/component/elements/formik/FormikError.d.ts +8 -0
  60. package/lib/component/elements/formik/FormikError.js +22 -0
  61. package/lib/component/elements/formik/FormikInput.js +10 -6
  62. package/lib/component/elements/formik/FormikSelect.js +1 -1
  63. package/lib/component/header/ApodizationOptionsPanel.js +4 -3
  64. package/lib/component/header/AutoPeakPickingOptionPanel.js +16 -7
  65. package/lib/component/header/BaseLineCorrectionPanel.js +5 -2
  66. package/lib/component/header/PhaseCorrectionPanel.js +5 -2
  67. package/lib/component/header/RangesPickingOptionPanel.js +15 -7
  68. package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
  69. package/lib/component/highlight/index.d.ts +1 -1
  70. package/lib/component/hooks/useActiveSpectra.d.ts +1 -1
  71. package/lib/component/hooks/useActiveSpectrum.d.ts +1 -1
  72. package/lib/component/hooks/useActiveSpectrumPeaksViewState.d.ts +1 -1
  73. package/lib/component/hooks/useCheckPointsNumberInWindowArea.d.ts +2 -0
  74. package/lib/component/hooks/useCheckPointsNumberInWindowArea.js +17 -0
  75. package/lib/component/hooks/useCheckToolsVisibility.d.ts +2 -2
  76. package/lib/component/hooks/useDatumWithSpectraStatistics.d.ts +3 -2
  77. package/lib/component/hooks/useExport.js +1 -1
  78. package/lib/component/hooks/useFilter.d.ts +2 -1
  79. package/lib/component/hooks/usePanelPreferences.d.ts +3 -3
  80. package/lib/component/hooks/usePanelPreferences.js +4 -0
  81. package/lib/component/hooks/useSaveSettings.d.ts +1 -1
  82. package/lib/component/hooks/useSaveSettings.js +17 -15
  83. package/lib/component/hooks/useVerticalAlign.d.ts +1 -1
  84. package/lib/component/loader/DropZone.js +1 -2
  85. package/lib/component/modal/EditPeakShapeModal.d.ts +2 -2
  86. package/lib/component/modal/LoadJCAMPModal.d.ts +3 -3
  87. package/lib/component/modal/LoadJCAMPModal.js +56 -74
  88. package/lib/component/modal/ModalStyle.js +0 -10
  89. package/lib/component/modal/MoleculeStructureEditorModal.d.ts +2 -1
  90. package/lib/component/modal/MoleculeStructureEditorModal.js +12 -6
  91. package/lib/component/modal/MultipletAnalysisModal.d.ts +2 -2
  92. package/lib/component/modal/PredictSpectraModal.d.ts +4 -2
  93. package/lib/component/modal/PredictSpectraModal.js +53 -105
  94. package/lib/component/modal/SaveAsModal.d.ts +2 -0
  95. package/lib/component/modal/SaveAsModal.js +21 -14
  96. package/lib/component/modal/changeSum/ChangeSumModal.js +25 -38
  97. package/lib/component/modal/editRange/EditRangeModal.d.ts +7 -6
  98. package/lib/component/modal/editRange/EditRangeModal.js +33 -13
  99. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +1 -1
  100. package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -0
  101. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +2 -2
  102. package/lib/component/modal/metaImportation/MetaImportationModal.js +15 -5
  103. package/lib/component/modal/setting/GeneralSettings.js +2 -7
  104. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts +1 -1
  105. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
  106. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  107. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +7 -15
  108. package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +2 -2
  109. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +1 -11
  110. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +20 -25
  111. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +6 -11
  112. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +71 -81
  113. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
  114. package/lib/component/panels/MoleculesPanel/Utilities.js +3 -1
  115. package/lib/component/panels/MultipleSpectraAnalysisPanel/base/AnalysisColumnHeader.js +6 -6
  116. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
  117. package/lib/component/panels/MultipleSpectraAnalysisPanel/preferences/index.js +2 -2
  118. package/lib/component/panels/Panels.js +2 -2
  119. package/lib/component/panels/PeaksPanel/PeaksPanel.d.ts +1 -1
  120. package/lib/component/panels/RangesPanel/RangesHeader.js +39 -53
  121. package/lib/component/panels/RangesPanel/RangesPreferences.d.ts +1 -1
  122. package/lib/component/panels/RangesPanel/RangesPreferences.js +7 -22
  123. package/lib/component/panels/RangesPanel/RangesTable.d.ts +2 -2
  124. package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +2 -2
  125. package/lib/component/panels/RangesPanel/TableColumns/SignalDeltaHzColumn.d.ts +1 -1
  126. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.d.ts +1 -1
  127. package/lib/component/panels/RangesPanel/hooks/useEditRangeModal.js +9 -12
  128. package/lib/component/panels/RangesPanel/hooks/useMapRanges.d.ts +1 -1
  129. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +5 -1
  130. package/lib/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +10 -4
  131. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.d.ts +2 -2
  132. package/lib/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +1 -1
  133. package/lib/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
  134. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditPathLength.d.ts +1 -1
  135. package/lib/component/panels/ZonesPanel/hooks/useMapZones.d.ts +1 -1
  136. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
  137. package/lib/component/panels/databasePanel/DatabasePanel.js +5 -24
  138. package/lib/component/panels/databasePanel/DatabasePreferences.js +2 -2
  139. package/lib/component/panels/header/DefaultPanelHeader.d.ts +2 -3
  140. package/lib/component/panels/header/DefaultPanelHeader.js +18 -26
  141. package/lib/component/panels/header/PanelHeader.d.ts +7 -0
  142. package/lib/component/panels/header/PanelHeader.js +12 -0
  143. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.d.ts +9 -0
  144. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +94 -0
  145. package/lib/component/panels/predictionPanel/PredictionPanel.d.ts +1 -1
  146. package/lib/component/panels/predictionPanel/PredictionPanel.js +109 -37
  147. package/lib/component/panels/predictionPanel/PredictionPreferences.d.ts +3 -0
  148. package/lib/component/panels/predictionPanel/PredictionPreferences.js +24 -0
  149. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.d.ts +2 -0
  150. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +44 -0
  151. package/lib/component/reducer/Reducer.d.ts +5 -87
  152. package/lib/component/reducer/Reducer.js +1 -29
  153. package/lib/component/reducer/actions/DatabaseActions.js +6 -4
  154. package/lib/component/reducer/actions/DomainActions.js +3 -0
  155. package/lib/component/reducer/actions/FiltersActions.d.ts +1 -2
  156. package/lib/component/reducer/actions/FiltersActions.js +47 -52
  157. package/lib/component/reducer/actions/HistoryActions.d.ts +4 -0
  158. package/lib/component/reducer/actions/HistoryActions.js +40 -0
  159. package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
  160. package/lib/component/reducer/actions/IntegralsActions.js +3 -1
  161. package/lib/component/reducer/actions/LoadActions.d.ts +1 -2
  162. package/lib/component/reducer/actions/LoadActions.js +1 -1
  163. package/lib/component/reducer/actions/MoleculeActions.d.ts +7 -4
  164. package/lib/component/reducer/actions/MoleculeActions.js +57 -28
  165. package/lib/component/reducer/actions/PeaksActions.d.ts +1 -2
  166. package/lib/component/reducer/actions/PeaksActions.js +3 -3
  167. package/lib/component/reducer/actions/RangesActions.d.ts +4 -5
  168. package/lib/component/reducer/actions/RangesActions.js +5 -27
  169. package/lib/component/reducer/actions/SpectrumsActions.js +8 -8
  170. package/lib/component/reducer/actions/ToolsActions.d.ts +2 -2
  171. package/lib/component/reducer/actions/ToolsActions.js +3 -32
  172. package/lib/component/reducer/actions/ZonesActions.d.ts +2 -1
  173. package/lib/component/reducer/actions/ZonesActions.js +3 -6
  174. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +8 -0
  175. package/lib/component/reducer/helper/ZoomHistoryManager.js +35 -0
  176. package/lib/component/reducer/helper/getActiveSpectra.d.ts +1 -1
  177. package/lib/component/reducer/helper/getActiveSpectrum.d.ts +1 -1
  178. package/lib/component/reducer/helper/getVerticalAlign.d.ts +1 -1
  179. package/lib/component/reducer/preferences/actions/addWorkspace.js +2 -2
  180. package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.d.ts +1 -1
  181. package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -3
  182. package/lib/component/reducer/preferences/utilities/getActiveWorkspace.d.ts +1 -1
  183. package/lib/component/reducer/preferences/utilities/getPreferencesByWorkspace.d.ts +2 -3
  184. package/lib/component/reducer/preferences/utilities/initWorkspace.d.ts +1 -1
  185. package/lib/component/reducer/preferences/utilities/mapNucleiFormatting.d.ts +1 -1
  186. package/lib/component/reducer/preferences/utilities/mapWorkspaces.d.ts +1 -1
  187. package/lib/component/toolbar/BasicToolBar.js +6 -11
  188. package/lib/component/toolbar/ToolTypes.d.ts +2 -2
  189. package/lib/component/toolbar/ToolTypes.js +1 -1
  190. package/lib/component/workspaces/assignment.d.ts +1 -1
  191. package/lib/component/workspaces/basic.d.ts +1 -1
  192. package/lib/component/workspaces/embedded.d.ts +1 -1
  193. package/lib/component/workspaces/exercise.d.ts +1 -1
  194. package/lib/component/workspaces/index.d.ts +6 -6
  195. package/lib/component/workspaces/prediction.d.ts +1 -1
  196. package/lib/component/workspaces/prediction.js +193 -0
  197. package/lib/component/workspaces/process1D.d.ts +1 -1
  198. package/lib/component/workspaces/workspaceDefaultProperties.d.ts +1 -1
  199. package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
  200. package/lib/data/PredictionManager.d.ts +3 -1
  201. package/lib/data/PredictionManager.js +43 -3
  202. package/lib/data/SpectraManager.d.ts +1 -2
  203. package/lib/data/constants/DefaultApodizationOptions.d.ts +2 -0
  204. package/lib/data/constants/DefaultApodizationOptions.js +5 -0
  205. package/lib/data/data1d/Spectrum1D/SumManager.d.ts +1 -1
  206. package/lib/data/data1d/Spectrum1D/convertDataToFloat64Array.d.ts +2 -2
  207. package/lib/data/data1d/Spectrum1D/generateJGraphData.d.ts +1 -1
  208. package/lib/data/data1d/Spectrum1D/generateSpectrumFromPublicationString.d.ts +1 -2
  209. package/lib/data/data1d/Spectrum1D/index.d.ts +1 -5
  210. package/lib/data/data1d/Spectrum1D/index.js +1 -5
  211. package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +3 -3
  212. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.d.ts +3 -2
  213. package/lib/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +1 -1
  214. package/lib/data/data1d/Spectrum1D/isRangeAssigned.d.ts +1 -1
  215. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.d.ts +2 -1
  216. package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -2
  217. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.d.ts +3 -2
  218. package/lib/data/data1d/Spectrum1D/peaks/initiatePeaks.js +1 -1
  219. package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.d.ts +2 -2
  220. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.d.ts +2 -1
  221. package/lib/data/data1d/Spectrum1D/peaks/optimizePeaks.js +1 -2
  222. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +7 -7
  223. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -24
  224. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.d.ts +2 -1
  225. package/lib/data/data1d/Spectrum1D/ranges/changeRange.d.ts +2 -1
  226. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
  227. package/lib/data/data1d/Spectrum1D/ranges/checkRangeKind.d.ts +1 -1
  228. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  229. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.js +1 -2
  230. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +13 -6
  231. package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.d.ts +1 -1
  232. package/lib/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +23 -18
  233. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +37 -2
  234. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.js +1 -1
  235. package/lib/data/data1d/database.js +2 -4
  236. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +3 -30
  237. package/lib/data/data1d/multipleSpectraAnalysis.js +4 -15
  238. package/lib/data/data2d/Spectrum2D/getMissingProjection.d.ts +3 -2
  239. package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
  240. package/lib/data/data2d/Spectrum2D/getSlice.d.ts +1 -1
  241. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
  242. package/lib/data/data2d/Spectrum2D/zones/detectZones.d.ts +1 -1
  243. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +1 -1
  244. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +3 -2
  245. package/lib/data/data2d/Spectrum2D/zones/isZoneExists.d.ts +2 -1
  246. package/lib/data/data2d/Spectrum2D/zones/mapZones.d.ts +3 -2
  247. package/lib/data/getDefaultMatrixFilters.d.ts +1 -1
  248. package/lib/data/types/data1d/ComplexData1D.d.ts +2 -2
  249. package/lib/data/types/data1d/RangeDetectionResult.d.ts +1 -1
  250. package/lib/data/utilities/FindUtilities.d.ts +2 -1
  251. package/lib/data/utilities/RangeUtilities.d.ts +1 -1
  252. package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
  253. package/lib/data/utilities/calculateSanPlot.d.ts +2 -2
  254. package/lib/types/NMRiumDataReturn.d.ts +1 -3
  255. package/lib/versionInfo.js +1 -1
  256. package/lib-cjs/component/1d/ApodizationLine.js +28 -5
  257. package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +3 -26
  258. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +5 -28
  259. package/lib-cjs/component/1d/FooterBanner.js +2 -2
  260. package/lib-cjs/component/1d/SpectraLegends.js +1 -2
  261. package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +2 -2
  262. package/lib-cjs/component/1d/tool/PeakPointer.js +3 -3
  263. package/lib-cjs/component/1d/tool/XLabelPointer.js +2 -2
  264. package/lib-cjs/component/1d-2d/tools/BrushX.js +1 -2
  265. package/lib-cjs/component/1d-2d/tools/BrushXY.js +1 -2
  266. package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +2 -3
  267. package/lib-cjs/component/2d/Chart2D.js +4 -4
  268. package/lib-cjs/component/2d/FooterBanner.js +2 -2
  269. package/lib-cjs/component/2d/tools/XYLabelPointer.js +2 -2
  270. package/lib-cjs/component/EventsTrackers/BrushTracker.js +36 -22
  271. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +90 -67
  272. package/lib-cjs/component/EventsTrackers/MouseTracker.js +4 -1
  273. package/lib-cjs/component/NMRium.js +12 -13
  274. package/lib-cjs/component/context/LoggerContext.js +5 -0
  275. package/lib-cjs/component/elements/Button.js +16 -25
  276. package/lib-cjs/component/elements/ColorInput.js +2 -2
  277. package/lib-cjs/component/elements/EditableColumn.js +5 -2
  278. package/lib-cjs/component/elements/Input.js +2 -4
  279. package/lib-cjs/component/elements/Label.js +2 -2
  280. package/lib-cjs/component/elements/MolecularFormulaInput.js +14 -16
  281. package/lib-cjs/component/elements/NextPrev.js +26 -8
  282. package/lib-cjs/component/elements/NumberInput.js +2 -2
  283. package/lib-cjs/component/elements/ReactTable/ReactTable.js +4 -4
  284. package/lib-cjs/component/elements/formik/FormikCheckBox.js +2 -2
  285. package/lib-cjs/component/elements/formik/FormikColumnFormatField.js +20 -16
  286. package/lib-cjs/component/elements/formik/FormikError.js +27 -0
  287. package/lib-cjs/component/elements/formik/FormikInput.js +10 -6
  288. package/lib-cjs/component/elements/formik/FormikSelect.js +1 -1
  289. package/lib-cjs/component/header/ApodizationOptionsPanel.js +6 -5
  290. package/lib-cjs/component/header/AutoPeakPickingOptionPanel.js +15 -6
  291. package/lib-cjs/component/header/BaseLineCorrectionPanel.js +6 -3
  292. package/lib-cjs/component/header/PhaseCorrectionPanel.js +6 -26
  293. package/lib-cjs/component/header/RangesPickingOptionPanel.js +15 -7
  294. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +2 -25
  295. package/lib-cjs/component/hooks/useCheckPointsNumberInWindowArea.js +24 -0
  296. package/lib-cjs/component/hooks/useExport.js +1 -1
  297. package/lib-cjs/component/hooks/usePanelPreferences.js +4 -0
  298. package/lib-cjs/component/hooks/useSaveSettings.js +16 -14
  299. package/lib-cjs/component/loader/DropZone.js +1 -2
  300. package/lib-cjs/component/modal/LoadJCAMPModal.js +81 -75
  301. package/lib-cjs/component/modal/ModalStyle.js +0 -10
  302. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +12 -6
  303. package/lib-cjs/component/modal/PredictSpectraModal.js +53 -126
  304. package/lib-cjs/component/modal/SaveAsModal.js +22 -14
  305. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +24 -37
  306. package/lib-cjs/component/modal/editRange/EditRangeModal.js +32 -12
  307. package/lib-cjs/component/modal/editRange/forms/components/DeltaInput.js +2 -0
  308. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +15 -5
  309. package/lib-cjs/component/modal/setting/GeneralSettings.js +2 -7
  310. package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +6 -14
  311. package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +2 -2
  312. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +19 -24
  313. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +76 -86
  314. package/lib-cjs/component/panels/MoleculesPanel/Utilities.js +3 -1
  315. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/base/AnalysisColumnHeader.js +6 -6
  316. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/AnalysisTablePreferences.js +2 -2
  317. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/preferences/index.js +2 -2
  318. package/lib-cjs/component/panels/Panels.js +2 -2
  319. package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +38 -52
  320. package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +5 -20
  321. package/lib-cjs/component/panels/RangesPanel/hooks/useEditRangeModal.js +9 -12
  322. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +5 -1
  323. package/lib-cjs/component/panels/SpectrumsPanel/base/SpectraColumnsManager.js +10 -4
  324. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/AdditionalColumnField.js +1 -1
  325. package/lib-cjs/component/panels/SummaryPanel/CorrelationTable/CorrelationTableRow.js +1 -1
  326. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +5 -24
  327. package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +25 -2
  328. package/lib-cjs/component/panels/header/DefaultPanelHeader.js +18 -26
  329. package/lib-cjs/component/panels/header/PanelHeader.js +15 -0
  330. package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +122 -0
  331. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +109 -37
  332. package/lib-cjs/component/panels/predictionPanel/PredictionPreferences.js +29 -0
  333. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +72 -0
  334. package/lib-cjs/component/reducer/Reducer.js +2 -31
  335. package/lib-cjs/component/reducer/actions/DatabaseActions.js +6 -4
  336. package/lib-cjs/component/reducer/actions/DomainActions.js +3 -0
  337. package/lib-cjs/component/reducer/actions/FiltersActions.js +66 -94
  338. package/lib-cjs/component/reducer/actions/HistoryActions.js +45 -0
  339. package/lib-cjs/component/reducer/actions/IntegralsActions.js +3 -1
  340. package/lib-cjs/component/reducer/actions/MoleculeActions.js +58 -32
  341. package/lib-cjs/component/reducer/actions/PeaksActions.js +3 -3
  342. package/lib-cjs/component/reducer/actions/RangesActions.js +7 -52
  343. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +10 -33
  344. package/lib-cjs/component/reducer/actions/ToolsActions.js +26 -32
  345. package/lib-cjs/component/reducer/actions/ZonesActions.js +6 -32
  346. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +37 -0
  347. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +2 -2
  348. package/lib-cjs/component/toolbar/BasicToolBar.js +5 -10
  349. package/lib-cjs/component/toolbar/ToolTypes.js +9 -32
  350. package/lib-cjs/component/workspaces/prediction.js +193 -0
  351. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +21 -44
  352. package/lib-cjs/data/PredictionManager.js +43 -3
  353. package/lib-cjs/data/constants/DefaultApodizationOptions.js +8 -0
  354. package/lib-cjs/data/data1d/Spectrum1D/index.js +7 -11
  355. package/lib-cjs/data/data1d/Spectrum1D/initiateDatum1D.js +9 -32
  356. package/lib-cjs/data/data1d/Spectrum1D/integrals/initiateIntegrals.js +2 -2
  357. package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -2
  358. package/lib-cjs/data/data1d/Spectrum1D/peaks/initiatePeaks.js +2 -2
  359. package/lib-cjs/data/data1d/Spectrum1D/peaks/optimizePeaks.js +1 -2
  360. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +7 -26
  361. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRange.js +2 -2
  362. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +2 -2
  363. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRanges.js +3 -4
  364. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +13 -6
  365. package/lib-cjs/data/data1d/Spectrum1D/ranges/generateSpectrumFromRanges.js +23 -18
  366. package/lib-cjs/data/data1d/Spectrum1D/ranges/initiateRanges.js +2 -2
  367. package/lib-cjs/data/data1d/database.js +2 -4
  368. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +5 -16
  369. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +3 -26
  370. package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +2 -25
  371. package/lib-cjs/versionInfo.js +1 -1
  372. package/package.json +29 -29
  373. package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +0 -7
  374. package/lib/component/panels/predictionPanel/PredictionOptions.js +0 -74
  375. package/lib/component/workspaces/Workspace.d.ts +0 -188
  376. package/lib/component/workspaces/Workspace.js +0 -1
  377. package/lib/data/Filters.d.ts +0 -12
  378. package/lib/data/Filters.js +0 -12
  379. package/lib/data/FiltersManager.d.ts +0 -30
  380. package/lib/data/FiltersManager.js +0 -175
  381. package/lib/data/data1d/Spectrum1D/getShiftX.d.ts +0 -2
  382. package/lib/data/data1d/Spectrum1D/getShiftX.js +0 -6
  383. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.d.ts +0 -2
  384. package/lib/data/data1d/Spectrum1D/getSpectrumErrorValue.js +0 -4
  385. package/lib/data/data1d/Spectrum1D/integrals/checkIntegralKind.d.ts +0 -7
  386. package/lib/data/data1d/Spectrum1D/integrals/checkIntegralKind.js +0 -9
  387. package/lib/data/data1d/Spectrum1D/integrals/mapIntegrals.d.ts +0 -12
  388. package/lib/data/data1d/Spectrum1D/integrals/mapIntegrals.js +0 -36
  389. package/lib/data/data1d/Spectrum1D/integrals/updateIntegrals.d.ts +0 -2
  390. package/lib/data/data1d/Spectrum1D/integrals/updateIntegrals.js +0 -6
  391. package/lib/data/data1d/Spectrum1D/integrals/updateIntegralsRelativeValues.d.ts +0 -2
  392. package/lib/data/data1d/Spectrum1D/integrals/updateIntegralsRelativeValues.js +0 -5
  393. package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.d.ts +0 -2
  394. package/lib/data/data1d/Spectrum1D/integrals/updateRelatives.js +0 -26
  395. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.d.ts +0 -3
  396. package/lib/data/data1d/Spectrum1D/peaks/mapPeaks.js +0 -45
  397. package/lib/data/data1d/Spectrum1D/peaks/updatePeaks.d.ts +0 -2
  398. package/lib/data/data1d/Spectrum1D/peaks/updatePeaks.js +0 -7
  399. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.d.ts +0 -4
  400. package/lib/data/data1d/Spectrum1D/ranges/mapRanges.js +0 -78
  401. package/lib/data/data1d/Spectrum1D/ranges/updateRanges.d.ts +0 -2
  402. package/lib/data/data1d/Spectrum1D/ranges/updateRanges.js +0 -9
  403. package/lib/data/data1d/Spectrum1D/ranges/updateRangesRelativeValues.d.ts +0 -2
  404. package/lib/data/data1d/Spectrum1D/ranges/updateRangesRelativeValues.js +0 -5
  405. package/lib/data/data1d/filter1d/apodization.d.ts +0 -27
  406. package/lib/data/data1d/filter1d/apodization.js +0 -81
  407. package/lib/data/data1d/filter1d/baselineCorrection.d.ts +0 -33
  408. package/lib/data/data1d/filter1d/baselineCorrection.js +0 -51
  409. package/lib/data/data1d/filter1d/digitalFilter.d.ts +0 -20
  410. package/lib/data/data1d/filter1d/digitalFilter.js +0 -44
  411. package/lib/data/data1d/filter1d/equallySpaced.d.ts +0 -33
  412. package/lib/data/data1d/filter1d/equallySpaced.js +0 -52
  413. package/lib/data/data1d/filter1d/exclusionZones.d.ts +0 -15
  414. package/lib/data/data1d/filter1d/exclusionZones.js +0 -32
  415. package/lib/data/data1d/filter1d/fft.d.ts +0 -18
  416. package/lib/data/data1d/filter1d/fft.js +0 -90
  417. package/lib/data/data1d/filter1d/phaseCorrection.d.ts +0 -26
  418. package/lib/data/data1d/filter1d/phaseCorrection.js +0 -64
  419. package/lib/data/data1d/filter1d/shiftX.d.ts +0 -20
  420. package/lib/data/data1d/filter1d/shiftX.js +0 -26
  421. package/lib/data/data1d/filter1d/signalProcessing.d.ts +0 -26
  422. package/lib/data/data1d/filter1d/signalProcessing.js +0 -65
  423. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +0 -2
  424. package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +0 -35
  425. package/lib/data/data1d/filter1d/zeroFilling.d.ts +0 -22
  426. package/lib/data/data1d/filter1d/zeroFilling.js +0 -60
  427. package/lib/data/data2d/filter2d/shiftX.d.ts +0 -18
  428. package/lib/data/data2d/filter2d/shiftX.js +0 -27
  429. package/lib/data/data2d/filter2d/shiftY.d.ts +0 -18
  430. package/lib/data/data2d/filter2d/shiftY.js +0 -27
  431. package/lib/data/types/view-state/PeaksViewState.d.ts +0 -17
  432. package/lib/data/types/view-state/PeaksViewState.js +0 -1
  433. package/lib/types/NMRiumGeneralPreferences.d.ts +0 -7
  434. package/lib/types/NMRiumGeneralPreferences.js +0 -1
  435. package/lib/types/NMRiumPanelPreferences.d.ts +0 -17
  436. package/lib/types/NMRiumPanelPreferences.js +0 -1
  437. package/lib/types/NMRiumToolBarPreferences.d.ts +0 -22
  438. package/lib/types/NMRiumToolBarPreferences.js +0 -1
  439. package/lib/types/PanelPreferencesType.d.ts +0 -4
  440. package/lib/types/PanelPreferencesType.js +0 -1
  441. package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +0 -102
  442. package/lib-cjs/component/workspaces/Workspace.js +0 -2
  443. package/lib-cjs/data/Filters.js +0 -38
  444. package/lib-cjs/data/FiltersManager.js +0 -206
  445. package/lib-cjs/data/data1d/Spectrum1D/getShiftX.js +0 -33
  446. package/lib-cjs/data/data1d/Spectrum1D/getSpectrumErrorValue.js +0 -8
  447. package/lib-cjs/data/data1d/Spectrum1D/integrals/checkIntegralKind.js +0 -13
  448. package/lib-cjs/data/data1d/Spectrum1D/integrals/mapIntegrals.js +0 -40
  449. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateIntegrals.js +0 -10
  450. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateIntegralsRelativeValues.js +0 -9
  451. package/lib-cjs/data/data1d/Spectrum1D/integrals/updateRelatives.js +0 -30
  452. package/lib-cjs/data/data1d/Spectrum1D/peaks/mapPeaks.js +0 -49
  453. package/lib-cjs/data/data1d/Spectrum1D/peaks/updatePeaks.js +0 -11
  454. package/lib-cjs/data/data1d/Spectrum1D/ranges/mapRanges.js +0 -82
  455. package/lib-cjs/data/data1d/Spectrum1D/ranges/updateRanges.js +0 -13
  456. package/lib-cjs/data/data1d/Spectrum1D/ranges/updateRangesRelativeValues.js +0 -9
  457. package/lib-cjs/data/data1d/filter1d/apodization.js +0 -88
  458. package/lib-cjs/data/data1d/filter1d/baselineCorrection.js +0 -60
  459. package/lib-cjs/data/data1d/filter1d/digitalFilter.js +0 -50
  460. package/lib-cjs/data/data1d/filter1d/equallySpaced.js +0 -61
  461. package/lib-cjs/data/data1d/filter1d/exclusionZones.js +0 -38
  462. package/lib-cjs/data/data1d/filter1d/fft.js +0 -96
  463. package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +0 -70
  464. package/lib-cjs/data/data1d/filter1d/shiftX.js +0 -32
  465. package/lib-cjs/data/data1d/filter1d/signalProcessing.js +0 -95
  466. package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +0 -39
  467. package/lib-cjs/data/data1d/filter1d/zeroFilling.js +0 -66
  468. package/lib-cjs/data/data2d/filter2d/shiftX.js +0 -33
  469. package/lib-cjs/data/data2d/filter2d/shiftY.js +0 -33
  470. package/lib-cjs/data/types/view-state/PeaksViewState.js +0 -2
  471. package/lib-cjs/types/NMRiumGeneralPreferences.js +0 -2
  472. package/lib-cjs/types/NMRiumPanelPreferences.js +0 -2
  473. package/lib-cjs/types/NMRiumToolBarPreferences.js +0 -2
  474. package/lib-cjs/types/PanelPreferencesType.js +0 -2
@@ -1,78 +0,0 @@
1
- import { v4 } from '@lukeed/uuid';
2
- import { xyIntegration } from 'ml-spectra-processing';
3
- import { DatumKind } from '../../../constants/SignalsKinds';
4
- import { getShiftX } from '../getShiftX';
5
- import { getSpectrumErrorValue } from '../getSpectrumErrorValue';
6
- function checkRange(range, spectrum, error) {
7
- // check if the range is already exists
8
- for (const { from, to } of spectrum.ranges?.values || []) {
9
- if (Math.abs(range.from - from) < error &&
10
- Math.abs(range.to - to) < error) {
11
- return true;
12
- }
13
- }
14
- }
15
- function getRange(range, shiftTarget, shift) {
16
- const { originFrom, originTo, from, to } = range;
17
- if (shiftTarget === 'origin') {
18
- return {
19
- originFrom: from - shift,
20
- originTo: to - shift,
21
- from,
22
- to,
23
- };
24
- }
25
- else {
26
- return {
27
- originFrom,
28
- originTo,
29
- from: (originFrom || 0) + shift,
30
- to: (originTo || 0) + shift,
31
- };
32
- }
33
- }
34
- function getSignalDelta(signal, shiftTarget, shift) {
35
- const { delta, originDelta } = signal;
36
- if (shiftTarget === 'origin') {
37
- return {
38
- originDelta: delta - shift,
39
- delta,
40
- };
41
- }
42
- else {
43
- return {
44
- originDelta,
45
- delta: (originDelta || 0) + shift,
46
- };
47
- }
48
- }
49
- export function mapRanges(ranges, spectrum, options = {}) {
50
- const { checkIsExisting = true, shiftTarget = 'origin' } = options;
51
- const { x, re } = spectrum.data;
52
- const shiftX = getShiftX(spectrum);
53
- const error = getSpectrumErrorValue(spectrum);
54
- if (checkIsExisting) {
55
- ranges = ranges.filter((r) => (checkIsExisting && !checkRange(r, spectrum, error)) || r.id === 'new');
56
- }
57
- return ranges.map((range) => {
58
- const rangeBoundary = getRange(range, shiftTarget, shiftX);
59
- const absolute = xyIntegration({ x, y: re }, { from: rangeBoundary.from, to: rangeBoundary.to, reverse: true });
60
- const signals = range.signals.map((signal) => {
61
- const { kind = null, id, ...resSignal } = signal;
62
- return {
63
- kind: kind || 'signal',
64
- id: id || v4(),
65
- ...resSignal,
66
- ...getSignalDelta(signal, shiftTarget, shiftX),
67
- };
68
- });
69
- return {
70
- ...range,
71
- id: range.id || v4(),
72
- kind: signals?.[0].kind || DatumKind.signal,
73
- ...rangeBoundary,
74
- absolute,
75
- signals,
76
- };
77
- });
78
- }
@@ -1,2 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- export declare function updateRanges(spectrum: Spectrum1D): void;
@@ -1,9 +0,0 @@
1
- import { mapRanges } from './mapRanges';
2
- import { updateRangesRelativeValues } from './updateRangesRelativeValues';
3
- export function updateRanges(spectrum) {
4
- spectrum.ranges.values = mapRanges(spectrum.ranges.values, spectrum, {
5
- checkIsExisting: false,
6
- shiftTarget: 'current',
7
- });
8
- updateRangesRelativeValues(spectrum, true);
9
- }
@@ -1,2 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- export declare function updateRangesRelativeValues(spectrum: Spectrum1D, forceCalculateIntegral?: boolean): void;
@@ -1,5 +0,0 @@
1
- import { updateRelatives } from '../integrals/updateRelatives';
2
- import { checkRangeKind } from './checkRangeKind';
3
- export function updateRangesRelativeValues(spectrum, forceCalculateIntegral = false) {
4
- updateRelatives(spectrum.ranges, 'integration', checkRangeKind, forceCalculateIntegral);
5
- }
@@ -1,27 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- import { FilterDomainUpdateRules } from '../../FiltersManager';
3
- export declare const id: "apodization";
4
- export declare const name = "Apodization";
5
- export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
6
- /**
7
- *
8
- * @param {Spectrum1D} datum1d
9
- * @param {Object} [value]
10
- */
11
- export interface ApodizationOptions {
12
- lineBroadening?: number;
13
- gaussBroadening?: number;
14
- lineBroadeningCenter?: number;
15
- }
16
- export declare const defaultApodizationOptions: ApodizationOptions;
17
- export declare function apply(datum1D: Spectrum1D, options?: ApodizationOptions): void;
18
- export declare function isApplicable(datum1D: Spectrum1D): boolean;
19
- export declare function reduce(previousValue: any, newValue: any): {
20
- once: boolean;
21
- reduce: any;
22
- };
23
- export declare function apodizationFilter(datum1D: Spectrum1D, options?: ApodizationOptions): {
24
- re: import("cheminfo-types").DoubleArray;
25
- im: import("cheminfo-types").DoubleArray;
26
- windowData: Float64Array;
27
- };
@@ -1,81 +0,0 @@
1
- import { apodization } from 'nmr-processing';
2
- export const id = 'apodization';
3
- export const name = 'Apodization';
4
- export const DOMAIN_UPDATE_RULES = {
5
- updateXDomain: true,
6
- updateYDomain: false,
7
- };
8
- export const defaultApodizationOptions = {
9
- lineBroadening: 1,
10
- gaussBroadening: 0,
11
- lineBroadeningCenter: 0,
12
- };
13
- export function apply(datum1D, options = {}) {
14
- const { lineBroadening = 1, gaussBroadening = 0, lineBroadeningCenter = 0, } = options;
15
- // if no options is set, we add the default value to filter
16
- if (Object.keys(options).length === 0) {
17
- const filter = datum1D.filters.find((filter) => filter.name === id);
18
- if (filter) {
19
- filter.value = { lineBroadening, gaussBroadening, lineBroadeningCenter };
20
- }
21
- }
22
- const newData = apodizationFilter(datum1D, {
23
- lineBroadening,
24
- gaussBroadening,
25
- lineBroadeningCenter,
26
- });
27
- datum1D.data = {
28
- ...datum1D.data,
29
- re: newData.re,
30
- im: newData.im,
31
- };
32
- }
33
- export function isApplicable(datum1D) {
34
- if (datum1D.info.isComplex && datum1D.info.isFid)
35
- return true;
36
- return false;
37
- }
38
- export function reduce(previousValue, newValue) {
39
- return {
40
- once: true,
41
- reduce: newValue,
42
- };
43
- }
44
- export function apodizationFilter(datum1D, options = {}) {
45
- const { lineBroadening = 1, gaussBroadening = 0, lineBroadeningCenter = 0, } = options;
46
- let grpdly = datum1D.info?.digitalFilter || 0;
47
- let pointsToShift;
48
- if (grpdly > 0) {
49
- pointsToShift = Math.floor(grpdly);
50
- }
51
- else {
52
- pointsToShift = 0;
53
- }
54
- const data = datum1D.data;
55
- const re = data.re;
56
- const im = data.im;
57
- const t = data.x;
58
- const length = re.length;
59
- const dw = (t[length - 1] - t[0]) / (length - 1); //REPLACE CONSTANT with calculated value... : for this we need AQ or DW to set it right...
60
- return apodization({ re, im }, {
61
- pointsToShift,
62
- compose: {
63
- length,
64
- shapes: [
65
- {
66
- start: 0,
67
- shape: {
68
- kind: 'lorentzToGauss',
69
- options: {
70
- length,
71
- dw,
72
- exponentialHz: gaussBroadening > 0 ? lineBroadening : -lineBroadening,
73
- gaussianHz: gaussBroadening,
74
- center: lineBroadeningCenter,
75
- },
76
- },
77
- },
78
- ],
79
- },
80
- });
81
- }
@@ -1,33 +0,0 @@
1
- import { Spectrum1D } from 'nmr-load-save';
2
- import { FilterDomainUpdateRules } from '../../FiltersManager';
3
- export declare const id = "baselineCorrection";
4
- export declare const name = "Baseline correction";
5
- export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
6
- /**
7
- *
8
- * @param {Spectrum1D} spectrum
9
- */
10
- export type BaselineAlgorithms = 'airpls' | 'polynomial';
11
- export interface BaselineCorrectionZone {
12
- from: number;
13
- to: number;
14
- id: string;
15
- }
16
- export interface PolynomialOptions {
17
- zones: BaselineCorrectionZone[];
18
- algorithm: 'polynomial';
19
- degree: number;
20
- }
21
- export interface AirplsOptions {
22
- zones: BaselineCorrectionZone[];
23
- algorithm: 'airpls';
24
- maxIterations: number;
25
- tolerance: number;
26
- }
27
- export type BaselineCorrectionOptions = PolynomialOptions | AirplsOptions;
28
- export declare function apply(datum1D: Spectrum1D, options: BaselineCorrectionOptions): void;
29
- export declare function isApplicable(datum1D: Spectrum1D): boolean;
30
- export declare function reduce(previousValue: any, newValue: any): {
31
- once: boolean;
32
- reduce: any;
33
- };
@@ -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 {};