Quick Intro

Core pygram11 Functions

pygram11 provides a simple set of functions for calculating histograms:

pygram11.fix1d(x[, bins, range, weights, …]) histogram x with fixed (uniform) binning over a range [xmin, xmax).
pygram11.fix1dmw(x, weights[, bins, range, …]) histogram x with fixed (uniform) binning over a range [xmin, xmax) using multiple weight variations.
pygram11.var1d(x, bins[, weights, density, …]) histogram x with variable (non-uniform) binning over a range [bins[0], bins[-1]).
pygram11.var1dmw(x, weights, bins[, flow, omp]) histogram x with fixed (uniform) binning over a range [xmin, xmax) using multiple weight variations.
pygram11.fix2d(x, y[, bins, range, weights, omp]) histogram the x, y data with fixed (uniform) binning in two dimensions over the ranges [xmin, xmax), [ymin, ymax).
pygram11.var2d(x, y, xbins, ybins[, …]) histogram the x and y data with variable width binning in two dimensions over the range [xbins[0], xbins[-1]), [ybins[0], ybins[-1])

You’ll see that the API specific to pygram11 is a bit more specialized than the NumPy histogramming API (shown below).

Histogramming a normal distribution:

>>> h, __ = pygram11.fix1d(np.random.randn(10000), bins=25, range=(-3, 3))

See the API reference for more examples.

NumPy-like Functions

For convenience a NumPy-like API is also provided (not one-to-one, see the API reference).

pygram11.histogram(x[, bins, range, …]) Compute the histogram for the data x.
pygram11.histogram2d(x, y[, bins, range, …]) Compute the two-dimensional histogram for the data (x, y).