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

scipy ifft import of peakdetect (stale) breaks findpeaks #31

Closed
mmarras opened this issue Feb 18, 2024 · 3 comments
Closed

scipy ifft import of peakdetect (stale) breaks findpeaks #31

mmarras opened this issue Feb 18, 2024 · 3 comments

Comments

@mmarras
Copy link

mmarras commented Feb 18, 2024

Python 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
>>> scipy.__version__
1.12.0
>>> import findpeaks

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/findpeaks/__init__.py", line 1, in <module>
    from findpeaks.findpeaks import findpeaks
  File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/findpeaks/findpeaks.py", line 11, in <module>
    from peakdetect import peakdetect
  File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/peakdetect/__init__.py", line 3, in <module>
    from .peakdetect import *
  File "/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/peakdetect/peakdetect.py", line 5, in <module>
    from scipy import fft, ifft
ImportError: cannot import name 'ifft' from 'scipy' (/home/ubuntu/miniconda3/envs/datamore/lib/python3.10/site-packages/scipy/__init__.py)

findpeaks breaks with newer scipy, because in more recent versions of scipy, the way Fourier transform functions (like fft and ifft) are imported has changed. Instead of importing fft and ifft directly from scipy, they should be imported from scipy.fft.

This should be addressed at peakdetect, but it's archived.

@erdogant
Copy link
Owner

Thank you for mentioning this issue. I fixed this issue by setting the installation of scipy to version 1.11.4. It may not be the real solution but it is a first quick fix.

@mamuncseru
Copy link

You saved my day. Thanks

@erdogant
Copy link
Owner

I released a new version where I now use the fork of peakdetct where I fixed the import issues.
https://github.com/erdogant/findpeaks/releases

pip install -U findpeaks

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

3 participants