Skip to content

scipy: if _is_safe_size(n): #5

Open

Description

@jeremyNG-lab

Hi,
This is my code with Accz and Time are array of float:

cwt = ContinuousWaveletTransform(wavelet= morse.Morse())
CPEF=cwt.transform(data =Accz, fs =1000, timestamps =Time, freq_limits =[0,300])

And the answer:

File ".......\lib\site-packages\scipy\fftpack\basic.py", line 87, in fft
if _is_safe_size(n):

TypeError: c2c() missing 1 required keyword-only argument: 'plan'

Activity

  1. jchutrue commented on Feb 2, 2021

    @jchutrue
    Member

    Hello,

    What version of scipy are you using, and do you have a full traceback of the issue when you run the code?

  2. jeremyNG-lab commented on Feb 2, 2021

    @jeremyNG-lab
    Author

    I use scipy 1.3.0 but I had lot of problem with scipy like No module named....
    What version you use?

  3. jchutrue commented on Feb 2, 2021

    @jchutrue
    Member

    I've been using pyfftw for the FFT backend. For scipy, if you have the full traceback of all your issues, I can take a look. Right now I'm not sure what the specific problems are.

  4. jeremyNG-lab commented on Feb 2, 2021

    @jeremyNG-lab
    Author

    So at the bigging I use the last scipy (1.6.0)

    from . import morlet
    File "......\anaconda3\lib\site-packages\ghost\wave\morlet.py", line 5, in
    from scipy.misc import logsumexp
    ImportError: cannot import name 'logsumexp' from 'scipy.misc' (C:\Users\jerem\anaconda3\lib\site-packages\scipy\misc_init
    .py)_

    I changed in the file scipy.misc by scipy.special

    _from .fourier import clean_scipy_cache
    File ".....\anaconda3\lib\site-packages\ghost\sigtools\fourier.py", line 5, in
    import scipy.fftpack._fftpack as sff
    ModuleNotFoundError: No module named 'scipy.fftpack.fftpack'

    I changed by from scipy.fftpack import fft as sff

    And I saw your last message that you use pyfftw so i installed this package and it works.
    I think that pyfftw must be installed for a good work .

  5. jchutrue commented on Feb 2, 2021

    @jchutrue
    Member

    The issue with scipy is that they removed some functions in later versions. I'll get around to fixing that today so that you can still use scipy as the fft backend if you want. But in general I do prefer to use pyfftw.

  6. ckemere commented on Feb 2, 2021

    @ckemere

    I think the two pull requests I proposed will fix these issues. But you should update the home page example to also import pyfftw so that people do this by default.

  7. added a commit that references this issue on Feb 2, 2021
  8. jchutrue commented on Feb 2, 2021

    @jchutrue
    Member

    @jeremyNG-lab The errors should be gone now--let us know how it looks on your system

  9. jeremyNG-lab commented on Feb 2, 2021

    @jeremyNG-lab
    Author

    Without the FFT backend I have the same issu:

    File "....\anaconda3\lib\site-packages\ghost\sigtools\fourier.py", line 11, in clean_scipy_cache
    sff.destroy_zfft_cache()
    AttributeError: 'function' object has no attribute 'destroy_zfft_cache'

  10. ckemere commented on Feb 2, 2021

    @ckemere

    The master branch has been changed. Make sure you pip install it again?

  11. jeremyNG-lab commented on Feb 3, 2021

    @jeremyNG-lab
    Author

    I redownload and reinstall the package. But with scipy it didn't work, the same issue.

  12. jchutrue commented on Feb 3, 2021

    @jchutrue
    Member

    This might have something to do with scipy's legacy code. Try it now?

    EDIT: i.e. run pip install again

  13. jeremyNG-lab commented on Feb 3, 2021

    @jeremyNG-lab
    Author

    INFO:ghost:'timestamps' not passed in; generating from data
    WARNING:root:Module 'pyfftw' not found, using scipy backend
    Traceback (most recent call last):

    File "", line 2, in
    cwt.transform(data =Accz, fs =10000, voices_per_octaveint=48) #, ,freqs=frevoices_per_octaveint=48 timestamps =Time, freq_limits =[10,401] ,

    File "......\anaconda3\lib\site-packages\ghost\formats\preprocessing.py", line 187, in wrap_function
    return function(*args, **kwargs)

    File "......\anaconda3\lib\site-packages\ghost\wave\transforms.py", line 224, in transform
    wavelet_conv((ii, freq, length))

    File ".......\anaconda3\lib\site-packages\ghost\wave\transforms.py", line 203, in wavelet_conv
    res = convfun(input_asarray[..., start:stop], kernel)

    File ".....\anaconda3\lib\site-packages\ghost\sigtools\convolution.py", line 81, in fastconv_scipy
    clean_scipy_cache()

    File ".....\anaconda3\lib\site-packages\ghost\sigtools\fourier.py", line 11, in clean_scipy_cache
    sff.destroy_zfft_cache()

    AttributeError: 'function' object has no attribute 'destroy_zfft_cache'

  14. jchutrue commented on Feb 3, 2021

    @jchutrue
    Member
    File ".....\anaconda3\lib\site-packages\ghost\sigtools\convolution.py", line 81, in fastconv_scipy
    clean_scipy_cache()
    
    File ".....\anaconda3\lib\site-packages\ghost\sigtools\fourier.py", line 11, in clean_scipy_cache
    sff.destroy_zfft_cache()
    
    AttributeError: 'function' object has no attribute 'destroy_zfft_cache'
    

    Those two lines above no longer exist. You need to git pull to update to the latest code and then run pip install again.

  15. jeremyNG-lab commented on Feb 3, 2021

    @jeremyNG-lab
    Author

    (base) C:....>pip3 install git+https://github.com/nelpy/ghost.git
    Collecting git+https://github.com/nelpy/ghost.git
    Cloning https://github.com/nelpy/ghost.git to c:\users\jerem\appdata\local\temp\pip-req-build-syyxcccr
    Requirement already satisfied: numpy>=1.15.0 in c:\users\jerem\anaconda3\lib\site-packages (from ghost==0.0.0) (1.19.2)
    Requirement already satisfied: scipy>=1.0 in c:\users\jerem\anaconda3\lib\site-packages (from ghost==0.0.0) (1.6.0)
    Requirement already satisfied: matplotlib>=3.0 in c:\users\jerem\anaconda3\lib\site-packages (from ghost==0.0.0) (3.3.4)
    Requirement already satisfied: python-dateutil>=2.1 in c:\users\jerem\anaconda3\lib\site-packages (from matplotlib>=3.0->ghost==0.0.0) (2.8.1)
    Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\jerem\anaconda3\lib\site-packages (from matplotlib>=3.0->ghost==0.0.0) (1.3.1)
    Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in c:\users\jerem\anaconda3\lib\site-packages (from matplotlib>=3.0->ghost==0.0.0) (2.4.7)
    Requirement already satisfied: cycler>=0.10 in c:\users\jerem\anaconda3\lib\site-packages (from matplotlib>=3.0->ghost==0.0.0) (0.10.0)
    Requirement already satisfied: pillow>=6.2.0 in c:\users\jerem\anaconda3\lib\site-packages (from matplotlib>=3.0->ghost==0.0.0) (8.1.0)
    Requirement already satisfied: six in c:\users\jerem\anaconda3\lib\site-packages (from cycler>=0.10->matplotlib>=3.0->ghost==0.0.0) (1.15.0)

    I did it

    I launched the script and I have the same error

  16. jchutrue commented on Feb 3, 2021

    @jchutrue
    Member

    If you instead install like so:

    1. pip3 uninstall ghost
    2. Navigate to the directory you want to place the cloned repo in.
    3. git clone https://github.com/nelpy/ghost.git
    4. cd ghost
    5. pip3 install .

    and run your script, do you get the same error?

    If you still have the error, try exporting your environment by running conda env export > environment.yml. Then upload that file here and I'll try to reproduce the error on my machine.

  17. jeremyNG-lab commented on Feb 3, 2021

    @jeremyNG-lab
    Author

    Yes it works.
    Really Thanks

    But with pyfftw it works everytime

  18. jchutrue commented on Feb 3, 2021

    @jchutrue
    Member

    Great! It should work fine on either scipy or fftw now. Let me know if you run into any further issues. If there aren't any related ones in the next couple of days, I'll close this one out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions