optmat.gas.models.registry#

Every dispersion model of a gas, and the recommended one.

Models come from four places: the fits (models.fitted), their compact forms (models.compact, OEP 2), the published formulas of the source records (models.formulas) and the refractiveindex.info comparison entries (comparison). The recommended model of each gas is chosen, with its reason, in data/gas/defaults.toml.

Functions

default_model(gas)

Return the recommended model of a gas.

model(name)

Return a model by name.

models(gas)

Return every model of a gas, by name.

refractive_index(gas, wavelength[, state, ...])

Return the complex refractive index of a gas: the entry point for absorption.

refractivity(gas, wavelength[, state, ...])

Return n - 1 of a gas: the one-call entry point.

optmat.gas.models.registry.default_model(gas)[source]#

Return the recommended model of a gas.

Parameters:
gasGas or str

The species.

Returns:
Model

The model data/gas/defaults.toml names for it.

Raises:
OptmatError

If no model is recommended for the gas (TC-733).

Examples

>>> default_model("He").name
'fit/He'
optmat.gas.models.registry.model(name)[source]#

Return a model by name.

Parameters:
namestr

fit/<gas>, compact/<gas>, <source>/<formula> or refractiveindex.info/<gas>/<entry>.

Returns:
Model

The model.

Raises:
OptmatError

If no model has that name.

optmat.gas.models.registry.models(gas)[source]#

Return every model of a gas, by name.

Parameters:
gasGas or str

The species.

Returns:
dict of str to Model

The fitted models (fit/<gas>), the compact models of the molecules (compact/<gas>), the published formulas (<source>/<formula>) and the refractiveindex.info entries.

Examples

>>> "fit/Ar" in models("Ar")
True
optmat.gas.models.registry.refractive_index(gas, wavelength, state=State(pressure=101325.0, temperature=273.15), *, model_name=None)[source]#

Return the complex refractive index of a gas: the entry point for absorption.

Parameters:
gasGas or str

The species.

wavelengtharray_like or float

Vacuum wavelength, m.

stateState, optional

Pressure and temperature (real-gas density, Lorentz-Lorenz with the virial term); 0 degrees C and 1 atm by default.

model_namestr, optional

A model by name; the recommended one by default.

Returns:
numpy.ndarray

n (complex; Im n > 0 is absorption, zero for a transparent model), the shape of wavelength.

Warns:
ModelRangeWarning

Outside the model’s range.

Examples

>>> n = refractive_index("Ar", 800e-9)
>>> f"{float(n.real - 1) * 1e7:.2f} {float(n.imag):.1f}"
'2796.77 0.0'
optmat.gas.models.registry.refractivity(gas, wavelength, state=State(pressure=101325.0, temperature=273.15), *, model_name=None)[source]#

Return n - 1 of a gas: the one-call entry point.

Parameters:
gasGas or str

The species.

wavelengtharray_like or float

Vacuum wavelength, m.

stateState, optional

Pressure and temperature (real-gas density, Lorentz-Lorenz with the virial term); 0 degrees C and 1 atm by default.

model_namestr, optional

A model by name; the recommended one by default.

Returns:
numpy.ndarray

n - 1, the shape of wavelength.

Warns:
ModelRangeWarning

Outside the model’s range.

Examples

>>> from optmat.conditions import State
>>> f"{float(refractivity('Ar', 800e-9, State(101325.0, 293.15))) * 1e7:.2f}"
'2605.28'