optmat.gas.mixture#

The refractive index of a gas mixture at finite density (OEP 4, sections 4.1, 4.3).

In the low-density cluster expansion the Lorentz-Lorenz function of a mixture is

\[y = \frac{n^2 - 1}{n^2 + 2} = \sum_s A_s \rho_s + \sum_{s,t} B_{st}\,\rho_s \rho_t, \qquad A_s = \frac{N_A \alpha_s}{3\varepsilon_0},\]

with \(\rho_s = N_s/N_A\) the molar densities and \(B_{ss}\) each gas’s own refractivity virial coefficient, so that one species is optmat’s pure law exactly. The whole mixture’s \(y\) is inverted once, \(\chi = 3y/(1-y)\).

  • Like terms disperse with their gas, \(B_{ss} = b_s A_s\), as in the pure models. O2’s is a published estimate, provisional with its 50 % uncertainty. A gas whose \(B_R\) optmat has not curated (D2, N2O, CO, O3) is unknown: it enters with \(b = 0\) and the declared scale \(|b| \le 2.5\) cm^3/mol.

  • Unlike terms are not curated for any pair. Each is estimated as the mean of its like terms, \(B_{st} = \tfrac12(B_{ss} + B_{tt})\), each like term with its own \(A\), with standard uncertainty \(\max(|B_{ss}|, |B_{tt}|)\), taking an unknown like term at its scale. The status is estimate, or unknown where a like term is unknown (section 7.2).

  • The uncertainty of the estimated and unknown terms is combined linearly, as fully correlated (MixtureOptics.refractivity_uncertainty()).

The optical domain (MixtureOptics.density_bound()) is the lower of two densities. One is where the neglected third term reaches 1e-3 of \(y\), from the largest constituent \(|C_R/A_R|\): measured, a measured bound, or the declared scale \(600 B_R^2/A_R\). The other is where the estimated and unknown terms’ uncertainty reaches 1e-3 of \(y\). Beyond the bound the optics warn. In wavelength, a mixture holds on the intersection of its constituents’ qualified intervals.

Functions

mixture_optics(species)

Return the optics of a mixture of gases (OEP 4).

Classes

MixtureOptics(species, models, pairs, ...[, ...])

The optics of a gas mixture at finite density (OEP 4).

PairTerm(species, partner, b, sigma, status, ...)

One pair's refractivity virial term, like or unlike (OEP 4, section 6).

class optmat.gas.mixture.MixtureOptics(species, models, pairs, intervals, *, status='user', status_reason='', modified=(), base='')[source]#

Bases: Identified

The optics of a gas mixture at finite density (OEP 4).

Attributes:
speciestuple of str

The species, sorted.

modelstuple of Model

Each species’ recommended dispersion model, in the same order.

pairstuple of PairTerm

Every like and unlike pair, like terms first.

intervalstuple of tuple of float

The intersection of the models’ qualified intervals, m.

statusstr

provisional where any like term is unknown or provisional, else validated.

EVALUATES_THROUGH: ClassVar[tuple[str, ...]] = ()#
EVALUATION_VERSION: ClassVar[int] = 1#
IDENTITY_KIND: ClassVar[str] = 'gas_refractive_mixture'#
density_bound(composition)[source]#

Return the optical domain’s bound on the total number density.

The lower of the density at which the third term reaches 1e-3 of y (the largest |C_R/A_R| of the species present) and that at which the estimated and unknown terms’ uncertainty does, the smallest over the qualified intervals (section 4.3).

Parameters:
compositionMapping

Species to mole fraction, summing to one; a species left out is absent.

Returns:
float

The bound, m^-3; inf where nothing bounds it.

Raises:
OptmatError

For a species not in the mixture, a negative fraction, or fractions that do not sum to one.

Examples

>>> f"{mixture_optics(['Ar']).density_bound({'Ar': 1.0}) / 6.02214076e23:.0f}"
'6961'
dsusceptibility_ddensity(wavelength, densities)[source]#

Return d chi / d N_s for every species.

Parameters:
wavelengtharray_like or float

Vacuum wavelength, m.

densitiesMapping

Each species’ number density, m^-3.

Returns:
dict

Species to the derivative with respect to its number density, m^3.

Warns:
ModelRangeWarning

Outside the constituents’ common intervals or the optical domain.

