nmrium 0.45.0 → 0.46.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.
- package/lib/component/1d/tool/PeakPointer.js +6 -16
- package/lib/component/1d/utilities/scale.js +13 -8
- package/lib/component/1d-2d/components/SpectrumInfoBlock.js +15 -4
- package/lib/component/elements/ContextMenuBluePrint.d.ts +16 -0
- package/lib/component/elements/ContextMenuBluePrint.js +20 -0
- package/lib/component/elements/DropdownMenu.d.ts +9 -0
- package/lib/component/elements/DropdownMenu.js +7 -0
- package/lib/component/elements/Header.d.ts +1 -1
- package/lib/component/elements/Header.js +4 -6
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.d.ts +2 -2
- package/lib/component/elements/ReactTable/Elements/ReactTableRow.js +2 -2
- package/lib/component/elements/ReactTable/ReactTable.d.ts +5 -5
- package/lib/component/elements/Select.js +11 -4
- package/lib/component/header/Header.js +3 -4
- package/lib/component/hooks/useActiveSpectrumIntegralsViewState.js +3 -1
- package/lib/component/hooks/useActiveSpectrumPeaksViewState.js +3 -1
- package/lib/component/hooks/useActiveSpectrumRangesViewState.js +3 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +6 -2
- package/lib/component/hooks/useActiveSpectrumZonesViewState.js +3 -1
- package/lib/component/hooks/useCheckToolsVisibility.d.ts +1 -1
- package/lib/component/hooks/useSaveSettings.js +1 -1
- package/lib/component/hooks/useSpectrum.js +1 -1
- package/lib/component/hooks/useToolsFunctions.js +2 -2
- package/lib/component/modal/MoleculeStructureEditorModal.d.ts +0 -8
- package/lib/component/modal/MoleculeStructureEditorModal.js +31 -8
- package/lib/component/modal/MultipletAnalysisModal.d.ts +1 -2
- package/lib/component/modal/PredictSpectraModal.js +3 -2
- package/lib/component/modal/aboutUs/AboutUsModal.js +1 -5
- package/lib/component/modal/editRange/forms/components/AddSignalFormTab.js +1 -0
- package/lib/component/modal/editRange/forms/validation/EditRangeValidation.js +4 -1
- package/lib/component/modal/metaImportation/MetaImportationModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +1 -1
- package/lib/component/modal/setting/settings-tabs/InfoBlockTabContent.js +1 -1
- package/lib/component/modal/setting/settingsValidation.js +3 -1
- package/lib/component/panels/MatrixGenerationPanel/FiltersOptions.js +7 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +7 -14
- package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -2
- package/lib/component/panels/RangesPanel/RangesTable.d.ts +2 -2
- package/lib/component/panels/RangesPanel/RangesTableRow.d.ts +2 -2
- package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -3
- package/lib/component/panels/SpectrumsPanel/SpectraTable.d.ts +1 -2
- package/lib/component/panels/SpectrumsPanel/SpectraTable.js +15 -18
- package/lib/component/panels/SummaryPanel/utilities/Utilities.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/ZonesTableRow.d.ts +2 -2
- package/lib/component/panels/ZonesPanel/ZonesTableRow.js +2 -2
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +1 -2
- package/lib/component/panels/filtersPanel/FiltersTable.js +1 -1
- package/lib/component/panels/multipleAnalysisPanel/preferences/index.js +6 -2
- package/lib/component/reducer/Reducer.d.ts +0 -4
- package/lib/component/reducer/actions/FiltersActions.d.ts +2 -1
- package/lib/component/reducer/actions/FiltersActions.js +1 -1
- package/lib/component/reducer/actions/MoleculeActions.d.ts +4 -1
- package/lib/component/reducer/actions/MoleculeActions.js +6 -2
- package/lib/component/reducer/actions/PeaksActions.js +4 -3
- package/lib/component/reducer/actions/SpectrumsActions.js +1 -0
- package/lib/component/reducer/actions/ToolsActions.js +8 -6
- package/lib/component/reducer/actions/utilities/deepReplaceDiaIDs.d.ts +3 -0
- package/lib/component/reducer/actions/utilities/deepReplaceDiaIDs.js +24 -0
- package/lib/component/reducer/helper/Zoom1DManager.js +1 -1
- package/lib/component/reducer/helper/getActiveSpectra.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrum.js +1 -1
- package/lib/component/reducer/preferences/panelsPreferencesDefaultValues.js +1 -1
- package/lib/component/toolbar/BasicToolBar.js +53 -34
- package/lib/component/toolbar/FunctionToolBar.js +102 -9
- package/lib/component/toolbar/ToolBar.js +1 -1
- package/lib/component/utility/getClosePeak.d.ts +10 -0
- package/lib/component/utility/getClosePeak.js +15 -0
- package/lib/component/utility/maxAbsoluteValue.d.ts +3 -0
- package/lib/component/utility/maxAbsoluteValue.js +21 -0
- package/lib/data/data1d/Spectrum1D/index.d.ts +0 -1
- package/lib/data/data1d/Spectrum1D/index.js +0 -1
- package/lib/data/data1d/Spectrum1D/initiateDatum1D.js +2 -2
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +1 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectRange.js +1 -1
- package/lib/data/data2d/Spectrum2D/contours.js +2 -2
- package/lib/data/data2d/Spectrum2D/getMissingProjection.js +2 -2
- package/lib/data/data2d/Spectrum2D/getSlice.js +3 -3
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +1 -1
- package/lib/data/parseMeta/mapErrors.js +3 -1
- package/lib/data/utilities/generateNumbersPowerOfX.js +1 -1
- package/lib/versionInfo.js +1 -1
- package/package.json +39 -38
- package/lib/component/elements/ToolbarMenu.d.ts +0 -18
- package/lib/component/elements/ToolbarMenu.js +0 -102
- package/lib/component/elements/toggle/ToggleButton.d.ts +0 -13
- package/lib/component/elements/toggle/ToggleButton.js +0 -24
- package/lib/component/elements/toggle/ToggleButtonGroup.d.ts +0 -8
- package/lib/component/elements/toggle/ToggleButtonGroup.js +0 -48
- package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.d.ts +0 -17
- package/lib/data/data1d/Spectrum1D/peaks/lookupPeak.js +0 -18
- package/lib/data/data2d/Processing2D.d.ts +0 -32
- package/lib/data/data2d/Processing2D.js +0 -130
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function deepReplaceDiaIDs(data, mappings) {
|
|
2
|
+
for (const key in data) {
|
|
3
|
+
if (key !== 'diaIDs') {
|
|
4
|
+
if (typeof data[key] === 'object' && !ArrayBuffer.isView(data[key])) {
|
|
5
|
+
deepReplaceDiaIDs(data[key], mappings);
|
|
6
|
+
}
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
if (!Array.isArray(data[key])) {
|
|
10
|
+
throw new Error('diaIDs must be an array');
|
|
11
|
+
}
|
|
12
|
+
const diaIDs = data[key];
|
|
13
|
+
for (let i = 0; i < diaIDs.length; i++) {
|
|
14
|
+
const diaID = diaIDs[i];
|
|
15
|
+
if (typeof diaID !== 'string') {
|
|
16
|
+
throw new Error('diaID must be a string');
|
|
17
|
+
}
|
|
18
|
+
const newDiaID = mappings[diaID];
|
|
19
|
+
if (newDiaID) {
|
|
20
|
+
diaIDs[i] = newDiaID;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -31,7 +31,7 @@ function setZoom(draft, options = {}) {
|
|
|
31
31
|
]);
|
|
32
32
|
const [min, max] = shareYDomain ? yDomain : yDomains[id];
|
|
33
33
|
const maxPoint = Math.max(Math.abs(max), Math.abs(min));
|
|
34
|
-
const scalePoint = maxPoint === max ? 0 : min;
|
|
34
|
+
const scalePoint = maxPoint === Math.abs(max) ? 0 : min;
|
|
35
35
|
const t = zoomIdentity
|
|
36
36
|
.translate(0, Math.sign(scalePoint) >= 0
|
|
37
37
|
? _scale(scalePoint)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export function getActiveSpectra(state) {
|
|
2
2
|
const { activeSpectra, activeTab } = state.view.spectra;
|
|
3
|
-
|
|
3
|
+
const spectra = activeSpectra?.[activeTab]?.filter((spectrum) => spectrum?.selected);
|
|
4
|
+
return Array.isArray(spectra) && spectra.length > 0 ? spectra : null;
|
|
4
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function getActiveSpectrum(state) {
|
|
2
2
|
const { activeSpectra, activeTab } = state.view.spectra;
|
|
3
3
|
const spectra = activeSpectra[activeTab];
|
|
4
|
-
if (spectra?.length === 1) {
|
|
4
|
+
if (spectra?.length === 1 && spectra[0]?.selected) {
|
|
5
5
|
return spectra[0];
|
|
6
6
|
}
|
|
7
7
|
return null;
|
|
@@ -95,7 +95,7 @@ const getRangeDefaultValues = (nucleus) => {
|
|
|
95
95
|
deltaPPM: { show: true, format: '0.00' },
|
|
96
96
|
deltaHz: { show: false, format: '0.00' },
|
|
97
97
|
coupling: { show: true, format: '0.00' },
|
|
98
|
-
jGraphTolerance: nucleus === '1H' ? 0.2 : nucleus === '13C' ? 2 : 0,
|
|
98
|
+
jGraphTolerance: nucleus === '1H' ? 0.2 : nucleus === '13C' ? 2 : 0, //J Graph tolerance for: 1H: 0.2Hz 13C: 2Hz
|
|
99
99
|
showKind: true,
|
|
100
100
|
showMultiplicity: true,
|
|
101
101
|
showAssignment: true,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { SvgNmrRealImag, SvgNmrOverlay3, SvgNmrOverlay3Aligned, SvgNmrAlignBottom, SvgNmrAlignCenter, } from 'cheminfo-font';
|
|
3
3
|
import { Fragment, useCallback, memo } from 'react';
|
|
4
4
|
import { FaDownload, FaFileDownload, FaFileImage, FaCopy, FaFileExport, FaFile, FaFileImport, } from 'react-icons/fa';
|
|
5
5
|
import { Toolbar, useOnOff } from 'react-science/ui';
|
|
6
6
|
import { useChartData } from '../context/ChartContext';
|
|
7
7
|
import { useLoader } from '../context/LoaderContext';
|
|
8
|
-
import
|
|
8
|
+
import { DropdownMenu } from '../elements/DropdownMenu';
|
|
9
9
|
import { useModal } from '../elements/popup/Modal';
|
|
10
10
|
import useCheckExperimentalFeature from '../hooks/useCheckExperimentalFeature';
|
|
11
11
|
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
@@ -16,58 +16,79 @@ import { useVerticalAlign } from '../hooks/useVerticalAlign';
|
|
|
16
16
|
import ImportPublicationStringModal from '../modal/ImportPublicationStringModal';
|
|
17
17
|
import { LoadJCAMPModal } from '../modal/LoadJCAMPModal';
|
|
18
18
|
import { useMetaInformationImportationModal } from '../modal/metaImportation/index';
|
|
19
|
+
import { options } from './ToolTypes';
|
|
19
20
|
const IMPORT_MENU = [
|
|
20
21
|
{
|
|
21
|
-
id: 'importFile',
|
|
22
22
|
icon: _jsx(FaFile, {}),
|
|
23
|
-
|
|
23
|
+
text: 'Import from file system (Press Ctrl + O)',
|
|
24
|
+
data: {
|
|
25
|
+
id: 'importFile',
|
|
26
|
+
},
|
|
24
27
|
},
|
|
25
28
|
{
|
|
26
|
-
id: 'importJDX',
|
|
27
29
|
icon: _jsx(FaFile, {}),
|
|
28
|
-
|
|
30
|
+
text: 'Add JCAMP-DX from URL',
|
|
31
|
+
data: {
|
|
32
|
+
id: 'importJDX',
|
|
33
|
+
},
|
|
29
34
|
},
|
|
30
35
|
{
|
|
31
|
-
id: 'importPublicationString',
|
|
32
36
|
icon: _jsx(FaFile, {}),
|
|
33
|
-
|
|
37
|
+
text: 'Import from publication string',
|
|
38
|
+
data: {
|
|
39
|
+
id: 'importPublicationString',
|
|
40
|
+
},
|
|
34
41
|
},
|
|
35
42
|
{
|
|
36
|
-
id: 'importMetaInformation',
|
|
37
43
|
icon: _jsx(FaFile, {}),
|
|
38
|
-
|
|
44
|
+
text: 'Import meta information',
|
|
45
|
+
data: {
|
|
46
|
+
id: 'importMetaInformation',
|
|
47
|
+
},
|
|
39
48
|
},
|
|
40
49
|
];
|
|
41
50
|
const EXPORT_MENU = [
|
|
42
51
|
{
|
|
43
|
-
id: 'svg',
|
|
44
52
|
icon: _jsx(FaDownload, {}),
|
|
45
|
-
|
|
53
|
+
text: 'Export as SVG',
|
|
54
|
+
data: {
|
|
55
|
+
id: 'svg',
|
|
56
|
+
},
|
|
46
57
|
},
|
|
47
58
|
{
|
|
48
|
-
id: 'png',
|
|
49
59
|
icon: _jsx(FaFileImage, {}),
|
|
50
|
-
|
|
60
|
+
text: 'Export as PNG',
|
|
61
|
+
data: {
|
|
62
|
+
id: 'png',
|
|
63
|
+
},
|
|
51
64
|
},
|
|
52
65
|
{
|
|
53
|
-
id: 'json',
|
|
54
66
|
icon: _jsx(FaFileDownload, {}),
|
|
55
|
-
|
|
67
|
+
text: 'Save data ( Press Ctrl + S )',
|
|
68
|
+
data: {
|
|
69
|
+
id: 'json',
|
|
70
|
+
},
|
|
56
71
|
},
|
|
57
72
|
{
|
|
58
|
-
id: 'advance_save',
|
|
59
73
|
icon: _jsx(FaFileDownload, {}),
|
|
60
|
-
|
|
74
|
+
text: 'Save data as ( Press Ctrl + Shift + S )',
|
|
75
|
+
data: {
|
|
76
|
+
id: 'advance_save',
|
|
77
|
+
},
|
|
61
78
|
},
|
|
62
79
|
{
|
|
63
|
-
id: 'nmre',
|
|
64
80
|
icon: _jsx(FaFileDownload, {}),
|
|
65
|
-
|
|
81
|
+
text: 'Save NMRE data',
|
|
82
|
+
data: {
|
|
83
|
+
id: 'nmre',
|
|
84
|
+
},
|
|
66
85
|
},
|
|
67
86
|
{
|
|
68
|
-
id: 'copy',
|
|
69
87
|
icon: _jsx(FaCopy, {}),
|
|
70
|
-
|
|
88
|
+
text: 'Copy image to Clipboard ( Press Ctrl + C )',
|
|
89
|
+
data: {
|
|
90
|
+
id: 'copy',
|
|
91
|
+
},
|
|
71
92
|
},
|
|
72
93
|
];
|
|
73
94
|
function BasicToolBarInner({ verticalAlign, ftCounter, fidCounter, }) {
|
|
@@ -91,8 +112,8 @@ function BasicToolBarInner({ verticalAlign, ftCounter, fidCounter, }) {
|
|
|
91
112
|
const openImportPublicationStringModal = useCallback(() => {
|
|
92
113
|
modal.show(_jsx(ImportPublicationStringModal, { onClose: () => modal.close() }), {});
|
|
93
114
|
}, [modal]);
|
|
94
|
-
const importHandler = useCallback((
|
|
95
|
-
switch (id) {
|
|
115
|
+
const importHandler = useCallback((data) => {
|
|
116
|
+
switch (data?.id) {
|
|
96
117
|
case 'importFile':
|
|
97
118
|
openLoader();
|
|
98
119
|
break;
|
|
@@ -113,8 +134,8 @@ function BasicToolBarInner({ verticalAlign, ftCounter, fidCounter, }) {
|
|
|
113
134
|
openImportPublicationStringModal,
|
|
114
135
|
openMetaInformationModal,
|
|
115
136
|
]);
|
|
116
|
-
const exportHandler = useCallback((
|
|
117
|
-
switch (id) {
|
|
137
|
+
const exportHandler = useCallback((data) => {
|
|
138
|
+
switch (data?.id) {
|
|
118
139
|
case 'svg':
|
|
119
140
|
void saveAsSVGHandler();
|
|
120
141
|
break;
|
|
@@ -140,16 +161,14 @@ function BasicToolBarInner({ verticalAlign, ftCounter, fidCounter, }) {
|
|
|
140
161
|
saveAsHandler,
|
|
141
162
|
saveToClipboardHandler,
|
|
142
163
|
]);
|
|
143
|
-
return (_jsxs(Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen: isLoadModalOpened, onCloseDialog: closeLoadModal }), isButtonVisible('import') && (_jsx(
|
|
144
|
-
importHandler(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
return null;
|
|
149
|
-
}, items: exportMenu })), isButtonVisible('spectraStackAlignments') && ftCounter > 1 && (_jsx(Toolbar.Item, { id: "spectra-alignment", className: "cheminfo", title: "Spectra alignment ( Press s )", onClick: changeDisplayViewModeHandler, children: verticalAlign === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})) })), isButtonVisible('realImaginary') && (_jsx(Toolbar.Item, { id: "display", title: isRealSpectrumShown ? 'Display real ' : 'Display imaginary', onClick: changeSpectrumViewHandler, className: "cheminfo", children: _jsx(SvgNmrRealImag, {}) })), isButtonVisible('spectraCenterAlignments') &&
|
|
164
|
+
return (_jsxs(Fragment, { children: [_jsx(LoadJCAMPModal, { isOpen: isLoadModalOpened, onCloseDialog: closeLoadModal }), isButtonVisible('import') && (_jsx(DropdownMenu, { placement: "right", onSelect: (data) => {
|
|
165
|
+
importHandler(data);
|
|
166
|
+
}, options: importMenu, renderTarget: (targetProps) => (_jsx("div", { ...targetProps, style: { flex: 'none' }, children: _jsx(Toolbar.Item, { id: options.import.id, title: options.import.label, icon: _jsx(FaFileImport, {}) }) })) })), isButtonVisible('exportAs') && (_jsx(DropdownMenu, { onSelect: (data) => {
|
|
167
|
+
exportHandler(data);
|
|
168
|
+
}, placement: "right", options: exportMenu, renderTarget: (targetProps) => (_jsx("div", { ...targetProps, style: { flex: 'none' }, children: _jsx(Toolbar.Item, { id: options.exportAs.id, title: options.import.label, icon: _jsx(FaFileExport, {}) }) })) })), isButtonVisible('spectraStackAlignments') && ftCounter > 1 && (_jsx(Toolbar.Item, { id: "spectra-alignment", className: "cheminfo", title: "Spectra alignment ( Press s )", onClick: changeDisplayViewModeHandler, icon: verticalAlign === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})) })), isButtonVisible('realImaginary') && (_jsx(Toolbar.Item, { id: "display", title: isRealSpectrumShown ? 'Display real ' : 'Display imaginary', onClick: changeSpectrumViewHandler, className: "cheminfo", icon: _jsx(SvgNmrRealImag, {}) })), isButtonVisible('spectraCenterAlignments') &&
|
|
150
169
|
(ftCounter > 0 || fidCounter > 0) && (_jsx(Toolbar.Item, { id: "baseline-position", title: verticalAlign === 'bottom'
|
|
151
170
|
? 'Baseline center ( Press c )'
|
|
152
|
-
: 'Baseline bottom ( Press c )', onClick: alignSpectrumsVerticallyHandler, className: "cheminfo",
|
|
171
|
+
: 'Baseline bottom ( Press c )', onClick: alignSpectrumsVerticallyHandler, className: "cheminfo", icon: _jsx(_Fragment, { children: verticalAlign === 'bottom' ? (_jsx(SvgNmrAlignCenter, {})) : (_jsx(SvgNmrAlignBottom, {})) }) }))] }));
|
|
153
172
|
}
|
|
154
173
|
const MemoizedBasicToolBar = memo(BasicToolBarInner);
|
|
155
174
|
export default function BasicToolBar() {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { SvgNmrApodization, SvgNmrBaselineCorrection, SvgNmrFourierTransform, SvgNmrIntegrate, SvgNmrMultipleAnalysis, SvgNmrPeakPicking, SvgNmrPhaseCorrection, SvgNmrRangePicking, SvgNmrZeroFilling, } from 'cheminfo-font';
|
|
3
3
|
import { useState, useEffect, useCallback, memo } from 'react';
|
|
4
4
|
import { FaSearchPlus, FaExpand, FaDiceFour } from 'react-icons/fa';
|
|
5
5
|
import { Toolbar } from 'react-science/ui';
|
|
6
6
|
import { useChartData } from '../context/ChartContext';
|
|
7
7
|
import { useDispatch } from '../context/DispatchContext';
|
|
8
|
-
import
|
|
9
|
-
import ToggleButtonGroup from '../elements/toggle/ToggleButtonGroup';
|
|
10
|
-
import { useCheckToolsVisibility } from '../hooks/useCheckToolsVisibility';
|
|
8
|
+
import { useCheckToolsVisibility, } from '../hooks/useCheckToolsVisibility';
|
|
11
9
|
import useDatumWithSpectraStatistics from '../hooks/useDatumWithSpectraStatistics';
|
|
12
10
|
import useToolsFunctions from '../hooks/useToolsFunctions';
|
|
13
11
|
import { options } from './ToolTypes';
|
|
@@ -38,11 +36,106 @@ function FunctionToolBarInner({ defaultValue, ftCounter, }) {
|
|
|
38
36
|
type: 'APPLY_FFT_DIMENSION_2_FILTER',
|
|
39
37
|
});
|
|
40
38
|
}, [dispatch]);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
const toolItems = [
|
|
40
|
+
{
|
|
41
|
+
id: 'zoom',
|
|
42
|
+
label: options.zoom.label,
|
|
43
|
+
icon: _jsx(FaSearchPlus, {}),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'zoomOut',
|
|
47
|
+
label: 'Horizontal zoom out ( Press f ), Horizontal and Vertical zoom out, double click ( Press ff )',
|
|
48
|
+
onClick: handleFullZoomOut,
|
|
49
|
+
icon: _jsx(FaExpand, {}),
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'peakPicking',
|
|
53
|
+
label: `${options.peakPicking.label} ( Press p )`,
|
|
54
|
+
icon: _jsx(SvgNmrPeakPicking, {}),
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'integral',
|
|
58
|
+
label: `${options.integral.label} ( Press i )`,
|
|
59
|
+
icon: _jsx(SvgNmrIntegrate, {}),
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'zonePicking',
|
|
63
|
+
label: `${options.zonePicking.label} ( Press r )`,
|
|
64
|
+
icon: _jsx(FaDiceFour, {}),
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'slicing',
|
|
68
|
+
label: options.slicing.label,
|
|
69
|
+
icon: _jsx("p", { children: "Slic" }),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'rangePicking',
|
|
73
|
+
label: `${options.rangePicking.label} ( Press r )`,
|
|
74
|
+
icon: _jsx(SvgNmrRangePicking, {}),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'multipleSpectraAnalysis',
|
|
78
|
+
label: options.multipleSpectraAnalysis.label,
|
|
79
|
+
icon: _jsx(SvgNmrMultipleAnalysis, {}),
|
|
80
|
+
checkOptions: { checkSpectrumType: false },
|
|
81
|
+
condition: ftCounter > 1,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 'apodization',
|
|
85
|
+
label: `${options.apodization.label} (Press a)`,
|
|
86
|
+
icon: _jsx(SvgNmrApodization, {}),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'zeroFilling',
|
|
90
|
+
label: `${options.zeroFilling.label} ( Press z )`,
|
|
91
|
+
icon: _jsx(SvgNmrZeroFilling, {}),
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 'phaseCorrection',
|
|
95
|
+
label: `${options.phaseCorrection.label} ( Press a )`,
|
|
96
|
+
icon: _jsx(SvgNmrPhaseCorrection, {}),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'phaseCorrectionTwoDimensions',
|
|
100
|
+
label: `${options.phaseCorrectionTwoDimensions.label} ( Press a )`,
|
|
101
|
+
icon: _jsx(SvgNmrPhaseCorrection, {}),
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'baselineCorrection',
|
|
105
|
+
label: `${options.baselineCorrection.label} ( Press b )`,
|
|
106
|
+
icon: _jsx(SvgNmrBaselineCorrection, {}),
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: 'exclusionZones',
|
|
110
|
+
label: `${options.exclusionZones.label} ( Press e )`,
|
|
111
|
+
icon: _jsx(SvgNmrMultipleAnalysis, {}),
|
|
112
|
+
checkOptions: { checkSpectrumType: false },
|
|
113
|
+
condition: ftCounter > 0,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: 'fft',
|
|
117
|
+
label: `${options.fft.label} ( Press t )`,
|
|
118
|
+
onClick: handleOnFFTFilter,
|
|
119
|
+
icon: _jsx(SvgNmrFourierTransform, {}),
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'fftDimension1',
|
|
123
|
+
label: options.fftDimension1.label,
|
|
124
|
+
onClick: handleFFtDimension1Filter,
|
|
125
|
+
icon: _jsx(SvgNmrFourierTransform, {}),
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: 'fftDimension2',
|
|
129
|
+
label: options.fftDimension2.label,
|
|
130
|
+
onClick: handleFFtDimension2Filter,
|
|
131
|
+
icon: _jsx(SvgNmrFourierTransform, {}),
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
return (_jsx(_Fragment, { children: toolItems.map((item) => {
|
|
135
|
+
const { id, icon, label, checkOptions, onClick, condition } = item;
|
|
136
|
+
return (isButtonVisible(id, checkOptions) &&
|
|
137
|
+
(condition === undefined || condition) && (_jsx(Toolbar.Item, { onClick: onClick || (() => handleChange(id)), title: label, id: id, active: option === id, icon: icon }, id)));
|
|
138
|
+
}) }));
|
|
46
139
|
}
|
|
47
140
|
const MemoizedFunctionToolBar = memo(FunctionToolBarInner);
|
|
48
141
|
export default function FunctionToolBar({ defaultValue = options.zoom.id, }) {
|
|
@@ -5,7 +5,7 @@ import { useChartData } from '../context/ChartContext';
|
|
|
5
5
|
import BasicToolBar from './BasicToolBar';
|
|
6
6
|
import FunctionToolBar from './FunctionToolBar';
|
|
7
7
|
function ToolBarInner({ selectedTool }) {
|
|
8
|
-
return (_jsxs(Toolbar, {
|
|
8
|
+
return (_jsxs(Toolbar, { vertical: true, children: [_jsx(FunctionToolBar, { defaultValue: selectedTool }), _jsx(BasicToolBar, {})] }));
|
|
9
9
|
}
|
|
10
10
|
const MemoizedToolBar = memo(ToolBarInner);
|
|
11
11
|
export default function ToolBar() {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { get1DDataXY } from '../../data/data1d/Spectrum1D';
|
|
2
|
+
import { maxAbsoluteValue } from './maxAbsoluteValue';
|
|
3
|
+
export function getClosePeak(spectrum, lookRange) {
|
|
4
|
+
const { from, to } = lookRange;
|
|
5
|
+
const datum = get1DDataXY(spectrum);
|
|
6
|
+
const maxIndex = datum.x.findIndex((number) => number >= to) - 1;
|
|
7
|
+
const minIndex = datum.x.findIndex((number) => number >= from);
|
|
8
|
+
const yDataRange = datum.y.slice(minIndex, maxIndex);
|
|
9
|
+
if (!yDataRange || yDataRange.length === 0)
|
|
10
|
+
return null;
|
|
11
|
+
const y = maxAbsoluteValue(yDataRange);
|
|
12
|
+
const xIndex = minIndex + yDataRange.indexOf(y);
|
|
13
|
+
const x = datum.x[xIndex];
|
|
14
|
+
return { x, y };
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { xCheck, xGetFromToIndex, } from 'ml-spectra-processing';
|
|
2
|
+
//This function is an adapted version of the xMaxAbsoluteValue function from ml-spectra-processing. It identifies the maximum absolute value and returns the corresponding maximum value along with its sign
|
|
3
|
+
export function maxAbsoluteValue(array, options = {}) {
|
|
4
|
+
xCheck(array);
|
|
5
|
+
const { fromIndex, toIndex } = xGetFromToIndex(array, options);
|
|
6
|
+
let maxValue = array[fromIndex];
|
|
7
|
+
let sign = 1;
|
|
8
|
+
for (let i = fromIndex + 1; i <= toIndex; i++) {
|
|
9
|
+
if (array[i] >= 0) {
|
|
10
|
+
if (array[i] > maxValue) {
|
|
11
|
+
maxValue = array[i];
|
|
12
|
+
sign = 1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
else if (-array[i] > maxValue) {
|
|
16
|
+
maxValue = -array[i];
|
|
17
|
+
sign = Math.sign(array[i]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return maxValue * sign;
|
|
21
|
+
}
|
|
@@ -5,7 +5,6 @@ export { initiateDatum1D } from './initiateDatum1D';
|
|
|
5
5
|
export { changeIntegralsRelative } from './integrals/changeIntegralsRelative';
|
|
6
6
|
export { isSpectrum1D } from './isSpectrum1D';
|
|
7
7
|
export { autoPeakPicking } from './peaks/autoPeakPicking';
|
|
8
|
-
export { lookupPeak } from './peaks/lookupPeak';
|
|
9
8
|
export { optimizePeaks } from './peaks/optimizePeaks';
|
|
10
9
|
export { addRange } from './ranges/addRange';
|
|
11
10
|
export { changeRange } from './ranges/changeRange';
|
|
@@ -5,7 +5,6 @@ export { initiateDatum1D } from './initiateDatum1D';
|
|
|
5
5
|
export { changeIntegralsRelative } from './integrals/changeIntegralsRelative';
|
|
6
6
|
export { isSpectrum1D } from './isSpectrum1D';
|
|
7
7
|
export { autoPeakPicking } from './peaks/autoPeakPicking';
|
|
8
|
-
export { lookupPeak } from './peaks/lookupPeak';
|
|
9
8
|
export { optimizePeaks } from './peaks/optimizePeaks';
|
|
10
9
|
export { addRange } from './ranges/addRange';
|
|
11
10
|
export { changeRange } from './ranges/changeRange';
|
|
@@ -19,9 +19,9 @@ export function initiateDatum1D(spectrum, options = {}) {
|
|
|
19
19
|
...get1DColor(spectrum, usedColors),
|
|
20
20
|
};
|
|
21
21
|
spectrumObj.info = {
|
|
22
|
-
nucleus: '1H',
|
|
22
|
+
nucleus: '1H', // 1H, 13C, 19F, ...
|
|
23
23
|
isFid: false,
|
|
24
|
-
isComplex: false,
|
|
24
|
+
isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
|
|
25
25
|
dimension: 1,
|
|
26
26
|
...spectrum.info,
|
|
27
27
|
};
|
|
@@ -15,7 +15,7 @@ export function autoPeakPicking(spectrum, options) {
|
|
|
15
15
|
direction,
|
|
16
16
|
shape: { kind: 'lorentzian' },
|
|
17
17
|
noiseLevel: noise * noiseFactor,
|
|
18
|
-
minMaxRatio,
|
|
18
|
+
minMaxRatio, // Threshold to determine if a given peak should be considered as a noise
|
|
19
19
|
realTopDetection: true,
|
|
20
20
|
smoothY: false,
|
|
21
21
|
});
|
|
@@ -75,7 +75,7 @@ function getRange(min, max, length, exp) {
|
|
|
75
75
|
const factors = [];
|
|
76
76
|
factors[0] = 0;
|
|
77
77
|
for (let i = 1; i <= length; i++) {
|
|
78
|
-
factors[i] = factors[i - 1] + (exp - 1) /
|
|
78
|
+
factors[i] = factors[i - 1] + (exp - 1) / exp ** i;
|
|
79
79
|
}
|
|
80
80
|
const lastFactor = factors[length];
|
|
81
81
|
const result = new Array(length);
|
|
@@ -119,7 +119,7 @@ function getContours(zoomLevel, options) {
|
|
|
119
119
|
const sanResult = calculateSanPlot('2D', data);
|
|
120
120
|
const median = sanResult.positive;
|
|
121
121
|
const max = Math.max(Math.abs(data.maxZ), Math.abs(data.minZ));
|
|
122
|
-
let _range = getRange(median * 1 *
|
|
122
|
+
let _range = getRange(median * 1 * 2 ** zoomLevel, max, nbLevels, 2);
|
|
123
123
|
if (negative) {
|
|
124
124
|
_range = _range.map((value) => -value);
|
|
125
125
|
}
|
|
@@ -33,9 +33,9 @@ export function getMissingProjection(datum, nucleus, datumInfo, usedColors) {
|
|
|
33
33
|
if (index === -1)
|
|
34
34
|
index = 0;
|
|
35
35
|
const info = {
|
|
36
|
-
nucleus: datumInfo.nucleus[index],
|
|
36
|
+
nucleus: datumInfo.nucleus[index], // 1H, 13C, 19F, ...
|
|
37
37
|
isFid: false,
|
|
38
|
-
isComplex: false,
|
|
38
|
+
isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
|
|
39
39
|
dimension: 1,
|
|
40
40
|
};
|
|
41
41
|
const data = getProjection(datum, index);
|
|
@@ -2,7 +2,7 @@ import { zoneToX } from 'ml-spectra-processing';
|
|
|
2
2
|
import { initiateDatum1D } from '../../data1d/Spectrum1D';
|
|
3
3
|
const BASE_INFO = {
|
|
4
4
|
isFid: false,
|
|
5
|
-
isComplex: false,
|
|
5
|
+
isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
|
|
6
6
|
dimension: 1,
|
|
7
7
|
};
|
|
8
8
|
export function getSlice(spectrum, position, options = {}) {
|
|
@@ -21,11 +21,11 @@ export function getSlice(spectrum, position, options = {}) {
|
|
|
21
21
|
if (yIndex < 0 || yIndex >= real.z.length)
|
|
22
22
|
return;
|
|
23
23
|
const infoX = {
|
|
24
|
-
nucleus: info.nucleus[0],
|
|
24
|
+
nucleus: info.nucleus[0], // 1H, 13C, 19F, ...
|
|
25
25
|
...BASE_INFO,
|
|
26
26
|
};
|
|
27
27
|
const infoY = {
|
|
28
|
-
nucleus: info.nucleus[1],
|
|
28
|
+
nucleus: info.nucleus[1], // 1H, 13C, 19F, ...
|
|
29
29
|
...BASE_INFO,
|
|
30
30
|
};
|
|
31
31
|
const dataX = initiateData(real.minX, real.maxX, xLength);
|
|
@@ -21,7 +21,7 @@ export function initiateDatum2D(spectrum, usedColors = {}) {
|
|
|
21
21
|
nucleus: ['1H', '1H'],
|
|
22
22
|
isFt: true,
|
|
23
23
|
isFid: false,
|
|
24
|
-
isComplex: false,
|
|
24
|
+
isComplex: false, // if isComplex is true that mean it contains real/ imaginary x set, if not hid re/im button .
|
|
25
25
|
dimension: 2,
|
|
26
26
|
...spectrum.info,
|
|
27
27
|
};
|
package/lib/versionInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v0.
|
|
1
|
+
export default { version: 'v0.46.0' };
|