optmat.solid.models.formulas#

Published formulas of solids as models.

A curated source’s [[formulas]] entry for a solid becomes a model when it has a form this module knows; its coefficients are the printed strings, corrected by the entry’s corrections with the evidence for each (as for the gases):

  • n2_sellmeier: n^2 - 1 = A + sum_i B_i lambda^2 / (lambda^2 - C_i), lambda the vacuum wavelength in um, C_i in um^2 (terms A, optional, B, C);

  • n2_sellmeier_wavelength: the same with the poles printed as wavelengths, C_i = L_i^2 (terms B, L, in um);

  • n2_sellmeier_temperature: n^2 - 1 = sum_i S_i(T) lambda^2 / (lambda^2 - lambda_i(T)^2), with S_i(T) = sum_j S_ij T^j and lambda_i(T) = sum_j lambda_ij T^j (terms S1, S2, … and L1, L2, …, lambda in um, T in K), as Leviton & Frey fit fused silica; the model is evaluated at the entry’s reference_temperature_k, and FormulaModel.at_temperature() gives it at another temperature within temperature_range_k;

  • udm: Franta et al.’s universal dispersion model (optmat.solid.udm), with the values of its newAD2 parameter file as the terms: attributes (the file’s first line, he:ex=10:ut:ph=52) and each parameter in newAD2’s names and units.

A formula whose variable is the wavelength in standard air says so with wavelength_medium = "standard_air"; the model converts. A formula whose index is relative to the room air of the measurement, as minimum-deviation refractometry in air gives it, says so with index_medium = "air" and the air’s air_temperature_k and air_pressure_pa (101 325 Pa when the source states none); the model multiplies by the index of that air (Edlen’s dry air, optmat.conditions.air_refractivity()) to give the absolute index (TC-398). A formula whose index is relative to nitrogen, as Daimon & Masumura measure CaF2, says so with index_medium = "nitrogen" and nitrogen_temperature_k and nitrogen_pressure_pa; the model multiplies by the index of that nitrogen from optmat’s recommended N2 model at the ideal-gas density (TC-545). A Sellmeier formula is transparent (real epsilon) and meaningless near its poles; its range is the one its source states.

Module Attributes

FORMS

The formula forms solids use.

Functions

published_model(name)

Return one solid formula model, reading only its source's record.

published_models()

Return every solid formula model defined in the source records, by name.

Classes

FormulaModel(material, name, citation, ...)

A published Sellmeier formula of a solid.

UdmModel(material, name, citation, ...[, ...])

Franta et al.'s universal dispersion model of a solid, as a model.

optmat.solid.models.formulas.FORMS = frozenset({'n2_sellmeier', 'n2_sellmeier_temperature', 'n2_sellmeier_wavelength', 'udm'})#

The formula forms solids use.

class optmat.solid.models.formulas.FormulaModel(material, name, citation, wavelength_range, kind, axis='', form='', terms=<factory>, wavelength_medium='vacuum', air=None, reference_gas='air', temperature=None, temperature_range=None, *, status='user', status_reason='', modified=(), base='', intervals=())[source]#

Bases: Model

A published Sellmeier formula of a solid.

Attributes:
formstr

n2_sellmeier, n2_sellmeier_wavelength or n2_sellmeier_temperature.

termsdict of str to tuple of float

The coefficients, after corrections.

wavelength_mediumstr

vacuum, or standard_air for a formula whose variable is the wavelength in standard air (converted with Edlen’s formula).

airState or None

The state of the gas the formula’s index is relative to (room air, or nitrogen), or None for an absolute index.

reference_gasstr

air or nitrogen: the gas air is the state of.

temperaturefloat or None

The sample temperature in K of an n2_sellmeier_temperature formula.

temperature_rangetuple of float or None

The temperatures in K its source supports.

EVALUATES_THROUGH: ClassVar[tuple[str, ...]] = ('optmat.conditions',)#
EVALUATION_VERSION: ClassVar[int] = 2#
INPUTS: ClassVar[tuple[str, ...]] = ('intervals', 'terms')#

The parameters with_parameters() may change.

air: State | None = None#
at_temperature(temperature)[source]#

Return the model at another sample temperature.

Parameters:
temperaturefloat

The sample temperature, K, within the source’s temperature_range.

Returns:
FormulaModel

The same formula evaluated at temperature (typed as its base, for the runtime type checker).

Raises:
DataError

If the formula has no temperature dependence.

Warns:
ModelRangeWarning

If temperature is outside the range its source supports.

form: str = ''#
reference_gas: str = 'air'#
property reference_model: object[source]#

The gas model of a formula relative to nitrogen, bound once.

A solid formula relative to nitrogen needs the gas subpackage only when it is evaluated, or its identity asked for.

Returns:
optmat.gas.models.base.Model or None

The recommended model of N2, or None for a formula relative to air or absolute.

classmethod sellmeier(material, coefficients, wavelength_range, *, reference_medium='vacuum', citation='', name='')[source]#

Return a Sellmeier formula from its coefficients.

n^2 = 1 + A + sum_i B_i lambda^2 / (lambda^2 - C_i), lambda the vacuum wavelength in um and C_i in um^2.

Parameters:
materialstr

The material, the identity’s (a curated id or a caller’s name).

coefficientsMapping

B and C (equal lengths), and optionally A.

wavelength_rangetuple of float

The vacuum wavelengths the formula holds over, m.

reference_mediumstr or State, optional

"vacuum" for an absolute index, or the state of the room air the index is relative to.

citationstr, optional

Where the coefficients come from.

namestr, optional

The model’s name; user/<material> by default.

Returns:
FormulaModel

The model, status user.

Raises:
ValueError

If B and C differ in length or a term is missing.

Examples

>>> silica = FormulaModel.sellmeier(
...     "SiO2", {"B": (0.6961663, 0.4079426, 0.8974794),
...              "C": (0.0684043**2, 0.1162414**2, 9.896161**2)},
...     (210e-9, 3.71e-6), citation="Malitson (1965)")
>>> f"{float(silica.refractive_index(1e-6).real):.5f}"
'1.45042'
temperature: float | None = None#
temperature_range: tuple[float, float] | None = None#
terms: Mapping[str, tuple[float, ...]]#
wavelength_medium: str = 'vacuum'#
class optmat.solid.models.formulas.UdmModel(material, name, citation, wavelength_range, kind, axis='', udm=None, *, status='user', status_reason='', modified=(), base='', intervals=())[source]#

Bases: Model

Franta et al.’s universal dispersion model of a solid, as a model.

Attributes:
udmUniversalDispersionModel

The dielectric function in photon energy.

EVALUATION_VERSION: ClassVar[int] = 1#
udm: UniversalDispersionModel | None = None#
optmat.solid.models.formulas.published_model(name)[source]#

Return one solid formula model, reading only its source’s record.

published_models() reads every record with formulas, which takes seconds; a lookup by name needs one.

Parameters:
namestr

<source>/<formula>.

Returns:
Model

The model, the same as published_models() holds under that name.

Raises:
KeyError

If no solid formula has that name.

Examples

>>> published_model("malitson_1965/sellmeier").material
'SiO2'
optmat.solid.models.formulas.published_models()[source]#

Return every solid formula model defined in the source records, by name.

Returns:
dict of str to Model

The models, named <source>/<formula>.