pub fn detect_dead_pixels_chunked(
chunks: &[Array3<f64>],
) -> Result<Array2<bool>, IoError>Expand description
Detect dead pixels across acquisition chunks (dead-in-any-chunk).
Catches intermittent deadness that detect_dead_pixels on the summed
stack cannot see: a pixel that was dead for one acquisition chunk but
alive in another has nonzero summed counts, yet its dead-chunk data
corrupts the combined spectrum. A pixel is flagged iff it is all-zero
(exact == 0.0 test, same rationale as detect_dead_pixels) in any
chunk.
False-positive control: a live pixel with expected total counts λ within one chunk is all-zero in that chunk with probability P = e^(−λ) (Poisson); over m chunks, P(misflag) ≤ m·e^(−λ). Guidance: chunk the acquisition so each live pixel has λ ≥ 20 expected counts per chunk — e^(−20) ≈ 2e-9, i.e. ~5e-4·m expected false flags on a 512² detector.
There is deliberately no per-TOF-block zero-run variant. Within one TOF-summed stack, wall-clock-intermittent deadness is invisible — the pixel just shows uniformly reduced counts across all TOF bins, with no zeros to find. And any within-stack zero-run cut is a statistical screen on low-count pixels (a pixel at 0.01 counts/bin normally has ~100-bin zero runs) — exactly the banned failure mode (see the module-level “Pixel masks — pipeline integrity only” section).
Chunks may have differing TOF axis lengths (n_tof) — ragged event-mode
re-histogramming is fine; deadness is spatial, so only the spatial
dimensions must agree.
§Arguments
chunks— One 3D counts array per acquisition chunk, each with shape (n_tof, height, width).n_tofmay differ between chunks; (height, width) must not.
§Returns
2D boolean mask, shape (height, width). true = dead in at least one
chunk.
§Errors
Returns IoError::InvalidParameter if chunks is empty, any chunk has
an empty TOF axis (shape[0] == 0 — its all-zero test would vacuously
mark every pixel dead), or any chunk contains a non-finite or negative
value, and IoError::ShapeMismatch if the chunks’ spatial dimensions
differ.