fix1dmw(x, weights, bins=10, range=None, flow=False, cons_var=False)¶
Histogram data with multiple weight variations and fixed width bins.
The weights array must have a total number of rows equal to the length of the input data. The number of columns in the weights array is equal to the number of weight variations. (The weights array must be an M x N matrix where M is the length of x and N is the number of weight variations).
x (numpy.ndarray) – Data to histogram.
weights (numpy.ndarray) – The weight variations for the elements of x, first dimension is the length of x, second dimension is the number of weights variations.
bins (int) – The number of bins.
flow (bool) – Include under/overflow in the first/last bins.
cons_var (bool) – If
True, conserve the variance rather than return the standard error (square root of the variance).
Multiple histograms of x using 20 different weight variations:
>>> rng = np.random.default_rng(123) >>> x = rng.standard_normal(10000) >>> twenty_weights = np.abs(rng.standard_normal((x.shape, 20))) >>> h, err = fix1dmw(x, twenty_weights, bins=50, range=(-3, 3))
h and err are now shape
(50, 20). Each column represents the histogram of the data using its respective weight.