Skip to main content

Module normalization

Module normalization 

Source
Expand description

Transmission normalization from raw neutron counts.

Converts raw sample and open-beam (OB) neutron counts into a transmission spectrum, following the ORNL Method 2 approach used in PLEIADES.

§Method 2 Normalization

For each TOF bin and pixel:

T[tof, y, x] = (C_sample / C_ob) × (PC_ob / PC_sample)

where:

  • C_sample = raw sample counts (dark-current subtracted)
  • C_ob = open-beam counts (dark-current subtracted)
  • PC_sample = proton charge for sample run
  • PC_ob = proton charge for open-beam run

The proton charge ratio corrects for different beam exposures.

§Uncertainty

Assuming Poisson counting statistics:

σ_T / T = √(1/C_sample + 1/C_ob)

§Pixel masks — pipeline integrity only

The boolean masks produced by detect_dead_pixels, detect_dead_pixels_chunked, detect_hot_pixels, and detect_bad_pixels exist for exactly one purpose: excluding pixels whose data stream is broken in a way that would corrupt the downstream pipeline. Downstream, a mask is a hard exclude — masked pixels are never fitted and appear as NaN in every result map (nereids-pipeline’s spatial_map_typed skips them entirely; see crates/nereids-pipeline/src/spatial.rs).

The masks are not a data-quality or coverage filter:

  • Low-count pixels are alive and MUST be kept. KL-domain fitting handles them correctly; a statistical low-count screen was measured to reject 13% of an ROI essentially at random (IPTS-37432).
  • Coverage / thickness inhomogeneity is a model concern (free density per region), never a masking concern.
  • Deadness/hotness is per-acquisition, so always union the sample and open-beam masks — detect_bad_pixels does this.

See issue #643 for the methodology discussion.

§PLEIADES Reference

  • processing/normalization_ornl.py — Method 2 implementation

Structs§

NormalizationParams
Parameters for transmission normalization.
NormalizedData
Result of normalization: transmission and its uncertainty.

Constants§

HOT_LOCAL_FACTOR
Local-neighborhood confirmation factor (stage 2) of detect_hot_pixels.
HOT_PIXEL_K_MAD
Default MAD multiplier for the global (stage-1) cut of detect_hot_pixels.

Functions§

average_roi
Average spectra over a rectangular region of interest.
detect_bad_pixels
Detect all pipeline-corrupting pixels: dead ∪ hot over sample and (optionally) open beam.
detect_dead_pixels
Detect dead pixels (zero counts across all TOF bins of one stack).
detect_dead_pixels_chunked
Detect dead pixels across acquisition chunks (dead-in-any-chunk).
detect_hot_pixels
Detect hot (railed / runaway) pixels via a two-stage criterion: a robust one-sided log-space median + k·MAD screen on per-pixel total counts (stage 1, global), confirmed by a local-neighborhood isolation test (stage 2).
extract_spectrum
Extract a single spectrum (all TOF bins) from a pixel in the 3D array.
normalize
Normalize raw data to transmission using Method 2.