hist

Histogramming for analysis powered by boost-histogram

https://github.com/scikit-hep/hist

Science Score: 64.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
    6 of 23 committers (26.1%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.2%) to scientific vocabulary

Keywords

histogram python scikit-hep

Keywords from Contributors

hep high-energy-physics jax closember qt asymptotic-formulas cls frequentist-statistics hep-ex histfactory
Last synced: 6 months ago · JSON representation ·

Repository

Histogramming for analysis powered by boost-histogram

Basic Info
  • Host: GitHub
  • Owner: scikit-hep
  • License: bsd-3-clause
  • Language: Python
  • Default Branch: main
  • Homepage: https://hist.readthedocs.io
  • Size: 4.49 MB
Statistics
  • Stars: 131
  • Watchers: 7
  • Forks: 28
  • Open Issues: 80
  • Releases: 28
Topics
histogram python scikit-hep
Created about 6 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Citation Support

README.md

histogram

Hist

Actions Status Documentation Status pre-commit.ci status

PyPI version Conda-Forge PyPI platforms DOI License

GitHub Discussion Gitter Binder Scikit-HEP SPEC 4 — Using and Creating Nightly Wheels

Hist is an analyst-friendly front-end for boost-histogram, designed for Python 3.9+ (3.6-3.8 users get older versions). See what's new.

Slideshow of features. See docs/banner_slides.md for text if the image is not readable.

Installation

You can install this library from PyPI with pip:

bash python3 -m pip install "hist[plot,fit]"

If you do not need the plotting features, you can skip the [plot] and/or [fit] extras. [fit] is not currently supported in WebAssembly.

Features

Hist currently provides everything boost-histogram provides, and the following enhancements:

  • Hist augments axes with names:

    • name= is a unique label describing each axis.
    • label= is an optional string that is used in plotting (defaults to name if not provided).
    • Indexing, projection, and more support named axes.
    • Experimental NamedHist is a Hist that disables most forms of positional access, forcing users to use only names.
  • The Hist class augments bh.Histogram with simpler construction:

    • flow=False is a fast way to turn off flow for the axes on construction.
    • Storages can be given by string.
    • storage= can be omitted, strings and storages can be positional.
    • data= can initialize a histogram with existing data.
    • Hist.from_columns can be used to initialize with a DataFrame or dict.
    • You can cast back and forth with boost-histogram (or any other extensions).
  • Hist support QuickConstruct, an import-free construction system that does not require extra imports:

    • Use Hist.new.<axis>().<axis>().<storage>().
    • Axes names can be full (Regular) or short (Reg).
    • Histogram arguments (like data=) can go in the storage.
  • Extended Histogram features:

    • Direct support for .name and .label, like axes.
    • .density() computes the density as an array.
    • .profile(remove_ax) can convert a ND COUNT histogram into a (N-1)D MEAN histogram.
    • .sort(axis) supports sorting a histogram by a categorical axis. Optionally takes a function to sort by.
    • .fill_flattened(...) will flatten and fill, including support for AwkwardArray.
    • .integrate(...), which takes the opposite arguments as .project.
  • Hist implements UHI+; an extension to the UHI (Unified Histogram Indexing) system designed for import-free interactivity:

    • Uses j suffix to switch to data coordinates in access or slices.
    • Uses j suffix on slices to rebin.
    • Strings can be used directly to index into string category axes.
  • Quick plotting routines encourage exploration:

    • .plot() provides 1D and 2D plots (or use plot1d(), plot2d())
    • .plot2d_full() shows 1D projects around a 2D plot.
    • .plot_ratio(...) make a ratio plot between the histogram and another histogram or callable.
    • .plot_pull(...) performs a pull plot.
    • .plot_pie() makes a pie plot.
    • .show() provides a nice str printout using Histoprint.
  • Stacks: work with groups of histograms with identical axes

    • Stacks can be created with h.stack(axis), using index or name of an axis (StrCategory axes ideal).
    • You can also create with hist.stacks.Stack(h1, h2, ...), or use from_iter or from_dict.
    • You can index a stack, and set an entry with a matching histogram.
    • Stacks support .plot() and .show(), with names (plot labels default to original axes info).
    • Stacks pass through .project, *, +, and -.
  • New modules

    • intervals supports frequentist coverage intervals.
  • Notebook ready: Hist has gorgeous in-notebook representation.

    • No dependencies required

