pub fn load_nexus_events(
path: &Path,
params: &EventBinningParams,
) -> Result<NexusHistogramData, IoError>Expand description
Load neutron event data from a NeXus file and histogram into a 3D grid.
Reads /entry/neutrons/event_time_offset (u64), x (f64), y (f64),
rescales TOF to the canonical internal unit of microseconds based on
the event_time_offset dataset’s units attribute (issue #554), then
bins events into a (n_bins, height, width) histogram grid.
§TOF units handling (issue #554)
The loader consults the NeXus units attribute on the
event_time_offset dataset and rescales the raw u64 channel
counts to µs accordingly. See the module-level “Units convention”
table for the recognised values. If the units attribute is
absent, the loader falls back to the rustpix legacy assumption of
nanoseconds (× 1e-3); if it is present but unrecognised, the
call returns IoError::InvalidParameter rather than silently
guessing a scale factor.
§Binning behaviour (D-8)
- Out-of-range events are dropped and counted: events with TOF outside
[tof_min_us, tof_max_us), pixel coordinates outside[0, width)/[0, height), or non-finite spatial coordinates are excluded. Per-category drop counts are returned inEventRetentionStatsviaNexusHistogramData::event_stats. - Pixel coordinates are rounded to the nearest integer (
f64::round()then cast toisize), snapping sub-pixel positions to a discrete grid. Fractional coordinates exactly at 0.5 round up.