Hist classes and utilities
Project description
Hist
Hist is a analyst friendly front-end for boost-histogram.
Installation
You can install this library from PyPI with pip:
python -m pip install hist
Usage
import hist
# You can create a histogram like this.
h = (
hist.Hist()
.Reg(10, 0 ,1, name="x", label="x-axis")
.Variable(range(10), name="y", label="y-axis")
.Int64()
)
# Filling by names is allowed in hist.
hist.fill(y=[1, 4, 6], x=[3, 5, 2])
# New ways to manipulate the histogram.
h.project("x")
h[{"y": 1j + 3, "x": 5j}]
...
# Elegant plotting functions.
h.plot()
h.plot2d_full()
h.plot_pull(Callable)
...
Features
-
Hist augments metadata by adding names to axes; these are highly recommend and will help you track axes. There is also a special
NamedHist
, which will enforce all hist axes have names, and all axes will require named access.name=
is a unique label describing each axislabel=
is an optional string that is used in plotting (defaults to name if not provided)- Indexing, projection, and more support named axes.
-
The
Hist
class augments thebh.Histogram
class with the following shortcuts, designed for interactive exploration without extensive imports:- Optional import-free construction system
- Quick import-free data-coordinates and rebin syntax (use a j suffix for numbers, or strings directly in indexing expressions)
-
Quick plotting routines encourage exploration:
.plot()
provides 1D and 2D plots.plot2d_full()
shows 1D projects around a 2D plot.plot_pull(...)
performs a pull plot
Development
python -m pip install hist
See CONTRIBUTING.md for information on setting up a development environment.
Contributors
We would like to acknowledge the contributors that made this project possible (emoji key):
Henry Schreiner 🚧 💻 📖 |
Nino Lau 🚧 💻📖 |
This project follows the all-contributors specification.
Talks
Acknowledgements
This library was primarily developed by Henry Schreiner and Nino Lau.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hist-2.0.0b1.tar.gz
.
File metadata
- Download URL: hist-2.0.0b1.tar.gz
- Upload date:
- Size: 225.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10ee38b4c4c84eaf22c584e2de93e5e663dd7ea1e64380b37a01fb49a1c3f614 |
|
MD5 | 66da5b4761bda4389e4658380829b825 |
|
BLAKE2b-256 | 91cf51ad6eb594c2d8b4a79dad2561c86a8cf468b24fa3356f0637a22a331b02 |
File details
Details for the file hist-2.0.0b1-py3-none-any.whl
.
File metadata
- Download URL: hist-2.0.0b1-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 741ae6e6cb448cb520cee3dd5ef365c784922aa2bbf1bba7598bc09c03bd3d09 |
|
MD5 | 17607b1f3a9897411cf61a67e28e2efa |
|
BLAKE2b-256 | 791c0c1cb65398e9c47f060d04b79899f177a94cd4fcc2db6c5dd5ab8bc86510 |