@@ -4,9 +4,9 @@ Comparison with Boost.Histogram
44===============================
55
66``boost-histogram `` was based on the C++ library Boost.Histogram. In most ways,
7- it mimics the interface of this library; if you learn to use one, you probably can use
8- the other. A special high-compatibility mode is available with `` boost_histogram.cpp ``,
9- as well, which reduces the changes to a bare minimum. There are a few differences, however :
7+ it mimics the spirit of this library; if you learn to use one, you probably can use
8+ the other. There are a few differences, however, mostly around adhering to Python
9+ conventions :
1010
1111Removals
1212^^^^^^^^
@@ -21,14 +21,12 @@ The call operator
2121 fills are not encouraged in Python due to poor performance. The ``.fill `` method from
2222 Boost.Histogram 1.72 is bound, however - this provides fast fills without the drawbacks.
2323 If you want to fill with a single item, Python's ``.fill `` does support single item fills.
24- ``cpp `` mode does have a call operator.
2524
2625Histogram make functions
2726 These functions, such as ``make_histogram `` and ``make_weighted_histogram ``, are provided
2827 in Boost.Histogram to make the template syntax easier in C++14. In C++17, they are replaced
2928 by directly using the ``histogram `` constructor; the Python bindings are not limited by old
3029 templating syntax, and choose to only provide the newer spelling.
31- ``cpp `` mode does have the make functions.
3230
3331Custom components
3432 Many components in Boost.Histogram are configurable or replaceable at compile time; since
@@ -37,20 +35,36 @@ Custom components
3735Changes
3836^^^^^^^
3937
38+ Naming
39+ The bindings follow modern Python conventions, with CamelCase for classes,
40+ etc. The Boost.Histogram library follows Boost conventions.
41+
4042Serialization
41- The Python bindings use a pickle based binary serialization, so cannot read files saved in C++ using Boost.Serialize.
43+ The Python bindings use a pickle-based binary serialization, so cannot read
44+ files saved in C++ using Boost.Serialize.
4245
4346Properties
44- Many methods in C++ are properties in Python. In ``cpp `` mode, most of these remain methods, except for ``.metadata ``,
45- which needs to be a property to allow it to be set.
47+ Many methods in C++ are properties in Python. ``.axis(i) `` is replaced with ``.axes[i] ``.
48+
49+ Indexing
50+ The Python bindings use standard Python indexing for selection and setting.
51+ You can recover the functionality of ``.at(i) `` at endpoints with
52+ ``bh.tag.at(i) ``.
4653
54+ Renames
55+ The ``.rank() `` method is replaced by the ``.ndim `` property to match the common NumPy spelling.
4756
4857Additions
4958^^^^^^^^^
5059
5160Unified Histogram Indexing
52- The Python bindings support UHI, a proposal to unify and simplify histogram indexing in Python. Currently,
53- this is disabled in ``cpp `` mode.
61+ The Python bindings support UHI, a proposal to unify and simplify histogram
62+ indexing in Python.
63+
64+ Custom transforms
65+ Custom transforms are possible using Numba or a C pointer. In
66+ Boost.Histogram, you can use templating to make arbitrary transforms, so a
67+ run time transform is not as necessary (but may be added).
5468
55- Numpy compatibility
56- The Python bindings do several things to simplify Numpy compatibility.
69+ NumPy compatibility
70+ The Python bindings do several things to simplify NumPy compatibility.
0 commit comments