Quick Intro

Core pygram11 Functions

pygram11 provides four simple functions for histogramming.

pygram11.fix1d(x[, bins, range, weights, omp]) histogram x with fixed (uniform) binning over a range [xmin, xmax).
pygram11.var1d(x, bins[, weights, omp]) histogram x with variable (non-uniform) binning over a range .[bins[0], bins[-1])
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 there are a number of types of histograms supported by pygram11. For each of the four generic types, one can build a weighted or unweighted histogram. The weighted histograms always return the sum of weights squared in each bin.

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).