@zakodium/nmr-types 0.5.8 → 0.5.10

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.
Files changed (2) hide show
  1. package/dist/nmr-types.d.ts +119 -4
  2. package/package.json +2 -2
@@ -1,15 +1,25 @@
1
1
  import type * as Filters from 'ml-signal-processing';
2
2
  import type { FilterXYType } from 'ml-signal-processing';
3
3
  import type { FromTo } from 'cheminfo-types';
4
+ import type { Logger } from 'cheminfo-types';
5
+ import type { NumberArray } from 'cheminfo-types';
4
6
  import type { PeakXYWidth } from 'cheminfo-types';
5
7
  import type { Shape1D } from 'ml-peak-shape-generator';
6
8
  import type { XYEquallySpacedOptions } from 'ml-spectra-processing';
7
9
 
8
10
  export declare interface AirplsOptions {
9
- zones: BaselineCorrectionZone[];
10
11
  algorithm: 'airpls';
12
+ lambda?: number;
13
+ /**
14
+ * Array of x positions (anchors) where the baseline will be estimated.
15
+ * When provided only the x positions are needed; the corresponding y
16
+ * values are computed internally using a median window around each x.
17
+ * @default undefined
18
+ */
19
+ anchors?: NumberArray;
11
20
  maxIterations: number;
12
21
  tolerance: number;
22
+ autoDownsample?: boolean;
13
23
  }
14
24
 
