Skip to content

Commit

Permalink
Merge branch 'main' into nino/feat/numba-fill
Browse files Browse the repository at this point in the history
  • Loading branch information
LovelyBuggies committed Aug 20, 2021
2 parents b25c3cf + 6544230 commit 74cb941
Show file tree
Hide file tree
Showing 72 changed files with 8,049 additions and 757 deletions.
18 changes: 18 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@
"contributions": [
"doc"
]
},
{
"login": "dantrim",
"name": "Daniel Antrim",
"avatar_url": "https://avatars.githubusercontent.com/u/7841565?v=4",
"profile": "http://dantrim.github.io",
"contributions": [
"code"
]
},
{
"login": "nsmith-",
"name": "Nicholas Smith",
"avatar_url": "https://avatars.githubusercontent.com/u/6587412?v=4",
"profile": "https://github.com/nsmith-",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
33 changes: 29 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,36 @@ detailed description of best practices for developing Scikit-HEP packages.

[skhep-dev-intro]: https://scikit-hep.org/developer/intro

# Setting up a development environment
# Contributing

## Setting up a development environment

### Nox

The fastest way to start with development is to use nox. If you don't have nox,
you can use `pipx run nox` to run it without installing, or `pipx install nox`.
If you don't have pipx (pip for applications), then you can install with with
`pip install pipx` (the only case were installing an application with regular
pip is reasonable). If you use macOS, then pipx and nox are both in brew, use
`brew install pipx nox`.

To use, run `nox`. This will lint and test using every installed version of
Python on your system, skipping ones that are not installed. You can also run
specific jobs:

```console
$ nox -s lint # Lint only
$ nox -s tests-3.9 # Python 3.9 tests only
$ nox -s docs -- serve # Build and serve the docs
$ nox -s build # Make an SDist and wheel
```

Nox handles everything for you, including setting up an temporary virtual
environment for each run.

### PyPI

You can set up a development environment using PyPI.
For extended development, you can set up a development environment using PyPI.

```bash
$ python3 -m venv venv
Expand All @@ -29,7 +54,7 @@ $ conda activate hist
(hist)$ python -m ipykernel install --name hist
```

# Post setup
## Post setup

You should prepare pre-commit, which will help you by checking that commits
pass required checks:
Expand All @@ -42,7 +67,7 @@ pre-commit install # Will install a pre-commit hook into the git repo
You can also/alternatively run `pre-commit run` (changes only) or `pre-commit
run --all-files` to check even without installing the hook.

# Testing
## Testing

Use PyTest to run the unit checks:

Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
python-version:
- 3.6
- 3.7
- 3.8
- 3.9
name: Check Python ${{ matrix.python-version }}
Expand All @@ -40,8 +40,11 @@ jobs:
- name: Test package
run: python -m pytest

- name: Temporarily pin mplhep
run: echo "mplhep<=0.3.7" >> constraints.txt

- name: Install plotting requirements too
run: python -m pip install -e ".[test,plot]"
run: python -m pip install -e ".[test,plot]" -c constraints.txt

- name: Test plotting too
run: python -m pytest --mpl
19 changes: 10 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 21.5b2
rev: 21.7b0
hooks:
- id: black

Expand All @@ -19,15 +19,15 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/PyCQA/isort
rev: 5.8.0
rev: 5.9.3
hooks:
- id: isort

- repo: https://github.com/asottile/pyupgrade
rev: v2.19.0
rev: v2.23.3
hooks:
- id: pyupgrade
args: [--py36-plus]
args: [--py37-plus]

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.17.0
Expand All @@ -36,13 +36,13 @@ repos:

# Notebook formatting
- repo: https://github.com/nbQA-dev/nbQA
rev: 0.10.0
rev: 1.1.0
hooks:
- id: nbqa-black
additional_dependencies: [black==20.8b1]
- id: nbqa-pyupgrade
additional_dependencies: [pyupgrade==2.7.4]
args: ["--py36-plus"]
additional_dependencies: [pyupgrade==2.12.0]
args: ["--py37-plus"]

- repo: https://github.com/pycqa/flake8
rev: 3.9.2
Expand All @@ -52,11 +52,12 @@ repos:
additional_dependencies: [flake8-bugbear]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
rev: v0.910
hooks:
- id: mypy
files: ^src
additional_dependencies: ["numpy>=1.20", "matplotlib>=3.3", "boost-histogram~=1.0.1"]
args: []
additional_dependencies: ["numpy==1.21.*", "matplotlib>=3.3", "boost-histogram~=1.0.1", "uhi~=0.3.0"]

- repo: https://github.com/mgedmin/check-manifest
rev: "0.46"
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
[![pre-commit.ci status][pre-commit-badge]][pre-commit-link]
[![Code style: black][black-badge]][black-link]


[![PyPI version][pypi-version]][pypi-link]
[![Conda-Forge][conda-badge]][conda-link]
[![PyPI platforms][pypi-platforms]][pypi-link]
Expand All @@ -19,7 +18,7 @@

Hist is an analyst-friendly front-end for
[boost-histogram](https://github.com/scikit-hep/boost-histogram), designed for
Python 3.7+ (3.6 users get version 2.3). See [what's new](https://hist.readthedocs.io/en/latest/changelog.html).
Python 3.7+ (3.6 users get version 2.4). See [what's new](https://hist.readthedocs.io/en/latest/changelog.html).

## Installation

Expand Down Expand Up @@ -110,7 +109,7 @@ From a git checkout, run:
python -m pip install -e .[dev]
```

See [CONTRIBUTING.md](./.github/CONTRIBUTING.md) for information on setting up a development environment.
See [Contributing](https://hist.readthedocs.io/en/latest/contributing.html) guidelines for information on setting up a development environment.

## Contributors

Expand All @@ -130,6 +129,8 @@ We would like to acknowledge the contributors that made this project possible ([
</tr>
<tr>
<td align="center"><a href="http://theoryandpractice.org"><img src="https://avatars.githubusercontent.com/u/4458890?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kyle Cranmer</b></sub></a><br /><a href="https://github.com/scikit-hep/hist/commits?author=cranmer" title="Documentation">📖</a></td>
<td align="center"><a href="http://dantrim.github.io"><img src="https://avatars.githubusercontent.com/u/7841565?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Daniel Antrim</b></sub></a><br /><a href="https://github.com/scikit-hep/hist/commits?author=dantrim" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/nsmith-"><img src="https://avatars.githubusercontent.com/u/6587412?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nicholas Smith</b></sub></a><br /><a href="https://github.com/scikit-hep/hist/commits?author=nsmith-" title="Code">💻</a></td>
</tr>
</table>

Expand All @@ -138,14 +139,12 @@ We would like to acknowledge the contributors that made this project possible ([

<!-- ALL-CONTRIBUTORS-LIST:END -->



This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.

## Talks

* [2020-07-07 SciPy Proceedings](https://www.youtube.com/watch?v=ERraTfHkPd0&list=PLYx7XA2nY5GfY4WWJjG5cQZDc7DIUmn6Z&index=4)
* [2020-07-17 PyHEP2020](https://indico.cern.ch/event/882824/contributions/3931299/)
- [2020-07-07 SciPy Proceedings](https://www.youtube.com/watch?v=ERraTfHkPd0&list=PLYx7XA2nY5GfY4WWJjG5cQZDc7DIUmn6Z&index=4)
- [2020-07-17 PyHEP2020](https://indico.cern.ch/event/882824/contributions/3931299/)

---

Expand All @@ -155,7 +154,6 @@ 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.


[actions-badge]: https://github.com/scikit-hep/hist/workflows/CI/badge.svg
[actions-link]: https://github.com/scikit-hep/hist/actions
[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg
Expand Down
Binary file added docs/_images/axis_category.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/axis_circular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/axis_integer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/axis_regular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/axis_variable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/ex_hist_density.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_images/histogram_design.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/_src/images/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.pdf
*.png
14 changes: 14 additions & 0 deletions docs/_src/images/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SRC = $(wildcard *.tex)
PDFs = $(patsubst %.tex, %.pdf, $(SRC))
PNGs = $(patsubst %.tex, %.png, $(SRC))

.PHONY: all

all: $(PNGs)

%.pdf: %.tex Makefile
pdflatex $<
@rm $*.aux $*.log

%.png: %.pdf
convert -density 150 $< -quality 95 -colorspace Gray $@
39 changes: 39 additions & 0 deletions docs/_src/images/axis_category.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, calc, decorations.pathreplacing}
\usepackage{units}
\usepackage[graphics, active, tightpage]{preview}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage[outline]{contour}
\contourlength{1.2pt}
\usepackage{ocr}
\PreviewEnvironment{tikzpicture}

\pgfplotsset{compat=1.16}

\definecolor{presDark}{RGB}{39,1,136}
\definecolor{presDark2}{RGB}{87,80,149}
\definecolor{presLight}{RGB}{139,131,215}
\definecolor{presLight2}{RGB}{0,129,203}

\definecolor{presHighlight}{RGB}{215,50,50}

\begin{document}

\begin{tikzpicture}[
xscale=4,
every path/.style={thick}]
\draw (0,0) -- (1,0);
\foreach \i in {0, .2, ..., 1} {
\draw (\i,0) -- (\i,.2);
}
\node at (.1, 0) [above] {2};
\node at (.3, 0) [above] {5};
\node at (.5, 0) [above] {8};
\node at (.7, 0) [above] {3};
\node at (.9, 0) [above] {7};
\node at (.5,0) [below] {\verb|hist.axis.IntCategory([2,5,8,3,7])|};
\end{tikzpicture}

\end{document}
37 changes: 37 additions & 0 deletions docs/_src/images/axis_circular.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, calc, decorations.pathreplacing}
\usepackage{units}
\usepackage[graphics, active, tightpage]{preview}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage[outline]{contour}
\contourlength{1.2pt}
\usepackage{ocr}
\PreviewEnvironment{tikzpicture}

\pgfplotsset{compat=1.16}

\definecolor{presDark}{RGB}{39,1,136}
\definecolor{presDark2}{RGB}{87,80,149}
\definecolor{presLight}{RGB}{139,131,215}
\definecolor{presLight2}{RGB}{0,129,203}

\definecolor{presHighlight}{RGB}{215,50,50}

\begin{document}

\begin{tikzpicture}[
every path/.style={thick}]
\draw (0,0) circle (.75);
\foreach \i in {0, 45, ..., 360} {
\draw (\i:.75) -- (\i:.95);
}
\node at (0:.95) [right] {$\pi/2$};
\node at (90:.95) [above] {0, $2\pi$};
\node at (180:.95) [left] {$\pi$};
\node at (270:.95) [below] {$3\pi/3$};
\node at (0,-1.3) [below] {\verb|hist.axis.Regular(8,0,2*np.pi, circular=True)|};
\end{tikzpicture}

\end{document}
37 changes: 37 additions & 0 deletions docs/_src/images/axis_integer.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, calc, decorations.pathreplacing}
\usepackage{units}
\usepackage[graphics, active, tightpage]{preview}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage[outline]{contour}
\contourlength{1.2pt}
\usepackage{ocr}
\PreviewEnvironment{tikzpicture}

\pgfplotsset{compat=1.16}

\definecolor{presDark}{RGB}{39,1,136}
\definecolor{presDark2}{RGB}{87,80,149}
\definecolor{presLight}{RGB}{139,131,215}
\definecolor{presLight2}{RGB}{0,129,203}

\definecolor{presHighlight}{RGB}{215,50,50}

\begin{document}

\begin{tikzpicture}[
xscale=4,
every path/.style={thick}]
\draw (0,0) -- (1,0);
\foreach \i in {0, .2, ..., 1} {
\draw (\i,0) -- (\i,.2);
}
\foreach \i in {0,...,4} {
\node at (\i/5 + .1, 0) [above] {\i};
}
\node at (.5,0) [below] {\verb|hist.axis.Integer(0,5)|};
\end{tikzpicture}

\end{document}
37 changes: 37 additions & 0 deletions docs/_src/images/axis_regular.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, calc, decorations.pathreplacing}
\usepackage{units}
\usepackage[graphics, active, tightpage]{preview}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage[outline]{contour}
\contourlength{1.2pt}
\usepackage{ocr}
\PreviewEnvironment{tikzpicture}

\pgfplotsset{compat=1.16}

\definecolor{presDark}{RGB}{39,1,136}
\definecolor{presDark2}{RGB}{87,80,149}
\definecolor{presLight}{RGB}{139,131,215}
\definecolor{presLight2}{RGB}{0,129,203}

\definecolor{presHighlight}{RGB}{215,50,50}

\begin{document}

\begin{tikzpicture}[
xscale=4,
every path/.style={thick}]
\draw (0,0) -- (1,0);
\foreach \i in {0, .1, ..., 1.1} {
\draw (\i,0) -- (\i,.2);
}
\node at (0,.2) [above] {0};
\node at (.5,.2) [above] {0.5};
\node at (1,.2) [above] {1};
\node at (.5,0) [below] {\verb|hist.axis.Regular(10,0,1)|};
\end{tikzpicture}

\end{document}
Loading

0 comments on commit 74cb941

Please sign in to comment.