nmrium 0.50.1 → 0.52.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 (219) hide show
  1. package/lib/component/1d/Chart1D.js +1 -1
  2. package/lib/component/1d/LinesSeries.js +2 -2
  3. package/lib/component/1d/Viewer1D.js +6 -11
  4. package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
  5. package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
  6. package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
  7. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
  8. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
  9. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
  10. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
  11. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
  12. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
  13. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
  14. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
  15. package/lib/component/2d/Viewer2D.js +16 -15
  16. package/lib/component/2d/ft/Contours.js +6 -3
  17. package/lib/component/2d/utilities/scale.d.ts +2 -1
  18. package/lib/component/2d/utilities/scale.js +12 -2
  19. package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
  20. package/lib/component/EventsTrackers/BrushTracker.js +2 -2
  21. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
  22. package/lib/component/EventsTrackers/KeysListenerTracker.js +32 -18
  23. package/lib/component/context/DispatchContext.d.ts +1 -1
  24. package/lib/component/context/ToasterContext.d.ts +13 -0
  25. package/lib/component/context/ToasterContext.js +34 -0
  26. package/lib/component/elements/Label.js +1 -1
  27. package/lib/component/elements/Select.js +2 -2
  28. package/lib/component/elements/ToolbarPopoverItem.js +1 -1
  29. package/lib/component/header/ApodizationOptionsPanel.js +1 -1
  30. package/lib/component/header/AutoPeakPickingOptionPanel.js +7 -4
  31. package/lib/component/header/BaseLineCorrectionPanel.js +2 -2
  32. package/lib/component/header/Header.d.ts +1 -11
  33. package/lib/component/header/Header.js +5 -6
  34. package/lib/component/header/PhaseCorrectionPanel.js +24 -33
  35. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
  36. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
  37. package/lib/component/header/RangesPickingOptionPanel.js +7 -4
  38. package/lib/component/header/ZeroFillingOptionsPanel.js +1 -1
  39. package/lib/component/header/Zones2DOptionPanel.js +6 -2
  40. package/lib/component/hooks/useDialogToggle.d.ts +5 -0
  41. package/lib/component/hooks/useDialogToggle.js +16 -0
  42. package/lib/component/hooks/useExport.d.ts +9 -1
  43. package/lib/component/hooks/useExport.js +34 -36
  44. package/lib/component/hooks/useSaveSettings.js +6 -3
  45. package/lib/component/hooks/useToolsFunctions.d.ts +1 -1
  46. package/lib/component/hooks/useToolsFunctions.js +9 -7
  47. package/lib/component/loader/DropZone.js +14 -14
  48. package/lib/component/main/InnerNMRium.js +5 -9
  49. package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
  50. package/lib/component/main/InnerNMRiumContents.js +5 -3
  51. package/lib/component/main/NMRium.js +2 -2
  52. package/lib/component/modal/AboutPredictionModal.js +1 -1
  53. package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
  54. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  55. package/lib/component/modal/ExportAsJcampModal.js +15 -15
  56. package/lib/component/modal/ImportPublicationStringModal.js +5 -3
  57. package/lib/component/modal/LoadJCAMPModal.js +7 -5
  58. package/lib/component/modal/LogsHistoryModal.js +1 -1
  59. package/lib/component/modal/MultipletAnalysisModal.js +1 -1
  60. package/lib/component/modal/PredictSpectraModal.js +11 -9
  61. package/lib/component/modal/SaveAsModal.d.ts +3 -4
  62. package/lib/component/modal/SaveAsModal.js +27 -27
  63. package/lib/component/modal/editRange/EditRangeModal.js +2 -2
  64. package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
  65. package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
  66. package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
  67. package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
  68. package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
  69. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
  70. package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
  71. package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
  72. package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
  73. package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
  74. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
  75. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
  76. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
  77. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
  78. package/lib/component/modal/editZone/EditPathLengthFormik.js +2 -2
  79. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  80. package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
  81. package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
  82. package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
  83. package/lib/component/modal/setting/GeneralSettings.js +9 -6
  84. package/lib/component/modal/setting/settings-tabs/GeneralTabContent.js +1 -1
  85. package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +1 -1
  86. package/lib/component/modal/setting/settings-tabs/OnLoadProcessingTabContent.js +1 -1
  87. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
  88. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +1 -1
  89. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +13 -7
  90. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
  91. package/lib/component/panels/Panels.js +5 -5
  92. package/lib/component/panels/PeaksPanel/PeaksPanel.js +6 -3
  93. package/lib/component/panels/RangesPanel/RangesHeader.js +3 -3
  94. package/lib/component/panels/RangesPanel/RangesPanel.js +5 -5
  95. package/lib/component/panels/RangesPanel/RangesPreferences.js +1 -1
  96. package/lib/component/panels/SpectraPanel/SpectraPanelHeader.d.ts +5 -0
  97. package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPanelHeader.js +11 -11
  98. package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.js +12 -6
  99. package/lib/component/panels/SpectraPanel/SpectraTabs.d.ts +1 -0
  100. package/lib/component/panels/{SpectrumsPanel/SpectrumsTabs.js → SpectraPanel/SpectraTabs.js} +6 -6
  101. package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.js +2 -2
  102. package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
  103. package/lib/component/panels/databasePanel/DatabasePreferences.js +1 -1
  104. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +1 -1
  105. package/lib/component/panels/filtersPanel/FilterPanel.js +5 -3
  106. package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
  107. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +7 -5
  108. package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
  109. package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +5 -5
  110. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +6 -6
  111. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +5 -3
  112. package/lib/component/panels/predictionPanel/PredictionOptionsPanel.js +2 -2
  113. package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
  114. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +2 -1
  115. package/lib/component/panels/spectrumSimulation/SpectrumSimulationPreferences.js +1 -1
  116. package/lib/component/panels/spectrumSimulation/SpectrumSimulationSimpleOptions.js +1 -1
  117. package/lib/component/reducer/IgnoreActions.js +1 -1
  118. package/lib/component/reducer/Reducer.d.ts +3 -2
  119. package/lib/component/reducer/Reducer.js +40 -32
  120. package/lib/component/reducer/actions/DomainActions.js +3 -3
  121. package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
  122. package/lib/component/reducer/actions/FiltersActions.js +243 -91
  123. package/lib/component/reducer/actions/IntegralsActions.js +2 -2
  124. package/lib/component/reducer/actions/LoadActions.js +1 -1
  125. package/lib/component/reducer/actions/MoleculeActions.js +0 -1
  126. package/lib/component/reducer/actions/PreferencesActions.js +2 -2
  127. package/lib/component/reducer/actions/RangesActions.js +16 -6
  128. package/lib/component/reducer/actions/ToolsActions.d.ts +6 -6
  129. package/lib/component/reducer/actions/ToolsActions.js +83 -22
  130. package/lib/component/reducer/actions/ZonesActions.d.ts +2 -0
  131. package/lib/component/reducer/actions/ZonesActions.js +5 -1
  132. package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
  133. package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
  134. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
  135. package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
  136. package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
  137. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
  138. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
  139. package/lib/component/toolbar/ToolBar.js +32 -27
  140. package/lib/component/toolbar/toolbarMenu.js +4 -4
  141. package/lib/component/utility/Events.d.ts +11 -0
  142. package/lib/component/utility/Events.js +22 -0
  143. package/lib/constants.js +5 -5
  144. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
  145. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
  146. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
  147. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
  148. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  149. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
  150. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
  151. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
  152. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
  153. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
  154. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
  155. package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
  156. package/lib/data/data2d/Spectrum2D/contours.js +3 -3
  157. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
  158. package/lib/data/data2d/Spectrum2D/getSlice.js +4 -4
  159. package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -0
  160. package/lib/data/getDefaultMatrixFilters.js +2 -2
  161. package/lib/data/matrixGeneration.js +1 -1
  162. package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
  163. package/lib/versionInfo.js +1 -1
  164. package/package.json +32 -30
  165. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
  166. package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
  167. package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
  168. package/lib/component/elements/popup/Alert/Context.js +0 -10
  169. package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
  170. package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
  171. package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
  172. package/lib/component/elements/popup/Alert/Provider.js +0 -127
  173. package/lib/component/elements/popup/Alert/index.d.ts +0 -3
  174. package/lib/component/elements/popup/Alert/index.js +0 -3
  175. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
  176. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
  177. package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
  178. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
  179. package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
  180. package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
  181. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
  182. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
  183. package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
  184. package/lib/component/modal/metaImportation/index.d.ts +0 -2
  185. package/lib/component/modal/metaImportation/index.js +0 -17
  186. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.d.ts +0 -5
  187. package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.d.ts +0 -1
  188. package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
  189. package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
  190. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.d.ts +0 -0
  191. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraPreferences.js +0 -0
  192. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectraTable.d.ts +0 -0
  193. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/SpectrumListPanel.d.ts +0 -0
  194. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.d.ts +0 -0
  195. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ColorIndicator.js +0 -0
  196. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.d.ts +0 -0
  197. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/RenderAsHTML.js +0 -0
  198. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.d.ts +0 -0
  199. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/ShowHideSpectrumButton.js +0 -0
  200. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.d.ts +0 -0
  201. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectraColumnsManager.js +0 -0
  202. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.d.ts +0 -0
  203. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/SpectrumName.js +0 -0
  204. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.d.ts +0 -0
  205. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/PlotChart.js +0 -0
  206. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.d.ts +0 -0
  207. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DHistogram.js +0 -0
  208. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.d.ts +0 -0
  209. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum1DSetting.js +0 -0
  210. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.d.ts +0 -0
  211. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DHistogram.js +0 -0
  212. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.d.ts +0 -0
  213. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/Spectrum2DSetting.js +0 -0
  214. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.d.ts +0 -0
  215. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/SpectrumSetting.js +0 -0
  216. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.d.ts +0 -0
  217. /package/lib/component/panels/{SpectrumsPanel → SpectraPanel}/base/setting/processSnapPlot.js +0 -0
  218. /package/lib/component/reducer/actions/{SpectrumsActions.d.ts → SpectraActions.d.ts} +0 -0
  219. /package/lib/component/reducer/actions/{SpectrumsActions.js → SpectraActions.js} +0 -0
