Skip to content

compute_snr

function grb_trigger.features

grb_trigger.features.compute_snr(fg_window, bg_window)

Compute the signal-to-noise ratio of each energy channel.

Parameters

fg_window, bg_window tuple of numpy.ndarray

Windows returned by split_windows.

Returns

snr numpy.ndarray, shape (2,)

SNR of the low (index 0) and high (index 1) channel.

Raises

ValueError

If a window is empty or the background standard deviation is zero.

Notes

For each channel,

SNR=xˉfg−xˉbgσbg\mathrm{SNR} = \frac{\bar{x}_\mathrm{fg} - \bar{x}_\mathrm{bg}}{\sigma_\mathrm{bg}}