diff --git a/package-lock.json b/package-lock.json index 5a1b92569..a7fba938d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,8 +39,8 @@ "ml-stat": "^1.3.3", "multiplet-analysis": "^2.1.2", "nmr-correlation": "^2.3.3", - "nmr-load-save": "^0.22.2", - "nmr-processing": "^11.3.0", + "nmr-load-save": "^0.22.4", + "nmr-processing": "^11.4.1", "nmredata": "^0.9.7", "numeral": "^2.0.6", "openchemlib": "^8.7.1", @@ -981,9 +981,9 @@ "dev": true }, "node_modules/@cspell/dict-fsharp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@cspell/dict-fsharp/-/dict-fsharp-1.0.0.tgz", - "integrity": "sha512-dHPkMHwW4dWv3Lv9VWxHuVm4IylqvcfRBSnZ7usJTRThraetSVrOPIJwr6UJh7F5un/lGJx2lxWVApf2WQaB/A==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@cspell/dict-fsharp/-/dict-fsharp-1.0.1.tgz", + "integrity": "sha512-23xyPcD+j+NnqOjRHgW3IU7Li912SX9wmeefcY0QxukbAxJ/vAN4rBpjSwwYZeQPAn3fxdfdNZs03fg+UM+4yQ==", "dev": true }, "node_modules/@cspell/dict-fullstack": { @@ -3769,6 +3769,12 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "node_modules/@vitejs/plugin-react-swc": { "version": "3.4.0", "resolved": "https://registry.npmjs.org/@vitejs/plugin-react-swc/-/plugin-react-swc-3.4.0.tgz", @@ -6169,27 +6175,27 @@ } }, "node_modules/es-abstract": { - "version": "1.22.2", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.2.tgz", - "integrity": "sha512-YoxfFcDmhjOgWPWsV13+2RNjq1F6UQnfs+8TftwNqtzlmFzEXvlUwdrNrYeaizfjQzRMxkZ6ElWMOJIFKdVqwA==", + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.3.tgz", + "integrity": "sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==", "dev": true, "peer": true, "dependencies": { "array-buffer-byte-length": "^1.0.0", "arraybuffer.prototype.slice": "^1.0.2", "available-typed-arrays": "^1.0.5", - "call-bind": "^1.0.2", + "call-bind": "^1.0.5", "es-set-tostringtag": "^2.0.1", "es-to-primitive": "^1.2.1", "function.prototype.name": "^1.1.6", - "get-intrinsic": "^1.2.1", + "get-intrinsic": "^1.2.2", "get-symbol-description": "^1.0.0", "globalthis": "^1.0.3", "gopd": "^1.0.1", - "has": "^1.0.3", "has-property-descriptors": "^1.0.0", "has-proto": "^1.0.1", "has-symbols": "^1.0.3", + "hasown": "^2.0.0", "internal-slot": "^1.0.5", "is-array-buffer": "^3.0.2", "is-callable": "^1.2.7", @@ -6199,7 +6205,7 @@ "is-string": "^1.0.7", "is-typed-array": "^1.1.12", "is-weakref": "^1.0.2", - "object-inspect": "^1.12.3", + "object-inspect": "^1.13.1", "object-keys": "^1.1.1", "object.assign": "^4.1.4", "regexp.prototype.flags": "^1.5.1", @@ -6213,7 +6219,7 @@ "typed-array-byte-offset": "^1.0.0", "typed-array-length": "^1.0.4", "unbox-primitive": "^1.0.2", - "which-typed-array": "^1.1.11" + "which-typed-array": "^1.1.13" }, "engines": { "node": ">= 0.4" @@ -6246,28 +6252,28 @@ } }, "node_modules/es-set-tostringtag": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.1.tgz", - "integrity": "sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz", + "integrity": "sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==", "dev": true, "peer": true, "dependencies": { - "get-intrinsic": "^1.1.3", - "has": "^1.0.3", - "has-tostringtag": "^1.0.0" + "get-intrinsic": "^1.2.2", + "has-tostringtag": "^1.0.0", + "hasown": "^2.0.0" }, "engines": { "node": ">= 0.4" } }, "node_modules/es-shim-unscopables": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz", - "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", + "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", "dev": true, "peer": true, "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" } }, "node_modules/es-to-primitive": { @@ -6359,6 +6365,7 @@ "@humanwhocodes/config-array": "^0.11.11", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -7372,8 +7379,6 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, - "peer": true, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -7436,16 +7441,16 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", - "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", + "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", "dev": true, "peer": true, "dependencies": { - "function-bind": "^1.1.1", - "has": "^1.0.3", + "function-bind": "^1.1.2", "has-proto": "^1.0.1", - "has-symbols": "^1.0.3" + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -7723,6 +7728,8 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz", "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==", + "dev": true, + "peer": true, "engines": { "node": ">= 0.4.0" } @@ -7755,13 +7762,13 @@ } }, "node_modules/has-property-descriptors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", - "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", + "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", "dev": true, "peer": true, "dependencies": { - "get-intrinsic": "^1.1.1" + "get-intrinsic": "^1.2.2" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -7809,6 +7816,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/header-case": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", @@ -8018,14 +8036,14 @@ } }, "node_modules/internal-slot": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz", - "integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==", + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz", + "integrity": "sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==", "dev": true, "peer": true, "dependencies": { - "get-intrinsic": "^1.2.0", - "has": "^1.0.3", + "get-intrinsic": "^1.2.2", + "hasown": "^2.0.0", "side-channel": "^1.0.4" }, "engines": { @@ -8154,11 +8172,11 @@ } }, "node_modules/is-core-module": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", - "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -9858,9 +9876,9 @@ } }, "node_modules/nmr-load-save": { - "version": "0.22.2", - "resolved": "https://registry.npmjs.org/nmr-load-save/-/nmr-load-save-0.22.2.tgz", - "integrity": "sha512-vWz0DHsb5Nppr0AH0T+bEs6XVww20nHDuKzTFTsZL3cBgaHMR2qA8R6LSn4tgt6XH5zZ83Q6nWh5K2n7UkNuDA==", + "version": "0.22.4", + "resolved": "https://registry.npmjs.org/nmr-load-save/-/nmr-load-save-0.22.4.tgz", + "integrity": "sha512-U3HAOz67ilLKLKoCKVQciGma8e/FPE9bM/J9k+1BJEU+JgmWuLPt4bqIoGz8E2A5huvKD1/JW38SrMXZvOWCVg==", "dependencies": { "@lukeed/uuid": "^2.0.1", "@types/lodash.merge": "^4.6.7", @@ -9875,7 +9893,7 @@ "lodash.merge": "^4.6.2", "ml-spectra-processing": "^12.5.1", "nmr-correlation": "^2.3.3", - "nmr-processing": "^11.3.0", + "nmr-processing": "^11.4.1", "nmredata": "^0.9.7", "openchemlib": "^8.7.0", "openchemlib-utils": "^5.4.0", @@ -9884,9 +9902,9 @@ } }, "node_modules/nmr-processing": { - "version": "11.3.0", - "resolved": "https://registry.npmjs.org/nmr-processing/-/nmr-processing-11.3.0.tgz", - "integrity": "sha512-ggUWG7NEnrFidWxN1Lc31H2NpHt3IYLVAAoU28KFrbfA5o0+qus0N3TGkjbnmymNzYYuwQC5/ZQ/dLgAL04qoA==", + "version": "11.4.1", + "resolved": "https://registry.npmjs.org/nmr-processing/-/nmr-processing-11.4.1.tgz", + "integrity": "sha512-pA/Z5vWcQcetaB3UHip0+XahjNQh7c9JPAE9uC+HHpRoagb13U4cnO4RLApdxOTKzjKwsXC4sSwtZKqJbpES4A==", "dependencies": { "@lukeed/uuid": "^2.0.1", "binary-search": "^1.3.6", @@ -9902,7 +9920,7 @@ "ml-gsd": "^12.1.3", "ml-hclust": "^3.1.0", "ml-levenberg-marquardt": "^4.1.3", - "ml-matrix": "^6.10.5", + "ml-matrix": "^6.10.7", "ml-matrix-convolution": "^1.0.0", "ml-matrix-peaks-finder": "^1.0.0", "ml-peak-shape-generator": "^4.1.2", diff --git a/package.json b/package.json index d3edaa3c9..1b159e99a 100644 --- a/package.json +++ b/package.json @@ -86,8 +86,8 @@ "ml-stat": "^1.3.3", "multiplet-analysis": "^2.1.2", "nmr-correlation": "^2.3.3", - "nmr-load-save": "^0.22.2", - "nmr-processing": "^11.3.0", + "nmr-load-save": "^0.22.4", + "nmr-processing": "^11.4.1", "nmredata": "^0.9.7", "numeral": "^2.0.6", "openchemlib": "^8.7.1", diff --git a/public/data/oxfordInstruments/ethylCrotonate.zip b/public/data/oxfordInstruments/ethylCrotonate.zip new file mode 100644 index 000000000..fa0de2119 Binary files /dev/null and b/public/data/oxfordInstruments/ethylCrotonate.zip differ diff --git a/public/data/oxfordInstruments/oxfordCosy.json b/public/data/oxfordInstruments/oxfordCosy.json new file mode 100644 index 000000000..17a2a12bd --- /dev/null +++ b/public/data/oxfordInstruments/oxfordCosy.json @@ -0,0 +1,174 @@ +{ + "data": { + "source": { + "baseURL": "", + "entries": [ + { + "relativePath": "data/oxfordInstruments/ethylCrotonate.zip" + } + ] + }, + "spectra": [ + { + "sourceSelector": { + "files": [ + "data/oxfordInstruments/ethylCrotonate.zip/Ethyl Crotonate, 1H-1H COSY.jdx" + ] + }, + "filters": [ + { + "name": "blpDimension1", + "label": "Backward-LP Dimension 1", + "value": {}, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "apodizationDimension1", + "label": "Apodization on Dimension 1", + "value": { + "compose": { + "shapes": [ + { + "shape": { + "kind": "sineBell", + "options": { + "offset": 0, + "exponent": 2 + } + } + } + ] + }, + "apply": true + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "fftDimension1", + "label": "FFT Dimension 1", + "value": { + "phaseCorrection": { + "mode": "mc" + }, + "zeroFilling": { + "nbPoints": 2048 + } + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "flpDimension2", + "label": "Forward-LP Dimension 2", + "value": {}, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "apodizationDimension2", + "label": "Apodization on Dimension 2", + "value": { + "compose": { + "shapes": [ + { + "shape": { + "kind": "sineBell", + "options": { + "offset": 0, + "exponent": 2 + } + } + } + ] + }, + "apply": true + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "fftDimension2", + "label": "FFT Dimension 2", + "value": { + "phaseCorrection": { + "mode": "mc" + }, + "zeroFilling": { + "nbPoints": 2048 + } + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "symmetrizeCosyLike", + "label": "symmetrize COSY-like", + "value": {}, + "flag": true, + "isDeleteAllow": true + } + ] + }, + { + "sourceSelector": { + "files": [ + "data/oxfordInstruments/ethylCrotonate.zip/Ethyl Crotonate, 1H FID.jdx" + ] + }, + "filters": [ + { + "name": "backwardLinearPrediction", + "label": "Backward Linear Prediction Filter", + "value": { + "nbInputs": 16384 + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "apodization", + "label": "Apodization", + "value": { + "lineBroadening": 1, + "gaussBroadening": 0, + "lineBroadeningCenter": 0 + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "zeroFilling", + "label": "Zero Filling", + "value": { + "nbPoints": 32768 + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "fft", + "label": "FFT", + "value": {}, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "phaseCorrection", + "label": "Phase correction", + "value": { + "ph0": -126, + "ph1": 0, + "absolute": false + }, + "flag": true, + "isDeleteAllow": true + } + ] + } + ], + "molecules": [] + }, + "version": 5 +} \ No newline at end of file diff --git a/public/data/oxfordInstruments/oxfordHSQC.json b/public/data/oxfordInstruments/oxfordHSQC.json new file mode 100644 index 000000000..2c9f8e039 --- /dev/null +++ b/public/data/oxfordInstruments/oxfordHSQC.json @@ -0,0 +1,112 @@ +{ + "data": { + "source": { + "baseURL": "", + "entries": [ + { + "relativePath": "data/oxfordInstruments/ethylCrotonate.zip" + } + ] + }, + "spectra": [ + { + "sourceSelector": { + "files": [ + "data/oxfordInstruments/ethylCrotonate.zip/Ethyl Crotonate, 1H-13C HSQC-ME.jdx" + ] + }, + "filters": [ + { + "name": "blpDimension1", + "value": {}, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "apodizationDimension1", + "value": { + "compose": { + "shapes": [ + { + "shape": { + "kind": "traf", + "options": { + "lb": 0.5 + } + } + } + ] + }, + "apply": false + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "fftDimension1", + "label": "FFT on Dimension 1", + "value": { + "zeroFilling": { + "nbPoints": 2048 + }, + "phaseCorrection": { + "mode": "pk", + "ph0": -47, + "ph1": 236 + } + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "flpDimension2", + "value": {}, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "apodizationDimension2", + "value": { + "compose": { + "shapes": [ + { + "shape": { + "kind": "traf", + "options": { + "lb": 0.5 + } + } + }, + { + "shape": { + "kind": "sineBell", + "options": { + "offset": 0.5, + "exponent": 2 + } + } + } + ] + }, + "apply": false + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "fftDimension2", + "value": { + "zeroFilling": { + "nbPoints": 2048 + } + }, + "flag": true, + "isDeleteAllow": true + } + ] + } + ], + "molecules": [] + }, + "version": 5 +} \ No newline at end of file diff --git a/public/data/oxfordInstruments/oxfordInstruments.json b/public/data/oxfordInstruments/oxfordInstruments.json new file mode 100644 index 000000000..901f9c8a9 --- /dev/null +++ b/public/data/oxfordInstruments/oxfordInstruments.json @@ -0,0 +1,82 @@ +{ + "data": { + "source": { + "baseURL": "", + "entries": [ + { + "relativePath": "data/oxfordInstruments/ethylCrotonate.zip" + } + ] + }, + "spectra": [ + { + "sourceSelector": { + "files": [ + "data/oxfordInstruments/ethylCrotonate.zip/Ethyl Crotonate, 1H FID.jdx" + ] + }, + "filters": [ + { + "name": "digitalFilter", + "label": "Digital Filter", + "value": { + "digitalFilterValue": 0 + }, + "id": "00167756-e605-4129-ae90-7f17274ac7ee", + "flag": true, + "isDeleteAllow": false + }, + { + "name": "apodization", + "label": "Apodization", + "value": { + "lineBroadening": 1, + "gaussBroadening": 0, + "lineBroadeningCenter": 0 + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "zeroFilling", + "label": "Zero Filling", + "value": { + "nbPoints": 32768 + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "backwardLinearPrediction", + "label": "Backward Linear Prediction Filter", + "value": { + "nbInputs": 16384 + }, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "fft", + "label": "FFT", + "value": {}, + "flag": true, + "isDeleteAllow": true + }, + { + "name": "phaseCorrection", + "label": "Phase correction", + "value": { + "ph0": -126, + "ph1": 0, + "absolute": false + }, + "flag": true, + "isDeleteAllow": true + } + ] + } + ], + "molecules": [] + }, + "version": 5 +} \ No newline at end of file diff --git a/src/data/data1d/Spectrum1D/initiateDatum1D.ts b/src/data/data1d/Spectrum1D/initiateDatum1D.ts index 7e2d4ed8d..033612975 100644 --- a/src/data/data1d/Spectrum1D/initiateDatum1D.ts +++ b/src/data/data1d/Spectrum1D/initiateDatum1D.ts @@ -3,14 +3,15 @@ import { Spectrum1D } from 'nmr-load-save'; import { BaseFilter, FiltersManager, Filters } from 'nmr-processing'; import { UsedColors } from '../../../types/UsedColors'; -import { StateMoleculeExtended } from '../../molecules/Molecule'; -import { initSumOptions } from './SumManager'; import { convertDataToFloat64Array } from './convertDataToFloat64Array'; import { get1DColor } from './get1DColor'; import { initiateIntegrals } from './integrals/initiateIntegrals'; import { initiatePeaks } from './peaks/initiatePeaks'; import { initiateRanges } from './ranges/initiateRanges'; +import { initSumOptions } from './SumManager'; +import { StateMoleculeExtended } from '../../molecules/Molecule'; +import { initiateFilters } from '../../initiateFilters'; export interface InitiateDatum1DOptions { usedColors?: UsedColors; @@ -53,7 +54,7 @@ export function initiateDatum1D( spectrumObj.originalData = spectrumObj.data; - spectrumObj.filters = Object.assign([], spectrum.filters); //array of object {name: "FilterName", options: FilterOptions = {value | object} } + spectrumObj.filters = initiateFilters(spectrum?.filters); //array of object {name: "FilterName", options: FilterOptions = {value | object} } const { nucleus } = spectrumObj.info; diff --git a/src/data/data2d/Spectrum2D/initiateDatum2D.ts b/src/data/data2d/Spectrum2D/initiateDatum2D.ts index 2385f27a8..6ec535c92 100644 --- a/src/data/data2d/Spectrum2D/initiateDatum2D.ts +++ b/src/data/data2d/Spectrum2D/initiateDatum2D.ts @@ -5,6 +5,7 @@ import { FiltersManager } from 'nmr-processing'; import { DEFAULT_CONTOURS_OPTIONS } from './contours'; import { get2DColor } from './get2DColor'; import { initiateZones } from './zones/initiateZones'; +import { initiateFilters } from '../../initiateFilters'; const defaultMinMax = { z: [], minX: 0, minY: 0, maxX: 0, maxY: 0 }; @@ -40,7 +41,7 @@ export function initiateDatum2D(spectrum: any, usedColors = {}): Spectrum2D { datum.data = getData(datum, spectrum); datum.originalData = datum.data; - datum.filters = Object.assign([], spectrum.filters); + datum.filters = initiateFilters(spectrum?.filters); datum.zones = initiateZones(spectrum, datum as Spectrum2D); diff --git a/src/data/initiateFilters.ts b/src/data/initiateFilters.ts new file mode 100644 index 000000000..fcd6a6dc5 --- /dev/null +++ b/src/data/initiateFilters.ts @@ -0,0 +1,8 @@ +import { v4 } from '@lukeed/uuid'; +import { Filter } from 'nmr-processing'; + +export function initiateFilters(inputFilters: Filter[] | undefined) { + if (!inputFilters || !Array.isArray(inputFilters)) return []; + + return inputFilters.map((filter) => ({ ...filter, id: filter?.id || v4() })); +} diff --git a/src/demo/samples.json b/src/demo/samples.json index a659a607b..77829160b 100644 --- a/src/demo/samples.json +++ b/src/demo/samples.json @@ -120,6 +120,14 @@ "file": "./data/nmriumFromSource.json", "title": "Zip file as source with multiple spectra" }, + { + "file": "./data/oxfordInstruments/oxfordInstruments.json", + "title": "Ethyl Crotonate - oxford" + }, + { + "file": "./data/oxfordInstruments/oxfordCosy.json", + "title": "Ethyl Crotonate - COSY - oxford" + }, { "file": "./data/nmredata/nmredata.json", "title": "NMReDATA Menthol 1D"