lsurf.materials.HomogeneousMaterial

class lsurf.materials.HomogeneousMaterial(name, refractive_index, absorption_coef=0.0, scattering_coef=0.0, anisotropy=0.0, propagator=None)[source]

Homogeneous material with constant optical properties.

Properties are uniform throughout space but can depend on wavelength. Supports analytic dispersion models (Sellmeier, Cauchy) or custom functions.

Parameters:
  • name (str) – Descriptive name for this material.

  • refractive_index (float or callable) – Refractive index value or function f(wavelength) -> n. If float, uses constant n for all wavelengths. If callable, wavelength is in meters.

  • absorption_coef (float, optional) – Absorption coefficient α in m⁻¹. Default is 0.

  • scattering_coef (float, optional) – Scattering coefficient μ_s in m⁻¹. Default is 0.

  • anisotropy (float, optional) – Henyey-Greenstein anisotropy factor g ∈ [-1, 1]. Default is 0.

refractive_index

Refractive index specification.

Type:

float or callable

absorption_coef

Absorption coefficient in m⁻¹.

Type:

float

scattering_coef

Scattering coefficient in m⁻¹.

Type:

float

anisotropy

Scattering anisotropy factor.

Type:

float

Examples

>>> # Constant refractive index
>>> glass = HomogeneousMaterial("Glass", 1.5)
>>> # Wavelength-dependent (Cauchy dispersion)
>>> def cauchy_n(wavelength):
...     wl_um = wavelength * 1e6
...     return 1.5 + 0.01 / wl_um**2
>>> glass = HomogeneousMaterial("Glass", cauchy_n)
>>> # With absorption (colored glass)
>>> colored_glass = HomogeneousMaterial(
...     "Red Glass", 1.52, absorption_coef=0.1
... )

Notes

For homogeneous materials: - Rays propagate in straight lines (no gradient-driven bending) - Reflection/refraction occurs only at interfaces - Beer-Lambert absorption: I(d) = I₀ exp(-αd) - No GPU kernels are needed (straight-line propagation)

__init__(name, refractive_index, absorption_coef=0.0, scattering_coef=0.0, anisotropy=0.0, propagator=None)[source]

Initialize homogeneous material.

Parameters:
  • name (str) – Descriptive name for this material.

  • refractive_index (float or callable) – Refractive index value or function f(wavelength) -> n.

  • absorption_coef (float, optional) – Absorption coefficient α in m⁻¹. Default is 0.

  • scattering_coef (float, optional) – Scattering coefficient μ_s in m⁻¹. Default is 0.

  • anisotropy (float, optional) – Henyey-Greenstein anisotropy factor g ∈ [-1, 1]. Default is 0.

  • propagator (PropagatorID, optional) – Override the default propagator. Only CPU_GRADIENT is supported.

Raises:

ValueError – If anisotropy is outside [-1, 1].

Methods

__init__(name, refractive_index[, ...])

Initialize homogeneous material.

compute_phase_velocity(x, y, z, wavelength)

Compute phase velocity v_p = c/n at position.

default_kernel()

Return the default propagation kernel for this material type.

default_propagator()

Return the default propagator for this material type.

get_absorption_coefficient(x, y, z, wavelength)

Get absorption coefficient (constant for homogeneous).

get_anisotropy_factor(x, y, z, wavelength)

Get scattering anisotropy factor (constant for homogeneous).

get_extinction_coefficient(x, y, z, wavelength)

Get total extinction coefficient (absorption + scattering).

get_refractive_index(x, y, z, wavelength)

Get refractive index (position-independent, wavelength-dependent).

get_refractive_index_gradient(x, y, z, ...)

Get refractive index gradient (always zero for homogeneous).

get_refractive_index_gradient_magnitude(x, ...)

Get magnitude of refractive index gradient |∇n|.

get_scattering_coefficient(x, y, z, wavelength)

Get scattering coefficient (constant for homogeneous).

is_homogeneous()

Check if material has uniform properties (no spatial variation).

supported_kernels()

Return list of propagation kernels supported by this material type.

supported_propagators()

Return list of propagators supported by this material type.

Attributes

kernel_id

Return the kernel ID configured for this material instance.

propagator_id

Return the propagator ID configured for this material instance.

__init__(name, refractive_index, absorption_coef=0.0, scattering_coef=0.0, anisotropy=0.0, propagator=None)[source]

Initialize homogeneous material.

Parameters:
  • name (str) – Descriptive name for this material.

  • refractive_index (float or callable) – Refractive index value or function f(wavelength) -> n.

  • absorption_coef (float, optional) – Absorption coefficient α in m⁻¹. Default is 0.

  • scattering_coef (float, optional) – Scattering coefficient μ_s in m⁻¹. Default is 0.

  • anisotropy (float, optional) – Henyey-Greenstein anisotropy factor g ∈ [-1, 1]. Default is 0.

  • propagator (PropagatorID, optional) – Override the default propagator. Only CPU_GRADIENT is supported.

Raises:

ValueError – If anisotropy is outside [-1, 1].

get_refractive_index(x, y, z, wavelength)[source]

Get refractive index (position-independent, wavelength-dependent).

Parameters:
  • x (float or ndarray) – Position coordinates in meters (ignored for homogeneous).

  • y (float or ndarray) – Position coordinates in meters (ignored for homogeneous).

  • z (float or ndarray) – Position coordinates in meters (ignored for homogeneous).

  • wavelength (float or ndarray) – Wavelength in meters.

Returns:

n – Refractive index.

Return type:

float or ndarray

get_refractive_index_gradient(x, y, z, wavelength)[source]

Get refractive index gradient (always zero for homogeneous).

Parameters:
  • x (float or ndarray) – Position coordinates in meters.

  • y (float or ndarray) – Position coordinates in meters.

  • z (float or ndarray) – Position coordinates in meters.

  • wavelength (float or ndarray) – Wavelength in meters (unused).

Returns:

grad_n – (0, 0, 0) since ∇n = 0 for homogeneous materials.

Return type:

tuple of (float or ndarray)

get_absorption_coefficient(x, y, z, wavelength)[source]

Get absorption coefficient (constant for homogeneous).

Parameters:
  • x (float or ndarray) – Position coordinates in meters (ignored).

  • y (float or ndarray) – Position coordinates in meters (ignored).

  • z (float or ndarray) – Position coordinates in meters (ignored).

  • wavelength (float or ndarray) – Wavelength in meters (currently ignored, could extend).

Returns:

alpha – Absorption coefficient in m⁻¹.

Return type:

float or ndarray

get_scattering_coefficient(x, y, z, wavelength)[source]

Get scattering coefficient (constant for homogeneous).

Parameters:
  • x (float or ndarray) – Position coordinates in meters (ignored).

  • y (float or ndarray) – Position coordinates in meters (ignored).

  • z (float or ndarray) – Position coordinates in meters (ignored).

  • wavelength (float or ndarray) – Wavelength in meters (currently ignored, could extend).

Returns:

mu_s – Scattering coefficient in m⁻¹.

Return type:

float or ndarray

get_anisotropy_factor(x, y, z, wavelength)[source]

Get scattering anisotropy factor (constant for homogeneous).

Parameters:
  • x (float or ndarray) – Position coordinates in meters (ignored).

  • y (float or ndarray) – Position coordinates in meters (ignored).

  • z (float or ndarray) – Position coordinates in meters (ignored).

  • wavelength (float or ndarray) – Wavelength in meters (ignored).

Returns:

g – Anisotropy factor.

Return type:

float or ndarray

__repr__()[source]

Return string representation with key properties.