hist2array(hist, include_overflow=False, copy=True, return_edges=False)¶
Convert a ROOT histogram into a NumPy array
hist : ROOT TH1, TH2, TH3, THn, or THnSparse
The ROOT histogram to convert into an array
include_overflow : bool, optional (default=False)
If True, the over- and underflow bins will be included in the output numpy array. These bins are excluded by default.
copy : bool, optional (default=True)
If True (the default) then copy the underlying array, otherwise the NumPy array will view (and not own) the same memory as the ROOT histogram’s array.
return_edges : bool, optional (default=False)
If True, also return the bin edges along each axis.
array : numpy array
A NumPy array containing the histogram bin values
edges : list of numpy arrays
A list of numpy arrays where each array contains the bin edges along the corresponding axis of
hist. Overflow and underflow bins are not included.
If hist is not a ROOT histogram.