nmrium 0.63.2 → 0.64.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 (160) hide show
  1. package/lib/component/1d/BrushTracker1D.d.ts.map +1 -1
  2. package/lib/component/1d/BrushTracker1D.js +8 -1
  3. package/lib/component/1d/BrushTracker1D.js.map +1 -1
  4. package/lib/component/1d/PredictionErrorsNotations.d.ts +2 -0
  5. package/lib/component/1d/PredictionErrorsNotations.d.ts.map +1 -0
  6. package/lib/component/1d/PredictionErrorsNotations.js +112 -0
  7. package/lib/component/1d/PredictionErrorsNotations.js.map +1 -0
  8. package/lib/component/1d/SVGContent1D.d.ts.map +1 -1
  9. package/lib/component/1d/SVGContent1D.js +2 -1
  10. package/lib/component/1d/SVGContent1D.js.map +1 -1
  11. package/lib/component/2d/ft/Contours.d.ts.map +1 -1
  12. package/lib/component/2d/ft/Contours.js +3 -4
  13. package/lib/component/2d/ft/Contours.js.map +1 -1
  14. package/lib/component/2d/utilities/extractSpectrumSignals.d.ts +5 -3
  15. package/lib/component/2d/utilities/extractSpectrumSignals.d.ts.map +1 -1
  16. package/lib/component/2d/utilities/extractSpectrumSignals.js +3 -3
  17. package/lib/component/2d/utilities/extractSpectrumSignals.js.map +1 -1
  18. package/lib/component/2d/zones/SignalsGuideLines.d.ts.map +1 -1
  19. package/lib/component/2d/zones/SignalsGuideLines.js +74 -6
  20. package/lib/component/2d/zones/SignalsGuideLines.js.map +1 -1
  21. package/lib/component/EventsTrackers/BrushTracker.d.ts.map +1 -1
  22. package/lib/component/EventsTrackers/BrushTracker.js +2 -2
  23. package/lib/component/EventsTrackers/BrushTracker.js.map +1 -1
  24. package/lib/component/assignment/AssignmentProvider.d.ts.map +1 -1
  25. package/lib/component/assignment/AssignmentProvider.js +2 -1
  26. package/lib/component/assignment/AssignmentProvider.js.map +1 -1
  27. package/lib/component/assignment/AssignmentsContext.d.ts +5 -2
  28. package/lib/component/assignment/AssignmentsContext.d.ts.map +1 -1
  29. package/lib/component/assignment/AssignmentsContext.js +2 -1
  30. package/lib/component/assignment/AssignmentsContext.js.map +1 -1
  31. package/lib/component/elements/SVGGroup.js +1 -1
  32. package/lib/component/elements/SVGGroup.js.map +1 -1
  33. package/lib/component/elements/Sections.d.ts +1 -0
  34. package/lib/component/elements/Sections.d.ts.map +1 -1
  35. package/lib/component/elements/Sections.js +42 -7
  36. package/lib/component/elements/Sections.js.map +1 -1
  37. package/lib/component/elements/pdnd.cjs +12 -0
  38. package/lib/component/elements/pdnd.cjs.map +1 -0
  39. package/lib/component/elements/pdnd.d.cts +2 -0
  40. package/lib/component/elements/pdnd.d.cts.map +1 -0
  41. package/lib/component/hooks/useToolsFunctions.js +1 -1
  42. package/lib/component/hooks/useToolsFunctions.js.map +1 -1
  43. package/lib/component/main/InnerNMRiumContents.d.ts.map +1 -1
  44. package/lib/component/main/InnerNMRiumContents.js +3 -1
  45. package/lib/component/main/InnerNMRiumContents.js.map +1 -1
  46. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.d.ts.map +1 -1
  47. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js +7 -4
  48. package/lib/component/modal/setting/settings-tabs/DatabasesTabContent.js.map +1 -1
  49. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +6 -5
  50. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js.map +1 -1
  51. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +1 -1
  52. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts.map +1 -1
  53. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +3 -2
  54. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js.map +1 -1
  55. package/lib/component/panels/MoleculesPanel/useAtomAssignment.d.ts.map +1 -1
  56. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +17 -9
  57. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js.map +1 -1
  58. package/lib/component/panels/Panels.d.ts +0 -4
  59. package/lib/component/panels/Panels.d.ts.map +1 -1
  60. package/lib/component/panels/Panels.js +8 -14
  61. package/lib/component/panels/Panels.js.map +1 -1
  62. package/lib/component/panels/RangesPanel/RangesHeader.d.ts.map +1 -1
  63. package/lib/component/panels/RangesPanel/RangesHeader.js +5 -8
  64. package/lib/component/panels/RangesPanel/RangesHeader.js.map +1 -1
  65. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.d.ts.map +1 -1
  66. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js +4 -1
  67. package/lib/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.js.map +1 -1
  68. package/lib/component/panels/extra/utilities/MultiplicityUtilities.d.ts +1 -1
  69. package/lib/component/panels/extra/utilities/MultiplicityUtilities.d.ts.map +1 -1
  70. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.d.ts.map +1 -1
  71. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js +7 -1
  72. package/lib/component/panels/filtersPanel/Filters/FiltersSectionsPanel.js.map +1 -1
  73. package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.d.ts +1 -1
  74. package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.d.ts.map +1 -1
  75. package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.js +15 -17
  76. package/lib/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.js.map +1 -1
  77. package/lib/component/panels/hooks/useTogglePanel.d.ts.map +1 -1
  78. package/lib/component/panels/hooks/useTogglePanel.js +4 -3
  79. package/lib/component/panels/hooks/useTogglePanel.js.map +1 -1
  80. package/lib/component/reducer/Reducer.d.ts.map +1 -1
  81. package/lib/component/reducer/Reducer.js +2 -0
  82. package/lib/component/reducer/Reducer.js.map +1 -1
  83. package/lib/component/reducer/actions/FiltersActions.d.ts +7 -2
  84. package/lib/component/reducer/actions/FiltersActions.d.ts.map +1 -1
  85. package/lib/component/reducer/actions/FiltersActions.js +56 -26
  86. package/lib/component/reducer/actions/FiltersActions.js.map +1 -1
  87. package/lib/component/reducer/actions/InsetActions.d.ts.map +1 -1
  88. package/lib/component/reducer/actions/InsetActions.js +1 -5
  89. package/lib/component/reducer/actions/InsetActions.js.map +1 -1
  90. package/lib/component/reducer/actions/RangesActions.d.ts +3 -1
  91. package/lib/component/reducer/actions/RangesActions.d.ts.map +1 -1
  92. package/lib/component/reducer/actions/RangesActions.js +7 -14
  93. package/lib/component/reducer/actions/RangesActions.js.map +1 -1
  94. package/lib/component/reducer/actions/ToolsActions.d.ts.map +1 -1
  95. package/lib/component/reducer/actions/ToolsActions.js +2 -2
  96. package/lib/component/reducer/actions/ToolsActions.js.map +1 -1
  97. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +3 -2
  98. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts.map +1 -1
  99. package/lib/component/reducer/helper/ZoomHistoryManager.js +17 -8
  100. package/lib/component/reducer/helper/ZoomHistoryManager.js.map +1 -1
  101. package/lib/component/reducer/preferences/actions/togglePanel.d.ts.map +1 -1
  102. package/lib/component/reducer/preferences/actions/togglePanel.js +11 -6
  103. package/lib/component/reducer/preferences/actions/togglePanel.js.map +1 -1
  104. package/lib/component/reducer/preferences/preferencesReducer.d.ts +3 -1
  105. package/lib/component/reducer/preferences/preferencesReducer.d.ts.map +1 -1
  106. package/lib/component/reducer/preferences/preferencesReducer.js.map +1 -1
  107. package/lib/component/workspaces/prediction.js +1 -1
  108. package/lib/component/workspaces/prediction.js.map +1 -1
  109. package/lib/data/PredictionManager.d.ts.map +1 -1
  110. package/lib/data/PredictionManager.js +1 -0
  111. package/lib/data/PredictionManager.js.map +1 -1
  112. package/lib/data/data2d/Spectrum2D/contours.d.ts.map +1 -1
  113. package/lib/data/data2d/Spectrum2D/contours.js +6 -4
  114. package/lib/data/data2d/Spectrum2D/contours.js.map +1 -1
  115. package/lib/data/data2d/Spectrum2D/initiateDatum2D.d.ts.map +1 -1
  116. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +22 -10
  117. package/lib/data/data2d/Spectrum2D/initiateDatum2D.js.map +1 -1
  118. package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts.map +1 -1
  119. package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts.map +1 -1
  120. package/lib/data/types/data1d/index.js +1 -1
  121. package/lib/data/types/data1d/index.js.map +1 -1
  122. package/lib/versionInfo.js +1 -1
  123. package/package.json +20 -19
  124. package/src/component/1d/BrushTracker1D.tsx +8 -1
  125. package/src/component/1d/PredictionErrorsNotations.tsx +209 -0
  126. package/src/component/1d/SVGContent1D.tsx +2 -0
  127. package/src/component/2d/ft/Contours.tsx +3 -11
  128. package/src/component/2d/utilities/extractSpectrumSignals.ts +12 -9
  129. package/src/component/2d/zones/SignalsGuideLines.tsx +107 -11
  130. package/src/component/EventsTrackers/BrushTracker.tsx +2 -3
  131. package/src/component/assignment/AssignmentProvider.tsx +2 -1
  132. package/src/component/assignment/AssignmentsContext.ts +7 -2
  133. package/src/component/elements/SVGGroup.tsx +2 -2
  134. package/src/component/elements/Sections.tsx +103 -19
  135. package/src/component/elements/pdnd.cts +9 -0
  136. package/src/component/hooks/useToolsFunctions.ts +1 -1
  137. package/src/component/main/InnerNMRiumContents.tsx +3 -1
  138. package/src/component/modal/setting/settings-tabs/DatabasesTabContent.tsx +12 -7
  139. package/src/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.tsx +11 -5
  140. package/src/component/panels/MoleculesPanel/MoleculePanelHeader.tsx +32 -32
  141. package/src/component/panels/MoleculesPanel/useAtomAssignment.tsx +29 -8
  142. package/src/component/panels/Panels.tsx +9 -24
  143. package/src/component/panels/RangesPanel/RangesHeader.tsx +14 -21
  144. package/src/component/panels/SpectraPanel/base/setting/Spectrum2DSetting.tsx +11 -1
  145. package/src/component/panels/filtersPanel/Filters/FiltersSectionsPanel.tsx +9 -0
  146. package/src/component/panels/filtersPanel/Filters/hooks/usePhaseCorrectionTwoDimensions.tsx +16 -18
  147. package/src/component/panels/hooks/useTogglePanel.ts +4 -3
  148. package/src/component/reducer/Reducer.ts +2 -0
  149. package/src/component/reducer/actions/FiltersActions.ts +86 -40
  150. package/src/component/reducer/actions/InsetActions.ts +1 -5
  151. package/src/component/reducer/actions/RangesActions.ts +10 -13
  152. package/src/component/reducer/actions/ToolsActions.ts +1 -2
  153. package/src/component/reducer/helper/ZoomHistoryManager.ts +20 -9
  154. package/src/component/reducer/preferences/actions/togglePanel.ts +10 -6
  155. package/src/component/reducer/preferences/preferencesReducer.ts +11 -1
  156. package/src/component/workspaces/prediction.ts +1 -1
  157. package/src/data/PredictionManager.ts +1 -0
  158. package/src/data/data2d/Spectrum2D/contours.ts +8 -4
  159. package/src/data/data2d/Spectrum2D/initiateDatum2D.ts +34 -16
  160. package/src/versionInfo.ts +1 -1