package/lib/constants.js CHANGED
@@ -1,23 +1,23 @@
1
1
  export const docsBaseUrl = 'https://docs.nmrium.org';
2
2
  export const helpList = {
3
3
  zoom: {
4
- text: 'Zoom Tool',
4
+ text: 'Zoom tool',
5
5
  url: `${docsBaseUrl}/help/zoom-and-scale`,
6
6
  },
7
7
  peakPicking: {
8
- text: 'peak picking tool',
8
+ text: 'Peak picking tool',
9
9
  url: `${docsBaseUrl}/help/peaks`,
10
10
  },
11
11
  integralPicking: {
12
- text: 'integral tool',
12
+ text: 'Integral tool',
13
13
  url: `${docsBaseUrl}/help/integrations`,
14
14
  },
15
15
  fullScreen: {
16
- text: 'Full Screen mode',
16
+ text: 'Full screen mode',
17
17
  url: `${docsBaseUrl}/help/general`,
18
18
  },
19
19
  loadSpectrum: {
20
- text: 'load spectrums',
20
+ text: 'Load spectra',
21
21
  url: `${docsBaseUrl}/help/loading-a-spectrum`,
22
22
  },
23
23
  };
@@ -1,40 +1,7 @@
1
1
  import { Spectrum1D } from 'nmr-load-save';
