Module spectrum

Module spectrum 

Source
Expand description

Spectrum file parser for TOF/energy bin edges or centers.

Parses CSV/TXT files containing TOF or energy values that define the spectral bins of a neutron imaging dataset.

§Supported formats

  • Single-column: one value per line
  • Two-column (CSV/TSV): first column used, rest ignored
  • Comment lines starting with # are skipped
  • First non-comment line skipped if it cannot be parsed as a number (header)

Enums§

SpectrumUnit
Whether spectrum values represent TOF or energy.
SpectrumValueKind
Whether values are bin edges (N+1 for N bins) or bin centers (N for N bins).

Functions§

parse_spectrum_file
Parse a spectrum file from disk.
parse_spectrum_text
Parse spectrum values from a string.
validate_monotonic
Validate that values are strictly monotonically increasing.
validate_spectrum_frame_count
Validate that spectrum values are compatible with the TIFF frame count.