pywt icon indicating copy to clipboard operation
pywt copied to clipboard

Comparing pywt and aaren wavelets

Open ckemere opened this issue 7 years ago • 0 comments

I've been happily using Aaron O'Leary's Morlet wavelet transform code (https://github.com/aaren/wavelets) for a while. I wanted to make sure I stayed abreast of other developments in the Python wavelet world and since I know @aaren is a contributor to this effort, I figured it would be easy to run the pywt cwt code on my data as well.

I'm having trouble, perhaps because I can't figure out the appropriate parameters for the complex Morlet wavelet. The aaren library follows Torrence and Compo 1997, where the w0 parameter is set to 6. I believe that the C parameter should be 6/(2 pi) ~= 1, and B should be 2. The aaren library also uses a somewhat complex process to calculate the minimum scale for the Morlet with these parameters (it's something like 1.93). Here is my example code:

from wavelets import WaveletAnalysis # aaren librar wa = WaveletAnalysis(data, dt=1, frequency=True) waSpect = wa.wavelet_power

import pywt coef, freqs=pywt.cwt(supratheta, wa.scales[:1],'cmor0.95493-2') pywtSpect = np.abs(coef)**2

The values of waSpect and pywtSpect seem completely random. Am I missing something?

Also, for very large scales, it seems like the naive convolution implementation in PyWavelets will be quite slow?

Thanks!

ckemere avatar Sep 10 '18 17:09 ckemere