{
"info": {
"author": "Hans Dembinski and Henry Schreiner",
"author_email": "hschrein@cern.ch",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Programming Language :: C++",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Information Analysis",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Software Development",
"Topic :: Utilities",
"Typing :: Typed"
],
"description": "
\n\n# boost-histogram for Python\n\n[![Actions Status][actions-badge]][actions-link]\n[![Documentation Status][rtd-badge]][rtd-link]\n[![Code style: black][black-badge]][black-link]\n\n[![PyPI version][pypi-version]][pypi-link]\n[![Conda-Forge][conda-badge]][conda-link]\n[![PyPI platforms][pypi-platforms]][pypi-link]\n[](https://zenodo.org/badge/latestdoi/148885351)\n\n[![GitHub Discussion][github-discussions-badge]][github-discussions-link]\n[![Gitter][gitter-badge]][gitter-link]\n[![Scikit-HEP][sk-badge]](https://scikit-hep.org/)\n\n\nPython bindings for [Boost::Histogram][] ([source][Boost::Histogram\nsource]), a C++14 library. This is one of the [fastest libraries][] for\nhistogramming, while still providing the power of a full histogram object. See\n[what's new](./docs/CHANGELOG.md).\n\nFor end users interested in analysis, see [Hist][], a first-party\nanalyst-friendly histogram library that extends boost-histogram with named\naxes, many new shortcuts including UHI+, plotting shortcuts, and more.\n\n[uhi]: https://uhi.readthedocs.io\n## Usage\n\n\n\nText intro (click to expand)
\n\n\n```python\nimport boost_histogram as bh\n\n# Compose axis however you like; this is a 2D histogram\nhist = bh.Histogram(\n bh.axis.Regular(2, 0, 1),\n bh.axis.Regular(4, 0.0, 1.0),\n)\n\n# Filling can be done with arrays, one per dimension\nhist.fill(\n [0.3, 0.5, 0.2],\n [0.1, 0.4, 0.9],\n)\n\n# NumPy array view into histogram counts, no overflow bins\nvalues = hist.values()\n\n# Make a new histogram with just the second axis, summing over the first, and\n# rebinning the second into larger bins:\nh2 = hist[::sum, ::bh.rebin(2)]\n```\n\nSimplified list of features (click to expand)
\n\n* Many axis types (all support `metadata=...`)\n * `bh.axis.Regular(n, start, stop, ...)`: Make a regular axis. Options listed below.\n * `overflow=False`: Turn off overflow bin\n * `underflow=False`: Turn off underflow bin\n * `growth=True`: Turn on growing axis, bins added when out-of-range items added\n * `circular=True`: Turn on wrapping, so that out-of-range values wrap around into the axis\n * `transform=bh.axis.transform.Log`: Log spacing\n * `transform=bh.axis.transform.Sqrt`: Square root spacing\n * `transform=bh.axis.transform.Pow(v)`: Power spacing\n * See also the flexible [Function transform](https://boost-histogram.readthedocs.io/en/latest/usage/transforms.html)\n * `bh.axis.Integer(start, stop, *, underflow=True, overflow=True, growth=False, circular=False)`: Special high-speed version of `regular` for evenly spaced bins of width 1\n * `bh.axis.Variable([start, edge1, edge2, ..., stop], *, underflow=True, overflow=True, circular=False)`: Uneven bin spacing\n * `bh.axis.IntCategory([...], *, growth=False)`: Integer categories\n * `bh.axis.StrCategory([...], *, growth=False)`: String categories\n * `bh.axis.Boolean()`: A True/False axis\n* Axis features:\n * `.index(value)`: The index at a point (or points) on the axis\n * `.value(index)`: The value for a fractional bin (or bins) in the axis\n * `.bin(i)`: The bin edges (continuous axis) or a bin value (discrete axis)\n * `.centers`: The N bin centers (if continuous)\n * `.edges`: The N+1 bin edges (if continuous)\n * `.extent`: The number of bins (including under/overflow)\n * `.metadata`: Anything a user wants to store\n * `.traits`: The options set on the axis\n * `.size`: The number of bins (not including under/overflow)\n * `.widths`: The N bin widths\n* Many storage types\n * `bh.storage.Double()`: Doubles for weighted values (default)\n * `bh.storage.Int64()`: 64-bit unsigned integers\n * `bh.storage.Unlimited()`: Starts small, but can go up to unlimited precision ints or doubles.\n * `bh.storage.AtomicInt64()`: Threadsafe filling, experimental. Does not support growing axis in threads.\n * `bh.storage.Weight()`: Stores a weight and sum of weights squared.\n * `bh.storage.Mean()`: Accepts a sample and computes the mean of the samples (profile).\n * `bh.storage.WeightedMean()`: Accepts a sample and a weight. It computes the weighted mean of the samples.\n* Accumulators\n * `bh.accumulator.Sum`: High accuracy sum (Neumaier) - used by the sum method when summing a numerical histogram\n * `bh.accumulator.WeightedSum`: Tracks a weighted sum and variance\n * `bh.accumulator.Mean`: Running count, mean, and variance (Welfords's incremental algorithm)\n * `bh.accumulator.WeightedMean`: Tracks a weighted sum, mean, and variance (West's incremental algorithm)\n* Histogram operations\n * `h.ndim`: The number of dimensions\n * `h.size or len(h)`: The number of bins\n * `+`: Add two histograms (storages must match types currently)\n * `*=`: Multiply by a scaler (not all storages) (`hist * scalar` and `scalar * hist` supported too)\n * `/=`: Divide by a scaler (not all storages) (`hist / scalar` supported too)\n * `.kind`: Either `bh.Kind.COUNT` or `bh.Kind.MEAN`, depending on storage\n * `.sum(flow=False)`: The total count of all bins\n * `.project(ax1, ax2, ...)`: Project down to listed axis (numbers). Can also reorder axes.\n * `.to_numpy(flow=False, view=False)`: Convert to a NumPy style tuple (with or without under/overflow bins)\n * `.view(flow=False)`: Get a view on the bin contents (with or without under/overflow bins)\n * `.values(flow=False)`: Get a view on the values (counts or means, depending on storage)\n * `.variances(flow=False)`: Get the variances if available\n * `.counts(flow=False)`: Get the effective counts for all storage types\n * `.reset()`: Set counters to 0\n * `.empty(flow=False)`: Check to see if the histogram is empty (can check flow bins too if asked)\n * `.copy(deep=False)`: Make a copy of a histogram\n * `.axes`: Get the axes as a tuple-like (all properties of axes are available too)\n * `.axes[0]`: Get the 0th axis\n * `.axes.edges`: The lower values as a broadcasting-ready array\n * `.axes.centers`: The centers of the bins broadcasting-ready array\n * `.axes.widths`: The bin widths as a broadcasting-ready array\n * `.axes.metadata`: A tuple of the axes metadata\n * `.axes.size`: A tuple of the axes sizes (size without flow)\n * `.axes.extent`: A tuple of the axes extents (size with flow)\n * `.axes.bin(*args)`: Returns the bin edges as a tuple of pairs (continuous axis) or values (describe)\n * `.axes.index(*args)`: Returns the bin index at a value for each axis\n * `.axes.value(*args)`: Returns the bin value at an index for each axis\n* Indexing - Supports [UHI Indexing](https://uhi.readthedocs.io/en/latest/indexing.html)\n * Bin content access / setting\n * `v = h[b]`: Access bin content by index number\n * `v = h[{0:b}]`: All actions can be represented by `axis:item` dictionary instead of by position (mostly useful for slicing)\n * Slicing to get histogram or set array of values\n * `h2 = h[a:b]`: Access a slice of a histogram, cut portions go to flow bins if present\n * `h2 = h[:, ...]`: Using `:` and `...` supported just like NumPy\n * `h2 = h[::sum]`: Third item in slice is the \"action\"\n * `h[...] = array`: Set the bin contents, either include or omit flow bins\n * Special accessors\n * `bh.loc(v)`: Supply value in axis coordinates instead of bin number\n * `bh.underflow`: The underflow bin (use empty beginning on slice for slicing instead)\n * `bh.overflow`: The overflow bin (use empty end on slice for slicing instead)\n * Special actions (third item in slice)\n * `sum`: Remove axes via projection; if limits are given, use those\n * `bh.rebin(n)`: Rebin an axis\n* NumPy compatibility\n * `bh.numpy` provides faster [drop in replacements](https://boost-histogram.readthedocs.io/en/latest/usage/numpy.html) for NumPy histogram functions\n * Histograms follow the buffer interface, and provide `.view()`\n * Histograms can be converted to NumPy style output tuple with `.to_numpy()`\n* Details\n * All objects support copy/deepcopy/pickle\n * Fully statically typed, tested with MyPy.\n\n