adbin_hist¶
-
hep_spt.
adbin_hist
(arr, nbins=100, range=None, weights=None, ndiv=2, free_memory=True)[source]¶ Create an adaptive binned histogram in N dimensions. The number of dimensions is determined by the shape of the input array. An array with shape (n, 2), will create a 2-dimensional adaptive binned histogram.
- Parameters
arr (numpy.ndarray) – array of data with the variables as columns.
range (None or numpy.ndarray((float, float, ..), (float, float, ..))) – range of the histogram in each dimension. For example, [(xmin, ymin), (xmax, ymax)] in the 2-dimensional case.
nbins (int) – number of bins. In this algorithm, divisions will be made till the real number of bins is equal or greater than “nbins”. If this number is a power of “ndiv”, then the real number of bins will match “nbins”.
weights (numpy.ndarray) – optional array of weights.
ndiv (int) – see
AdBin.divide()
.free_memory (bool) – whether to free the pointers pointing to the arrays of data and weights in the bins.
- Returns
Adaptive bins of the histogram, with size (nbins + 1).
- Return type
Note
This function will automatically delete the arrays of data and weights copied in the adaptive bins by calling AdBin.free_memory. To prevent it set “free_memory” to False. In such case, the user is responsible of deleting the data in each bin by calling the aforementioned function, if necessary.
See also