nmrium 0.40.1 → 0.42.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 (293) hide show
  1. package/lib/component/1d/FooterBanner.js +5 -4
  2. package/lib/component/1d/Viewer1D.js +121 -104
  3. package/lib/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  4. package/lib/component/1d/jCouplingGraph/JGraphContext.d.ts +1 -1
  5. package/lib/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  6. package/lib/component/1d/multiplicityTree/TreeColors.d.ts +1 -1
  7. package/lib/component/1d/multiplicityTree/TreeColors.js +1 -6
  8. package/lib/component/1d/multiplicityTree/TreeNodes.d.ts +1 -1
  9. package/lib/component/1d/tool/BaseLineZones.d.ts +1 -1
  10. package/lib/component/1d/tool/BaseLineZones.js +7 -4
  11. package/lib/component/1d/tool/PeakPointer.js +1 -1
  12. package/lib/component/1d/utilities/scale.js +1 -3
  13. package/lib/component/1d-2d/components/FloatMoleculeStructures/index.d.ts +1 -1
  14. package/lib/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
  15. package/lib/component/1d-2d/tools/BrushXY.js +10 -7
  16. package/lib/component/1d-2d/tools/CrossLinePointer.js +1 -1
  17. package/lib/component/2d/FooterBanner.js +3 -2
  18. package/lib/component/2d/Viewer2D.js +51 -29
  19. package/lib/component/2d/XAxis.js +1 -1
  20. package/lib/component/2d/YAxis.js +1 -1
  21. package/lib/component/2d/utilities/SliceScale.d.ts +2 -2
  22. package/lib/component/2d/utilities/scale.d.ts +5 -5
  23. package/lib/component/2d/zones/Signal.js +1 -2
  24. package/lib/component/EventsTrackers/BrushTracker.d.ts +4 -1
  25. package/lib/component/EventsTrackers/BrushTracker.js +21 -6
  26. package/lib/component/NMRium.d.ts +2 -2
  27. package/lib/component/NMRium.js +39 -26
  28. package/lib/component/assignment/AssignmentsReducer.d.ts +1 -1
  29. package/lib/component/assignment/actions/setActiveAssignment.js +1 -1
  30. package/lib/component/elements/Input.js +1 -0
  31. package/lib/component/elements/InputRange.js +1 -1
  32. package/lib/component/elements/MenuButton.d.ts +1 -1
  33. package/lib/component/elements/MoleculeSelection.d.ts +1 -1
  34. package/lib/component/elements/ReactTable/ReactTable.d.ts +1 -1
  35. package/lib/component/elements/Scroller.d.ts +15 -0
  36. package/lib/component/elements/Scroller.js +31 -0
  37. package/lib/component/elements/Tab/DeleteButton.d.ts +1 -1
  38. package/lib/component/elements/ToolbarMenu.d.ts +1 -1
  39. package/lib/component/elements/accordion/Accordion.d.ts +1 -1
  40. package/lib/component/elements/draggable/SVGDraggable.d.ts +1 -1
  41. package/lib/component/elements/draggable/useDraggable.d.ts +1 -1
  42. package/lib/component/elements/dropDownButton/DropDownButton.d.ts +1 -1
  43. package/lib/component/elements/dropDownButton/DropDownList.js +3 -1
  44. package/lib/component/elements/formik/SelectBox.d.ts +1 -1
  45. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +3 -2
  46. package/lib/component/elements/popup/Alert/AlertBlock.js +21 -15
  47. package/lib/component/elements/popup/Alert/Context.d.ts +26 -2
  48. package/lib/component/elements/popup/Alert/Context.js +6 -2
  49. package/lib/component/elements/popup/Alert/Provider.d.ts +4 -3
  50. package/lib/component/elements/popup/Alert/Provider.js +3 -3
  51. package/lib/component/elements/popup/Modal/ConfirmDialog.d.ts +1 -1
  52. package/lib/component/elements/popup/Modal/Provider.js +3 -1
  53. package/lib/component/elements/popup/options.d.ts +22 -19
  54. package/lib/component/elements/resizer/Resizer.d.ts +2 -2
  55. package/lib/component/elements/toggle/ToggleButton.d.ts +2 -2
  56. package/lib/component/elements/toggle/ToggleButton.js +1 -1
  57. package/lib/component/header/ZeroFillingOptionsPanel.js +3 -8
  58. package/lib/component/highlight/index.d.ts +1 -1
  59. package/lib/component/hooks/useCheckToolsVisibility.js +2 -2
  60. package/lib/component/hooks/useExport.js +2 -1
  61. package/lib/component/hooks/useFormatNumberByNucleus.d.ts +1 -1
  62. package/lib/component/hooks/usePanelPreferences.js +2 -2
  63. package/lib/component/hooks/useSaveSettings.js +9 -11
  64. package/lib/component/hooks/useXScale.d.ts +1 -1
  65. package/lib/component/hooks/useXYReduce.d.ts +2 -2
  66. package/lib/component/modal/AboutPredictionModal.js +1 -1
  67. package/lib/component/modal/AboutSpectrumSimulationModal.d.ts +2 -0
  68. package/lib/component/modal/AboutSpectrumSimulationModal.js +49 -0
  69. package/lib/component/modal/AlignSpectraModal.js +11 -1
  70. package/lib/component/modal/MultipletAnalysisModal.js +2 -1
  71. package/lib/component/modal/PredictSpectraModal.d.ts +1 -2
  72. package/lib/component/modal/PredictSpectraModal.js +25 -28
  73. package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
  74. package/lib/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  75. package/lib/component/modal/editZone/SignalsForm.js +1 -1
  76. package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
  77. package/lib/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  78. package/lib/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  79. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
  80. package/lib/component/modal/setting/settingsValidation.js +2 -2
  81. package/lib/component/panels/IntegralsPanel/IntegralPanel.d.ts +1 -1
  82. package/lib/component/panels/IntegralsPanel/IntegralTable.d.ts +1 -1
  83. package/lib/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  84. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
  85. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  86. package/lib/component/panels/MoleculesPanel/Utilities.d.ts +1 -1
  87. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  88. package/lib/component/panels/Panels.js +13 -0
  89. package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
  90. package/lib/component/panels/SpectrumsPanel/SpectraPreferences.js +4 -3
  91. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
  92. package/lib/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  93. package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  94. package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -1
  95. package/lib/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  96. package/lib/component/panels/ZonesPanel/ZonesTable.d.ts +1 -1
  97. package/lib/component/panels/databasePanel/DatabasePanel.d.ts +1 -1
  98. package/lib/component/panels/databasePanel/DatabasePanel.js +34 -27
  99. package/lib/component/panels/databasePanel/DatabaseTable.js +1 -1
  100. package/lib/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  101. package/lib/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  102. package/lib/component/panels/filtersPanel/FiltersTable.js +2 -2
  103. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  104. package/lib/component/panels/predictionPanel/PredictionPanel.js +3 -2
  105. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -2
  106. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.d.ts +1 -0
  107. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +88 -0
  108. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.d.ts +11 -0
  109. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +37 -0
  110. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.d.ts +4 -0
  111. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +25 -0
  112. package/lib/component/panels/spectrumSimulation/SpinSystemTable.d.ts +5 -0
  113. package/lib/component/panels/spectrumSimulation/SpinSystemTable.js +60 -0
  114. package/lib/component/reducer/Reducer.d.ts +13 -12
  115. package/lib/component/reducer/Reducer.js +253 -239
  116. package/lib/component/reducer/actions/AssignmentsActions.d.ts +1 -1
  117. package/lib/component/reducer/actions/AssignmentsActions.js +1 -1
  118. package/lib/component/reducer/actions/DatabaseActions.js +2 -1
  119. package/lib/component/reducer/actions/DomainActions.d.ts +7 -2
  120. package/lib/component/reducer/actions/DomainActions.js +30 -1
  121. package/lib/component/reducer/actions/FiltersActions.js +4 -4
  122. package/lib/component/reducer/actions/LoadActions.js +1 -1
  123. package/lib/component/reducer/actions/MoleculeActions.d.ts +8 -2
  124. package/lib/component/reducer/actions/MoleculeActions.js +58 -3
  125. package/lib/component/reducer/actions/SpectrumsActions.d.ts +8 -2
  126. package/lib/component/reducer/actions/SpectrumsActions.js +43 -4
  127. package/lib/component/reducer/actions/ToolsActions.js +2 -2
  128. package/lib/component/reducer/actions/ZonesActions.js +1 -1
  129. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +4 -6
  130. package/lib/component/reducer/preferences/actions/addWorkspace.js +19 -15
  131. package/lib/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  132. package/lib/component/reducer/preferences/actions/setPreferences.js +3 -4
  133. package/lib/component/reducer/preferences/preferencesReducer.d.ts +1 -1
  134. package/lib/component/reducer/preferences/preferencesReducer.js +5 -1
  135. package/lib/component/reducer/preferences/utilities/flatObject.js +1 -1
  136. package/lib/component/toolbar/ToolTypes.d.ts +4 -4
  137. package/lib/component/utility/PathBuilder.js +11 -0
  138. package/lib/component/utility/export.js +9 -9
  139. package/lib/component/utility/getSpectraObjectPaths.js +1 -1
  140. package/lib/component/utility/getUniqueNuclei.js +1 -1
  141. package/lib/component/utility/jpathToArray.js +1 -1
  142. package/lib/component/workspaces/index.d.ts +1 -0
  143. package/lib/component/workspaces/index.js +2 -0
  144. package/lib/component/workspaces/simulation.d.ts +2 -0
  145. package/lib/component/workspaces/simulation.js +68 -0
  146. package/lib/component/workspaces/workspaceDefaultProperties.js +9 -5
  147. package/lib/data/PredictionManager.d.ts +8 -7
  148. package/lib/data/PredictionManager.js +95 -22
  149. package/lib/data/SpectraManager.js +1 -1
  150. package/lib/data/constants/DefaultPathLengths.d.ts +1 -3
  151. package/lib/data/constants/SignalsKinds.d.ts +2 -2
  152. package/lib/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  153. package/lib/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  154. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.d.ts +1 -1
  155. package/lib/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  156. package/lib/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  157. package/lib/data/data1d/database.d.ts +9 -7
  158. package/lib/data/data1d/database.js +13 -6
  159. package/lib/data/data1d/multipleSpectraAnalysis.d.ts +1 -1
  160. package/lib/data/data1d/multipleSpectraAnalysis.js +1 -1
  161. package/lib/data/data1d/spectrumSimulation.d.ts +14 -0
  162. package/lib/data/data1d/spectrumSimulation.js +53 -0
  163. package/lib/data/data2d/Spectrum2D/contours.d.ts +8 -4
  164. package/lib/data/data2d/Spectrum2D/contours.js +7 -1
  165. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  166. package/lib/data/data2d/Spectrum2D/getShift.js +1 -1
  167. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  168. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  169. package/lib/data/getDefaultMatrixFilters.d.ts +2 -2
  170. package/lib/data/matrixGeneration.js +1 -1
  171. package/lib/data/molecules/MoleculeManager.d.ts +2 -1
  172. package/lib/data/molecules/MoleculeManager.js +21 -7
  173. package/lib/data/parseMeta/linkMetaWithSpectra.js +2 -1
  174. package/lib/data/types/data1d/MatrixOptions.d.ts +2 -2
  175. package/lib/data/utilities/FindUtilities.js +4 -4
  176. package/lib/data/utilities/RangeUtilities.d.ts +1 -1
  177. package/lib/data/utilities/ZoneUtilities.d.ts +1 -1
  178. package/lib/data/utilities/calculateSanPlot.js +3 -3
  179. package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
  180. package/lib/utils/clipboard/clipboard.d.ts +1 -1
  181. package/lib/versionInfo.js +1 -1
  182. package/lib-cjs/component/1d/FooterBanner.js +5 -4
  183. package/lib-cjs/component/1d/Viewer1D.js +120 -103
  184. package/lib-cjs/component/1d/database/ResurrectedDatabaseRanges.js +1 -1
  185. package/lib-cjs/component/1d/jCouplingGraph/JsCouplingLinks.js +1 -1
  186. package/lib-cjs/component/1d/multiplicityTree/TreeColors.js +1 -6
  187. package/lib-cjs/component/1d/tool/BaseLineZones.js +6 -3
  188. package/lib-cjs/component/1d/tool/PeakPointer.js +1 -1
  189. package/lib-cjs/component/1d/utilities/scale.js +1 -3
  190. package/lib-cjs/component/1d-2d/components/SpectrumInfoBlock.js +4 -1
  191. package/lib-cjs/component/1d-2d/tools/BrushXY.js +10 -7
  192. package/lib-cjs/component/1d-2d/tools/CrossLinePointer.js +1 -1
  193. package/lib-cjs/component/2d/FooterBanner.js +3 -2
  194. package/lib-cjs/component/2d/Viewer2D.js +50 -28
  195. package/lib-cjs/component/2d/XAxis.js +1 -1
  196. package/lib-cjs/component/2d/YAxis.js +1 -1
  197. package/lib-cjs/component/2d/zones/Signal.js +1 -2
  198. package/lib-cjs/component/EventsTrackers/BrushTracker.js +21 -6
  199. package/lib-cjs/component/NMRium.js +37 -24
  200. package/lib-cjs/component/assignment/actions/setActiveAssignment.js +1 -1
  201. package/lib-cjs/component/elements/Input.js +1 -0
  202. package/lib-cjs/component/elements/InputRange.js +1 -1
  203. package/lib-cjs/component/elements/Scroller.js +35 -0
  204. package/lib-cjs/component/elements/dropDownButton/DropDownList.js +3 -1
  205. package/lib-cjs/component/elements/popup/Alert/AlertBlock.js +21 -15
  206. package/lib-cjs/component/elements/popup/Alert/Context.js +6 -2
  207. package/lib-cjs/component/elements/popup/Alert/Provider.js +2 -2
  208. package/lib-cjs/component/elements/popup/Modal/Provider.js +3 -1
  209. package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -8
  210. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +2 -2
  211. package/lib-cjs/component/hooks/useExport.js +2 -1
  212. package/lib-cjs/component/hooks/usePanelPreferences.js +1 -1
  213. package/lib-cjs/component/hooks/useSaveSettings.js +9 -11
  214. package/lib-cjs/component/modal/AboutPredictionModal.js +1 -1
  215. package/lib-cjs/component/modal/AboutSpectrumSimulationModal.js +54 -0
  216. package/lib-cjs/component/modal/AlignSpectraModal.js +11 -1
  217. package/lib-cjs/component/modal/MultipletAnalysisModal.js +2 -1
  218. package/lib-cjs/component/modal/PredictSpectraModal.js +24 -27
  219. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +1 -1
  220. package/lib-cjs/component/modal/editRange/forms/components/SignalsForm.js +1 -1
  221. package/lib-cjs/component/modal/editZone/SignalsForm.js +1 -1
  222. package/lib-cjs/component/modal/metaImportation/MetaImportationModal.js +1 -1
  223. package/lib-cjs/component/modal/setting/settings-tabs/DisplayTabContent.js +4 -0
  224. package/lib-cjs/component/modal/setting/settings-tabs/FormattingTabContent.js +1 -1
  225. package/lib-cjs/component/modal/setting/settings-tabs/InfoBlockTabContent.js +9 -2
  226. package/lib-cjs/component/modal/setting/settingsValidation.js +2 -2
  227. package/lib-cjs/component/panels/IntegralsPanel/IntegralTable.js +4 -7
  228. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +6 -6
  229. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -5
  230. package/lib-cjs/component/panels/Panels.js +13 -0
  231. package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
  232. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPreferences.js +3 -2
  233. package/lib-cjs/component/panels/SpectrumsPanel/SpectraTable.js +1 -1
  234. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/SpectrumSetting.js +3 -1
  235. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -2
  236. package/lib-cjs/component/panels/SummaryPanel/utilities/Utilities.js +1 -1
  237. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +34 -27
  238. package/lib-cjs/component/panels/databasePanel/DatabaseTable.js +1 -1
  239. package/lib-cjs/component/panels/extra/utilities/MultiplicityUtilities.js +2 -2
  240. package/lib-cjs/component/panels/extra/utilities/UseToggleStatus.js +1 -1
  241. package/lib-cjs/component/panels/filtersPanel/FiltersTable.js +2 -2
  242. package/lib-cjs/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -1
  243. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +3 -2
  244. package/lib-cjs/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -1
  245. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulation.js +94 -0
  246. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +42 -0
  247. package/lib-cjs/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +31 -0
  248. package/lib-cjs/component/panels/spectrumSimulation/SpinSystemTable.js +67 -0
  249. package/lib-cjs/component/reducer/Reducer.js +253 -239
  250. package/lib-cjs/component/reducer/actions/AssignmentsActions.js +1 -1
  251. package/lib-cjs/component/reducer/actions/DatabaseActions.js +2 -1
  252. package/lib-cjs/component/reducer/actions/DomainActions.js +31 -1
  253. package/lib-cjs/component/reducer/actions/FiltersActions.js +4 -4
  254. package/lib-cjs/component/reducer/actions/LoadActions.js +1 -1
  255. package/lib-cjs/component/reducer/actions/MoleculeActions.js +62 -3
  256. package/lib-cjs/component/reducer/actions/SpectrumsActions.js +43 -3
  257. package/lib-cjs/component/reducer/actions/ToolsActions.js +2 -2
  258. package/lib-cjs/component/reducer/actions/ZonesActions.js +1 -1
  259. package/lib-cjs/component/reducer/preferences/actions/addWorkspace.js +19 -15
  260. package/lib-cjs/component/reducer/preferences/actions/setActiveWorkspace.js +1 -1
  261. package/lib-cjs/component/reducer/preferences/actions/setPreferences.js +3 -4
  262. package/lib-cjs/component/reducer/preferences/preferencesReducer.js +5 -1
  263. package/lib-cjs/component/reducer/preferences/utilities/flatObject.js +1 -1
  264. package/lib-cjs/component/utility/PathBuilder.js +11 -0
  265. package/lib-cjs/component/utility/export.js +9 -9
  266. package/lib-cjs/component/utility/getSpectraObjectPaths.js +1 -1
  267. package/lib-cjs/component/utility/getUniqueNuclei.js +1 -1
  268. package/lib-cjs/component/utility/jpathToArray.js +1 -1
  269. package/lib-cjs/component/workspaces/index.js +2 -0
  270. package/lib-cjs/component/workspaces/simulation.js +71 -0
  271. package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +9 -5
  272. package/lib-cjs/data/PredictionManager.js +96 -22
  273. package/lib-cjs/data/SpectraManager.js +1 -1
  274. package/lib-cjs/data/data1d/Spectrum1D/generateJGraphData.js +3 -3
  275. package/lib-cjs/data/data1d/Spectrum1D/getReferenceShift.js +5 -4
  276. package/lib-cjs/data/data1d/Spectrum1D/integrals/changeIntegralsRelative.js +12 -13
  277. package/lib-cjs/data/data1d/Spectrum1D/ranges/changeRangeRelativeValue.js +10 -9
  278. package/lib-cjs/data/data1d/database.js +13 -6
  279. package/lib-cjs/data/data1d/multipleSpectraAnalysis.js +1 -1
  280. package/lib-cjs/data/data1d/spectrumSimulation.js +58 -0
  281. package/lib-cjs/data/data2d/Spectrum2D/contours.js +7 -1
  282. package/lib-cjs/data/data2d/Spectrum2D/getMissingProjection.js +6 -6
  283. package/lib-cjs/data/data2d/Spectrum2D/getShift.js +1 -1
  284. package/lib-cjs/data/data2d/Spectrum2D/getSlice.js +4 -4
  285. package/lib-cjs/data/data2d/Spectrum2D/zones/getDetectionZones.js +5 -5
  286. package/lib-cjs/data/matrixGeneration.js +1 -1
  287. package/lib-cjs/data/molecules/MoleculeManager.js +23 -8
  288. package/lib-cjs/data/parseMeta/linkMetaWithSpectra.js +2 -1
  289. package/lib-cjs/data/utilities/FindUtilities.js +4 -4
  290. package/lib-cjs/data/utilities/calculateSanPlot.js +3 -3
  291. package/lib-cjs/data/utilities/generateNumbersPowerOfX.js +1 -1
  292. package/lib-cjs/versionInfo.js +1 -1
  293. package/package.json +21 -20
