Skip to main content

rebin_transmission

Function rebin_transmission 

Source
pub fn rebin_transmission(data: &Array3<f64>, factor: usize) -> Array3<f64>
Expand description

Rebin a 3D transmission array along axis 0 by averaging groups of factor slices.

Transmission T = I/I₀ is a ratio. With uniform I₀ across bins, the correct rebinned transmission is the arithmetic mean of the group. This is an approximation — real I₀ varies per pixel and energy bin. When I₀ varies significantly across the group (e.g., near absorption edges or chopper gaps), the arithmetic mean biases toward bins with higher I₀.

The correct approach is Σ(C_s) / Σ(C_ob) (sum counts then divide), but this requires raw counts which are not available at the transmission stage. Users working with raw event data should rebin counts before normalization via rebin_counts.

Returns the original array unchanged if factor < 2.

NaN handling: NaN values propagate through the average — any NaN in a group produces NaN in that output bin. This matches ndarray semantics.