pygram11.var2d¶
-
pygram11.
var2d
(x, y, xbins, ybins, weights=None, flow=False)[source]¶ Histogram the
x
,y
data with variable width binning.The two input arrays (
x
andy
) 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.
xbins (numpy.ndarray) – Bin edges for the
x
dimension.ybins (np.ndarray) – Bin edges for the
y
dimension.weights (array_like, optional) – The weights for data element. If weights are absent, the second return type will be
None
.flow (bool) – Include under/overflow.
- Raises
ValueError – If
x
andy
have different shape.ValueError – If either bin edge definition is not monotonically increasing.
TypeError – If
x
,y
, orweights
are unsupported types
- Returns
numpy.ndarray
– The bin counts.numpy.ndarray
, optional – The standard error of each bin count, \(\sqrt{\sum_i w_i^2}\).
Examples
A histogram of (
x
,y
) where the edges are defined by anumpy.logspace()
in both dimensions:>>> bins = numpy.logspace(0.1, 1.0, 10, endpoint=True) >>> h, __ = var2d(x, y, bins, bins)