0

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

lennon310
  • 3,590
  • 19
  • 24
  • 27

1 Answers1

1

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.

OverLordGoldDragon
  • 8,912
  • 5
  • 23
  • 74