nmrium 0.50.0 → 0.51.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 (196) hide show
  1. package/README.md +7 -7
  2. package/lib/component/1d/Chart1D.js +1 -1
  3. package/lib/component/1d/LinesSeries.js +2 -2
  4. package/lib/component/1d/Viewer1D.js +6 -11
  5. package/lib/component/1d/database/DatabaseSpectrum.js +3 -3
  6. package/lib/component/2d/1d-tracer/HorizontalSliceChart.js +6 -2
  7. package/lib/component/2d/1d-tracer/VerticalSliceChart.js +8 -1
  8. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraceWithMouse.js +2 -21
  9. package/lib/component/2d/1d-tracer/phase-correction-traces/PhaseTraces.js +1 -1
  10. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.d.ts +1 -1
  11. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectraPhaseTraces.js +6 -17
  12. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.d.ts +6 -10
  13. package/lib/component/2d/1d-tracer/phase-correction-traces/SpectrumPhaseTrace.js +62 -13
  14. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.d.ts +1 -0
  15. package/lib/component/2d/1d-tracer/phase-correction-traces/useActivePhaseTraces.js +2 -1
  16. package/lib/component/2d/Viewer2D.js +16 -15
  17. package/lib/component/2d/ft/Contours.js +6 -3
  18. package/lib/component/2d/utilities/scale.d.ts +2 -1
  19. package/lib/component/2d/utilities/scale.js +12 -2
  20. package/lib/component/EventsTrackers/BrushTracker.d.ts +5 -3
  21. package/lib/component/EventsTrackers/BrushTracker.js +2 -2
  22. package/lib/component/EventsTrackers/KeysListenerTracker.d.ts +1 -1
  23. package/lib/component/EventsTrackers/KeysListenerTracker.js +29 -15
  24. package/lib/component/context/ToasterContext.d.ts +13 -0
  25. package/lib/component/context/ToasterContext.js +34 -0
  26. package/lib/component/elements/CloseButton.d.ts +2 -2
  27. package/lib/component/elements/CloseButton.js +1 -1
  28. package/lib/component/elements/CounterLabel.d.ts +3 -3
  29. package/lib/component/elements/CounterLabel.js +3 -3
  30. package/lib/component/elements/PreferencesButton.d.ts +2 -2
  31. package/lib/component/elements/PreferencesButton.js +2 -4
  32. package/lib/component/elements/SaveButton.d.ts +2 -2
  33. package/lib/component/elements/SaveButton.js +1 -1
  34. package/lib/component/elements/Select.js +2 -2
  35. package/lib/component/elements/ToolBarButton.d.ts +1 -8
  36. package/lib/component/elements/ToolBarButton.js +2 -11
  37. package/lib/component/elements/ToolbarPopoverItem.d.ts +11 -0
  38. package/lib/component/elements/ToolbarPopoverItem.js +10 -0
  39. package/lib/component/header/AutoPeakPickingOptionPanel.js +6 -3
  40. package/lib/component/header/Header.d.ts +1 -11
  41. package/lib/component/header/Header.js +5 -6
  42. package/lib/component/header/PhaseCorrectionPanel.js +24 -33
  43. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.d.ts +1 -1
  44. package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +96 -42
  45. package/lib/component/header/RangesPickingOptionPanel.js +6 -3
  46. package/lib/component/hooks/useDialogToggle.d.ts +5 -0
  47. package/lib/component/hooks/useDialogToggle.js +16 -0
  48. package/lib/component/hooks/useExport.d.ts +9 -1
  49. package/lib/component/hooks/useExport.js +34 -36
  50. package/lib/component/hooks/useSaveSettings.js +6 -3
  51. package/lib/component/hooks/useToolsFunctions.js +6 -4
  52. package/lib/component/loader/DropZone.js +14 -14
  53. package/lib/component/main/InnerNMRium.js +5 -9
  54. package/lib/component/main/InnerNMRiumContents.d.ts +0 -2
  55. package/lib/component/main/InnerNMRiumContents.js +5 -3
  56. package/lib/component/main/NMRium.js +2 -2
  57. package/lib/component/modal/AboutPredictionModal.js +1 -1
  58. package/lib/component/modal/CopyClipboardModal.js +1 -1
  59. package/lib/component/modal/EditPeakShapeModal.js +1 -1
  60. package/lib/component/modal/ExportAsJcampModal.js +15 -15
  61. package/lib/component/modal/ImportPublicationStringModal.js +5 -3
  62. package/lib/component/modal/LoadJCAMPModal.js +6 -4
  63. package/lib/component/modal/PredictSpectraModal.js +11 -9
  64. package/lib/component/modal/SaveAsModal.d.ts +3 -4
  65. package/lib/component/modal/SaveAsModal.js +27 -27
  66. package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
  67. package/lib/component/modal/editRange/EditRangeModal.js +2 -2
  68. package/lib/component/modal/editRange/forms/components/DeltaInput.d.ts +2 -3
  69. package/lib/component/modal/editRange/forms/components/DeltaInput.js +2 -3
  70. package/lib/component/modal/editRange/forms/components/InfoBlock.d.ts +1 -0
  71. package/lib/component/modal/editRange/forms/components/{SignalFormInfo.js → InfoBlock.js} +2 -2
  72. package/lib/component/modal/editRange/forms/components/NewSignalTab.d.ts +5 -0
  73. package/lib/component/modal/editRange/forms/components/NewSignalTab.js +85 -0
  74. package/lib/component/modal/editRange/forms/components/SignalTab.d.ts +7 -0
  75. package/lib/component/modal/editRange/forms/components/SignalTab.js +24 -0
  76. package/lib/component/modal/editRange/forms/components/SignalsContent.d.ts +8 -0
  77. package/lib/component/modal/editRange/forms/components/SignalsContent.js +57 -0
  78. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.d.ts +5 -0
  79. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +133 -0
  80. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.d.ts +5 -0
  81. package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +141 -0
  82. package/lib/component/modal/editZone/EditZoneModal.js +1 -1
  83. package/lib/component/modal/metaImportation/MetaImportationModal.d.ts +7 -4
  84. package/lib/component/modal/metaImportation/MetaImportationModal.js +23 -13
  85. package/lib/component/modal/metaImportation/utils/mapColumnToSelectItems.js +1 -1
  86. package/lib/component/modal/setting/GeneralSettings.js +7 -4
  87. package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +16 -2
  88. package/lib/component/panels/AutomaticAssignment/useAutoAssignments.js +7 -4
  89. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +20 -6
  90. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +16 -3
  91. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +14 -10
  92. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +6 -4
  93. package/lib/component/panels/PeaksPanel/PeaksPanel.js +48 -14
  94. package/lib/component/panels/RangesPanel/RangesHeader.js +73 -13
  95. package/lib/component/panels/RangesPanel/RangesPanel.js +4 -4
  96. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +49 -8
  97. package/lib/component/panels/SpectrumsPanel/SpectraTable.js +11 -5
  98. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
  99. package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +1 -1
  100. package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +1 -1
  101. package/lib/component/panels/SummaryPanel/SummaryPanel.js +28 -18
  102. package/lib/component/panels/ZonesPanel/ZonesPanel.js +28 -4
  103. package/lib/component/panels/databasePanel/DatabasePanel.js +37 -19
  104. package/lib/component/panels/databasePanel/DatabaseSearchOptions.d.ts +3 -3
  105. package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +4 -4
  106. package/lib/component/panels/filtersPanel/FilterPanel.js +6 -4
  107. package/lib/component/panels/filtersPanel/FiltersTable.js +27 -23
  108. package/lib/component/panels/header/DefaultPanelHeader.d.ts +10 -6
  109. package/lib/component/panels/header/DefaultPanelHeader.js +26 -10
  110. package/lib/component/panels/header/SpectraAutomaticPickingButton.js +6 -4
  111. package/lib/component/panels/multipleAnalysisPanel/AlignSpectra.js +2 -2
  112. package/lib/component/panels/multipleAnalysisPanel/AnalysisChart.js +3 -3
  113. package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +36 -7
  114. package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +4 -2
  115. package/lib/component/panels/predictionPanel/PredictionPanel.js +7 -5
  116. package/lib/component/panels/predictionPanel/PredictionSimpleOptions.js +1 -0
  117. package/lib/component/panels/spectrumSimulation/SpectrumSimulation.js +5 -1
  118. package/lib/component/reducer/Reducer.d.ts +2 -2
  119. package/lib/component/reducer/Reducer.js +23 -16
  120. package/lib/component/reducer/actions/FiltersActions.d.ts +11 -4
  121. package/lib/component/reducer/actions/FiltersActions.js +243 -91
  122. package/lib/component/reducer/actions/IntegralsActions.d.ts +1 -1
  123. package/lib/component/reducer/actions/IntegralsActions.js +2 -2
  124. package/lib/component/reducer/actions/MoleculeActions.js +0 -1
  125. package/lib/component/reducer/actions/RangesActions.js +16 -6
  126. package/lib/component/reducer/actions/ToolsActions.d.ts +3 -3
  127. package/lib/component/reducer/actions/ToolsActions.js +75 -14
  128. package/lib/component/reducer/helper/Zoom1DManager.d.ts +4 -3
  129. package/lib/component/reducer/helper/Zoom1DManager.js +4 -4
  130. package/lib/component/reducer/helper/ZoomHistoryManager.js +1 -5
  131. package/lib/component/reducer/helper/findStrongestPeak.d.ts +6 -0
  132. package/lib/component/reducer/helper/findStrongestPeak.js +13 -0
  133. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.d.ts +2 -1
  134. package/lib/component/reducer/helper/getTwoDimensionPhaseCorrectionOptions.js +7 -1
  135. package/lib/component/toolbar/ToolBar.js +241 -8
  136. package/lib/component/toolbar/toolbarMenu.d.ts +4 -0
  137. package/lib/component/toolbar/toolbarMenu.js +77 -0
  138. package/lib/component/utility/Events.d.ts +11 -0
  139. package/lib/component/utility/Events.js +22 -0
  140. package/lib/component/utility/booleanToString.d.ts +6 -0
  141. package/lib/component/utility/booleanToString.js +4 -0
  142. package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -33
  143. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -15
  144. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -4
  145. package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +1 -1
  146. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
  147. package/lib/data/data1d/Spectrum1D/ranges/detectRanges.d.ts +6 -4
  148. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +13 -3
  149. package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +6 -0
  150. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.d.ts +13 -3
  151. package/lib/data/data1d/Spectrum1D/ranges/detectSignalsByMultipletAnalysis.js +78 -18
  152. package/lib/data/data1d/Spectrum1D/ranges/initiateRanges.d.ts +2 -2
  153. package/lib/data/data1d/spectrumSimulation.d.ts +1 -1
  154. package/lib/data/data2d/Spectrum2D/contours.js +3 -3
  155. package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
  156. package/lib/data/data2d/Spectrum2D/getSlice.js +3 -3
  157. package/lib/data/getDefaultMatrixFilters.js +2 -2
  158. package/lib/data/matrixGeneration.js +1 -1
  159. package/lib/data/utilities/calculateSanPlot.d.ts +1 -6
  160. package/lib/versionInfo.js +1 -1
  161. package/package.json +31 -30
  162. package/lib/component/elements/DeleteButton.d.ts +0 -6
  163. package/lib/component/elements/DeleteButton.js +0 -8
  164. package/lib/component/elements/DropdownMenu.d.ts +0 -9
  165. package/lib/component/elements/DropdownMenu.js +0 -7
  166. package/lib/component/elements/FilterButton.d.ts +0 -6
  167. package/lib/component/elements/FilterButton.js +0 -8
  168. package/lib/component/elements/popup/Alert/AlertBlock.d.ts +0 -8
  169. package/lib/component/elements/popup/Alert/AlertBlock.js +0 -30
  170. package/lib/component/elements/popup/Alert/Context.d.ts +0 -27
  171. package/lib/component/elements/popup/Alert/Context.js +0 -10
  172. package/lib/component/elements/popup/Alert/ProgressIndicator.d.ts +0 -1
  173. package/lib/component/elements/popup/Alert/ProgressIndicator.js +0 -33
  174. package/lib/component/elements/popup/Alert/Provider.d.ts +0 -19
  175. package/lib/component/elements/popup/Alert/Provider.js +0 -127
  176. package/lib/component/elements/popup/Alert/index.d.ts +0 -3
  177. package/lib/component/elements/popup/Alert/index.js +0 -3
  178. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.d.ts +0 -10
  179. package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +0 -81
  180. package/lib/component/modal/editRange/forms/components/CouplingsTable.d.ts +0 -13
  181. package/lib/component/modal/editRange/forms/components/CouplingsTable.js +0 -63
  182. package/lib/component/modal/editRange/forms/components/SignalFormInfo.d.ts +0 -1
  183. package/lib/component/modal/editRange/forms/components/SignalFormTab.d.ts +0 -8
  184. package/lib/component/modal/editRange/forms/components/SignalFormTab.js +0 -18
  185. package/lib/component/modal/editRange/forms/components/SignalsForm.d.ts +0 -10
  186. package/lib/component/modal/editRange/forms/components/SignalsForm.js +0 -114
  187. package/lib/component/modal/metaImportation/index.d.ts +0 -2
  188. package/lib/component/modal/metaImportation/index.js +0 -17
  189. package/lib/component/panels/PeaksPanel/PeaksToggleActions.d.ts +0 -12
  190. package/lib/component/panels/PeaksPanel/PeaksToggleActions.js +0 -7
  191. package/lib/component/reducer/helper/getStrongestPeak.d.ts +0 -7
  192. package/lib/component/reducer/helper/getStrongestPeak.js +0 -15
  193. package/lib/component/toolbar/BasicToolBar.d.ts +0 -1
  194. package/lib/component/toolbar/BasicToolBar.js +0 -165
  195. package/lib/component/toolbar/FunctionToolBar.d.ts +0 -3
  196. package/lib/component/toolbar/FunctionToolBar.js +0 -148
