optmat.gas.models.base#

The model interface: polarizability against vacuum wavelength, with a valid range.

Classes

Model(gas, name, citation, wavelength_range, ...)

A dispersion model of one gas.

class optmat.gas.models.base.Model(gas, name, citation, wavelength_range, kind, *, status='user', status_reason='', modified=(), base='', intervals=())[source]#

Bases: Identified

A dispersion model of one gas.

Attributes:
gasGas or str

The species: a curated gas, or a custom species’ name (a model a caller built), which has no curated virial ratio or equation of state.

namestr

A unique name, <source>/<formula> for a published formula.

citationstr

Where the model comes from.

wavelength_rangetuple of float

The vacuum-wavelength range over which the source supports the model, m (the upper end may be inf): the envelope of intervals.

kindstr

The model’s provenance: “published” (a formula as printed, corrected where it is misprinted), “legacy” (a recorded implementation formula without a publication of its own), “theory” (an ab initio or semi-empirical calculation) or “fitted” (fitted here). It is not identity.kind, which names the quantity ("gas_refractive").

intervalstuple of tuple of float

The qualified intervals, vacuum wavelength, m: disjoint and ascending, with wavelength_range as their envelope. One interval, the range, unless the source qualifies several.

statusstr

"validated" for the recommended model of its gas, "comparison" for the other curated models, "user" for a model a caller built.

status_reasonstr

Why.

DERIVED: ClassVar[tuple[str, ...]] = ('wavelength_range',)#

Fields derived from the inputs, which an override may not name.

EVALUATES_THROUGH: ClassVar[tuple[str, ...]] = ('optmat.gas.lorentz_lorenz',)#
EVALUATION_VERSION: ClassVar[int] = 1#
IDENTITY_KIND: ClassVar[str] = 'gas_refractive'#
INPUTS: ClassVar[tuple[str, ...]] = ('intervals',)#

The parameters with_parameters() may change.

property absorbing: bool#

Whether the model has an imaginary part (the gas absorbs in its range).

Returns:
bool

False for a transparent model; an absorbing model’s real-part methods warn where the absorption is not negligible.

absorption_warning_threshold: ClassVar[float] = 0.0001#

|Im alpha / Re alpha| above which the real-part methods warn.

citation: str#
complex_polarizability(wavelength, *, warn=True)[source]#

Return the complex per-particle polarizability at vacuum wavelengths.

Parameters:
wavelengtharray_like or float

Vacuum wavelength, m; inf is the static limit.

warnbool, optional

Warn (ModelRangeWarning) when a wavelength lies outside wavelength_range; True by default.

Returns:
numpy.ndarray

Polarizability, C m^2/V (complex, Im alpha > 0 is absorption; zero imaginary part for a transparent model), the shape of wavelength.

Raises:
ArgumentError

If a wavelength is zero or negative.

Warns:
ModelRangeWarning

If warn and any wavelength lies outside the model’s range.

dpolarizability_domega(wavelength, *, warn=True)[source]#

Return the frequency derivative of the complex polarizability.

d alpha / d omega at fixed state, with omega = 2 pi c / lambda: it enters the group index and every frame derivative of a propagation code. Each class gives its own analytic form (OEP 1, section 4.1), computed in omega so that the static limit, where it is 0, needs no chain rule through lambda.

Parameters:
wavelengtharray_like or float

Vacuum wavelength, m; inf is the static limit.

warnbool, optional

Warn (ModelRangeWarning) when a wavelength lies outside every one of intervals; True by default.

Returns:
numpy.ndarray

d alpha / d omega, C m^2 V^-1 s (complex), the shape of wavelength.

Raises:
ArgumentError

If a wavelength is zero or negative.

Warns:
ModelRangeWarning

If warn and any wavelength lies outside the model’s intervals.

Examples

>>> from optmat.gas.models.registry import model
>>> float(model("fit/Ar").dpolarizability_domega(float("inf")).real)
0.0
gas: Gas | str#
intervals: tuple[tuple[float, float], ...] = ()#
kind: str#
name: str#
polarizability(wavelength, *, warn=True)[source]#

Return the real per-particle polarizability at vacuum wavelengths.

Parameters:
wavelengtharray_like or float

Vacuum wavelength, m; inf is the static limit.

warnbool, optional

Warn (ModelRangeWarning) when a wavelength lies outside wavelength_range, and, for an absorbing model, (ModelAbsorptionWarning) where the imaginary part is not negligible; True by default.

Returns:
numpy.ndarray

Polarizability, C m^2/V (the real part), the shape of wavelength.

Raises:
ArgumentError

If a wavelength is zero or negative.

Warns:
ModelRangeWarning

If warn and any wavelength lies outside the model’s range.

ModelAbsorptionWarning

If warn, the model absorbs and |Im alpha / Re alpha| exceeds absorption_warning_threshold at any wavelength.

refractive_index(wavelength, state=State(pressure=101325.0, temperature=273.15), *, ideal=False, warn=True)[source]#

Return the complex refractive index at a state (Lorentz-Lorenz, virial).

Parameters:
wavelengtharray_like or float

Vacuum wavelength, m.

stateState, optional

Pressure and temperature; 0 degrees C and 1 atm by default.

idealbool, optional

Use the ideal-gas density instead of the real-gas one (always, for a species without an equation of state: ozone, a custom species).

warnbool, optional

Warn outside the model’s range (see complex_polarizability()).

Returns:
numpy.ndarray

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

Raises:
ArgumentError

If a wavelength is zero or negative.

refractivity(wavelength, state=State(pressure=101325.0, temperature=273.15), *, ideal=False, warn=True)[source]#

Return n - 1 at a state, through Lorentz-Lorenz and the virial term.

Parameters:
wavelengtharray_like or float

Vacuum wavelength, m.

stateState, optional

Pressure and temperature; 0 degrees C and 1 atm by default.

idealbool, optional

Use the ideal-gas density instead of the real-gas one (always, for a species without an equation of state: ozone, a custom species).

warnbool, optional

Warn outside the model’s range (see polarizability()).

Returns:
numpy.ndarray

n - 1, the shape of wavelength.

Raises:
ArgumentError

If a wavelength is zero or negative.

property refractivity_virial: float[source]#

The refractivity virial ratio B_R / A_R of the gas, resolved once.

Returns:
float

The ratio, m^3/mol; zero where none is curated.

wavelength_range: tuple[float, float]#