nirs4all.synthesis.measurement_modes module

Measurement mode simulation for synthetic NIRS data generation.

This module provides simulation of different NIR measurement geometries and their associated physics. The relationship between absorption coefficients and observed signal varies significantly with measurement mode.

Supported Measurement Modes:
  • Transmittance: Beer-Lambert law, direct transmission

  • Diffuse Reflectance: Kubelka-Munk theory for scattering samples

  • Transflectance: Double-pass transmission with mirror backing

  • ATR: Attenuated Total Reflectance with wavelength-dependent penetration

References

  • Kubelka, P. (1948). New contributions to the optics of intensely light-scattering materials. Part I. JOSA, 38(5), 448-457.

  • Burns, D. A., & Ciurczak, E. W. (2007). Handbook of Near-Infrared Analysis. CRC Press.

  • Harrick, N. J. (1967). Internal Reflection Spectroscopy. Wiley.

  • Dahm, D. J., & Dahm, K. D. (2007). Interpreting Diffuse Reflectance and Transmittance. NIR Publications.

class nirs4all.synthesis.measurement_modes.ATRConfig(crystal_material: str = 'diamond', crystal_refractive_index: float = 2.4, incidence_angle: float = 45.0, n_reflections: int = 1, sample_refractive_index: float = 1.5)[source]

Bases: object

Configuration for Attenuated Total Reflectance mode.

ATR uses internal reflection within a high-refractive-index crystal. The evanescent wave penetrates into the sample, with penetration depth depending on wavelength.

Variables:
  • crystal_material (str) – ATR crystal material.

  • crystal_refractive_index (float) – Refractive index of crystal.

  • incidence_angle (float) – Angle of incidence (degrees).

  • n_reflections (int) – Number of internal reflections.

  • sample_refractive_index (float) – Approximate refractive index of sample.

crystal_material: str = 'diamond'
crystal_refractive_index: float = 2.4
incidence_angle: float = 45.0
n_reflections: int = 1
sample_refractive_index: float = 1.5
class nirs4all.synthesis.measurement_modes.ReflectanceConfig(geometry: str = 'integrating_sphere', reference_material: str = 'spectralon', reference_reflectance: float = 0.99, illumination_angle: float = 0.0, collection_angle: float = 45.0, sample_presentation: str = 'powder')[source]

Bases: object

Configuration for diffuse reflectance measurement mode.

Implements Kubelka-Munk theory: f(R) = (1-R)² / 2R = K/S where R is reflectance, K is absorption coefficient, S is scattering.

Variables:
  • geometry (str) – Measurement geometry (integrating sphere, fiber probe, etc.).

  • reference_material (str) – Reference standard material.

  • reference_reflectance (float) – Reflectance of reference standard.

  • illumination_angle (float) – Angle of illumination (degrees from normal).

  • collection_angle (float) – Angle of collection (degrees from normal).

  • sample_presentation (str) – How sample is presented (powder, solid, slurry).

collection_angle: float = 45.0
geometry: str = 'integrating_sphere'
illumination_angle: float = 0.0
reference_material: str = 'spectralon'
reference_reflectance: float = 0.99
sample_presentation: str = 'powder'
class nirs4all.synthesis.measurement_modes.ScatteringConfig(baseline_scattering: float = 1.0, wavelength_exponent: float = 1.0, particle_size_um: float = 50.0, particle_size_variation: float = 0.2, sample_to_sample_variation: float = 0.15)[source]

Bases: object

Configuration for scattering coefficient generation.

Controls how scattering coefficients are generated for samples, which is essential for Kubelka-Munk reflectance simulation.

Variables:
  • baseline_scattering (float) – Base scattering coefficient (arbitrary units).

  • wavelength_exponent (float) – Exponent for wavelength dependence (Rayleigh-like). S(λ) ∝ λ^(-exponent), typically 0.5-2.0

  • particle_size_um (float) – Mean particle size in micrometers.

  • particle_size_variation (float) – Coefficient of variation in particle size.

  • sample_to_sample_variation (float) – How much scattering varies between samples.

baseline_scattering: float = 1.0
particle_size_um: float = 50.0
particle_size_variation: float = 0.2
sample_to_sample_variation: float = 0.15
wavelength_exponent: float = 1.0
class nirs4all.synthesis.measurement_modes.TransflectanceConfig(path_length_mm: float = 0.5, reflector_type: str = 'gold', reflector_reflectance: float = 0.95, spacer_thickness_mm: float = 0.5)[source]

Bases: object

Configuration for transflectance measurement mode.

Light passes through sample, reflects off a mirror/diffuser, and passes through sample again (double-pass).

Variables:
  • path_length_mm (float) – Single-pass path length in mm.

  • reflector_type (str) – Type of backing reflector.

  • reflector_reflectance (float) – Reflectance of backing material.

  • spacer_thickness_mm (float) – Spacer thickness controlling path length.

path_length_mm: float = 0.5
reflector_reflectance: float = 0.95
reflector_type: str = 'gold'
spacer_thickness_mm: float = 0.5
class nirs4all.synthesis.measurement_modes.TransmittanceConfig(path_length_mm: float = 1.0, path_length_variation: float = 0.02, cuvette_material: str = 'quartz', reference_type: str = 'air')[source]

Bases: object

Configuration for transmittance measurement mode.

Implements Beer-Lambert law: A = εcl where A is absorbance, ε is molar absorptivity, c is concentration, and l is path length.

Variables:
  • path_length_mm (float) – Optical path length in mm.

  • path_length_variation (float) – Sample-to-sample variation in path length.

  • cuvette_material (str) – Material of sample holder (affects NIR absorption).

  • reference_type (str) – Type of reference measurement.

cuvette_material: str = 'quartz'
path_length_mm: float = 1.0
path_length_variation: float = 0.02
reference_type: str = 'air'
nirs4all.synthesis.measurement_modes.create_atr_simulator(crystal_material: str = 'diamond', incidence_angle: float = 45.0, n_reflections: int = 1, random_state: int | None = None) → MeasurementModeSimulator[source]

Create an ATR mode simulator.

Parameters:
  • crystal_material – ATR crystal material.

  • incidence_angle – Incidence angle in degrees.

  • n_reflections – Number of internal reflections.

  • random_state – Random seed.

Returns:

Configured MeasurementModeSimulator.

nirs4all.synthesis.measurement_modes.create_reflectance_simulator(geometry: str = 'integrating_sphere', particle_size_um: float = 50.0, random_state: int | None = None) → MeasurementModeSimulator[source]

Create a diffuse reflectance mode simulator.

Parameters:
  • geometry – Measurement geometry.

  • particle_size_um – Mean particle size.

  • random_state – Random seed.

Returns:

Configured MeasurementModeSimulator.

nirs4all.synthesis.measurement_modes.create_transmittance_simulator(path_length_mm: float = 1.0, random_state: int | None = None) → MeasurementModeSimulator[source]

Create a transmittance mode simulator.

Parameters:
  • path_length_mm – Optical path length in mm.

  • random_state – Random seed.

Returns:

Configured MeasurementModeSimulator.