# API Reference¶

pygram11.fix1d(x, bins=10, range=None, weights=None, omp=False)[source]

histogram x with fixed (uniform) binning

Parameters: x (array_like) – data to histogram bins (int or str, optional) – number of bins or str range ((float, float), optional) – axis limits to histogram over weights (array_like, optional) – weight for each element of x. omp (bool) – use OpenMP if available numpy.ndarray – bin counts (heights) numpy.ndarray – sum of weights squared (only if weights is not None)

Examples

A histogram of x with 20 bins between 0 and 100, and weighted.

>>> h, w = fix1d(x, bins=20, range=(0, 100), weights=w)


The sample histogram, unweighted, and accelerated with OpenMP

>>> h = fix1d(x, bins=20, range=(0, 100), omp=True)

pygram11.var1d(x, bins, weights=None, omp=False)[source]

histogram x with variabale (non-uniform) binning

Parameters: 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 numpy.ndarray – bin counts (heights) numpy.ndarray – sum of weights squared (only if weights 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 histogram, 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 dimensions

Parameters: 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 numpy.ndarray – bin counts (heights) numpy.ndarray – sum of weights squared (only if weights is not None)
pygram11.var2d(x, y, xbins, ybins, weights=None, omp=False)[source]

histogram the x and y data with variable width binning in two dimensions

Parameters: 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