pub struct DetectorBinResponseMatrix { /* private fields */ }Expand description
Detector-bin probabilities for a fixed instrument response.
Rows correspond to true_energies_ev; columns correspond to consecutive
intervals in detector_time_edges_us. Building the matrix evaluates the
analytical IC/tabulated bin integrals once. Reusing it during optimization
changes only the true-energy sample transmission, not the detector physics.
Only entries whose evaluated probability is strictly greater than zero are
stored. This is lossless: there is no numerical cutoff, and every nonzero
value returned by the response model is retained. Probability outside the
acquisition window is likewise never renormalized into the stored rows —
each row’s out-of-window fraction is kept alongside it so Self::apply
can report the quantified window loss exactly as
two_arm_count_response does (pipeline-map R5·7).
Implementations§
Source§impl DetectorBinResponseMatrix
impl DetectorBinResponseMatrix
Sourcepub fn new(
true_energies_ev: &[f64],
detector_time_edges_us: &[f64],
timing_offset_us: f64,
response: &ResolutionFunction,
) -> Result<Self, CountsResponseError>
pub fn new( true_energies_ev: &[f64], detector_time_edges_us: &[f64], timing_offset_us: f64, response: &ResolutionFunction, ) -> Result<Self, CountsResponseError>
Build a fixed detector-bin response matrix.
Sourcepub fn n_true_energies(&self) -> usize
pub fn n_true_energies(&self) -> usize
Number of true-energy quadrature points.
Sourcepub fn n_detector_bins(&self) -> usize
pub fn n_detector_bins(&self) -> usize
Number of measured detector-time bins.
Sourcepub fn storage_bytes(&self) -> usize
pub fn storage_bytes(&self) -> usize
Heap bytes used by the compact probability storage.
This excludes the small fixed-size Self value, the per-row window-loss
fractions, and allocator overhead.
Sourcepub fn row_entries(
&self,
true_index: usize,
) -> impl Iterator<Item = (usize, f64)> + '_
pub fn row_entries( &self, true_index: usize, ) -> impl Iterator<Item = (usize, f64)> + '_
Stored (detector_bin, probability) pairs for one true-energy row.
Sourcepub fn probability(&self, true_index: usize, detector_bin: usize) -> f64
pub fn probability(&self, true_index: usize, detector_bin: usize) -> f64
Probability that true-energy row true_index lands in detector bin
detector_bin.
Sourcepub fn apply(
&self,
incident_fluence_weights: &[f64],
transmission: &[f64],
) -> Result<TwoArmCounts, CountsResponseError>
pub fn apply( &self, incident_fluence_weights: &[f64], transmission: &[f64], ) -> Result<TwoArmCounts, CountsResponseError>
Apply the fixed response separately to open and sample arms.
Numerically equivalent to two_arm_count_response on the same
inputs, including the per-arm acquisition-window loss report.
Trait Implementations§
Source§impl Clone for DetectorBinResponseMatrix
impl Clone for DetectorBinResponseMatrix
Source§fn clone(&self) -> DetectorBinResponseMatrix
fn clone(&self) -> DetectorBinResponseMatrix
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DetectorBinResponseMatrix
impl Debug for DetectorBinResponseMatrix
impl StructuralPartialEq for DetectorBinResponseMatrix
Auto Trait Implementations§
impl Freeze for DetectorBinResponseMatrix
impl RefUnwindSafe for DetectorBinResponseMatrix
impl Send for DetectorBinResponseMatrix
impl Sync for DetectorBinResponseMatrix
impl Unpin for DetectorBinResponseMatrix
impl UnsafeUnpin for DetectorBinResponseMatrix
impl UnwindSafe for DetectorBinResponseMatrix
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