Skip to content

Commit 6cca24b

Browse files
committed
added appveyor badge and some details
1 parent 2c40e25 commit 6cca24b

File tree

1 file changed

+14
-48
lines changed

1 file changed

+14
-48
lines changed

README.md

Lines changed: 14 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
**Fast multi-dimensional histogram with convenient interface for C++11 and Python**
44

5-
[![Build Status](https://travis-ci.org/HDembinski/histogram.svg?branch=master)](https://travis-ci.org/HDembinski/histogram?branch=master) [![Coverage Status](https://coveralls.io/repos/github/HDembinski/histogram/badge.svg?branch=master)](https://coveralls.io/github/HDembinski/histogram?branch=master)
5+
[![Build Status Linux](https://travis-ci.org/HDembinski/histogram.svg?branch=master)](https://travis-ci.org/HDembinski/histogram?branch=master)
6+
[![Build status Windows](https://ci.appveyor.com/api/projects/status/6a15ga3upiv9ca51/branch/master?svg=true)](https://ci.appveyor.com/project/HDembinski/histogram/branch/master)
7+
[![Coverage Status](https://coveralls.io/repos/github/HDembinski/histogram/badge.svg?branch=master)](https://coveralls.io/github/HDembinski/histogram?branch=master)
68

79
This `C++11` library provides a multi-dimensional [histogram](https://en.wikipedia.org/wiki/Histogram) class for your statistics needs. The library is **header-only**, if you don't need the Python module.
810

@@ -12,7 +14,7 @@ Tested platforms:
1214
- Windows: Visual Studio 2015
1315
- Python: 2.7 and 3.6
1416

15-
The histogram is very customisable through policy classes, but the default policies were carefully designed so that most users won't need to customize anything. In the standard configuration, this library offers a unique safety guarantee not found elsewhere: bin counts *cannot overflow* or *be capped*. While being safe to use, the library also has a convenient interface, is memory conserving, and faster than other libraries (see benchmarks).
17+
The histogram is very customisable through policy classes, but the default policies were carefully designed so that most users don't need to customize anything. In the standard configuration, this library offers a unique safety guarantee not found elsewhere: bin counts *cannot overflow* or *be capped*. While being safe to use, the library also has a convenient interface, is memory conserving, and faster than other libraries (see benchmarks).
1618

1719
The histogram class comes in two variants which share a common interface. The *static* variant uses compile-time information to provide maximum performance, at the cost of runtime flexibility and potentially larger executables. The *dynamic* variant is a bit slower, but configurable at run-time and may produce smaller executables. Python bindings for the latter are included, implemented with `Boost.Python`.
1820

@@ -66,11 +68,9 @@ To run the tests, do `make test`.
6668

6769
### Trouble-shooting when compiling with Python support
6870

69-
If you compile the library with Python support (the default if Python is found) and have several versions of Python installed, `cmake` will pick the latest Python version by default. Please make sure that this is the same version that Boost.Python and Boost.Numpy were compiled against, otherwise you will get strange errors during compilation and/or at runtime. You can force `cmake` to pick a specific Python version with the PYTHON_VERSION flag. For example, to force the use of Python2.7, do: `cmake -DPYTHON_VERSION=2.7 ../histogram/build`
71+
If you compile the library with Python support (the default, when you compile at all) and have several versions of Python installed, `cmake` will use the Python interpreter that is accessible as `python` on your system, and will use the headers and libraries of this version. Please make sure that this is the same version that Boost.Python and Boost.Numpy were compiled against, otherwise you will get strange errors during compilation and/or at runtime! You can force `cmake` to pick a specific Python interpreter with the PYTHON_EXECUTABLE flag. For example, to force the use of `python3`, do: `cmake ../histogram/build -DPYTHON_EXECUTABLE=python3`
7072

71-
In the future, the build system may be able to pick the right Python version automatically, but right now it has to be done manually.
72-
73-
If you installed Boost with `brew` on OSX, also have a look at this [Stackoverflow](https://stackoverflow.com/questions/33653001/unable-to-link-against-boost-python-on-os-x) question.
73+
If you installed Boost with `brew` on OSX and have trouble with the build, have a look at this [Stackoverflow](https://stackoverflow.com/questions/33653001/unable-to-link-against-boost-python-on-os-x) question.
7474

7575
## Code examples
7676

@@ -85,39 +85,13 @@ int main(int, char**) {
8585
namespace bh = boost::histogram;
8686
using namespace bh::literals; // enables _c suffix
8787

88-
/*
89-
create a static 1d-histogram with an axis that has 6 equidistant
90-
bins on the real line from -1.0 to 2.0, and label it as "x"
91-
*/
9288
auto h = bh::make_static_histogram(
9389
bh::axis::regular<>(6, -1.0, 2.0, "x")
9490
);
9591

96-
// fill histogram with data, typically this happens in a loop
97-
// STL algorithms are supported
98-
auto data = { -0.5, 1.1, 0.3, 1.7 };
92+
auto data = { -0.4, 1.1, 0.3, 1.7 };
9993
std::for_each(data.begin(), data.end(), h);
10094

101-
/*
102-
a regular axis is a sequence of semi-open bins; extra under- and
103-
overflow bins extend the axis in the default configuration
104-
index : -1 0 1 2 3 4 5 6
105-
bin edge: -inf -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 inf
106-
*/
107-
h(-1.5); // put in underflow bin -1
108-
h(-1.0); // put in bin 0, bin interval is semi-open
109-
h(2.0); // put in overflow bin 6, bin interval is semi-open
110-
h(20.0); // put in overflow bin 6
111-
112-
/*
113-
do a weighted fill using bh::weight, a wrapper for any type,
114-
which may appear at the beginning of the argument list
115-
*/
116-
h(bh::weight(1.0), 0.1);
117-
118-
/*
119-
iterate over bins with a fancy histogram iterator
120-
*/
12195
for (auto it = h.begin(); it != h.end(); ++it) {
12296
const auto bin = it.bin(0_c);
12397
std::cout << "bin " << it.idx(0) << " x in ["
@@ -129,14 +103,14 @@ int main(int, char**) {
129103

130104
/* program output: (note that under- and overflow bins appear at the end)
131105

132-
bin 0 x in [-1.0, -0.5): 1 +/- 1
133-
bin 1 x in [-0.5, 0.0): 0 +/- 0
106+
bin 0 x in [-1.0, -0.5): 0 +/- 0
107+
bin 1 x in [-0.5, 0.0): 1 +/- 1
134108
bin 2 x in [ 0.0, 0.5): 1 +/- 1
135109
bin 3 x in [ 0.5, 1.0): 0 +/- 0
136110
bin 4 x in [ 1.0, 1.5): 1 +/- 1
137-
bin 5 x in [ 1.5, 2.0): 0 +/- 0
138-
bin 6 x in [ 2.0, inf): 2 +/- 1.41421
139-
bin -1 x in [-inf, -1): 1 +/- 1
111+
bin 5 x in [ 1.5, 2.0): 1 +/- 1
112+
bin 6 x in [ 2.0, inf): 0 +/- 0
113+
bin -1 x in [-inf, -1): 0 +/- 0
140114

141115
*/
142116
}
@@ -148,22 +122,14 @@ Example 2: Fill a 2d-histogram in Python with data in Numpy arrays
148122
import histogram as bh
149123
import numpy as np
150124
151-
# create 2d-histogram over polar coordinates, with
152-
# 10 equidistant bins in radius from 0 to 5 and
153-
# 4 equidistant bins in polar angle
154125
h = bh.histogram(bh.axis.regular(10, 0.0, 5.0, "radius", uoflow=False),
155126
bh.axis.circular(4, 0.0, 2 * np.pi, "phi"))
156127
157-
# generate some numpy arrays with data to fill into histogram,
158-
# in this case normal distributed random numbers in x and y,
159-
# converted into polar coordinates
160128
x = np.random.randn(1000) # generate x
161129
y = np.random.randn(1000) # generate y
162130
radius = (x ** 2 + y ** 2) ** 0.5
163131
phi = np.arctan2(y, x)
164132
165-
# fill histogram with numpy arrays; call looks as
166-
# if radius and phi are numbers instead of arrays
167133
h(radius, phi)
168134
169135
# access histogram counts (no copy)
@@ -201,6 +167,6 @@ Read more about the design choices in the [documentation](http://hdembinski.gith
201167

202168
The histogram is feature-complete. More than 500 individual tests make sure that the implementation works as expected. Full documentation is available. User feedback is appreciated!
203169

204-
As we are finalising the interface in the review process, code breaking changes of the interface are not unlikely to happen. If you want to use the library in production code, please use the [latest release](https://github.com/HDembinski/histogram/releases) instead of the master. After the library is accepted as part of Boost, the interface will be kept stable, of course.
170+
We are finalising the interface for the review process, so code-breaking changes of the interface are currently happening on the master. If you want to use the library in production code, please use the [latest release](https://github.com/HDembinski/histogram/releases) instead of the master. After the library is accepted as part of Boost, the interface will be kept stable, of course.
205171

206-
Review of the library was planned to happen in March 2018, but is delayed.
172+
Review of the library is planned in September 2018.

0 commit comments

Comments
 (0)