nmr-processing 17.1.0 → 17.1.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.
@@ -1,37 +1,36 @@
1
- import { AnalizeMultipletOptions } from 'multiplet-analysis';
1
+ import type { AnalizeMultipletOptions } from 'multiplet-analysis';
2
2
  import { BaseRegression } from 'ml-regression-base';
3
- import { DataReIm } from 'ml-spectra-processing';
4
- import { DataXReIm } from 'ml-spectra-processing';
3
+ import type { DataReIm } from 'ml-spectra-processing';
4
+ import type { DataXReIm } from 'ml-spectra-processing';
5
5
  import { DataXY } from 'cheminfo-types';
6
- import { DoubleArray } from 'cheminfo-types';
6
+ import type { DoubleArray } from 'cheminfo-types';
7
7
  import { ExponentialRegression } from 'ml-regression-exponential';
8
8
  import type { FilterXYType } from 'ml-signal-processing';
9
9
  import { FromTo } from 'cheminfo-types';
10
- import { GroupedDiaID } from 'openchemlib-utils';
11
- import { GSDOptions } from 'ml-gsd';
10
+ import type { GroupedDiaID } from 'openchemlib-utils';
11
+ import type { GSDOptions } from 'ml-gsd';
12
12
  import { GSDPeakOptimized } from 'ml-gsd';
13
13
  import { GSDPeakOptimizedID } from 'ml-gsd';
14
- import { JoinBroadPeaksOptions } from 'ml-gsd';
15
- import { LightLogger } from 'cheminfo-types';
16
- import { Logger } from 'cheminfo-types';
14
+ import type { JoinBroadPeaksOptions } from 'ml-gsd';
15
+ import type { LightLogger } from 'cheminfo-types';
16
+ import type { Logger } from 'cheminfo-types';
17
17
  import { Matrix } from 'ml-matrix';
18
- import * as matrixPeakFinders from 'ml-matrix-peaks-finder';
19
- import { Molecule } from 'openchemlib/full';
18
+ import type { Molecule } from 'openchemlib/full';
20
19
  import type { Molecule as Molecule_2 } from 'openchemlib/minimal';
21
- import { NmrData1D } from 'cheminfo-types';
22
- import { NmrData2D } from 'cheminfo-types';
23
- import { NmrData2DContent } from 'cheminfo-types';
24
- import { NmrData2DFt } from 'cheminfo-types';
25
- import { NumberArray } from 'cheminfo-types';
26
- import { OCLMolecule } from 'cheminfo-types';
27
- import { OptimizePeaksOptions } from 'ml-gsd';
28
- import { OptionsSG1D } from 'spectrum-generator';
20
+ import type { NmrData1D } from 'cheminfo-types';
21
+ import type { NmrData2D } from 'cheminfo-types';
22
+ import type { NmrData2DContent } from 'cheminfo-types';
23
+ import type { NmrData2DFt } from 'cheminfo-types';
24
+ import type { NumberArray } from 'cheminfo-types';
25
+ import type { OCLMolecule } from 'cheminfo-types';
26
+ import type { OptimizePeaksOptions } from 'ml-gsd';
27
+ import type { OptionsSG1D } from 'spectrum-generator';
29
28
  import type { Peak2D as Peak2D_2 } from 'ml-matrix-peaks-finder';
30
- import { PeakXYWidth } from 'cheminfo-types';
29
+ import type { PeakXYWidth } from 'cheminfo-types';
31
30
  import { PointXY } from 'cheminfo-types';
32
31
  import { Shape1D } from 'ml-peak-shape-generator';
33
- import { TopicMolecule } from 'openchemlib-utils';
34
- import { XYEquallySpacedOptions } from 'ml-spectra-processing';
32
+ import type { TopicMolecule } from 'openchemlib-utils';
33
+ import type { XYEquallySpacedOptions } from 'ml-spectra-processing';
35
34
  import type { XYNumber } from 'spectrum-generator';
36
35
 
37
36
  declare function addDefaultSignal(range: Range_2): void;
