montepython_public icon indicating copy to clipboard operation
montepython_public copied to clipboard

Deprecated argument for np.histogram2d

Open davidcato opened this issue 1 year ago • 3 comments

Hi all,

I just want to heads up that the latest version of numpy (1.24) does not support normed as an argument anymore. Thus, trying to analyze a chain under this version of numpy will result in the following error:

TypeError: histogram2d() got an unexpected keyword argument 'normed'

According to the official documentation normed has been deprecated since version 1.6.0. and its use should be substitute by the density argument.

davidcato avatar Mar 20 '23 19:03 davidcato

Thanks for the report and for including the solution!

Best, Thejs

brinckmann avatar Mar 21 '23 14:03 brinckmann

Mostly note to self: I like to preserve backwards compatibility (unlike Python developers) since a lot of people have old versions on clusters, but it looks like the default prior to the change was normed=False, which is what is set in the code, so the flag should be possible to omit entirely. We can leave density=False (although density=None is already the default) so a user interested in modifying the code realizes it's an option.

Best, Thejs

brinckmann avatar Mar 21 '23 16:03 brinckmann

This was missed for the previous release but has been fixed for the next version. Since numpy v1.5 and earlier is very old I decided to only keep the density flag and left a comment in the code in case anyone is stuck on an old version and encounter the issue.

Best, Thejs

brinckmann avatar Sep 18 '23 11:09 brinckmann