pygram11.var1dmw

pygram11.var1dmw(x, weights, bins, flow=False)[source]

Histogram data with multiple weight variations and variable width bins.

Parameters
  • x (array_like) – data to histogram

  • bins (array_like) – bin edges

  • weights (array_like) – weight variations for the elements of x, first dimension is the shape of x, second dimension is the number of weights.

  • density (bool) – normalize histogram bins as value of PDF such that the integral over the range is 1.

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

Returns

Examples

Using three different weight variations:

>>> x = np.random.randn(10000)
>>> weights = np.abs(np.random.randn(x.shape[0], 3))
>>> bin_edges = [-3.0, -2.5, -1.5, -0.25, 0.25, 2.0, 3.0]
>>> h, err = var1dmw(x, weights, bin_edges)
>>> h.shape
(6, 3)
>>> err.shape
(6, 3)