nirs4all.data.synthetic.detectors module
Detector simulation for synthetic NIRS data generation.
This module provides detailed simulation of NIR detector characteristics including spectral response curves, noise models, and nonlinearity effects.
- Key Features:
Detector spectral response curves (Si, InGaAs, PbS, etc.)
Shot noise, thermal noise, read noise, and 1/f noise models
Detector nonlinearity simulation
Temperature-dependent behavior
References
Rogalski, A. (2002). Infrared Detectors: An Overview. Infrared Physics & Technology, 43(3-5), 187-210.
Vincent, J. D., Hodges, S., Vampola, J., Stegall, M., & Pierce, G. (2015). Fundamentals of Infrared and Visible Detector Operation and Testing. Wiley.
Burns, D. A., & Ciurczak, E. W. (2007). Handbook of Near-Infrared Analysis. CRC Press.
- class nirs4all.data.synthetic.detectors.DetectorConfig(detector_type: ~nirs4all.data.synthetic.instruments.DetectorType = DetectorType.INGAAS, temperature_k: float = 293.0, integration_time_ms: float = 100.0, gain: float = 1.0, noise_model: ~nirs4all.data.synthetic.detectors.NoiseModelConfig = <factory>, apply_response_curve: bool = True, apply_nonlinearity: bool = False, nonlinearity_coefficient: float = 0.02)[source]
Bases:
objectComplete detector configuration.
- detector_type
Type of detector.
- noise_model
Noise model configuration.
- detector_type: DetectorType = 'ingaas'
- noise_model: NoiseModelConfig
- class nirs4all.data.synthetic.detectors.DetectorSimulator(config: DetectorConfig | None = None, random_state: int | None = None)[source]
Bases:
objectSimulate detector effects on NIR spectra.
Applies detector spectral response, noise models, and nonlinearity to synthetic spectra.
- config
Detector configuration.
- rng
Random number generator.
Example
>>> config = DetectorConfig(detector_type=DetectorType.INGAAS) >>> simulator = DetectorSimulator(config, random_state=42) >>> spectra_out = simulator.apply(spectra, wavelengths)
- apply(spectra: ndarray, wavelengths: ndarray, base_signal_level: float = 1.0) ndarray[source]
Apply detector effects to spectra.
- Parameters:
spectra – Input spectra (n_samples, n_wavelengths).
wavelengths – Wavelength array (nm).
base_signal_level – Reference signal level for noise scaling.
- Returns:
Spectra with detector effects applied.
- class nirs4all.data.synthetic.detectors.DetectorSpectralResponse(detector_type: DetectorType, wavelengths: ndarray, response: ndarray, peak_wavelength: float, cutoff_wavelength: float, short_cutoff: float, peak_qe: float = 0.7)[source]
Bases:
objectSpectral response curve for a detector.
Defines the wavelength-dependent sensitivity (quantum efficiency) of the detector.
- detector_type
Type of detector.
- wavelengths
Wavelength grid for response curve (nm).
- Type:
- response
Relative response at each wavelength (0-1).
- Type:
- detector_type: DetectorType
- class nirs4all.data.synthetic.detectors.NoiseModelConfig(shot_noise_enabled: bool = True, thermal_noise_enabled: bool = True, read_noise_enabled: bool = True, flicker_noise_enabled: bool = False, quantization_noise_enabled: bool = False, shot_noise_factor: float = 1.0, thermal_noise_factor: float = 1.0, read_noise_electrons: float = 50.0, flicker_corner_freq: float = 100.0, adc_bits: int = 16, full_scale: float = 3.0)[source]
Bases:
objectConfiguration for detector noise model.
- nirs4all.data.synthetic.detectors.get_default_noise_config(detector_type: DetectorType) NoiseModelConfig[source]
Get default noise model configuration for a detector type.
- Parameters:
detector_type – Type of detector.
- Returns:
NoiseModelConfig with appropriate defaults.
- nirs4all.data.synthetic.detectors.get_detector_response(detector_type: DetectorType) DetectorSpectralResponse[source]
Get spectral response curve for a detector type.
- Parameters:
detector_type – Type of detector.
- Returns:
DetectorSpectralResponse object.
- nirs4all.data.synthetic.detectors.get_detector_wavelength_range(detector_type: DetectorType) Tuple[float, float][source]
Get the effective wavelength range for a detector type.
- Parameters:
detector_type – Type of detector.
- Returns:
Tuple of (min_wavelength, max_wavelength) in nm.
- nirs4all.data.synthetic.detectors.list_detector_types() List[str][source]
List available detector types.
- Returns:
List of detector type names.
- nirs4all.data.synthetic.detectors.simulate_detector_effects(spectra: ndarray, wavelengths: ndarray, detector_type: DetectorType = DetectorType.INGAAS, include_response: bool = True, include_noise: bool = True, random_state: int | None = None) ndarray[source]
Apply detector effects to spectra with simple API.
- Parameters:
spectra – Input spectra (n_samples, n_wavelengths).
wavelengths – Wavelength array (nm).
detector_type – Type of detector to simulate.
include_response – Whether to apply spectral response.
include_noise – Whether to apply noise.
random_state – Random seed.
- Returns:
Spectra with detector effects applied.
Example
>>> spectra_out = simulate_detector_effects( ... spectra, wavelengths, ... detector_type=DetectorType.PBS ... )