nmrium 0.19.1 → 0.21.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 (197) hide show
  1. package/lib/component/1d/Chart1D.js +3 -3
  2. package/lib/component/1d/ExclusionZoneAnnotation.d.ts +11 -0
  3. package/lib/component/1d/ExclusionZoneAnnotation.js +18 -0
  4. package/lib/component/1d/ExclusionZonesAnnotations.d.ts +3 -0
  5. package/lib/component/1d/ExclusionZonesAnnotations.js +28 -0
  6. package/lib/component/1d/Line.js +11 -23
  7. package/lib/component/1d/Viewer1D.js +36 -5
  8. package/lib/component/1d/ranges/Ranges.js +3 -3
  9. package/lib/component/1d/{BaseLineZones.d.ts → tool/BaseLineZones.d.ts} +0 -0
  10. package/lib/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
  11. package/lib/component/1d/utilities/useIntegralPath.js +9 -10
  12. package/lib/component/2d/Contours.js +12 -11
  13. package/lib/component/2d/Left1DChart.js +7 -9
  14. package/lib/component/2d/Top1DChart.js +7 -7
  15. package/lib/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
  16. package/lib/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
  17. package/lib/component/EventsTrackers/BrushTracker.js +2 -2
  18. package/lib/component/EventsTrackers/KeysListenerTracker.js +106 -80
  19. package/lib/component/NMRium.d.ts +8 -3
  20. package/lib/component/NMRium.js +36 -33
  21. package/lib/component/elements/NumberInput.d.ts +1 -2
  22. package/lib/component/elements/Tab/Tab.js +1 -0
  23. package/lib/component/header/Header.js +10 -3
  24. package/lib/component/hooks/useActiveSpectrumStyleOptions.d.ts +6 -0
  25. package/lib/component/hooks/useActiveSpectrumStyleOptions.js +15 -0
  26. package/lib/component/hooks/useCheckExperimentalFeature.js +2 -1
  27. package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -0
  28. package/lib/component/hooks/useCheckToolsVisibility.js +6 -0
  29. package/lib/component/hooks/useToolsFunctions.js +2 -1
  30. package/lib/component/hooks/useXYReduce.d.ts +2 -1
  31. package/lib/component/loader/DropZone.js +88 -88
  32. package/lib/component/modal/ModalStyle.js +5 -2
  33. package/lib/component/modal/MoleculeStructureEditorModal.js +3 -2
  34. package/lib/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
  35. package/lib/component/modal/changeSum/ChangeSumModal.js +4 -2
  36. package/lib/component/modal/setting/DisplayTabContent.js +1 -1
  37. package/lib/component/modal/setting/GeneralSettings.js +1 -5
  38. package/lib/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
  39. package/lib/component/panels/IntegralsPanel/IntegralsPreferences.js +4 -17
  40. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.d.ts +2 -0
  41. package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +35 -0
  42. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +49 -67
  43. package/lib/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
  44. package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -23
  45. package/lib/component/panels/Panels.js +10 -0
  46. package/lib/component/panels/PeaksPanel/PeaksPanel.js +0 -3
  47. package/lib/component/panels/PeaksPanel/PeaksPreferences.js +5 -14
  48. package/lib/component/panels/RangesPanel/RangesPanel.js +0 -3
  49. package/lib/component/panels/RangesPanel/RangesPreferences.js +5 -18
  50. package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
  51. package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
  52. package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/MoveLink.d.ts +5 -5
  53. package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
  54. package/lib/component/panels/SummaryPanel/Utilities.d.ts +7 -7
  55. package/lib/component/panels/ZonesPanel/ZonesPanel.js +0 -3
  56. package/lib/component/panels/ZonesPanel/ZonesPreferences.js +5 -18
  57. package/lib/component/panels/ZonesPanel/ZonesTable.js +9 -2
  58. package/lib/component/panels/databasePanel/DatabasePanel.js +0 -3
  59. package/lib/component/panels/databasePanel/DatabasePreferences.js +4 -17
  60. package/lib/component/reducer/Reducer.d.ts +11 -27
  61. package/lib/component/reducer/Reducer.js +4 -5
  62. package/lib/component/reducer/actions/CorrelationsActions.d.ts +7 -7
  63. package/lib/component/reducer/actions/CorrelationsActions.js +1 -1
  64. package/lib/component/reducer/actions/FiltersActions.d.ts +3 -1
  65. package/lib/component/reducer/actions/FiltersActions.js +60 -18
  66. package/lib/component/reducer/actions/LoadActions.js +2 -3
  67. package/lib/component/reducer/actions/MoleculeActions.js +2 -2
  68. package/lib/component/reducer/actions/PreferencesActions.js +4 -7
  69. package/lib/component/reducer/actions/RangesActions.js +1 -1
  70. package/lib/component/reducer/actions/ToolsActions.d.ts +1 -3
  71. package/lib/component/reducer/actions/ToolsActions.js +13 -59
  72. package/lib/component/reducer/helper/ZoomHistoryManager.d.ts +1 -0
  73. package/lib/component/reducer/helper/ZoomHistoryManager.js +2 -1
  74. package/lib/component/reducer/helper/getRange.d.ts +6 -1
  75. package/lib/component/reducer/helper/getRange.js +1 -1
  76. package/lib/component/reducer/preferencesReducer.d.ts +2 -0
  77. package/lib/component/reducer/preferencesReducer.js +76 -36
  78. package/lib/component/toolbar/FunctionToolBar.js +9 -15
  79. package/lib/component/toolbar/ToolTypes.js +3 -3
  80. package/lib/component/utility/PathBuilder.d.ts +7 -0
  81. package/lib/component/utility/PathBuilder.js +17 -0
  82. package/lib/component/utility/getSpectraByNucleus.d.ts +3 -0
  83. package/lib/component/utility/getSpectraByNucleus.js +4 -0
  84. package/lib/component/workspaces/Workspace.d.ts +6 -0
  85. package/lib/component/workspaces/Workspace.js +1 -0
  86. package/lib/component/workspaces/basic.d.ts +2 -0
  87. package/lib/component/workspaces/basic.js +45 -0
  88. package/lib/component/workspaces/exercise1D.d.ts +2 -0
  89. package/lib/component/workspaces/exercise1D.js +45 -0
  90. package/lib/component/workspaces/index.d.ts +6 -0
  91. package/lib/component/workspaces/index.js +4 -0
  92. package/lib/component/workspaces/process1D.d.ts +2 -0
  93. package/lib/component/workspaces/process1D.js +43 -0
  94. package/lib/data/Filters.d.ts +2 -1
  95. package/lib/data/Filters.js +2 -1
  96. package/lib/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
  97. package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
  98. package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
  99. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.d.ts +3 -2
  100. package/lib/data/data1d/Spectrum1D/ranges/detectSignal.js +23 -15
  101. package/lib/data/data1d/filter1d/exclusionZones.d.ts +16 -0
  102. package/lib/data/data1d/filter1d/exclusionZones.js +28 -0
  103. package/lib/data/migration/MigrationManager.js +3 -0
  104. package/lib/data/types/data1d/ExclusionZone.d.ts +5 -0
  105. package/lib/data/types/data1d/ExclusionZone.js +1 -0
  106. package/lib/versionInfo.js +1 -1
  107. package/lib-cjs/component/1d/Chart1D.js +3 -3
  108. package/lib-cjs/component/1d/ExclusionZoneAnnotation.js +23 -0
  109. package/lib-cjs/component/1d/ExclusionZonesAnnotations.js +52 -0
  110. package/lib-cjs/component/1d/Line.js +11 -23
  111. package/lib-cjs/component/1d/Viewer1D.js +36 -5
  112. package/lib-cjs/component/1d/ranges/Ranges.js +1 -1
  113. package/lib-cjs/component/1d/{BaseLineZones.js → tool/BaseLineZones.js} +5 -5
  114. package/lib-cjs/component/1d/utilities/useIntegralPath.js +9 -10
  115. package/lib-cjs/component/2d/Contours.js +12 -11
  116. package/lib-cjs/component/2d/Left1DChart.js +7 -9
  117. package/lib-cjs/component/2d/Top1DChart.js +7 -7
  118. package/lib-cjs/component/2d/tools/slicing/HorizontalSliceChart.js +7 -7
  119. package/lib-cjs/component/2d/tools/slicing/VerticalSliceChart.js +7 -9
  120. package/lib-cjs/component/EventsTrackers/BrushTracker.js +2 -2
  121. package/lib-cjs/component/EventsTrackers/KeysListenerTracker.js +106 -80
  122. package/lib-cjs/component/NMRium.js +37 -34
  123. package/lib-cjs/component/elements/Tab/Tab.js +1 -0
  124. package/lib-cjs/component/header/Header.js +10 -3
  125. package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +21 -0
  126. package/lib-cjs/component/hooks/useCheckExperimentalFeature.js +5 -1
  127. package/lib-cjs/component/hooks/useCheckToolsVisibility.js +13 -0
  128. package/lib-cjs/component/hooks/useToolsFunctions.js +2 -1
  129. package/lib-cjs/component/loader/DropZone.js +88 -88
  130. package/lib-cjs/component/modal/ModalStyle.js +5 -2
  131. package/lib-cjs/component/modal/MoleculeStructureEditorModal.js +3 -2
  132. package/lib-cjs/component/modal/MultipleSpectraFiltersModal/index.js +10 -1
  133. package/lib-cjs/component/modal/changeSum/ChangeSumModal.js +4 -2
  134. package/lib-cjs/component/modal/setting/DisplayTabContent.js +1 -1
  135. package/lib-cjs/component/modal/setting/GeneralSettings.js +1 -5
  136. package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +0 -3
  137. package/lib-cjs/component/panels/IntegralsPanel/IntegralsPreferences.js +3 -16
  138. package/lib-cjs/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +40 -0
  139. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +48 -66
  140. package/lib-cjs/component/panels/MoleculesPanel/useAtomAssignment.js +3 -8
  141. package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -22
  142. package/lib-cjs/component/panels/Panels.js +10 -0
  143. package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +0 -3
  144. package/lib-cjs/component/panels/PeaksPanel/PeaksPreferences.js +4 -13
  145. package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +0 -3
  146. package/lib-cjs/component/panels/RangesPanel/RangesPreferences.js +4 -17
  147. package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +13 -3
  148. package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DHistogram.js +1 -1
  149. package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +0 -3
  150. package/lib-cjs/component/panels/ZonesPanel/ZonesPreferences.js +4 -17
  151. package/lib-cjs/component/panels/ZonesPanel/ZonesTable.js +8 -1
  152. package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +0 -3
  153. package/lib-cjs/component/panels/databasePanel/DatabasePreferences.js +3 -16
  154. package/lib-cjs/component/reducer/Reducer.js +4 -5
  155. package/lib-cjs/component/reducer/actions/FiltersActions.js +62 -18
  156. package/lib-cjs/component/reducer/actions/LoadActions.js +2 -3
  157. package/lib-cjs/component/reducer/actions/MoleculeActions.js +2 -2
  158. package/lib-cjs/component/reducer/actions/PreferencesActions.js +4 -7
  159. package/lib-cjs/component/reducer/actions/RangesActions.js +1 -1
  160. package/lib-cjs/component/reducer/actions/ToolsActions.js +13 -61
  161. package/lib-cjs/component/reducer/helper/ZoomHistoryManager.js +2 -1
  162. package/lib-cjs/component/reducer/helper/getRange.js +1 -1
  163. package/lib-cjs/component/reducer/preferencesReducer.js +75 -35
  164. package/lib-cjs/component/toolbar/FunctionToolBar.js +9 -15
  165. package/lib-cjs/component/toolbar/ToolTypes.js +3 -3
  166. package/lib-cjs/component/utility/PathBuilder.js +21 -0
  167. package/lib-cjs/component/utility/getSpectraByNucleus.js +11 -0
  168. package/lib-cjs/component/workspaces/Workspace.js +2 -0
  169. package/lib-cjs/component/workspaces/basic.js +48 -0
  170. package/lib-cjs/component/workspaces/exercise1D.js +48 -0
  171. package/lib-cjs/component/workspaces/index.js +6 -0
  172. package/lib-cjs/component/workspaces/process1D.js +46 -0
  173. package/lib-cjs/data/Filters.js +3 -1
  174. package/lib-cjs/data/data1d/Spectrum1D/ranges/addRange.js +5 -2
  175. package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +6 -1
  176. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectRange.js +0 -1
  177. package/lib-cjs/data/data1d/Spectrum1D/ranges/detectSignal.js +24 -15
  178. package/lib-cjs/data/data1d/filter1d/exclusionZones.js +34 -0
  179. package/lib-cjs/data/migration/MigrationManager.js +3 -0
  180. package/lib-cjs/data/types/data1d/ExclusionZone.js +2 -0
  181. package/lib-cjs/versionInfo.js +1 -1
  182. package/package.json +28 -29
  183. package/lib/component/1d/ExclusionZone.d.ts +0 -8
  184. package/lib/component/1d/ExclusionZone.js +0 -30
  185. package/lib/component/1d/ExclusionZones.d.ts +0 -2
  186. package/lib/component/1d/ExclusionZones.js +0 -10
  187. package/lib/component/nmriumMode/basic.d.ts +0 -38
  188. package/lib/component/nmriumMode/basic.js +0 -37
  189. package/lib/component/nmriumMode/exercise1D.d.ts +0 -38
  190. package/lib/component/nmriumMode/exercise1D.js +0 -37
  191. package/lib/component/nmriumMode/process1D.d.ts +0 -38
  192. package/lib/component/nmriumMode/process1D.js +0 -37
  193. package/lib-cjs/component/1d/ExclusionZone.js +0 -32
  194. package/lib-cjs/component/1d/ExclusionZones.js +0 -16
  195. package/lib-cjs/component/nmriumMode/basic.js +0 -39
  196. package/lib-cjs/component/nmriumMode/exercise1D.js +0 -39
  197. package/lib-cjs/component/nmriumMode/process1D.js +0 -39