15
25
  export declare interface Apodization1DFilterOptions extends BaseFilter {
@@ -112,12 +122,47 @@ export declare interface BasePeak {
112
122
  }
113
123
 
114
124
  export declare interface BernsteinOptions {
115
- algorithm: 'bernstein';
116
125
  degree: number;
126
+ algorithm: 'bernstein';
127
+ /**
128
+ * Array of x positions (anchors) where the baseline will be estimated.
129
+ * When provided only the x positions are needed; the corresponding y
130
+ * values are computed internally using a median window around each x.
131
+ * @default undefined
132
+ */
133
+ anchors?: NumberArray;
134
+ /**
135
+ * Median window size (in number of points) used to compute anchor y
136
+ * values from the input `data` when `anchors` (x positions) are
137
+ * provided. If omitted a sensible default is used by `getAnchors`.
138
+ * @default undefined
139
+ */
140
+ medianWindow?: number;
141
+ /**
142
+ * Maximum number of iterations to perform.
143
+ * @default 100
144
+ */
117
145
  maxIterations?: number;
146
+ /**
147
+ * Tolerance level for convergence.
148
+ * The algorithm stops if the change between iterations is below this value.
149
+ * @default 1e-6
150
+ */
118
151
  tolerance?: number;
152
+ /**
153
+ * Factor to scale the residuals.
154
+ * @default 1.0
155
+ */
119
156
  factorStd?: number;
157
+ /**
158
+ * Learning rate for the iterative updates.
159
+ * @default 0.01
160
+ */
120
161
  learningRate?: number;
162
+ /**
163
+ * Logger instance for logging the progress and debug information.
164
+ */
165
+ logger?: Logger;
121
166
  }
122
167
 
123
168
  declare interface BooleanField extends Field<boolean> {
@@ -128,12 +173,46 @@ declare type CommonField = SelectField | StringField | NumberField | BooleanFiel
128
173
 
129
174
  export declare interface CubicOptions {
130
175
  algorithm: 'cubic';
131
- numAnchors?: number;
176
+ /**
177
+ * Array of x positions (anchors) where the baseline will be estimated.
178
+ * When provided only the x positions are needed; the corresponding y
179
+ * values are computed internally using a median window around each x.
180
+ * @default []
181
+ */
182
+ anchors?: NumberArray;
183
+ /**
184
+ * Noise threshold multiplier. An anchor is clipped when
185
+ * signal[anchor] > baseline[anchor] + noiseThreshold * σ_noise
186
+ * Smaller → more aggressive clipping (may clip baseline regions too).
187
+ * Larger → less clipping (may leave some signal contamination).
188
+ * Default: 1.0
189
+ */
132
190
  noiseThreshold?: number;
191
+ /**
192
+ * Maximum number of clipping iterations.
193
+ * Default: 20
194
+ */
133
195
  maxIterations?: number;
196
+ /**
197
+ * Stop iterating when RMS change in baseline between iterations
198
+ * falls below tolerance * σ_noise.
199
+ * Default: 0.001
200
+ */
134
201
  tolerance?: number;
202
+ /**
203
+ * Override the automatic noise estimate with a fixed value.
204
+ * Useful when you know your instrument's noise floor.
205
+ */
135
206
  noiseLevel?: number;
207
+ /**
208
+ * Percentile (0–100) used to estimate noise from |diff(signal)|.
209
+ * Default: 10 (lower 10th percentile of first differences).
210
+ */
136
211
  noisePercentile?: number;
212
+ /** Median window size (number of points) passed to `getAnchors` when
213
+ * `anchors` is supplied. Default: Math.max(1, Math.floor(data.y.length/100)).
214
+ */
215
+ medianWindow?: number;
137
216
  }
138
217
 
139
218
  export declare interface DigitalFilter2DOptions extends BaseFilter {
@@ -292,6 +371,7 @@ export declare interface Info {
292
371
  solvent?: string;
293
372
  pulseSequence?: string;
294
373
  name: string;
374
+ spectrumSource?: SpectrumSource;
295
375
  }
296
376
 
297
377
  export declare interface Info1D extends Info {
@@ -528,7 +608,13 @@ export declare interface PhaseCorrectionVerticalOptions extends PhaseCorrectionH
528
608
  }
529
609
 
530
610
  export declare interface PolynomialOptions {
531
- zones: BaselineCorrectionZone[];
611
+ /**
612
+ * Array of x positions (anchors) where the baseline will be estimated.
613
+ * When provided only the x positions are needed; the corresponding y
614
+ * values are computed internally using a median window around each x.
615
+ * @default undefined
616
+ */
617
+ anchors?: NumberArray;
532
618
  algorithm: 'polynomial';
533
619
  degree: number;
534
620
  }
@@ -639,6 +725,8 @@ export declare interface SineBellOptions {
639
725
 
640
726
  export declare type SineSquareOptions = Omit<SineBellOptions, 'exponent'>;
641
727
 
728
+ export declare type SpectrumSource = 'prediction' | 'database' | 'unknown';
729
+
642
730
  declare interface StringField extends Field<string> {
643
731
  type: 'string';
644
732
  }
@@ -723,8 +811,35 @@ export declare interface TrimOptions {
723
811
 
724
812
  export declare interface WhittakerOptions {
725
813
  algorithm: 'whittaker';
814
+ /**
815
+ * Value between [0-1] that indicates how much the initial weight will be updated relative to the absolute
816
+ * value of an approximation of the standard deviation of the difference between
817
+ * the baseline and the original signal.
818
+ * @default 0.2
819
+ */
820
+ learningRate?: number;
821
+ /**
822
+ * Smoothing parameter. Factor of weights matrix in -> [I + lambda D'D]z = x.
823
+ * @default 2000
824
+ */
726
825
  lambda?: number;
826
+ /**
827
+ * Maximal number of iterations if the method does not reach the stop criterion.
828
+ * @default 100
829
+ */
727
830
  maxIterations?: number;
831
+ /**
832
+ * Tolerance for convergence. The process stops if the change in baseline is less than this value.
833
+ * @default 1e-3
834
+ */
835
+ tolerance?: number;
836
+ /**
837
+ * Array of x positions (anchors) where the baseline will be estimated.
838
+ * When provided only the x positions are needed; the corresponding y
839
+ * values are computed internally using a median window around each x.
840
+ * @default undefined
841
+ */
842
+ anchors?: NumberArray;
728
843
  }
729
844
 
730
845
  export declare interface ZeroFillingDimension1Options extends BaseFilter {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zakodium/nmr-types",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "Types related to NMR data processing.",
5
5
  "author": "Zakodium Sàrl",
6
6
  "license": "CC-BY-NC-SA-4.0",
@@ -38,5 +38,5 @@
38
38
  "volta": {
39
39
  "extends": "../../../package.json"
40
40
  },
41
- "gitHead": "433002a53e8ad5b8b3743ae5762c1d4a4b8fc85a"
41
+ "gitHead": "33548bbb69c0f3d6eb5ded49caf404d5f53cf7ac"
42
42
  }