@zakodium/nmr-types 0.5.8 → 0.5.9

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 +116 -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 {
@@ -528,7 +607,13 @@ export declare interface PhaseCorrectionVerticalOptions extends PhaseCorrectionH
528
607
  }
529
608
 
530
609
  export declare interface PolynomialOptions {
531
- zones: BaselineCorrectionZone[];
610
+ /**
611
+ * Array of x positions (anchors) where the baseline will be estimated.
612
+ * When provided only the x positions are needed; the corresponding y
613
+ * values are computed internally using a median window around each x.
614
+ * @default undefined
615
+ */
616
+ anchors?: NumberArray;
532
617
  algorithm: 'polynomial';
533
618
  degree: number;
534
619
  }
@@ -723,8 +808,35 @@ export declare interface TrimOptions {
723
808
 
724
809
  export declare interface WhittakerOptions {
725
810
  algorithm: 'whittaker';
811
+ /**
812
+ * Value between [0-1] that indicates how much the initial weight will be updated relative to the absolute
813
+ * value of an approximation of the standard deviation of the difference between
814
+ * the baseline and the original signal.
815
+ * @default 0.2
816
+ */
817
+ learningRate?: number;
818
+ /**
819
+ * Smoothing parameter. Factor of weights matrix in -> [I + lambda D'D]z = x.
820
+ * @default 2000
821
+ */
726
822
  lambda?: number;
823
+ /**
824
+ * Maximal number of iterations if the method does not reach the stop criterion.
825
+ * @default 100
826
+ */
727
827
  maxIterations?: number;
828
+ /**
829
+ * Tolerance for convergence. The process stops if the change in baseline is less than this value.
830
+ * @default 1e-3
831
+ */
832
+ tolerance?: number;
833
+ /**
834
+ * Array of x positions (anchors) where the baseline will be estimated.
835
+ * When provided only the x positions are needed; the corresponding y
836
+ * values are computed internally using a median window around each x.
837
+ * @default undefined
838
+ */
839
+ anchors?: NumberArray;
728
840
  }
729
841
 
730
842
  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.9",
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": "40ac12f7777c90a4c90c5f5e6507f22ef0d37a13"
42
42
  }