Histogramming: NumPylike¶

pygram11.
histogram
(x, bins=10, range=None, weights=None, density=False, omp=False)[source]¶ Compute the histogram for the data
x
.This function provides an API very simiar to
numpy.histogram()
. Keep in mind that the returns are different.Parameters:  x (array_like) – Data to histogram.
 bins (int or sequence of scalars, optional) – If bins is an int, that many equalwidth bins will be used to construct the histogram in the given range. If bins is a sequence, it must define a monotonically increasing array of bin edges. This allows for nonuniform bin widths.
 range ((float, float), optional) – The range over which the histogram is constructed. If a range is not provided then the default is (x.min(), x.max()). Values outside of the range are ignored. If bins is a sequence, this options is ignored.
 weights (array_like, optional) – An array of weights associated to each element of
x
. Each value of thex
will contribute its associated weight to the bin count.  density (bool) – normalize histogram bins as value of PDF such that the integral over the range is 1.
 omp (bool) – Use OpenMP if available.
Returns: numpy.ndarray
– bin counts (heights)numpy.ndarray
– sum of weights squared (only ifweights
is not None)

pygram11.
histogram2d
(x, y, bins=10, range=None, weights=None, omp=False)[source]¶ Compute the twodimensional histogram for the data (
x
,y
).This function provides an API very simiar to
numpy.histogram2d()
. Keep in mind that the returns are different.Parameters:  x (array_like) – Array representing the
x
coordinate of the data to histogram.  y (array_like) – Array representing the
y
coordinate of the data to histogram.  bins (int or array_like or [int, int] or [array, array], optional) –
 The bin specification:
 If int, the number of bins for the two dimensions
(
nx = ny = bins
).  If array_like, the bin edges for the two dimensions
(
x_edges = y_edges = bins
).  If [int, int], the number of bins in each dimension
(
nx, ny = bins
).  If [array_like, array_like], the bin edges in each
dimension (
x_edges, y_edges = bins
).
 If int, the number of bins for the two dimensions
(
 range (array_like, shape(2,2), optional) – The edges of this histogram along each dimension. If
bins
is not integral, then this parameter is ignored. If None, the default is[[x.min(), x.max()], [y.min(), y.max()]]
.  weights (array_like) – An array of weights associated to each element \((x_i, y_i)\) pair. Each pair of the the data will contribute its associated weight to the bin count.
 omp (bool) – Use OpenMP if available
Returns: numpy.ndarray
– bin counts (heights)numpy.ndarray
– sum of weights squared (only ifweights
is not None)
 x (array_like) – Array representing the