nmr-processing 9.2.0-pre.1668170175 → 9.3.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/README.md +1 -0
- package/lib/signals/signalsToFID.d.ts +29 -0
- package/lib/signals/signalsToFID.js +7 -1
- package/lib/signals/signalsToFID.js.map +1 -1
- package/lib-esm/signals/signalsToFID.js +7 -1
- package/lib-esm/signals/signalsToFID.js.map +1 -1
- package/package.json +10 -10
- package/src/signals/signalsToFID.ts +30 -1
package/README.md
CHANGED
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
import { NMRSignal1D } from './NMRSignal1D';
|
|
2
2
|
export interface SignalsToFIDOptions {
|
|
3
|
+
/**
|
|
4
|
+
* at the end of the superposition of all component, an exponential apodization will be applied
|
|
5
|
+
* in order to have FID like shape.
|
|
6
|
+
* @default 1
|
|
7
|
+
*/
|
|
3
8
|
lb?: number;
|
|
9
|
+
/**
|
|
10
|
+
* lower limit of the spectrum
|
|
11
|
+
* @default 0
|
|
12
|
+
*/
|
|
4
13
|
from?: number;
|
|
14
|
+
/**
|
|
15
|
+
* upper limit of the spectrum
|
|
16
|
+
* @default 10
|
|
17
|
+
*/
|
|
5
18
|
to?: number;
|
|
19
|
+
/**
|
|
20
|
+
* number of points of the resulting FID
|
|
21
|
+
*/
|
|
6
22
|
nbPoints?: number;
|
|
23
|
+
/**
|
|
24
|
+
* It is the frequency of the carrier (e.g. SFO1 for bruker spectrometers)
|
|
25
|
+
*/
|
|
7
26
|
frequency?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Maximum number of atoms on each cluster that can be considered to be simulated together.
|
|
29
|
+
* It affects the the quality and speed of the simulation.
|
|
30
|
+
*/
|
|
8
31
|
maxClusterSize?: number;
|
|
9
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* it use the chemical shifts and the coupling between them in order to generate a FID.
|
|
35
|
+
* It does not propagate the hamiltonian of the spin system, instead it simulate all the
|
|
36
|
+
* frequencies in the spectrum (including second order) and add all the waves in a real and
|
|
37
|
+
* imaginary parts, that is why the couplings should be assigned in order to generate the spin system.
|
|
38
|
+
*/
|
|
10
39
|
export declare function signalsToFID(signals: NMRSignal1D[], options: SignalsToFIDOptions): {
|
|
11
40
|
re: import("cheminfo-types").DoubleArray;
|
|
12
41
|
im: import("cheminfo-types").DoubleArray;
|
|
@@ -7,6 +7,12 @@ const signalsToSpinSystem_1 = require("./simulation/signalsToSpinSystem");
|
|
|
7
7
|
const simulateXYPeaks_1 = require("./simulation/simulateXYPeaks");
|
|
8
8
|
const splitSpinSystem_1 = require("./simulation/splitSpinSystem");
|
|
9
9
|
const twoPi = Math.PI * 2;
|
|
10
|
+
/**
|
|
11
|
+
* it use the chemical shifts and the coupling between them in order to generate a FID.
|
|
12
|
+
* It does not propagate the hamiltonian of the spin system, instead it simulate all the
|
|
13
|
+
* frequencies in the spectrum (including second order) and add all the waves in a real and
|
|
14
|
+
* imaginary parts, that is why the couplings should be assigned in order to generate the spin system.
|
|
15
|
+
*/
|
|
10
16
|
function signalsToFID(signals, options) {
|
|
11
17
|
const { lb = 1, from = 0, to = 10, nbPoints = 1024, frequency = 400, maxClusterSize = 8, } = options;
|
|
12
18
|
let spinSystem = (0, signalsToSpinSystem_1.signalsToSpinSystem)(signals);
|
|
@@ -18,7 +24,7 @@ function signalsToFID(signals, options) {
|
|
|
18
24
|
const re = new Float64Array(nbPoints);
|
|
19
25
|
const im = new Float64Array(nbPoints);
|
|
20
26
|
const sw = Math.abs(to - from);
|
|
21
|
-
const adquisitionTime = nbPoints / (
|
|
27
|
+
const adquisitionTime = nbPoints / (sw * frequency);
|
|
22
28
|
const time = (0, ml_spectra_processing_1.xSequentialFill)({
|
|
23
29
|
size: nbPoints,
|
|
24
30
|
from: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signalsToFID.js","sourceRoot":"","sources":["../../src/signals/signalsToFID.ts"],"names":[],"mappings":";;;AAAA,iEAAwD;AAExD,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MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;QACtB,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAAG,KAAK,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE;YACjC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACrC;KACF;IAED,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,GAAG,IAAA,yBAAW,EAC3C,EAAE,EAAE,EAAE,EAAE,EAAE,EACV;QACE,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE;YACP,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN;oBACE,KAAK,EAAE,CAAC;oBACR,KAAK,EAAE;wBACL,IAAI,EAAE,aAAa;wBACnB,OAAO,EAAE;4BACP,EAAE,EAAE,eAAe,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC;4BACpC,EAAE;yBACH;qBACF;iBACF;aACF;SACF;KACF,CACF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC;AA/DD,oCA+DC"}
|
|
@@ -4,6 +4,12 @@ import { signalsToSpinSystem } from './simulation/signalsToSpinSystem';
|
|
|
4
4
|
import { simulateXYPeaks } from './simulation/simulateXYPeaks';
|
|
5
5
|
import { splitSpinSystem } from './simulation/splitSpinSystem';
|
|
6
6
|
const twoPi = Math.PI * 2;
|
|
7
|
+
/**
|
|
8
|
+
* it use the chemical shifts and the coupling between them in order to generate a FID.
|
|
9
|
+
* It does not propagate the hamiltonian of the spin system, instead it simulate all the
|
|
10
|
+
* frequencies in the spectrum (including second order) and add all the waves in a real and
|
|
11
|
+
* imaginary parts, that is why the couplings should be assigned in order to generate the spin system.
|
|
12
|
+
*/
|
|
7
13
|
export function signalsToFID(signals, options) {
|
|
8
14
|
const { lb = 1, from = 0, to = 10, nbPoints = 1024, frequency = 400, maxClusterSize = 8, } = options;
|
|
9
15
|
let spinSystem = signalsToSpinSystem(signals);
|
|
@@ -15,7 +21,7 @@ export function signalsToFID(signals, options) {
|
|
|
15
21
|
const re = new Float64Array(nbPoints);
|
|
16
22
|
const im = new Float64Array(nbPoints);
|
|
17
23
|
const sw = Math.abs(to - from);
|
|
18
|
-
const adquisitionTime = nbPoints / (
|
|
24
|
+
const adquisitionTime = nbPoints / (sw * frequency);
|
|
19
25
|
const time = xSequentialFill({
|
|
20
26
|
size: nbPoints,
|
|
21
27
|
from: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signalsToFID.js","sourceRoot":"","sources":["../../src/signals/signalsToFID.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"signalsToFID.js","sourceRoot":"","sources":["../../src/signals/signalsToFID.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAkC/D,MAAM,KAAK,G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AG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YACpC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;SACrC;KACF;IAED,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,EAAE,GAAG,WAAW,CAC3C,EAAE,EAAE,EAAE,EAAE,EAAE,EACV;QACE,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE;YACP,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE;gBACN;oBACE,KAAK,EAAE,CAAC;oBACR,KAAK,EAAE;wBACL,IAAI,EAAE,aAAa;wBACnB,OAAO,EAAE;4BACP,EAAE,EAAE,eAAe,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC;4BACpC,EAAE;yBACH;qBACF;iBACF;aACF;SACF;KACF,CACF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nmr-processing",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "Pure functions allowing to process NMR spectra.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"module": "./lib-esm/index.js",
|
|
@@ -38,20 +38,20 @@
|
|
|
38
38
|
},
|
|
39
39
|
"homepage": "https://github.com/cheminfo/nmr-processing#readme",
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/jest": "^
|
|
41
|
+
"@types/jest": "^29.2.2",
|
|
42
42
|
"cheminfo-build": "^1.1.11",
|
|
43
43
|
"cheminfo-types": "^1.4.0",
|
|
44
|
-
"eslint": "^8.
|
|
45
|
-
"eslint-config-cheminfo-typescript": "^11.
|
|
46
|
-
"jest": "^
|
|
44
|
+
"eslint": "^8.27.0",
|
|
45
|
+
"eslint-config-cheminfo-typescript": "^11.2.2",
|
|
46
|
+
"jest": "^29.3.1",
|
|
47
47
|
"jest-matcher-deep-close-to": "^3.0.2",
|
|
48
48
|
"md5": "^2.3.0",
|
|
49
49
|
"nmr-xy-testdata": "^0.5.1",
|
|
50
|
-
"openchemlib": "^8.0.
|
|
50
|
+
"openchemlib": "^8.0.1",
|
|
51
51
|
"prettier": "^2.7.1",
|
|
52
52
|
"rimraf": "^3.0.2",
|
|
53
|
-
"ts-jest": "^
|
|
54
|
-
"typescript": "^4.
|
|
53
|
+
"ts-jest": "^29.0.3",
|
|
54
|
+
"typescript": "^4.8.4"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@lukeed/uuid": "^2.0.0",
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
"ml-gsd": "^12.1.2",
|
|
69
69
|
"ml-hclust": "^3.1.0",
|
|
70
70
|
"ml-levenberg-marquardt": "^4.1.0",
|
|
71
|
-
"ml-matrix": "^6.10.
|
|
71
|
+
"ml-matrix": "^6.10.4",
|
|
72
72
|
"ml-matrix-convolution": "^1.0.0",
|
|
73
73
|
"ml-matrix-peaks-finder": "^1.0.0",
|
|
74
74
|
"ml-peak-shape-generator": "^4.1.2",
|
|
75
75
|
"ml-simple-clustering": "^0.1.0",
|
|
76
76
|
"ml-sparse-matrix": "^2.1.0",
|
|
77
|
-
"ml-spectra-processing": "^11.
|
|
77
|
+
"ml-spectra-processing": "^11.14.0",
|
|
78
78
|
"ml-tree-set": "^0.1.1",
|
|
79
79
|
"nmr-correlation": "^2.3.3",
|
|
80
80
|
"openchemlib-utils": "^2.0.0",
|
|
@@ -8,16 +8,45 @@ import { simulateXYPeaks } from './simulation/simulateXYPeaks';
|
|
|
8
8
|
import { splitSpinSystem } from './simulation/splitSpinSystem';
|
|
9
9
|
|
|
10
10
|
export interface SignalsToFIDOptions {
|
|
11
|
+
/**
|
|
12
|
+
* at the end of the superposition of all component, an exponential apodization will be applied
|
|
13
|
+
* in order to have FID like shape.
|
|
14
|
+
* @default 1
|
|
15
|
+
*/
|
|
11
16
|
lb?: number;
|
|
17
|
+
/**
|
|
18
|
+
* lower limit of the spectrum
|
|
19
|
+
* @default 0
|
|
20
|
+
*/
|
|
12
21
|
from?: number;
|
|
22
|
+
/**
|
|
23
|
+
* upper limit of the spectrum
|
|
24
|
+
* @default 10
|
|
25
|
+
*/
|
|
13
26
|
to?: number;
|
|
27
|
+
/**
|
|
28
|
+
* number of points of the resulting FID
|
|
29
|
+
*/
|
|
14
30
|
nbPoints?: number;
|
|
31
|
+
/**
|
|
32
|
+
* It is the frequency of the carrier (e.g. SFO1 for bruker spectrometers)
|
|
33
|
+
*/
|
|
15
34
|
frequency?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Maximum number of atoms on each cluster that can be considered to be simulated together.
|
|
37
|
+
* It affects the the quality and speed of the simulation.
|
|
38
|
+
*/
|
|
16
39
|
maxClusterSize?: number;
|
|
17
40
|
}
|
|
18
41
|
|
|
19
42
|
const twoPi = Math.PI * 2;
|
|
20
43
|
|
|
44
|
+
/**
|
|
45
|
+
* it use the chemical shifts and the coupling between them in order to generate a FID.
|
|
46
|
+
* It does not propagate the hamiltonian of the spin system, instead it simulate all the
|
|
47
|
+
* frequencies in the spectrum (including second order) and add all the waves in a real and
|
|
48
|
+
* imaginary parts, that is why the couplings should be assigned in order to generate the spin system.
|
|
49
|
+
*/
|
|
21
50
|
export function signalsToFID(
|
|
22
51
|
signals: NMRSignal1D[],
|
|
23
52
|
options: SignalsToFIDOptions,
|
|
@@ -43,7 +72,7 @@ export function signalsToFID(
|
|
|
43
72
|
const im = new Float64Array(nbPoints);
|
|
44
73
|
|
|
45
74
|
const sw = Math.abs(to - from);
|
|
46
|
-
const adquisitionTime = nbPoints / (
|
|
75
|
+
const adquisitionTime = nbPoints / (sw * frequency);
|
|
47
76
|
const time = xSequentialFill({
|
|
48
77
|
size: nbPoints,
|
|
49
78
|
from: 0,
|