@@ -87,6 +87,7 @@ type DeleteSignalAction = ActionType<'DELETE_1D_SIGNAL', DeleteSignalProps>;
87
87
 
88
88
  interface UnlinkRangeProps {
89
89
  rangeKey?: string;
90
+ spectrumId?: string; // If not specified, the currently active spectrum will be used by default.
90
91
  signalIndex?: number;
91
92
  }
92
93
  type UnlinkRangeAction = ActionType<'UNLINK_RANGE', UnlinkRangeProps>;
@@ -95,6 +96,7 @@ type AssignRangeAction = ActionType<
95
96
  'ASSIGN_RANGE',
96
97
  {
97
98
  keys: TargetAssignKeys;
99
+ spectrumId?: string;
98
100
  } & Required<Pick<Range, 'diaIDs' | 'nbAtoms'>>
99
101
  >;
100
102
  type ResizeRangeAction = ActionType<
@@ -191,6 +193,7 @@ function getRangeByIndex(draft: Draft<State>, spectrumIndex, rangeID) {
191
193
  (range) => range.id === rangeID,
192
194
  );
193
195
  }
196
+
194
197
  function getRange(spectrum: Spectrum1D, rangeID: string) {
195
198
  return spectrum.ranges.values.findIndex((range) => range.id === rangeID);
196
199
  }
