compute_histogram

compute_histogram#

glue.utils.array.compute_histogram(data, range, bins, weights=None, log=None)#

Compute an n-dimensional histogram with regularly spaced bins.

Currently this only implements 1-D and 2-D histograms. The values are assumed to have already been restricted to any subset of interest - this function only takes care of the binning itself (range selection, optional log scaling, and dropping NaN values).

Parameters:
datalist of ~numpy.ndarray

The array of values to histogram, with one array per dimension (one or two).

rangelist of tuple

The (min, max) of the histogram range, with one tuple per dimension.

binslist of int

The number of bins, with one value per dimension.

weights~numpy.ndarray, optional

The weights to assign to each value.

loglist of bool, optional

Whether to compute the histogram in log space, with one value per dimension.