0
$\begingroup$

I am running continuous wavelet transform in mexican hat wavelet basis on a data set (with millions of samples) using pywavelets. The command used is pywt.cwt(data, scales, wavelet). It works well for scales less than or equal to 64 but above 64 I am getting 0 as output for all coefficients. Any idea what is happening (I am assuming some truncation to 0 due to limited number of bits to store the data)? And how to fix it, if there is any solution.

Also above scale 64, the computation is getting really infeasible in terms of memory and runtimes, so even if I could fix it, I would actually prefer staying within scale 64. And of course in reality we would need infinite number of scaled daughter wavelets to complete the entire spectral range which is impossible. What are my other solutions, is it possible to have something like a low pass for the lower frequencies not covered using the mother and daughter wavelets, so I can visualize the continuous wavelet transform of high frequencies along with the short time Fourier transform of lower frequencies in one graph?

$\endgroup$
0
$\begingroup$

PyWavelets' cwt is flawed, and so is scipy's; use ssqueezepy.cwt.

a low pass for the lower frequencies not covered using the mother and daughter wavelets ... with the short time Fourier transform of lower frequencies in one graph

This is exactly what kymatio's Scattering1D does (pass average=False, oversampling=999), it's CWT for most frequencies, and STFT for lowest, and one row dedicated to lowpass. Kymatio's CWT is identical to ssqueezepy's but with different filter design (more efficient for ML).

$\endgroup$
3
  • 1
    $\begingroup$ Thank you very much. Great work on the code and analysis. I will try out ssqueezepy cwt and let you know my results. Also interesting to see that resampling in pywavelets sometimes works better than computing wavelets from scratch in scipy. $\endgroup$ Apr 24 at 11:53
  • $\begingroup$ @ManuelJenkin If you found the answer helpful, consider accepting. $\endgroup$ May 24 at 19:21
  • 1
    $\begingroup$ Thank you. I didn't know how the procedure to mark an answer as accepted. Accepted it now. $\endgroup$ Jun 6 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.