@@ -78,6 +77,8 @@ export declare function apodizationXReIm(data: Required<NmrData1D>, options: Apo
78
77
 
79
78
  /**
80
79
  * pure function that applies a window function to the input data.
80
+ * @param data
81
+ * @param options
81
82
  */
82
83
  export declare function apodize(data: DoubleArray, options: ApplyWindowOptions): Float64Array<ArrayBufferLike>;
83
84
 
@@ -114,9 +115,6 @@ declare interface ApplyFilterOptions_2 {
114
115
  */
115
116
  declare function applyFilters(datum: Entry1D, filters?: Filter1DOptions[], options?: ApplyFilterOptions): void;
116
117
 
117
- /***
118
- * @param {object} Filters [{name:'',options:{}},{...}]
119
- */
120
118
  declare function applyFilters_2(datum: Entry2D, filters?: Filter2DOptions[], options?: ApplyFilterOptions_2): void;
121
119
 
122
120
  export declare interface ApplyWindowOptions {
@@ -297,8 +295,8 @@ export declare const carbonImpurities: DatabaseNMREntry[];
297
295
 
298
296
  /**
299
297
  * check whether integral based on its kind can be included in another operation or not
300
- * @param integral integral
301
- * @returns {boolean}
298
+ * @param integral - integral
299
+ * @returns
302
300
  */
303
301
  export declare function checkIntegralKind(integral: Integral): boolean;
304
302
 
@@ -630,7 +628,8 @@ declare interface FilterFactory<EntryType, OptionsType> {
630
628
  * Filter function that process the data in place.
631
629
  */
632
630
  apply: (datum1D: EntryType, options: OptionsType) => void;
633
- /** This function is called when the same filter had been applied
631
+ /**
632
+ * This function is called when the same filter had been applied
634
633
  * it returns the value should be applied to the filter (reduce) and
635
634
  */
636
635
  reduce: (previousValue: OptionsType, newValue: OptionsType) => {
@@ -653,7 +652,7 @@ export declare const Filters1D: {
653
652
  }>;
654
653
  };
655
654
 
656
- declare namespace Filters1DManager {
655
+ export declare namespace Filters1DManager {
657
656
  export {
658
657
  applyFilters,
659
658
  reapplyFilters,
@@ -662,7 +661,6 @@ declare namespace Filters1DManager {
662
661
  applyFilter
663
662
  }
664
663
  }
665
- export { Filters1DManager }
666
664
 
667
665
  export declare const Filters2D: {
668
666
  [K in Filter2D['name']]: Extract<Filter2D, {
@@ -670,7 +668,7 @@ export declare const Filters2D: {
670
668
  }>;
671
669
  };
672
670
 
673
- declare namespace Filters2DManager {
671
+ export declare namespace Filters2DManager {
674
672
  export {
675
673
  applyFilters_2 as applyFilters,
676
674
  reapplyFilters_2 as reapplyFilters,
@@ -679,7 +677,6 @@ declare namespace Filters2DManager {
679
677
  applyFilter_2 as applyFilter
680
678
  }
681
679
  }
682
- export { Filters2DManager }
683
680
 
684
681
  /**
685
682
  * Look for a multiplet based on the pattern name or abbreviation.
@@ -691,12 +688,9 @@ export declare function findMultiplet(name: string): MatchingMultiplicity | unde
691
688
  * Finds a peak that can serve as a pivot point within specified boundaries.
692
689
  * The pivot is selected based on its y-value being above a threshold and its position
693
690
  * being closest to either boundary (minX or maxX).
694
- *
695
691
  * @param peaks - Array of points containing x and y coordinates
696
692
  * @param options - Configuration object for finding the pivot
697
- *
698
693
  * @returns The peak that serves as pivot point
699
- *
700
694
  * @throws {Error} If peaks array is empty
701
695
  */
702
696
  export declare function findPivot(peaks: PointXY[], options: XYObjectSidePointOptions): PointXY;
@@ -759,7 +753,7 @@ declare interface GaussianOptions {
759
753
 
760
754
  export declare function get13CAssignments(ranges: NMRRange[], molecule: Molecule, options?: Get13CAssignmentsOptions): Promise<{
761
755
  score: any;
762
- assignment: unknown[];
756
+ assignment: NMRRangeWithIntegration[];
763
757
  }[]>;
764
758
 
765
759
  export declare interface Get13CAssignmentsOptions {
@@ -794,7 +788,7 @@ export declare function get1DErrorFactor(spectrum: Entry1D): number;
794
788
 
795
789
  export declare function get1HAssignments(ranges: NMRRange[], molecule: Molecule, options?: Get1HAssignmentsOptions): Promise<{
796
790
  score: any;
797
- assignment: unknown[];
791
+ assignment: NMRRangeWithIntegration[];
798
792
  }[]>;
799
793
 
800
794
  export declare interface Get1HAssignmentsOptions {
@@ -890,12 +884,15 @@ export declare interface GetAutoAssignmentInput {
890
884
  * The approach is to find the peaks using GSD and then to enlarge the peaks
891
885
  * to determine the zones where the baseline is not present
892
886
  * @param data
887
+ * @param options
893
888
  */
894
889
  export declare function getBaselineZones(data: NmrData1D, options?: BaselineZoneOptions): BaselineCorrectionZone[];
895
890
 
896
891
  /**
897
892
  * Generate baseline zones by Dietrich method, it uses an iterative thresholding to discard signals zones over a power spectrum.
898
893
  * the implementation is based on the publication of Cobas et al (DOI: {@link https://doi.org/10.1016/j.jmr.2006.07.013})
894
+ * @param data
895
+ * @param options
899
896
  */
900
897
  export declare function getBaselineZonesByDietrich(data: NmrData1D, options?: BaselineZoneOptionsDietrich): BaselineCorrectionZone[];
901
898
 
@@ -910,6 +907,8 @@ declare function getDiaIDs(range: Range_2): string[];
910
907
 
911
908
  /**
912
909
  * calculate the frequency of a nucleus with respect to a reference nucleus
910
+ * @param nucleus
911
+ * @param observedNucleusData
913
912
  */
914
913
  export declare function getFrequency(
915
914
  /**
@@ -1112,10 +1111,10 @@ export declare function mapRanges(ranges: Range_2[] | NMRRange[], spectrum: Entr
1112
1111
  delta: number;
1113
1112
  multiplicity: string;
1114
1113
  js: Jcoupling[];
1114
+ nbAtoms?: number | undefined;
1115
1115
  atoms?: number[] | undefined;
1116
1116
  assignment?: string | undefined;
1117
1117
  diaIDs?: string[] | undefined;
1118
- nbAtoms?: number | undefined;
1119
1118
  integration?: number | undefined;
1120
1119
  statistics?: NMRSignalStatistics | undefined;
1121
1120
  kind: string;
@@ -1202,7 +1201,8 @@ export declare function mapZones(zones: Zone[], datum: Entry2D, options?: MapOpt
1202
1201
  export declare function markSolventPeaks<T extends NMRRange>(input: T[], solventSignals: NMRSignal1D[], options?: MarkSolventPeaksOptions): T[];
1203
1202
 
1204
1203
  declare interface MarkSolventPeaksOptions {
1205
- /** The NMR spectrometer frequency in MHz
1204
+ /**
1205
+ * The NMR spectrometer frequency in MHz
1206
1206
  * @default 400
1207
1207
  */
1208
1208
  frequency?: number;
@@ -1223,7 +1223,6 @@ export declare interface MatrixOptions {
1223
1223
  /**
1224
1224
  * Matrix generation filters
1225
1225
  * @default []
1226
- *
1227
1226
  */
1228
1227
  filters: Array<MatrixFilter & {
1229
1228
  options: object;
@@ -1251,10 +1250,10 @@ declare type MatrixProperties = Record<string, Properties>;
1251
1250
  export declare function matrixToBoxPlot(input: NumberArray[], options?: {
1252
1251
  colors?: string[];
1253
1252
  }): {
1254
- color: any[];
1253
+ color: (string | undefined)[];
1254
+ median: Float64Array<ArrayBufferLike>;
1255
1255
  max: Float64Array<ArrayBufferLike>;
1256
1256
  min: Float64Array<ArrayBufferLike>;
1257
- median: Float64Array<ArrayBufferLike>;
1258
1257
  q1: Float64Array<ArrayBufferLike>;
1259
1258
  q3: Float64Array<ArrayBufferLike>;
1260
1259
  };
@@ -1262,7 +1261,7 @@ export declare function matrixToBoxPlot(input: NumberArray[], options?: {
1262
1261
  export declare function matrixToStocsy(matrix: NumberArray[], index: number, options?: MatrixToStocsyOptions): {
1263
1262
  y: number[];
1264
1263
  correlations: Float64Array<ArrayBuffer>;
1265
- color: any[];
1264
+ color: (string | undefined)[];
1266
1265
  };
1267
1266
 
1268
1267
  declare interface MatrixToStocsyOptions {
@@ -1393,6 +1392,7 @@ declare interface NMRZoneWithIds extends Omit<NMRZone, 'signals' | 'id'> {
1393
1392
 
1394
1393
  /**
1395
1394
  * The idea is to convert nucleus name like H1, proton or Fluorine19 to 1H and 19F.
1395
+ * @param nucleus
1396
1396
  */
1397
1397
  export declare function normalizeNucleus(nucleus: string): string;
1398
1398
 
@@ -1653,31 +1653,29 @@ export declare interface Peaks {
1653
1653
 
1654
1654
  /**
1655
1655
  * Filters impurities from a list of NMR peaks based on the specified options.
1656
- *
1657
1656
  * @template T - The type of NMR peaks.
1658
- * @param {T[]} peakList - The list of NMR peaks to be filtered.
1659
- * @param {OptionsPeaksFilterImpurities} [options={}] - The options for filtering impurities.
1660
- * @returns {T[]} The filtered list of NMR peaks.
1657
+ * @param peakList - The list of NMR peaks to be filtered.
1658
+ * @param [options={}] - The options for filtering impurities.
1659
+ * @returns The filtered list of NMR peaks.
1661
1660
  */
1662
1661
  export declare function peaksFilterImpurities<T extends NMRPeak1D>(peakList: T[], options?: OptionsPeaksFilterImpurities): T[];
1663
1662
 
1664
1663
  /**
1665
1664
  * Generates an NMR Free Induction Decay (FID) signal from a list of peaks.
1666
- *
1667
- * @param {Array<{ x: number, y: number }>} peaks - The list of peaks, where:
1665
+ * @param peaks - The list of peaks, where:
1668
1666
  * - `x` is the chemical shift in ppm.
1669
1667
  * - `y` is the intensity of the peak.
1670
- * @param {object} options - The options for FID generation.
1671
- * @param {number} [options.from=0] - The start of the spectral window in ppm.
1672
- * @param {number} [options.to=10] - The end of the spectral window in ppm.
1673
- * @param {number} [options.nbPoints=1024] - The number of data points in the FID.
1674
- * @param {number} [options.frequency=400] - The spectrometer frequency in MHz.
1675
- * @param {NumberArray} [options.t2Relaxation] - An array of T2 relaxation times in milliseconds for each peak.
1668
+ * @param options - The options for FID generation.
1669
+ * @param [options.from=0] - The start of the spectral window in ppm.
1670
+ * @param [options.to=10] - The end of the spectral window in ppm.
1671
+ * @param [options.nbPoints=1024] - The number of data points in the FID.
1672
+ * @param [options.frequency=400] - The spectrometer frequency in MHz.
1673
+ * @param [options.t2Relaxation] - An array of T2 relaxation times in milliseconds for each peak.
1676
1674
  * If not provided, all peaks are assigned a default T2 relaxation time of 100 ms.
1677
- * @returns {{ re: Float64Array, im: Float64Array }} - The generated FID signal, where:
1675
+ * @returns - The generated FID signal, where:
1678
1676
  * - `re` is the real part of the FID.
1679
1677
  * - `im` is the imaginary part of the FID.
1680
- **/
1678
+ */
1681
1679
  export declare function peaksToFID(peaks: Array<{
1682
1680
  x: number;
1683
1681
  y: number;
@@ -1770,7 +1768,9 @@ export declare interface PolynomialOptions {
1770
1768
 
1771
1769
  /**
1772
1770
  * Generate the 2D correlation nmr peaks based on the number of bonds between a pair of atoms
1773
- * @returns {Promise<object>} - object with molfile, diaIDs, 1D and 2D signals, joined signals, ranges and zones.
1771
+ * @param molecule
1772
+ * @param options
1773
+ * @returns - object with molfile, diaIDs, 1D and 2D signals, joined signals, ranges and zones.
1774
1774
  */
1775
1775
  export declare function predict(molecule: Molecule, options?: PredictAllOptions): Promise<Predicted>;
1776
1776
 
@@ -2181,7 +2181,7 @@ export declare interface RangeToXYOptions {
2181
2181
  shape: Shape1D;
2182
2182
  }
2183
2183
 
2184
- declare namespace RangeUtilities {
2184
+ export declare namespace RangeUtilities {
2185
2185
  export {
2186
2186
  getDiaIDs,
2187
2187
  getNbAtoms,
@@ -2193,7 +2193,6 @@ declare namespace RangeUtilities {
2193
2193
  checkSignalKinds
2194
2194
  }
2195
2195
  }
2196
- export { RangeUtilities }
2197
2196
 
2198
2197
  declare function reapplyFilters(datum: Entry1D, options?: {
2199
2198
  filters?: Filter1DOptions[];
@@ -2346,6 +2345,8 @@ declare interface SignalAxis {
2346
2345
  * Join couplings smaller than a define tolerance.
2347
2346
  * The resulting coupling should be an average of the existing one.
2348
2347
  * If pathLength is specified and is not always the same this property will be removed.
2348
+ * @param signal
2349
+ * @param options
2349
2350
  */
2350
2351
  export declare function signalJoinCouplings(signal: NMRSignal1D, options?: SignalJoinCouplingsOptions): NMRSignal1D;
2351
2352
 
@@ -2376,7 +2377,9 @@ export declare const SignalKindsToInclude: string[];
2376
2377
 
2377
2378
  /**
2378
2379
  * Return
2379
- * @param {*} signal
2380
+ * @param signal
2381
+ * @param options
2382
+ * @param options.acsFormat
2380
2383
  */
2381
2384
  export declare function signalMultiplicityPattern(signal: NMRSignal1D, options?: {
2382
2385
  acsFormat?: boolean;
@@ -2427,6 +2430,9 @@ declare interface Signals2DToZOptions {
2427
2430
 
2428
2431
  /**
2429
2432
  * Join signals if all the same diaID
2433
+ * @param signals
2434
+ * @param options
2435
+ * @returns
2430
2436
  */
2431
2437
  export declare function signalsJoin(signals: NMRSignal1D[], options?: SignalsJoinOptions): Signal1DWidthJsAndDiaID[];
2432
2438
 
@@ -2443,6 +2449,8 @@ export declare interface SignalsJoinOptions {
2443
2449
  * It does not propagate the hamiltonian of the spin system, instead it simulate all the
2444
2450
  * frequencies in the spectrum (including second order) and add all the waves in a real and
2445
2451
  * imaginary parts, that is why the couplings should be assigned in order to generate the spin system.
2452
+ * @param signals
2453
+ * @param options
2446
2454
  */
2447
2455
  export declare function signalsToFID(signals: NMRSignal1D[], options: SignalsToFIDOptions): {
2448
2456
  re: Float64Array<ArrayBuffer>;
@@ -2503,11 +2511,15 @@ declare interface SignalsToRangesOptions {
2503
2511
 
2504
2512
  /**
2505
2513
  * Generate a spectrum from an array of singals
2514
+ * @param signals
2515
+ * @param options
2506
2516
  */
2507
2517
  export declare function signalsToXY(signals: NMRSignal1D[], options?: OptionsSignalsToXY): DataXY<Float64Array<ArrayBufferLike>>;
2508
2518
 
2509
2519
  /**
2510
2520
  * This function simulates a one dimensional nmr spectrum. This function returns an array containing the relative intensities of the spectrum in the specified simulation window (from-to).
2521
+ * @param spinSystemInput
2522
+ * @param options
2511
2523
  */
2512
2524
  export declare function simulate1D(spinSystemInput: SpinSystem, options?: Simulate1DOptions): DataXY<Float64Array<ArrayBufferLike>>;
2513
2525
 
@@ -2551,7 +2563,6 @@ declare interface Simulate1DOptions {
2551
2563
 
2552
2564
  /**
2553
2565
  * This function will generate an object compatible with NMR-ium
2554
- *
2555
2566
  * @param molecule
2556
2567
  * @param options
2557
2568
  */
@@ -2774,6 +2785,8 @@ declare function unlink(range: Range_2, options?: UnlinkOptions): Range_2;
2774
2785
  /**
2775
2786
  * Predict back points by singular value decomposition.
2776
2787
  * to append the predicted points is it needed to append nbPoints zeros at the beginning of input data.
2788
+ * @param data
2789
+ * @param options
2777
2790
  */
2778
2791
  export declare function xBackwardLinearPrediction(data: DoubleArray, options: BackwardLPOptions): {
2779
2792
  output: Float64Array<ArrayBufferLike>;
@@ -2783,6 +2796,8 @@ declare function unlink(range: Range_2, options?: UnlinkOptions): Range_2;
2783
2796
  /**
2784
2797
  * Predict back points by singular value decomposition.
2785
2798
  * to append the predicted points is it needed to append nbPoints zeros at the beginning of input data.
2799
+ * @param data
2800
+ * @param options
2786
2801
  */
2787
2802
  export declare function xForwardLinearPrediction(data: DoubleArray, options: ForwardLPOptions): {
2788
2803
  output: Float64Array<ArrayBufferLike>;
@@ -2797,6 +2812,8 @@ declare function unlink(range: Range_2, options?: UnlinkOptions): Range_2;
2797
2812
  /**
2798
2813
  * Determination of J couplings by recursive deconvolution in the frequency domain,
2799
2814
  * it use the method published by Damien Jeannerat and Geoffrey Bodenhausen @link{https://doi.org/10.1006/jmre.1999.1845}
2815
+ * @param data
2816
+ * @param options
2800
2817
  */
2801
2818
  export declare function xreimMultipletAnalysis(
2802
2819
  /**
@@ -2817,11 +2834,15 @@ declare function unlink(range: Range_2, options?: UnlinkOptions): Range_2;
2817
2834
 
2818
2835
  /**
2819
2836
  * Detect peaks, optimize parameters and compile multiplicity if required.
2837
+ * @param data
2838
+ * @param options
2820
2839
  */
2821
2840
  export declare function xyAutoRangesPicking(data: DataXY<Float64Array>, options: OptionsXYAutoRangesPicking): NMRRange[];
2822
2841
 
2823
2842
  /**
2824
2843
  * Estimate the diffusion coefficient of an independent component by fitting of imput data with the Stejskal–Tanner equation.
2844
+ * @param data
2845
+ * @param options
2825
2846
  */
2826
2847
  export declare function xyCalculateDiffussionCoefficient(
2827
2848
  /**
@@ -2872,10 +2893,12 @@ declare function unlink(range: Range_2, options?: UnlinkOptions): Range_2;
2872
2893
  * Bidimensional automatic phase correction, based in the idea to see the spectrum as a bitmap,
2873
2894
  * where the number of white pixels will be bigger in a phased spectrum (whitening concept). Further information can be found in the
2874
2895
  * publication of Balacco and Cobas (DOI: {@link https://doi.org/10.1002/mrc.2394}). This method use a incremental search instead of simplex algorithm.
2896
+ * @param data
2897
+ * @param options
2875
2898
  */
2876
2899
  export declare function xyzAutoPhaseCorrection(data: NmrData2DFt, options?: AutoPhaseCorrection2D): Required<PhaseCorrectionTwoDOptions>;
2877
2900
 
2878
- export declare function xyzAutoSignalsPicking(spectraData: NmrData2DContent, options: XYZAutoSignalsPickingOptions): NMRSignal2DWithID<matrixPeakFinders.Peak2D & {
2901
+ export declare function xyzAutoSignalsPicking(spectraData: NmrData2DContent, options: XYZAutoSignalsPickingOptions): NMRSignal2DWithID<Peak2D_2 & {
2879
2902
  id: string;
2880
2903
  }>[];
2881
2904