API Reference¶

pygram11.
fix1d
(x, bins=10, range=None, weights=None, omp=False)[source]¶ histogram
x
with fixed (uniform) binningParameters: Returns: numpy.ndarray
– bin counts (heights)numpy.ndarray
– sum of weights squared (only ifweights
is not None)
Examples
A histogram of
x
with 20 bins between 0 and 100, and weighted.>>> h = fix1d(x, bins=20, range=(0, 100))
The same data, now histogrammed weighted & accelerated with OpenMP.
>>> h, sw2 = fix1d(x, bins=20, range=(0, 100), omp=True)

pygram11.
var1d
(x, bins, weights=None, omp=False)[source]¶ histogram
x
with variable (nonuniform) binningParameters:  x (array_like) – data to histogram
 bins (array_like) – bin edges
 weights (array_like, optional) – weight for each element of
x
 omp (bool) – use OpenMP if available
Returns: numpy.ndarray
– bin counts (heights)numpy.ndarray
– sum of weights squared (only ifweights
is not None)
Examples
A histogram of
x
where the edges are defined by the list[1, 5, 10, 12]
:>>> h, w = var1d(x, [1, 5, 10, 12])
The same data, now weighted and accelerated with OpenMP:
>>> h = var1d(x, [1, 5, 10, 12], weights=w, omp=True)

pygram11.
fix2d
(x, y, bins=10, range=None, weights=None, omp=False)[source]¶ histogram the
x
,y
data with fixed (uniform) binning in two dimensionsParameters:  x (array_like) – first entries in data pairs to histogram
 y (array_like) – second entries in data pairs to histogram
 bins (int or iterable) – if int, both dimensions will have that many bins, if iterable, the number of bins for each dimension
 range (iterable, optional) – axis limits to histogram over in the form [(xmin, xmax), (ymin, ymax)]
 weights (array_like, optional) – weight for each \((x_i, y_i)\) pair.
 omp (bool) – use OpenMP if available
Returns: numpy.ndarray
– bin counts (heights)numpy.ndarray
– sum of weights squared (only if weights is not None)
Examples
A histogram of (
x
,y
) with 20 bins between 0 and 100 in thex
dimention and 10 bins between 0 and 50 in they
dimension.>>> h = fix2d(x, y, bins=(20, 10), range=((0, 100), (0, 50)))
The same data, now histogrammed weighted (via
w
) & accelerated with OpenMP.>>> h, sw2 = fix2d(x, y, bins=(20, 10), range=((0, 100), (0, 50)), ... weights=w, omp=True)

pygram11.
var2d
(x, y, xbins, ybins, weights=None, omp=False)[source]¶ histogram the
x
andy
data with variable width binning in two dimensionsParameters:  x (array_like) – first entries in the data pairs to histogram
 y (array_like) – second entries in the data pairs to histogram
 xbins (array_like) – bin edges for the
x
dimension  ybins (array_like) – bin edges for the
y
dimension  weights (array_like, optional) – weights for each \((x_i, y_i)\) pair.
 omp (bool) – use OpenMP if available
Returns: numpy.ndarray
– bin counts (heights)numpy.ndarray
– sum of weights squared (only if weights is not None)
Examples
A histogram of (
x
,y
) where the edges are defined by anumpy.logspace()
in both dimensions, accelerated with OpenMP.>>> bins = numpy.logspace(0.1, 1.0, 10, endpoint=True) >>> h = var2d(x, y, bins, bins, omp=True)