Binning Algorithms for Unbinned Data (unbinned)

A collection of algorithms are provided to perform binning on unbinned (event) data. Each algorithm is packaged in a function with the same general inputs and outputs.

For Developers:

Users can define their own binning algorithm to be used to bin event data within the data tools by following these rules:

  • The function must take as an argument times, An array of event arrival times

  • Any algorithm-specific parameters can be pass as additional arguments or keywords

  • The function must return edges, the array of bin edges.

Following this design, here is an example function:

>>> def my_binning_algorithm(times, my_param1, my_param2=None):
>>>     # my_param1 and my_param2 are algorithm-specific parameters
>>>     # define algorithm here
>>>     return edges

Note that the functions do not perform the binning but instead return the edges defining the bins. The Data Tools uses the event times and the bin edges with numpy.histogram2d (to handle multi-channel data) to do the binning once the edges are determined by the algorithm.

Reference/API

gdt.core.binning.unbinned Module

Functions

bin_by_edges(times, time_edges, *args, **kwargs)

Bins unbinned data by pre-defined edges.

bin_by_snr(times, back_rates, snr, *args, ...)

Bins unbinned data by SNR

bin_by_time(times, dt[, tstart, tstop, time_ref])

Bins unbinned data to a specified temporal bin width.

combine_by_factor(times, old_edges, bin_factor)

Bins individual events to a multiple factor of bins given a set of bin edges

combine_into_one(times, tstart, tstop, ...)

Bins unbinned data to a single bin.

time_to_spill(times, threshold, *args, **kwargs)

Time-to-Spill binning for an event list.