Skip to main content

load_nexus_events

Function load_nexus_events 

Source
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 ns), x (f64), y (f64), converts TOF from nanoseconds to microseconds, then bins events into a (n_bins, height, width) histogram grid.

ยง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 in EventRetentionStats via NexusHistogramData::event_stats.
  • Pixel coordinates are rounded to the nearest integer (f64::round() then cast to isize), snapping sub-pixel positions to a discrete grid. Fractional coordinates exactly at 0.5 round up.