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

incorporate bandwidths into CWT wavelet names for families cmor, shan, fbsp #308

Closed
grlee77 opened this issue Apr 7, 2017 · 4 comments
Closed

Comments

@grlee77
Copy link
Contributor

grlee77 commented Apr 7, 2017

The cmor, shan and fbsp ContinuousWavelet objects have both a bandwidth_frequency and center_frequency attribute. If a user calls the cwt routine in Matlab these must be specified in the name as follows:

e.g. cmor1.5-1 gives a complex Morlet wavelet with bandwidth_frequency of 1.5 and center_frequency of 1.0.

To do the equivalent in PyWavelets one currently has to first create a wavelet and then manually modify the attributes:

w = pywt.ContinuousWavelet('cmor')
w.bandwidth_frequency=1.5
w.center_frequency=1

If the user passes just 'cmor' to the cwt routine in Matlab an error would be raised as the bandwidths are not specified. In PyWavelets, this currently does not raise an error and default values are set (these appear to be equivalent to `'cmor1.0-0.5' in Matlab).

I propose to allow parsing the 2 bandwidth parameters from the Wavelet names as is done in Matlab.

I think it is also probably good to require that these be specified than choosing some undocumented default. (i.e. raise an exception if just the blank wavelet family name such as cmor is passed into cwt or ContinuousWavelet)

The default setting has already caused some confusion as in #307

@rgommers
Copy link
Member

I propose to allow parsing the 2 bandwidth parameters from the Wavelet names as is done in Matlab.

It's ugly, but I don't see a better option. So +1

@mohsenbme
Copy link

How can I set the number of cycles for complex morlet wavelet?
Thanks

@grlee77
Copy link
Contributor Author

grlee77 commented Jul 6, 2018

How can I set the number of cycles for complex morlet wavelet?

I don't know off-hand what the relation is to convert between the center frequency and bandwidth to the number of cycles, but you can plot the output of something like the following to get some idea of this in practice:

int_psi, x = pywt.integrate_wavelet('cmor2-1', precision=10)

@grlee77
Copy link
Contributor Author

grlee77 commented Jul 6, 2018

closed by #310

@grlee77 grlee77 closed this as completed Jul 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants