pygram11.fix1dmw

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

Histogram data with multiple weight variations and fixed width bins.

Parameters
  • x (array_like) – data to histogram.

  • weights (array_like) – 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.

  • range ((float, float), optional) – The minimum and maximumm of the histogram axis.

  • flow (bool) – If True, the under and overflow bin contents are added to the first and last bins, respectively.

Returns

Examples

Multiple histograms of x with 50 bins between 0 and 100; using 20 different weight variations:

>>> x = np.random.randn(10000)
>>> twenty_weights = np.random.rand(x.shape[0], 20)
>>> h, err = fix1dmw(x, w, 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.