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

cwt always fails with the message AttributeError: 'pywt._extensions._pywt.Wavelet' object has no attribute 'comple x_cwt' #776

Open
algebravic opened this issue Nov 8, 2024 · 4 comments

Comments

@algebravic
Copy link

I installed pywavelts on an M2 mac using Python 3.11. Whenever I try to use cwt is fails with the message:

AttributeError: 'pywt._extensions._pywt.Wavelet' object has no attribute 'complex_cwt'

What is this about? Is there some problem with M2 macs?

I tried an installation using pip which gave version 1.7.0. I then tried the current github version which is 1.8.0.dev0

Any suggestions? In any case this isn't an acceptable error message.

To be more specific I tried
cwt(bnds, 1, 'coif1') where bnds is a numpy array of np.float64. No matter what wavelet or scale I try I get the same error.

@agriyakhetarpal
Copy link
Collaborator

Hi @algebravic, I tried a simple pywt.cwt example from the docs, but I can't reproduce it on an M-series macOS machine. Could you please provide an M.W.E?

I tried both the version from PyPI and built from sources, too, and neither of them seem to fail with the Coiflets family.

@agriyakhetarpal
Copy link
Collaborator

I tried dir(pywt._extensions._pywt.Wavelet), which returns the following:

['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'biorthogonal', 'dec_hi', 'dec_len', 'dec_lo', 'family_name', 'family_number', 'filter_bank', 'get_filters_coeffs', 'get_reverse_filters_coeffs', 'inverse_filter_bank', 'name', 'number', 'orthogonal', 'rec_hi', 'rec_len', 'rec_lo', 'short_family_name', 'symmetry', 'vanishing_moments_phi', 'vanishing_moments_psi', 'wavefun']

So pywt._extensions._pywt.Wavelet.complex_cwt as an attribute apparently does not exist.

@algebravic
Copy link
Author

Hi @algebravic, I tried a simple pywt.cwt example from the docs, but I can't reproduce it on an M-series macOS machine. Could you please provide an M.W.E?

I tried both the version from PyPI and built from sources, too, and neither of them seem to fail with the Coiflets family.

Here's some code that fails in that way

import numpy as np
from pywt import cwt

sdata = np.cos(0.33 + np.pi*np.linspace(0,1,100))
cwt(sdata, [1], 'coif1')

It fails the same way with all other wavelets.

@quantmask
Copy link

I installed pywavelts on an M2 mac using Python 3.11. Whenever I try to use cwt is fails with the message:

AttributeError: 'pywt._extensions._pywt.Wavelet' object has no attribute 'complex_cwt'

What is this about? Is there some problem with M2 macs?

I tried an installation using pip which gave version 1.7.0. I then tried the current github version which is 1.8.0.dev0

Any suggestions? In any case this isn't an acceptable error message.

To be more specific I tried cwt(bnds, 1, 'coif1') where bnds is a numpy array of np.float64. No matter what wavelet or scale I try I get the same error.

I recently faced this issue, the issue is not with pywt or any version of it .

The issue is you might be trying to get the continuous wavelet analysis using it for a wave which would have discrete in nature.

coiflet is a discrete wavelet so whenever you will try :
'pywt.cwt(values_wavelet, scales, wavelet_name)'

this will give attribution error, since it is discrete wavelet try :
'coeffs = pywt.wavedec(values_wavelet, wavelet_name, level=None)'

NOTE: For wavelet like coiflets, symlets, Haar, Daubechies you have to use 'pywt.wavedec'.

Ya, for continuous waves like morlet, this issue will not come so you can use 'pywt.cwt'.

I hope this helps.

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