@@ -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,9 +60,9 @@ 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),
65
+ x: xSequentialFillFromTo({ from, to, size }),
66
66
  re: new Float64Array(length),
67
67
  };
68
68
  }
@@ -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.0' };
1
+ export default { version: 'v0.51.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.0",
4
+ "version": "0.51.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,24 @@
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-spectra-processing": "^14.2.2",
87
88
  "ml-stat": "^1.3.3",
88
89
  "ml-tree-similarity": "^2.2.0",
89
90
  "multiplet-analysis": "^2.1.2",
90
91
  "nmr-correlation": "^2.3.3",
91
- "nmr-load-save": "^0.27.2",
92
- "nmr-processing": "^11.10.1",
92
+ "nmr-load-save": "^0.28.0",
93
+ "nmr-processing": "^12.0.1",
93
94
  "nmredata": "^0.9.9",
94
95
  "numeral": "^2.0.6",
95
- "openchemlib": "^8.8.1",
96
- "openchemlib-utils": "^5.9.0",
96
+ "openchemlib": "^8.9.0",
97
+ "openchemlib-utils": "^5.12.1",
97
98
  "papaparse": "^5.4.1",
98
99
  "re-resizable": "6.9.11",
99
100
  "react-d3-utils": "^1.0.0",
100
101
  "react-dropzone": "^14.2.3",
101
- "react-error-boundary": "^4.0.12",
102
+ "react-error-boundary": "^4.0.13",
102
103
  "react-icons": "^5.0.1",
103
104
  "react-inspector": "^6.0.2",
104
105
  "react-mf": "^2.0.2",
@@ -106,48 +107,48 @@
106
107
  "react-ocl-nmr": "^3.0.1",
107
108
  "react-plot": "^1.4.2",
108
109
  "react-rnd": "^10.4.1",
109
- "react-science": "^0.35.0",
110
+ "react-science": "^1.0.2",
110
111
  "react-slider": "^2.0.6",
111
112
  "react-table": "^7.8.0",
112
113
  "react-transition-group": "^4.4.5",
113
114
  "react-use": "^17.5.0",
114
115
  "smart-array-filter": "^4.0.2",
115
- "yup": "^1.3.3"
116
+ "yup": "^1.4.0"
116
117
  },
