split_windows
grb_trigger.features.split_windows(detector_counts, i, background_bins_number=100, foreground_bins_number=10)Split a detector time series into foreground and background windows.
The background window holds the background_bins_number bins before
bin i; the foreground window holds the foreground_bins_number bins
starting at bin i.
Parameters
detector_countstuple of numpy.ndarray-
(low_counts, high_counts), as returned bysimulations.detector_counts. iint-
Index of the first foreground bin.
background_bins_numberint, default 100-
Number of bins in the background window.
foreground_bins_numberint, default 10-
Number of bins in the foreground window.
Returns
fg_windowtuple of numpy.ndarray-
(low, high)slices of the foreground window. bg_windowtuple of numpy.ndarray-
(low, high)slices of the background window.
Raises
- ValueError
-
If the channels are empty or differ in length, if a window size is not positive, or if there are not enough bins around
i.
See Also
feature_extraction_loop— Applies this function at every valid bin.
Examples
>>> bkg = generate_background(500)>>> counts = detector_counts(bkg, [{"signal": generate_grb_pulse(50, 80),... "start_bin": 200, "type": "grb"}])>>> fg, bg = split_windows(counts, 200)>>> len(fg[0]), len(bg[0])(10, 100)