@@ -399,12 +402,9 @@ function handleDeleteSignal(draft: Draft<State>, action: DeleteSignalAction) {
399
402
  deleteSignal1D(draft, action.payload);
400
403
  }
401
404
 
402
- function unlinkRange(draft: Draft<State>, options?: UnlinkRangeProps) {
403
- const activeSpectrum = getActiveSpectrum(draft);
404
-
405
- if (!activeSpectrum) return null;
406
- const { index } = activeSpectrum;
407
- const spectrum = draft.data[index];
405
+ function unlinkRange(draft: Draft<State>, options: UnlinkRangeProps = {}) {
406
+ const { spectrumId } = options;
407
+ const spectrum = getSpectrum(draft, spectrumId);
408
408
 
409
409
  if (!isSpectrum1D(spectrum)) return;
410
410
 
@@ -412,7 +412,7 @@ function unlinkRange(draft: Draft<State>, options?: UnlinkRangeProps) {
412
412
  const ranges = spectrum.ranges.values;
413
413
 
414
414
  if (rangeKey) {
415
- const rangeIndex = getRangeByIndex(draft, index, rangeKey);
415
+ const rangeIndex = getRange(spectrum, rangeKey);
416
416
  const unlinkType = signalIndex === -1 ? 'range' : 'signal';
417
417
  ranges[rangeIndex] = unlink(ranges[rangeIndex], {
418
418
  unlinkType,
@@ -433,14 +433,11 @@ function handleUnlinkRange(draft: Draft<State>, action: UnlinkRangeAction) {
433
433
 
434
434
  //action
435
435
  function handleAssignRange(draft: Draft<State>, action: AssignRangeAction) {
436
- const activeSpectrum = getActiveSpectrum(draft);
437
- if (!activeSpectrum?.id) return;
438
- const { index } = activeSpectrum;
439
- const spectrum = draft.data[index];
436
+ const { keys, diaIDs, nbAtoms, spectrumId } = action.payload;
440
437
 
441
- if (!isSpectrum1D(spectrum)) return;
438
+ const spectrum = getSpectrum(draft, spectrumId);
442
439
 
443
- const { keys, diaIDs, nbAtoms } = action.payload;
440
+ if (!spectrum || !isSpectrum1D(spectrum)) return;
444
441
 
445
442
  if (keys.length === 1) {
446
443
  const [{ index }] = keys;
@@ -470,11 +470,10 @@ function handleZoom(draft: Draft<State>, action: ZoomAction) {
470
470
  function zoomOut(draft: Draft<State>, action: ZoomOutAction) {
471
471
  if (draft?.data.length > 0) {
472
472
  const { zoomType, trackID } = action?.payload || {};
473
- const { xDomain, yDomain } = draft.originDomain;
473
+ const { xDomain } = draft.originDomain;
474
474
  const zoomHistory = zoomHistoryManager(
475
475
  draft.zoom.history,
476
476
  draft.view.spectra.activeTab,
477
- { xDomain, yDomain },
478
477
  );
479
478
 
480
479
  if (draft.displayerMode === '1D') {
@@ -12,6 +12,7 @@ export type ZoomHistory = Record<string, HistoryItem[]>;
12
12
  interface BaseZoomHistoryManager {
13
13
  historyStack: HistoryItem[];
14
14
  push: (value: HistoryItem) => void;
15
+ setBase: (value: HistoryItem) => void;
15
16
  pop: () => HistoryItem;
16
17
  getLast: () => HistoryItem;
17
18
  }
@@ -22,19 +23,19 @@ interface ZoomHistoryManager extends BaseZoomHistoryManager {
22
23
  export default function zoomHistoryManager(
23
24
  zoomHistory: ZoomHistory,
24
25
  nucleus: string,
25
- baseZoom?: HistoryItem,
26
26
  ): ZoomHistoryManager {
27
27
  if (!zoomHistory[nucleus] && !Array.isArray(zoomHistory[nucleus])) {
28
28
  zoomHistory[nucleus] = [];
29
29
  }
30
30
  const history = zoomHistory[nucleus];
31
31
 
32
+ const setBase = prepareSetBase(history);
32
33
  const push = preparePush(history);
33
- const pop = preparePop(history, baseZoom);
34
+ const pop = preparePop(history);
34
35
  const getLast = prepareGetLast(history);
35
36
  const clear = () => (zoomHistory[nucleus] = []);
36
37
 
37
- return { historyStack: history, push, pop, getLast, clear };
38
+ return { historyStack: history, push, pop, getLast, clear, setBase };
38
39
  }
39
40
 
40
41
  function preparePush(historyStack) {
@@ -43,18 +44,26 @@ function preparePush(historyStack) {
43
44
  };
44
45
  }
45
46
 
46
- function popZoomHistory(historyStack, baseZoom?: HistoryItem) {
47
+ function prepareSetBase(historyStack) {
48
+ return (val: HistoryItem) => {
49
+ if (historyStack.length === 0) {
50
+ historyStack[0] = val;
51
+ }
52
+ };
53
+ }
54
+
55
+ function popZoomHistory(historyStack) {
47
56
  const val = historyStack.pop();
48
57
 
49
- if (val && historyStack.length === 0) {
50
- return baseZoom || null;
58
+ if (historyStack.length === 0) {
59
+ return null;
51
60
  }
52
61
 
53
62
  return val ? historyStack.at(-1) : null;
54
63
  }
55
64
 
56
- export function preparePop(historyStack, baseZoom?: HistoryItem) {
57
- return () => popZoomHistory(historyStack, baseZoom);
65
+ export function preparePop(historyStack) {
66
+ return () => popZoomHistory(historyStack);
58
67
  }
59
68
 
60
69
  function prepareGetLast(historyStack) {
@@ -74,9 +83,11 @@ export function addToBrushHistory(
74
83
 
75
84
  const brushHistory = zoomHistoryManager(
76
85
  draft.zoom.history,
77
-
78
86
  draft.view.spectra.activeTab,
79
87
  );
88
+
89
+ brushHistory.setBase({ xDomain: draft.xDomain, yDomain: draft.yDomain });
90
+
80
91
  switch (axis) {
81
92
  case 'XY':
82
93
  draft.xDomain = xDomain;
@@ -12,19 +12,23 @@ export function togglePanel(
12
12
  action: TogglePanelAction,
13
13
  ) {
14
14
  const currentWorkspacePreferences = getActiveWorkspace(draft);
15
- const { id } = action.payload || {};
15
+ const { id, options } = action.payload || {};
16
16
 
17
17
  if (!id) return;
18
18
 
19
19
  const panels = currentWorkspacePreferences.display.panels || {};
20
20
 
21
- const existingPanel: PanelPreferencesType = panels[id];
21
+ const existingPanel: PanelPreferencesType = { ...panels[id] };
22
22
 
23
+ for (const [key, value] of Object.entries(options)) {
24
+ if (value === undefined) {
25
+ existingPanel[key] = !existingPanel[key];
26
+ } else {
27
+ existingPanel[key] = value;
28
+ }
29
+ }
23
30
  currentWorkspacePreferences.display.panels = {
24
31
  ...panels,
25
- [id]: {
26
- ...existingPanel,
27
- display: existingPanel ? !existingPanel.display : true,
28
- },
32
+ [id]: existingPanel,
29
33
  };
30
34
  }
@@ -3,6 +3,7 @@ import type {
3
3
  ExportPreferences,
4
4
  ExportSettings,
5
5
  MultipleSpectraAnalysisPreferences,
6
+ PanelPreferencesType,
6
7
  PrintPageOptions,
7
8
  Workspace,
8
9
  WorkSpaceSource,
@@ -48,6 +49,7 @@ import { setWorkspace } from './actions/setWorkspace.js';
48
49
  import { toggleInformationBlock } from './actions/toggleInformationBlock.js';
49
50
  import { togglePanel } from './actions/togglePanel.js';
50
51
  import { mapWorkspaces } from './utilities/mapWorkspaces.js';
52
+ import type { FilterType } from '../../utility/filterType.js';
51
53
 
52
54
  const LOCAL_STORAGE_SETTINGS_KEY = 'nmr-general-settings';
53
55
 
@@ -148,7 +150,15 @@ export type ChangePeaksLabelPositionAction = ActionType<
148
150
  }
149
151
  >;
150
152
 
151
- export type TogglePanelAction = ActionType<'TOGGLE_PANEL', { id: string }>;
153
+ export type TogglePanelAction = ActionType<
154
+ 'TOGGLE_PANEL',
155
+ {
156
+ id: string;
157
+ options: Partial<
158
+ Record<keyof FilterType<Required<PanelPreferencesType>, boolean>, boolean>
159
+ >;
160
+ }
161
+ >;
152
162
 
153
163
  type PreferencesActions =
154
164
  | InitPreferencesAction
@@ -19,7 +19,7 @@ export const prediction: InnerWorkspace = {
19
19
  hideWorkspaces: true,
20
20
  },
21
21
  panels: {
22
- spectraPanel: { display: true, visible: true },
22
+ spectraPanel: { display: true, visible: true, open: false },
23
23
  rangesPanel: { display: true, visible: true },
24
24
  zonesPanel: { display: true, visible: true },
25
25
  predictionPanel: { display: true, visible: true, open: true },
@@ -80,6 +80,7 @@ export const FREQUENCIES: Array<{ value: number; label: string }> = [
80
80
  { value: 90, label: '90 MHz' },
81
81
  { value: 100, label: '100 MHz' },
82
82
  { value: 200, label: '200 MHz' },
83
+ { value: 250, label: '250 MHz' },
83
84
  { value: 300, label: '300 MHz' },
84
85
  { value: 400, label: '400 MHz' },
85
86
  { value: 500, label: '500 MHz' },
@@ -61,17 +61,21 @@ function getDefaultContoursLevel(spectrum: Spectrum2D, quadrant = 'rr') {
61
61
  Math.abs(quadrantData.minZ),
62
62
  Math.abs(quadrantData.maxZ),
63
63
  );
64
- const value = 3 * xMaxAbsoluteValue([positive, negative]);
65
- const minLevel = calculateValueOfLevel(value, max, true);
64
+
65
+ const minAbsPeakBase = 0.005 * max;
66
+ const minAllowed = 3 * xMaxAbsoluteValue([positive, negative]);
67
+
68
+ const minLevel = Math.max(minAbsPeakBase, minAllowed);
69
+ const minContourLevel = calculateValueOfLevel(minLevel, max, true);
66
70
 
67
71
  const defaultLevel: ContourOptions = {
68
72
  negative: {
69
73
  numberOfLayers: 10,
70
- contourLevels: [minLevel, 100],
74
+ contourLevels: [minContourLevel, 100],
71
75
  },
72
76
  positive: {
73
77
  numberOfLayers: 10,
74
- contourLevels: [minLevel, 100],
78
+ contourLevels: [minContourLevel, 100],
75
79
  },
76
80
  };
77
81
  return defaultLevel;
@@ -21,29 +21,19 @@ interface InitiateDatum2DOptions {
21
21
  colors?: SpectrumTwoDimensionsColor[];
22
22
  }
23
23
 
24
- export function initiateDatum2D(
25
- spectrum: any,
26
- options: InitiateDatum2DOptions = {},
27
- ): Spectrum2D {
28
- const { usedColors, colors } = options;
29
- const datum: any = { ...spectrum };
30
-
31
- datum.id = spectrum.id || crypto.randomUUID();
32
-
33
- datum.display = {
24
+ function initiateDisplay(spectrum: any, options: InitiateDatum2DOptions) {
25
+ return {
34
26
  isPositiveVisible: true,
35
27
  isNegativeVisible: true,
36
28
  isVisible: true,
37
- contourOptions:
38
- 'rr' in spectrum.data
39
- ? getDefaultContoursLevel(spectrum)
40
- : DEFAULT_CONTOURS_OPTIONS,
41
29
  dimension: 2,
42
30
  ...spectrum.display,
43
- ...get2DColor(spectrum, { usedColors, colors }),
31
+ ...get2DColor(spectrum, options),
44
32
  };
33
+ }
45
34
 
46
- datum.info = {
35
+ function initiateInfo(spectrum: any) {
36
+ return {
47
37
  nucleus: ['1H', '1H'],
48
38
  isFt: true,
49
39
  isFid: false,
@@ -51,6 +41,32 @@ export function initiateDatum2D(
51
41
  dimension: 2,
52
42
  ...spectrum.info,
53
43
  };
44
+ }
45
+ function initiateContoursLevels(spectrum: any) {
46
+ const {
47
+ display: { contourOptions },
48
+ data,
49
+ } = spectrum;
50
+
51
+ if (contourOptions) return contourOptions;
52
+
53
+ if ('rr' in data) return getDefaultContoursLevel(spectrum);
54
+
55
+ return DEFAULT_CONTOURS_OPTIONS;
56
+ }
57
+
58
+ export function initiateDatum2D(
59
+ spectrum: any,
60
+ options: InitiateDatum2DOptions = {},
61
+ ): Spectrum2D {
62
+ const { usedColors, colors } = options;
63
+ const datum: any = { ...spectrum };
64
+
65
+ datum.id = spectrum.id || crypto.randomUUID();
66
+
67
+ datum.display = initiateDisplay(spectrum, { usedColors, colors });
68
+
69
+ datum.info = initiateInfo(spectrum);
54
70
 
55
71
  datum.originalInfo = datum.info;
56
72
 
@@ -67,6 +83,8 @@ export function initiateDatum2D(
67
83
  //reapply filters after load the original data
68
84
  Filters2DManager.reapplyFilters(datum);
69
85
 
86
+ datum.display.contourOptions = initiateContoursLevels(datum);
87
+
70
88
  return datum;
71
89
  }
72
90
 
@@ -1 +1 @@
1
- export default { version: 'v0.63.2' };
1
+ export default { version: 'v0.64.0' };