Skip to content

compute_hardness_ratio

function grb_trigger.features

grb_trigger.features.compute_hardness_ratio(fg_window, bg_window)

Compute the hardness ratio (HR) of the background-subtracted signal.

Parameters

fg_window, bg_window tuple of numpy.ndarray

Windows returned by split_windows.

Returns

float

Net high-channel rate divided by net low-channel rate. 0.0 if either net rate is not positive.

Raises

ValueError

If a window is empty.

Notes

HR=xˉfghigh−xˉbghighxˉfglow−xˉbglow\mathrm{HR} = \frac{\bar{x}^\mathrm{high}_\mathrm{fg} - \bar{x}^\mathrm{high}_\mathrm{bg}}{\bar{x}^\mathrm{low}_\mathrm{fg} - \bar{x}^\mathrm{low}_\mathrm{bg}}