darrencroton / sage

Home of the Semi-Analytic Galaxy Evolution (SAGE) galaxy formation model
MIT License
21 stars 21 forks source link

allresults.py bug fix #15

Closed broukema closed 3 years ago

broukema commented 5 years ago

In pull request https://github.com/darrencroton/sage/pull/14 I've proposed a bug fix for commit a186562 . It seems to me that 2be3027 should fix the bug. Just to repeat the bug report here (also give in the pull request), since this is the Issues section:

Python 2.7.12 tolerates feeding floats to the np.histogram function with a warning that the behaviour will soon be deprecated. Consistently with that warning, python 2.7.13 gives a fatal error:

TypeError: 'numpy.float64' object cannot be interpreted as an index

Using the floor function is not enough, because it gives float values such as 32.0 instead of integers such as 32. The int function is needed too. In general, using int(floor(x)) is not the same as int(x), since int(floor(-2.7)) is -3 while int(-2.7) is -2, at least in fortran and C, so it could be the same in python. For positive floats, int(x) should be OK, I presume.

darrencroton commented 5 years ago

Thanks @broukema . I'll be having a look and updating a number of things soon. Appreciate the feedback.

broukema commented 3 years ago

hi @darrencroton - I saw you implemeted this in commit 0fec63735eaa , so I'll close this issue. :)

darrencroton commented 3 years ago

Thanks. Sorry it took so long! Fell off my radar.