0
$\begingroup$

I have a very basic question, but I didn't find a definite answer elsewhere. When we use scipy.signal.cwt we specify only one parameter widths. Do you know a function that can help to relate this widths parameter to frequencies? Like, pywt.scale2frequency() to relate scales to frequencies in pywt package. The only hint I found is here: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.morlet2.html

freq = np.linspace(1, fs/2, 100)
widths = w*fs / (2*freq*np.pi)

Can you please explain how this works?

Similar questions, but there was no definite answer: Continuous Wavelet Transform with Scipy.signal: what is parameter "widths" in cwt() function? How do time-frequency? https://stackoverflow.com/questions/22813512/continuous-wavelet-transform-with-scipy-signal-python-what-is-parameter-widt

$\endgroup$
1
  • 1
    $\begingroup$ scipy's CWT is not very developed. I'd use a different package specifically designed for it. $\endgroup$
    – endolith
    Mar 11, 2022 at 15:19

1 Answer 1

1
$\begingroup$

The center frequency at scale=1 is w, which defaults to 5. Then for any other scale (cwt's width) the frequency is w / scale, i.e. w / widths.

However, PyWavelets' cwt is flawed, and scipy's even more so; I recommend ssqueezepy.cwt.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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