optmat.gas.virial#

The refractivity virial coefficient of each gas, from the curated data.

The refractivity of a real gas departs from Lorentz-Lorenz through the pair term of the virial expansion, (n^2 - 1)/(n^2 + 2) = A_R rho + B_R rho^2 + ...: a relative correction B_R rho / A_R of order 1e-6 (helium) to 1e-4 (SF6) at 1 atm, and of order 1e-3 to 1e-2 at the tens of bar of gas-filled fibres. Which measured B_R each gas uses is chosen in data/gas/refractivity_virial.toml, which points at curated datasets; the values themselves come from those datasets.

Module Attributes

VIRIAL_FILE

The per-gas choice of refractivity virial coefficient.

Functions

like_term(gas)

Return a gas's pair term with its uncertainty, or its declared scale.

pair_rules()

Return the rules for the unlike pairs of a mixture (OEP 4, section 7.2).

third_term(gas)

Return the bound on a gas's third refractivity virial term (OEP 4, 4.3).

virial_ratio(gas)

Return B_R / A_R for a gas, m^3/mol (0 where none is curated).

virial_sources()

Return, per gas, the dataset keys of its B_R and A_R.

Classes

LikeTerm(gas, b, sigma, status, source, ...)

A gas's own pair term, B_R = b A_R, as a mixture takes it.

ThirdTerm(gas, ratio, status, source)

The bound on a gas's third refractivity virial term, for the optical domain.

class optmat.gas.virial.LikeTerm(gas, b, sigma, status, source, temperature, frequency, contribution)[source]#

Bases: object

A gas’s own pair term, B_R = b A_R, as a mixture takes it.

Attributes:
gasstr

The species.

bfloat

B_R / A_R, m^3/mol; 0 for an uncurated term.

sigmafloat

Its standard uncertainty, m^3/mol; for an uncurated term the declared scale.

statusstr

curated, provisional (a published estimate, with its stated uncertainty: O2’s, egan_2026) or unknown.

sourcestr

The B_R dataset or formula, or empty.

temperaturefloat

The temperature it was measured at, K; NaN where there is none.

frequencystr

static, or the vacuum wavelength in nm.

contributionstr

induced: an optical value, or a static one whose induced part is stated.

b: float#
contribution: str#
frequency: str#
gas: str#
sigma: float#
source: str#
status: str#
temperature: float#
class optmat.gas.virial.ThirdTerm(gas, ratio, status, source)[source]#

Bases: object

The bound on a gas’s third refractivity virial term, for the optical domain.

Attributes:
gasstr

The species.

ratiofloat

|C_R| / A_R, m^6/mol^2; NaN for a gas with neither B_R nor C_R, which has no third-term bound (OEP 4, section 4.3).

statusstr

measured (a curated C_R), bound (a measured bound), scale (the declared third_ratio B_R^2 / A_R) or none.

sourcestr

The C_R dataset, or what gives the bound.

gas: str#
ratio: float#
source: str#
status: str#
optmat.gas.virial.VIRIAL_FILE: Final = PosixPath('/home/docs/checkouts/optmat/checkouts/7/src/optmat/data/gas/refractivity_virial.toml')#

The per-gas choice of refractivity virial coefficient.

optmat.gas.virial.like_term(gas)[source]#

Return a gas’s pair term with its uncertainty, or its declared scale.

Parameters:
gasGas or str

The species.

Returns:
LikeTerm

The curated b of virial_ratio(), or unknown with b = 0 and pair_rules()’ unknown_b as its scale.

Raises:
DataError

If a static B_R does not state that it is induced.

Examples

>>> like_term("D2").status
'unknown'
>>> like_term("O2").status
'provisional'
>>> f"{like_term('Ar').b * 1e6:.3f}"
'0.419'
optmat.gas.virial.pair_rules()[source]#

Return the rules for the unlike pairs of a mixture (OEP 4, section 7.2).

Returns:
Mapping

rule ("mean"), reason, uncertainty, unknown_b (cm^3/mol), third_ratio and density_fraction.

optmat.gas.virial.third_term(gas)[source]#

Return the bound on a gas’s third refractivity virial term (OEP 4, 4.3).

Parameters:
gasGas or str

The species.

Returns:
ThirdTerm

From its measured C_R, a measured bound, the declared scale on its B_R, or none.

Examples

>>> term = third_term("Ar")
>>> term.status, f"{term.ratio * 1e12:.2f}"
('measured', '20.64')
optmat.gas.virial.virial_ratio(gas)[source]#

Return B_R / A_R for a gas, m^3/mol (0 where none is curated).

Parameters:
gasGas or str

The species.

Returns:
float

The ratio the Lorentz-Lorenz functions take as virial.

Examples

>>> f"{virial_ratio('Ar') * 1e6:.3f}"
'0.419'
>>> virial_ratio("D2")
0.0
optmat.gas.virial.virial_sources()[source]#

Return, per gas, the dataset keys of its B_R and A_R.

Returns:
dict of Gas to tuple of str

(B_R key, A_R key) for every gas with a pair term.

Raises:
DataError

If an entry names a dataset that does not exist.