dsusceptibility_domega(wavelength, densities)[source]#

Return d chi / d omega of the mixture.

Parameters:
wavelengtharray_like or float

Vacuum wavelength, m.

densitiesMapping

Each species’ number density, m^-3.

Returns:
numpy.ndarray

The derivative, s.

Warns:
ModelRangeWarning

Outside the constituents’ common intervals or the optical domain.

intervals: tuple[tuple[float, float], ...]#
models: tuple[Model, ...]#
pairs: tuple[PairTerm, ...]#
refractivity(wavelength, densities)[source]#

Return n - 1 of the mixture, in the real-polarizability convention.

For one species it is the pure model’s refractivity at that density.

Parameters:
wavelengtharray_like or float

Vacuum wavelength, m; broadcast with the densities.

densitiesMapping

Each species’ number density, m^-3.

Returns:
numpy.ndarray

n - 1 = chi / (1 + sqrt(1 + chi)).

Warns:
ModelRangeWarning

Outside the constituents’ common intervals or the optical domain.

ModelAbsorptionWarning

Where a constituent absorbs, as its model’s polarizability does.

Examples

>>> he_ar = mixture_optics(["He", "Ar"])
>>> n = 1.25e25  # m^-3 each: about 1 bar together at 294 K
>>> f"{float(he_ar.refractivity(800e-9, {'He': n, 'Ar': n})):.5e}"
'1.46154e-04'
refractivity_uncertainty(wavelength, densities)[source]#

Return the estimated and unknown terms’ effect on n - 1.

Their uncertainties are combined linearly, as fully correlated (section 7.2): a sensitivity, not a statistical uncertainty.

Parameters:
wavelengtharray_like or float

Vacuum wavelength, m.

densitiesMapping

Each species’ number density, m^-3.

Returns:
numpy.ndarray

The change in n - 1 they span.

Warns:
ModelRangeWarning

Outside the constituents’ common intervals or the optical domain.

species: tuple[str, ...]#
susceptibility(wavelength, densities)[source]#

Return the complex susceptibility chi = n^2 - 1 of the mixture.

For one species, sqrt(1 + chi) is the pure model’s refractive_index.

Parameters:
wavelengtharray_like or float

Vacuum wavelength, m; broadcast with the densities.

densitiesMapping

Each species’ number density, m^-3.

Returns:
numpy.ndarray

chi, from each constituent’s complex polarizability.

Warns:
ModelRangeWarning

Outside the constituents’ common intervals or the optical domain.

class optmat.gas.mixture.PairTerm(species, partner, b, sigma, status, source, reason, frequency, temperature, contribution)[source]#

Bases: object

One pair’s refractivity virial term, like or unlike (OEP 4, section 6).

Attributes:
species, partnerstr

The pair, in sorted order; the same species twice for a like term.

bfloat

B_st / mean(A_s, A_t), m^3/mol: a like term’s curated ratio, or 0 for an unknown one. NaN for an unlike pair, whose rule is named in source.

sigmafloat

The standard uncertainty of b, m^3/mol: the curated one, or the declared scale for an unknown like term. NaN for an unlike pair (see reason).

statusstr

curated (a like term optmat curates), estimate (the mean rule) or unknown (a like term optmat has not curated, and its pairs); a like term that is a published estimate is provisional.

sourcestr

The curated dataset, or rule: mean.

reasonstr

Why the term is what it is.

frequencystr

static or the source’s vacuum wavelength, nm; empty where there is none.

temperaturefloat

The source’s temperature, K; NaN where there is none.

contributionstr

induced, or total for a static value that includes orientation.

b: float#
contribution: str#
frequency: str#
partner: str#
reason: str#
sigma: float#
source: str#
species: str#
status: str#
temperature: float#
optmat.gas.mixture.mixture_optics(species)[source]#

Return the optics of a mixture of gases (OEP 4).

Parameters:
speciessequence of Gas or str

The mixture’s species, each once.

Returns:
MixtureOptics

With each species’ recommended dispersion model; one object per set of species, whatever their order.

Raises:
OptmatError

If the list is empty or a species repeats.

Examples

>>> optics = mixture_optics(["Ar", "He"])
>>> optics.species, [p.status for p in optics.pairs]
(('Ar', 'He'), ['curated', 'curated', 'estimate'])