optmat.gas.comparison#

The refractiveindex.info database, as a comparison source only.

A pinned snapshot of the database’s gas entries (CC0; see data/external/refractiveindex_info/PROVENANCE.md) is converted to data/external/refractiveindex_info.json by tools/convert_refractiveindex_info.py. This module reads that file. Its formula entries become models (kind “comparison”), so the gallery can compare them with the curated data and the fits; its tabulated entries are returned as arrays. Nothing here enters a fit: every value the database takes from a paper is curated from the paper itself.

The formula types used by the gas entries, from the database’s documentation (lambda in um): type 2, n^2 - 1 = C1 + sum C_{2i} lambda^2 / (lambda^2 - C_{2i+1}); type 5, n = C1 + sum C_{2i} lambda^{C_{2i+1}}; type 6, n - 1 = C1 + sum C_{2i} / (C_{2i+1} - lambda^-2).

Module Attributes

COMMIT

The refractiveindex.info-database commit the snapshot was taken from.

Functions

database_models()

Return the snapshot's formula entries as models, by name.

tabulated_entries()

Return the snapshot's tabulated entries.

Classes

DatabaseModel(gas, name, citation, ...[, ...])

A refractiveindex.info formula entry as a polarizability model.

TabulatedEntry(gas, name, references, state, ...)

A refractiveindex.info tabulated entry.

optmat.gas.comparison.COMMIT: Final = 'c5c2f188e848453def5970e347399d653df2ffc2'#

The refractiveindex.info-database commit the snapshot was taken from.

class optmat.gas.comparison.DatabaseModel(gas, name, citation, wavelength_range, kind, formula_type='', coefficients=(), state=State(pressure=101325.0, temperature=273.15), *, status='user', status_reason='', modified=(), base='', intervals=())[source]#

Bases: Model

A refractiveindex.info formula entry as a polarizability model.

Attributes:
formula_typestr

“formula 2”, “formula 5” or “formula 6”.

coefficientstuple of float

C1, C2, ... as stored.

stateState

The entry’s stated conditions (0 degrees C and 1 atm where it states none).

Its overrides are the coefficients and the intervals.
EVALUATION_VERSION: ClassVar[int] = 1#
INPUTS: ClassVar[tuple[str, ...]] = ('coefficients', 'intervals')#

The parameters with_parameters() may change.

coefficients: tuple[float, ...] = ()#
formula_type: str = ''#
property reference_density: float[source]#

The number density of the entry’s stated conditions, resolved once.

Returns:
float

The density, m^-3.

state: State = State(pressure=101325.0, temperature=273.15)#
class optmat.gas.comparison.TabulatedEntry(gas, name, references, state, wavelength, refractive_index)[source]#

Bases: object

A refractiveindex.info tabulated entry.

Attributes:
gasGas

The species.

namestr

refractiveindex.info/<gas>/<entry>.

referencesstr

The entry’s references, as stored (HTML).

stateState

The entry’s stated conditions (0 degrees C and 1 atm where it states none).

wavelengthnumpy.ndarray

Wavelengths, m (the database’s wavelengths are vacuum wavelengths).

refractive_indexnumpy.ndarray

n.

gas: Gas#
name: str#
references: str#
refractive_index: Float[ndarray, 'n']#
state: State#
wavelength: Float[ndarray, 'n']#
optmat.gas.comparison.database_models()[source]#

Return the snapshot’s formula entries as models, by name.

Returns:
dict of str to DatabaseModel

Models named refractiveindex.info/<gas>/<entry>.

Examples

>>> model = database_models()["refractiveindex.info/Ar/Bideau-Mehu"]
>>> f"{float(model.refractivity(253.7e-9)) * 1e6:.1f}"
'303.2'
optmat.gas.comparison.tabulated_entries()[source]#

Return the snapshot’s tabulated entries.

Returns:
tuple of TabulatedEntry

The entries, each with its wavelengths and refractive indices.

Examples

>>> {entry.gas.value for entry in tabulated_entries()} >= {"H2", "Kr"}
True