pub fn load_nexus_bank_spectrum(
path: &Path,
bank: &str,
params: &BankBinningParams,
keep_intervals: Option<&[(f64, f64)]>,
) -> Result<BankSpectrum, IoError>Expand description
Load one NXevent_data bank (e.g. a beam monitor) as a 1-D TOF spectrum,
optionally keeping only pulses inside wall-clock keep_intervals
(issue #637).
Reads /entry/<bank>/{event_time_offset, event_index, event_time_zero}:
event_time_offset— TOF per event; itsunitsattribute is required on this path (facility files always write it; refusing to guess closes the #554 silent-rescale class). Recognised values are the module-level table (ns/us/ms/s), scaled to canonical µs.event_index— cumulative first-event index per pulse (validated non-decreasing, last entry ≤ total events). Events of pulsepareevent_index[p] .. event_index[p+1](last pulse runs to the end).event_time_zero— pulse wall-clock times; itsunitsattribute is also required (NXevent_data specifies no default; SNS writes"second"), accepted via the same table and rescaled to seconds.
keep_intervals are (t_start, t_end) pairs in seconds on the same
clock as event_time_zero (at SNS: seconds since run start — the same
clock as /entry/DASlogs/<pv>/time, so lists from
crate::runlog::intervals_where /
crate::runlog::intervals_intersect apply directly). Pulse p is
kept iff t_start <= event_time_zero[p] < t_end for some interval;
the list may be unsorted/overlapping (it is normalised internally), but
every pair must be finite with t_end > t_start.
Empty-bank grace (issue #637): a bank with zero events (the normal state of every imaging-detector bank on VENUS, where tpx1 is frame-mode) loads to an all-zero spectrum with correct pulse statistics — it never errors.