Usage

```python from hist import Hist

Quick construction, no other imports needed:

h = ( Hist.new.Reg(10, 0, 1, name="x", label="x-axis") .Var(range(10), name="y", label="y-axis") .Int64() )

Filling by names is allowed:

h.fill(y=[1, 4, 6], x=[0.3, 0.5, 0.2])

Names can be used to manipulate the histogram:

h.project("x") h[{"y": 0.5j + 3, "x": 5j}]

You can access data coordinates or rebin with a j suffix:

h[0.3j:, ::2j] # x from .3 to the end, y is rebinned by 2

Elegant plotting functions:

h.plot() h.plot2dfull() h.plotpull(Callable) ```

Development

From a git checkout, either use nox, or run:

bash python -m pip install -e .[dev]

See Contributing guidelines for information on setting up a development environment.

Contributors

We would like to acknowledge the contributors that made this project possible (emoji key): <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore-start --> <!-- markdownlint-disable -->


Henry Schreiner

🚧 💻 📖

Nino Lau

🚧 💻 📖

Chris Burr

💻

Nick Amin

💻

Eduardo Rodrigues

💻

Andrzej Novak

💻

Matthew Feickert

💻

Kyle Cranmer

📖

Daniel Antrim

💻

Nicholas Smith

💻

Michael Eliachevitch

💻

Jonas Eschle

📖

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.

Owner

  • Name: Scikit-HEP Project
  • Login: scikit-hep
  • Kind: organization
  • Email: scikit-hep-forum@googlegroups.com

A community project for High Energy Physics data analysis in Python

Citation (CITATION.cff)

cff-version: 1.2.0
message: "Please cite the following works when using this software."
type: software
title: "hist"
abstract: "Hist is an analyst-friendly front-end for boost-histogram, designed for Python 3.7+."
authors:
- family-names: "Schreiner"
  given-names: "Henry"
  orcid: "https://orcid.org/0000-0002-7833-783X"
  affiliation: "Princeton University"
- family-names: "Liu"
  given-names: "Shuo"
  affiliation: "Columbia University in the City of New York"
- family-names: "Goel"
  given-names: "Aman"
  orcid: "https://orcid.org/0000-0003-3567-2096"
  affiliation: "University of Delhi"
doi: 10.5281/zenodo.4057112
repository-code: "https://github.com/scikit-hep/hist"
url: "https://hist.readthedocs.io/"
keywords:
  - python
  - histogram
  - scikit-hep
license: "BSD-3-Clause"

GitHub Events

Total
  • Create event: 22
  • Release event: 2
  • Issues event: 15
  • Watch event: 3
  • Delete event: 23
  • Issue comment event: 26
  • Push event: 61
  • Pull request review comment event: 2
  • Pull request event: 55
  • Pull request review event: 3
  • Fork event: 4
Last Year
  • Create event: 22
  • Release event: 2
  • Issues event: 15
  • Watch event: 3
  • Delete event: 23
  • Issue comment event: 26
  • Push event: 61
  • Pull request review comment event: 2
  • Pull request event: 55
  • Pull request review event: 3
  • Fork event: 4

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 470
  • Total Committers: 23
  • Avg Commits per committer: 20.435
  • Development Distribution Score (DDS): 0.572
Past Year
  • Commits: 27
  • Committers: 6
  • Avg Commits per committer: 4.5
  • Development Distribution Score (DDS): 0.593
Top Committers
Name Email Commits
Henry Schreiner h****r@c****h 201
pre-commit-ci[bot] 6****] 110
N!no n****l@g****m 61
Aman Goel a****5@g****m 28
dependabot[bot] 4****] 25
allcontributors[bot] 4****] 10
Matthew Feickert m****t@c****h 9
Andrzej Novak n****j@g****m 6
Eduardo Rodrigues e****s@c****h 3
Saransh s****1@g****m 2
Lindsey Gray l****y@g****m 2
Fabrice MUKARAGE 7****E 2
Sourcery AI u****n 1
Alexander Puck Neuwirth A****y 1
Angus Hollands g****5@g****m 1
Chris Burr c****r 1
Daniel Antrim d****3@g****m 1
Jonas Eschle j****e@c****h 1
Kyle Cranmer k****r@c****h 1
Michael Eliachevitch m****h@p****e 1
Nicholas Smith n****h@c****h 1
Nick Amin a****j@g****m 1
sourcery-ai[bot] 5****] 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 63
  • Total pull requests: 185
  • Average time to close issues: 6 months
  • Average time to close pull requests: 13 days
  • Total issue authors: 37
  • Total pull request authors: 18
  • Average comments per issue: 1.71
  • Average comments per pull request: 0.32
  • Merged pull requests: 154
  • Bot issues: 0
  • Bot pull requests: 94
