Boost histogram logo

Welcome to boost-histogram’s documentation!

Gitter Build Status Actions Status Documentation Status DOI Code style: black PyPI version Conda-Forge Scikit-HEP

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([.3, .5, .2],
          [.1, .4, .9])

# Numpy array view into histogram counts, no overflow bins
counts = hist.view()

See Quickstart for more.

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.

Indices and tables