pygram11.fix1d¶

pygram11.
fix1d
(x, bins=10, range=None, weights=None, density=False, flow=False)[source]¶ Histogram data with fixed (uniform) bin widths.
 Parameters
x (array_like) – Data to histogram.
bins (int) – The number of bins.
range ((float, float), optional) – The minimum and maximum of the histogram axis.
weights (array_like, optional) – The weights for each element of
x
.density (bool) – If True, normalize histogram bins as value of PDF such that the integral over the range is one.
flow (bool) – If True, the under and overflow bin contents are added to the first and last bins, respectively.
 Returns
numpy.ndarray
– The bin counts.numpy.ndarray
– The standard error of each bin count, \(\sqrt{\sum_i w_i^2}\).
Examples
A histogram of
x
with 20 bins between 0 and 100:>>> h, __ = fix1d(x, bins=20, range=(0, 100))
The same data, now histogrammed with weights:
>>> w = np.abs(np.random.randn(x.shape[0])) >>> h, h_err = fix1d(x, bins=20, range=(0, 100), weights=w)