brinckmann / montepython_public

Public repository for the Monte Python Code
MIT License
93 stars 77 forks source link

Deprecated argument for np.histogram2d #318

Open davidcato opened 1 year ago

davidcato commented 1 year ago

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.

brinckmann commented 1 year ago

Thanks for the report and for including the solution!

Best, Thejs

brinckmann commented 1 year ago

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 commented 11 months ago

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