@@ -44,7 +44,7 @@ export const options = {
44
44
  },
45
45
  rangesPicking: {
46
46
  id: 'rangesPicking',
47
- label: 'Ranges Picking ( Press r )',
47
+ label: 'Ranges Picking',
48
48
  hasOptionPanel: true,
49
49
  isFilter: false,
50
50
  },
@@ -56,13 +56,13 @@ export const options = {
56
56
  },
57
57
  phaseCorrection: {
58
58
  id: Filters.phaseCorrection.id,
59
- label: `${Filters.phaseCorrection.name} ( Press a )`,
59
+ label: Filters.phaseCorrection.name,
60
60
  hasOptionPanel: true,
61
61
  isFilter: true,
62
62
  },
63
63
  baseLineCorrection: {
64
64
  id: 'baseLineCorrection',
65
- label: 'baseline correction ( Press b )',
65
+ label: 'baseline correction',
66
66
  hasOptionPanel: true,
67
67
  isFilter: true,
68
68
  },
@@ -0,0 +1,7 @@
1
+ export declare class PathBuilder {
2
+ private array;
3
+ moveTo(x: number, y: number): void;
4
+ lineTo(x: number, y: number): void;
5
+ closePath(): void;
6
+ toString(): string;
7
+ }
@@ -0,0 +1,17 @@
1
+ export class PathBuilder {
2
+ constructor() {
3
+ this.array = [];
4
+ }
5
+ moveTo(x, y) {
6
+ this.array.push(`M ${x} ${y}`);
7
+ }
8
+ lineTo(x, y) {
9
+ this.array.push(`L ${x} ${y}`);
10
+ }
11
+ closePath() {
12
+ this.array.push('Z');
13
+ }
14
+ toString() {
15
+ return this.array.join(' ');
16
+ }
17
+ }
@@ -0,0 +1,3 @@
1
+ import { Datum1D } from '../../data/types/data1d/Datum1D';
2
+ import { Datum2D } from '../../data/types/data2d';
3
+ export declare function getSpectraByNucleus(nucleus: string, data: (Datum1D | Datum2D)[]): (Datum1D | Datum2D)[];
@@ -0,0 +1,4 @@
1
+ import nucleusToString from './nucleusToString';
2
+ export function getSpectraByNucleus(nucleus, data) {
3
+ return data.filter((spectrum) => nucleusToString(spectrum.info.nucleus) === nucleus);
4
+ }
@@ -0,0 +1,6 @@
1
+ import { NMRiumPreferences } from '../NMRium';
2
+ export interface Workspace {
3
+ version: number;
4
+ label: string;
5
+ display: NMRiumPreferences;
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Workspace } from './Workspace';
2
+ export declare const basic: Workspace;
@@ -0,0 +1,45 @@
1
+ export const basic = {
2
+ version: 1,
3
+ label: 'Default Mode',
4
+ display: {
5
+ general: {
6
+ disableMultipletAnalysis: false,
7
+ hideSetSumFromMolecule: false,
8
+ hideGeneralSettings: false,
9
+ hideExperimentalFeatures: false,
10
+ },
11
+ panels: {
12
+ hideSpectraPanel: false,
13
+ hideInformationPanel: false,
14
+ hidePeaksPanel: false,
15
+ hideIntegralsPanel: false,
16
+ hideRangesPanel: false,
17
+ hideStructuresPanel: false,
18
+ hideFiltersPanel: false,
19
+ hideZonesPanel: false,
20
+ hideSummaryPanel: false,
21
+ hideMultipleSpectraAnalysisPanel: false,
22
+ hideDatabasePanel: false,
23
+ },
24
+ toolBarButtons: {
25
+ hideZoomTool: false,
26
+ hideZoomOutTool: false,
27
+ hideImport: false,
28
+ hideExportAs: false,
29
+ hideSpectraStackAlignments: false,
30
+ hideSpectraCenterAlignments: false,
31
+ hideRealImaginary: false,
32
+ hidePeakTool: false,
33
+ hideIntegralTool: false,
34
+ hideZonePickingTool: false,
35
+ hideSlicingTool: false,
36
+ hideAutoRangesTool: false,
37
+ hideZeroFillingTool: false,
38
+ hidePhaseCorrectionTool: false,
39
+ hideBaseLineCorrectionTool: false,
40
+ hideFFTTool: false,
41
+ hideMultipleSpectraAnalysisTool: false,
42
+ hideExclusionZonesTool: false,
43
+ },
44
+ },
45
+ };
@@ -0,0 +1,2 @@
1
+ import { Workspace } from './Workspace';
2
+ export declare const exercise1D: Workspace;
@@ -0,0 +1,45 @@
1
+ export const exercise1D = {
2
+ version: 1,
3
+ label: 'Exercise 1D Mode',
4
+ display: {
5
+ general: {
6
+ disableMultipletAnalysis: true,
7
+ hideSetSumFromMolecule: true,
8
+ hideGeneralSettings: true,
9
+ hideExperimentalFeatures: true,
10
+ },
11
+ panels: {
12
+ hideSpectraPanel: false,
13
+ hideInformationPanel: true,
14
+ hidePeaksPanel: true,
15
+ hideIntegralsPanel: false,
16
+ hideRangesPanel: true,
17
+ hideStructuresPanel: true,
18
+ hideFiltersPanel: true,
19
+ hideZonesPanel: true,
20
+ hideSummaryPanel: true,
21
+ hideMultipleSpectraAnalysisPanel: true,
22
+ hideDatabasePanel: true,
23
+ },
24
+ toolBarButtons: {
25
+ hideZoomTool: false,
26
+ hideZoomOutTool: false,
27
+ hideImport: true,
28
+ hideExportAs: true,
29
+ hideSpectraStackAlignments: false,
30
+ hideSpectraCenterAlignments: false,
31
+ hideRealImaginary: true,
32
+ hidePeakTool: false,
33
+ hideIntegralTool: false,
34
+ hideZonePickingTool: true,
35
+ hideSlicingTool: true,
36
+ hideAutoRangesTool: true,
37
+ hideZeroFillingTool: true,
38
+ hidePhaseCorrectionTool: true,
39
+ hideBaseLineCorrectionTool: true,
40
+ hideFFTTool: true,
41
+ hideMultipleSpectraAnalysisTool: true,
42
+ hideExclusionZonesTool: true,
43
+ },
44
+ },
45
+ };
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ exercise1D: import("./Workspace").Workspace;
3
+ basic: import("./Workspace").Workspace;
4
+ process1D: import("./Workspace").Workspace;
5
+ };
6
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import { basic } from './basic';
2
+ import { exercise1D } from './exercise1D';
3
+ import { process1D } from './process1D';
4
+ export default { exercise1D, basic, process1D };
@@ -0,0 +1,2 @@
1
+ import { Workspace } from './Workspace';
2
+ export declare const process1D: Workspace;
@@ -0,0 +1,43 @@
1
+ export const process1D = {
2
+ version: 1,
3
+ label: 'Process 1D Mode',
4
+ display: {
5
+ general: {
6
+ disableMultipletAnalysis: true,
7
+ hideSetSumFromMolecule: false,
8
+ hideGeneralSettings: false,
9
+ hideExperimentalFeatures: false,
10
+ },
11
+ panels: {
12
+ hideSpectraPanel: false,
13
+ hideInformationPanel: false,
14
+ hidePeaksPanel: false,
15
+ hideIntegralsPanel: false,
16
+ hideRangesPanel: true,
17
+ hideStructuresPanel: false,
18
+ hideFiltersPanel: false,
19
+ hideZonesPanel: true,
20
+ hideSummaryPanel: true,
21
+ hideMultipleSpectraAnalysisPanel: true,
22
+ hideDatabasePanel: false,
23
+ },
24
+ toolBarButtons: {
25
+ hideZoomTool: false,
26
+ hideZoomOutTool: false,
27
+ hideImport: true,
28
+ hideExportAs: true,
29
+ hideSpectraStackAlignments: false,
30
+ hideSpectraCenterAlignments: false,
31
+ hideRealImaginary: false,
32
+ hidePeakTool: false,
33
+ hideIntegralTool: false,
34
+ hideAutoRangesTool: true,
35
+ hideZeroFillingTool: false,
36
+ hidePhaseCorrectionTool: false,
37
+ hideBaseLineCorrectionTool: false,
38
+ hideFFTTool: false,
39
+ hideMultipleSpectraAnalysisTool: true,
40
+ hideExclusionZonesTool: true,
41
+ },
42
+ },
43
+ };
@@ -4,6 +4,7 @@ import * as baselineCorrection from './data1d/filter1d/baselineCorrection';
4
4
  import * as centerMean from './data1d/filter1d/centerMean';
