uproot.behaviors.TH1.Histogram — Uproot documentation

# uproot.behaviors.TH1.Histogram

Defined in uproot.behaviors.TH1 on line 43.

class uproot.behaviors.TH1.Histogram

  Abstract class for histograms.

## name

Histogram.name

  The name of the histogram.

## title

Histogram.title

  The title of the histogram.

## axes

Histogram.axes

  A tuple of all uproot.behaviors.TAxis.TAxis objects.

## axis

Histogram.axis(axis)

  Returns a specified uproot.behaviors.TAxis.TAxis object.

  The `axis` can be specified as

  - a non-negative integer: `0` is the first axis, `1` is the second, and `2` is the third.

  - a negative integer: `-1` is the last axis, `-2` is the second-to-last, and `-3` is the third-to-last.

  - a string: `"x"` is the first axis, `"y"` is the second, and `"z"` is the third

  (assuming that the histogram dimension supports a given `axis`).

## weighted

Histogram.weighted

  True if the histogram has weights (`fSumw2`); False otherwise.

## kind

Histogram.kind

  `"COUNT"` for true histograms (TH*) and `"MEAN"` for profile plots (TProfile*).

  Type:

    The meaning of this object

## values

Histogram.values(flow=False)
  Parameters:

    flow (bool) – If True, include underflow and overflow bins before and after the normal (finite-width) bins.

  Bin contents as a 1, 2, or 3 dimensional `numpy.ndarray`. The `numpy.dtype` of this array depends on the histogram type.

  Setting `flow=True` increases the length of each dimension by two.

## errors

Histogram.errors(flow=False)
  Parameters:

    flow (bool) – If True, include underflow and overflow bins before and after the normal (finite-width) bins.

  Errors (uncertainties) in the values as a 1, 2, or 3 dimensional `numpy.ndarray` of `numpy.float64`.

  If `fSumw2` (weights) are available, they will be used in the calculation of the errors. If not, errors are assumed to be the square root of the values.

  Setting `flow=True` increases the length of each dimension by two.

## variances

Histogram.variances(flow=False)
  Parameters:

    flow (bool) – If True, include underflow and overflow bins before and after the normal (finite-width) bins.

  Variances (uncertainties squared) in the values as a 1, 2, or 3 dimensional `numpy.ndarray` of `numpy.float64`.

  If `fSumw2` (weights) are available, they will be used in the calculation of the variances. If not, variances are assumed to be equal to the values.

  Setting `flow=True` increases the length of each dimension by two.

## counts

Histogram.counts(flow=False)
  Parameters:

    flow (bool) – If True, include underflow and overflow bins before and after the normal (finite-width) bins.

  Returns the (possibly weighted) number of entries in each bin. For histograms, this is equal to values.

## to_boost

Histogram.to_boost(metadata={'label': 'fTitle', 'name': 'fName'}, axis_metadata={'label': 'fTitle', 'name': 'fName'})
  Parameters:

    - metadata (dict of str → str) – Metadata to collect (keys) and their C++ class member names (values).

    - axis_metadata (dict of str → str) – Metadata to collect from each axis.

  Converts the histogram into a `boost-histogram` object.

## to_hist

Histogram.to_hist(metadata={'label': 'fTitle', 'name': 'fName'}, axis_metadata={'label': 'fTitle', 'name': 'fName'})
  Parameters:

    - metadata (dict of str → str) – Metadata to collect (keys) and their C++ class member names (values).

    - axis_metadata (dict of str → str) – Metadata to collect from each axis.

  Converts the histogram into a `hist` object.