nmr-processing 22.5.2 → 22.7.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.
@@ -1216,6 +1216,7 @@ export declare interface NMRZone {
1216
1216
  x: FromTo;
1217
1217
  y: FromTo;
1218
1218
  integration?: number;
1219
+ absolute?: number;
1219
1220
  id?: string;
1220
1221
  signals: NMRSignal2D[];
1221
1222
  }
@@ -2845,12 +2846,46 @@ export declare interface XYZAutoZonesPickingOptions {
2845
2846
 
2846
2847
  export declare function xyzPhaseCorrection(data: NmrData2DFt, options: PhaseCorrectionTwoDOptions): NmrData2DFt;
2847
2848
 
2849
+ /**
2850
+ * Integrates a zone in 2D spectra data assuming the delta X/Y is constant.
2851
+ * the integration and absolute values are the same.
2852
+ */
2848
2853
  export declare function xyzZoneIntegration<T extends NMRZone>(spectraData: NmrData2DContent, zone: T): T & {
2849
2854
  integration: number;
2850
2855
  };
2851
2856
 
2852
- export declare function xyzZonesIntegration<T extends NMRZone>(spectraData: NmrData2DContent, zones: T[]): Array<T & {
2857
+ /**
2858
+ * Integrates zones over a 2D NMR spectrum grid.
2859
+ *
2860
+ * This function computes the absolute integrated area for each provided zone
2861
+ * by summing the matrix values inside the zone bounds and multiplying by
2862
+ * the area element (|deltaX * deltaY|). If `options.maxIntegrationValue`
2863
+ * is provided and is not 0, the function normalizes all zone integrations so
2864
+ * that the sum of `integration` values equals `maxIntegrationValue`.
2865
+ *
2866
+ * Assumptions:
2867
+ * - `spectraData.z` is a regular 2D matrix of numbers with dimensions
2868
+ * `[rows][columns]` corresponding to Y and X axis points respectively.
2869
+ * - X and Y axes are uniformly spaced between `minX..maxX` and `minY..maxY`.
2870
+ *
2871
+ * Behavior details:
2872
+ * - The zone coordinates are specified as `FromTo` ranges for `x` and `y`.
2873
+ * - Matrix indices are calculated by rounding the coordinate-to-index mapping
2874
+ * and clamped to the matrix bounds.
2875
+ * - `absolute` is the raw area (sum * |dx * dy|) and `integration` is
2876
+ * either equal to `absolute` or a normalized value depending on options.
2877
+ *
2878
+ * @param spectraData - 2D spectrum content.
2879
+ * @param zones - Array of zones to integrate. Each zone must expose `x` and `y` ranges.
2880
+ * @returns A new array where each zone is extended with numeric properties
2881
+ * `absolute` (raw area) and `integration` (possibly normalized).
2882
+ *
2883
+ * @example
2884
+ * const integrated = xyzZonesIntegration(spectra, zones, { maxIntegrationValue: 100 });
2885
+ */
2886
+ export declare function xyzZonesIntegration<T extends NMRZone>(spectraData: NmrData2DContent, zones: T[], options?: ZonesIntegrationOptions): Array<T & {
2853
2887
  integration: number;
2888
+ absolute: number;
2854
2889
  }>;
2855
2890
 
2856
2891
  declare type ZeroFilling = FilterFactory<Entry1D, ZeroFillingOptions> & Pick<ZeroFillingFilterOptions, 'name'>;
@@ -2868,6 +2903,16 @@ declare type ZoneForMapping = Pick<Zone, 'id' | 'kind' | 'x' | 'y'> & {
2868
2903
  signals: SignalForMapping[];
2869
2904
  };
2870
2905
 
2906
+ export declare interface ZonesIntegrationOptions {
2907
+ /**
2908
+ * If provided and non-zero, the integrations
2909
+ * are scaled so that their max value would be qual this value.
2910
+ * Set to `0` to skip rescaling.
2911
+ * @default 100
2912
+ */
2913
+ maxIntegrationValue?: number;
2914
+ }
2915
+
2871
2916
 
2872
2917
  export * from "gyromagnetic-ratio";
2873
2918