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

NumPy legacy bug -- AttributeError: module 'numpy' has no attribute 'int' #59

Closed
o-nate opened this issue Nov 21, 2024 · 1 comment
Closed

Comments

@o-nate
Copy link

o-nate commented Nov 21, 2024

For a few functions, mainly related to CWT, I get the error below about the use of np.int. When I adjust the fft_kwargs in helpers.py, updating to np.int64 (an arbitrary choice, as opposed to np.int32), the bug resolves. I see that np.int is also used in cwt and wct functions (wavelet.py) and the smooth method of the Morlet class (mothers.py).

This seems like a pretty quick fix. I'm happy to open a pull request myself!

  File "..\anaconda3\envs\wavelet-dashboard\lib\site-packages\pycwt\wavelet.py", line 91, in cwt
    signal_ft = fft.fft(signal, **fft_kwargs(signal))
  File "..\anaconda3\envs\wavelet-dashboard\lib\site-packages\pycwt\helpers.py", line 30, in fft_kwargs
    return {'n': np.int(2 ** np.ceil(np.log2(len(signal))))}
  File "..\anaconda3\envs\wavelet-dashboard\lib\site-packages\numpy\__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for 
additional information.
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. Did you mean: 'inf'?
@o-nate
Copy link
Author

o-nate commented Jan 8, 2025

I found that there actually was a fix to this implemented already, but it is not updated in the version currently available via Conda it appears.

@o-nate o-nate closed this as completed Jan 8, 2025
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

1 participant