scikit-hep / hist

Histogramming for analysis powered by boost-histogram

Home Page:https://hist.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] axis.index finds wrong index when giving integer values

mpad opened this issue · comments

commented

the axis.index() function returns incorrect index when passed particular integer values.

Steps to reproduce
Running under linux (fedora 35, python 3.6.10)

>>> hist.__version__
'2.6.2'
>>> a=hist.axis.Regular(50,0,50)
>>> [(i,a.index(i)) for i in range(28,31) ]
[(28, 28), (29, 28), (30, 30)]

I expect to obtain (29,29) as the 2nd entry as any other integer in the range 0..50 .
With decimals, it works as expected :

>>> [(i,a.index(i+0.001)) for i in range(28,31) ]
[(28, 28), (29, 29), (30, 30)]