boostorg / histogram

Fast multi-dimensional generalized histogram with convenient interface for C++14
Boost Software License 1.0
313 stars 74 forks source link

Request: axis with closed bounds in the last bin #307

Closed jolopezl closed 2 years ago

jolopezl commented 3 years ago

(See: https://gitter.im/boostorg/histogram?at=6040fcdc457d6b4a94a1e3be)

I wonder if there is a proper way to set the last bin of a histogram to have a closed bound? It has some statistical effects and applications when analyzing images. Maybe we can foresee a possible way to set a switch for this?

The axis would look like this: [x_0),x_1),...),x_i),...,x_N-1),x_N], instead of [x_0),x_1),...),x_i),...,x_N-1),x_N).

henryiii commented 3 years ago

This is pretty easy to implement if you need it, see https://github.com/scikit-hep/boost-histogram/blob/6170cff72d65e63c1f4ad0504b3dab16152cec6b/include/bh_python/regular_numpy.hpp .