Skip to main content

add_count_backgrounds

Function add_count_backgrounds 

Source
pub fn add_count_backgrounds(
    signal: TwoArmCounts,
    open_background_counts: &[f64],
    sample_background_counts: &[f64],
) -> Result<TwoArmCountPrediction, CountsResponseError>
Expand description

Add detector-bin backgrounds to an already evaluated two-arm neutron signal.

Both background arrays are expected counts for the corresponding complete acquisition, already mapped into the same detector-time bins as signal. A measured dark or blocked-beam reference may therefore be supplied directly after applying its independently justified run normalization. This function does not guess an exposure, fit a smooth curve, or reinterpret a SAMMY transmission-level background as detector counts.

A sample-scattering calculation that starts from a true-energy spectrum is not an input here: it must first be propagated through the instrument response. Only a scattering reference already measured in the detector bins can enter directly.

The per-arm acquisition-window loss carried by signal travels into the returned prediction unchanged (pipeline-map R5ยท7). Backgrounds are already binned into the acquisition, so they add no further loss.