nirs4all.synthesis.scattering module
Scattering effects configuration for synthetic NIRS data generation.
This module provides configuration classes for light scattering effects in NIR spectra, including particle size effects and scattering coefficient generation.
Note
For applying scattering effects to spectra, use the operators in nirs4all.operators.augmentation.scattering: - ParticleSizeAugmenter: Particle size-dependent scattering - EMSCDistortionAugmenter: EMSC-style scatter distortions
- Key Features:
EMSC-style (Extended Multiplicative Scatter Correction) transformations
Particle size-dependent scattering simulation
Scattering coefficient generation for Kubelka-Munk
Sample-to-sample scatter variation
Wavelength-dependent scattering (Rayleigh-like)
- Physics Background:
Light scattering in particulate samples is complex and depends on: - Particle size relative to wavelength (Mie vs Rayleigh regimes) - Particle shape and surface roughness - Refractive index differences - Packing density
Rather than implementing full Mie theory (computationally expensive and may not match real data), this module uses empirical EMSC-style models that approximate the distortions that chemometric preprocessing corrects.
References
Martens, H., Nielsen, J. P., & Engelsen, S. B. (2003). Light scattering and light absorbance separated by extended multiplicative signal correction. Application to near-infrared transmission analysis of powder mixtures. Analytical Chemistry, 75(3), 394-404.
Kubelka, P. (1948). New contributions to the optics of intensely light-scattering materials. Part I. JOSA, 38(5), 448-457.
Dahm, D. J., & Dahm, K. D. (2007). Interpreting Diffuse Reflectance and Transmittance. NIR Publications.
Burger, J., & Geladi, P. (2005). Hyperspectral NIR image regression part I: calibration and correction. Journal of Chemometrics, 19(5‐7), 355-363.
- class nirs4all.synthesis.scattering.EMSCConfig(polynomial_order: int = 2, multiplicative_scatter_std: float = 0.15, additive_scatter_std: float = 0.05, include_wavelength_terms: bool = True, wavelength_coef_std: float = 0.02, reference_spectrum: ndarray | None = None)[source]
Bases:
objectConfiguration for EMSC-style scattering transformation.
EMSC models scattering distortion as: x = a + b*x_ref + d*λ + e*λ² + …
where a, b are multiplicative/additive scatter, and higher terms model baseline curvature due to scattering.
- reference_spectrum
Optional reference spectrum for EMSC.
- Type:
numpy.ndarray | None
- class nirs4all.synthesis.scattering.ParticleSizeConfig(distribution: ParticleSizeDistribution = <factory>, reference_size_um: float = 50.0, size_effect_strength: float = 1.0, wavelength_exponent: float = 1.5, include_path_length_effect: bool = True, path_length_sensitivity: float = 0.5)[source]
Bases:
objectConfiguration for particle size effects.
- distribution
Particle size distribution parameters.
- wavelength_exponent
Exponent for wavelength dependence of scattering. - 4.0 = Rayleigh (particles << wavelength) - 0.0 = No wavelength dependence - 1.0-2.0 = Typical for NIR powder samples
- Type:
- distribution: ParticleSizeDistribution
- class nirs4all.synthesis.scattering.ParticleSizeDistribution(mean_size_um: float = 50.0, std_size_um: float = 15.0, min_size_um: float = 5.0, max_size_um: float = 200.0, distribution: str = 'lognormal')[source]
Bases:
objectParticle size distribution parameters.
Models particle size as a log-normal distribution, which is common for ground/milled samples in NIR analysis.
- class nirs4all.synthesis.scattering.ScatteringCoefficientConfig(baseline_scattering: float = 1.0, wavelength_exponent: float = 1.0, particle_size_factor: float = 0.5, sample_variation: float = 0.15, wavelength_reference_nm: float = 1500.0)[source]
Bases:
objectConfiguration for scattering coefficient (S) generation.
For Kubelka-Munk reflectance, we need both absorption (K) and scattering (S) coefficients. This config controls S(λ) generation.
- class nirs4all.synthesis.scattering.ScatteringEffectsConfig(model: ScatteringModel = ScatteringModel.EMSC, particle_size: ParticleSizeConfig = <factory>, emsc: EMSCConfig = <factory>, scattering_coefficient: ScatteringCoefficientConfig = <factory>, enable_particle_size: bool = True, enable_emsc: bool = True)[source]
Bases:
objectCombined configuration for all scattering effects.
- model
Which scattering model to use.
- particle_size
Particle size effect configuration.
- emsc
EMSC-style transformation configuration.
- scattering_coefficient
Scattering coefficient generation config.
- emsc: EMSCConfig
- model: ScatteringModel = 'emsc'
- particle_size: ParticleSizeConfig
- scattering_coefficient: ScatteringCoefficientConfig