You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,15 +40,19 @@ All the normal best-practices for Python apply; you should be in a virtual envir
40
40
import boost_histogram as bh
41
41
42
42
# Compose axis however you like; this is a 2D histogram
43
-
hist = bh.Histogram(bh.axis.Regular(2, 0, 1),
44
-
bh.axis.Regular(4, 0.0, 1.0))
43
+
hist = bh.Histogram(
44
+
bh.axis.Regular(2, 0, 1),
45
+
bh.axis.Regular(4, 0.0, 1.0),
46
+
)
45
47
46
48
# Filling can be done with arrays, one per dimension
47
-
hist.fill([.3, .5, .2],
48
-
[.1, .4, .9])
49
+
hist.fill(
50
+
[0.3, 0.5, 0.2], [0.1, 0.4, 0.9]
51
+
)
49
52
50
53
# Numpy array view into histogram counts, no overflow bins
51
54
counts = hist.view()
55
+
52
56
```
53
57
54
58
## Features
@@ -66,6 +70,7 @@ counts = hist.view()
66
70
*`bh.axis.Integer(start, stop, underflow=True, overflow=True, growth=False)`: Special high-speed version of `regular` for evenly spaced bins of width 1
67
71
*`bh.axis.Variable([start, edge1, edge2, ..., stop], underflow=True, overflow=True)`: Uneven bin spacing
68
72
*`bh.axis.Category([...], growth=False)`: Integer or string categories
73
+
*`bh.axis.Boolean()`: A True/False axis [(known issue with slicing/selection in 0.8.0)]()
69
74
* Axis features:
70
75
*`.index(value)`: The index at a point (or points) on the axis
71
76
*`.value(index)`: The value for a fractional bin (or bins) in the axis
@@ -91,7 +96,7 @@ counts = hist.view()
91
96
*`bh.accumulator.Mean`: Running count, mean, and variance (Welfords's incremental algorithm)
92
97
*`bh.accumulator.WeightedMean`: Tracks a weighted sum, mean, and variance (West's incremental algorithm)
93
98
* Histogram operations
94
-
*`h.rank`: The number of dimensions
99
+
*`h.ndim`: The number of dimensions
95
100
*`h.size or len(h)`: The number of bins
96
101
*`+`: Add two histograms (storages must match types currently)
97
102
*`*=`: Multiply by a scaler (not all storages) (`hist * scalar` and `scalar * hist` supported too)
@@ -121,14 +126,14 @@ counts = hist.view()
121
126
* Slicing to get histogram or set array of values
122
127
*`h2 = h[a:b]`: Access a slice of a histogram, cut portions go to flow bins if present
123
128
*`h2 = h[:, ...]`: Using `:` and `...` supported just like Numpy
124
-
*`h2 = h[::bh.sum]`: Third item in slice is the "action"
129
+
*`h2 = h[::sum]`: Third item in slice is the "action"
125
130
*`h[...] = array`: Set the bin contents, either include or omit flow bins
126
131
* Special accessors
127
132
*`bh.loc(v)`: Supply value in axis coordinates instead of bin number
128
133
*`bh.underflow`: The underflow bin (use empty beginning on slice for slicing instead)
129
134
*`bh.overflow`: The overflow bin (use empty end on slice for slicing instead)
130
135
* Special actions (third item in slice)
131
-
*`bh.sum`: Remove axes via projection; if limits are given, use those
136
+
*`sum`: Remove axes via projection; if limits are given, use those
132
137
*`bh.rebin(n)`: Rebin an axis
133
138
* NumPy compatibility
134
139
*`bh.numpy` provides faster [drop in replacements](https://boost-histogram.readthedocs.io/en/latest/usage/numpy.html) for NumPy histogram functions
@@ -156,7 +161,7 @@ These are the supported platforms for which wheels are produced using [cibuildwh
* manylinux1: Using a custom docker container with GCC 9.2; should work but can't be called directly other compiled extensions unless they do the same thing (think that's the main caveat). Supporting 32 bits because it's there.
@@ -170,7 +175,7 @@ If you are on a Linux system that is not part of the "many" in manylinux, such a
170
175
171
176
#### Conda-Forge
172
177
173
-
The boost-histogram package is available on Conda-Forge, as well. All supported versions are available with the exception of Windows + Python 2.7, which cannot built due to the age of the compiler and conda-forge policies. Please use Pip if you *really* need Python 2.7 on Windows. You will also need the VS 2015 distributable, as described above.
178
+
The boost-histogram package is available on Conda-Forge, as well. All supported versions are available with the exception of Python 2.7, which is no longer supported by conda-forge direclty. If you really need boost-histogram + Conda + Python 2.7, please open an issue.
174
179
175
180
```bash
176
181
conda install -c conda-forge boost-histogram
@@ -225,9 +230,12 @@ This project follows the [all-contributors](https://github.com/all-contributors/
225
230
226
231
The [official documentation is here](https://boost-histogram.readthedocs.io/en/latest/index.html), and includes a [quickstart](https://boost-histogram.readthedocs.io/en/latest/usage/quickstart.html).
*[2019-10-17 PyHEP Histogram session](https://indico.cern.ch/event/833895/contributions/3577833/) - [repo with talks and workbook](https://github.com/henryiii/pres-bhandhist)
0 commit comments