2
- import { Signal1D } from 'nmr-processing';
3
2
  interface RangeOptions {
4
3
  from: number;
5
4
  to: number;
6
5
  }
7
- export declare function createRangeObj({ from, to, absolute, signals, }: RangeOptions & {
8
- signals: Array<Omit<Signal1D, 'id'>>;
9
- absolute: number;
10
- }): {
11
- id: string;
12
- from: number;
13
- to: number;
14
- absolute: number;
15
- signals: {
16
- peaks?: import("nmr-processing").NMRPeak1D[] | undefined;
17
- kind?: string | undefined;
18
- assignment?: string | undefined;
19
- diaIDs?: string[] | undefined;
20
- integration?: number | undefined;
21
- multiplicity: string;
22
- nbAtoms?: number | undefined;
23
- js: import("nmr-processing").Jcoupling[];
24
- delta: number;
25
- atoms?: number[] | undefined;
26
- statistic?: {
27
- mean: number;
28
- sd: number;
29
- min: number;
30
- max: number;
31
- nb: number;
32
- } | undefined;
33
- originalDelta?: number | undefined;
34
- id: string;
35
- }[];
36
- kind: "signal";
37
- integration: number;
38
- };
39
6
  export declare function addRange(spectrum: Spectrum1D, options: RangeOptions): void;
40
7
  export {};
@@ -1,24 +1,11 @@
1
- import { v4 } from '@lukeed/uuid';
2
1
  import { xyIntegration } from 'ml-spectra-processing';
3
2
  import { mapRanges } from 'nmr-processing';
4
- import { DATUM_KIND } from '../../../constants/signalsKinds';
5
3
  import detectSignals from './detectSignals';
