Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

np.bool deprecated in newer versions of NumPy #43

Open
seantcaron opened this issue Apr 2, 2024 · 3 comments
Open

np.bool deprecated in newer versions of NumPy #43

seantcaron opened this issue Apr 2, 2024 · 3 comments

Comments

@seantcaron
Copy link

The following error is produced when running popcorn with NumPy >= 1.20.

Performing jackknife estimation of the standard error using 200 blocks of size 17925 .
/usr/local/lib/python3.8/dist-packages/popcorn/jackknife.py:44: FutureWarning: In the future np.bool will be defined as the corresponding NumPy scalar.
k = np.ones((x.shape[0]),dtype=np.bool)
Traceback (most recent call last):
File "/usr/local/bin/popcorn", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.8/dist-packages/popcorn/main.py", line 218, in main
res = fit.fit_pg(data.data,args,M=M)
File "/usr/local/lib/python3.8/dist-packages/popcorn/fit.py", line 241, in init
self.jackknife = jackknife.jackknife(close_call,data,res,args)
File "/usr/local/lib/python3.8/dist-packages/popcorn/jackknife.py", line 19, in init
self.psuedovalues, self.delete_values = self.jackknife(f,x,r)
File "/usr/local/lib/python3.8/dist-packages/popcorn/jackknife.py", line 44, in jackknife
k = np.ones((x.shape[0]),dtype=np.bool)
File "/usr/local/lib/python3.8/dist-packages/numpy/init.py", line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Could you please update line 44 in jackknife.py to replace np.bool with np.bool_ such that this will run properly with newer NumPy without modification?

Thank you!

@seantcaron
Copy link
Author

seantcaron commented Apr 22, 2024 via email

@francontiram
Copy link

francontiram commented Apr 22, 2024 via email

@seantcaron
Copy link
Author

seantcaron commented Apr 22, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants