Skip to main content

PulseCalibration

Struct PulseCalibration 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> PulseCalibration

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PulseCalibration

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,