nmr-processing 9.5.0 → 9.5.1-pre.1684857934
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/apodization/apodization.d.ts +9 -4
- package/lib/apodization/apodization.js +3 -1
- package/lib/apodization/apodization.js.map +1 -1
- package/lib/apodization/applyWindow.js.map +1 -1
- package/lib/apodization/compose.js.map +1 -1
- package/lib/apodization/getFunction.js +3 -0
- package/lib/apodization/getFunction.js.map +1 -1
- package/lib/apodization/shapes/WindowFunctions.d.ts +6 -1
- package/lib/apodization/shapes/sineBell.d.ts +27 -0
- package/lib/apodization/shapes/sineBell.js +17 -0
- package/lib/apodization/shapes/sineBell.js.map +1 -0
- package/lib/apodization/utils/getData.js.map +1 -1
- package/lib/filters/Data1D.d.ts +6 -0
- package/lib/{xyz/Data2D.js → filters/Data1D.js} +1 -1
- package/lib/filters/Data1D.js.map +1 -0
- package/lib/filters/Entry1D.d.ts +10 -0
- package/lib/filters/Entry1D.js +3 -0
- package/lib/filters/Entry1D.js.map +1 -0
- package/lib/filters/ExclusionZone.d.ts +5 -0
- package/lib/filters/ExclusionZone.js +3 -0
- package/lib/filters/ExclusionZone.js.map +1 -0
- package/lib/filters/Filters.d.ts +7 -0
- package/lib/filters/Filters.js +47 -0
- package/lib/filters/Filters.js.map +1 -0
- package/lib/filters/FiltersManager.d.ts +23 -0
- package/lib/filters/FiltersManager.js +130 -0
- package/lib/filters/FiltersManager.js.map +1 -0
- package/lib/filters/MatrixFilter.d.ts +39 -0
- package/lib/filters/MatrixFilter.js +3 -0
- package/lib/filters/MatrixFilter.js.map +1 -0
- package/lib/filters/MatrixOptions.d.ts +28 -0
- package/lib/filters/MatrixOptions.js +3 -0
- package/lib/filters/MatrixOptions.js.map +1 -0
- package/lib/filters/filter1d/apodization.d.ts +26 -0
- package/lib/filters/filter1d/apodization.js +77 -0
- package/lib/filters/filter1d/apodization.js.map +1 -0
- package/lib/filters/filter1d/baselineCorrection.d.ts +32 -0
- package/lib/filters/filter1d/baselineCorrection.js +61 -0
- package/lib/filters/filter1d/baselineCorrection.js.map +1 -0
- package/lib/filters/filter1d/digitalFilter.d.ts +15 -0
- package/lib/filters/filter1d/digitalFilter.js +47 -0
- package/lib/filters/filter1d/digitalFilter.js.map +1 -0
- package/lib/filters/filter1d/equallySpaced.d.ts +29 -0
- package/lib/filters/filter1d/equallySpaced.js +55 -0
- package/lib/filters/filter1d/equallySpaced.js.map +1 -0
- package/lib/filters/filter1d/exclusionZones.d.ts +11 -0
- package/lib/filters/filter1d/exclusionZones.js +35 -0
- package/lib/filters/filter1d/exclusionZones.js.map +1 -0
- package/lib/filters/filter1d/fft.d.ts +14 -0
- package/lib/filters/filter1d/fft.js +94 -0
- package/lib/filters/filter1d/fft.js.map +1 -0
- package/lib/filters/filter1d/phaseCorrection.d.ts +26 -0
- package/lib/filters/filter1d/phaseCorrection.js +81 -0
- package/lib/filters/filter1d/phaseCorrection.js.map +1 -0
- package/lib/filters/filter1d/shiftX.d.ts +16 -0
- package/lib/filters/filter1d/shiftX.js +30 -0
- package/lib/filters/filter1d/shiftX.js.map +1 -0
- package/lib/filters/filter1d/signalProcessing.d.ts +17 -0
- package/lib/filters/filter1d/signalProcessing.js +88 -0
- package/lib/filters/filter1d/signalProcessing.js.map +1 -0
- package/lib/filters/filter1d/utils/padDataToNextPowerOfTwo.d.ts +2 -0
- package/lib/filters/filter1d/utils/padDataToNextPowerOfTwo.js +41 -0
- package/lib/filters/filter1d/utils/padDataToNextPowerOfTwo.js.map +1 -0
- package/lib/filters/filter1d/zeroFilling.d.ts +18 -0
- package/lib/filters/filter1d/zeroFilling.js +68 -0
- package/lib/filters/filter1d/zeroFilling.js.map +1 -0
- package/lib/filters/filter2d/shiftX.d.ts +14 -0
- package/lib/filters/filter2d/shiftX.js +30 -0
- package/lib/filters/filter2d/shiftX.js.map +1 -0
- package/lib/filters/filter2d/shiftY.d.ts +14 -0
- package/lib/filters/filter2d/shiftY.js +30 -0
- package/lib/filters/filter2d/shiftY.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -1
- package/lib/signals/signalsToFID.d.ts +3 -0
- package/lib/utilities/checkData2DFid.d.ts +3 -0
- package/lib/utilities/checkData2DFid.js +10 -0
- package/lib/utilities/checkData2DFid.js.map +1 -0
- package/lib/utilities/cloneData1D.d.ts +6 -0
- package/lib/utilities/cloneData1D.js +9 -0
- package/lib/utilities/cloneData1D.js.map +1 -0
- package/lib/utilities/cloneData2D.d.ts +2 -0
- package/lib/utilities/cloneData2D.js +28 -0
- package/lib/utilities/cloneData2D.js.map +1 -0
- package/lib/xyz/Entry2D.d.ts +10 -0
- package/lib/xyz/Entry2D.js +3 -0
- package/lib/xyz/Entry2D.js.map +1 -0
- package/lib/xyz/quadrature.d.ts +7 -0
- package/lib/xyz/quadrature.js +54 -0
- package/lib/xyz/quadrature.js.map +1 -0
- package/lib/xyz/util/fft2d/digitalFilter.d.ts +7 -0
- package/lib/xyz/util/fft2d/digitalFilter.js +20 -0
- package/lib/xyz/util/fft2d/digitalFilter.js.map +1 -0
- package/lib/xyz/util/fft2d/fftDirectDimension.d.ts +24 -0
- package/lib/xyz/util/fft2d/fftDirectDimension.js +57 -0
- package/lib/xyz/util/fft2d/fftDirectDimension.js.map +1 -0
- package/lib/xyz/util/fft2d/fftIndirectDimension.d.ts +23 -0
- package/lib/xyz/util/fft2d/fftIndirectDimension.js +72 -0
- package/lib/xyz/util/fft2d/fftIndirectDimension.js.map +1 -0
- package/lib/xyz/util/fft2d/removeDCOffset.d.ts +5 -0
- package/lib/xyz/util/fft2d/removeDCOffset.js +19 -0
- package/lib/xyz/util/fft2d/removeDCOffset.js.map +1 -0
- package/lib/xyz/util/fft2d/zeroFilling.d.ts +10 -0
- package/lib/xyz/util/fft2d/zeroFilling.js +29 -0
- package/lib/xyz/util/fft2d/zeroFilling.js.map +1 -0
- package/lib/xyz/util/padData.d.ts +5 -3
- package/lib/xyz/util/padData.js +7 -7
- package/lib/xyz/util/padData.js.map +1 -1
- package/lib/xyz/xyzAutoSignalsPicking.d.ts +2 -2
- package/lib/xyz/xyzAutoSignalsPicking.js.map +1 -1
- package/lib/xyz/xyzAutoZonesPicking.d.ts +2 -8
- package/lib/xyz/xyzAutoZonesPicking.js.map +1 -1
- package/lib/xyz/xyzBidimensionalFFT.d.ts +40 -0
- package/lib/xyz/xyzBidimensionalFFT.js +79 -0
- package/lib/xyz/xyzBidimensionalFFT.js.map +1 -0
- package/lib-esm/apodization/apodization.js +3 -1
- package/lib-esm/apodization/apodization.js.map +1 -1
- package/lib-esm/apodization/applyWindow.js.map +1 -1
- package/lib-esm/apodization/compose.js.map +1 -1
- package/lib-esm/apodization/getFunction.js +3 -0
- package/lib-esm/apodization/getFunction.js.map +1 -1
- package/lib-esm/apodization/shapes/sineBell.js +13 -0
- package/lib-esm/apodization/shapes/sineBell.js.map +1 -0
- package/lib-esm/apodization/utils/getData.js.map +1 -1
- package/lib-esm/filters/Data1D.js +2 -0
- package/lib-esm/filters/Data1D.js.map +1 -0
- package/lib-esm/filters/Entry1D.js +2 -0
- package/lib-esm/filters/Entry1D.js.map +1 -0
- package/lib-esm/filters/ExclusionZone.js +2 -0
- package/lib-esm/filters/ExclusionZone.js.map +1 -0
- package/lib-esm/filters/Filters.js +21 -0
- package/lib-esm/filters/Filters.js.map +1 -0
- package/lib-esm/filters/FiltersManager.js +124 -0
- package/lib-esm/filters/FiltersManager.js.map +1 -0
- package/lib-esm/filters/MatrixFilter.js +2 -0
- package/lib-esm/filters/MatrixFilter.js.map +1 -0
- package/lib-esm/filters/MatrixOptions.js +2 -0
- package/lib-esm/filters/MatrixOptions.js.map +1 -0
- package/lib-esm/filters/filter1d/apodization.js +70 -0
- package/lib-esm/filters/filter1d/apodization.js.map +1 -0
- package/lib-esm/filters/filter1d/baselineCorrection.js +52 -0
- package/lib-esm/filters/filter1d/baselineCorrection.js.map +1 -0
- package/lib-esm/filters/filter1d/digitalFilter.js +41 -0
- package/lib-esm/filters/filter1d/digitalFilter.js.map +1 -0
- package/lib-esm/filters/filter1d/equallySpaced.js +49 -0
- package/lib-esm/filters/filter1d/equallySpaced.js.map +1 -0
- package/lib-esm/filters/filter1d/exclusionZones.js +29 -0
- package/lib-esm/filters/filter1d/exclusionZones.js.map +1 -0
- package/lib-esm/filters/filter1d/fft.js +88 -0
- package/lib-esm/filters/filter1d/fft.js.map +1 -0
- package/lib-esm/filters/filter1d/phaseCorrection.js +75 -0
- package/lib-esm/filters/filter1d/phaseCorrection.js.map +1 -0
- package/lib-esm/filters/filter1d/shiftX.js +24 -0
- package/lib-esm/filters/filter1d/shiftX.js.map +1 -0
- package/lib-esm/filters/filter1d/signalProcessing.js +58 -0
- package/lib-esm/filters/filter1d/signalProcessing.js.map +1 -0
- package/lib-esm/filters/filter1d/utils/padDataToNextPowerOfTwo.js +37 -0
- package/lib-esm/filters/filter1d/utils/padDataToNextPowerOfTwo.js.map +1 -0
- package/lib-esm/filters/filter1d/zeroFilling.js +62 -0
- package/lib-esm/filters/filter1d/zeroFilling.js.map +1 -0
- package/lib-esm/filters/filter2d/shiftX.js +24 -0
- package/lib-esm/filters/filter2d/shiftX.js.map +1 -0
- package/lib-esm/filters/filter2d/shiftY.js +24 -0
- package/lib-esm/filters/filter2d/shiftY.js.map +1 -0
- package/lib-esm/index.js +2 -0
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/utilities/checkData2DFid.js +6 -0
- package/lib-esm/utilities/checkData2DFid.js.map +1 -0
- package/lib-esm/utilities/cloneData1D.js +5 -0
- package/lib-esm/utilities/cloneData1D.js.map +1 -0
- package/lib-esm/utilities/cloneData2D.js +24 -0
- package/lib-esm/utilities/cloneData2D.js.map +1 -0
- package/lib-esm/xyz/Entry2D.js +2 -0
- package/lib-esm/xyz/Entry2D.js.map +1 -0
- package/lib-esm/xyz/quadrature.js +50 -0
- package/lib-esm/xyz/quadrature.js.map +1 -0
- package/lib-esm/xyz/util/fft2d/digitalFilter.js +16 -0
- package/lib-esm/xyz/util/fft2d/digitalFilter.js.map +1 -0
- package/lib-esm/xyz/util/fft2d/fftDirectDimension.js +50 -0
- package/lib-esm/xyz/util/fft2d/fftDirectDimension.js.map +1 -0
- package/lib-esm/xyz/util/fft2d/fftIndirectDimension.js +65 -0
- package/lib-esm/xyz/util/fft2d/fftIndirectDimension.js.map +1 -0
- package/lib-esm/xyz/util/fft2d/removeDCOffset.js +15 -0
- package/lib-esm/xyz/util/fft2d/removeDCOffset.js.map +1 -0
- package/lib-esm/xyz/util/fft2d/zeroFilling.js +25 -0
- package/lib-esm/xyz/util/fft2d/zeroFilling.js.map +1 -0
- package/lib-esm/xyz/util/padData.js +7 -4
- package/lib-esm/xyz/util/padData.js.map +1 -1
- package/lib-esm/xyz/xyzAutoSignalsPicking.js.map +1 -1
- package/lib-esm/xyz/xyzAutoZonesPicking.js.map +1 -1
- package/lib-esm/xyz/xyzBidimensionalFFT.js +75 -0
- package/lib-esm/xyz/xyzBidimensionalFFT.js.map +1 -0
- package/package.json +7 -2
- package/src/apodization/apodization.ts +6 -4
- package/src/apodization/applyWindow.ts +0 -1
- package/src/apodization/compose.ts +1 -0
- package/src/apodization/getFunction.ts +3 -0
- package/src/apodization/shapes/WindowFunctions.ts +7 -1
- package/src/apodization/shapes/sineBell.ts +41 -0
- package/src/apodization/utils/getData.ts +0 -1
- package/src/filters/Data1D.ts +7 -0
- package/src/filters/Entry1D.ts +11 -0
- package/src/filters/ExclusionZone.ts +5 -0
- package/src/filters/Filters.ts +24 -0
- package/src/filters/FiltersManager.ts +176 -0
- package/src/filters/MatrixFilter.ts +58 -0
- package/src/filters/MatrixOptions.ts +26 -0
- package/src/filters/filter1d/apodization.ts +90 -0
- package/src/filters/filter1d/baselineCorrection.ts +83 -0
- package/src/filters/filter1d/digitalFilter.ts +51 -0
- package/src/filters/filter1d/equallySpaced.ts +61 -0
- package/src/filters/filter1d/exclusionZones.ts +34 -0
- package/src/filters/filter1d/fft.ts +135 -0
- package/src/filters/filter1d/phaseCorrection.ts +118 -0
- package/src/filters/filter1d/shiftX.ts +31 -0
- package/src/filters/filter1d/signalProcessing.ts +79 -0
- package/src/filters/filter1d/utils/padDataToNextPowerOfTwo.ts +48 -0
- package/src/filters/filter1d/zeroFilling.ts +90 -0
- package/src/filters/filter2d/shiftX.ts +31 -0
- package/src/filters/filter2d/shiftY.ts +29 -0
- package/src/index.ts +3 -0
- package/src/utilities/checkData2DFid.ts +10 -0
- package/src/utilities/cloneData1D.ts +6 -0
- package/src/utilities/cloneData2D.ts +27 -0
- package/src/xyz/Entry2D.ts +12 -0
- package/src/xyz/quadrature.ts +68 -0
- package/src/xyz/util/fft2d/digitalFilter.ts +24 -0
- package/src/xyz/util/fft2d/fftDirectDimension.ts +111 -0
- package/src/xyz/util/fft2d/fftIndirectDimension.ts +123 -0
- package/src/xyz/util/fft2d/removeDCOffset.ts +19 -0
- package/src/xyz/util/fft2d/zeroFilling.ts +39 -0
- package/src/xyz/util/padData.ts +13 -7
- package/src/xyz/xyzAutoSignalsPicking.ts +2 -2
- package/src/xyz/xyzAutoZonesPicking.ts +3 -9
- package/src/xyz/xyzBidimensionalFFT.ts +122 -0
- package/lib/xyz/Data2D.d.ts +0 -7
- package/lib/xyz/Data2D.js.map +0 -1
- package/lib-esm/xyz/Data2D.js +0 -2
- package/lib-esm/xyz/Data2D.js.map +0 -1
- package/src/xyz/Data2D.ts +0 -7
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Entry1D } from '../Entry1D';
|
|
2
|
+
import { FilterDomainUpdateRules } from '../FiltersManager';
|
|
3
|
+
export declare const id = "baselineCorrection";
|
|
4
|
+
export declare const name = "Baseline correction";
|
|
5
|
+
export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
|
|
6
|
+
export type BaselineAlgorithms = 'airpls' | 'polynomial';
|
|
7
|
+
export interface PolynomialOptions {
|
|
8
|
+
zones: Array<{
|
|
9
|
+
from: number;
|
|
10
|
+
to: number;
|
|
11
|
+
id: string;
|
|
12
|
+
}>;
|
|
13
|
+
algorithm: 'polynomial';
|
|
14
|
+
degree: number;
|
|
15
|
+
}
|
|
16
|
+
export interface AirplsOptions {
|
|
17
|
+
zones: Array<{
|
|
18
|
+
from: number;
|
|
19
|
+
to: number;
|
|
20
|
+
id: string;
|
|
21
|
+
}>;
|
|
22
|
+
algorithm: 'airpls';
|
|
23
|
+
maxIterations: number;
|
|
24
|
+
tolerance: number;
|
|
25
|
+
}
|
|
26
|
+
export type BaselineCorrectionOptions = PolynomialOptions | AirplsOptions;
|
|
27
|
+
export declare function apply(datum1D: Entry1D, options: BaselineCorrectionOptions): void;
|
|
28
|
+
export declare function isApplicable(datum1D: Entry1D): boolean;
|
|
29
|
+
export declare function reduce(previousValue: BaselineCorrectionOptions, newValue: BaselineCorrectionOptions): {
|
|
30
|
+
once: boolean;
|
|
31
|
+
reduce: BaselineCorrectionOptions;
|
|
32
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.reduce = exports.isApplicable = exports.apply = exports.DOMAIN_UPDATE_RULES = exports.name = exports.id = void 0;
|
|
7
|
+
const ml_airpls_1 = __importDefault(require("ml-airpls"));
|
|
8
|
+
const ml_baseline_correction_regression_1 = __importDefault(require("ml-baseline-correction-regression"));
|
|
9
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
10
|
+
exports.id = 'baselineCorrection';
|
|
11
|
+
exports.name = 'Baseline correction';
|
|
12
|
+
exports.DOMAIN_UPDATE_RULES = {
|
|
13
|
+
updateXDomain: false,
|
|
14
|
+
updateYDomain: true,
|
|
15
|
+
};
|
|
16
|
+
function apply(datum1D, options) {
|
|
17
|
+
if (!isApplicable(datum1D)) {
|
|
18
|
+
throw new Error('baselineCorrection not applicable on this data');
|
|
19
|
+
}
|
|
20
|
+
const { algorithm } = options;
|
|
21
|
+
let { x, re } = datum1D.data;
|
|
22
|
+
let corrected;
|
|
23
|
+
switch (algorithm) {
|
|
24
|
+
case 'airpls':
|
|
25
|
+
corrected = (0, ml_airpls_1.default)(x, re, options).corrected;
|
|
26
|
+
break;
|
|
27
|
+
case 'polynomial':
|
|
28
|
+
{
|
|
29
|
+
const { degree, zones } = options;
|
|
30
|
+
let reduced = (0, ml_spectra_processing_1.xyEquallySpaced)({ x, y: re }, { numberOfPoints: 4096, zones });
|
|
31
|
+
let result = (0, ml_baseline_correction_regression_1.default)(reduced.x, reduced.y, {
|
|
32
|
+
regressionOptions: degree,
|
|
33
|
+
});
|
|
34
|
+
let { regression } = result;
|
|
35
|
+
corrected = new Float64Array(x.length);
|
|
36
|
+
for (let i = 0; i < re.length; i++) {
|
|
37
|
+
corrected[i] = re[i] - regression.predict(x[i]);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
43
|
+
throw new Error(`baselineCorrection: algorithm unknown: ${algorithm}`);
|
|
44
|
+
}
|
|
45
|
+
Object.assign(datum1D.data, { re: corrected });
|
|
46
|
+
}
|
|
47
|
+
exports.apply = apply;
|
|
48
|
+
function isApplicable(datum1D) {
|
|
49
|
+
if (!datum1D.info.isFid)
|
|
50
|
+
return true;
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
exports.isApplicable = isApplicable;
|
|
54
|
+
function reduce(previousValue, newValue) {
|
|
55
|
+
return {
|
|
56
|
+
once: true,
|
|
57
|
+
reduce: newValue,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.reduce = reduce;
|
|
61
|
+
//# sourceMappingURL=baselineCorrection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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AK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBAClC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBACjD;aACF;YAED,MAAM;QACR;YACE,4EAA4E;YAC5E,MAAM,IAAI,KAAK,CAAC,0CAA0C,SAAS,EAAE,CAAC,CAAC;KAC1E;IAED,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AACjD,CAAC;AApCD,sBAoCC;AAED,SAAgB,YAAY,CAAC,OAAgB;IAC3C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,KAAK,CAAC;AACf,CAAC;AAHD,oCAGC;AAED,SAAgB,MAAM,CACpB,aAAwC,EACxC,QAAmC;IAEnC,OAAO;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,QAAQ;KACjB,CAAC;AACJ,CAAC;AARD,wBAQC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Entry1D } from '../Entry1D';
|
|
2
|
+
import { FilterDomainUpdateRules } from '../FiltersManager';
|
|
3
|
+
export declare const id = "digitalFilter";
|
|
4
|
+
export declare const name = "Digital Filter";
|
|
5
|
+
export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
|
|
6
|
+
/**
|
|
7
|
+
* Move points from the beginning to the end of FID and performs a first order phase correction
|
|
8
|
+
* @param {Datum1d} datum1d
|
|
9
|
+
*/
|
|
10
|
+
export declare function apply(datum1D: Entry1D, options?: any): void;
|
|
11
|
+
export declare function isApplicable(datum1D: Entry1D): boolean;
|
|
12
|
+
export declare function reduce(): {
|
|
13
|
+
once: boolean;
|
|
14
|
+
reduce: undefined;
|
|
15
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reduce = exports.isApplicable = exports.apply = exports.DOMAIN_UPDATE_RULES = exports.name = exports.id = void 0;
|
|
4
|
+
exports.id = 'digitalFilter';
|
|
5
|
+
exports.name = 'Digital Filter';
|
|
6
|
+
exports.DOMAIN_UPDATE_RULES = {
|
|
7
|
+
updateXDomain: true,
|
|
8
|
+
updateYDomain: true,
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Move points from the beginning to the end of FID and performs a first order phase correction
|
|
12
|
+
* @param {Datum1d} datum1d
|
|
13
|
+
*/
|
|
14
|
+
function apply(datum1D, options = {}) {
|
|
15
|
+
if (!isApplicable(datum1D)) {
|
|
16
|
+
throw new Error('Digital Filter is not applicable on this data');
|
|
17
|
+
}
|
|
18
|
+
let { digitalFilterValue = 0 } = options;
|
|
19
|
+
let re = new Float64Array(datum1D.data.re);
|
|
20
|
+
let im = new Float64Array(datum1D.data.im);
|
|
21
|
+
let pointsToShift = Math.floor(digitalFilterValue);
|
|
22
|
+
const skip = 0;
|
|
23
|
+
pointsToShift += 0;
|
|
24
|
+
const newRe = new Float64Array(re.length);
|
|
25
|
+
const newIm = new Float64Array(im.length);
|
|
26
|
+
newRe.set(re.slice(pointsToShift));
|
|
27
|
+
newRe.set(re.slice(skip, pointsToShift), re.length - pointsToShift);
|
|
28
|
+
newIm.set(im.slice(pointsToShift));
|
|
29
|
+
newIm.set(im.slice(skip, pointsToShift), im.length - pointsToShift);
|
|
30
|
+
datum1D.data.re = newRe;
|
|
31
|
+
datum1D.data.im = newIm;
|
|
32
|
+
}
|
|
33
|
+
exports.apply = apply;
|
|
34
|
+
function isApplicable(datum1D) {
|
|
35
|
+
if (datum1D.info.isComplex && datum1D.info.isFid)
|
|
36
|
+
return true;
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
exports.isApplicable = isApplicable;
|
|
40
|
+
function reduce() {
|
|
41
|
+
return {
|
|
42
|
+
once: true,
|
|
43
|
+
reduce: undefined,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
exports.reduce = reduce;
|
|
47
|
+
//# sourceMappingURL=digitalFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"digitalFilter.js","sourceRoot":"","sources":["../../../src/filters/filter1d/digitalFilter.ts"],"names":[],"mappings":";;;AAGa,QAAA,EAAE,GAAG,eAAe,CAAC;AACrB,QAAA,IAAI,GAAG,gBAAgB,CAAC;AACxB,QAAA,mBAAmB,GAAsC;IACpE,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF;;;GAGG;AAEH,SAAgB,KAAK,CAAC,OAAgB,EAAE,UAAe,EAAE;IACvD,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;KAClE;IAED,IAAI,EAAE,kBAAkB,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC;IACzC,IAAI,EAAE,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3C,IAAI,EAAE,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAE3C,IAAI,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEnD,MAAM,IAAI,GAAG,CAAC,CAAC;IACf,aAAa,IAAI,CAAC,CAAC;IAEnB,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IAC1C,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IACnC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,CAAC,EAAE,EAAE,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;IACpE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IACnC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,aAAa,CAAC,EAAE,EAAE,CAAC,MAAM,GAAG,aAAa,CAAC,CAAC;IAEpE,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC;IACxB,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC;AAC1B,CAAC;AAvBD,sBAuBC;AAED,SAAgB,YAAY,CAAC,OAAgB;IAC3C,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAC9D,OAAO,KAAK,CAAC;AACf,CAAC;AAHD,oCAGC;AAED,SAAgB,MAAM;IACpB,OAAO;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,SAAS;KAClB,CAAC;AACJ,CAAC;AALD,wBAKC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Entry1D } from '../Entry1D';
|
|
2
|
+
export declare const id = "equallySpaced";
|
|
3
|
+
export declare const name = "Equally spaced";
|
|
4
|
+
/**
|
|
5
|
+
* Equally Spaced
|
|
6
|
+
* **
|
|
7
|
+
* Function that returns a Number array of equally spaced numberOfPoints
|
|
8
|
+
* containing a representation of intensities of the spectra arguments x
|
|
9
|
+
* and y.
|
|
10
|
+
*
|
|
11
|
+
* The options parameter contains an object in the following form:
|
|
12
|
+
* from: starting point
|
|
13
|
+
* to: last point
|
|
14
|
+
* numberOfPoints: number of points between from and to
|
|
15
|
+
* variant: "slot" or "smooth" - smooth is the default option
|
|
16
|
+
*
|
|
17
|
+
* The slot variant consist that each point in the new array is calculated
|
|
18
|
+
* averaging the existing points between the slot that belongs to the current
|
|
19
|
+
* value. The smooth variant is the same but takes the integral of the range
|
|
20
|
+
* of the slot and divide by the step size between two points in the new array.
|
|
21
|
+
*
|
|
22
|
+
* @param {Array<{from:number;to:number}>} options.exclusions
|
|
23
|
+
*/
|
|
24
|
+
export declare function apply(spectrum: Entry1D, options?: any): void;
|
|
25
|
+
export declare function isApplicable(spectrum: Entry1D): boolean;
|
|
26
|
+
export declare function reduce(): {
|
|
27
|
+
once: boolean;
|
|
28
|
+
reduce: null;
|
|
29
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reduce = exports.isApplicable = exports.apply = exports.name = exports.id = void 0;
|
|
4
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
exports.id = 'equallySpaced';
|
|
6
|
+
exports.name = 'Equally spaced';
|
|
7
|
+
/**
|
|
8
|
+
* Equally Spaced
|
|
9
|
+
* **
|
|
10
|
+
* Function that returns a Number array of equally spaced numberOfPoints
|
|
11
|
+
* containing a representation of intensities of the spectra arguments x
|
|
12
|
+
* and y.
|
|
13
|
+
*
|
|
14
|
+
* The options parameter contains an object in the following form:
|
|
15
|
+
* from: starting point
|
|
16
|
+
* to: last point
|
|
17
|
+
* numberOfPoints: number of points between from and to
|
|
18
|
+
* variant: "slot" or "smooth" - smooth is the default option
|
|
19
|
+
*
|
|
20
|
+
* The slot variant consist that each point in the new array is calculated
|
|
21
|
+
* averaging the existing points between the slot that belongs to the current
|
|
22
|
+
* value. The smooth variant is the same but takes the integral of the range
|
|
23
|
+
* of the slot and divide by the step size between two points in the new array.
|
|
24
|
+
*
|
|
25
|
+
* @param {Array<{from:number;to:number}>} options.exclusions
|
|
26
|
+
*/
|
|
27
|
+
function apply(spectrum, options = {}) {
|
|
28
|
+
if (!isApplicable(spectrum)) {
|
|
29
|
+
throw new Error('Equally Spaced is not applicable on this data');
|
|
30
|
+
}
|
|
31
|
+
const { from, to, numberOfPoints, exclusions } = options;
|
|
32
|
+
const { x, re, im } = spectrum.data;
|
|
33
|
+
const XREdata = (0, ml_spectra_processing_1.xyEquallySpaced)({ x, y: re }, { from, to, numberOfPoints, exclusions });
|
|
34
|
+
spectrum.data.x = XREdata.x;
|
|
35
|
+
spectrum.data.re = XREdata.y;
|
|
36
|
+
if (im) {
|
|
37
|
+
const XIMdata = (0, ml_spectra_processing_1.xyEquallySpaced)({ x, y: re }, { from, to, numberOfPoints, exclusions });
|
|
38
|
+
spectrum.data.im = XIMdata.y;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.apply = apply;
|
|
42
|
+
function isApplicable(spectrum) {
|
|
43
|
+
if (spectrum.info.isComplex && !spectrum.info.isFid)
|
|
44
|
+
return true;
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
exports.isApplicable = isApplicable;
|
|
48
|
+
function reduce() {
|
|
49
|
+
return {
|
|
50
|
+
once: false,
|
|
51
|
+
reduce: null,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
exports.reduce = reduce;
|
|
55
|
+
//# sourceMappingURL=equallySpaced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"equallySpaced.js","sourceRoot":"","sources":["../../../src/filters/filter1d/equallySpaced.ts"],"names":[],"mappings":";;;AAAA,iEAAwD;AAI3C,QAAA,EAAE,GAAG,eAAe,CAAC;AACrB,QAAA,IAAI,GAAG,gBAAgB,CAAC;AAErC;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,SAAgB,KAAK,CAAC,QAAiB,EAAE,UAAe,EAAE;IACxD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;KAClE;IACD,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACzD,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;IACpC,MAAM,OAAO,GAAG,IAAA,uCAAe,EAC7B,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EACZ,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,CACzC,CAAC;IAEF,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAC7B,IAAI,EAAE,EAAE;QACN,MAAM,OAAO,GAAG,IAAA,uCAAe,EAC7B,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EACZ,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,CACzC,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;KAC9B;AACH,CAAC;AApBD,sBAoBC;AAED,SAAgB,YAAY,CAAC,QAAiB;IAC5C,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACjE,OAAO,KAAK,CAAC;AACf,CAAC;AAHD,oCAGC;AAED,SAAgB,MAAM;IACpB,OAAO;QACL,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,IAAI;KACb,CAAC;AACJ,CAAC;AALD,wBAKC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Entry1D } from '../Entry1D';
|
|
2
|
+
import { FilterDomainUpdateRules } from '../FiltersManager';
|
|
3
|
+
export declare const id = "exclusionZones";
|
|
4
|
+
export declare const name = "Exclusion zones";
|
|
5
|
+
export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
|
|
6
|
+
export declare function apply(spectrum: Entry1D, zones?: never[]): void;
|
|
7
|
+
export declare function isApplicable(spectrum: Entry1D): boolean;
|
|
8
|
+
export declare function reduce(previousValue: any, newValue: any): {
|
|
9
|
+
once: boolean;
|
|
10
|
+
reduce: import("cheminfo-types").FromTo[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reduce = exports.isApplicable = exports.apply = exports.DOMAIN_UPDATE_RULES = exports.name = exports.id = void 0;
|
|
4
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
exports.id = 'exclusionZones';
|
|
6
|
+
exports.name = 'Exclusion zones';
|
|
7
|
+
exports.DOMAIN_UPDATE_RULES = {
|
|
8
|
+
updateXDomain: false,
|
|
9
|
+
updateYDomain: false,
|
|
10
|
+
};
|
|
11
|
+
function apply(spectrum, zones = []) {
|
|
12
|
+
if (!isApplicable(spectrum)) {
|
|
13
|
+
throw new Error('Exclusion Zones filter not applicable on this data');
|
|
14
|
+
}
|
|
15
|
+
const { x, re, im } = spectrum.data;
|
|
16
|
+
spectrum.data.re = Float64Array.from((0, ml_spectra_processing_1.xySetYValue)({ x, y: re }, { zones }).y);
|
|
17
|
+
spectrum.data.im = im
|
|
18
|
+
? Float64Array.from((0, ml_spectra_processing_1.xySetYValue)({ x, y: re }, { zones }).y)
|
|
19
|
+
: im;
|
|
20
|
+
}
|
|
21
|
+
exports.apply = apply;
|
|
22
|
+
function isApplicable(spectrum) {
|
|
23
|
+
if (spectrum.info.isFt)
|
|
24
|
+
return true;
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
exports.isApplicable = isApplicable;
|
|
28
|
+
function reduce(previousValue, newValue) {
|
|
29
|
+
return {
|
|
30
|
+
once: true,
|
|
31
|
+
reduce: (0, ml_spectra_processing_1.zonesNormalize)(previousValue.concat(newValue)),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
exports.reduce = reduce;
|
|
35
|
+
//# sourceMappingURL=exclusionZones.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclusionZones.js","sourceRoot":"","sources":["../../../src/filters/filter1d/exclusionZones.ts"],"names":[],"mappings":";;;AAAA,iEAAoE;AAKvD,QAAA,EAAE,GAAG,gBAAgB,CAAC;AACtB,QAAA,IAAI,GAAG,iBAAiB,CAAC;AACzB,QAAA,mBAAmB,GAAsC;IACpE,aAAa,EAAE,KAAK;IACpB,aAAa,EAAE,KAAK;CACrB,CAAC;AAEF,SAAgB,KAAK,CAAC,QAAiB,EAAE,KAAK,GAAG,EAAE;IACjD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;KACvE;IACD,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,YAAY,CAAC,IAAI,CAAC,IAAA,mCAAW,EAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE;QACnB,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,IAAA,mCAAW,EAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,EAAE,CAAC;AACT,CAAC;AATD,sBASC;AAED,SAAgB,YAAY,CAAC,QAAiB;IAC5C,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACpC,OAAO,KAAK,CAAC;AACf,CAAC;AAHD,oCAGC;AAED,SAAgB,MAAM,CAAC,aAAkB,EAAE,QAAa;IACtD,OAAO;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,IAAA,sCAAc,EAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;KACvD,CAAC;AACJ,CAAC;AALD,wBAKC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Data1D } from '../Data1D';
|
|
2
|
+
import { Entry1D } from '../Entry1D';
|
|
3
|
+
import { FilterDomainUpdateRules } from '../FiltersManager';
|
|
4
|
+
export declare const id = "fft";
|
|
5
|
+
export declare const name = "FFT";
|
|
6
|
+
export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
|
|
7
|
+
export declare function apply(datum1D: Entry1D): void;
|
|
8
|
+
export declare function isApplicable(datum1D: Entry1D): datum1D is Entry1D & {
|
|
9
|
+
data: Required<Data1D>;
|
|
10
|
+
};
|
|
11
|
+
export declare function reduce(): {
|
|
12
|
+
once: boolean;
|
|
13
|
+
reduce: undefined;
|
|
14
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reduce = exports.isApplicable = exports.apply = exports.DOMAIN_UPDATE_RULES = exports.name = exports.id = void 0;
|
|
4
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
const padDataToNextPowerOfTwo_1 = require("./utils/padDataToNextPowerOfTwo");
|
|
6
|
+
exports.id = 'fft';
|
|
7
|
+
exports.name = 'FFT';
|
|
8
|
+
exports.DOMAIN_UPDATE_RULES = {
|
|
9
|
+
updateXDomain: true,
|
|
10
|
+
updateYDomain: true,
|
|
11
|
+
};
|
|
12
|
+
function apply(datum1D) {
|
|
13
|
+
if (!isApplicable(datum1D)) {
|
|
14
|
+
throw new Error('fft not applicable on this data');
|
|
15
|
+
}
|
|
16
|
+
checkSameLength(datum1D);
|
|
17
|
+
let digitalFilterApplied = datum1D.filters.some((e) => e.name === 'digitalFilter' && e.flag);
|
|
18
|
+
const { info: { aqMod }, } = datum1D;
|
|
19
|
+
if (aqMod === 1) {
|
|
20
|
+
removeDCOffset(datum1D, digitalFilterApplied);
|
|
21
|
+
}
|
|
22
|
+
if (!isPowerOfTwo(datum1D.data.x.length)) {
|
|
23
|
+
(0, padDataToNextPowerOfTwo_1.padDataToNextPowerOfTwo)(datum1D, digitalFilterApplied);
|
|
24
|
+
}
|
|
25
|
+
const { data, info } = datum1D;
|
|
26
|
+
Object.assign(data, (0, ml_spectra_processing_1.reimFFT)({
|
|
27
|
+
re: data.re,
|
|
28
|
+
im: data.im,
|
|
29
|
+
}, { applyZeroShift: true }));
|
|
30
|
+
if (digitalFilterApplied) {
|
|
31
|
+
let { digitalFilter = 0 } = info;
|
|
32
|
+
let ph1 = (digitalFilter - Math.floor(digitalFilter)) * Math.PI * 2;
|
|
33
|
+
Object.assign(data, (0, ml_spectra_processing_1.reimPhaseCorrection)(data, 0, -ph1, { reverse: true }));
|
|
34
|
+
}
|
|
35
|
+
datum1D.data.x = generateXAxis(datum1D);
|
|
36
|
+
datum1D.info = { ...datum1D.info, isFid: false, isFt: true };
|
|
37
|
+
}
|
|
38
|
+
exports.apply = apply;
|
|
39
|
+
function isApplicable(datum1D) {
|
|
40
|
+
if (datum1D.info.isComplex && datum1D.info.isFid)
|
|
41
|
+
return true;
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
exports.isApplicable = isApplicable;
|
|
45
|
+
function reduce() {
|
|
46
|
+
return {
|
|
47
|
+
once: true,
|
|
48
|
+
reduce: undefined,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
exports.reduce = reduce;
|
|
52
|
+
function generateXAxis(datum1D) {
|
|
53
|
+
const info = datum1D.info;
|
|
54
|
+
const baseFrequency = Number.parseFloat(info.baseFrequency);
|
|
55
|
+
const frequencyOffset = Number.parseFloat(info.frequencyOffset);
|
|
56
|
+
const spectralWidth = Number.parseFloat(info.spectralWidth);
|
|
57
|
+
const offset = frequencyOffset / baseFrequency;
|
|
58
|
+
let spectralHalfWidth = 0.5 * spectralWidth;
|
|
59
|
+
let nbPoints = datum1D.data.x.length;
|
|
60
|
+
let firstPoint = offset - spectralHalfWidth;
|
|
61
|
+
let dx = spectralWidth / (nbPoints - 1);
|
|
62
|
+
const xAxis = new Float64Array(nbPoints);
|
|
63
|
+
for (let i = 0; i < nbPoints; i++) {
|
|
64
|
+
xAxis[i] = firstPoint;
|
|
65
|
+
firstPoint += dx;
|
|
66
|
+
}
|
|
67
|
+
return xAxis;
|
|
68
|
+
}
|
|
69
|
+
function isPowerOfTwo(n) {
|
|
70
|
+
return n !== 0 && (n & (n - 1)) === 0;
|
|
71
|
+
}
|
|
72
|
+
function removeDCOffset(spectrum, digitalFilterApplied) {
|
|
73
|
+
let { digitalFilter = 0 } = digitalFilterApplied ? spectrum.info : {};
|
|
74
|
+
const data = spectrum.data;
|
|
75
|
+
const nbPoints = data.re.length;
|
|
76
|
+
const newRe = new Float64Array(data.re);
|
|
77
|
+
const newIm = new Float64Array(data.im);
|
|
78
|
+
const averageRe = (0, ml_spectra_processing_1.xMean)(data.re.slice((nbPoints * 0.75) >> 0, nbPoints - digitalFilter));
|
|
79
|
+
const averageIm = (0, ml_spectra_processing_1.xMean)(data.im.slice((nbPoints * 0.75) >> 0, nbPoints - digitalFilter));
|
|
80
|
+
for (let i = digitalFilterApplied ? 0 : digitalFilter; i < nbPoints - digitalFilter; i++) {
|
|
81
|
+
newRe[i] -= averageRe;
|
|
82
|
+
newIm[i] -= averageIm;
|
|
83
|
+
}
|
|
84
|
+
Object.assign(spectrum.data, { re: newRe, im: newIm });
|
|
85
|
+
return spectrum;
|
|
86
|
+
}
|
|
87
|
+
function checkSameLength(spectrum) {
|
|
88
|
+
var _a;
|
|
89
|
+
const { data } = spectrum;
|
|
90
|
+
if (data.x.length !== data.re.length || data.x.length !== ((_a = data.im) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
91
|
+
throw new Error('The length of data should be equal');
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=fft.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fft.js","sourceRoot":"","sources":["../../../src/filters/filter1d/fft.ts"],"names":[],"mappings":";;;AAAA,iEAK+B;AAM/B,6EAA0E;AAE7D,QAAA,EAAE,GAAG,KAAK,CAAC;AACX,QAAA,IAAI,GAAG,KAAK,CAAC;AACb,QAAA,mBAAmB,GAAsC;IACpE,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,IAAI;CACpB,CAAC;AAEF,SAAgB,KAAK,CAAC,OAAgB;IACpC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;KACpD;IAED,eAAe,CAAC,OAAO,CAAC,CAAC;IAEzB,IAAI,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAC7C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,IAAI,CAAC,CAAC,IAAI,CAC5C,CAAC;IAEF,MAAM,EACJ,IAAI,EAAE,EAAE,KAAK,EAAE,GAChB,GAAG,OAAO,CAAC;IAEZ,IAAI,KAAK,KAAK,CAAC,EAAE;QACf,cAAc,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;KAC/C;IAED,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE;QACxC,IAAA,iDAAuB,EAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;KACxD;IAED,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,CAAC,MAAM,CACX,IAAI,EACJ,IAAA,+BAAO,EACL;QACE,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,EAAE,EAAE,IAAI,CAAC,EAAE;KACZ,EACD,EAAE,cAAc,EAA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,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC,CAChE,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,6BAAK,EACrB,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC,CAChE,CAAC;IACF,KACE,IAAI,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,EAChD,CAAC,GAAG,QAAQ,GAAG,aAAa,EAC5B,CAAC,EAAE,EACH;QACA,KAAK,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;QACtB,KAAK,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC;KACvB;IAED,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACvD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,QAAiB;;IACxC,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;IAC1B,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,EAAE,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,MAAK,MAAA,IAAI,CAAC,EAAE,0CAAE,MAAM,CAAA,EAAE;QACzE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;KACvD;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Data1D } from '../Data1D';
|
|
2
|
+
import { Entry1D } from '../Entry1D';
|
|
3
|
+
import { FilterDomainUpdateRules } from '../FiltersManager';
|
|
4
|
+
export declare const id = "phaseCorrection";
|
|
5
|
+
export declare const name = "Phase correction";
|
|
6
|
+
export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
|
|
7
|
+
export interface PhaseCorrectionParameters {
|
|
8
|
+
ph0: number;
|
|
9
|
+
ph1: number;
|
|
10
|
+
absolute: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {Datum1d} datum1d
|
|
15
|
+
* @param {Object} [options={}]
|
|
16
|
+
* @param {number} [options.ph0=0]
|
|
17
|
+
* @param {number} [options.ph1=0]
|
|
18
|
+
*/
|
|
19
|
+
export declare function apply(datum1D: Entry1D, options?: any): void;
|
|
20
|
+
export declare function isApplicable(spectrum: Entry1D): spectrum is Entry1D & {
|
|
21
|
+
data: Required<Data1D>;
|
|
22
|
+
};
|
|
23
|
+
export declare function reduce(previousValue: PhaseCorrectionParameters, newValue: PhaseCorrectionParameters): {
|
|
24
|
+
once: boolean;
|
|
25
|
+
reduce: PhaseCorrectionParameters;
|
|
26
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reduce = exports.isApplicable = exports.apply = exports.DOMAIN_UPDATE_RULES = exports.name = exports.id = void 0;
|
|
4
|
+
const ml_spectra_processing_1 = require("ml-spectra-processing");
|
|
5
|
+
exports.id = 'phaseCorrection';
|
|
6
|
+
exports.name = 'Phase correction';
|
|
7
|
+
exports.DOMAIN_UPDATE_RULES = {
|
|
8
|
+
updateXDomain: false,
|
|
9
|
+
updateYDomain: false,
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {Datum1d} datum1d
|
|
14
|
+
* @param {Object} [options={}]
|
|
15
|
+
* @param {number} [options.ph0=0]
|
|
16
|
+
* @param {number} [options.ph1=0]
|
|
17
|
+
*/
|
|
18
|
+
function apply(datum1D, options = {}) {
|
|
19
|
+
var _a;
|
|
20
|
+
if (!isApplicable(datum1D)) {
|
|
21
|
+
throw new Error('phaseCorrection not applicable on this data');
|
|
22
|
+
}
|
|
23
|
+
const { absolute = false } = options;
|
|
24
|
+
const filter = (_a = datum1D.filters) === null || _a === void 0 ? void 0 : _a.find((filter) => filter.name === exports.id);
|
|
25
|
+
if (absolute) {
|
|
26
|
+
const { re, im } = datum1D.data;
|
|
27
|
+
datum1D.data.re = (0, ml_spectra_processing_1.reimAbsolute)({ re, im });
|
|
28
|
+
datum1D.data.im = new Float64Array(0);
|
|
29
|
+
if (filter) {
|
|
30
|
+
filter.value = { ...filter.value, ph0: 0, ph1: 0, absolute };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if ('ph0' in options && 'ph1' in options) {
|
|
34
|
+
let { ph0, ph1 } = options;
|
|
35
|
+
phaseCorrection(datum1D, { ph0, ph1 });
|
|
36
|
+
if (filter) {
|
|
37
|
+
filter.value = { ...filter.value, absolute };
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
let { ph0, ph1 } = autoPhaseCorrection(datum1D);
|
|
42
|
+
phaseCorrection(datum1D, { ph0, ph1 });
|
|
43
|
+
if (filter) {
|
|
44
|
+
filter.value = { ...filter.value, absolute, ph0, ph1 };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.apply = apply;
|
|
49
|
+
function phaseCorrection(spectrum, phaseValues) {
|
|
50
|
+
let { ph0, ph1 } = phaseValues;
|
|
51
|
+
ph0 *= Math.PI / 180;
|
|
52
|
+
ph1 *= Math.PI / 180;
|
|
53
|
+
spectrum.data = {
|
|
54
|
+
...spectrum.data,
|
|
55
|
+
...(0, ml_spectra_processing_1.reimPhaseCorrection)(spectrum.data, ph0, ph1, { reverse: true }),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function autoPhaseCorrection(spectrum, options = {}) {
|
|
59
|
+
const { minRegSize = 5, maxDistanceToJoin = 128, magnitudeMode = true, factorNoise = 5, reverse = true, } = options;
|
|
60
|
+
return (0, ml_spectra_processing_1.reimAutoPhaseCorrection)(spectrum.data, {
|
|
61
|
+
minRegSize,
|
|
62
|
+
maxDistanceToJoin,
|
|
63
|
+
magnitudeMode,
|
|
64
|
+
factorNoise,
|
|
65
|
+
reverse,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function isApplicable(spectrum) {
|
|
69
|
+
if (spectrum.info.isComplex && !spectrum.info.isFid)
|
|
70
|
+
return true;
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
exports.isApplicable = isApplicable;
|
|
74
|
+
function reduce(previousValue, newValue) {
|
|
75
|
+
return {
|
|
76
|
+
once: true,
|
|
77
|
+
reduce: newValue,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
exports.reduce = reduce;
|
|
81
|
+
//# sourceMappingURL=phaseCorrection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phaseCorrection.js","sourceRoot":"","sources":["../../../src/filters/filter1d/phaseCorrection.ts"],"names":[],"mappings":";;;AAAA,iEAI+B;AAMlB,QAAA,EAAE,GAAG,iBAAiB,CAAC;AACvB,QAAA,IAAI,GAAG,kBAAkB,CAAC;AAC1B,QAAA,mBAAmB,GAAsC;IACpE,aAAa,EAAE,KAAK;IACpB,aAAa,EAAE,KAAK;CACrB,CAAC;AAOF;;;;;;GAMG;AAEH,SAAgB,KAAK,CAAC,OAAgB,EAAE,UAAe,EAAE;;IACvD,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAChE;IAED,MAAM,EAAE,QAAQ,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IACrC,MAAM,MAAM,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,KAAK,UAAE,CAAC,CAAC;IAErE,IAAI,QAAQ,EAAE;QACZ,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,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,IAAI,GAAG;QACd,GAAG,QAAQ,CAAC,IAAI;QAChB,GAAG,IAAA,2CAAmB,EAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;KACnE,CAAC;AACJ,CAAC;AAUD,SAAS,mBAAmB,CAC1B,QAAiB,EACjB,UAAsC,EAAE;IAExC,MAAM,EACJ,UAAU,GAAG,CAAC,EACd,iBAAiB,GAAG,GAAG,EACvB,aAAa,GAAG,IAAI,EACpB,WAAW,GAAG,CAAC,EACf,OAAO,GAAG,IAAI,GACf,GAAG,OAAO,CAAC;IAEZ,OAAO,IAAA,+CAAuB,EAAC,QAAQ,CAAC,IAAW,EAAE;QACnD,UAAU;QACV,iBAAiB;QACjB,aAAa;QACb,WAAW;QACX,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,YAAY,CAC1B,QAAiB;IAEjB,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACjE,OAAO,KAAK,CAAC;AACf,CAAC;AALD,oCAKC;AAED,SAAgB,MAAM,CACpB,aAAwC,EACxC,QAAmC;IAEnC,OAAO;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,QAAQ;KACjB,CAAC;AACJ,CAAC;AARD,wBAQC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Entry1D } from '../Entry1D';
|
|
2
|
+
import { FilterDomainUpdateRules } from '../FiltersManager';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {Object} datum1d
|
|
6
|
+
* @param {number} [shiftValue=0]
|
|
7
|
+
*/
|
|
8
|
+
export declare const id = "shiftX";
|
|
9
|
+
export declare const name = "Shift X";
|
|
10
|
+
export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
|
|
11
|
+
export declare function apply(datum1D: Entry1D, shiftValue?: number): void;
|
|
12
|
+
export declare function isApplicable(): boolean;
|
|
13
|
+
export declare function reduce(previousValue: number, newValue: number): {
|
|
14
|
+
once: boolean;
|
|
15
|
+
reduce: number;
|
|
16
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reduce = exports.isApplicable = exports.apply = exports.DOMAIN_UPDATE_RULES = exports.name = exports.id = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} datum1d
|
|
7
|
+
* @param {number} [shiftValue=0]
|
|
8
|
+
*/
|
|
9
|
+
exports.id = 'shiftX';
|
|
10
|
+
exports.name = 'Shift X';
|
|
11
|
+
exports.DOMAIN_UPDATE_RULES = {
|
|
12
|
+
updateXDomain: true,
|
|
13
|
+
updateYDomain: false,
|
|
14
|
+
};
|
|
15
|
+
function apply(datum1D, shiftValue = 0) {
|
|
16
|
+
datum1D.data.x = datum1D.data.x.map((val) => val + shiftValue);
|
|
17
|
+
}
|
|
18
|
+
exports.apply = apply;
|
|
19
|
+
function isApplicable() {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
exports.isApplicable = isApplicable;
|
|
23
|
+
function reduce(previousValue, newValue) {
|
|
24
|
+
return {
|
|
25
|
+
once: true,
|
|
26
|
+
reduce: previousValue + newValue,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.reduce = reduce;
|
|
30
|
+
//# sourceMappingURL=shiftX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shiftX.js","sourceRoot":"","sources":["../../../src/filters/filter1d/shiftX.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AAEU,QAAA,EAAE,GAAG,QAAQ,CAAC;AACd,QAAA,IAAI,GAAG,SAAS,CAAC;AAEjB,QAAA,mBAAmB,GAAsC;IACpE,aAAa,EAAE,IAAI;IACnB,aAAa,EAAE,KAAK;CACrB,CAAC;AAEF,SAAgB,KAAK,CAAC,OAAgB,EAAE,UAAU,GAAG,CAAC;IACpD,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,UAAU,CAAC,CAAC;AACjE,CAAC;AAFD,sBAEC;AAED,SAAgB,YAAY;IAC1B,OAAO,IAAI,CAAC;AACd,CAAC;AAFD,oCAEC;AAED,SAAgB,MAAM,CAAC,aAAqB,EAAE,QAAgB;IAC5D,OAAO;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,aAAa,GAAG,QAAQ;KACjC,CAAC;AACJ,CAAC;AALD,wBAKC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { MatrixOptions } from '../MatrixOptions';
|
|
2
|
+
import { Entry1D } from '../Entry1D';
|
|
3
|
+
import { FilterDomainUpdateRules } from '../FiltersManager';
|
|
4
|
+
export declare const id = "signalProcessing";
|
|
5
|
+
export declare const name = "Signal processing";
|
|
6
|
+
export declare const DOMAIN_UPDATE_RULES: Readonly<FilterDomainUpdateRules>;
|
|
7
|
+
export declare function apply(spectrum: Entry1D, options: MatrixOptions): void;
|
|
8
|
+
export declare function isApplicable(spectrum: Entry1D): boolean;
|
|
9
|
+
export declare function reduce(previousValue: any, newValue: any): {
|
|
10
|
+
once: boolean;
|
|
11
|
+
reduce: any;
|
|
12
|
+
};
|
|
13
|
+
export declare function filterXY(spectrum: Entry1D, options: MatrixOptions): {
|
|
14
|
+
x: number[] | Float64Array;
|
|
15
|
+
re: number[] | Float64Array;
|
|
16
|
+
im: number[] | Float64Array;
|
|
17
|
+
};
|