@@ -0,0 +1,68 @@
1
+ export const simulation = {
2
+ version: 1,
3
+ label: 'Simulation',
4
+ general: {
5
+ dimmedSpectraOpacity: 0.5,
6
+ verticalSplitterPosition: '440px',
7
+ verticalSplitterCloseThreshold: 600,
8
+ spectraRendering: 'auto',
9
+ loggingLevel: 'info',
10
+ },
11
+ display: {
12
+ panels: {
13
+ spectraPanel: { display: true },
14
+ simulationPanel: { display: true, open: true },
15
+ },
16
+ toolBarButtons: {
17
+ exportAs: true,
18
+ import: true,
19
+ spectraCenterAlignments: true,
20
+ spectraStackAlignments: true,
21
+ zoomOut: true,
22
+ zoom: true,
23
+ },
24
+ },
25
+ formatting: {
26
+ nuclei: {},
27
+ panels: {
28
+ spectra: {
29
+ nuclei: {
30
+ '1H': {
31
+ columns: [
32
+ {
33
+ name: 'visible',
34
+ label: '',
35
+ description: 'Show/Hide Spectrum',
36
+ visible: true,
37
+ },
38
+ {
39
+ name: 'name',
40
+ label: 'Spectrum Name',
41
+ description: 'Spectrum Name',
42
+ jpath: ['info', 'name'],
43
+ visible: true,
44
+ },
45
+ {
46
+ label: 'Frequency',
47
+ description: 'frequency',
48
+ jpath: ['info', 'originFrequency'],
49
+ visible: true,
50
+ },
51
+ {
52
+ jpath: ['info', 'nucleus'],
53
+ label: 'Experiment',
54
+ visible: true,
55
+ },
56
+ {
57
+ name: 'color',
58
+ label: '',
59
+ description: 'Spectrum Color',
60
+ visible: true,
61
+ },
62
+ ],
63
+ },
64
+ },
65
+ },
66
+ },
67
+ },
68
+ };
@@ -21,6 +21,7 @@ export const workspaceDefaultProperties = {
21
21
  peaksPanel: { display: false, open: false },
22
22
  predictionPanel: { display: false, open: false },
23
23
  summaryPanel: { display: false, open: false },
24
+ simulationPanel: { display: false, open: false },
24
25
  },
