Binning Algorithms for Binned Data (binned)

A collection of algorithms are provided to perform binning/rebinning on binned (histogram) 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 data within the data tools by following these rules:

  • The function must take as arguments:

  1. counts: An array of counts in each bin, size m

  2. exposure: An array of the exposure of each bin, size m

  3. old_edges: An array of the current bin edges, size m + 1

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

  • The function must return:

  1. new_counts: The array of counts in each of the new bins, size n

  2. new_exposure: The array of exposure for each of the new bins, size n

  3. new_edges: The array of new bin edges, size n + 1

Following this design, here is an example function:

>>> def my_binning_algorithm(counts, exposure, old_edges, my_param1):
>>>     # my_param1 is an algorithm-specific parameter
>>>     # define algorithm here
>>>     return (new_counts, new_exposure, new_edges)

Reference/API

gdt.core.binning.binned Module

Functions

combine_by_factor(counts, count_uncert, ...)

Rebins binned data to a multiple factor.

combine_into_one(counts, count_uncert, ...)

Combines binned data into a single bin.

rebin_by_edge(counts, count_uncert, ...)

Rebins binned data based on an array of bin edge indices

rebin_by_edge_index(counts, count_uncert, ...)

Rebins binned data based on an array of bin edge indices

rebin_by_snr(counts, count_uncert, exposure, ...)

Rebins binned data such that each bin is above a minimum signal-to-noise ratio

rebin_by_time(counts, count_uncert, ...)

Rebins binned data to a specified temporal bin width.