Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I see the list of built-in wavelet functions that I can pass to scipy.signal.cwt?

scipy.signal.cwt's documentation says:

scipy.signal.cwt(data, wavelet, widths)

wavelet : function Wavelet function, which should take 2 arguments. The first argument is the number of points that the returned vector will have (len(wavelet(width,length)) == length). The second is a width parameter, defining the size of the wavelet (e.g. standard deviation of a gaussian). See ricker, which satisfies these requirements.wavelet : function Wavelet function, which should take 2 arguments.

Beyond scipy.signal.ricket, what are the other built-in wavelet functions that I can pass to scipy.signal.cwt?

I see in scipy / scipy / signal / wavelets.py

__all__ = ['daub', 'qmf', 'cascade', 'morlet', 'ricker', 'cwt']

and looking at the arguments of each of those wavelet functions, only ricket seems to work with scipy.signal.cwt(data, wavelet, widths) (as only ricker takes precisely 2 arguments).

like image 256
Franck Dernoncourt Avatar asked May 18 '14 16:05

Franck Dernoncourt


People also ask

What is the difference between CWT and DWT?

The difference between the CWT and the DWT is that the choice of scale parameter and position parameter of continuous wavelet transform is arbitrary, while discrete wavelet transform is not.

What are wavelet functions?

A wavelet is a mathematical function used to divide a given function or continuous-time signal into different scale components. Usually one can assign a frequency range to each scale component. Each scale component can then be studied with a resolution that matches its scale.

What are wavelets in DSP?

Wavelets are powerful mechanisms for analyzing and processing digital signals. The wavelet transform translates the time-amplitude representation of a signal to a time-frequency representation that is encapsulated as a set of wavelet coefficients.


1 Answers

I asked the question on the SciPy Users List , answer 1:

I found the module for CWT quite confusing, so I rolled my own:

https://github.com/Dapid/fast-pycwt

It is built for speed (I got my running time from 4 h down to 20 min). It is not thoroughly tested, and it is limited to single and double; but for me it is in a "good enough" state.

Answer 2:

You might also find my version useful:

https://github.com/aaren/wavelets

I also found scipy wavelets confusing. My version includes a faster cwt that can take wavelets expressed in either frequency or time.

I found it more intuitive to have wavelet functions that take time/frequency and width as arguments rather than the present method (I prefer thinking in real space rather than sample space).

Presently, the morlet wavelet that comes with scipy, scipy.signal.wavelets.morlet, cannot be used as input to cwt. This is unfortunate I think.

Additionally, the present cwt doesn't allow complex output. This doesn't make a difference for ricker but wavelet functions are complex in general.

My modified 'cwt' method is here:

https://github.com/aaren/wavelets/blob/master/wavelets.py#L15

It can accept wavelet functions defined in time or frequency space, uses fftconvolve, and allows complex output.

My background on this is based on a reading of Torrence and Compo:

Torrence and Compo, 'A Practical Guide to Wavelet Analysis' (BAMS, 1998)

http://paos.colorado.edu/research/wavelets/

hope that helps a bit,

aaron

like image 154
Franck Dernoncourt Avatar answered Dec 12 '22 11:12

Franck Dernoncourt