nmrium 0.31.0 → 0.33.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/Chart1D.js +1 -1
- package/lib/component/1d/FooterBanner.js +17 -10
- package/lib/component/1d/{Integral.d.ts → integral/Integral.d.ts} +0 -0
- package/lib/component/1d/{Integral.js → integral/Integral.js} +2 -2
- package/lib/component/1d/integral/IntegralIndicator.d.ts +9 -0
- package/lib/component/1d/integral/IntegralIndicator.js +27 -0
- package/lib/component/1d/{IntegralResizable.d.ts → integral/IntegralResizable.d.ts} +0 -0
- package/lib/component/1d/integral/IntegralResizable.js +69 -0
- package/lib/component/1d/{IntegralsSeries.d.ts → integral/IntegralsSeries.d.ts} +0 -0
- package/lib/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +3 -3
- package/lib/component/1d/ranges/Range.js +27 -50
- package/lib/component/1d/utilities/scale.js +2 -2
- package/lib/component/2d/Contours.js +61 -42
- package/lib/component/2d/Left1DChart.js +1 -1
- package/lib/component/2d/Top1DChart.js +1 -1
- package/lib/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib/component/NMRium.d.ts +1 -1
- package/lib/component/NMRium.js +1 -1
- package/lib/component/SplitPaneWrapper.js +1 -1
- package/lib/component/elements/EditableColumn.d.ts +3 -1
- package/lib/component/elements/EditableColumn.js +18 -3
- package/lib/component/elements/formik/FormikColorPicker.d.ts +0 -1
- package/lib/component/elements/formik/FormikColorPicker.js +5 -8
- package/lib/component/elements/formik/FormikInput.d.ts +0 -1
- package/lib/component/elements/formik/FormikInput.js +8 -19
- package/lib/component/elements/formik/FormikOnChange.d.ts +1 -1
- package/lib/component/elements/formik/FormikOnChange.js +13 -10
- package/lib/component/elements/formik/FormikSlider.d.ts +2 -4
- package/lib/component/elements/formik/FormikSlider.js +8 -11
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib/component/hooks/useExport.js +1 -1
- package/lib/component/loader/DropZone.js +9 -1
- package/lib/component/modal/ExportAsMatrixModal.js +1 -1
- package/lib/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
- package/lib/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +1 -1
- package/lib/component/panels/RangesPanel/RangesPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +1 -3
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.d.ts +1 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
- package/lib/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +3 -26
- package/lib/component/panels/extra/preferences/ColumnsHelper.js +5 -2
- package/lib/component/reducer/Reducer.d.ts +20 -59
- package/lib/component/reducer/Reducer.js +24 -10
- package/lib/component/reducer/actions/DomainActions.js +3 -2
- package/lib/component/reducer/actions/FiltersActions.js +12 -3
- package/lib/component/reducer/actions/IntegralsActions.js +6 -5
- package/lib/component/reducer/actions/PeaksActions.js +7 -6
- package/lib/component/reducer/actions/PreferencesActions.js +18 -36
- package/lib/component/reducer/actions/RangesActions.d.ts +1 -1
- package/lib/component/reducer/actions/RangesActions.js +20 -16
- package/lib/component/reducer/actions/SpectrumsActions.js +13 -6
- package/lib/component/reducer/actions/ToolsActions.d.ts +1 -1
- package/lib/component/reducer/actions/ToolsActions.js +15 -28
- package/lib/component/reducer/actions/ZonesActions.js +9 -8
- package/lib/component/reducer/core/Constants.js +1 -1
- package/lib/component/reducer/helper/getActiveSpectrum.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrum.js +4 -0
- package/lib/component/reducer/preferences/preferencesReducer.d.ts +2 -2
- package/lib/component/toolbar/BasicToolBar.js +8 -7
- package/lib/component/utility/FileUtility.d.ts +1 -8
- package/lib/component/utility/FileUtility.js +2 -17
- package/lib/component/utility/{Export.d.ts → export.d.ts} +0 -0
- package/lib/component/utility/{Export.js → export.js} +27 -44
- package/lib/component/utility/formatNumber.d.ts +6 -1
- package/lib/component/utility/formatNumber.js +4 -3
- package/lib/component/workspaces/Workspace.d.ts +1 -1
- package/lib/component/workspaces/exercise.js +4 -4
- package/lib/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib/data/Filters.d.ts +1 -2
- package/lib/data/Filters.js +1 -2
- package/lib/data/SpectraManager.d.ts +1 -2
- package/lib/data/SpectraManager.js +22 -55
- package/lib/data/data1d/filter1d/fft.js +21 -4
- package/lib/data/data1d/filter1d/phaseCorrection.js +11 -5
- package/lib/data/data2d/Processing2D.js +3 -2
- package/lib/data/data2d/Spectrum2D/contours.d.ts +40 -0
- package/lib/data/data2d/Spectrum2D/contours.js +132 -0
- package/lib/data/data2d/Spectrum2D/initiateDatum2D.js +2 -3
- package/lib/data/types/common/Source.d.ts +1 -0
- package/lib/data/types/data2d/Data2D.d.ts +2 -0
- package/lib/data/types/data2d/Datum2D.d.ts +0 -1
- package/lib/data/utilities/calculateSanPlot.d.ts +8 -0
- package/lib/data/utilities/calculateSanPlot.js +31 -0
- package/lib/types/NMRiumGeneralPreferences.d.ts +2 -2
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/Chart1D.js +1 -1
- package/lib-cjs/component/1d/FooterBanner.js +16 -9
- package/lib-cjs/component/1d/{Integral.js → integral/Integral.js} +2 -2
- package/lib-cjs/component/1d/integral/IntegralIndicator.js +31 -0
- package/lib-cjs/component/1d/integral/IntegralResizable.js +74 -0
- package/lib-cjs/component/1d/{IntegralsSeries.js → integral/IntegralsSeries.js} +3 -3
- package/lib-cjs/component/1d/ranges/Range.js +27 -50
- package/lib-cjs/component/1d/utilities/scale.js +2 -2
- package/lib-cjs/component/2d/Contours.js +60 -41
- package/lib-cjs/component/2d/Left1DChart.js +1 -1
- package/lib-cjs/component/2d/Top1DChart.js +1 -1
- package/lib-cjs/component/EventsTrackers/BrushTracker.js +30 -21
- package/lib-cjs/component/NMRium.js +2 -2
- package/lib-cjs/component/SplitPaneWrapper.js +1 -1
- package/lib-cjs/component/elements/EditableColumn.js +18 -3
- package/lib-cjs/component/elements/formik/FormikColorPicker.js +4 -7
- package/lib-cjs/component/elements/formik/FormikInput.js +8 -19
- package/lib-cjs/component/elements/formik/FormikOnChange.js +13 -10
- package/lib-cjs/component/elements/formik/FormikSlider.js +7 -10
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +1 -1
- package/lib-cjs/component/hooks/useExport.js +6 -6
- package/lib-cjs/component/loader/DropZone.js +9 -1
- package/lib-cjs/component/modal/ExportAsMatrixModal.js +2 -2
- package/lib-cjs/component/modal/editRange/forms/components/SignalFormInfo.js +1 -1
- package/lib-cjs/component/modal/setting/GeneralTabContent.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculeHeader.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +4 -4
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +2 -2
- package/lib-cjs/component/panels/PeaksPanel/PeaksTable.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +2 -2
- package/lib-cjs/component/panels/RangesPanel/RangesTableRow.js +1 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +2 -2
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum1DSetting.js +2 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/Spectrum2DSetting.js +2 -1
- package/lib-cjs/component/panels/SpectrumsPanel/base/setting/processSnapPlot.js +2 -25
- package/lib-cjs/component/panels/extra/preferences/ColumnsHelper.js +5 -2
- package/lib-cjs/component/reducer/Reducer.js +23 -9
- package/lib-cjs/component/reducer/actions/DomainActions.js +3 -2
- package/lib-cjs/component/reducer/actions/FiltersActions.js +12 -3
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +6 -5
- package/lib-cjs/component/reducer/actions/PeaksActions.js +7 -6
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +18 -36
- package/lib-cjs/component/reducer/actions/RangesActions.js +20 -16
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +12 -5
- package/lib-cjs/component/reducer/actions/ToolsActions.js +15 -28
- package/lib-cjs/component/reducer/actions/ZonesActions.js +9 -8
- package/lib-cjs/component/reducer/core/Constants.js +1 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrum.js +8 -0
- package/lib-cjs/component/toolbar/BasicToolBar.js +7 -6
- package/lib-cjs/component/utility/FileUtility.js +2 -18
- package/lib-cjs/component/utility/{Export.js → export.js} +51 -45
- package/lib-cjs/component/utility/formatNumber.js +4 -3
- package/lib-cjs/component/workspaces/exercise.js +4 -4
- package/lib-cjs/component/workspaces/workspaceDefaultProperties.js +1 -1
- package/lib-cjs/data/Filters.js +1 -3
- package/lib-cjs/data/SpectraManager.js +23 -57
- package/lib-cjs/data/data1d/filter1d/fft.js +20 -3
- package/lib-cjs/data/data1d/filter1d/phaseCorrection.js +10 -4
- package/lib-cjs/data/data2d/Processing2D.js +3 -2
- package/lib-cjs/data/data2d/Spectrum2D/contours.js +138 -0
- package/lib-cjs/data/data2d/Spectrum2D/initiateDatum2D.js +2 -3
- package/lib-cjs/data/utilities/calculateSanPlot.js +35 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +21 -20
- package/lib/component/1d/IntegralResizable.js +0 -72
- package/lib/component/panels/RangesPanel/TableColumns/format.d.ts +0 -1
- package/lib/component/panels/RangesPanel/TableColumns/format.js +0 -8
- package/lib/data/data1d/Data1DManager.d.ts +0 -3
- package/lib/data/data1d/Data1DManager.js +0 -98
- package/lib/data/data1d/filter1d/absolute.d.ts +0 -13
- package/lib/data/data1d/filter1d/absolute.js +0 -26
- package/lib/data/data2d/Data2DManager.d.ts +0 -3
- package/lib/data/data2d/Data2DManager.js +0 -34
- package/lib/data/types/data2d/Contour.d.ts +0 -4
- package/lib/data/types/data2d/Contour.js +0 -1
- package/lib/data/types/data2d/Contours.d.ts +0 -2
- package/lib/data/types/data2d/Contours.js +0 -1
- package/lib-cjs/component/1d/IntegralResizable.js +0 -77
- package/lib-cjs/component/panels/RangesPanel/TableColumns/format.js +0 -14
- package/lib-cjs/data/data1d/Data1DManager.js +0 -104
- package/lib-cjs/data/data1d/filter1d/absolute.js +0 -32
- package/lib-cjs/data/data2d/Data2DManager.js +0 -40
- package/lib-cjs/data/types/data2d/Contour.js +0 -2
- package/lib-cjs/data/types/data2d/Contours.js +0 -2
|
@@ -11,7 +11,7 @@ declare function handleAddBaseLineZone(draft: Draft<State>, { from, to }: {
|
|
|
11
11
|
to: any;
|
|
12
12
|
}): void;
|
|
13
13
|
declare function handleDeleteBaseLineZone(draft: Draft<State>, id: any): void;
|
|
14
|
-
declare function handleToggleRealImaginaryVisibility(draft:
|
|
14
|
+
declare function handleToggleRealImaginaryVisibility(draft: Draft<State>): void;
|
|
15
15
|
declare function handleBrushEnd(draft: Draft<State>, action: any): void;
|
|
16
16
|
declare function setVerticalIndicatorXPosition(draft: Draft<State>, position: any): void;
|
|
17
17
|
declare function handleZoom(draft: Draft<State>, action: any): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { v4 } from '@lukeed/uuid';
|
|
2
2
|
import { original } from 'immer';
|
|
3
3
|
import { xFindClosestIndex } from 'ml-spectra-processing';
|
|
4
|
+
import { contoursManager } from '../../../data/data2d/Spectrum2D/contours';
|
|
4
5
|
import { getYScale, getXScale } from '../../1d/utilities/scale';
|
|
5
6
|
import { LAYOUT } from '../../2d/utilities/DimensionLayout';
|
|
6
7
|
import { get2DYScale } from '../../2d/utilities/scale';
|
|
@@ -10,7 +11,9 @@ import { rangeStateInit } from '../Reducer';
|
|
|
10
11
|
import { DISPLAYER_MODE, MARGIN } from '../core/Constants';
|
|
11
12
|
import { setZoom, wheelZoom, ZoomType } from '../helper/Zoom1DManager';
|
|
12
13
|
import zoomHistoryManager from '../helper/ZoomHistoryManager';
|
|
14
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
13
15
|
import { getActiveSpectrumOrFail } from '../helper/getActiveSpectrumOrFail';
|
|
16
|
+
import { getSpectrum } from '../helper/getSpectrum';
|
|
14
17
|
import { setDomain, setIntegralsYDomain, setMode, } from './DomainActions';
|
|
15
18
|
import { calculateBaseLineCorrection, resetSpectrumByFilter, setFilterChanges, } from './FiltersActions';
|
|
16
19
|
import { changeSpectrumVerticalAlignment } from './PreferencesActions';
|
|
@@ -112,10 +115,11 @@ function handleDeleteBaseLineZone(draft, id) {
|
|
|
112
115
|
calculateBaseLineCorrection(draft);
|
|
113
116
|
}
|
|
114
117
|
function handleToggleRealImaginaryVisibility(draft) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
119
|
+
if (activeSpectrum != null) {
|
|
120
|
+
const { index } = activeSpectrum;
|
|
121
|
+
const datum = draft.data[index];
|
|
122
|
+
datum.display.isRealSpectrumVisible = !datum.display.isRealSpectrumVisible;
|
|
119
123
|
setDomain(draft);
|
|
120
124
|
}
|
|
121
125
|
}
|
|
@@ -157,7 +161,7 @@ function handleBrushEnd(draft, action) {
|
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
function setVerticalIndicatorXPosition(draft, position) {
|
|
160
|
-
const activeSpectrum = draft
|
|
164
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
161
165
|
if (activeSpectrum?.id) {
|
|
162
166
|
const scaleX = getXScale(draft);
|
|
163
167
|
const value = scaleX.invert(position);
|
|
@@ -173,7 +177,7 @@ function getSpectrumID(draft, index) {
|
|
|
173
177
|
function handleZoom(draft, action) {
|
|
174
178
|
const { event, trackID, selectedTool } = action;
|
|
175
179
|
const { view: { ranges: rangeState }, displayerMode, } = draft;
|
|
176
|
-
const activeSpectrum = draft
|
|
180
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
177
181
|
const { showRangesIntegrals } = rangeState.find((r) => r.spectrumID === activeSpectrum?.id) ||
|
|
178
182
|
rangeStateInit;
|
|
179
183
|
if (displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
@@ -273,15 +277,6 @@ function setMargin(draft) {
|
|
|
273
277
|
draft.margin = MARGIN['1D'];
|
|
274
278
|
}
|
|
275
279
|
}
|
|
276
|
-
function processing2DData(draft, data) {
|
|
277
|
-
if (draft.displayerMode === DISPLAYER_MODE.DM_2D) {
|
|
278
|
-
let _data = {};
|
|
279
|
-
for (const datum of data[draft.view.spectra.activeTab]) {
|
|
280
|
-
_data[datum.id] = datum.processingController.drawContours();
|
|
281
|
-
}
|
|
282
|
-
draft.contours = _data;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
280
|
function setDisplayerMode(draft, data) {
|
|
286
281
|
draft.displayerMode =
|
|
287
282
|
data && data.some((d) => d.info.dimension === 2)
|
|
@@ -352,7 +347,6 @@ function setActiveTab(draft, options) {
|
|
|
352
347
|
const currentTab = !tab || !tabs.includes(tab || '') ? tabs[0] : tab;
|
|
353
348
|
setTab(draft, dataGroupByNucleus, currentTab, refreshActiveTab);
|
|
354
349
|
resetTool(draft);
|
|
355
|
-
processing2DData(draft, dataGroupByNucleus);
|
|
356
350
|
setDomain(draft, domainOptions);
|
|
357
351
|
setIntegralsYDomain(draft, dataGroupByNucleus[currentTab]);
|
|
358
352
|
const zoomHistory = zoomHistoryManager(draft.zoom.history, draft.view.spectra.activeTab);
|
|
@@ -369,20 +363,13 @@ function handelSetActiveTab(draft, tab) {
|
|
|
369
363
|
}
|
|
370
364
|
}
|
|
371
365
|
function levelChangeHandler(draft, { deltaY, shiftKey }) {
|
|
372
|
-
const activeSpectrum = draft
|
|
366
|
+
const activeSpectrum = getSpectrum(draft);
|
|
373
367
|
try {
|
|
374
368
|
if (activeSpectrum?.id) {
|
|
375
|
-
const {
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
processingController.shiftWheel(deltaY);
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
processingController.wheel(deltaY);
|
|
383
|
-
}
|
|
384
|
-
const contours = Object.freeze(processingController.drawContours());
|
|
385
|
-
draft.contours[id] = contours;
|
|
369
|
+
const { levels } = draft.view.zoom;
|
|
370
|
+
const contourOptions = activeSpectrum.display.contourOptions;
|
|
371
|
+
const zoom = contoursManager(activeSpectrum.id, levels, contourOptions);
|
|
372
|
+
draft.view.zoom.levels[activeSpectrum.id] = zoom.wheel(deltaY, shiftKey);
|
|
386
373
|
}
|
|
387
374
|
}
|
|
388
375
|
catch (e) {
|
|
@@ -8,13 +8,14 @@ import { changeZoneSignal, detectZones, detectZonesManual, updateShift, } from '
|
|
|
8
8
|
import { unlink, unlinkInAssignmentData, } from '../../../data/utilities/ZoneUtilities';
|
|
9
9
|
import { zoneStateInit } from '../Reducer';
|
|
10
10
|
import get2DRange from '../helper/get2DRange';
|
|
11
|
+
import { getActiveSpectrum } from '../helper/getActiveSpectrum';
|
|
11
12
|
import { handleUpdateCorrelations } from './CorrelationsActions';
|
|
12
13
|
import { setDomain } from './DomainActions';
|
|
13
14
|
function changeZonesFactorHandler(draft, action) {
|
|
14
15
|
draft.toolOptions.data.zonesNoiseFactor = action.payload;
|
|
15
16
|
}
|
|
16
17
|
function add2dZoneHandler(draft, action) {
|
|
17
|
-
const activeSpectrum = draft
|
|
18
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
18
19
|
if (activeSpectrum?.id) {
|
|
19
20
|
const { index } = activeSpectrum;
|
|
20
21
|
const drawnZone = get2DRange(draft, action);
|
|
@@ -29,7 +30,7 @@ function add2dZoneHandler(draft, action) {
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
function handleAutoZonesDetection(draft, detectionOptions) {
|
|
32
|
-
const activeSpectrum = draft
|
|
33
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
33
34
|
if (activeSpectrum?.id) {
|
|
34
35
|
const { index } = activeSpectrum;
|
|
35
36
|
const [fromX, toX] = draft.xDomain;
|
|
@@ -57,7 +58,7 @@ function handleAutoSpectraZonesDetection(draft) {
|
|
|
57
58
|
}
|
|
58
59
|
function changeZoneSignalDelta(draft, action) {
|
|
59
60
|
const { zoneID, signal } = action.payload;
|
|
60
|
-
const activeSpectrum = draft
|
|
61
|
+
const activeSpectrum = getActiveSpectrum(draft);
|
|
61
62
|
if (activeSpectrum?.id) {
|
|
62
63
|
const { index } = activeSpectrum;
|
|
63
64
|
const { xShift, yShift } = changeZoneSignal(draft.data[index], zoneID, signal);
|
|
@@ -79,7 +80,7 @@ function getZoneIndex(state, spectrumIndex, zoneID) {
|
|
|
79
80
|
}
|
|
80
81
|
function handleChangeZoneSignalKind(draft, action) {
|
|
81
82
|
const state = original(draft);
|
|
82
|
-
const activeSpectrum = state
|
|
83
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
83
84
|
if (activeSpectrum?.id) {
|
|
84
85
|
const { index } = activeSpectrum;
|
|
85
86
|
const { rowData, value } = action.payload;
|
|
@@ -94,7 +95,7 @@ function handleChangeZoneSignalKind(draft, action) {
|
|
|
94
95
|
}
|
|
95
96
|
function handleDeleteZone(draft, action) {
|
|
96
97
|
const state = original(draft);
|
|
97
|
-
const activeSpectrum = state
|
|
98
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
98
99
|
if (activeSpectrum?.id) {
|
|
99
100
|
const { index } = activeSpectrum;
|
|
100
101
|
const { id, assignmentData } = action.payload;
|
|
@@ -149,7 +150,7 @@ function handleSetSignalPathLength(draft, action) {
|
|
|
149
150
|
}
|
|
150
151
|
function handleUnlinkZone(draft, action) {
|
|
151
152
|
const state = original(draft);
|
|
152
|
-
const activeSpectrum = state
|
|
153
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
153
154
|
if (activeSpectrum?.id) {
|
|
154
155
|
const { index } = activeSpectrum;
|
|
155
156
|
const { zoneData = null, assignmentData, isOnZoneLevel = undefined, signalIndex = -1, axis = undefined, } = action.payload;
|
|
@@ -172,7 +173,7 @@ function handleUnlinkZone(draft, action) {
|
|
|
172
173
|
}
|
|
173
174
|
function handleSetDiaIDZone(draft, action) {
|
|
174
175
|
const state = original(draft);
|
|
175
|
-
const activeSpectrum = state
|
|
176
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
176
177
|
if (activeSpectrum?.id) {
|
|
177
178
|
const { index } = activeSpectrum;
|
|
178
179
|
const { zoneData, diaIDs, axis, signalIndex, nbAtoms } = action.payload;
|
|
@@ -191,7 +192,7 @@ function handleSetDiaIDZone(draft, action) {
|
|
|
191
192
|
}
|
|
192
193
|
function handleSaveEditedZone(draft, action) {
|
|
193
194
|
const state = original(draft);
|
|
194
|
-
const activeSpectrum = state
|
|
195
|
+
const activeSpectrum = getActiveSpectrum(state);
|
|
195
196
|
if (activeSpectrum?.id) {
|
|
196
197
|
const { index } = activeSpectrum;
|
|
197
198
|
const { editedRowData } = action.payload;
|
|
@@ -48,7 +48,7 @@ declare const preferencesReducer: (base: {
|
|
|
48
48
|
readonly open?: boolean | undefined;
|
|
49
49
|
} | undefined;
|
|
50
50
|
readonly hidePanelOnLoad?: boolean | undefined;
|
|
51
|
-
readonly initialPanelWidth?: import("analysis-ui-components
|
|
51
|
+
readonly initialPanelWidth?: import("analysis-ui-components").SplitPaneSize | undefined;
|
|
52
52
|
} | undefined;
|
|
53
53
|
readonly panels?: {
|
|
54
54
|
readonly spectraPanel?: {
|
|
@@ -127,7 +127,7 @@ declare const preferencesReducer: (base: {
|
|
|
127
127
|
} | undefined;
|
|
128
128
|
};
|
|
129
129
|
readonly general: {
|
|
130
|
-
readonly
|
|
130
|
+
readonly dimmedSpectraOpacity: number;
|
|
131
131
|
};
|
|
132
132
|
readonly formatting: {
|
|
133
133
|
readonly nuclei: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Toolbar } from 'analysis-ui-components';
|
|
3
3
|
import { SvgNmrRealImag, SvgNmrOverlay3, SvgNmrOverlay3Aligned, SvgNmrAlignBottom, SvgNmrAlignCenter, } from 'cheminfo-font';
|
|
4
|
-
import { Fragment, useCallback, memo
|
|
4
|
+
import { Fragment, useCallback, memo } from 'react';
|
|
5
5
|
import { FaDownload, FaFileDownload, FaFileImage, FaCopy, FaFileExport, FaFile, FaFileImport, } from 'react-icons/fa';
|
|
6
6
|
import { useChartData } from '../context/ChartContext';
|
|
7
7
|
import { useDispatch } from '../context/DispatchContext';
|
|
@@ -74,11 +74,12 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
|
|
|
74
74
|
const openLoader = useLoader();
|
|
75
75
|
const isExperimentalFeature = useCheckExperimentalFeature();
|
|
76
76
|
const isButtonVisible = useCheckToolsVisibility();
|
|
77
|
-
const importMenu =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
const importMenu = isExperimentalFeature
|
|
78
|
+
? IMPORT_MENU
|
|
79
|
+
: IMPORT_MENU.filter((item) => item.id !== 'importPublicationString');
|
|
80
|
+
const exportMenu = isExperimentalFeature
|
|
81
|
+
? EXPORT_MENU
|
|
82
|
+
: EXPORT_MENU.filter((item) => item.id !== 'nmre');
|
|
82
83
|
const { isRealSpectrumShown, changeSpectrumViewHandler, changeDisplayViewModeHandler, alignSpectrumsVerticallyHandler, } = useToolsFunctions();
|
|
83
84
|
const { saveAsSVGHandler, saveAsPNGHandler, saveAsJSONHandler, saveToClipboardHandler, saveAsHandler, } = useExport();
|
|
84
85
|
const LoadJacmpHandler = useCallback((file) => {
|
|
@@ -147,7 +148,7 @@ function BasicToolBarInner({ info, verticalAlign, ftCounter, fidCounter, activeS
|
|
|
147
148
|
}, items: importMenu })), isButtonVisible('exportAs') && (_jsx(ToolbarMenu, { component: _jsx(FaFileExport, {}), toolTip: "Export As", onClick: (element) => {
|
|
148
149
|
exportHandler(element);
|
|
149
150
|
return null;
|
|
150
|
-
}, items:
|
|
151
|
+
}, items: exportMenu })), isButtonVisible('spectraStackAlignments') &&
|
|
151
152
|
ftCounter > 1 &&
|
|
152
153
|
(info?.isFt || !activeSpectrum) && (_jsx(Toolbar.Item, { id: "spectra-alignment", className: "cheminfo", title: "Spectra alignment ( Press s )", onClick: changeDisplayViewModeHandler, children: verticalAlign.align === 'stack' ? (_jsx(SvgNmrOverlay3Aligned, {})) : (_jsx(SvgNmrOverlay3, {})) })), isButtonVisible('realImaginary') && info.isComplex && (_jsx(Toolbar.Item, { id: "display", title: isRealSpectrumShown ? 'Display Real ' : 'Display Imaginary', onClick: changeSpectrumViewHandler, className: "cheminfo", children: _jsx(SvgNmrRealImag, {}) })), isButtonVisible('spectraCenterAlignments') &&
|
|
153
154
|
(ftCounter > 0 || fidCounter > 0) && (_jsx(Toolbar.Item, { id: "baseline-position", title: verticalAlign.align === 'bottom'
|
|
@@ -31,11 +31,4 @@ declare function extractFileMetaFromPath(path: any): {
|
|
|
31
31
|
declare function loadFiles<T = unknown>(acceptedFiles: any, options?: {
|
|
32
32
|
asBuffer?: boolean;
|
|
33
33
|
}): Promise<T[]>;
|
|
34
|
-
|
|
35
|
-
asBuffer?: boolean;
|
|
36
|
-
}): Promise<{
|
|
37
|
-
binary: any;
|
|
38
|
-
name: string;
|
|
39
|
-
extension: string;
|
|
40
|
-
}[]>;
|
|
41
|
-
export { loadFiles, loadFilesFromZip, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
|
|
34
|
+
export { loadFiles, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
|
|
@@ -12,6 +12,7 @@ export const FILES_SIGNATURES = {
|
|
|
12
12
|
ZIP: '504b0304',
|
|
13
13
|
};
|
|
14
14
|
function getFileSignature(fileArrayBuffer) {
|
|
15
|
+
// eslint-disable-next-line no-restricted-properties
|
|
15
16
|
return new Uint8Array(fileArrayBuffer)
|
|
16
17
|
.slice(0, 4)
|
|
17
18
|
.reduce((acc, byte) => (acc += byte.toString(16).padStart(2, '0')), '');
|
|
@@ -68,20 +69,4 @@ function loadFiles(acceptedFiles, options = {}) {
|
|
|
68
69
|
});
|
|
69
70
|
}));
|
|
70
71
|
}
|
|
71
|
-
|
|
72
|
-
const result = [];
|
|
73
|
-
for (const file of files) {
|
|
74
|
-
try {
|
|
75
|
-
const binary = await file.async(options.asBuffer ? 'uint8array' : 'text');
|
|
76
|
-
const name = getFileName(file.name);
|
|
77
|
-
const extension = getFileExtension(file.name);
|
|
78
|
-
result.push({ binary, name, extension });
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
// eslint-disable-next-line no-console
|
|
82
|
-
console.error(e);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
|
-
export { loadFiles, loadFilesFromZip, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
|
|
72
|
+
export { loadFiles, loadFile, getFileExtension, getFileName, extractFileMetaFromPath, getFileSignature, };
|
|
File without changes
|
|
@@ -1,49 +1,31 @@
|
|
|
1
|
+
import * as clipboard from 'clipboard-polyfill';
|
|
1
2
|
import { saveAs } from 'file-saver';
|
|
2
3
|
import JSZip from 'jszip';
|
|
3
|
-
function copyFormattedHtml(html) {
|
|
4
|
-
// Create an iframe (isolated container) for the HTML
|
|
5
|
-
let container = document.createElement('div');
|
|
6
|
-
container.innerHTML = html;
|
|
7
|
-
// Hide element
|
|
8
|
-
container.style.position = 'fixed';
|
|
9
|
-
container.style.pointerEvents = 'none';
|
|
10
|
-
container.style.opacity = '0';
|
|
11
|
-
// Detect all style sheets of the page
|
|
12
|
-
let activeSheets = Array.prototype.slice
|
|
13
|
-
.call(document.styleSheets)
|
|
14
|
-
.filter((sheet) => {
|
|
15
|
-
return !sheet.disabled;
|
|
16
|
-
});
|
|
17
|
-
// Mount the iframe to the DOM to make `contentWindow` available
|
|
18
|
-
document.body.appendChild(container);
|
|
19
|
-
// Copy to clipboard
|
|
20
|
-
window.getSelection()?.removeAllRanges();
|
|
21
|
-
let range = document.createRange();
|
|
22
|
-
range.selectNode(container);
|
|
23
|
-
window.getSelection()?.addRange(range);
|
|
24
|
-
document.execCommand('copy');
|
|
25
|
-
for (const active of activeSheets) {
|
|
26
|
-
active.disabled = true;
|
|
27
|
-
}
|
|
28
|
-
document.execCommand('copy');
|
|
29
|
-
for (const active of activeSheets) {
|
|
30
|
-
active.disabled = false;
|
|
31
|
-
}
|
|
32
|
-
// Remove the iframe
|
|
33
|
-
document.body.removeChild(container);
|
|
34
|
-
}
|
|
35
4
|
async function copyHTMLToClipboard(data) {
|
|
36
|
-
|
|
37
|
-
copyFormattedHtml(data);
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
catch (err) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
5
|
+
return copyToClipboard(data, 'text/html');
|
|
43
6
|
}
|
|
44
7
|
async function copyTextToClipboard(data) {
|
|
8
|
+
return copyToClipboard(data, 'text/plain');
|
|
9
|
+
}
|
|
10
|
+
async function copyToClipboard(data, type) {
|
|
45
11
|
try {
|
|
46
|
-
|
|
12
|
+
if (typeof ClipboardItem !== 'undefined') {
|
|
13
|
+
void navigator.clipboard.write([
|
|
14
|
+
new ClipboardItem({
|
|
15
|
+
[type]: new Promise((resolve) => {
|
|
16
|
+
resolve(new Blob([data], { type }));
|
|
17
|
+
}),
|
|
18
|
+
}),
|
|
19
|
+
]);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
//TODO when Firefox team implement ClipboardItem this code should be removed
|
|
23
|
+
// this library is used mainly to solve the problem of copy HTML to a clipboard in Firefox but we use it for both HTML and plain text
|
|
24
|
+
const item = new clipboard.ClipboardItem({
|
|
25
|
+
[type]: new Blob([data], { type }),
|
|
26
|
+
});
|
|
27
|
+
await clipboard.write([item]);
|
|
28
|
+
}
|
|
47
29
|
return true;
|
|
48
30
|
}
|
|
49
31
|
catch (err) {
|
|
@@ -139,7 +121,8 @@ function exportAsPng(rootRef, elementID, fileName = 'experiment') {
|
|
|
139
121
|
console.log(e);
|
|
140
122
|
}
|
|
141
123
|
}
|
|
142
|
-
|
|
124
|
+
// hack way to copy the image to the clipboard
|
|
125
|
+
function copyDataURLClipboardFireFox(image) {
|
|
143
126
|
const img = document.createElement('img');
|
|
144
127
|
img.src = image;
|
|
145
128
|
img.style.position = 'fixed';
|
|
@@ -152,7 +135,7 @@ function copyDataURLCliboard(image) {
|
|
|
152
135
|
document.execCommand('Copy');
|
|
153
136
|
document.body.removeChild(img);
|
|
154
137
|
}
|
|
155
|
-
function
|
|
138
|
+
function copyBlobToClipboard(canvas) {
|
|
156
139
|
canvas.toBlob((b) => {
|
|
157
140
|
const clip = new ClipboardItem({
|
|
158
141
|
[b.type]: b,
|
|
@@ -184,10 +167,10 @@ function copyPNGToClipboard(rootRef, elementID) {
|
|
|
184
167
|
const png = canvas.toDataURL('image/png', 1);
|
|
185
168
|
// @ts-expect-error write exists in some browsers
|
|
186
169
|
if (navigator.clipboard.write) {
|
|
187
|
-
|
|
170
|
+
copyBlobToClipboard(canvas);
|
|
188
171
|
}
|
|
189
172
|
else {
|
|
190
|
-
|
|
173
|
+
copyDataURLClipboardFireFox(png);
|
|
191
174
|
}
|
|
192
175
|
URL.revokeObjectURL(png);
|
|
193
176
|
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
interface FormatOptions {
|
|
2
|
+
prefix?: string;
|
|
3
|
+
suffix?: string;
|
|
4
|
+
defaultFormat?: string;
|
|
5
|
+
}
|
|
6
|
+
declare function formatNumber(value: string | number, format: string | undefined, options?: FormatOptions): string;
|
|
2
7
|
declare function getNumberOfDecimals(value: number | string): number;
|
|
3
8
|
export { formatNumber, getNumberOfDecimals };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import numeral from 'numeral';
|
|
2
|
-
function formatNumber(value, format,
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
function formatNumber(value, format, options = {}) {
|
|
3
|
+
const { prefix = '', suffix = '', defaultFormat = '0.00' } = options;
|
|
4
|
+
return typeof value === 'number' || !isNaN(value)
|
|
5
|
+
? prefix + numeral(value).format(format || defaultFormat) + suffix
|
|
5
6
|
: value;
|
|
6
7
|
}
|
|
7
8
|
function getNumberOfDecimals(value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const exercise = {
|
|
2
|
-
version:
|
|
2
|
+
version: 2,
|
|
3
3
|
label: 'Exercise',
|
|
4
4
|
display: {
|
|
5
5
|
general: {
|
|
@@ -10,17 +10,17 @@ export const exercise = {
|
|
|
10
10
|
integralsPanel: { display: true },
|
|
11
11
|
},
|
|
12
12
|
toolBarButtons: {
|
|
13
|
-
|
|
13
|
+
zoom: true,
|
|
14
|
+
zoomOut: true,
|
|
14
15
|
apodization: true,
|
|
15
16
|
zeroFilling: true,
|
|
16
17
|
fastFourierTransform: true,
|
|
17
18
|
phaseCorrection: true,
|
|
18
19
|
baselineCorrection: true,
|
|
20
|
+
peakPicking: true,
|
|
19
21
|
integral: true,
|
|
20
22
|
spectraCenterAlignments: true,
|
|
21
23
|
spectraStackAlignments: true,
|
|
22
|
-
zoomOut: true,
|
|
23
|
-
zoom: true,
|
|
24
24
|
},
|
|
25
25
|
},
|
|
26
26
|
};
|
package/lib/data/Filters.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as absolute from './data1d/filter1d/absolute';
|
|
2
1
|
import * as apodization from './data1d/filter1d/apodization';
|
|
3
2
|
import * as autoPhaseCorrection from './data1d/filter1d/autoPhaseCorrection';
|
|
4
3
|
import * as baselineCorrection from './data1d/filter1d/baselineCorrection';
|
|
@@ -15,4 +14,4 @@ import * as standardDeviation from './data1d/filter1d/standardDeviation';
|
|
|
15
14
|
import * as zeroFilling from './data1d/filter1d/zeroFilling';
|
|
16
15
|
import * as shift2DX from './data2d/filter2d/shiftX';
|
|
17
16
|
import * as shift2DY from './data2d/filter2d/shiftY';
|
|
18
|
-
export {
|
|
17
|
+
export { baselineCorrection, apodization, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
|
package/lib/data/Filters.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as absolute from './data1d/filter1d/absolute';
|
|
2
1
|
import * as apodization from './data1d/filter1d/apodization';
|
|
3
2
|
import * as autoPhaseCorrection from './data1d/filter1d/autoPhaseCorrection';
|
|
4
3
|
import * as baselineCorrection from './data1d/filter1d/baselineCorrection';
|
|
@@ -15,4 +14,4 @@ import * as standardDeviation from './data1d/filter1d/standardDeviation';
|
|
|
15
14
|
import * as zeroFilling from './data1d/filter1d/zeroFilling';
|
|
16
15
|
import * as shift2DX from './data2d/filter2d/shiftX';
|
|
17
16
|
import * as shift2DY from './data2d/filter2d/shiftY';
|
|
18
|
-
export {
|
|
17
|
+
export { baselineCorrection, apodization, fft, phaseCorrection, autoPhaseCorrection, shiftX, zeroFilling, digitalFilter, fromTo, equallySpaced, standardDeviation, centerMean, pareto, exclusionZones, shift2DX, shift2DY, };
|
|
@@ -6,8 +6,7 @@ export declare enum DataExportOptions {
|
|
|
6
6
|
}
|
|
7
7
|
export declare type DataExportOptionsType = keyof typeof DataExportOptions;
|
|
8
8
|
export declare function addJcampFromURL(spectra: any, jcampURL: any, options: any, usedColors: any): Promise<void>;
|
|
9
|
-
export declare function addJcamp(
|
|
10
|
-
export declare function fromJSON(data?: any[], usedColors?: any): Promise<any[]>;
|
|
9
|
+
export declare function addJcamp(output: any, jcamp: any, options: any, usedColors: any): void;
|
|
11
10
|
export declare function addJcamps(files: any, usedColors: any): never[];
|
|
12
11
|
/**
|
|
13
12
|
*
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { CURRENT_EXPORT_VERSION } from 'nmr-load-save';
|
|
2
|
-
import { fromJCAMP } from 'nmr-parser';
|
|
1
|
+
import { CURRENT_EXPORT_VERSION, processJcamp } from 'nmr-load-save';
|
|
3
2
|
import { DISPLAYER_MODE } from '../component/reducer/core/Constants';
|
|
4
|
-
import * as Data1DManager from './data1d/Data1DManager';
|
|
5
3
|
import * as Datum1D from './data1d/Spectrum1D';
|
|
6
|
-
import * as Data2DManager from './data2d/Data2DManager';
|
|
7
4
|
import * as Datum2D from './data2d/Spectrum2D';
|
|
8
5
|
import * as Molecule from './molecules/Molecule';
|
|
9
6
|
export var DataExportOptions;
|
|
@@ -11,6 +8,15 @@ export var DataExportOptions;
|
|
|
11
8
|
DataExportOptions["ROW_DATA"] = "ROW_DATA";
|
|
12
9
|
DataExportOptions["DATA_SOURCE"] = "DATA_SOURCE";
|
|
13
10
|
})(DataExportOptions || (DataExportOptions = {}));
|
|
11
|
+
function getData(datum, usedColors) {
|
|
12
|
+
const dimension = datum.info.dimension;
|
|
13
|
+
if (dimension === 1) {
|
|
14
|
+
return Datum1D.initiateDatum1D(datum, usedColors);
|
|
15
|
+
}
|
|
16
|
+
else if (dimension === 2) {
|
|
17
|
+
return Datum2D.initiateDatum2D(datum, usedColors);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
14
20
|
export function addJcampFromURL(spectra, jcampURL, options, usedColors) {
|
|
15
21
|
return fetch(jcampURL)
|
|
16
22
|
.then((response) => response.arrayBuffer())
|
|
@@ -18,65 +24,26 @@ export function addJcampFromURL(spectra, jcampURL, options, usedColors) {
|
|
|
18
24
|
addJcamp(spectra, jcamp, options, usedColors);
|
|
19
25
|
});
|
|
20
26
|
}
|
|
21
|
-
export function addJcamp(
|
|
27
|
+
export function addJcamp(output, jcamp, options, usedColors) {
|
|
22
28
|
options = options || {};
|
|
23
|
-
const
|
|
24
|
-
|
|
29
|
+
const name = options?.display?.name;
|
|
30
|
+
const { spectra: spectraIn } = processJcamp(jcamp, {
|
|
31
|
+
name,
|
|
32
|
+
noContours: true,
|
|
25
33
|
xy: true,
|
|
26
34
|
keepRecordsRegExp: /.*/,
|
|
27
35
|
profiling: true,
|
|
28
36
|
});
|
|
29
|
-
if (
|
|
37
|
+
if (spectraIn.length === 0)
|
|
30
38
|
return;
|
|
31
|
-
// Should be improved when we have a more complex case
|
|
32
|
-
for (let index = 0; index < entries.length; index++) {
|
|
33
|
-
let entry = entries[index];
|
|
34
|
-
const components = entry.dependentVariables?.[0]?.components;
|
|
35
|
-
if (components && (components.length > 0 || components.z)) {
|
|
36
|
-
addJcampSS(spectra, { index, entry }, options, usedColors);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function addJcampSS(spectra, jcampDatum, options, usedColors) {
|
|
41
|
-
const source = options?.source || {};
|
|
42
|
-
if (!('jcampSpectrumIndex' in source) ||
|
|
43
|
-
source.jcampSpectrumIndex === jcampDatum.index) {
|
|
44
|
-
const dimension = jcampDatum.entry.info.dimension;
|
|
45
|
-
if (dimension === 1) {
|
|
46
|
-
spectra.push(Data1DManager.fromParsedJcamp(jcampDatum.entry, options, usedColors, jcampDatum.index));
|
|
47
|
-
}
|
|
48
|
-
if (dimension === 2) {
|
|
49
|
-
// console.log(options, jcampDatum.entry);
|
|
50
|
-
spectra.push(Data2DManager.fromParsedJcamp(jcampDatum.entry, options, usedColors, jcampDatum.index));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function addData(spectra, datum, usedColors) {
|
|
55
|
-
const dimension = datum.info.dimension;
|
|
56
|
-
if (dimension === 1) {
|
|
57
|
-
spectra.push(Datum1D.initiateDatum1D(datum, usedColors));
|
|
58
|
-
}
|
|
59
|
-
if (dimension === 2) {
|
|
60
|
-
spectra.push(Datum2D.initiateDatum2D(datum, usedColors));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
export async function fromJSON(data = [], usedColors = {}) {
|
|
64
39
|
const spectra = [];
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
else if (jcampURL != null) {
|
|
72
|
-
promises.push(addJcampFromURL(spectra, jcampURL, datum, usedColors));
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
addData(spectra, datum, usedColors);
|
|
76
|
-
}
|
|
40
|
+
for (let spectrum of spectraIn) {
|
|
41
|
+
const data = getData(spectrum, usedColors);
|
|
42
|
+
if (!data)
|
|
43
|
+
continue;
|
|
44
|
+
spectra.push(data);
|
|
77
45
|
}
|
|
78
|
-
|
|
79
|
-
return spectra;
|
|
46
|
+
output.push(...spectra);
|
|
80
47
|
}
|
|
81
48
|
export function addJcamps(files, usedColors) {
|
|
82
49
|
const spectra = [];
|