5
5
  import * as digitalFilter from './data1d/filter1d/digitalFilter';
6
6
  import * as equallySpaced from './data1d/filter1d/equallySpaced';
7
+ import * as exclusionZones from './data1d/filter1d/exclusionZones';
7
8
  import * as fft from './data1d/filter1d/fft';
8
9
  import * as fromTo from './data1d/filter1d/fromTo';
9
10
  import * as lineBroadening from './data1d/filter1d/lineBroadening';
@@ -14,4 +15,4 @@ import * as standardDeviation from './data1d/filter1d/standardDeviation';
14
15
  import * as zeroFilling from './data1d/filter1d/zeroFilling';
15
16
  import * as shift2DX from './data2d/filter2d/shiftX';
16
17
  import * as shift2DY from './data2d/filter2d/shiftY';
17
- export { absolute, baselineCorrection, lineBroadening, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, shift2DX, shift2DY, };
18
+ export { absolute, baselineCorrection, lineBroadening, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
@@ -4,6 +4,7 @@ import * as baselineCorrection from './data1d/filter1d/baselineCorrection';
4
4
  import * as centerMean from './data1d/filter1d/centerMean';
5
5
  import * as digitalFilter from './data1d/filter1d/digitalFilter';
6
6
  import * as equallySpaced from './data1d/filter1d/equallySpaced';
7
+ import * as exclusionZones from './data1d/filter1d/exclusionZones';
7
8
  import * as fft from './data1d/filter1d/fft';
8
9
  import * as fromTo from './data1d/filter1d/fromTo';
9
10
  import * as lineBroadening from './data1d/filter1d/lineBroadening';
@@ -14,4 +15,4 @@ import * as standardDeviation from './data1d/filter1d/standardDeviation';
14
15
  import * as zeroFilling from './data1d/filter1d/zeroFilling';
15
16
  import * as shift2DX from './data2d/filter2d/shiftX';
16
17
  import * as shift2DY from './data2d/filter2d/shiftY';
17
- export { absolute, baselineCorrection, lineBroadening, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, shift2DX, shift2DY, };
18
+ export { absolute, baselineCorrection, lineBroadening, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
@@ -9,14 +9,17 @@ export function addRange(datum, options) {
9
9
  const { from, to, molecules, nucleus } = options;
10
10
  const { x, re } = datum.data;
11
11
  const absolute = xyIntegration({ x, y: re }, { from, to, reverse: true });
12
- const signals = detectSignal(x, re, from, to, datum.info.originFrequency);
12
+ // detectSignal use the advance multiplet-analysis that can crash if too many points
13
+ const signal = detectSignal(x, re, from, to, datum.info.originFrequency);
14
+ if (!signal)
15
+ return;
13
16
  try {
14
17
  const range = {
15
18
  id: generateID(),
16
19
  from,
17
20
  to,
18
21
  absolute,
19
- signals: [{ id: generateID(), ...signals }],
22
+ signals: [{ id: generateID(), ...signal }],
20
23
  kind: DatumKind.signal,
21
24
  integration: 0,
22
25
  };
@@ -30,12 +30,17 @@ export default function autoRangesDetection(datum1D, options = {}) {
30
30
  re = re.slice(windowFromIndex, windowToIndex);
31
31
  }
32
32
  if (originFrequency) {
33
- let ws = Math.max(Math.round(1 / originFrequency / (x[1] - x[0])), 5);
33
+ // we calculate the number of points per Hz
34
+ let pointsPerHz = 1 / originFrequency / (x[1] - x[0]);
35
+ // we can consider a peak with of 0.5 Hz for the windowSize
36
+ let ws = Math.max(Math.round(pointsPerHz / 2), 5);
34
37
  peakPickingOptions.sgOptions = {
35
38
  windowSize: ws - (ws % 2) + 1,
36
39
  polynomial: 3,
37
40
  };
38
41
  }
42
+ peakPickingOptions.smoothY = undefined;
43
+ peakPickingOptions.sgOptions = undefined;
39
44
  const ranges = xyAutoRangesPicking({ x, y: re }, {
40
45
  peakPicking: peakPickingOptions,
41
46
  ranges: rangesOptions,
@@ -5,7 +5,6 @@ export function detectRange(datum, options) {
5
5
  const { from, to } = options;
6
6
  const { x, re: y } = datum.data;
7
7
  const absolute = xyIntegration({ x, y }, { from, to, reverse: true });
8
- // @ts-expect-error Types will be fixed in ml-spectra-processing.
9
8
  const min = xyMinYPoint({ x, y }, { from, to }).y;
10
9
  const max = xyMaxYPoint({ x, y }, { from, to }).y;
11
10
  const shiftX = getShiftX(datum);
@@ -1,6 +1,7 @@
1
- export default function detectSignal(x: any, re: any, from: any, to: any, frequency: any): {
1
+ export declare const MAX_LENGTH = 2048;
2
+ export default function detectSignal(x: Float64Array, re: Float64Array, from: any, to: any, frequency: any): {
2
3
  multiplicity: any;
3
4
  kind: string;
4
5
  delta: any;
5
6
  js: any;
6
- };
7
+ } | undefined;
@@ -1,23 +1,31 @@
1
1
  import { xGetFromToIndex } from 'ml-spectra-processing';
2
2
  import { analyseMultiplet } from 'multiplet-analysis';
3
+ export const MAX_LENGTH = 2048;
3
4
  export default function detectSignal(x, re, from, to, frequency) {
4
5
  const { fromIndex, toIndex } = xGetFromToIndex(x, {
5
6
  from: from,
6
7
  to: to,
7
8
  });
8
- const data = {
9
- x: x.slice(fromIndex, toIndex),
10
- y: re.slice(fromIndex, toIndex),
11
- };
12
- const result = analyseMultiplet(data, {
13
- frequency: frequency,
14
- takeBestPartMultiplet: true,
15
- symmetrizeEachStep: true,
16
- });
17
- return {
18
- multiplicity: result.js.map((j) => j.multiplicity).join(''),
19
- kind: 'signal',
20
- delta: result.chemShift,
21
- js: result.js,
22
- };
9
+ if (toIndex - fromIndex <= MAX_LENGTH) {
10
+ const data = {
11
+ x: x.subarray(fromIndex, toIndex),
12
+ y: re.subarray(fromIndex, toIndex),
13
+ };
14
+ const result = analyseMultiplet(data, {
15
+ frequency: frequency,
16
+ takeBestPartMultiplet: true,
17
+ symmetrizeEachStep: true,
18
+ });
19
+ if (result && result.chemShift === undefined)
20
+ return;
21
+ return {
22
+ multiplicity: result.js.map((j) => j.multiplicity).join(''),
23
+ kind: 'signal',
24
+ delta: result.chemShift,
25
+ js: result.js,
26
+ };
27
+ }
28
+ else {
29
+ throw new Error(`length of signal should not exceed ${MAX_LENGTH} points`);
30
+ }
23
31
  }
@@ -0,0 +1,16 @@
1
+ import { Datum1D } from '../../types/data1d/Datum1D';
2
+ export declare const id = "exclusionZones";
3
+ export declare const name = "Exclusion Zones";
4
+ /**
5
+ *
6
+ * @param {Datum1d} datum1d
7
+ */
8
+ export declare function apply(datum1D: Datum1D, zones?: never[]): void;
9
+ export declare function isApplicable(datum1D: Datum1D): boolean;
10
+ export declare function reduce(previousValue: any, newValue: any): {
11
+ once: boolean;
12
+ reduce: {
13
+ from: number;
14
+ to: number;
15
+ }[];
16
+ };
@@ -0,0 +1,28 @@
1
+ import { xySetYValue, zonesNormalize } from 'ml-spectra-processing';
2
+ export const id = 'exclusionZones';
3
+ export const name = 'Exclusion Zones';
4
+ /**
5
+ *
6
+ * @param {Datum1d} datum1d
7
+ */
8
+ export function apply(datum1D, zones = []) {
9
+ if (!isApplicable(datum1D)) {
10
+ throw new Error('Exclusion Zones filter not applicable on this data');
11
+ }
12
+ const { x, re, im } = datum1D.data;
13
+ datum1D.data.re = xySetYValue({ x, y: re }, { zones }).y;
14
+ datum1D.data.im = (im
15
+ ? xySetYValue({ x, y: re }, { zones })
16
+ : im);
17
+ }
18
+ export function isApplicable(datum1D) {
19
+ if (datum1D.info.isComplex && datum1D.info.isFt)
20
+ return true;
21
+ return false;
22
+ }
23
+ export function reduce(previousValue, newValue) {
24
+ return {
25
+ once: true,
26
+ reduce: zonesNormalize(previousValue.concat(newValue)),
27
+ };
28
+ }
@@ -10,5 +10,8 @@ export function migrate(data) {
10
10
  migrateToVersion2,
11
11
  ];
12
12
  let index = data?.version || 0;
13
+ if (index > CURRENT_EXPORT_VERSION) {
14
+ throw new Error('This file can not be imported using the current NMRium version, Please move to the new one !!! ');
15
+ }
13
16
  return migrationPipe(migrationsFuncs.slice(index))(data);
14
17
  }
@@ -0,0 +1,5 @@
1
+ export interface ExclusionZone {
2
+ id: string;
3
+ from: number;
4
+ to: number;
5
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- export default { version: 'v0.19.1' };
1
+ export default { version: 'v0.21.0' };
@@ -4,8 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const jsx_runtime_1 = require("react/jsx-runtime");
7
- const BaseLineZones_1 = __importDefault(require("./BaseLineZones"));
8
- const ExclusionZones_1 = __importDefault(require("./ExclusionZones"));
7
+ const ExclusionZonesAnnotations_1 = __importDefault(require("./ExclusionZonesAnnotations"));
9
8
  const IntegralsSeries_1 = __importDefault(require("./IntegralsSeries"));
10
9
  const LinesSeries_1 = __importDefault(require("./LinesSeries"));
11
10
  const PeakAnnotations_1 = __importDefault(require("./PeakAnnotations"));
@@ -14,7 +13,8 @@ const XAxis_1 = __importDefault(require("./XAxis"));
14
13
  const JGraph_1 = __importDefault(require("./jCouplingGraph/JGraph"));
15
14
  const MultiAnalysisRanges_1 = __importDefault(require("./multiAnalysis/MultiAnalysisRanges"));
16
15
  const Ranges_1 = __importDefault(require("./ranges/Ranges"));
16
+ const BaseLineZones_1 = __importDefault(require("./tool/BaseLineZones"));
17
17
  function Chart1D({ mode, width, height, margin, displayerKey }) {
18
- return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: `${displayerKey}clip-chart-1d`, children: (0, jsx_runtime_1.jsx)("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(LinesSeries_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(IntegralsSeries_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(PeakAnnotations_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(Ranges_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(JGraph_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(MultiAnalysisRanges_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(BaseLineZones_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(ExclusionZones_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(ResurrectedDatabaseRanges_1.default, {}, void 0), (0, jsx_runtime_1.jsx)("g", { className: "container", style: { pointerEvents: 'none' }, children: (0, jsx_runtime_1.jsx)(XAxis_1.default, { showGrid: true, mode: mode }, void 0) }, void 0)] }, void 0));
18
+ return ((0, jsx_runtime_1.jsxs)("svg", { viewBox: `0 0 ${width} ${height}`, width: width, height: height, id: "nmrSVG", children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: `${displayerKey}clip-chart-1d`, children: (0, jsx_runtime_1.jsx)("rect", { width: `${width - margin.left - margin.right}`, height: `${height}`, x: `${margin.left}`, y: `${0}` }, void 0) }, void 0) }, void 0), (0, jsx_runtime_1.jsx)(LinesSeries_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(IntegralsSeries_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(PeakAnnotations_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(Ranges_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(JGraph_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(MultiAnalysisRanges_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(BaseLineZones_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(ExclusionZonesAnnotations_1.default, {}, void 0), (0, jsx_runtime_1.jsx)(ResurrectedDatabaseRanges_1.default, {}, void 0), (0, jsx_runtime_1.jsx)("g", { className: "container", style: { pointerEvents: 'none' }, children: (0, jsx_runtime_1.jsx)(XAxis_1.default, { showGrid: true, mode: mode }, void 0) }, void 0)] }, void 0));
19
19
  }
20
20
  exports.default = Chart1D;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const react_1 = require("react");
8
+ const ScaleContext_1 = require("../context/ScaleContext");
9
+ const highlight_1 = require("../highlight");
10
+ const useActiveSpectrumStyleOptions_1 = __importDefault(require("../hooks/useActiveSpectrumStyleOptions"));
11
+ function ExclusionZoneAnnotation({ zone, color, vAlign, spectrumID, }) {
12
+ const { scaleX, scaleY } = (0, ScaleContext_1.useScaleChecked)();
13
+ const highlight = (0, highlight_1.useHighlight)([zone.id], {
14
+ type: highlight_1.HighlightedSource.EXCLUSION_ZONE,
15
+ extra: { id: zone.id, spectrumID },
16
+ });
17
+ const { opacity } = (0, useActiveSpectrumStyleOptions_1.default)(spectrumID);
18
+ return ((0, jsx_runtime_1.jsx)("g", { transform: `translate(${scaleX()(zone.to)},0)`, children: (0, jsx_runtime_1.jsx)("rect", { x: "0", transform: `translate(0,${scaleY()(0) - (vAlign + 5)})`, width: `${scaleX()(zone.from) - scaleX()(zone.to)}`, height: "10px", style: {
19
+ fill: highlight.isActive ? '#ff6f0057' : color,
20
+ opacity,
21
+ }, ...highlight.onHover }, void 0) }, zone.id));
22
+ }
23
+ exports.default = (0, react_1.memo)(ExclusionZoneAnnotation);
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
21
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ const jsx_runtime_1 = require("react/jsx-runtime");
26
+ const react_1 = require("react");
27
+ const Filters = __importStar(require("../../data/Filters"));
28
+ const ChartContext_1 = require("../context/ChartContext");
29
+ const useSpectraPerNucleus_1 = __importDefault(require("../hooks/useSpectraPerNucleus"));
30
+ const Constants_1 = require("../reducer/core/Constants");
31
+ const ExclusionZoneAnnotation_1 = __importDefault(require("./ExclusionZoneAnnotation"));
32
+ const getVerticalShift_1 = __importDefault(require("./utilities/getVerticalShift"));
33
+ function ExclusionZonesAnnotationsInner({ displayerKey, xDomains, spectra, verticalAlign, }) {
34
+ return ((0, jsx_runtime_1.jsx)("g", { className: "spectrum-exclusion-zones-group", clipPath: `url(#${displayerKey}clip-chart-1d)`, children: spectra
35
+ .filter((d) => d.display.isVisible === true && xDomains[d.id])
36
+ .map((d, index) => getExclusionZones(d).map((zone) => {
37
+ return ((0, jsx_runtime_1.jsx)(ExclusionZoneAnnotation_1.default, { spectrumID: d.id, vAlign: (0, getVerticalShift_1.default)(verticalAlign, { index }), zone: zone, color: d.display.color }, zone.id));
38
+ })) }, void 0));
39
+ }
40
+ const MemoizedPeakAnnotations = (0, react_1.memo)(ExclusionZonesAnnotationsInner);
41
+ function ExclusionZonesAnnotations() {
42
+ const { displayerKey, xDomains, displayerMode, verticalAlign } = (0, ChartContext_1.useChartData)();
43
+ const spectra = (0, useSpectraPerNucleus_1.default)();
44
+ if (displayerMode !== Constants_1.DISPLAYER_MODE.DM_1D)
45
+ return null;
46
+ return ((0, jsx_runtime_1.jsx)(MemoizedPeakAnnotations, { spectra: spectra, displayerKey: displayerKey, xDomains: xDomains, verticalAlign: verticalAlign }, void 0));
47
+ }
48
+ exports.default = ExclusionZonesAnnotations;
49
+ function getExclusionZones(data) {
50
+ return (data.filters.find((filter) => filter.name === Filters.exclusionZones.id)
51
+ ?.value || []);
52
+ }
@@ -23,51 +23,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
25
  const jsx_runtime_1 = require("react/jsx-runtime");
26
- const get_1 = __importDefault(require("lodash/get"));
27
26
  const react_1 = require("react");
28
27
  const ChartContext_1 = require("../context/ChartContext");
29
- const PreferencesContext_1 = require("../context/PreferencesContext");
30
28
  const ScaleContext_1 = require("../context/ScaleContext");
29
+ const useActiveSpectrumStyleOptions_1 = __importDefault(require("../hooks/useActiveSpectrumStyleOptions"));
31
30
  const useXYReduce_1 = __importStar(require("../hooks/useXYReduce"));
31
+ const PathBuilder_1 = require("../utility/PathBuilder");
32
32
  const getVerticalShift_1 = __importDefault(require("./utilities/getVerticalShift"));
33
33
  function Line({ data, id, display, index }) {
34
- const { activeSpectrum, verticalAlign } = (0, ChartContext_1.useChartData)();
35
- const preferences = (0, PreferencesContext_1.usePreferences)();
34
+ const { verticalAlign } = (0, ChartContext_1.useChartData)();
36
35
  const { scaleX, scaleY } = (0, ScaleContext_1.useScaleChecked)();
37
36
  const xyReduce = (0, useXYReduce_1.default)(useXYReduce_1.XYReducerDomainAxis.XAxis);
38
- const isActive = (0, react_1.useMemo)(() => {
39
- return activeSpectrum === null
40
- ? true
41
- : id === activeSpectrum.id
42
- ? true
43
- : false;
44
- }, [activeSpectrum, id]);
37
+ const { opacity } = (0, useActiveSpectrumStyleOptions_1.default)(id);
45
38
  const vAlign = (0, react_1.useMemo)(() => {
46
39
  return (0, getVerticalShift_1.default)(verticalAlign, { index });
47
40
  }, [index, verticalAlign]);
48
41
  const paths = (0, react_1.useMemo)(() => {
49
42
  const _scaleX = scaleX();
50
43
  const _scaleY = scaleY(id);
44
+ const pathBuilder = new PathBuilder_1.PathBuilder();
51
45
  if (data?.x && data?.y && _scaleX(0)) {
52
46
  const pathPoints = xyReduce(data);
53
- // TODO: use d3-path and remove type assertion.
54
- let path = `M ${_scaleX(pathPoints.x[0])} ${_scaleY(pathPoints.y[0])} `;
55
- path += pathPoints.x
56
- .slice(1)
57
- .reduce((accumulator, point, i) => {
58
- accumulator += ` L ${_scaleX(point)} ${_scaleY(pathPoints.y[i + 1])}`;
59
- return accumulator;
60
- }, '');
61
- return path;
47
+ pathBuilder.moveTo(_scaleX(pathPoints.x[0]), _scaleY(pathPoints.y[0]));
48
+ for (let i = 1; i < pathPoints.x.length; i++) {
49
+ pathBuilder.lineTo(_scaleX(pathPoints.x[i]), _scaleY(pathPoints.y[i]));
50
+ }
51
+ return pathBuilder.toString();
62
52
  }
63
53
  else {
64
54
  return '';
65
55
  }
66
56
  }, [scaleX, scaleY, id, data, xyReduce]);
67
57
  return ((0, jsx_runtime_1.jsx)("path", { className: "line", "data-test-id": "spectrum-line", stroke: display.color, fill: "none", style: {
68
- opacity: isActive
69
- ? 1
70
- : (0, get_1.default)(preferences, 'controllers.dimmedSpectraTransparency', 0.1),
58
+ opacity,
71
59
  }, d: paths, transform: `translate(0,-${vAlign})` }, id));
72
60
  }
73
61
  exports.default = Line;