pub struct PulseCalibration { /* private fields */ }Expand description
A pulse calibrated on a foil by fit_counts, as its calibration file
holds it.
A pulse number the calibration fitted keeps its fitted value and enters
the prior; a number known in the calibration stays known. The prior is
the calibration’s CountsFit::unbounded Gaussian in the fitted numbers,
marginal over the other quantities, so a number that ended on a bound
keeps its uncertainty and the experiment fit applies the bound. The
bounds of the calibration foil’s other quantities do not reach the prior
either: its mean and covariance are those without them. When the
calibration fitted a pulse number, an experiment’s pulse carries the
foil’s line_span_ev. When an experiment ends a
calibrated pulse number on its bound, or near it, its error bars on t0,
the flight path and the pulse numbers are not standard errors; those on
the densities and the temperature are.
Implementations§
Source§impl PulseCalibration
impl PulseCalibration
Sourcepub fn new(
measurement: &Measurement,
calibration: &Calibration,
provenance: Provenance,
) -> Result<(Self, CountsFit), PipelineError>
pub fn new( measurement: &Measurement, calibration: &Calibration, provenance: Provenance, ) -> Result<(Self, CountsFit), PipelineError>
The pulse calibrated by fitting the counts of a foil, measurement,
from provenance, with calibration, and that fit. The measurement
is the foil alone, one region holding it. Each isotope of the foil
not known to be absent (Value::Known(0.0)) has a measured density,
and the foil’s effective temperature is measured. The prior over the
pulse numbers takes the resonance parameters as exact.
§Errors
PipelineError::InvalidParameter if the measurement is not one
region holding a material, a density or the temperature of the foil is
not measured, as above, an identifier of provenance is
empty or its runs are the same, or calibration‘s pulse carries a
prior or a pulse number measured or boxed, since a calibration foil is
calibrated alone over the numbers’ physical ranges, or the pulse has
an R_high or a detector tail, since the calibration records a storage
fraction constant in energy and no tail; everything fit_counts
refuses;
PipelineError::InvalidParameter if the fit did not converge, or
fitted a pulse number and gives no CountsFit::unbounded Gaussian, a
pulse number it fitted has no finite positive variance without its
bounds, as when the counts do not determine it, a number that ended on
a bound carries no information, or a fitted temperature ended at 1 K or
5000 K,
or the fit fitted a pulse number and no isotope of the foil fitted or
known to a positive density has a resonance between the energies of its
last and first time edges at the fitted t0 and flight path;
PipelineError::Fitting if the fitted numbers’ covariance is refused
by Prior::correlated.
Sourcepub fn transfer(
&self,
other: &PulseCalibration,
) -> Result<Transfer, PipelineError>
pub fn transfer( &self, other: &PulseCalibration, ) -> Result<Transfer, PipelineError>
The agreement of this calibration’s pulse with other‘s, a physically
different foil calibrated alone: d² = dᵀ(C_a + C_b)⁻¹d over the pulse
numbers both fitted, with d the difference of their priors’ means and
C_a, C_b their covariances, against χ² with as many degrees of
freedom.
d² follows χ² when both foils see the same pulse, to the order the
priors are Gaussian. Each run’s information is divided by its
overdispersion, which is at least 1, so with Poisson counts the test is
conservative, and it weakens as the overdispersion grows. Two foils
that share an open-beam run, or whose stated temperatures share an
error, are not independent, which the test does not account for.
§Errors
PipelineError::InvalidParameter if the two calibrations name the
same foil, as the same foil re-measured tests only repeatability,
share a run other than the open-beam run, fit different pulse numbers
or know one at different values, or fit none;
PipelineError::Fitting if a decomposition fails.
Sourcepub fn record_transfer(
self,
other: &PulseCalibration,
) -> Result<Self, PipelineError>
pub fn record_transfer( self, other: &PulseCalibration, ) -> Result<Self, PipelineError>
This calibration with its Self::transfer to other recorded, in
place of “transfer unchecked” or an earlier transfer, when its p is
above 0.01.
§Errors
Those of Self::transfer; PipelineError::InvalidParameter if p
is 0.01 or less: the pulse does not transfer, and the calibration is
consumed, since it is not to be written.
Sourcepub fn calibration(&self) -> Calibration
pub fn calibration(&self) -> Calibration
The calibration of an experiment: t0 and the flight path fitted from
the calibrated ones, the fitted pulse numbers fitted from theirs under
the calibration’s prior, and the others known.
Sourcepub fn to_json(&self) -> String
pub fn to_json(&self) -> String
The calibration file: JSON of format version 3 that names the pulse
model and, in the order α₀, α₁, β₀, β₁, R, h², each pulse number with
its unit, value and status (fitted or known), then the prior over the
fitted numbers: its mean, which may lie past a number’s bound, its
covariance and rank; then t0 and the flight path, the pulse’s energy
span and n_tau, the line span, the foil’s isotopes and effective
temperature with their stated uncertainties and its library, the foil and run
identifiers, the sample run’s overdispersion, and the transfer to
another foil: "unchecked", or the other foil and its identifiers, its
sample run’s overdispersion, d2, dof and p.
Sourcepub fn from_json(text: &str) -> Result<Self, PipelineError>
pub fn from_json(text: &str) -> Result<Self, PipelineError>
The calibration a file from Self::to_json holds.
§Errors
PipelineError::InvalidParameter if text is not such a file: not
format version 3 of this pulse model, a field missing or unknown, the
pulse numbers’ names or units not in their order, the mean, the
covariance or the rank not over the fitted numbers, the line span
missing while a pulse number
was fitted, present when none was, or not low ≤ high within the
energy span, a provenance Self::new refuses, the overdispersion
below 1, the foil without isotopes, with one listed twice, or not as
Self::new takes it, a value outside its quantity’s range or one
DetectorPulse::new
refuses, or a recorded transfer Self::record_transfer could not
have written: to this calibration’s foil or sharing a run other than
the open-beam run, with a
provenance or foil Self::new refuses, an overdispersion below 1,
degrees of freedom not the number of fitted numbers, d2 negative, or
p not within a relative 1e-12 of the χ² survival of d2 or 0.01 or
less; PipelineError::Fitting if Prior::correlated refuses the
mean or the covariance.
Trait Implementations§
Source§impl Clone for PulseCalibration
impl Clone for PulseCalibration
Source§fn clone(&self) -> PulseCalibration
fn clone(&self) -> PulseCalibration
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PulseCalibration
impl RefUnwindSafe for PulseCalibration
impl Send for PulseCalibration
impl Sync for PulseCalibration
impl Unpin for PulseCalibration
impl UnsafeUnpin for PulseCalibration
impl UnwindSafe for PulseCalibration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more