fix1d(x, bins=10, range=None, weights=None, density=False, flow=False)¶
Histogram data with fixed (uniform) bin widths.
x (numpy.ndarray) – Data to histogram.
bins (int) – The number of bins.
weights (numpy.ndarray, optional) – The weights for each element of
x. If weights are absent, the second return type will be
density (bool) – Normalize histogram counts as value of PDF such that the integral over the range is unity.
flow (bool) – Include under/overflow in the first/last bins.
A histogram of
xwith 20 bins between 0 and 100:
>>> h, __ = fix1d(x, bins=20, range=(0, 100))
When weights are absent the second return is
None. The same data, now histogrammed with weights and over/underflow included:
>>> rng = np.random.default_rng(123) >>> w = rng.uniform(0.1, 0.9, x.shape)) >>> h, stderr = fix1d(x, bins=20, range=(0, 100), weights=w, flow=True)