optmat.gas.models.fitted#
The models fitted here, loaded from data/gas/models/fitted/<name>.json.
Each file is written by tools/fit/run.py from a fit configuration
(data/gas/fits/<name>.toml) and records the model’s terms, their covariance, the
fitted dataset scales, the chi-squared per dataset and the configuration’s SHA-256.
Functions
|
Return one stored fitted model, reading only its record. |
Return every stored fitted model, by name. |
Classes
|
An oscillator model fitted here, with its covariance and statistics. |
|
A measured temperature coefficient of a gas polarizability (OEP 1, section 4.9). |
- class optmat.gas.models.fitted.FittedModel(gas, name, citation, wavelength_range, kind, strengths=(), energies=(), labels=(), offset_au=0.0, retardation_au=0.0, absorption=None, n_lines=0, n_fixed=0, covariance=<factory>, reduced_chi2=0.0, record=<factory>, *, status='user', status_reason='', modified=(), base='', intervals=())[source]#
Bases:
OscillatorModelAn oscillator model fitted here, with its covariance and statistics.
Its overrides add two inputs to the oscillator model’s:
infrared, a pair of sequences (strengths, energies in hartree) that replaces the fixed infrared terms whole, andinfrared_scale, a factor on their strengths. The term counts are fixed otherwise. An override drops the covariance and the chi-squared (NaN): the fit’s uncertainty does not carry over.- Attributes:
- n_linesint
How many leading terms are resonance lines at fixed energies.
- n_fixedint
How many trailing terms are fixed (the infrared bands), outside the covariance.
- covariancenumpy.ndarray
Covariance of the strengths and of the effective terms’ energies.
- reduced_chi2float
Chi-squared per degree of freedom of the fit.
- recorddict
The stored record, for reports.
- DERIVED: ClassVar[tuple[str, ...]] = ('wavelength_range', 'covariance', 'n_fixed', 'n_lines', 'reduced_chi2')#
Fields derived from the inputs, which an override may not name.
- INPUTS: ClassVar[tuple[str, ...]] = ('energies', 'intervals', 'labels', 'offset_au', 'retardation_au', 'strengths', 'infrared', 'infrared_scale')#
The parameters
with_parameters()may change.
- covariance: Float[ndarray, 'q q']#
- property derived_sha256: str#
The SHA-256 of the derived tables the fit read, or empty (OEP 3).
- Returns:
- str
optmat.gas.infrared.derived_digest()when the fit was made.
- dispersion_sigma_au(omega, order, *, birge=True)[source]#
Return the absolute one-sigma uncertainty of a dispersion derivative.
sqrt(g^T Sigma g), withgthe gradient ofd^k (omega alpha) / d omega^k(dispersion_au()) with respect to the fitted parameters andSigmatheir covariance. It stays finite where the derivative crosses zero (OEP 2, section 4). The fixed terms carry none.- Parameters:
- omeganumpy.ndarray
Photon energies, hartree.
- orderint
The order
k >= 2.- birgebool, optional
Scale the covariance by the reduced chi-squared when it exceeds one.
- Returns:
- numpy.ndarray
One-sigma uncertainty, atomic units (those of alpha times
E_h^(1 - k)).
- Raises:
- ValueError
If
orderis below 2.
- dispersion_sigma_relative(omega, order, *, birge=True)[source]#
Return the relative one-sigma uncertainty of a dispersion coefficient.
In the dilute limit the propagation constant is
beta = (omega / c) [1 + N alpha / (2 epsilon_0)], so fork >= 2eachbeta_k = d^k beta / d omega^kis proportional tod^k (omega alpha) / d omega^kand its relative uncertainty is that of the derivative, independent of the density (k = 2is the group-velocity dispersion,k = 3the third-order dispersion). Lorentz-Lorenz changes the relative uncertainty only at the order of the susceptibility (below 1e-3 of itself at a few bar). The magnetic term is frequency-independent and drops out.- Parameters:
- omeganumpy.ndarray
Photon energies, hartree, below the lowest term’s energy.
- orderint
The order
k >= 2of the coefficient.- birgebool, optional
Scale the covariance by the reduced chi-squared when it exceeds one.
- Returns:
- numpy.ndarray
sigma(beta_k) / |beta_k|:dispersion_sigma_au()over|dispersion_au|.
- Raises:
- ValueError
If
orderis below 2.
- property gap_reasons: tuple[str, ...]#
The reason of each gap between two qualified intervals (OEP 3).
- Returns:
- tuple of str
absorption,representation,representation: kept bandorwidth; empty for a fit with one interval.
- property infrared_temperature: float | None#
The temperature of the fit’s fixed infrared terms, K.
- Returns:
- float or None
296 K for HITRAN’s line intensities (298.1 K for SF6’s cross-section); None for a fit without infrared terms.
- property n_rotational: int#
How many of the fixed terms are the rotational system (OEP 3).
- Returns:
- int
They follow the fitted terms; 0 for a fit without the derived rules.
- polarizability_sigma_au(omega, *, birge=True)[source]#
Return the one-sigma uncertainty of the polarizability.
- Parameters:
- omeganumpy.ndarray
Photon energies, hartree.
- birgebool, optional
Scale the covariance by the reduced chi-squared when it exceeds one.
- Returns:
- numpy.ndarray
One-sigma uncertainty, atomic units.
- property reference_temperature: float | None#
The temperature the fit’s polarizability refers to, K, where it declares one.
- Returns:
- float or None
293.15 K for N2, O2, CO2, N2O, H2 and D2; None for the atoms and for CH4, CO and SF6, whose levels rest on data at other temperatures without a curated coefficient (TC-730). Evaluation does not depend on it.
- representation_bound_au(omega, order)[source]#
Return the bound on the representation error of the fixed infrared terms.
B_m(omega) >= |D_m[model] - D_m[reference]|(OEP 3, section 4) from the gas’s derived tables: order 0 bounds the polarizability, 2 and 3 the dispersiond^m (omega alpha) / d omega^m. It is defined in every qualified interval.- Parameters:
- omeganumpy.ndarray
Photon energies, hartree.
- orderint
0, 2 or 3.
- Returns:
- numpy.ndarray
The bound, atomic units (those of alpha times E_h^(1 - m) for order m), NaN outside every qualified interval.
- Raises:
- ValueError
For another order.
- DataError
For a fit that read no derived tables.
- Warns:
- ModelRangeWarning
Outside every qualified interval.
- property temperature_coefficient: TemperatureCoefficient | None#
The measured temperature coefficient of the polarizability, if curated.
- Returns:
- TemperatureCoefficient or None
For N2, O2 and CO2 (TC-730); None otherwise.
- class optmat.gas.models.fitted.TemperatureCoefficient(coefficient_per_k, sigma_per_k, wavelength, dataset, reason)[source]#
Bases:
objectA measured temperature coefficient of a gas polarizability (OEP 1, section 4.9).
- Attributes:
- coefficient_per_kfloat
A_theta, per K, inA_R(T) = A_R(T0) [1 + A_theta (T - T0)].- sigma_per_kfloat
Its standard uncertainty, per K.
- wavelengthfloat
The vacuum wavelength it is measured at, m.
- datasetstr
The curated dataset it comes with.
- reasonstr
Where it is printed.