pub struct FlightTimeGrid { /* private fields */ }Expand description
Uniform flight-time grid over a window, with the probability that each grid point’s neutrons are counted in each bin.
Implementations§
Source§impl FlightTimeGrid
impl FlightTimeGrid
Sourcepub fn new(
time_edges_us: &[f64],
t0_us: f64,
flight_path_m: f64,
pulse: &DetectorPulse,
) -> Result<Self, FlightTimeGridError>
pub fn new( time_edges_us: &[f64], t0_us: f64, flight_path_m: f64, pulse: &DetectorPulse, ) -> Result<Self, FlightTimeGridError>
The grid for bins time_edges_us (µs) with timing offset t0_us,
flight path flight_path_m and pulse. The step, half the pulse’s shorter rise at the two ends of the flight
times whose neutrons can reach the bins, is a starting step: the counts
are converged once Self::halved no longer changes them. The grid
extends one step beyond those flight times at each end. For a storage
fraction that rises with energy, the latest arrival that sets the
earliest flight time takes the fraction at its largest over the energy
span.
§Errors
See FlightTimeGridError.
Sourcepub fn spanning(
time_edges_us: &[f64],
(t0_us, last_t0_us): (f64, f64),
flight_path_m: f64,
pulse: &DetectorPulse,
) -> Result<Self, FlightTimeGridError>
pub fn spanning( time_edges_us: &[f64], (t0_us, last_t0_us): (f64, f64), flight_path_m: f64, pulse: &DetectorPulse, ) -> Result<Self, FlightTimeGridError>
The grid of Self::new for every timing offset from t0_us to
last_t0_us: its flight times are those whose neutrons can reach the
bins at either, and Self::rows are at t0_us.
§Errors
See FlightTimeGridError.
Sourcepub fn covers(
&self,
t0_us: f64,
flight_path_m: f64,
params: &IkedaCarpenterParams,
) -> Result<bool, FlightTimeGridError>
pub fn covers( &self, t0_us: f64, flight_path_m: f64, params: &IkedaCarpenterParams, ) -> Result<bool, FlightTimeGridError>
Whether the grid’s points, arriving as Self::rows_at places them,
cover every flight time whose neutrons can reach the bins when the
timing offset is t0_us, the flight path flight_path_m and the
pulse’s laws params.
§Errors
As Self::new for that timing offset, flight path and pulse.
Source§impl FlightTimeGrid
impl FlightTimeGrid
Sourcepub fn halved(&self) -> Result<Self, FlightTimeGridError>
pub fn halved(&self) -> Result<Self, FlightTimeGridError>
Sourcepub fn rows_at(
&self,
t0_us: f64,
flight_path_m: f64,
params: &IkedaCarpenterParams,
) -> Result<Rows, FlightTimeGridError>
pub fn rows_at( &self, t0_us: f64, flight_path_m: f64, params: &IkedaCarpenterParams, ) -> Result<Rows, FlightTimeGridError>
The probability that each grid point’s neutrons are counted in each
bin when the timing offset is t0_us, the flight path flight_path_m
and the pulse’s laws params, with the step each point then stands
for. Neutrons from flight times the grid does not
cover there are not counted.
§Errors
FlightTimeGridError::InvalidTimingOffset or
FlightTimeGridError::InvalidFlightPath unless t0_us is finite and
flight_path_m finite and positive; FlightTimeGridError::Pulse if
the pulse cannot be evaluated there.
Sourcepub fn arrival_slopes_at(
&self,
t0_us: f64,
flight_path_m: f64,
params: &IkedaCarpenterParams,
) -> Result<Rows, FlightTimeGridError>
pub fn arrival_slopes_at( &self, t0_us: f64, flight_path_m: f64, params: &IkedaCarpenterParams, ) -> Result<Rows, FlightTimeGridError>
The derivative of Self::rows_at’s probabilities with respect to
each point’s arrival time, per µs, with the same step.
§Errors
As Self::rows_at.
Sourcepub fn pulse_slopes_at(
&self,
t0_us: f64,
flight_path_m: f64,
params: &IkedaCarpenterParams,
) -> Result<[Rows; 4], FlightTimeGridError>
pub fn pulse_slopes_at( &self, t0_us: f64, flight_path_m: f64, params: &IkedaCarpenterParams, ) -> Result<[Rows; 4], FlightTimeGridError>
The derivatives of Self::rows_at’s probabilities with respect to
α, β, R and the square of the triangle’s FWHM, each at its point’s
energy, with
the same step: IkedaCarpenterParams::bin_pulse_slopes_at for every
point.
§Errors
As Self::rows_at.
Sourcepub fn tail_slopes_at(
&self,
t0_us: f64,
flight_path_m: f64,
params: &IkedaCarpenterParams,
) -> Result<[Rows; 2], FlightTimeGridError>
pub fn tail_slopes_at( &self, t0_us: f64, flight_path_m: f64, params: &IkedaCarpenterParams, ) -> Result<[Rows; 2], FlightTimeGridError>
The derivatives of Self::rows_at’s probabilities with respect to
the detector tail’s f and τ_D, with the same step:
IkedaCarpenterParams::bin_tail_slopes_at for every point.
§Errors
As Self::rows_at, and FlightTimeGridError::Pulse for a pulse
without a detector tail.
Sourcepub fn rows(&self) -> &Rows
pub fn rows(&self) -> &Rows
The probabilities at the grid’s own timing offset, flight path and pulse.
Sourcepub fn pulse(&self) -> &DetectorPulse
pub fn pulse(&self) -> &DetectorPulse
The pulse the grid was built at.
Sourcepub fn flight_path_m(&self) -> f64
pub fn flight_path_m(&self) -> f64
The flight path in m the grid was built at.
Sourcepub fn range_us(&self) -> (f64, f64)
pub fn range_us(&self) -> (f64, f64)
(u_lo, u_hi), the flight-time range in µs at the timing offset and
flight path the grid was built at.
Sourcepub fn flight_times_us(&self) -> &[f64]
pub fn flight_times_us(&self) -> &[f64]
The grid’s flight times in µs, ascending.
Sourcepub fn time_edges_us(&self) -> &[f64]
pub fn time_edges_us(&self) -> &[f64]
The time-bin edges in µs, ascending.
Sourcepub fn energies_ev(&self) -> Vec<f64>
pub fn energies_ev(&self) -> Vec<f64>
The energy, in eV, of each grid point, descending.
Sourcepub fn predict(&self, values: &[f64]) -> Result<Vec<f64>, FlightTimeGridError>
pub fn predict(&self, values: &[f64]) -> Result<Vec<f64>, FlightTimeGridError>
step · Σ_j v_j P_k(u_j) for each bin k: the counts a beam of
values[j] neutrons per µs at each grid point predicts, or, for any
other per-point values, the same linear map. It differs from the
trapezoid rule by half a step of the end points’ terms, where P_k
is zero, or at most NEGLIGIBLE_ARRIVAL_PROBABILITY at the fast end
for an unfolded pulse. Features of the values narrower than the step
are not resolved.
§Errors
FlightTimeGridError::ValuesLength unless values has one entry
per grid point.
Trait Implementations§
Source§impl Clone for FlightTimeGrid
impl Clone for FlightTimeGrid
Source§fn clone(&self) -> FlightTimeGrid
fn clone(&self) -> FlightTimeGrid
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 FlightTimeGrid
impl RefUnwindSafe for FlightTimeGrid
impl Send for FlightTimeGrid
impl Sync for FlightTimeGrid
impl Unpin for FlightTimeGrid
impl UnsafeUnpin for FlightTimeGrid
impl UnwindSafe for FlightTimeGrid
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