rustmatrix.refractive#

Refractive-index helpers.

Direct port of pytmatrix.refractive. Provides:

rustmatrix.refractive.mg_refractive(m, mix)[source]#

Maxwell-Garnett effective-medium refractive index.

Parameters:
  • m (tuple of complex) – Complex refractive indices of the constituent media.

  • mix (tuple of float) – Volume fractions, len(mix) == len(m). Renormalised to sum(mix) == 1 if needed.

Returns:

Effective complex refractive index of the mixture.

Return type:

complex

Notes

For two components, the first element is the matrix and the second is the inclusion — the approximation is asymmetric. For more components the media are mixed recursively from the tail inward.

Examples

Dry snow as ice inclusions in air (10 %% ice by volume):

>>> mg_refractive((complex(1.0, 0.0), complex(1.78, 3e-4)), (0.9, 0.1))
rustmatrix.refractive.bruggeman_refractive(m, mix)[source]#

Bruggeman effective-medium refractive index (two components only).

Symmetric counterpart to mg_refractive(). Takes the same arguments but both media are treated equally.

rustmatrix.refractive.ice_refractive(file)[source]#

Build a callable interpolator for ice/snow refractive index.

Parameters:

file (str) – Path to a refractive-index lookup table with columns (wavelength [μm], real, imag). The bundled ice_refr.dat file comes from the Warren & Brandt (2008) optical-constants compilation hosted at http://www.atmos.washington.edu/ice_optical_constants/ .

Returns:

refref(wl, snow_density) where wl is in mm and snow_density is in g/cm³. Internally applies Maxwell-Garnett to mix the ice refractive index with air at the given density. Handles scalar or array-like wl.

Return type:

callable

Notes

The module-level mi instance is a pre-built interpolator using the bundled data file — use that directly in most cases:

>>> from rustmatrix.refractive import mi
>>> from rustmatrix.tmatrix_aux import wl_W
>>> mi(wl_W, 0.9)   # ice at 0.9 g/cm³ at W-band