pygram11.fix2d

pygram11.fix2d(x, y, bins=10, range=None, weights=None, flow=False)[source]

Histogram the x, y data with fixed (uniform) binning.

The two input arrays (x and y) must be the same length (shape).

Parameters
  • x (numpy.ndarray) – First entries in data pairs to histogram.

  • y (numpy.ndarray) – Second entries in data pairs to histogram.

  • bins (int or (int, int)) – If int, both dimensions will have that many bins; if tuple, the number of bins for each dimension

  • range (Sequence[Tuple[float, float]], optional) – Axis limits in the form [(xmin, xmax), (ymin, ymax)]. If None the input data min and max will be used.

  • weights (array_like, optional) – The weights for data element. If weights are absent, the second return type will be None.

  • flow (bool) – Include over/underflow.

Raises
  • ValueError – If x and y have incompatible shapes.

  • ValueError – If the shape of weights is incompatible with x and y

  • TypeError – If x, y, or weights are unsupported types

Returns

Examples

A histogram of (x, y) with 20 bins between 0 and 100 in the x dimention and 10 bins between 0 and 50 in the y dimension:

>>> h, __ = fix2d(x, y, bins=(20, 10), range=((0, 100), (0, 50)))

The same data, now histogrammed weighted (via w):

>>> h, err = fix2d(x, y, bins=(20, 10), range=((0, 100), (0, 50)), weights=w)