117
118
  "devDependencies": {
118
119
  "@babel/plugin-transform-modules-commonjs": "^7.23.3",
119
120
  "@babel/preset-react": "^7.23.3",
120
121
  "@babel/preset-typescript": "^7.23.3",
121
- "@playwright/test": "^1.41.2",
122
+ "@playwright/test": "^1.42.1",
122
123
  "@simbathesailor/use-what-changed": "^2.0.0",
123
124
  "@types/d3": "^7.4.3",
124
- "@types/lodash": "^4.14.202",
125
- "@types/node": "^20.11.19",
125
+ "@types/lodash": "^4.17.0",
126
+ "@types/node": "^20.11.28",
126
127
  "@types/papaparse": "^5.3.14",
127
- "@types/react": "^18.2.57",
128
- "@types/react-dom": "^18.2.19",
128
+ "@types/react": "^18.2.66",
129
+ "@types/react-dom": "^18.2.22",
129
130
  "@types/react-table": "^7.7.19",
130
131
  "@vitejs/plugin-react-swc": "^3.6.0",
131
- "@vitest/coverage-v8": "^1.3.1",
132
+ "@vitest/coverage-v8": "^1.4.0",
132
133
  "cross-env": "^7.0.3",
133
- "cspell": "^8.4.1",
134
- "eslint": "^8.56.0",
134
+ "cspell": "^8.6.0",
135
+ "eslint": "^8.57.0",
135
136
  "eslint-config-cheminfo-react": "^10.1.0",
136
137
  "eslint-config-cheminfo-typescript": "^12.2.0",
137
138
  "modern-normalize": "^2.0.0",
138
139
  "postcss-styled-syntax": "^0.6.4",
139
140
  "prettier": "^3.2.5",
140
- "rc-menu": "^9.12.4",
141
+ "rc-menu": "^9.13.0",
141
142
  "react": "^18.2.0",
142
143
  "react-dom": "^18.2.0",
143
- "react-router-dom": "^6.22.1",
144
+ "react-router-dom": "^6.22.3",
144
145
  "rimraf": "^5.0.5",
145
146
  "rollup-plugin-analyzer": "^4.0.0",
146
147
  "serve": "^14.2.1",
147
148
  "stylelint": "^16.2.1",
148
149
  "stylelint-config-standard": "^36.0.0",
149
- "typescript": "^5.3.3",
150
- "vite": "^5.1.3",
151
- "vitest": "^1.3.1"
150
+ "typescript": "^5.4.2",
151
+ "vite": "^5.1.6",
152
+ "vitest": "^1.4.0"
152
153
  }
