nirs4all.data.signal_type module

Signal type management for spectroscopy data.

This module provides: - SignalType enum for absorbance, reflectance, transmittance - Autodetection heuristics based on value ranges and band directions - Conversion utilities between signal types

class nirs4all.data.signal_type.SignalTypeDetector(wavelengths: ndarray | None = None, wavelength_unit: str = 'nm')[source]

Bases: object

Heuristic detector for spectral signal types.

Uses value ranges and optionally wavelength information to determine whether data is absorbance, reflectance, or transmittance.

WATER_BANDS_CM1 = [6897, 5155, 4000]
WATER_BANDS_NM = [1450, 1940, 2500]
detect(spectra: ndarray, confidence_threshold: float = 0.7) → tuple[SignalType, float, str][source]

Detect the signal type of spectral data.

Parameters:
  • spectra – Spectral data array of shape (n_samples, n_features)

  • confidence_threshold – Minimum confidence to return a definite type

Returns:

Tuple of (SignalType, confidence, reason_string)