Bin
- class coffea.hist.Bin(name, label, n_or_arr, lo=None, hi=None)[source]
Bases:
DenseAxisA binned axis with name, label, and binning.
- Parameters:
name (str) – is used as a keyword in histogram filling, immutable
label (str) – describes the meaning of the axis, can be changed
n_or_arr (int or list or numpy.ndarray) – Integer number of bins, if uniform binning. Otherwise, a list or numpy 1D array of bin boundaries.
lo (float, optional) – lower boundary of bin range, if uniform binning
hi (float, optional) – upper boundary of bin range, if uniform binning
This axis will generate frequencies for n+3 bins, special bin indices:
0 = underflow, n+1 = overflow, n+2 = nanflowBin boundaries are [lo, hi)Attributes Summary
Number of bins, including overflow (i.e.
n + 3).Methods Summary
centers([overflow])Bin centers
edges([overflow])Bin boundaries
identifiers([overflow])List of
Intervalidentifiersindex(identifier)Index of a identifer or label
reduced(islice)Return a new axis with reduced binning
Attributes Documentation
- size
Number of bins, including overflow (i.e.
n + 3)
Methods Documentation
- index(identifier)[source]
Index of a identifer or label
- Parameters:
identifier (float or Interval or numpy.ndarray) – The identifier(s) to lookup. Supports vectorized calls when a numpy 1D array of numbers is passed.
Returns an integer corresponding to the index in the axis where the histogram would be filled. The integer range includes flow bins:
0 = underflow, n+1 = overflow, n+2 = nanflow
- reduced(islice)[source]
Return a new axis with reduced binning
The new binning corresponds to the slice made on this axis. Overflow will be taken care of by
Hist.__getitem__- Parameters:
islice (slice) –
islice.startandislice.stopshould be None or within[1, ax.size() - 1]This slice is usually as returned fromBin._ireduce