25
26
  toolBarButtons: {
26
27
  baselineCorrection: false,
@@ -88,21 +89,24 @@ export const workspaceDefaultProperties = {
88
89
  infoBlock: {
89
90
  visible: false,
90
91
  fields: [
91
- { label: 'name', jpath: ['display', 'name'], visible: true },
92
+ { label: 'name', jpath: ['info', 'name'], visible: true, format: '' },
92
93
  {
93
94
  label: 'Number Of Scan',
94
95
  jpath: ['info', 'numberOfScans'],
95
96
  visible: true,
97
+ format: '0',
96
98
  },
97
99
  {
98
- label: 'Acquisition Time',
99
- jpath: ['info', 'acquisitionTime'],
100
+ label: 'Pulse Sequence',
101
+ jpath: ['info', 'pulseSequence'],
100
102
  visible: true,
103
+ format: '',
101
104
  },
102
105
  {
103
- label: 'Pulse Sequence',
104
- jpath: ['info', 'pulseSequence'],
106
+ label: 'Frequency',
107
+ jpath: ['info', 'originFrequency'],
105
108
  visible: true,
109
+ format: '0',
106
110
  },
107
111
  ],
108
112
  },
@@ -1,9 +1,9 @@
1
- import { FifoLogger } from 'fifo-logger';
1
+ import { Logger } from 'cheminfo-types';
2
2
  import { Spectrum } from 'nmr-load-save';
3
- import { PredictedAll } from 'nmr-processing';
3
+ import { PredictedAll, Prediction1D, Prediction2D } from 'nmr-processing';
4
4
  export type Experiment = 'proton' | 'carbon' | 'cosy' | 'hsqc' | 'hmbc';
5
5
  export type SpectraPredictionOptions = Record<Experiment, boolean>;
6
- export type PredictedSpectraResult = Partial<Record<Experiment, Spectrum>>;
6
+ export type PredictedSpectraResult = Partial<Record<Experiment, Prediction1D | Prediction2D>>;
7
7
  export interface PredictionOptions {
8
8
  name: string;
9
9
  frequency: number;
@@ -25,13 +25,14 @@ export interface PredictionOptions {
25
25
  y: number;
26
26
  };
27
27
  };
28
+ autoExtendRange: boolean;
28
29
  spectra: SpectraPredictionOptions;
29
- logger?: FifoLogger;
30
+ logger?: Logger;
30
31
  }
31
- export declare const defaultPredictionOptions: PredictionOptions;
32
+ export declare const getDefaultPredictionOptions: () => PredictionOptions;
32
33
  export declare const FREQUENCIES: Array<{
33
34
  value: number;
34
35
  label: string;
35
36
  }>;
36
- export declare function predictSpectra(molfile: string, logger: FifoLogger): Promise<PredictedAll>;
37
- export declare function generateSpectra(predictedSpectra: PredictedSpectraResult, inputOptions: PredictionOptions, color: string): Spectrum[];
37
+ export declare function predictSpectra(molfile: string): Promise<PredictedAll>;
38
+ export declare function generateSpectra(predictedSpectra: PredictedSpectraResult, inputOptions: PredictionOptions, color: string, logger: Logger): Spectrum[];
@@ -1,11 +1,12 @@
1
1
  import { v4 } from '@lukeed/uuid';
2
- import { predictAll, signalsToXY, signals2DToZ, getFrequency, } from 'nmr-processing';
2
+ import { xMinMaxValues } from 'ml-spectra-processing';
3
+ import { predictAll, signalsToXY, signals2DToZ, getFrequency, signalsToRanges, } from 'nmr-processing';
3
4
  import OCL from 'openchemlib/full';
4
5
  import { DatumKind } from './constants/SignalsKinds';
5
6
  import { initiateDatum1D, mapRanges, updateIntegralsRelativeValues, } from './data1d/Spectrum1D';
6
7
  import { initiateDatum2D } from './data2d/Spectrum2D';
7
8
  import { adjustAlpha } from './utilities/generateColor';
8
- export const defaultPredictionOptions = {
9
+ export const getDefaultPredictionOptions = () => ({
9
10
  name: '',
10
11
  frequency: 400,
11
12
  '1d': {
@@ -24,7 +25,8 @@ export const defaultPredictionOptions = {
24
25
  hsqc: true,
25
26
  hmbc: true,
26
27
  },
27
- };
28
+ autoExtendRange: true,
29
+ });
28
30
  export const FREQUENCIES = [
29
31
  { value: 40, label: '40 MHz' },
30
32
  { value: 60, label: '60 MHz' },
@@ -41,10 +43,9 @@ export const FREQUENCIES = [
41
43
  { value: 1200, label: '1200 MHz' },
42
44
  ];
43
45
  const baseURL = 'https://nmr-prediction.service.zakodium.com';
44
- export async function predictSpectra(molfile, logger) {
46
+ export async function predictSpectra(molfile) {
45
47
  const molecule = OCL.Molecule.fromMolfile(molfile);
46
48
  return predictAll(molecule, {
47
- logger,
48
49
  predictOptions: {
49
50
  C: {
50
51
  webserviceURL: `${baseURL}/v1/predict/carbon`,
@@ -59,17 +60,19 @@ function generateName(name, options) {
59
60
  : `${frequency}MHz`;
60
61
  return name || `${experiment.toUpperCase()}_${freq}_${v4()}`;
61
62
  }
62
- export function generateSpectra(predictedSpectra, inputOptions, color) {
63
+ export function generateSpectra(predictedSpectra, inputOptions, color, logger) {
64
+ const options = JSON.parse(JSON.stringify(inputOptions));
65
+ checkFromTo(predictedSpectra, options, logger);
63
66
  const spectra = [];
64
67
  for (const experiment in predictedSpectra) {
65
- if (inputOptions.spectra[experiment]) {
68
+ if (options.spectra[experiment]) {
66
69
  const spectrum = predictedSpectra[experiment];
67
70
  switch (experiment) {
68
71
  case 'proton':
69
72
  case 'carbon': {
70
73
  const datum = generated1DSpectrum({
71
74
  spectrum,
72
- inputOptions,
75
+ options,
73
76
  experiment,
74
77
  color,
75
78
  });
@@ -81,7 +84,7 @@ export function generateSpectra(predictedSpectra, inputOptions, color) {
81
84
  case 'hmbc': {
82
85
  const datum = generated2DSpectrum({
83
86
  spectrum,
84
- inputOptions,
87
+ options,
85
88
  experiment,
86
89
  color,
87
90
  });
@@ -95,14 +98,84 @@ export function generateSpectra(predictedSpectra, inputOptions, color) {
95
98
  }
96
99
  return spectra;
97
100
  }
101
+ function checkFromTo(predictedSpectra, inputOptions, logger) {
102
+ const setFromTo = (inputOptions, nucleus, fromTo) => {
103
+ inputOptions['1d'][nucleus].to = fromTo.to;
104
+ inputOptions['1d'][nucleus].from = fromTo.from;
105
+ if (fromTo.signalsOutOfRange) {
106
+ signalsOutOfRange[nucleus] = true;
107
+ }
108
+ };
109
+ const { autoExtendRange, spectra } = inputOptions;
110
+ const signalsOutOfRange = {};
111
+ for (const experiment in predictedSpectra) {
112
+ if (!spectra[experiment])
113
+ continue;
114
+ if (predictedSpectra[experiment].signals.length === 0)
115
+ continue;
116
+ if (['carbon', 'proton'].includes(experiment)) {
117
+ const spectrum = predictedSpectra[experiment];
118
+ const { signals, nucleus } = spectrum;
119
+ const { from, to } = inputOptions['1d'][nucleus];
120
+ const fromTo = getNewFromTo({
121
+ deltas: signals.map((s) => s.delta),
122
+ from,
123
+ to,
124
+ nucleus,
125
+ autoExtendRange,
126
+ });
127
+ setFromTo(inputOptions, nucleus, fromTo);
128
+ }
129
+ else {
130
+ const { signals, nuclei } = predictedSpectra[experiment];
131
+ for (const nucleus of nuclei) {
132
+ const axis = nucleus === '1H' ? 'x' : 'y';
133
+ const { from, to } = inputOptions['1d'][nucleus];
134
+ const fromTo = getNewFromTo({
135
+ deltas: signals.map((s) => s[axis].delta),
136
+ from,
137
+ to,
138
+ nucleus,
139
+ autoExtendRange,
140
+ });
141
+ setFromTo(inputOptions, nucleus, fromTo);
142
+ }
143
+ }
144
+ }
145
+ for (const nucleus of ['1H', '13C']) {
146
+ if (signalsOutOfRange[nucleus]) {
147
+ const { from, to } = inputOptions['1d'][nucleus];
148
+ if (autoExtendRange) {
149
+ logger.info(`There are ${nucleus} signals out of the range, it was extended to ${from}-${to}.`);
150
+ }
151
+ else {
152
+ logger.warn(`There are ${nucleus} signals out of the range.`);
153
+ }
154
+ }
155
+ }
156
+ }
157
+ function getNewFromTo(params) {
158
+ const { deltas, nucleus, autoExtendRange } = params;
159
+ let { from, to } = params;
160
+ const { min, max } = xMinMaxValues(deltas);
161
+ const signalsOutOfRange = from > min || to < max;
162
+ if (autoExtendRange && signalsOutOfRange) {
163
+ const spread = nucleus === '1H' ? 0.2 : 2;
164
+ if (from > min)
165
+ from = min - spread;
166
+ if (to < max)
167
+ to = max + spread;
168
+ }
169
+ return { from, to, signalsOutOfRange };
170
+ }
98
171
  function generated1DSpectrum(params) {
99
- const { spectrum, inputOptions, experiment, color } = params;
100
- const { signals, ranges, nucleus } = spectrum;
101
- const { name, '1d': { nbPoints }, frequency: freq, } = inputOptions;
172
+ const { spectrum, options, experiment, color } = params;
173
+ const { signals, joinedSignals, nucleus } = spectrum;
174
+ const { name, '1d': { nbPoints }, frequency: freq, } = options;
102
175
  const SpectrumName = generateName(name, { frequency: freq, experiment });
103
176
  const frequency = calculateFrequency(nucleus, freq);
104
177
  const { x, y } = signalsToXY(signals, {
105
- ...inputOptions['1d'][nucleus],
178
+ ...options['1d'][nucleus],
106
179
  frequency,
107
180
  nbPoints,
108
181
  });
@@ -123,7 +196,7 @@ function generated1DSpectrum(params) {
123
196
  title: SpectrumName,
124
197
  },
125
198
  }, {});
126
- datum.ranges.values = mapRanges(ranges, datum);
199
+ datum.ranges.values = mapRanges(signalsToRanges(joinedSignals, { frequency: frequency }), datum);
127
200
  updateIntegralsRelativeValues(datum);
128
201
  return datum;
129
202
  }
@@ -149,27 +222,27 @@ function mapZones(zones) {
149
222
  });
150
223
  }
151
224
  function generated2DSpectrum(params) {
152
- const { spectrum, inputOptions, experiment, color } = params;
225
+ const { spectrum, options, experiment, color } = params;
153
226
  const { signals, zones, nuclei } = spectrum;
154
- const xOption = inputOptions['1d'][nuclei[0]];
155
- const yOption = inputOptions['1d'][nuclei[1]];
227
+ const xOption = options['1d'][nuclei[0]];
228
+ const yOption = options['1d'][nuclei[1]];
156
229
  const width = get2DWidth(nuclei);
157
- const frequency = calculateFrequency(nuclei, inputOptions.frequency);
230
+ const frequency = calculateFrequency(nuclei, options.frequency);
158
231
  const minMaxContent = signals2DToZ(signals, {
159
232
  from: { x: xOption.from, y: yOption.from },
160
233
  to: { x: xOption.to, y: yOption.to },
161
234
  nbPoints: {
162
- x: inputOptions['2d'].nbPoints.x,
163
- y: inputOptions['2d'].nbPoints.y,
235
+ x: options['2d'].nbPoints.x,
236
+ y: options['2d'].nbPoints.y,
164
237
  },
165
238
  width,
166
239
  factor: 3,
167
240
  });
168
- const SpectrumName = generateName(inputOptions.name, {
241
+ const SpectrumName = generateName(options.name, {
169
242
  frequency,
170
243
  experiment,
171
244
  });
172
- const spectralWidth = getSpectralWidth(experiment, inputOptions);
245
+ const spectralWidth = getSpectralWidth(experiment, options);
173
246
  const datum = initiateDatum2D({
174
247
  data: { rr: { ...minMaxContent, noise: 0.01 } },
175
248
  display: {
@@ -31,7 +31,7 @@ export function addJcamp(output, jcamp, options, usedColors) {
31
31
  if (spectraIn.length === 0)
32
32
  return;
33
33
  const spectra = [];
34
- for (let spectrum of spectraIn) {
34
+ for (const spectrum of spectraIn) {
35
35
  const data = getData(spectrum, usedColors);
36
36
  if (!data)
37
37
  continue;
@@ -1,6 +1,4 @@
1
1
  import { FromTo } from 'cheminfo-types';
2
- export interface DefaultPathLengthsInterface {
3
- [key: string]: FromTo;
4
- }
2
+ export type DefaultPathLengthsInterface = Record<string, FromTo>;
5
3
  declare const DefaultPathLengths: DefaultPathLengthsInterface;
6
4
  export default DefaultPathLengths;
@@ -1,7 +1,7 @@
1
- export declare const SignalKinds: {
1
+ export declare const SignalKinds: Array<{
2
2
  label: string;
3
3
  value: string;
4
- }[];
4
+ }>;
5
5
  export declare const SignalKindsToInclude: string[];
6
6
  export declare const DatumKind: {
7
7
  signal: string;
@@ -2,9 +2,9 @@ import { v4 } from '@lukeed/uuid';
2
2
  export default function generateJGraphData(ranges, jGraphTolerance) {
3
3
  if (!ranges && !Array.isArray(ranges))
4
4
  return null;
5
- let signals = [];
5
+ const signals = [];
6
6
  let jCouplingMax = 0;
7
- let links = createLinks(ranges, jGraphTolerance);
7
+ const links = createLinks(ranges, jGraphTolerance);
8
8
  for (const range of ranges) {
9
9
  for (const signal of range.signals) {
10
10
  const { id: signalId, ...restSignal } = signal;
@@ -26,7 +26,7 @@ function getJsCouplingMax(js) {
26
26
  }
27
27
  function getCouplings(ranges) {
28
28
  const couplings = [];
29
- for (let range of ranges) {
29
+ for (const range of ranges) {
30
30
  for (const { delta, js } of range.signals) {
31
31
  for (const { coupling } of js || []) {
32
32
  couplings.push({ coupling, delta });
@@ -14,9 +14,10 @@ import { getRange } from '../../constants/References';
14
14
  * @param {string} [options.reference]
15
15
  */
16
16
  export function getReferenceShift(datum1D, options) {
17
- let { from, to, nbPeaks, targetX, reference } = options;
17
+ const { reference } = options;
18
+ let { from, to, nbPeaks, targetX } = options;
18
19
  if (reference) {
19
- let data = getRange({ reference, nucleus: datum1D.nucleus });
20
+ const data = getRange({ reference, nucleus: datum1D.nucleus });
20
21
  from = data.from;
21
22
  to = data.to;
22
23
  nbPeaks = data.nbPeaks;
@@ -36,7 +37,7 @@ function xyCalibrate(data, range = {}, options = {}) {
36
37
  polynomial: 3,
37
38
  },
38
39
  }, } = options;
39
- let { from, to } = range;
40
+ const { from, to } = range;
40
41
  if (from === undefined || to === undefined)
41
42
  return 0;
42
43
  const fromIndex = xFindClosestIndex(data.x, from);
@@ -45,7 +46,7 @@ function xyCalibrate(data, range = {}, options = {}) {
45
46
  x: data.x.slice(fromIndex, toIndex),
46
47
  y: data.y.slice(fromIndex, toIndex),
47
48
  };
48
- let peaks = gsd(sliceddata, gsdOptions)
49
+ const peaks = gsd(sliceddata, gsdOptions)
49
50
  .sort((a, b) => b.y - a.y)
50
51
  .slice(0, nbPeaks);
51
52
  if (peaks.length === 0)
@@ -1,5 +1,5 @@
1
1
  import { Spectrum1D } from 'nmr-load-save';
2
- export declare function changeIntegralsRelative(spectrum: Spectrum1D, newIntegral: {
2
+ export declare function changeIntegralsRelative(spectrum: Spectrum1D, data: {
3
3
  id: string;
4
4
  value: number;
5
5
  }): void;
@@ -1,18 +1,17 @@
1
- export function changeIntegralsRelative(spectrum, newIntegral) {
2
- const index = spectrum.integrals.values.findIndex((integral) => integral.id === newIntegral.id);
1
+ export function changeIntegralsRelative(spectrum, data) {
2
+ const { id, value } = data;
3
+ const index = spectrum.integrals.values.findIndex((integral) => integral.id === id);
3
4
  if (index !== -1) {
4
- const ratio = spectrum.integrals.values[index].absolute / newIntegral.value;
5
- const result = { values: [], sum: 0 };
6
- for (const [index, integral] of spectrum.integrals.values.entries()) {
7
- const newIntegralValue = integral.absolute / ratio;
8
- result.sum += newIntegralValue;
9
- result.values[index] = {
10
- ...integral,
11
- integral: newIntegralValue,
12
- };
5
+ const { absolute } = spectrum.integrals.values[index];
6
+ const ratio = absolute / value;
7
+ let sum = 0;
8
+ const integrals = [];
9
+ for (const integralRecord of spectrum.integrals.values) {
10
+ const integral = integralRecord.absolute / ratio;
11
+ sum += integral;
12
+ integrals.push({ ...integralRecord, integral });
13
13
  }
14
- const { values, sum } = result;
15
- spectrum.integrals.values = values;
14
+ spectrum.integrals.values = integrals;
16
15
  spectrum.integrals.options = {
17
16
  ...spectrum.integrals.options,
18
17
  mf: undefined,
@@ -6,10 +6,16 @@
6
6
  export function changeRangeRelativeValue(spectrum, data) {
7
7
  const { id, value } = data;
8
8
  const index = spectrum.ranges.values.findIndex((range) => range.id === id);
9
- if (index !== -1 && spectrum.ranges.options.sum) {
10
- const { absolute, integration } = spectrum.ranges.values[index];
9
+ if (index !== -1) {
10
+ const { absolute } = spectrum.ranges.values[index];
11
11
  const ratio = absolute / value;
12
- const sum = (value / integration) * spectrum.ranges.options.sum;
12
+ const ranges = [];
13
+ let sum = 0;
14
+ for (const range of spectrum.ranges.values) {
15
+ const integration = range.absolute / ratio;
16
+ sum += integration;
17
+ ranges.push({ ...range, integration });
18
+ }
13
19
  spectrum.ranges.options = {
14
20
  ...spectrum.ranges.options,
15
21
  mf: undefined,
@@ -17,11 +23,6 @@ export function changeRangeRelativeValue(spectrum, data) {
17
23
  sumAuto: false,
18
24
  sum,
19
25
  };
20
- spectrum.ranges.values = spectrum.ranges.values.map((range) => {
21
- return {
22
- ...range,
23
- integration: range.absolute / ratio,
24
- };
25
- });
26
+ spectrum.ranges.values = ranges;
26
27
  }
27
28
  }
@@ -16,14 +16,14 @@ export interface DataBaseBasic {
16
16
  export interface DataBaseRange {
17
17
  from: number;
18
18
  to: number;
19
- signals: Array<DataBaseSignal>;
19
+ signals: DataBaseSignal[];
20
20
  }
21
- export type LocalDatabase = {
21
+ export interface LocalDatabase {
22
22
  key: string;
23
23
  label: string;
24
24
  url?: string;
25
- value?: Array<DatabaseNMREntry>;
26
- };
25
+ value?: DatabaseNMREntry[];
26
+ }
27
27
  export declare const DATA_BASES: LocalDatabase[];
28
28
  interface Coupling {
29
29
  multiplicity: string;
@@ -33,9 +33,11 @@ export type PrepareDataResult = Partial<DataBaseBasic & DataBaseRange & DataBase
33
33
  export interface InitiateDatabaseResult {
34
34
  data: DatabaseNMREntry[];
35
35
  getSolvents: () => string[];
36
- search: (keywords?: string | string[]) => DatabaseNMREntry[];
37
- searchByStructure: (idCode: string) => DatabaseNMREntry[];
36
+ search: (options: {
37
+ keywords?: string | string[];
38
+ idCode?: string;
39
+ }) => DatabaseNMREntry[];
38
40
  }
39
41
  export declare function initiateDatabase(databases: DatabaseNMREntry[], nucleus: string): InitiateDatabaseResult;
40
- export declare function prepareData(data: Array<DatabaseNMREntry>): PrepareDataResult[];
42
+ export declare function prepareData(data: DatabaseNMREntry[]): PrepareDataResult[];
41
43
  export {};
@@ -14,9 +14,16 @@ export function initiateDatabase(databases, nucleus) {
14
14
  const data = databases.filter((datum) => datum.nucleus === nucleus);
15
15
  const moleculesDB = prepareMoleculesDB(data);
16
16
  const getSolvents = () => prepareGetSolvents(data);
17
- const search = (keywords = []) => filter(data, { keywords });
18
- const searchByStructure = (idCode) => processSearchByStructure(moleculesDB, idCode);
19
- return { searchByStructure, data, getSolvents, search };
17
+ const search = ({ idCode = '', keywords = '', }) => prepareSearch({ idCode, keywords, data, moleculesDB });
18
+ return { data, getSolvents, search };
19
+ }
20
+ function prepareSearch(options) {
21
+ const { data, keywords = [], moleculesDB, idCode } = options;
22
+ let searchData = data;
23
+ if (idCode) {
24
+ searchData = processSearchByStructure(moleculesDB, idCode);
25
+ }
26
+ return filter(searchData, { keywords });
20
27
  }
21
28
  function processSearchByStructure(moleculesDB, idCode) {
22
29
  // default format { format: 'idCode' }
@@ -43,8 +50,8 @@ function prepareGetSolvents(data) {
43
50
  // });
44
51
  // }
45
52
  function prepareMoleculesDB(array) {
46
- let moleculesDB = new MoleculesDB(OCL);
47
- for (let entry of array) {
53
+ const moleculesDB = new MoleculesDB(OCL);
54
+ for (const entry of array) {
48
55
  if (entry.ocl) {
49
56
  try {
50
57
  const molecule = OCL.Molecule.fromIDCode(entry.ocl.idCode, entry.ocl.coordinates);
@@ -84,7 +91,7 @@ export function prepareData(data) {
84
91
  const result = [];
85
92
  let index = 0;
86
93
  for (const item of data) {
87
- let ids = [];
94
+ const ids = [];
88
95
  const { ranges, ...restItemKeys } = item;
89
96
  if (!ranges) {
90
97
  ids.push(v4());
@@ -18,7 +18,7 @@ export type SpectraAnalysis = Record<string /** where the key is the nucleus*/,
18
18
  export declare function getColumns(spectraAnalysis: PanelsPreferences['multipleSpectraAnalysis'], nucleus: string): any;
19
19
  export declare function getValue(colKey: string, columns: SpectraAnalysisColumns, data: any): any;
20
20
  export declare function getSpectraAnalysis(spectra: Spectrum[], options: any): {
21
- values: Array<AnalysisRow>;
21
+ values: AnalysisRow[];
22
22
  sum: number;
23
23
  };
24
24
  export declare function mapColumns(options: MultipleSpectraAnalysisPreferences['analysisOptions']): {
@@ -75,7 +75,7 @@ export function analyzeSpectra(spectraAnalysis, options) {
75
75
  }, columnKey);
76
76
  }
77
77
  export function generateAnalyzeSpectra(multipleSpectraAnalysis, spectra, nucleus) {
78
- let data = {};
78
+ const data = {};
79
79
  const { sum, columns, code } = multipleSpectraAnalysis.analysisOptions;
80
80
  for (const columnKey in columns) {
81
81
  const { from, to } = columns[columnKey];
@@ -0,0 +1,14 @@
1
+ export type SpinSystemData = Array<Array<number | null>>;
2
+ export interface SpectrumSimulationOptions {
3
+ data: SpinSystemData;
4
+ options: {
5
+ frequency: number;
6
+ from: number;
7
+ to: number;
8
+ nbPoints: number;
9
+ lineWidth: number;
10
+ };
11
+ }
12
+ export declare const defaultSimulationOptions: SpectrumSimulationOptions;
13
+ export declare function getSpinSystems(): string[];
14
+ export declare function simulateSpectrum(spinSystem: string, options: SpectrumSimulationOptions): import("cheminfo-types").DataXY<import("cheminfo-types").DoubleArray>;
@@ -0,0 +1,53 @@
1
+ import { simulate1D } from 'nmr-processing';
2
+ export const defaultSimulationOptions = {
3
+ data: [],
4
+ options: {
5
+ frequency: 200,
6
+ from: -1,
7
+ to: 12,
8
+ nbPoints: 2 ** 16,
9
+ lineWidth: 1,
10
+ },
11
+ };
12
+ export function getSpinSystems() {
13
+ const spinSystem = [];
14
+ let temp = 'A';
15
+ for (let i = 66; i <= 72; i++) {
16
+ temp += String.fromCodePoint(i);
17
+ spinSystem.push(temp);
18
+ }
19
+ return spinSystem;
20
+ }
21
+ export function simulateSpectrum(spinSystem, options) {
22
+ const spinsLength = spinSystem.length;
23
+ const chemicalShifts = new Array(spinsLength);
24
+ const multiplicity = new Array(spinsLength);
25
+ const { data: spinsData, options: simulateOptions } = options;
26
+ for (let i = 0; i < spinsLength; i++) {
27
+ chemicalShifts[i] = spinsData[i][0];
28
+ multiplicity[i] = 2;
29
+ }
30
+ const chemicalShiftsLength = chemicalShifts.length;
31
+ const couplingConstants = new Array(chemicalShiftsLength);
32
+ for (let i = 0; i < chemicalShiftsLength; i++) {
33
+ couplingConstants[i] = new Array(chemicalShiftsLength);
34
+ for (let j = 0; j < chemicalShiftsLength; j++) {
35
+ couplingConstants[i][j] = 0;
36
+ }
37
+ }
38
+ for (let i = 0; i < spinsData.length; i++) {
39
+ for (let j = 1; j < chemicalShiftsLength; j++) {
40
+ const couplingVal = spinsData[i][j];
41
+ const jIndex = j - 1;
42
+ if (couplingVal !== null) {
43
+ couplingConstants[i][jIndex] = couplingVal;
44
+ couplingConstants[jIndex][i] = couplingVal;
45
+ }
46
+ }
47
+ }
48
+ return simulate1D({
49
+ chemicalShifts,
50
+ couplingConstants,
51
+ levels: multiplicity,
52
+ }, simulateOptions);
53
+ }