optmat.gas.models.base#
The model interface: polarizability against vacuum wavelength, with a valid range.
Classes
|
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:
IdentifiedA 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 ofintervals.- 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_rangeas 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.
- 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.
- complex_polarizability(wavelength, *, warn=True)[source]#
Return the complex per-particle polarizability at vacuum wavelengths.
- Parameters:
- wavelengtharray_like or float
Vacuum wavelength, m;
infis the static limit.- warnbool, optional
Warn (
ModelRangeWarning) when a wavelength lies outsidewavelength_range; True by default.
- Returns:
- numpy.ndarray
Polarizability, C m^2/V (complex,
Im alpha > 0is absorption; zero imaginary part for a transparent model), the shape ofwavelength.
- Raises:
- ArgumentError
If a wavelength is zero or negative.
- Warns:
- ModelRangeWarning
If
warnand 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 omegaat fixed state, withomega = 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 inomegaso that the static limit, where it is 0, needs no chain rule throughlambda.- Parameters:
- wavelengtharray_like or float
Vacuum wavelength, m;
infis the static limit.- warnbool, optional
Warn (
ModelRangeWarning) when a wavelength lies outside every one ofintervals; True by default.
- Returns:
- numpy.ndarray
d alpha / d omega, C m^2 V^-1 s (complex), the shape ofwavelength.
- Raises:
- ArgumentError
If a wavelength is zero or negative.
- Warns:
- ModelRangeWarning
If
warnand 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
- polarizability(wavelength, *, warn=True)[source]#
Return the real per-particle polarizability at vacuum wavelengths.
- Parameters:
- wavelengtharray_like or float
Vacuum wavelength, m;
infis the static limit.- warnbool, optional
Warn (
ModelRangeWarning) when a wavelength lies outsidewavelength_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
warnand any wavelength lies outside the model’s range.- ModelAbsorptionWarning
If
warn, the model absorbs and|Im alpha / Re alpha|exceedsabsorption_warning_thresholdat 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 > 0is absorption, zero for a transparent model), the shape ofwavelength.
- 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 - 1at 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 ofwavelength.
- Raises:
- ArgumentError
If a wavelength is zero or negative.