153
154
  }
@@ -1,6 +0,0 @@
1
- import { ButtonProps } from '@blueprintjs/core';
2
- interface DeleteButtonProps extends Pick<ButtonProps, 'onClick' | 'title' | 'disabled' | 'active'> {
3
- title: string;
4
- }
5
- export declare function DeleteButton(props: DeleteButtonProps): import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { FaRegTrashAlt } from 'react-icons/fa';
3
- import { ToolBarButton } from './ToolBarButton';
4
- export function DeleteButton(props) {
5
- return (_jsx(ToolBarButton, { intent: "danger", style: {
6
- fontSize: '1.125em',
7
- }, ...props, id: "delete-button", icon: _jsx(FaRegTrashAlt, {}) }));
8
- }
@@ -1,9 +0,0 @@
1
- import { MenuItemProps, PopoverProps } from '@blueprintjs/core';
2
- export interface DropdownMenuItem extends MenuItemProps {
3
- data?: object;
4
- }
5
- export interface DropdownMenuProps extends Omit<PopoverProps, 'onSelect' | 'content'> {
6
- options: DropdownMenuItem[];
7
- onSelect: (data?: object) => void;
8
- }
9
- export declare function DropdownMenu(props: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Menu, MenuItem, Popover, } from '@blueprintjs/core';
3
- export function DropdownMenu(props) {
4
- const { options, onSelect, children, ...other } = props;
5
- const content = (_jsx(Menu, { children: options.map((option) => (_jsx(MenuItem, { ...option, onClick: () => onSelect(option?.data) }, JSON.stringify(option)))) }));
6
- return (_jsx(Popover, { ...other, content: content, children: children }));
7
- }
@@ -1,6 +0,0 @@
1
- import { ButtonProps } from '@blueprintjs/core';
2
- interface FilterButtonProps extends Pick<ButtonProps, 'onClick' | 'title' | 'disabled' | 'active'> {
3
- title: string;
4
- }
5
- export declare function FilterButton(props: FilterButtonProps): import("react/jsx-runtime").JSX.Element;
6
- export {};