6
- export function createRangeObj({ from, to, absolute, signals, }) {
7
- return {
8
- id: v4(),
9
- from,
10
- to,
11
- absolute, // the real value,
12
- signals: signals.map((signal) => ({ id: v4(), ...signal })),
13
- kind: DATUM_KIND.signal,
14
- integration: 0,
15
- };
16
- }
17
4
  export function addRange(spectrum, options) {
18
5
  const { from, to } = options;
19
6
  const { x, re: y } = spectrum.data;
20
7
  const { nucleus, originFrequency: frequency } = spectrum.info;
21
- const absolute = xyIntegration({ x, y }, { from, to, reverse: true });
8
+ const absolute = xyIntegration({ x, y }, { from, to });
22
9
  const signals = detectSignals({ x, y }, {
23
10
  from,
24
11
  to,
@@ -32,7 +19,10 @@ export function addRange(spectrum, options) {
32
19
  signals,
33
20
  };
34
21
  try {
35
- spectrum.ranges.values = spectrum.ranges.values.concat(mapRanges([range], spectrum));
22
+ spectrum.ranges.values = spectrum.ranges.values.concat(
23
+ // TODO: Check this error.
24
+ // @ts-expect-error To be checked
25
+ mapRanges([range], spectrum));
36
26
  }
37
27
  catch (error) {
38
28
  reportError(error);
@@ -4,17 +4,18 @@ const defaultPeakPickingOptions = {
4
4
  shape: { kind: 'lorentzian' },
5
5
  realTopDetection: true,
6
6
  maxCriteria: true,
7
- smoothY: false,
7
+ smoothY: true,
8
+ broadWidth: 0.25,
9
+ broadRatio: 0.0025,
8
10
  integrationSum: 100,
9
- factorStd: 5,
10
- clean: true,
11
+ thresholdFactor: 5,
11
12
  sgOptions: { windowSize: 7, polynomial: 3 },
12
13
  };
13
14
  export default function autoRangesDetection(spectrum, options = {}) {
14
15
  // we calculate the noise but this could be improved
15
16
  let { re, x } = spectrum.data;
16
17
  const { originFrequency, nucleus } = spectrum.info;
17
- const { windowFromIndex, windowToIndex, peakPicking } = options;
18
+ const { windowFromIndex, windowToIndex, peakPicking, rangePicking } = options;
18
19
  const peakPickingOptions = {
19
20
  ...defaultPeakPickingOptions,
20
21
  ...peakPicking,
@@ -27,6 +28,7 @@ export default function autoRangesDetection(spectrum, options = {}) {
27
28
  frequencyCluster: 13,
28
29
  keepPeaks: true,
29
30
  clean: 0.3,
31
+ ...rangePicking,
30
32
  };
31
33
  if (windowFromIndex !== undefined && windowToIndex !== undefined) {
32
34
  x = x.slice(windowFromIndex, windowToIndex);
@@ -6,7 +6,7 @@ export function changeRange(spectrum, range) {
6
6
  const { x, re: y } = spectrum.data;
7
7
  const { originFrequency: frequency, nucleus } = spectrum.info;
8
8
  const index = spectrum.ranges.values.findIndex((i) => i.id === id);
9
- const absolute = xyIntegration({ x, y }, { from, to, reverse: true });
9
+ const absolute = xyIntegration({ x, y }, { from, to });
10
10
  const signals = detectSignals({ x, y }, {
11
11
  from,
12
12
  to,
@@ -4,7 +4,7 @@ import { getShiftX } from 'nmr-processing';
4
4
  export function detectRange(spectrum, options) {
5
5
  const { from, to } = options;
6
6
  const { x, re: y } = spectrum.data;
7
- const absolute = xyIntegration({ x, y }, { from, to, reverse: true });
7
+ const absolute = xyIntegration({ x, y }, { from, to });
8
8
  const min = xyMinYPoint({ x, y }, { from, to }).y;
9
9
  const max = xyMaxYPoint({ x, y }, { from, to }).y;
10
10
  const shiftX = getShiftX(spectrum);
@@ -3,14 +3,16 @@ import { SumParams } from '../SumManager';
3
3
  interface DetectRangesOptions {
4
4
  windowFromIndex?: number;
5
5
  windowToIndex?: number;
6
- peakPicking: {
7
- factorStd?: number;
8
- minMaxRatio?: number;
6
+ rangePicking: {
9
7
  integrationSum?: number;
10
8
  compile?: boolean;
11
9
  frequencyCluster?: number;
12
- clean?: boolean;
10
+ clean?: number;
13
11
  keepPeaks?: boolean;
12
+ };
13
+ peakPicking: {
14
+ thresholdFactor?: number;
15
+ minMaxRatio?: number;
14
16
  direction?: 'negative' | 'positive' | 'both';
15
17
  };
16
18
  impurities?: {
@@ -1,14 +1,24 @@
1
1
  import { DataXY } from 'cheminfo-types';
2
- export default function detectSignals(data: DataXY, options: {
2
+ export default function detectSignals(data: DataXY<Float64Array>, options: {
3
3
  from: number;
4
4
  to: number;
5
5
  nucleus: string;
6
6
  frequency: number;
7
7
  }): {
8
- multiplicity: any;
8
+ multiplicity: string;
9
9
  kind: string;
10
10
  delta: number;
11
- js: any;
11
+ js: never[];
12
+ peaks: import("ml-gsd").GSDPeakOptimized[];
13
+ diaIDs: never[];
14
+ }[] | {
15
+ multiplicity: string;
16
+ kind: string;
17
+ delta: any;
18
+ js: {
19
+ value: number;
20
+ multiplicity: "string";
21
+ }[];
12
22
  peaks: import("nmr-processing").NMRPeak1DWithShapeID[];
13
23
  diaIDs: never[];
14
24
  }[] | {
@@ -8,9 +8,15 @@ export default function detectSignals(data, options) {
8
8
  if (toIndex - fromIndex >= MAX_LENGTH) {
9
9
  const ranges = xyAutoRangesPicking(data, {
10
10
  peakPicking: {
11
+ sgOptions: {
12
+ windowSize: 7,
13
+ polynomial: 3,
14
+ },
11
15
  to,
12
16
  from,
13
17
  frequency,
18
+ broadRatio: 0.0025,
19
+ smoothY: true,
14
20
  },
15
21
  ranges: {
16
22
  symRatio: 2.5,
@@ -1,10 +1,20 @@
1
1
  import { DataXY } from 'cheminfo-types';
2
2
  import { NMRPeak1DWithShapeID } from 'nmr-processing';
3
- export declare function detectSignalsByMultipletAnalysis(data: DataXY, options: any): {
4
- multiplicity: any;
3
+ export declare function detectSignalsByMultipletAnalysis(data: DataXY<Float64Array>, options: any): {
4
+ multiplicity: string;
5
5
  kind: string;
6
6
  delta: number;
7
- js: any;
7
+ js: never[];
8
+ peaks: import("ml-gsd").GSDPeakOptimized[];
9
+ diaIDs: never[];
10
+ }[] | {
11
+ multiplicity: string;
12
+ kind: string;
13
+ delta: any;
14
+ js: {
15
+ value: number;
16
+ multiplicity: "string";
17
+ }[];
8
18
  peaks: NMRPeak1DWithShapeID[];
9
19
  diaIDs: never[];
10
20
  }[];
@@ -1,3 +1,5 @@
1
+ import { optimizePeaksWithLogs } from 'ml-gsd';
2
+ import { xMaxValue } from 'ml-spectra-processing';
1
3
  import { analyseMultiplet } from 'multiplet-analysis';
2
4
  import { signalJoinCouplings, xyAutoPeaksPicking, } from 'nmr-processing';
3
5
  export function detectSignalsByMultipletAnalysis(data, options) {
@@ -6,6 +8,55 @@ export function detectSignalsByMultipletAnalysis(data, options) {
6
8
  x: data.x.slice(fromIndex, toIndex),
7
9
  y: data.y.slice(fromIndex, toIndex),
8
10
  };
11
+ const from = data.x[fromIndex];
12
+ const to = data.x[toIndex];
13
+ const peaks = xyAutoPeaksPicking(data, {
14
+ from,
15
+ to,
16
+ frequency,
17
+ minMaxRatio: 0.1,
18
+ broadWidth: 0.25,
19
+ broadRatio: 0.0025,
20
+ optimize: true,
21
+ smoothY: true,
22
+ });
23
+ if (peaks.length === 0) {
24
+ return [];
25
+ }
26
+ let cs = 0;
27
+ let area = 0;
28
+ for (const peak of peaks) {
29
+ cs += peak.x * peak.y;
30
+ area += peak.y;
31
+ }
32
+ cs /= area;
33
+ const initialWidth = Math.abs(peaks[0].x - (peaks.at(-1) || peaks[0]).x);
34
+ const { logs, optimizedPeaks } = optimizePeaksWithLogs(dataRoi, [
35
+ {
36
+ x: cs,
37
+ y: xMaxValue(dataRoi.y),
38
+ width: initialWidth,
39
+ parameters: {
40
+ width: { max: initialWidth * 4, min: initialWidth * 0.8 },
41
+ },
42
+ },
43
+ ], { shape: { kind: 'pseudoVoigt' }, optimization: { kind: 'lm' } });
44
+ const log = logs.find((l) => l.message === 'optimization successful');
45
+ if (log) {
46
+ const { error } = log;
47
+ if (error < 0.2) {
48
+ return [
49
+ {
50
+ multiplicity: 's',
51
+ kind: 'signal',
52
+ delta: cs,
53
+ js: [],
54
+ peaks: optimizedPeaks,
55
+ diaIDs: [],
56
+ },
57
+ ];
58
+ }
59
+ }
9
60
  const result = analyseMultiplet(dataRoi, {
10
61
  frequency,
11
62
  minimalResolution: 0.1,
@@ -20,34 +71,43 @@ export function detectSignalsByMultipletAnalysis(data, options) {
20
71
  if (result && result.chemShift === undefined)
21
72
  return [];
22
73
  const { delta, js } = joinCouplings(result);
23
- let cs = 0;
24
- let area = 0;
25
- for (let i = 0; i < dataRoi.x.length; i++) {
26
- cs += dataRoi.x[i] * dataRoi.y[i];
27
- area += dataRoi.y[i];
28
- }
29
- cs /= area;
30
- const peaks = xyAutoPeaksPicking(dataRoi, { frequency });
31
- const multiplicity = getMultiplicity(js, { cs, delta, peaks });
74
+ const { jCouplings, multiplicity } = getMultiplicity(js, peaks);
32
75
  return [
33
76
  {
34
77
  multiplicity,
35
78
  kind: 'signal',
36
- delta: cs,
37
- js,
79
+ delta,
80
+ js: jCouplings,
38
81
  peaks,
39
82
  diaIDs: [],
40
83
  },
41
84
  ];
42
85
  }
43
- function getMultiplicity(js, options) {
44
- const { cs, delta, peaks } = options;
45
- if (js?.length > 0) {
46
- return js.map((j) => j.multiplicity).join('');
86
+ function getMultiplicity(js, peaks) {
87
+ if (peaks.length > 1) {
88
+ if (js?.length > 0) {
89
+ return {
90
+ jCouplings: js,
91
+ multiplicity: js.map((j) => j.multiplicity).join(''),
92
+ };
93
+ }
94
+ return {
95
+ jCouplings: [],
96
+ multiplicity: 'm',
97
+ };
98
+ }
99
+ if (peaks.length === 1) {
100
+ return {
101
+ jCouplings: [],
102
+ multiplicity: js.length > 0 ? 'br s' : 's',
103
+ };
104
+ }
105
+ else {
106
+ return {
107
+ jCouplings: [],
108
+ multiplicity: 'm',
109
+ };
47
110
  }
48
- //check if the massive center is closer to the shift from multiplet-analysis,
49
- //if true, is it possibly a singlet.
50
- return peaks.length === 1 && Math.abs(cs - delta) / cs < 1e-3 ? 's' : 'm';
51
111
  }
52
112
  function joinCouplings(result) {
53
113
  const { chemShift: delta, js } = result;
@@ -11,9 +11,9 @@ export declare function initiateRanges(inputSpectrum: Partial<Spectrum1D>, spect
11
11
  delta: number;
12
12
  multiplicity: string;
13
13
  js: import("nmr-processing").Jcoupling[];
14
- diaIDs?: string[] | undefined;
15
14
  atoms?: number[] | undefined;
16
15
  assignment?: string | undefined;
16
+ diaIDs?: string[] | undefined;
17
17
  nbAtoms?: number | undefined;
18
18
  integration?: number | undefined;
19
19
  statistic?: {
@@ -44,8 +44,8 @@ export declare function initiateRanges(inputSpectrum: Partial<Spectrum1D>, spect
44
44
  integration: number;
45
45
  nbAtoms?: number | undefined;
46
46
  multiplicity?: string | undefined;
47
- diaIDs?: string[] | undefined;
48
47
  assignment?: string | undefined;
48
+ diaIDs?: string[] | undefined;
49
49
  pubIntegral?: number | undefined;
50
50
  }[];
51
51
  };
@@ -11,4 +11,4 @@ export interface SpectrumSimulationOptions {
11
11
  }
12
12
  export declare const defaultSimulationOptions: SpectrumSimulationOptions;
13
13
  export declare function getSpinSystems(): string[];
14
- export declare function simulateSpectrum(spinSystem: string, options: SpectrumSimulationOptions): import("cheminfo-types").DataXY<import("cheminfo-types").DoubleArray>;
14
+ export declare function simulateSpectrum(spinSystem: string, options: SpectrumSimulationOptions): import("cheminfo-types").DataXY<Float64Array>;
@@ -27,17 +27,17 @@ function contoursManager(spectrumID, state, options) {
27
27
  spectraLevels[spectrumID] = defaultLevel;
28
28
  }
29
29
  const currentLevel = spectraLevels[spectrumID];
30
- const wheel = (value, shiftKey) => prepareWheel(value, { shiftKey, contourOptions, currentLevel });
30
+ const wheel = (value, altKey) => prepareWheel(value, { altKey, contourOptions, currentLevel });
31
31
  const getLevel = () => currentLevel;
32
32
  const checkLevel = () => prepareCheckLevel(currentLevel, contourOptions);
33
33
  return { wheel, getLevel, checkLevel };
34
34
  }
35
35
  function prepareWheel(value, options) {
36
- const { shiftKey, currentLevel, contourOptions } = options;
36
+ const { altKey, currentLevel, contourOptions } = options;
37
37
  const sign = Math.sign(value);
38
38
  const positiveBoundary = contourOptions.positive.contourLevels;
39
39
  const negativeBoundary = contourOptions.negative.contourLevels;
40
- if (shiftKey) {
40
+ if (altKey) {
41
41
  if ((currentLevel.positive === positiveBoundary[0] && sign === -1) ||
42
42
  (currentLevel.positive >= positiveBoundary[1] && sign === 1)) {
43
43
  return currentLevel;
@@ -1,4 +1,4 @@
1
- import { zoneToX } from 'ml-spectra-processing';
1
+ import { xSequentialFillFromTo } from 'ml-spectra-processing';
2
2
  import { initiateDatum1D } from '../../data1d/Spectrum1D';
3
3
  /**
4
4
  * calculate the missing projection
@@ -23,7 +23,7 @@ export function getProjection(datum, index) {
23
23
  }
24
24
  }
25
25
  return {
26
- x: zoneToX({ from, to }, nbPoints),
26
+ x: xSequentialFillFromTo({ from, to, size: nbPoints }),
27
27
  re: projection,
28
28
  };
29
29
  }
@@ -1,4 +1,4 @@
1
- import { zoneToX } from 'ml-spectra-processing';
1
+ import { xSequentialFillFromTo } from 'ml-spectra-processing';
2
2
  import { initiateDatum1D } from '../../data1d/Spectrum1D';
3
3
  const BASE_INFO = {
4
4
  isFid: false,
@@ -60,10 +60,10 @@ export function getSlice(spectrum, position, options = {}) {
60
60
  const vertical = initiateDatum1D({ info: infoY, data: dataY });
61
61
  return { horizontal, vertical };
62
62
  }
63
- function initiateData(from, to, length) {
63
+ function initiateData(from, to, size) {
64
64
  return {
65
- x: zoneToX({ from, to }, length),
66
- re: new Float64Array(length),
65
+ x: xSequentialFillFromTo({ from, to, size }),
66
+ re: new Float64Array(size),
67
67
  };
68
68
  }
69
69
  function getRealData(data, info) {
@@ -7,6 +7,7 @@ export interface DetectionZonesOptions {
7
7
  toY: number;
8
8
  };
9
9
  thresholdFactor: number;
10
+ maxPercentCutOff: number;
10
11
  tolerances?: number[];
11
12
  convolutionByFFT?: boolean;
12
13
  enhanceSymmetry?: boolean;
@@ -2,7 +2,7 @@ import filterXY from 'ml-signal-processing/FilterXYSchema.json';
2
2
  export function getDefaultMatrixFilters() {
3
3
  // get filters information & default options values
4
4
  return filterXY.anyOf
5
- .filter(({ properties }) => properties.name.enum[0] !== 'equallySpaced')
5
+ .filter(({ properties }) => properties.name.const !== 'equallySpaced')
6
6
  .map(({ properties }) => {
7
7
  const options = {};
8
8
  for (const [key, value] of Object.entries(properties?.options?.properties || {})) {
@@ -13,7 +13,7 @@ export function getDefaultMatrixFilters() {
13
13
  };
14
14
  }
15
15
  return {
16
- name: properties.name.enum[0],
16
+ name: properties.name.const,
17
17
  options,
18
18
  };
19
19
  });
@@ -78,7 +78,7 @@ export function getMatrixFilters() {
78
78
  for (const filter of filterXY.anyOf) {
79
79
  const filterData = filter.properties;
80
80
  const filterProperties = filterData?.options;
81
- const name = filterData.name.enum[0];
81
+ const name = filterData.name.const;
82
82
  if (!IGNORED_FILERS.has(name)) {
83
83
  const properties = flattenFields(name, filterProperties?.properties, {}, [], null, 0);
84
84
  result.push({
@@ -1,7 +1,2 @@
1
1
  import { NmrData2DFt, NmrData1D } from 'cheminfo-types';
2
- export declare function calculateSanPlot<T extends '1D' | '2D'>(dimension: T, data: T extends '1D' ? NmrData1D : NmrData2DFt['rr']): {
3
- positive: number;
4
- negative: number;
5
- snr: number;
6
- sanplot: Record<string, import("cheminfo-types").DataXY<import("cheminfo-types").DoubleArray>>;
7
- };
2
+ export declare function calculateSanPlot<T extends '1D' | '2D'>(dimension: T, data: T extends '1D' ? NmrData1D : NmrData2DFt['rr']): import("ml-spectra-processing").XNoiseSanPlotResult;
@@ -1 +1 @@
1
- export default { version: 'v0.50.1' };
1
+ export default { version: 'v0.52.0' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nmrium",
3
3
  "description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
4
- "version": "0.50.1",
4
+ "version": "0.52.0",
5
5
  "license": "MIT",
6
6
  "module": "lib/component/main/index.js",
7
7
  "types": "lib/component/main/index.d.ts",
@@ -57,22 +57,23 @@
57
57
  "react-dom": ">=18.0.0"
58
58
  },
59
59
  "dependencies": {
60
- "@blueprintjs/core": "^5.9.1",
61
- "@blueprintjs/icons": "^5.7.1",
62
- "@emotion/react": "^11.11.3",
60
+ "@blueprintjs/core": "^5.10.0",
61
+ "@blueprintjs/icons": "^5.8.0",
62
+ "@blueprintjs/select": "^5.1.2",
63
+ "@emotion/react": "^11.11.4",
63
64
  "@emotion/styled": "^11.11.0",
64
65
  "@lukeed/uuid": "^2.0.1",
65
66
  "cheminfo-font": "^1.13.0",
66
- "cheminfo-types": "^1.7.2",
67
+ "cheminfo-types": "^1.7.3",
67
68
  "clipboard-polyfill": "^4.0.2",
68
- "convert-to-jcamp": "^5.4.9",
69
- "d3": "^7.8.5",
69
+ "convert-to-jcamp": "^5.4.10",
70
+ "d3": "^7.9.0",
70
71
  "eventemitter3": "^5.0.1",
71
72
  "fifo-logger": "^0.6.1",
72
73
  "file-saver": "^2.0.5",
73
74
  "filelist-utils": "^1.11.0",
74
75
  "formik": "^2.4.5",
75
- "immer": "^10.0.3",
76
+ "immer": "^10.0.4",
76
77
  "jszip": "^3.10.1",
77
78
  "lodash": "^4.17.21",
78
79
  "ml-array-max": "^1.2.4",
@@ -81,24 +82,25 @@
81
82
  "ml-array-xy-equally-spaced": "^1.2.1",
82
83
  "ml-baseline-correction-regression": "^1.0.2",
83
84
  "ml-conrec": "^5.0.2",
84
- "ml-gsd": "^12.1.3",
85
+ "ml-gsd": "^12.1.6",
85
86
  "ml-matrix": "^6.11.0",
86
- "ml-spectra-processing": "^12.10.2",
87
+ "ml-signal-processing": "^1.0.4",
88
+ "ml-spectra-processing": "^14.2.2",
87
89
  "ml-stat": "^1.3.3",
88
90
  "ml-tree-similarity": "^2.2.0",
89
91
  "multiplet-analysis": "^2.1.2",
90
92
  "nmr-correlation": "^2.3.3",
91
- "nmr-load-save": "^0.27.3",
92
- "nmr-processing": "^11.10.1",
93
+ "nmr-load-save": "^0.28.0",
94
+ "nmr-processing": "^12.0.1",
93
95
  "nmredata": "^0.9.9",
94
96
  "numeral": "^2.0.6",
95
- "openchemlib": "^8.8.1",
96
- "openchemlib-utils": "^5.9.0",
97
+ "openchemlib": "^8.9.0",
98
+ "openchemlib-utils": "^5.12.1",
97
99
  "papaparse": "^5.4.1",
98
100
  "re-resizable": "6.9.11",
99
101
  "react-d3-utils": "^1.0.0",
100
102
  "react-dropzone": "^14.2.3",
101
- "react-error-boundary": "^4.0.12",
103
+ "react-error-boundary": "^4.0.13",
102
104
  "react-icons": "^5.0.1",
103
105
  "react-inspector": "^6.0.2",
104
106
  "react-mf": "^2.0.2",
@@ -106,48 +108,48 @@
106
108
  "react-ocl-nmr": "^3.0.1",
107
109
  "react-plot": "^1.4.2",
108
110
  "react-rnd": "^10.4.1",
109
- "react-science": "^0.36.0",
111
+ "react-science": "^1.0.2",
110
112
  "react-slider": "^2.0.6",
111
113
  "react-table": "^7.8.0",
112
114
  "react-transition-group": "^4.4.5",
113
115
  "react-use": "^17.5.0",
114
116
  "smart-array-filter": "^4.0.2",
115
- "yup": "^1.3.3"
117
+ "yup": "^1.4.0"
116
118
  },
117
119
  "devDependencies": {
118
120
  "@babel/plugin-transform-modules-commonjs": "^7.23.3",
119
121
  "@babel/preset-react": "^7.23.3",
120
122
  "@babel/preset-typescript": "^7.23.3",
121
- "@playwright/test": "^1.41.2",
123
+ "@playwright/test": "^1.42.1",
122
124
  "@simbathesailor/use-what-changed": "^2.0.0",
123
125
  "@types/d3": "^7.4.3",
124
- "@types/lodash": "^4.14.202",
125
- "@types/node": "^20.11.19",
126
+ "@types/lodash": "^4.17.0",
127
+ "@types/node": "^20.11.28",
126
128
  "@types/papaparse": "^5.3.14",
127
- "@types/react": "^18.2.57",
128
- "@types/react-dom": "^18.2.19",
129
+ "@types/react": "^18.2.66",
130
+ "@types/react-dom": "^18.2.22",
129
131
  "@types/react-table": "^7.7.19",
130
132
  "@vitejs/plugin-react-swc": "^3.6.0",
131
- "@vitest/coverage-v8": "^1.3.1",
133
+ "@vitest/coverage-v8": "^1.4.0",
132
134
  "cross-env": "^7.0.3",
133
- "cspell": "^8.4.1",
134
- "eslint": "^8.56.0",
135
+ "cspell": "^8.6.0",
136
+ "eslint": "^8.57.0",
135
137
  "eslint-config-cheminfo-react": "^10.1.0",
136
138
  "eslint-config-cheminfo-typescript": "^12.2.0",
137
139
  "modern-normalize": "^2.0.0",
138
140
  "postcss-styled-syntax": "^0.6.4",
139
141
  "prettier": "^3.2.5",
140
- "rc-menu": "^9.12.4",
142
+ "rc-menu": "^9.13.0",
141
143
  "react": "^18.2.0",
142
144
  "react-dom": "^18.2.0",
143
- "react-router-dom": "^6.22.1",
145
+ "react-router-dom": "^6.22.3",
144
146
  "rimraf": "^5.0.5",
145
147
  "rollup-plugin-analyzer": "^4.0.0",
146
148
  "serve": "^14.2.1",
147
149
  "stylelint": "^16.2.1",
148
150
  "stylelint-config-standard": "^36.0.0",
149
- "typescript": "^5.3.3",
150
- "vite": "^5.1.3",
151
- "vitest": "^1.3.1"
151
+ "typescript": "^5.4.2",
152
+ "vite": "^5.1.6",
153
+ "vitest": "^1.4.0"
152
154
  }
153
155
  }
@@ -1,8 +0,0 @@
1
- import { Alert } from './Context';
2
- interface AlertBlockProps {
3
- offset: string;
4
- alert: Alert;
5
- onClose: () => void;
6
- }
7
- export default function AlertBlock(props: AlertBlockProps): import("@emotion/react/jsx-runtime").JSX.Element;
8
- export {};