nmrium 0.30.0 → 0.31.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/ApodizationLine.js +3 -1
- package/lib/component/1d/FooterBanner.js +3 -1
- package/lib/component/1d/IntegralsSeries.js +3 -1
- package/lib/component/1d/LinesSeries.js +3 -1
- package/lib/component/1d/SpectraTracker.js +1 -1
- package/lib/component/1d/Viewer1D.js +3 -1
- package/lib/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib/component/1d/ranges/Ranges.js +8 -2
- package/lib/component/1d/tool/PeakPointer.js +3 -1
- package/lib/component/1d/tool/XLabelPointer.js +3 -1
- package/lib/component/2d/Contours.js +3 -1
- package/lib/component/2d/FooterBanner.js +3 -1
- package/lib/component/2d/Viewer2D.js +4 -4
- package/lib/component/2d/XAxis.js +2 -2
- package/lib/component/2d/YAxis.js +2 -2
- package/lib/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib/component/2d/zones/IndicationLines.js +1 -1
- package/lib/component/2d/zones/Zones.js +14 -19
- package/lib/component/NMRium.d.ts +2 -0
- package/lib/component/NMRium.js +14 -3
- package/lib/component/elements/popup/Modal/Provider.d.ts +3 -3
- package/lib/component/elements/popup/Modal/Provider.js +8 -11
- package/lib/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib/component/hooks/useExport.d.ts +0 -1
- package/lib/component/hooks/useExport.js +1 -17
- package/lib/component/hooks/useIntegralPath.js +5 -2
- package/lib/component/hooks/useNucleus.js +4 -4
- package/lib/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib/component/hooks/useSpectrum.js +3 -1
- package/lib/component/loader/DropZone.js +7 -147
- package/lib/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib/component/panels/RangesPanel/RangesHeader.d.ts +2 -1
- package/lib/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +19 -10
- package/lib/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib/component/reducer/IgnoreActions.js +1 -0
- package/lib/component/reducer/Reducer.d.ts +108 -49
- package/lib/component/reducer/Reducer.js +45 -41
- package/lib/component/reducer/actions/DomainActions.d.ts +1 -1
- package/lib/component/reducer/actions/DomainActions.js +11 -9
- package/lib/component/reducer/actions/FiltersActions.d.ts +1 -1
- package/lib/component/reducer/actions/FiltersActions.js +218 -232
- package/lib/component/reducer/actions/IntegralsActions.js +13 -8
- package/lib/component/reducer/actions/LoadActions.d.ts +2 -5
- package/lib/component/reducer/actions/LoadActions.js +19 -34
- package/lib/component/reducer/actions/MoleculeActions.d.ts +2 -1
- package/lib/component/reducer/actions/MoleculeActions.js +22 -6
- package/lib/component/reducer/actions/PeaksActions.js +18 -12
- package/lib/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib/component/reducer/actions/RangesActions.d.ts +3 -3
- package/lib/component/reducer/actions/RangesActions.js +85 -27
- package/lib/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib/component/reducer/actions/SpectrumsActions.js +13 -10
- package/lib/component/reducer/actions/ToolsActions.js +38 -23
- package/lib/component/reducer/actions/ZonesActions.d.ts +4 -1
- package/lib/component/reducer/actions/ZonesActions.js +68 -17
- package/lib/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.d.ts +3 -0
- package/lib/component/reducer/helper/getActiveSpectrumOrFail.js +6 -0
- package/lib/component/reducer/helper/getSpectrum.js +3 -2
- package/lib/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib/component/reducer/types/Types.d.ts +5 -0
- package/lib/component/reducer/types/Types.js +5 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.d.ts +6 -0
- package/lib/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib/component/toolbar/BasicToolBar.js +4 -6
- package/lib/component/toolbar/FunctionToolBar.js +3 -1
- package/lib/component/utility/assert.d.ts +1 -0
- package/lib/component/utility/assert.js +5 -0
- package/lib/component/workspaces/exercise.js +6 -0
- package/lib/data/SpectraManager.d.ts +0 -4
- package/lib/data/SpectraManager.js +2 -87
- package/lib/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib/data/data1d/filter1d/fft.js +11 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +35 -0
- package/lib/data/data2d/Spectrum2D/zones/getDetectionZones.d.ts +1 -1
- package/lib/data/molecules/Molecule.d.ts +5 -0
- package/lib/versionInfo.js +1 -1
- package/lib-cjs/component/1d/ApodizationLine.js +3 -1
- package/lib-cjs/component/1d/FooterBanner.js +3 -1
- package/lib-cjs/component/1d/IntegralsSeries.js +3 -1
- package/lib-cjs/component/1d/LinesSeries.js +3 -1
- package/lib-cjs/component/1d/SpectraTracker.js +1 -1
- package/lib-cjs/component/1d/Viewer1D.js +3 -1
- package/lib-cjs/component/1d/jCouplingGraph/JGraph.js +5 -1
- package/lib-cjs/component/1d/multiAnalysis/MultiAnalysisRanges.js +1 -1
- package/lib-cjs/component/1d/multiplicityTree/MultiplicityTree.js +3 -1
- package/lib-cjs/component/1d/peaks/PeakAnnotations.js +3 -1
- package/lib-cjs/component/1d/peaks/PeaksShapes.js +4 -2
- package/lib-cjs/component/1d/peaks/usePeakShapesPath.js +7 -3
- package/lib-cjs/component/1d/ranges/Ranges.js +7 -1
- package/lib-cjs/component/1d/tool/PeakPointer.js +3 -1
- package/lib-cjs/component/1d/tool/XLabelPointer.js +3 -1
- package/lib-cjs/component/2d/Contours.js +3 -1
- package/lib-cjs/component/2d/FooterBanner.js +3 -1
- package/lib-cjs/component/2d/Viewer2D.js +4 -4
- package/lib-cjs/component/2d/XAxis.js +2 -2
- package/lib-cjs/component/2d/YAxis.js +2 -2
- package/lib-cjs/component/2d/tools/XYLabelPointer.js +3 -1
- package/lib-cjs/component/2d/tools/slicing/SlicingView.js +3 -1
- package/lib-cjs/component/2d/zones/IndicationLines.js +1 -1
- package/lib-cjs/component/2d/zones/Zones.js +13 -18
- package/lib-cjs/component/NMRium.js +14 -3
- package/lib-cjs/component/elements/popup/Modal/Provider.js +8 -11
- package/lib-cjs/component/header/ZeroFillingOptionsPanel.js +3 -1
- package/lib-cjs/component/hooks/useActiveSpectrumStyleOptions.js +2 -2
- package/lib-cjs/component/hooks/useDatumWithSpectraStatistics.js +3 -1
- package/lib-cjs/component/hooks/useExport.js +0 -16
- package/lib-cjs/component/hooks/useIntegralPath.js +5 -2
- package/lib-cjs/component/hooks/useNucleus.js +4 -4
- package/lib-cjs/component/hooks/useSpectraPerNucleus.js +1 -1
- package/lib-cjs/component/hooks/useSpectrum.js +3 -1
- package/lib-cjs/component/loader/DropZone.js +6 -149
- package/lib-cjs/component/modal/changeSum/SelectMolecule.js +1 -1
- package/lib-cjs/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib-cjs/component/modal/setting/ToolsTabContent.js +4 -0
- package/lib-cjs/component/panels/IntegralsPanel/IntegralPanel.js +1 -1
- package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +1 -1
- package/lib-cjs/component/panels/MultipleSpectraAnalysisPanel/MultipleSpectraAnalysisPanel.js +1 -1
- package/lib-cjs/component/panels/PeaksPanel/PeaksPanel.js +1 -1
- package/lib-cjs/component/panels/RangesPanel/RangesHeader.js +10 -9
- package/lib-cjs/component/panels/RangesPanel/RangesPanel.js +7 -3
- package/lib-cjs/component/panels/SpectrumsPanel/SpectraPanelHeader.js +3 -1
- package/lib-cjs/component/panels/SpectrumsPanel/SpectrumsTabs.js +3 -1
- package/lib-cjs/component/panels/SummaryPanel/SummaryPanel.js +1 -1
- package/lib-cjs/component/panels/SummaryPanel/utilities/useInView.js +3 -1
- package/lib-cjs/component/panels/ZonesPanel/ZonesPanel.js +18 -9
- package/lib-cjs/component/panels/databasePanel/DatabasePanel.js +1 -1
- package/lib-cjs/component/reducer/IgnoreActions.js +1 -0
- package/lib-cjs/component/reducer/Reducer.js +48 -43
- package/lib-cjs/component/reducer/actions/DomainActions.js +11 -9
- package/lib-cjs/component/reducer/actions/FiltersActions.js +219 -233
- package/lib-cjs/component/reducer/actions/IntegralsActions.js +13 -8
- package/lib-cjs/component/reducer/actions/LoadActions.js +18 -36
- package/lib-cjs/component/reducer/actions/MoleculeActions.js +23 -6
- package/lib-cjs/component/reducer/actions/PeaksActions.js +18 -12
- package/lib-cjs/component/reducer/actions/PreferencesActions.js +8 -10
- package/lib-cjs/component/reducer/actions/RangesActions.js +85 -27
- package/lib-cjs/component/reducer/actions/SpectraAnalysisAction.js +5 -5
- package/lib-cjs/component/reducer/actions/SpectrumsActions.js +13 -10
- package/lib-cjs/component/reducer/actions/ToolsActions.js +38 -23
- package/lib-cjs/component/reducer/actions/ZonesActions.js +71 -17
- package/lib-cjs/component/reducer/helper/Zoom1DManager.js +2 -1
- package/lib-cjs/component/reducer/helper/getActiveSpectrumOrFail.js +10 -0
- package/lib-cjs/component/reducer/helper/getSpectrum.js +3 -2
- package/lib-cjs/component/reducer/helper/getStrongestPeak.js +2 -1
- package/lib-cjs/component/reducer/types/Types.js +8 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/DraggableStructure.js +10 -3
- package/lib-cjs/component/tool/FloatMoleculeStructures/index.js +14 -8
- package/lib-cjs/component/toolbar/BasicToolBar.js +4 -6
- package/lib-cjs/component/toolbar/FunctionToolBar.js +3 -1
- package/lib-cjs/component/utility/assert.js +9 -0
- package/lib-cjs/component/workspaces/exercise.js +6 -0
- package/lib-cjs/data/SpectraManager.js +3 -92
- package/lib-cjs/data/data1d/Spectrum1D/peaks/autoPeakPicking.js +1 -0
- package/lib-cjs/data/data1d/Spectrum1D/ranges/autoRangesDetection.js +1 -0
- package/lib-cjs/data/data1d/filter1d/fft.js +11 -0
- package/lib-cjs/data/data1d/filter1d/utils/padDataToNextPowerOfTwo.js +39 -0
- package/lib-cjs/versionInfo.js +1 -1
- package/package.json +22 -22
- package/lib/component/utility/nmredataToNmrium.d.ts +0 -4
- package/lib/component/utility/nmredataToNmrium.js +0 -66
- package/lib/component/utility/nmriumToNmredata.d.ts +0 -2
- package/lib/component/utility/nmriumToNmredata.js +0 -80
- package/lib/component/utility/util/nmredata/addRanges.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addRanges.js +0 -52
- package/lib/component/utility/util/nmredata/addSource.d.ts +0 -6
- package/lib/component/utility/util/nmredata/addSource.js +0 -54
- package/lib/component/utility/util/nmredata/addZones.d.ts +0 -1
- package/lib/component/utility/util/nmredata/addZones.js +0 -41
- package/lib/component/utility/util/nmredata/flat2DSignals.d.ts +0 -1
- package/lib/component/utility/util/nmredata/flat2DSignals.js +0 -7
- package/lib/component/utility/util/nmredata/get1DSignals.d.ts +0 -10
- package/lib/component/utility/util/nmredata/get1DSignals.js +0 -96
- package/lib/component/utility/util/nmredata/get2DSignals.d.ts +0 -8
- package/lib/component/utility/util/nmredata/get2DSignals.js +0 -59
- package/lib/component/utility/util/nmredata/getCouplingObserved.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getCouplingObserved.js +0 -11
- package/lib/component/utility/util/nmredata/getLabels.d.ts +0 -9
- package/lib/component/utility/util/nmredata/getLabels.js +0 -66
- package/lib/component/utility/util/nmredata/getToFix.d.ts +0 -1
- package/lib/component/utility/util/nmredata/getToFix.js +0 -19
- package/lib/data/migration/MigrationManager.d.ts +0 -2
- package/lib/data/migration/MigrationManager.js +0 -19
- package/lib/data/migration/changeKeys.d.ts +0 -1
- package/lib/data/migration/changeKeys.js +0 -9
- package/lib/data/migration/migrateToVersion1.d.ts +0 -11
- package/lib/data/migration/migrateToVersion1.js +0 -32
- package/lib/data/migration/migrateToVersion2.d.ts +0 -1
- package/lib/data/migration/migrateToVersion2.js +0 -111
- package/lib/data/migration/migrateToVersion3.d.ts +0 -1
- package/lib/data/migration/migrateToVersion3.js +0 -55
- package/lib-cjs/component/utility/nmredataToNmrium.js +0 -73
- package/lib-cjs/component/utility/nmriumToNmredata.js +0 -87
- package/lib-cjs/component/utility/util/nmredata/addRanges.js +0 -56
- package/lib-cjs/component/utility/util/nmredata/addSource.js +0 -61
- package/lib-cjs/component/utility/util/nmredata/addZones.js +0 -45
- package/lib-cjs/component/utility/util/nmredata/flat2DSignals.js +0 -11
- package/lib-cjs/component/utility/util/nmredata/get1DSignals.js +0 -100
- package/lib-cjs/component/utility/util/nmredata/get2DSignals.js +0 -63
- package/lib-cjs/component/utility/util/nmredata/getCouplingObserved.js +0 -15
- package/lib-cjs/component/utility/util/nmredata/getLabels.js +0 -70
- package/lib-cjs/component/utility/util/nmredata/getToFix.js +0 -23
- package/lib-cjs/data/migration/MigrationManager.js +0 -26
- package/lib-cjs/data/migration/changeKeys.js +0 -13
- package/lib-cjs/data/migration/migrateToVersion1.js +0 -35
- package/lib-cjs/data/migration/migrateToVersion2.js +0 -114
- package/lib-cjs/data/migration/migrateToVersion3.js +0 -58
|
@@ -23,14 +23,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.toJSON = exports.addJcamps = exports.
|
|
26
|
+
exports.toJSON = exports.addJcamps = exports.fromJSON = exports.addJcamp = exports.addJcampFromURL = exports.DataExportOptions = void 0;
|
|
27
|
+
const nmr_load_save_1 = require("nmr-load-save");
|
|
27
28
|
const nmr_parser_1 = require("nmr-parser");
|
|
28
29
|
const Constants_1 = require("../component/reducer/core/Constants");
|
|
29
30
|
const Data1DManager = __importStar(require("./data1d/Data1DManager"));
|
|
30
31
|
const Datum1D = __importStar(require("./data1d/Spectrum1D"));
|
|
31
32
|
const Data2DManager = __importStar(require("./data2d/Data2DManager"));
|
|
32
33
|
const Datum2D = __importStar(require("./data2d/Spectrum2D"));
|
|
33
|
-
const MigrationManager_1 = require("./migration/MigrationManager");
|
|
34
34
|
const Molecule = __importStar(require("./molecules/Molecule"));
|
|
35
35
|
var DataExportOptions;
|
|
36
36
|
(function (DataExportOptions) {
|
|
@@ -88,41 +88,6 @@ function addData(spectra, datum, usedColors) {
|
|
|
88
88
|
spectra.push(Datum2D.initiateDatum2D(datum, usedColors));
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
function addJDF(spectra, jdf, options = {}, usedColors = {}) {
|
|
92
|
-
// need to parse the jcamp
|
|
93
|
-
let converted = (0, nmr_parser_1.fromJEOL)(jdf, {});
|
|
94
|
-
converted = converted[0];
|
|
95
|
-
let info = converted.description;
|
|
96
|
-
let metadata = info.metadata;
|
|
97
|
-
delete info.metadata;
|
|
98
|
-
info.acquisitionMode = 0;
|
|
99
|
-
info.experiment = info.dimension === 1 ? '1d' : '2d';
|
|
100
|
-
info.type = 'NMR SPECTRUM';
|
|
101
|
-
info.nucleus = info.nucleus[0];
|
|
102
|
-
info.numberOfPoints = info.numberOfPoints[0];
|
|
103
|
-
info.acquisitionTime = info.acquisitionTime[0];
|
|
104
|
-
info.baseFrequency = info.baseFrequency[0];
|
|
105
|
-
info.frequencyOffset = info.frequencyOffset[0];
|
|
106
|
-
info.spectralWidthClipped = converted.application.spectralWidthClipped;
|
|
107
|
-
if (info.dimension === 1) {
|
|
108
|
-
if (converted.dependentVariables) {
|
|
109
|
-
spectra.push(Data1DManager.fromCSD(converted, {
|
|
110
|
-
...options,
|
|
111
|
-
display: { ...options.display },
|
|
112
|
-
info,
|
|
113
|
-
meta: metadata,
|
|
114
|
-
}, usedColors));
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (info.dimension === 2 && info.isFt) {
|
|
118
|
-
spectra.push(Data2DManager.fromCSD(converted, {
|
|
119
|
-
...options,
|
|
120
|
-
display: { ...options.display },
|
|
121
|
-
info,
|
|
122
|
-
}, usedColors));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.addJDF = addJDF;
|
|
126
91
|
async function fromJSON(data = [], usedColors = {}) {
|
|
127
92
|
const spectra = [];
|
|
128
93
|
let promises = [];
|
|
@@ -142,60 +107,6 @@ async function fromJSON(data = [], usedColors = {}) {
|
|
|
142
107
|
return spectra;
|
|
143
108
|
}
|
|
144
109
|
exports.fromJSON = fromJSON;
|
|
145
|
-
async function addBruker(options, data, usedColors) {
|
|
146
|
-
const spectra = [];
|
|
147
|
-
let result = await (0, nmr_parser_1.fromBruker)(data, {
|
|
148
|
-
converter: {
|
|
149
|
-
xy: true,
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
let entries = result;
|
|
153
|
-
for (let entry of entries) {
|
|
154
|
-
let { info, dependentVariables } = entry;
|
|
155
|
-
if (info.dimension === 1) {
|
|
156
|
-
if (dependentVariables[0].components) {
|
|
157
|
-
spectra.push(Data1DManager.fromBruker(entry, {
|
|
158
|
-
...options,
|
|
159
|
-
display: { ...options.display },
|
|
160
|
-
}, usedColors));
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
else if (info.dimension === 2) {
|
|
164
|
-
spectra.push(Data2DManager.fromBruker(entry, {
|
|
165
|
-
...options,
|
|
166
|
-
info,
|
|
167
|
-
display: { ...options.display },
|
|
168
|
-
}, usedColors));
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return spectra;
|
|
172
|
-
}
|
|
173
|
-
exports.addBruker = addBruker;
|
|
174
|
-
// handle zip files
|
|
175
|
-
async function fromZip(zipFiles) {
|
|
176
|
-
const spectra = [];
|
|
177
|
-
for (let zipFile of zipFiles) {
|
|
178
|
-
await addBruker(spectra, { display: { name: zipFile.name } }, zipFile.binary);
|
|
179
|
-
}
|
|
180
|
-
return spectra;
|
|
181
|
-
}
|
|
182
|
-
exports.fromZip = fromZip;
|
|
183
|
-
function addJDFs(files, usedColors) {
|
|
184
|
-
const spectra = [];
|
|
185
|
-
for (const file of files) {
|
|
186
|
-
addJDF(spectra, file.binary, {
|
|
187
|
-
display: {
|
|
188
|
-
name: file.name,
|
|
189
|
-
},
|
|
190
|
-
source: {
|
|
191
|
-
jcampURL: file.jcampURL ? file.jcampURL : null,
|
|
192
|
-
file,
|
|
193
|
-
},
|
|
194
|
-
}, usedColors);
|
|
195
|
-
}
|
|
196
|
-
return spectra;
|
|
197
|
-
}
|
|
198
|
-
exports.addJDFs = addJDFs;
|
|
199
110
|
function addJcamps(files, usedColors) {
|
|
200
111
|
const spectra = [];
|
|
201
112
|
for (const file of files) {
|
|
@@ -232,7 +143,7 @@ function toJSON(state, target, dataExportOption = DataExportOptions.DATA_SOURCE)
|
|
|
232
143
|
const molecules = mols.map((mol) => Molecule.toJSON(mol));
|
|
233
144
|
return {
|
|
234
145
|
...(target === 'onDataChange' ? { actionType } : {}),
|
|
235
|
-
version:
|
|
146
|
+
version: nmr_load_save_1.CURRENT_EXPORT_VERSION,
|
|
236
147
|
spectra,
|
|
237
148
|
molecules,
|
|
238
149
|
correlations,
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const nmr_processing_1 = require("nmr-processing");
|
|
4
4
|
const defaultPeakPickingOptions = {
|
|
5
5
|
minMaxRatio: 1,
|
|
6
|
+
shape: { kind: 'lorentzian' },
|
|
6
7
|
realTopDetection: true,
|
|
7
8
|
maxCriteria: true,
|
|
8
9
|
smoothY: false,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.reduce = exports.isApplicable = exports.apply = exports.name = exports.id = void 0;
|
|
4
4
|
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
const padDataToNextPowerOfTwo_1 = require("./utils/padDataToNextPowerOfTwo");
|
|
5
6
|
exports.id = 'fft';
|
|
6
7
|
exports.name = 'FFT';
|
|
7
8
|
/**
|
|
@@ -13,6 +14,13 @@ function apply(datum1D) {
|
|
|
13
14
|
throw new Error('fft not applicable on this data');
|
|
14
15
|
}
|
|
15
16
|
let digitalFilterApplied = datum1D.filters.some((e) => e.name === 'digitalFilter' && e.flag);
|
|
17
|
+
const { data } = datum1D;
|
|
18
|
+
if (data.x.length !== data.re.length || data.x.length !== data.im.length) {
|
|
19
|
+
throw new Error('The length of data should be equal');
|
|
20
|
+
}
|
|
21
|
+
else if (!isPowerOfTwo(datum1D.data.x.length)) {
|
|
22
|
+
(0, padDataToNextPowerOfTwo_1.padDataToNextPowerOfTwo)(datum1D, digitalFilterApplied);
|
|
23
|
+
}
|
|
16
24
|
Object.assign(datum1D.data, (0, ml_spectra_processing_1.reimFFT)(datum1D.data, { applyZeroShift: true }));
|
|
17
25
|
if (digitalFilterApplied) {
|
|
18
26
|
let { digitalFilter = 0 } = datum1D.info;
|
|
@@ -53,3 +61,6 @@ function generateXAxis(datum1D) {
|
|
|
53
61
|
}
|
|
54
62
|
return xAxis;
|
|
55
63
|
}
|
|
64
|
+
function isPowerOfTwo(n) {
|
|
65
|
+
return n !== 0 && (n & (n - 1)) === 0;
|
|
66
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.padDataToNextPowerOfTwo = void 0;
|
|
4
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
function padDataToNextPowerOfTwo(datum1D, digitalFilterApplied) {
|
|
6
|
+
const { x, re, im } = datum1D.data;
|
|
7
|
+
const size = nextPowerOfTwo(x.length);
|
|
8
|
+
let newRE = new Float64Array(size);
|
|
9
|
+
let newIM = new Float64Array(size);
|
|
10
|
+
const pointsToShift = getPointsToShift(datum1D);
|
|
11
|
+
newRE.set(re.slice(0, length - pointsToShift));
|
|
12
|
+
newIM.set(im.slice(0, length - pointsToShift));
|
|
13
|
+
if (pointsToShift > 0 && digitalFilterApplied) {
|
|
14
|
+
newRE.set(re.slice(re.length - pointsToShift), size - pointsToShift);
|
|
15
|
+
newIM.set(im.slice(re.length - pointsToShift), size - pointsToShift);
|
|
16
|
+
}
|
|
17
|
+
const newX = (0, ml_spectra_processing_1.xSequentialFill)({
|
|
18
|
+
from: x[0],
|
|
19
|
+
size,
|
|
20
|
+
step: x[1] - x[0],
|
|
21
|
+
});
|
|
22
|
+
datum1D.data = { ...datum1D.data, ...{ re: newRE, im: newIM, x: newX } };
|
|
23
|
+
}
|
|
24
|
+
exports.padDataToNextPowerOfTwo = padDataToNextPowerOfTwo;
|
|
25
|
+
function getPointsToShift(datum1D) {
|
|
26
|
+
let grpdly = datum1D.info?.digitalFilter || 0;
|
|
27
|
+
return grpdly > 0 ? Math.floor(grpdly) : 0;
|
|
28
|
+
}
|
|
29
|
+
function nextPowerOfTwo(n) {
|
|
30
|
+
if (n === 0)
|
|
31
|
+
return 1;
|
|
32
|
+
n--;
|
|
33
|
+
n |= n >> 1;
|
|
34
|
+
n |= n >> 2;
|
|
35
|
+
n |= n >> 4;
|
|
36
|
+
n |= n >> 8;
|
|
37
|
+
n |= n >> 16;
|
|
38
|
+
return n + 1;
|
|
39
|
+
}
|
package/lib-cjs/versionInfo.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmrium",
|
|
3
3
|
"description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.31.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib-cjs/component/NMRium.js",
|
|
7
7
|
"module": "lib/component/NMRium.js",
|
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
"url": "git+https://github.com/cheminfo/nmrium.git"
|
|
39
39
|
},
|
|
40
40
|
"volta": {
|
|
41
|
-
"node": "16.
|
|
42
|
-
"npm": "8.15.1"
|
|
41
|
+
"node": "16.17.0"
|
|
43
42
|
},
|
|
44
43
|
"overrides": {
|
|
45
44
|
"react": "$react",
|
|
@@ -50,7 +49,7 @@
|
|
|
50
49
|
"react-dom": ">=18.0.0"
|
|
51
50
|
},
|
|
52
51
|
"dependencies": {
|
|
53
|
-
"@emotion/react": "^11.10.
|
|
52
|
+
"@emotion/react": "^11.10.4",
|
|
54
53
|
"@lukeed/uuid": "^2.0.0",
|
|
55
54
|
"analysis-ui-components": "^0.16.0",
|
|
56
55
|
"cheminfo-font": "^1.9.0",
|
|
@@ -70,14 +69,15 @@
|
|
|
70
69
|
"ml-array-xy-equally-spaced": "^1.2.1",
|
|
71
70
|
"ml-baseline-correction-regression": "^1.0.0",
|
|
72
71
|
"ml-conrec": "^3.2.1",
|
|
73
|
-
"ml-gsd": "^12.
|
|
72
|
+
"ml-gsd": "^12.1.0",
|
|
74
73
|
"ml-spectra-processing": "^11.12.0",
|
|
75
74
|
"ml-stat": "^1.3.3",
|
|
76
75
|
"multiplet-analysis": "^2.0.0",
|
|
77
76
|
"nmr-correlation": "^2.3.3",
|
|
78
|
-
"nmr-
|
|
79
|
-
"nmr-
|
|
80
|
-
"
|
|
77
|
+
"nmr-load-save": "^0.2.1",
|
|
78
|
+
"nmr-parser": "^2.0.1",
|
|
79
|
+
"nmr-processing": "^9.2.0",
|
|
80
|
+
"nmredata": "^0.7.1",
|
|
81
81
|
"numeral": "^2.0.6",
|
|
82
82
|
"openchemlib": "^8.0.1",
|
|
83
83
|
"openchemlib-utils": "^2.0.0",
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
"react-mf": "^2.0.1",
|
|
91
91
|
"react-ocl": "^5.0.0",
|
|
92
92
|
"react-ocl-nmr": "^2.0.0",
|
|
93
|
-
"react-plot": "^0.20.
|
|
93
|
+
"react-plot": "^0.20.2",
|
|
94
94
|
"react-rnd": "^10.3.7",
|
|
95
|
-
"react-slider": "^2.0.
|
|
95
|
+
"react-slider": "^2.0.4",
|
|
96
96
|
"react-table": "^7.8.0",
|
|
97
97
|
"react-transition-group": "^4.4.5",
|
|
98
98
|
"react-use": "^17.4.0",
|
|
@@ -103,28 +103,28 @@
|
|
|
103
103
|
"@babel/plugin-transform-modules-commonjs": "^7.18.6",
|
|
104
104
|
"@babel/preset-react": "^7.18.6",
|
|
105
105
|
"@babel/preset-typescript": "^7.18.6",
|
|
106
|
-
"@playwright/test": "^1.25.
|
|
106
|
+
"@playwright/test": "^1.25.2",
|
|
107
107
|
"@simbathesailor/use-what-changed": "^2.0.0",
|
|
108
108
|
"@types/d3": "^7.4.0",
|
|
109
|
-
"@types/jest": "^
|
|
110
|
-
"@types/node": "^18.7.
|
|
111
|
-
"@types/react": "^18.0.
|
|
109
|
+
"@types/jest": "^29.0.3",
|
|
110
|
+
"@types/node": "^18.7.18",
|
|
111
|
+
"@types/react": "^18.0.20",
|
|
112
112
|
"@types/react-dom": "^18.0.6",
|
|
113
|
-
"@vitejs/plugin-react": "^2.0
|
|
113
|
+
"@vitejs/plugin-react": "^2.1.0",
|
|
114
114
|
"@zakodium/eslint-config": "^6.0.0",
|
|
115
115
|
"cross-env": "^7.0.3",
|
|
116
|
-
"eslint": "^8.
|
|
117
|
-
"jest": "^29.0.
|
|
116
|
+
"eslint": "^8.23.1",
|
|
117
|
+
"jest": "^29.0.3",
|
|
118
118
|
"modern-normalize": "^1.1.0",
|
|
119
119
|
"prettier": "^2.7.1",
|
|
120
|
-
"rc-menu": "^9.6.
|
|
120
|
+
"rc-menu": "^9.6.4",
|
|
121
121
|
"react": "^18.2.0",
|
|
122
122
|
"react-dom": "^18.2.0",
|
|
123
|
-
"react-router-dom": "^6.
|
|
123
|
+
"react-router-dom": "^6.4.0",
|
|
124
124
|
"rimraf": "^3.0.2",
|
|
125
125
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
126
126
|
"serve": "^14.0.1",
|
|
127
|
-
"typescript": "~4.8.
|
|
128
|
-
"vite": "^3.
|
|
127
|
+
"typescript": "~4.8.3",
|
|
128
|
+
"vite": "^3.1.1"
|
|
129
129
|
}
|
|
130
|
-
}
|
|
130
|
+
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import Jszip from 'jszip';
|
|
2
|
-
import { NmrRecord, parseSDF } from 'nmredata';
|
|
3
|
-
import { addBruker, addJcamps } from '../../data/SpectraManager';
|
|
4
|
-
import { addRanges } from './util/nmredata/addRanges';
|
|
5
|
-
import { addZones } from './util/nmredata/addZones';
|
|
6
|
-
export async function nmredataToNmrium(file, usedColors) {
|
|
7
|
-
const jszip = new Jszip();
|
|
8
|
-
const zip = await jszip.loadAsync(file.binary);
|
|
9
|
-
const sdfFiles = await getSDF(zip.files);
|
|
10
|
-
const jsonData = await NmrRecord.toJSON({
|
|
11
|
-
sdf: sdfFiles[0],
|
|
12
|
-
zipFiles: zip.files,
|
|
13
|
-
});
|
|
14
|
-
let { spectra, molecules = [] } = jsonData;
|
|
15
|
-
let nmrium = {
|
|
16
|
-
spectra: [],
|
|
17
|
-
molecules,
|
|
18
|
-
};
|
|
19
|
-
for (const data of spectra) {
|
|
20
|
-
const { file, jcampURL } = data.source;
|
|
21
|
-
let spectrum = (await getSpectra(file, { jcampURL }, usedColors)) || [];
|
|
22
|
-
for (const spectrumData of spectrum) {
|
|
23
|
-
const { info } = spectrumData;
|
|
24
|
-
if (info.isFid)
|
|
25
|
-
continue;
|
|
26
|
-
if (info.dimension > 1) {
|
|
27
|
-
addZones(data.signals, spectrumData);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
addRanges(data.signals, spectrumData);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
nmrium.spectra.push(...spectrum);
|
|
34
|
-
}
|
|
35
|
-
return nmrium;
|
|
36
|
-
}
|
|
37
|
-
async function getSpectra(file, options = {}, usedColors = {}) {
|
|
38
|
-
const { xy = true, noContours = true, keepOriginal = true, jcampURL, } = options;
|
|
39
|
-
switch (file.extension) {
|
|
40
|
-
case 'jdx':
|
|
41
|
-
case 'dx':
|
|
42
|
-
return addJcamps([file], usedColors);
|
|
43
|
-
case 'zip':
|
|
44
|
-
return addBruker({ xy, noContours, keepOriginal }, file.binary, usedColors);
|
|
45
|
-
default:
|
|
46
|
-
if (!jcampURL) {
|
|
47
|
-
throw new Error('file extension is not supported');
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function getSDF(zipFiles) {
|
|
52
|
-
let result = [];
|
|
53
|
-
for (const file in zipFiles) {
|
|
54
|
-
const pathFile = file.split('/');
|
|
55
|
-
if (/^[^.].+sdf$/.exec(pathFile[pathFile.length - 1])) {
|
|
56
|
-
const filename = pathFile[pathFile.length - 1].replace(/\.sdf/, '');
|
|
57
|
-
const root = pathFile.slice(0, pathFile.length - 1).join('/');
|
|
58
|
-
const sdf = await zipFiles[file].async('string');
|
|
59
|
-
let parserResult = parseSDF(`${sdf}`, { mixedEOL: true });
|
|
60
|
-
parserResult.filename = filename;
|
|
61
|
-
parserResult.root = root !== '' ? `${root}/` : '';
|
|
62
|
-
result.push(parserResult);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import Jszip from 'jszip';
|
|
2
|
-
import { getGroupedDiastereotopicAtomIDs } from 'openchemlib-utils';
|
|
3
|
-
import { Molecule as OCLMolecule } from 'openchemlib/full';
|
|
4
|
-
import { get1DSignals } from './util/nmredata/get1DSignals';
|
|
5
|
-
import { get2DSignals } from './util/nmredata/get2DSignals';
|
|
6
|
-
import { getLabels } from './util/nmredata/getLabels';
|
|
7
|
-
const tags = {
|
|
8
|
-
solvent: 'SOLVENT',
|
|
9
|
-
temperature: 'TEMPERATURE',
|
|
10
|
-
assignment: 'ASSIGNMENT',
|
|
11
|
-
j: 'J',
|
|
12
|
-
signals: 'SIGNALS',
|
|
13
|
-
id: 'ID',
|
|
14
|
-
};
|
|
15
|
-
export async function nmriumToNmredata(state, options = {}) {
|
|
16
|
-
const { data, // it would be changed depending of the final location
|
|
17
|
-
molecules, } = state || {
|
|
18
|
-
data: [],
|
|
19
|
-
molecules: [],
|
|
20
|
-
};
|
|
21
|
-
let nmrRecord = new Jszip();
|
|
22
|
-
for (const molecule of molecules) {
|
|
23
|
-
await addNMReDATA(data, nmrRecord, {
|
|
24
|
-
...options,
|
|
25
|
-
molecule,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
if (!molecules.length)
|
|
29
|
-
await addNMReDATA(data, nmrRecord, options);
|
|
30
|
-
return nmrRecord;
|
|
31
|
-
}
|
|
32
|
-
async function addNMReDATA(data, nmrRecord, options = {}) {
|
|
33
|
-
let { id, prefix = '\n> <NMREDATA_', filename = 'nmredata', molecule, } = options;
|
|
34
|
-
let sdfResult = '';
|
|
35
|
-
let groupedDiaIDs;
|
|
36
|
-
if (molecule) {
|
|
37
|
-
molecule = OCLMolecule.fromMolfile(molecule.molfile);
|
|
38
|
-
sdfResult += molecule.toMolfile();
|
|
39
|
-
molecule.addImplicitHydrogens();
|
|
40
|
-
groupedDiaIDs = getGroupedDiastereotopicAtomIDs(molecule);
|
|
41
|
-
}
|
|
42
|
-
let labels = molecule
|
|
43
|
-
? getLabels(data, { groupedDiaIDs, molecule })
|
|
44
|
-
: { byDiaID: undefined, byAssignNumber: undefined };
|
|
45
|
-
sdfResult += `${prefix}VERSION>\n1.1\\\n`;
|
|
46
|
-
sdfResult += putTag(data, 'temperature', { prefix });
|
|
47
|
-
sdfResult += putTag(data, 'solvent', { prefix });
|
|
48
|
-
if (id)
|
|
49
|
-
sdfResult += `${prefix + tags.id}>\nid\\\n`;
|
|
50
|
-
sdfResult += formatAssignments(labels.byDiaID, { prefix });
|
|
51
|
-
sdfResult += await get1DSignals(data, nmrRecord, { prefix, labels });
|
|
52
|
-
sdfResult += await get2DSignals(data, nmrRecord, { prefix, labels });
|
|
53
|
-
sdfResult += '\n$$$$\n';
|
|
54
|
-
nmrRecord.file(`${filename}.sdf`, sdfResult);
|
|
55
|
-
}
|
|
56
|
-
function formatAssignments(labels, options) {
|
|
57
|
-
if (!labels)
|
|
58
|
-
return '';
|
|
59
|
-
const { prefix } = options;
|
|
60
|
-
let str = `${prefix + tags.assignment}>\n`;
|
|
61
|
-
for (let l in labels) {
|
|
62
|
-
let atoms = labels[l].atoms;
|
|
63
|
-
str += `${labels[l].label}, ${labels[l].shift}`; // change to add label
|
|
64
|
-
for (let atom of atoms)
|
|
65
|
-
str += `, ${atom}`;
|
|
66
|
-
str += '\\\n';
|
|
67
|
-
}
|
|
68
|
-
return str;
|
|
69
|
-
}
|
|
70
|
-
function putTag(spectra, tag, options = { prefix: '' }) {
|
|
71
|
-
const { prefix } = options;
|
|
72
|
-
let str = '';
|
|
73
|
-
for (let spectrum of spectra) {
|
|
74
|
-
if (spectrum.info[tag]) {
|
|
75
|
-
str += `${prefix + tags[tag]}>\n${String(spectrum.info[tag])}\\\n`;
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return str;
|
|
80
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function addRanges(signals: any, datum: any): void;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { mapRanges } from '../../../../data/data1d/Spectrum1D';
|
|
2
|
-
export function addRanges(signals, datum) {
|
|
3
|
-
let ranges = [];
|
|
4
|
-
const { baseFrequency: frequency = 500 } = datum;
|
|
5
|
-
for (const signal of signals) {
|
|
6
|
-
const { jCoupling: js, delta, diaIDs = [], multiplicity, integration, } = signal;
|
|
7
|
-
const fromTo = computeFromTo({ delta, js, frequency });
|
|
8
|
-
if (js && multiplicity) {
|
|
9
|
-
if (js.length === multiplicity.length) {
|
|
10
|
-
js.sort((a, b) => b - a);
|
|
11
|
-
for (let i = 0; i < js.length; i++) {
|
|
12
|
-
js[i].multiplicity = multiplicity[i];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
ranges.push({
|
|
17
|
-
...fromTo,
|
|
18
|
-
integration,
|
|
19
|
-
signals: [
|
|
20
|
-
{
|
|
21
|
-
js,
|
|
22
|
-
delta,
|
|
23
|
-
diaIDs,
|
|
24
|
-
multiplicity,
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
datum.ranges.values = mapRanges(joinRanges(ranges), datum);
|
|
30
|
-
}
|
|
31
|
-
function computeFromTo(options = {}) {
|
|
32
|
-
const { delta, js: couplings = [], frequency } = options;
|
|
33
|
-
let width = 0.5;
|
|
34
|
-
for (let j of couplings) {
|
|
35
|
-
width += j.coupling;
|
|
36
|
-
}
|
|
37
|
-
width /= frequency;
|
|
38
|
-
return { from: delta - width, to: delta + width };
|
|
39
|
-
}
|
|
40
|
-
function joinRanges(ranges) {
|
|
41
|
-
ranges.sort((a, b) => a.from - b.from);
|
|
42
|
-
for (let i = 0; i < ranges.length - 1; i++) {
|
|
43
|
-
if (ranges[i].to > ranges[i + 1].from) {
|
|
44
|
-
ranges[i].to = Math.max(ranges[i + 1].to, ranges[i].to);
|
|
45
|
-
ranges[i].signals = ranges[i].signals.concat(ranges[i + 1].signals);
|
|
46
|
-
ranges[i].integration += ranges[i + 1].integration;
|
|
47
|
-
ranges.splice(i + 1, 1);
|
|
48
|
-
i--;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return ranges;
|
|
52
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import Jszip from 'jszip';
|
|
2
|
-
const jszip = new Jszip();
|
|
3
|
-
export async function addSource(nmrRecord, options = {}) {
|
|
4
|
-
const { spectrum, source } = options;
|
|
5
|
-
const { file = {}, jcampURL } = source;
|
|
6
|
-
let tag = '';
|
|
7
|
-
const dimension = `${spectrum.info.dimension}d`;
|
|
8
|
-
switch (file.extension) {
|
|
9
|
-
case 'jdx':
|
|
10
|
-
case 'dx':
|
|
11
|
-
tag += `\nJcamp_Location=file:jcamp/${dimension}/${spectrum.display.name}\\`;
|
|
12
|
-
nmrRecord.file(`jcamp/${dimension}/${spectrum.display.name}`, file.binary);
|
|
13
|
-
break;
|
|
14
|
-
case 'zip':
|
|
15
|
-
if (!file.binary)
|
|
16
|
-
return;
|
|
17
|
-
void jszip.loadAsync(file.binary).then(async (zip) => {
|
|
18
|
-
for (const file in zip.files) {
|
|
19
|
-
if (file.endsWith('/'))
|
|
20
|
-
continue;
|
|
21
|
-
nmrRecord.file(`Bruker/${file}`, await zip.file(file)?.async('arraybuffer'));
|
|
22
|
-
}
|
|
23
|
-
tag += `\nSpectrum_Location=file:Bruker/${getPathFromZip(zip)}\\`;
|
|
24
|
-
});
|
|
25
|
-
break;
|
|
26
|
-
default:
|
|
27
|
-
if (!jcampURL)
|
|
28
|
-
break;
|
|
29
|
-
await fetch(jcampURL).then(async (jcamp) => {
|
|
30
|
-
if (!jcamp)
|
|
31
|
-
return;
|
|
32
|
-
let name = jcampURL.split('/').slice(-1);
|
|
33
|
-
const path = `jcamp/${dimension}/${name}`;
|
|
34
|
-
tag += `\nJcamp_Location=file:${path}\\`;
|
|
35
|
-
nmrRecord.file(path, await jcamp.arrayBuffer());
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
return tag;
|
|
39
|
-
}
|
|
40
|
-
function getPathFromZip(zip) {
|
|
41
|
-
let files = zip.filter((relativePath) => {
|
|
42
|
-
if (relativePath.match('__MACOSX'))
|
|
43
|
-
return false;
|
|
44
|
-
if (relativePath.endsWith('fid') ||
|
|
45
|
-
relativePath.endsWith('1r') ||
|
|
46
|
-
relativePath.endsWith('ser') ||
|
|
47
|
-
relativePath.endsWith('2rr')) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
return false;
|
|
51
|
-
});
|
|
52
|
-
const index = files.findIndex((file) => file.name.endsWith('1r') || file.name.endsWith('2rr'));
|
|
53
|
-
return index > -1 ? files[index].name : files[0].name;
|
|
54
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function addZones(signals: any, datum: any): void;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { v4 } from '@lukeed/uuid';
|
|
2
|
-
import { getShift } from '../../../../data/data2d/Spectrum2D';
|
|
3
|
-
const axisLabels = ['y', 'x'];
|
|
4
|
-
export function addZones(signals, datum) {
|
|
5
|
-
let zones = [];
|
|
6
|
-
const shift = getShift(datum);
|
|
7
|
-
const { baseFrequency } = datum.info;
|
|
8
|
-
const frequency = { x: baseFrequency[0], y: baseFrequency[1] };
|
|
9
|
-
for (const signal of signals) {
|
|
10
|
-
let zone = { x: {}, y: {}, id: v4(), kind: 'signal' };
|
|
11
|
-
let signalFormated = { id: v4(), kind: 'signal', peaks: [] };
|
|
12
|
-
let width = { x: 10, y: 10 };
|
|
13
|
-
for (let axis of axisLabels) {
|
|
14
|
-
let { coupling = [], delta, diaIDs = [] } = signal[axis];
|
|
15
|
-
for (let j of coupling) {
|
|
16
|
-
width[axis] += j.coupling;
|
|
17
|
-
}
|
|
18
|
-
if (signal.activeCoupling) {
|
|
19
|
-
const { activeCoupling = [] } = signal;
|
|
20
|
-
for (let j of activeCoupling) {
|
|
21
|
-
width[axis] += j.coupling;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
width[axis] /= frequency[axis];
|
|
25
|
-
zone[axis] = {
|
|
26
|
-
from: delta - width[axis],
|
|
27
|
-
to: delta + width[axis],
|
|
28
|
-
};
|
|
29
|
-
signalFormated[axis] = {
|
|
30
|
-
delta,
|
|
31
|
-
diaIDs,
|
|
32
|
-
originDelta: delta - shift[`${axis}Shift`],
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
zones.push({
|
|
36
|
-
...zone,
|
|
37
|
-
signals: [signalFormated],
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
datum.zones.values = zones;
|
|
41
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function flat2DSignals(signals: any): any[];
|