nmr-processing 22.1.0 → 22.2.0

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.
@@ -97,6 +97,8 @@ import type { SineBellOptions } from '@zakodium/nmr-types';
97
97
  import type { SymmetrizeCosyLikeOptions } from '@zakodium/nmr-types';
98
98
  import type { TopicMolecule } from 'openchemlib-utils';
99
99
  import type { TrafOptions } from '@zakodium/nmr-types';
100
+ import type { TrimFilterOptions } from '@zakodium/nmr-types';
101
+ import type { TrimOptions } from '@zakodium/nmr-types';
100
102
  import type { XRobustDistributionStats } from 'ml-spectra-processing';
101
103
  import type { XYNumber } from 'spectrum-generator';
102
104
  import type { ZeroFillingDimension1Options } from '@zakodium/nmr-types';
@@ -606,7 +608,7 @@ export declare function fftIndirectDimension(data: {
606
608
  im: DoubleArray[] | Matrix;
607
609
  }, options?: IndirectDimensionOptions): Record<string, Matrix>;
608
610
 
609
- export declare type Filter1D = FFT1D | BaselineCorrection1D | BackwardLinearPrediction1D | Apodization1D | DigitalFilter | EquallySpaced | ExclusionZones | ForwardLP1D | PhaseCorrection1D | ShiftX | SignalProcessing | ZeroFilling;
611
+ export declare type Filter1D = FFT1D | BaselineCorrection1D | BackwardLinearPrediction1D | Apodization1D | DigitalFilter | EquallySpaced | ExclusionZones | ForwardLP1D | PhaseCorrection1D | ShiftX | SignalProcessing | Trim | ZeroFilling;
610
612
 
611
613
  export declare type Filter2D = ApodizationDimension1 | ApodizationDimension2 | BaselineCorrection2D | BackwardLPDimension1 | BackwardLPDimension2 | NUSDimension2 | FFTDimension1 | FFTDimension2 | FordwardLPDimension1 | FordwardLPDimension2 | DigitalFilter2D | PhaseCorrection2D | ZeroFillingDimension1 | ZeroFillingDimension2 | SymmetrizeCosyLike | Shift2DX | Shift2DY;
612
614
 
@@ -2515,6 +2517,41 @@ declare interface Traf<ShapeOption = TrafOptions> {
2515
2517
  */
2516
2518
  export declare function translateMultiplet(name: string): string;
2517
2519
 
2520
+ declare type Trim = FilterFactory<Entry1D, TrimOptions> & Pick<TrimFilterOptions, 'name'>;
2521
+
2522
+ export declare interface TrimApplyOptions {
2523
+ /**
2524
+ * Percentage (0-100) of points to trim from the low side. If undefined, no percentage-based trimming is applied to the low.
2525
+ * @default undefined
2526
+ */
2527
+ lowPercentage?: number;
2528
+ /**
2529
+ * Percentage (0-100) of points to trim from the high side. If undefined, no percentage-based trimming is applied to the high.
2530
+ * @default undefined
2531
+ */
2532
+ highPercentage?: number;
2533
+ /**
2534
+ * Value of the leftmost point to keep. If set, all points to the low of this value are trimmed.
2535
+ * @default undefined
2536
+ */
2537
+ lowValue?: number;
2538
+ /**
2539
+ * Value of the rightmost point to keep. If set, all points to the high of this value are trimmed.
2540
+ * @default undefined
2541
+ */
2542
+ highValue?: number;
2543
+ /**
2544
+ * Number of points to remove from the low side. If set, trims this many points from the low.
2545
+ * @default 0
2546
+ */
2547
+ lowNbPoints?: number;
2548
+ /**
2549
+ * Number of points to remove from the high side. If set, trims this many points from the high.
2550
+ * @default 0
2551
+ */
2552
+ highNbPoints?: number;
2553
+ }
2554
+
2518
2555
  /**
2519
2556
  * Options for specifying the region and resolution of the 2D spectrum
2520
2557
  */
@@ -2586,6 +2623,16 @@ export declare function xreimMultipletAnalysis(
2586
2623
  */
2587
2624
  data: DataXReOptionalIm, options?: XreimMultipletAnalysis): any;
2588
2625
 
2626
+ /**
2627
+ * Trims the input arrays in the object by removing points from the low and high according to the provided options.
2628
+ *
2629
+ * @param input - The input data containing x (required), re (required), and optionally im arrays. All arrays must be of the same length.
2630
+ * @param options - The trimming options specifying how many points or what range to trim.
2631
+ * @throws Error if the x array is not sorted in ascending order.
2632
+ * @returns A new DataXReOptionalIm object with trimmed x, re, and (if present) im arrays.
2633
+ */
2634
+ export declare function xreimTrim(input: DataXReOptionalIm, options: TrimApplyOptions): DataXReOptionalIm;
2635
+
2589
2636
  export declare function xyAutoPeaksPicking(data: DataXY<Float64Array>, options: OptionsXYAutoPeaksPicking): NMRPeak1DWithShapeID[];
2590
2637
 
2591
2638
  /**