jcampconverter 9.2.0 → 9.2.2
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/jcampconverter.cjs +8 -0
- package/{lib/convert.d.ts → jcampconverter.d.ts} +222 -182
- package/jcampconverter.mjs +8 -0
- package/package.json +27 -19
- package/lib/2d/add2D.d.ts +0 -2
- package/lib/2d/add2D.d.ts.map +0 -1
- package/lib/2d/add2D.js +0 -17
- package/lib/2d/add2D.js.map +0 -1
- package/lib/2d/convertTo3DZ.d.ts +0 -11
- package/lib/2d/convertTo3DZ.d.ts.map +0 -1
- package/lib/2d/convertTo3DZ.js +0 -59
- package/lib/2d/convertTo3DZ.js.map +0 -1
- package/lib/2d/generateContourLines.d.ts +0 -8
- package/lib/2d/generateContourLines.d.ts.map +0 -1
- package/lib/2d/generateContourLines.js +0 -163
- package/lib/2d/generateContourLines.js.map +0 -1
- package/lib/complexChromatogram.d.ts +0 -4
- package/lib/complexChromatogram.d.ts.map +0 -1
- package/lib/complexChromatogram.js +0 -49
- package/lib/complexChromatogram.js.map +0 -1
- package/lib/convert.d.ts.map +0 -1
- package/lib/convert.js +0 -412
- package/lib/convert.js.map +0 -1
- package/lib/convertToFloatArray.d.ts +0 -2
- package/lib/convertToFloatArray.d.ts.map +0 -1
- package/lib/convertToFloatArray.js +0 -11
- package/lib/convertToFloatArray.js.map +0 -1
- package/lib/createTree.d.ts +0 -29
- package/lib/createTree.d.ts.map +0 -1
- package/lib/createTree.js +0 -101
- package/lib/createTree.js.map +0 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
- package/lib/parse/fastParseXYData.d.ts +0 -2
- package/lib/parse/fastParseXYData.d.ts.map +0 -1
- package/lib/parse/fastParseXYData.js +0 -193
- package/lib/parse/fastParseXYData.js.map +0 -1
- package/lib/parse/parsePeakTable.d.ts +0 -2
- package/lib/parse/parsePeakTable.d.ts.map +0 -1
- package/lib/parse/parsePeakTable.js +0 -67
- package/lib/parse/parsePeakTable.js.map +0 -1
- package/lib/parse/parseXYA.d.ts +0 -2
- package/lib/parse/parseXYA.d.ts.map +0 -1
- package/lib/parse/parseXYA.js +0 -51
- package/lib/parse/parseXYA.js.map +0 -1
- package/lib/postProcessing.d.ts +0 -2
- package/lib/postProcessing.d.ts.map +0 -1
- package/lib/postProcessing.js +0 -93
- package/lib/postProcessing.js.map +0 -1
- package/lib/postProcessingNMR.d.ts +0 -2
- package/lib/postProcessingNMR.d.ts.map +0 -1
- package/lib/postProcessingNMR.js +0 -95
- package/lib/postProcessingNMR.js.map +0 -1
- package/lib/prepareNtuplesDatatable.d.ts +0 -2
- package/lib/prepareNtuplesDatatable.d.ts.map +0 -1
- package/lib/prepareNtuplesDatatable.js +0 -87
- package/lib/prepareNtuplesDatatable.js.map +0 -1
- package/lib/prepareSpectrum.d.ts +0 -2
- package/lib/prepareSpectrum.d.ts.map +0 -1
- package/lib/prepareSpectrum.js +0 -10
- package/lib/prepareSpectrum.js.map +0 -1
- package/lib/profiling.d.ts +0 -2
- package/lib/profiling.d.ts.map +0 -1
- package/lib/profiling.js +0 -13
- package/lib/profiling.js.map +0 -1
- package/lib/simpleChromatogram.d.ts +0 -2
- package/lib/simpleChromatogram.d.ts.map +0 -1
- package/lib/simpleChromatogram.js +0 -16
- package/lib/simpleChromatogram.js.map +0 -1
- package/lib-esm/2d/add2D.d.ts +0 -2
- package/lib-esm/2d/add2D.d.ts.map +0 -1
- package/lib-esm/2d/add2D.js +0 -11
- package/lib-esm/2d/add2D.js.map +0 -1
- package/lib-esm/2d/convertTo3DZ.d.ts +0 -11
- package/lib-esm/2d/convertTo3DZ.d.ts.map +0 -1
- package/lib-esm/2d/convertTo3DZ.js +0 -53
- package/lib-esm/2d/convertTo3DZ.js.map +0 -1
- package/lib-esm/2d/generateContourLines.d.ts +0 -8
- package/lib-esm/2d/generateContourLines.d.ts.map +0 -1
- package/lib-esm/2d/generateContourLines.js +0 -160
- package/lib-esm/2d/generateContourLines.js.map +0 -1
- package/lib-esm/complexChromatogram.d.ts +0 -4
- package/lib-esm/complexChromatogram.d.ts.map +0 -1
- package/lib-esm/complexChromatogram.js +0 -43
- package/lib-esm/complexChromatogram.js.map +0 -1
- package/lib-esm/convert.d.ts +0 -182
- package/lib-esm/convert.d.ts.map +0 -1
- package/lib-esm/convert.js +0 -405
- package/lib-esm/convert.js.map +0 -1
- package/lib-esm/convertToFloatArray.d.ts +0 -2
- package/lib-esm/convertToFloatArray.d.ts.map +0 -1
- package/lib-esm/convertToFloatArray.js +0 -8
- package/lib-esm/convertToFloatArray.js.map +0 -1
- package/lib-esm/createTree.d.ts +0 -29
- package/lib-esm/createTree.d.ts.map +0 -1
- package/lib-esm/createTree.js +0 -97
- package/lib-esm/createTree.js.map +0 -1
- package/lib-esm/index.d.ts +0 -3
- package/lib-esm/index.d.ts.map +0 -1
- package/lib-esm/index.js +0 -3
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/parse/fastParseXYData.d.ts +0 -2
- package/lib-esm/parse/fastParseXYData.d.ts.map +0 -1
- package/lib-esm/parse/fastParseXYData.js +0 -190
- package/lib-esm/parse/fastParseXYData.js.map +0 -1
- package/lib-esm/parse/parsePeakTable.d.ts +0 -2
- package/lib-esm/parse/parsePeakTable.d.ts.map +0 -1
- package/lib-esm/parse/parsePeakTable.js +0 -64
- package/lib-esm/parse/parsePeakTable.js.map +0 -1
- package/lib-esm/parse/parseXYA.d.ts +0 -2
- package/lib-esm/parse/parseXYA.d.ts.map +0 -1
- package/lib-esm/parse/parseXYA.js +0 -48
- package/lib-esm/parse/parseXYA.js.map +0 -1
- package/lib-esm/postProcessing.d.ts +0 -2
- package/lib-esm/postProcessing.d.ts.map +0 -1
- package/lib-esm/postProcessing.js +0 -87
- package/lib-esm/postProcessing.js.map +0 -1
- package/lib-esm/postProcessingNMR.d.ts +0 -2
- package/lib-esm/postProcessingNMR.d.ts.map +0 -1
- package/lib-esm/postProcessingNMR.js +0 -92
- package/lib-esm/postProcessingNMR.js.map +0 -1
- package/lib-esm/prepareNtuplesDatatable.d.ts +0 -2
- package/lib-esm/prepareNtuplesDatatable.d.ts.map +0 -1
- package/lib-esm/prepareNtuplesDatatable.js +0 -84
- package/lib-esm/prepareNtuplesDatatable.js.map +0 -1
- package/lib-esm/prepareSpectrum.d.ts +0 -2
- package/lib-esm/prepareSpectrum.d.ts.map +0 -1
- package/lib-esm/prepareSpectrum.js +0 -7
- package/lib-esm/prepareSpectrum.js.map +0 -1
- package/lib-esm/profiling.d.ts +0 -2
- package/lib-esm/profiling.d.ts.map +0 -1
- package/lib-esm/profiling.js +0 -10
- package/lib-esm/profiling.js.map +0 -1
- package/lib-esm/simpleChromatogram.d.ts +0 -2
- package/lib-esm/simpleChromatogram.d.ts.map +0 -1
- package/lib-esm/simpleChromatogram.js +0 -13
- package/lib-esm/simpleChromatogram.js.map +0 -1
- package/src/2d/add2D.js +0 -11
- package/src/2d/convertTo3DZ.js +0 -55
- package/src/2d/generateContourLines.js +0 -166
- package/src/complexChromatogram.js +0 -49
- package/src/convert.js +0 -412
- package/src/convertToFloatArray.js +0 -7
- package/src/createTree.js +0 -100
- package/src/index.js +0 -2
- package/src/parse/fastParseXYData.js +0 -175
- package/src/parse/parsePeakTable.js +0 -69
- package/src/parse/parseXYA.js +0 -50
- package/src/postProcessing.js +0 -93
- package/src/postProcessingNMR.js +0 -99
- package/src/prepareNtuplesDatatable.js +0 -85
- package/src/prepareSpectrum.js +0 -4
- package/src/profiling.js +0 -9
- package/src/simpleChromatogram.js +0 -12
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { gyromagneticRatio } from 'gyromagnetic-ratio';
|
|
2
|
-
export default function postProcessingNMR(entriesFlat) {
|
|
3
|
-
// specific NMR functions
|
|
4
|
-
for (let entry of entriesFlat) {
|
|
5
|
-
let observeFrequency = 0;
|
|
6
|
-
let shiftOffsetVal = 0;
|
|
7
|
-
for (let spectrum of entry.spectra) {
|
|
8
|
-
if (entry.ntuples && entry.ntuples.symbol) {
|
|
9
|
-
if (!observeFrequency && spectrum.observeFrequency) {
|
|
10
|
-
observeFrequency = spectrum.observeFrequency;
|
|
11
|
-
}
|
|
12
|
-
if (!shiftOffsetVal && spectrum.shiftOffsetVal) {
|
|
13
|
-
shiftOffsetVal = spectrum.shiftOffsetVal;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
observeFrequency = spectrum.observeFrequency;
|
|
18
|
-
shiftOffsetVal = spectrum.shiftOffsetVal;
|
|
19
|
-
}
|
|
20
|
-
if (observeFrequency) {
|
|
21
|
-
if (spectrum.xUnits && spectrum.xUnits.toUpperCase().includes('HZ')) {
|
|
22
|
-
spectrum.xUnits = 'PPM';
|
|
23
|
-
spectrum.xFactor = spectrum.xFactor / observeFrequency;
|
|
24
|
-
spectrum.firstX = spectrum.firstX / observeFrequency;
|
|
25
|
-
spectrum.lastX = spectrum.lastX / observeFrequency;
|
|
26
|
-
spectrum.deltaX = spectrum.deltaX / observeFrequency;
|
|
27
|
-
for (let i = 0; i < spectrum.data.x.length; i++) {
|
|
28
|
-
spectrum.data.x[i] /= observeFrequency;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (shiftOffsetVal && spectrum.xUnits.toLowerCase().includes('ppm')) {
|
|
33
|
-
let shift = spectrum.firstX - shiftOffsetVal;
|
|
34
|
-
spectrum.firstX = spectrum.firstX - shift;
|
|
35
|
-
spectrum.lastX = spectrum.lastX - shift;
|
|
36
|
-
for (let i = 0; i < spectrum.data.x.length; i++) {
|
|
37
|
-
spectrum.data.x[i] -= shift;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// we will check if some nucleus are missing ...
|
|
41
|
-
if (entry.ntuples && entry.ntuples.nucleus && entry.ntuples.symbol) {
|
|
42
|
-
for (let i = 0; i < entry.ntuples.nucleus.length; i++) {
|
|
43
|
-
let symbol = entry.ntuples.symbol[i];
|
|
44
|
-
let nucleus = entry.ntuples.nucleus[i];
|
|
45
|
-
if (symbol.match(/^[F|T]/) && !nucleus) {
|
|
46
|
-
if (symbol.match(/[F|T]1/)) {
|
|
47
|
-
// if F1 is defined we will use F2
|
|
48
|
-
if (entry.tmp.$NUC2) {
|
|
49
|
-
entry.ntuples.nucleus[i] = entry.tmp.$NUC2;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
let f2index = entry.ntuples.symbol.indexOf(symbol.replace(/^([F|T]).*/, '$12'));
|
|
53
|
-
if (f2index && entry.ntuples.nucleus[f2index]) {
|
|
54
|
-
entry.ntuples.nucleus[i] = entry.ntuples.nucleus[f2index];
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (symbol.match(/[F|T]2/)) {
|
|
59
|
-
entry.ntuples.nucleus[i] = entry.tmp.$NUC1;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (symbol.match(/[F|T]2/)) {
|
|
63
|
-
entry.yType = entry.ntuples.nucleus[0];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (observeFrequency &&
|
|
68
|
-
entry.ntuples &&
|
|
69
|
-
entry.ntuples.symbol &&
|
|
70
|
-
entry.ntuples.nucleus) {
|
|
71
|
-
let unit = '';
|
|
72
|
-
let pageSymbolIndex = entry.ntuples.symbol.indexOf(spectrum.pageSymbol);
|
|
73
|
-
if (entry.ntuples.units && entry.ntuples.units[pageSymbolIndex]) {
|
|
74
|
-
unit = entry.ntuples.units[pageSymbolIndex];
|
|
75
|
-
}
|
|
76
|
-
if (unit !== 'PPM') {
|
|
77
|
-
if (pageSymbolIndex !== 0) {
|
|
78
|
-
throw Error('Not sure about this ntuples format');
|
|
79
|
-
}
|
|
80
|
-
let ratio0 = gyromagneticRatio[entry.ntuples.nucleus[0]];
|
|
81
|
-
let ratio1 = gyromagneticRatio[entry.ntuples.nucleus[1]];
|
|
82
|
-
if (!ratio0 || !ratio1) {
|
|
83
|
-
throw Error('Problem with determination of gyromagnetic ratio');
|
|
84
|
-
}
|
|
85
|
-
let ratio = (ratio0 / ratio1) * observeFrequency;
|
|
86
|
-
spectrum.pageValue /= ratio;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
//# sourceMappingURL=postProcessingNMR.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postProcessingNMR.js","sourceRoot":"","sources":["../src/postProcessingNMR.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,WAAW;IACnD,yBAAyB;IAEzB,KAAK,IAAI,KAAK,IAAI,WAAW,EAAE;QAC7B,IAAI,gBAAgB,GAAG,CAAC,CAAC;QACzB,IAAI,cAAc,GAAG,CAAC,CAAC;QACvB,KAAK,IAAI,QAAQ,IAAI,KAAK,CAAC,OAAO,EAAE;YAClC,IAAI,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE;gBACzC,IAAI,CAAC,gBAAgB,IAAI,QAAQ,CAAC,gBAAgB,EAAE;oBAClD,gBAAgB,GAAG,QAAQ,CAAC,gBAAgB,CAAC;iBAC9C;gBACD,IAAI,CAAC,cAAc,IAAI,QAAQ,CAAC,cAAc,EAAE;oBAC9C,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;iBAC1C;aACF;iBAAM;gBACL,gBAAgB,GAAG,QAAQ,CAAC,gBAAgB,CAAC;gBAC7C,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;aAC1C;YAED,IAAI,gBAAgB,EAAE;gBACpB,IAAI,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;oBACnE,QAAQ,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,KAAK,CAAC,OAAO;gBACb,KAAK,CAAC,OAAO,CAAC,MAAM;gBACpB,KAAK,CAAC,OAAO,CAAC,OAAO,EACrB;gBACA,IAAI,IAAI,GAAG,EAAE,CAAC;gBACd,IAAI,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;gBACxE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE;oBAC/D,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;iBAC7C;gBACD,IAAI,IAAI,KAAK,KAAK,EAAE;oBAClB,IAAI,eAAe,KAAK,CAAC,EAAE;wBACzB,MAAM,KAAK,CAAC,oCAAoC,CAAC,CAAC;qBACnD;oBAED,IAAI,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;oBACzD,IAAI,MAAM,GAAG,iBAAiB,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;oBACzD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE;wBACtB,MAAM,KAAK,CAAC,kDAAkD,CAAC,CAAC;qBACjE;oBACD,IAAI,KAAK,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,gBAAgB,CAAC;oBACjD,QAAQ,CAAC,SAAS,IAAI,KAAK,CAAC;iBAC7B;aACF;SACF;KACF;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepareNtuplesDatatable.d.ts","sourceRoot":"","sources":["../src/prepareNtuplesDatatable.js"],"names":[],"mappings":"AAAA,mGAoFC"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
export default function prepareNtuplesDatatable(currentEntry, spectrum, kind) {
|
|
2
|
-
let xIndex = -1;
|
|
3
|
-
let yIndex = -1;
|
|
4
|
-
let firstVariable = '';
|
|
5
|
-
let secondVariable = '';
|
|
6
|
-
if (kind.indexOf('++') > 0) {
|
|
7
|
-
firstVariable = kind.replace(/.*\(([a-zA-Z0-9]+)\+\+.*/, '$1');
|
|
8
|
-
secondVariable = kind.replace(/.*\.\.([a-zA-Z0-9]+).*/, '$1');
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
kind = kind.replace(/[^a-zA-Z]/g, '');
|
|
12
|
-
firstVariable = kind.charAt(0);
|
|
13
|
-
secondVariable = kind.charAt(1);
|
|
14
|
-
spectrum.variables = {};
|
|
15
|
-
for (let symbol of kind) {
|
|
16
|
-
let lowerCaseSymbol = symbol.toLowerCase();
|
|
17
|
-
let index = currentEntry.ntuples.symbol.indexOf(symbol);
|
|
18
|
-
if (index === -1)
|
|
19
|
-
throw Error(`Symbol undefined: ${symbol}`);
|
|
20
|
-
spectrum.variables[lowerCaseSymbol] = {};
|
|
21
|
-
for (let key in currentEntry.ntuples) {
|
|
22
|
-
if (currentEntry.ntuples[key][index]) {
|
|
23
|
-
spectrum.variables[lowerCaseSymbol][key.replace(/^var/, '')] =
|
|
24
|
-
currentEntry.ntuples[key][index];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
xIndex = currentEntry.ntuples.symbol.indexOf(firstVariable);
|
|
30
|
-
yIndex = currentEntry.ntuples.symbol.indexOf(secondVariable);
|
|
31
|
-
if (xIndex === -1)
|
|
32
|
-
xIndex = 0;
|
|
33
|
-
if (yIndex === -1)
|
|
34
|
-
yIndex = 0;
|
|
35
|
-
if (currentEntry.ntuples.first) {
|
|
36
|
-
if (currentEntry.ntuples.first.length > xIndex) {
|
|
37
|
-
spectrum.firstX = currentEntry.ntuples.first[xIndex];
|
|
38
|
-
}
|
|
39
|
-
if (currentEntry.ntuples.first.length > yIndex) {
|
|
40
|
-
spectrum.firstY = currentEntry.ntuples.first[yIndex];
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (currentEntry.ntuples.last) {
|
|
44
|
-
if (currentEntry.ntuples.last.length > xIndex) {
|
|
45
|
-
spectrum.lastX = currentEntry.ntuples.last[xIndex];
|
|
46
|
-
}
|
|
47
|
-
if (currentEntry.ntuples.last.length > yIndex) {
|
|
48
|
-
spectrum.lastY = currentEntry.ntuples.last[yIndex];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (currentEntry.ntuples.vardim &&
|
|
52
|
-
currentEntry.ntuples.vardim.length > xIndex) {
|
|
53
|
-
spectrum.nbPoints = currentEntry.ntuples.vardim[xIndex];
|
|
54
|
-
}
|
|
55
|
-
if (currentEntry.ntuples.factor) {
|
|
56
|
-
if (currentEntry.ntuples.factor.length > xIndex) {
|
|
57
|
-
spectrum.xFactor = currentEntry.ntuples.factor[xIndex];
|
|
58
|
-
}
|
|
59
|
-
if (currentEntry.ntuples.factor.length > yIndex) {
|
|
60
|
-
spectrum.yFactor = currentEntry.ntuples.factor[yIndex];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (currentEntry.ntuples.units) {
|
|
64
|
-
if (currentEntry.ntuples.units.length > xIndex) {
|
|
65
|
-
if (currentEntry.ntuples.varname &&
|
|
66
|
-
currentEntry.ntuples.varname[xIndex]) {
|
|
67
|
-
spectrum.xUnits = `${currentEntry.ntuples.varname[xIndex]} [${currentEntry.ntuples.units[xIndex]}]`;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
spectrum.xUnits = currentEntry.ntuples.units[xIndex];
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (currentEntry.ntuples.units.length > yIndex) {
|
|
74
|
-
if (currentEntry.ntuples.varname &&
|
|
75
|
-
currentEntry.ntuples.varname[yIndex]) {
|
|
76
|
-
spectrum.yUnits = `${currentEntry.ntuples.varname[yIndex]} [${currentEntry.ntuples.units[yIndex]}]`;
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
spectrum.yUnits = currentEntry.ntuples.units[yIndex];
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=prepareNtuplesDatatable.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepareNtuplesDatatable.js","sourceRoot":"","sources":["../src/prepareNtuplesDatatable.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,YAAY,EAAE,QAAQ,EAAE,IAAI;IAC1E,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;IAChB,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;IAChB,IAAI,aAAa,GAAG,EAAE,CAAC;IACvB,IAAI,cAAc,GAAG,EAAE,CAAC;IACxB,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC1B,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAC;QAC/D,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;KAC/D;SAAM;QACL,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QACtC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC/B,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAChC,QAAQ,CAAC,SAAS,GAAG,EAAE,CAAC;QACxB,KAAK,IAAI,MAAM,IAAI,IAAI,EAAE;YACvB,IAAI,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;YAC3C,IAAI,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YACxD,IAAI,KAAK,KAAK,CAAC,CAAC;gBAAE,MAAM,KAAK,C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ACL,QAAQ,CAAC,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aACtD;SACF;QACD,IAAI,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE;YAC9C,IACE,YAAY,CAAC,OAAO,CAAC,OAAO;gBAC5B,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EACpC;gBACA,QAAQ,CAAC,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;aACrG;iBAAM;gBACL,QAAQ,CAAC,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;aACtD;SACF;KACF;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepareSpectrum.d.ts","sourceRoot":"","sources":["../src/prepareSpectrum.js"],"names":[],"mappings":"AAAA,6DAGC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prepareSpectrum.js","sourceRoot":"","sources":["../src/prepareSpectrum.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,QAAQ;IAC9C,IAAI,CAAC,QAAQ,CAAC,OAAO;QAAE,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC;IAC5C,IAAI,CAAC,QAAQ,CAAC,OAAO;QAAE,QAAQ,CAAC,OAAO,GAAG,CAAC,CAAC;AAC9C,CAAC"}
|
package/lib-esm/profiling.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profiling.d.ts","sourceRoot":"","sources":["../src/profiling.js"],"names":[],"mappings":"AAAA,gFAQC"}
|
package/lib-esm/profiling.js
DELETED
package/lib-esm/profiling.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profiling.js","sourceRoot":"","sources":["../src/profiling.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,EAAE;IAC5D,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,MAAM,CAAC,SAAS,EAAE;QACpB,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;YACpB,MAAM;YACN,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,KAAK;SACjC,CAAC,CAAC;KACJ;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simpleChromatogram.d.ts","sourceRoot":"","sources":["../src/simpleChromatogram.js"],"names":[],"mappings":"AAAA,8DAWC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export default function simpleChromatogram(result) {
|
|
2
|
-
let data = result.spectra[0].data;
|
|
3
|
-
result.chromatogram = {
|
|
4
|
-
times: data.x.slice(),
|
|
5
|
-
series: {
|
|
6
|
-
intensity: {
|
|
7
|
-
dimension: 1,
|
|
8
|
-
data: data.y.slice(),
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=simpleChromatogram.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"simpleChromatogram.js","sourceRoot":"","sources":["../src/simpleChromatogram.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,MAAM;IAC/C,IAAI,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAClC,MAAM,CAAC,YAAY,GAAG;QACpB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE;QACrB,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,SAAS,EAAE,CAAC;gBACZ,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE;aACrB;SACF;KACF,CAAC;AACJ,CAAC"}
|
package/src/2d/add2D.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import convertTo3DZ from './convertTo3DZ';
|
|
2
|
-
import generateContourLines from './generateContourLines';
|
|
3
|
-
|
|
4
|
-
export default function add2D(result, options) {
|
|
5
|
-
let zData = convertTo3DZ(result.spectra);
|
|
6
|
-
if (!options.noContour) {
|
|
7
|
-
result.contourLines = generateContourLines(zData, options);
|
|
8
|
-
delete zData.z;
|
|
9
|
-
}
|
|
10
|
-
result.minMax = zData;
|
|
11
|
-
}
|
package/src/2d/convertTo3DZ.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import getMedian from 'ml-array-median';
|
|
2
|
-
|
|
3
|
-
export default function convertTo3DZ(spectra) {
|
|
4
|
-
let minZ = spectra[0].data.y[0];
|
|
5
|
-
let maxZ = minZ;
|
|
6
|
-
let ySize = spectra.length;
|
|
7
|
-
let xSize = spectra[0].data.x.length;
|
|
8
|
-
|
|
9
|
-
let z = new Array(ySize);
|
|
10
|
-
for (let i = 0; i < ySize; i++) {
|
|
11
|
-
z[i] = spectra[i].data.y;
|
|
12
|
-
for (let j = 0; j < xSize; j++) {
|
|
13
|
-
let value = z[i][j];
|
|
14
|
-
if (value < minZ) minZ = value;
|
|
15
|
-
if (value > maxZ) maxZ = value;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const firstX = spectra[0].data.x[0];
|
|
20
|
-
const lastX = spectra[0].data.x[spectra[0].data.x.length - 1]; // has to be -2 because it is a 1D array [x,y,x,y,...]
|
|
21
|
-
const firstY = spectra[0].pageValue;
|
|
22
|
-
const lastY = spectra[ySize - 1].pageValue;
|
|
23
|
-
|
|
24
|
-
// Because the min / max value are the only information about the matrix if we invert
|
|
25
|
-
// min and max we need to invert the array
|
|
26
|
-
if (firstX > lastX) {
|
|
27
|
-
for (let spectrum of z) {
|
|
28
|
-
spectrum.reverse();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (firstY > lastY) {
|
|
32
|
-
z.reverse();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const medians = [];
|
|
36
|
-
for (let i = 0; i < z.length; i++) {
|
|
37
|
-
const row = Float64Array.from(z[i]);
|
|
38
|
-
for (let i = 0; i < row.length; i++) {
|
|
39
|
-
if (row[i] < 0) row[i] = -row[i];
|
|
40
|
-
}
|
|
41
|
-
medians.push(getMedian(row));
|
|
42
|
-
}
|
|
43
|
-
const median = getMedian(medians);
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
z,
|
|
47
|
-
minX: Math.min(firstX, lastX),
|
|
48
|
-
maxX: Math.max(firstX, lastX),
|
|
49
|
-
minY: Math.min(firstY, lastY),
|
|
50
|
-
maxY: Math.max(firstY, lastY),
|
|
51
|
-
minZ,
|
|
52
|
-
maxZ,
|
|
53
|
-
noise: median,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
export default function generateContourLines(zData, options) {
|
|
2
|
-
let noise = zData.noise;
|
|
3
|
-
let z = zData.z;
|
|
4
|
-
let povarHeight0, povarHeight1, povarHeight2, povarHeight3;
|
|
5
|
-
let isOver0, isOver1, isOver2, isOver3;
|
|
6
|
-
let nbSubSpectra = z.length;
|
|
7
|
-
let nbPovars = z[0].length;
|
|
8
|
-
let pAx, pAy, pBx, pBy;
|
|
9
|
-
|
|
10
|
-
let x0 = zData.minX;
|
|
11
|
-
let xN = zData.maxX;
|
|
12
|
-
let dx = (xN - x0) / (nbPovars - 1);
|
|
13
|
-
let y0 = zData.minY;
|
|
14
|
-
let yN = zData.maxY;
|
|
15
|
-
let dy = (yN - y0) / (nbSubSpectra - 1);
|
|
16
|
-
let minZ = zData.minZ;
|
|
17
|
-
let maxZ = zData.maxZ;
|
|
18
|
-
|
|
19
|
-
// System.out.prvarln('y0 '+y0+' yN '+yN);
|
|
20
|
-
// -------------------------
|
|
21
|
-
// Povars attribution
|
|
22
|
-
//
|
|
23
|
-
// 0----1
|
|
24
|
-
// | / |
|
|
25
|
-
// | / |
|
|
26
|
-
// 2----3
|
|
27
|
-
//
|
|
28
|
-
// ---------------------d------
|
|
29
|
-
|
|
30
|
-
let iter = options.nbContourLevels * 2;
|
|
31
|
-
let contourLevels = new Array(iter);
|
|
32
|
-
let lineZValue;
|
|
33
|
-
for (let level = 0; level < iter; level++) {
|
|
34
|
-
// multiply by 2 for positif and negatif
|
|
35
|
-
let contourLevel = {};
|
|
36
|
-
contourLevels[level] = contourLevel;
|
|
37
|
-
let side = level % 2;
|
|
38
|
-
let factor =
|
|
39
|
-
(maxZ - options.noiseMultiplier * noise) *
|
|
40
|
-
Math.exp((level >> 1) - options.nbContourLevels);
|
|
41
|
-
if (side === 0) {
|
|
42
|
-
lineZValue = factor + options.noiseMultiplier * noise;
|
|
43
|
-
} else {
|
|
44
|
-
lineZValue = 0 - factor - options.noiseMultiplier * noise;
|
|
45
|
-
}
|
|
46
|
-
let lines = [];
|
|
47
|
-
contourLevel.zValue = lineZValue;
|
|
48
|
-
contourLevel.lines = lines;
|
|
49
|
-
|
|
50
|
-
if (lineZValue <= minZ || lineZValue >= maxZ) continue;
|
|
51
|
-
|
|
52
|
-
for (let iSubSpectra = 0; iSubSpectra < nbSubSpectra - 1; iSubSpectra++) {
|
|
53
|
-
let subSpectra = z[iSubSpectra];
|
|
54
|
-
let subSpectraAfter = z[iSubSpectra + 1];
|
|
55
|
-
for (let povar = 0; povar < nbPovars - 1; povar++) {
|
|
56
|
-
povarHeight0 = subSpectra[povar];
|
|
57
|
-
povarHeight1 = subSpectra[povar + 1];
|
|
58
|
-
povarHeight2 = subSpectraAfter[povar];
|
|
59
|
-
povarHeight3 = subSpectraAfter[povar + 1];
|
|
60
|
-
|
|
61
|
-
isOver0 = povarHeight0 > lineZValue;
|
|
62
|
-
isOver1 = povarHeight1 > lineZValue;
|
|
63
|
-
isOver2 = povarHeight2 > lineZValue;
|
|
64
|
-
isOver3 = povarHeight3 > lineZValue;
|
|
65
|
-
|
|
66
|
-
// Example povar0 is over the plane and povar1 and
|
|
67
|
-
// povar2 are below, we find the varersections and add
|
|
68
|
-
// the segment
|
|
69
|
-
if (isOver0 !== isOver1 && isOver0 !== isOver2) {
|
|
70
|
-
pAx =
|
|
71
|
-
povar + (lineZValue - povarHeight0) / (povarHeight1 - povarHeight0);
|
|
72
|
-
pAy = iSubSpectra;
|
|
73
|
-
pBx = povar;
|
|
74
|
-
pBy =
|
|
75
|
-
iSubSpectra +
|
|
76
|
-
(lineZValue - povarHeight0) / (povarHeight2 - povarHeight0);
|
|
77
|
-
lines.push(pAx * dx + x0);
|
|
78
|
-
lines.push(pAy * dy + y0);
|
|
79
|
-
lines.push(pBx * dx + x0);
|
|
80
|
-
lines.push(pBy * dy + y0);
|
|
81
|
-
}
|
|
82
|
-
// remove push does not help !!!!
|
|
83
|
-
if (isOver3 !== isOver1 && isOver3 !== isOver2) {
|
|
84
|
-
pAx = povar + 1;
|
|
85
|
-
pAy =
|
|
86
|
-
iSubSpectra +
|
|
87
|
-
1 -
|
|
88
|
-
(lineZValue - povarHeight3) / (povarHeight1 - povarHeight3);
|
|
89
|
-
pBx =
|
|
90
|
-
povar +
|
|
91
|
-
1 -
|
|
92
|
-
(lineZValue - povarHeight3) / (povarHeight2 - povarHeight3);
|
|
93
|
-
pBy = iSubSpectra + 1;
|
|
94
|
-
lines.push(pAx * dx + x0);
|
|
95
|
-
lines.push(pAy * dy + y0);
|
|
96
|
-
lines.push(pBx * dx + x0);
|
|
97
|
-
lines.push(pBy * dy + y0);
|
|
98
|
-
}
|
|
99
|
-
// test around the diagonal
|
|
100
|
-
if (isOver1 !== isOver2) {
|
|
101
|
-
pAx =
|
|
102
|
-
(povar +
|
|
103
|
-
1 -
|
|
104
|
-
(lineZValue - povarHeight1) / (povarHeight2 - povarHeight1)) *
|
|
105
|
-
dx +
|
|
106
|
-
x0;
|
|
107
|
-
pAy =
|
|
108
|
-
(iSubSpectra +
|
|
109
|
-
(lineZValue - povarHeight1) / (povarHeight2 - povarHeight1)) *
|
|
110
|
-
dy +
|
|
111
|
-
y0;
|
|
112
|
-
if (isOver1 !== isOver0) {
|
|
113
|
-
pBx =
|
|
114
|
-
povar +
|
|
115
|
-
1 -
|
|
116
|
-
(lineZValue - povarHeight1) / (povarHeight0 - povarHeight1);
|
|
117
|
-
pBy = iSubSpectra;
|
|
118
|
-
lines.push(pAx);
|
|
119
|
-
lines.push(pAy);
|
|
120
|
-
lines.push(pBx * dx + x0);
|
|
121
|
-
lines.push(pBy * dy + y0);
|
|
122
|
-
}
|
|
123
|
-
if (isOver2 !== isOver0) {
|
|
124
|
-
pBx = povar;
|
|
125
|
-
pBy =
|
|
126
|
-
iSubSpectra +
|
|
127
|
-
1 -
|
|
128
|
-
(lineZValue - povarHeight2) / (povarHeight0 - povarHeight2);
|
|
129
|
-
lines.push(pAx);
|
|
130
|
-
lines.push(pAy);
|
|
131
|
-
lines.push(pBx * dx + x0);
|
|
132
|
-
lines.push(pBy * dy + y0);
|
|
133
|
-
}
|
|
134
|
-
if (isOver1 !== isOver3) {
|
|
135
|
-
pBx = povar + 1;
|
|
136
|
-
pBy =
|
|
137
|
-
iSubSpectra +
|
|
138
|
-
(lineZValue - povarHeight1) / (povarHeight3 - povarHeight1);
|
|
139
|
-
lines.push(pAx);
|
|
140
|
-
lines.push(pAy);
|
|
141
|
-
lines.push(pBx * dx + x0);
|
|
142
|
-
lines.push(pBy * dy + y0);
|
|
143
|
-
}
|
|
144
|
-
if (isOver2 !== isOver3) {
|
|
145
|
-
pBx =
|
|
146
|
-
povar +
|
|
147
|
-
(lineZValue - povarHeight2) / (povarHeight3 - povarHeight2);
|
|
148
|
-
pBy = iSubSpectra + 1;
|
|
149
|
-
lines.push(pAx);
|
|
150
|
-
lines.push(pAy);
|
|
151
|
-
lines.push(pBx * dx + x0);
|
|
152
|
-
lines.push(pBy * dy + y0);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
minX: zData.minX,
|
|
161
|
-
maxX: zData.maxX,
|
|
162
|
-
minY: zData.minY,
|
|
163
|
-
maxY: zData.maxY,
|
|
164
|
-
segments: contourLevels,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const GC_MS_FIELDS = ['TIC', '.RIC', 'SCANNUMBER'];
|
|
2
|
-
|
|
3
|
-
export function complexChromatogram(result) {
|
|
4
|
-
let spectra = result.spectra;
|
|
5
|
-
let length = spectra.length;
|
|
6
|
-
let chromatogram = {
|
|
7
|
-
times: new Array(length),
|
|
8
|
-
series: {
|
|
9
|
-
ms: {
|
|
10
|
-
dimension: 2,
|
|
11
|
-
data: new Array(length),
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
let existingGCMSFields = [];
|
|
17
|
-
for (let i = 0; i < GC_MS_FIELDS.length; i++) {
|
|
18
|
-
let label = convertMSFieldToLabel(GC_MS_FIELDS[i]);
|
|
19
|
-
if (spectra[0][label]) {
|
|
20
|
-
existingGCMSFields.push(label);
|
|
21
|
-
chromatogram.series[label] = {
|
|
22
|
-
dimension: 1,
|
|
23
|
-
data: new Array(length),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
for (let i = 0; i < length; i++) {
|
|
29
|
-
let spectrum = spectra[i];
|
|
30
|
-
chromatogram.times[i] = spectrum.pageValue;
|
|
31
|
-
for (let j = 0; j < existingGCMSFields.length; j++) {
|
|
32
|
-
chromatogram.series[existingGCMSFields[j]].data[i] = Number(
|
|
33
|
-
spectrum[existingGCMSFields[j]],
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
if (spectrum.data) {
|
|
37
|
-
chromatogram.series.ms.data[i] = [spectrum.data.x, spectrum.data.y];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
result.chromatogram = chromatogram;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function isMSField(canonicDataLabel) {
|
|
44
|
-
return GC_MS_FIELDS.indexOf(canonicDataLabel) !== -1;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function convertMSFieldToLabel(value) {
|
|
48
|
-
return value.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
49
|
-
}
|