Welcome to boost-histogram’s documentation!#
Boost-histogram (source) is a Python package providing Python bindings for Boost.Histogram (source). You can install this library from PyPI with pip or you can use Conda via conda-forge:
python -m pip install boost-histogram
conda install -c conda-forge boost-histogram
All the normal best-practices for Python apply; you should be in a virtual environment, etc. See Installation for more details. An example of usage:
import boost_histogram as bh
# Compose axis however you like; this is a 2D histogram
hist = bh.Histogram(bh.axis.Regular(2, 0, 1), bh.axis.Regular(4, 0.0, 1.0))
# Filling can be done with arrays, one per dimension
hist.fill([0.3, 0.5, 0.2], [0.1, 0.4, 0.9])
# NumPy array view into histogram counts, no overflow bins
counts = hist.view()
See Quickstart for more.
- boost_histogram
Histogram
Histogram.axes
Histogram.copy()
Histogram.counts()
Histogram.empty()
Histogram.fill()
Histogram.kind
Histogram.ndim
Histogram.project()
Histogram.reset()
Histogram.shape
Histogram.size
Histogram.storage_type
Histogram.sum()
Histogram.to_numpy()
Histogram.values()
Histogram.variances()
Histogram.view()
- boost_histogram.axis
- boost_histogram.axis.transform
- boost_histogram.accumulators
- boost_histogram.numpy
- boost_histogram.storage
- boost_histogram.tag
- boost_histogram.version
Acknowledgements#
This library was primarily developed by Henry Schreiner and Hans Dembinski.
Support for this work was provided by the National Science Foundation cooperative agreement OAC-1836650 (IRIS-HEP) and OAC-1450377 (DIANA/HEP). Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation.