pub struct SpatialResult {Show 17 fields
pub density_maps: Vec<Array2<f64>>,
pub uncertainty_maps: Vec<Array2<f64>>,
pub chi_squared_map: Array2<f64>,
pub deviance_per_dof_map: Option<Array2<f64>>,
pub converged_map: Array2<bool>,
pub temperature_map: Option<Array2<f64>>,
pub temperature_uncertainty_map: Option<Array2<f64>>,
pub isotope_labels: Vec<String>,
pub anorm_map: Option<Array2<f64>>,
pub background_maps: Option<[Array2<f64>; 3]>,
pub back_d_map: Option<Array2<f64>>,
pub back_f_map: Option<Array2<f64>>,
pub t0_us_map: Option<Array2<f64>>,
pub l_scale_map: Option<Array2<f64>>,
pub n_converged: usize,
pub n_total: usize,
pub n_failed: usize,
}Expand description
Result of spatial mapping over a 2D image.
NaN-on-failure contract (issue #458 B1/B2):
every per-pixel parameter map
(density_maps, uncertainty_maps, chi_squared_map,
deviance_per_dof_map, temperature_map,
temperature_uncertainty_map, anorm_map, background_maps,
back_d_map, back_f_map, t0_us_map, l_scale_map)
contains NaN at every pixel where
converged_map is false. The only map written unconditionally
is converged_map itself — it is how callers discover that a
pixel failed. Callers rendering numeric values should gate on
converged_map (or check value.is_finite()) to avoid displaying
the placeholder NaN.
Fields§
§density_maps: Vec<Array2<f64>>Fitted areal density maps, one per isotope.
Each Array2 has shape (height, width).
NaN at pixels where converged_map is false.
uncertainty_maps: Vec<Array2<f64>>Uncertainty maps, one per isotope.
NaN at pixels where converged_map is false.
chi_squared_map: Array2<f64>Reduced chi-squared map. For the counts-KL dispatch (joint-Poisson
deviance per memo 35 §P1.2) this is back-compat-mirrored to
D/(n−k); the semantically-correct per-pixel value is also
exposed as Self::deviance_per_dof_map.
NaN at pixels where converged_map is false.
deviance_per_dof_map: Option<Array2<f64>>Per-pixel conditional binomial deviance D/(n−k) map. Some when
the effective per-pixel solver is the counts-KL dispatch
(joint-Poisson); None for LM-only runs and transmission+PoissonKL
where Pearson χ²/dof is the GOF.
NaN at pixels where converged_map is false.
converged_map: Array2<bool>Convergence map (true = converged).
temperature_map: Option<Array2<f64>>Fitted temperature map (K). Some when config.fit_temperature() is true.
NaN at pixels where converged_map is false.
temperature_uncertainty_map: Option<Array2<f64>>Per-pixel temperature uncertainty map (K, 1-sigma).
Some when config.fit_temperature() is true.
Entries are NaN where uncertainty was unavailable for that pixel.
isotope_labels: Vec<String>Isotope labels captured at compute time, one per density map. Ensures display labels stay in sync with density data even if the user modifies the isotope list after fitting.
anorm_map: Option<Array2<f64>>Per-pixel SAMMY Anorm map (when background fitting is enabled).
NaN at pixels where converged_map is false.
background_maps: Option<[Array2<f64>; 3]>Per-pixel SAMMY background polynomial coefficient maps —
only the first three coefficients [BackA, BackB, BackC] of
the SAMMY 6-term form
bg(E) = BackA + BackB/√E + BackC·√E + BackD·exp(-BackF/√E).
Both LM-transmission and counts-KL paths use these semantics
(legacy alpha-fitting [b0, b1, alpha_2] layout was retired with
fit_counts_poisson in PR #450).
The exponential BackD/BackF terms are surfaced separately
in Self::back_d_map / Self::back_f_map — both None
for counts-KL runs (the joint-Poisson dispatch never fits the
exponential tail) and for LM transmission runs that left
fit_back_d / fit_back_f at their default false.
NaN at pixels where converged_map is false.
back_d_map: Option<Array2<f64>>Per-pixel fitted SAMMY exponential background amplitude BackD.
Some only when the LM transmission background path was active
AND fit_back_d=true; None otherwise (counts-KL runs, LM
runs without a background model, and LM runs that fit the
polynomial terms but left the exponential tail at its initial
value).
NaN at pixels where converged_map is false.
back_f_map: Option<Array2<f64>>Per-pixel fitted SAMMY exponential background decay constant
BackF. Some only when the LM transmission background path
was active AND fit_back_f=true; None otherwise. Mirrors
Self::back_d_map’s gating because BackD and BackF are
required to fit together (see validate_transmission_background
in crate::pipeline).
NaN at pixels where converged_map is false.
t0_us_map: Option<Array2<f64>>Per-pixel fitted SAMMY TZERO offset (µs) map.
Some when config.fit_energy_scale is true; None otherwise.
NaN at pixels where converged_map is false.
l_scale_map: Option<Array2<f64>>Per-pixel fitted SAMMY TZERO flight-path scale factor.
Some when config.fit_energy_scale is true; None otherwise.
NaN at pixels where converged_map is false.
n_converged: usizeNumber of pixels that converged.
n_total: usizeTotal number of pixels fitted.
n_failed: usizeNumber of pixels where the fitter returned an error (not just non-convergence — a hard failure like invalid parameters or NaN model output). These pixels have NaN density and false convergence.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpatialResult
impl RefUnwindSafe for SpatialResult
impl Send for SpatialResult
impl Sync for SpatialResult
impl Unpin for SpatialResult
impl UnsafeUnpin for SpatialResult
impl UnwindSafe for SpatialResult
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
§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