Skip to content

generate_labels

function grb_trigger.dataset

grb_trigger.dataset.generate_labels(n_bins, events, background_bins_number=100, foreground_bins_number=10)

Produces the 1D target array matching the exact rows returned by features.feature_extraction_loop().

Parameters

n_bins int

signal length in bin number.

events list of dict

Each dict has the keys "signal" ((low, high) arrays), "start_bin" (int, > 0), "type" (str, e.g. "grb") and optionally "is_grb" (0 or 1).

background_bins_number int, default 100

Number of bins in the background window.

foreground_bins_number int, default 10

Number of bins in the foreground window.

Returns

y numpy.ndarray

Target column: true if more than half of the window values are is_grb=1

Notes

Returned array has shape (n,) with n = n_bins - background_bins_number - foreground_bins_number + 1.