Sensitivities and inference
These tools work on named scalar quantities of a steady state
(opencr.analysis.quantities):
| Name | Quantity |
|---|---|
population:<state> | a density (m⁻³) |
effective_rate:<source>><target> | an effective rate coefficient (m³/s), quasi-static |
emissivity:<reaction> | a line’s photon emissivity (photons m⁻³ s⁻¹) |
electron_cooling:<driver> | electron energy loss per electron and per driver particle (eV m³/s) |
ratio:<quantity>/<quantity> | a ratio, e.g. ratio:emissivity:A:3-2/emissivity:A:4-2 (Balmer α/β) |
Sensitivities and uncertainties
Section titled “Sensitivities and uncertainties”opencr.inference.sensitivities(model, conditions, outputs) gives by central differences; a detailed-balance inverse moves with its forward reaction
(Model.solve_steady_state(..., factors={name: f}) scales rates the same way).
propagate(..., method="linear" | "monte-carlo") turns relative uncertainties of the data
(by default the uncertainty of each reaction’s provenance) into the uncertainty of the
quantities: for independent data, or by sampling
log-normal factors; Propagation.dominant lists the reactions that matter most. This is the
uncertainty of the data, kept apart from the error of a surrogate.
Inverse modelling
Section titled “Inverse modelling”Measured quantities Observation(name, value, uncertainty) and parameters of the conditions
with log-uniform priors give the posterior
, . posterior_grid evaluates it on a grid (one to three parameters), fit finds the
maximum by least squares with a curvature estimate of the spread. The forward model is the CR
model (forward_model(model, conditions, parameters, outputs)) or a trained surrogate’s
forward.
Surrogates
Section titled “Surrogates”opencr.ml.generate_dataset solves a model at a seeded Latin hypercube of log-uniform
conditions, with the provenance (the SHA-256 of the model’s manifest, the OpenCR version, the
seed, the solver’s time per sample) and a reproducible train/validation/test split.
Surrogate().fit(dataset) is a scikit-learn Gaussian process in log space (the ml extra);
evaluate reports held-out errors and the speed-up, predict flags inputs outside the training
ranges. The solver stays the reference.
Effective-rate tables
Section titled “Effective-rate tables”opencr.tables.effective_rate_table(model, conditions, outputs, temperatures, densities)
tabulates quantities on a grid; an EffectiveRateTable interpolates in
against , and writes netCDF. carafe (carafe.cr: the
hydrogen driver and the deuterium neutralizer), beamtracer (through carafe) and
freeofcharge (ElectronCRStopping) take their rates from these tables.