Past Year
  • Issues: 6
  • Pull requests: 54
  • Average time to close issues: 6 days
  • Average time to close pull requests: 16 days
  • Issue authors: 5
  • Pull request authors: 10
  • Average comments per issue: 1.67
  • Average comments per pull request: 0.09
  • Merged pull requests: 36
  • Bot issues: 0
  • Bot pull requests: 21
Top Authors
Issue Authors
  • andrzejnovak (10)
  • henryiii (4)
  • goi42 (4)
  • matthewfeickert (3)
  • yimuchen (3)
  • yurivict (3)
  • L61 (2)
  • jpivarski (2)
  • alexander-held (2)
  • bfonta (2)
  • acampove (2)
  • Dominic-Stafford (2)
  • mpad (1)
  • DraTeots (1)
  • andreypz (1)
Pull Request Authors
  • pre-commit-ci[bot] (67)
  • henryiii (59)
  • dependabot[bot] (36)
  • matthewfeickert (6)
  • amangoel185 (5)
  • andrzejnovak (5)
  • lgray (3)
  • Saransh-cpp (2)
  • Jammf (2)
  • jonas-eschle (2)
  • harry-patcher (2)
  • APN-Pucky (2)
  • LovelyBuggies (1)
  • agoose77 (1)
  • fabriceMUKARAGE (1)
Top Labels
Issue Labels
enhancement (26) documentation (11) good first issue (10) hacktoberfest (1) question (1)
Pull Request Labels
dependencies (37) needs changelog (23) documentation (5) enhancement (2)

Packages

  • Total packages: 4
  • Total downloads:
    • pypi 362,004 last-month
  • Total docker downloads: 122
  • Total dependent packages: 23
    (may contain duplicates)
  • Total dependent repositories: 64
    (may contain duplicates)
  • Total versions: 71
  • Total maintainers: 4
pypi.org: hist

Hist classes and utilities

  • Versions: 34
  • Dependent Packages: 18
  • Dependent Repositories: 55
  • Downloads: 362,004 Last month
  • Docker Downloads: 122
Rankings
Dependent packages count: 0.7%
Downloads: 0.9%
Dependent repos count: 2.0%
Docker downloads count: 2.3%
Average: 3.5%
Stargazers count: 6.7%
Forks count: 8.2%
Maintainers (3)
Last synced: 6 months ago
proxy.golang.org: github.com/scikit-hep/hist
  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 6.4%
Average: 6.6%
Dependent repos count: 6.8%
Last synced: 6 months ago
conda-forge.org: hist
  • Versions: 14
  • Dependent Packages: 4
  • Dependent Repositories: 9
Rankings
Dependent repos count: 11.6%
Dependent packages count: 12.5%
Average: 23.8%
Stargazers count: 33.2%
Forks count: 38.0%
Last synced: 7 months ago
spack.io: py-hist

Hist classes and utilities

  • Versions: 2
  • Dependent Packages: 1
  • Dependent Repositories: 0
Rankings
Dependent repos count: 0.0%
Stargazers count: 17.9%
Forks count: 22.4%
Average: 24.4%
Dependent packages count: 57.3%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/cd.yml actions
  • actions/checkout v3 composite
  • actions/download-artifact v3 composite
  • actions/upload-artifact v3 composite
  • pypa/gh-action-pypi-publish v1.6.4 composite
.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • pre-commit/action v3.0.0 composite
.github/workflows/pr.yml actions
  • actions/labeler main composite
pyproject.toml pypi
  • boost-histogram ~=1.3.1
  • histoprint >=2.2.0
  • numpy >=1.14.5
  • typing-extensions >=3.7;python_version<"3.8"