# How does the Scipy implementation of CWT actually work?

I'm trying to use the SciPy implementation of the Continuous Wavelet Transform to analyze EEG data.

I am using The problem is that I have no idea what the width parameter should be. It says that it's a list of "widths" for the wavelet, but I have no idea what these widths should be. Playing around with the scipy Ricker function directly seems to indicate that it should relate to sample frequency somehow (as the same width with different number of points is quite different) but I don't know how.

Let's say, for example, that I have a 2 second signal consisting of two sine waves, one at 50 Hz and one at 100 Hz, both sampled at 1000 Hz. I want to create a scalogram of this signal, and my region of interest is between 10 Hz and 150 Hz. What should the widths parameter be? How does the "width" of the Ricker function relate to various frequencies?

Below is a script attempting to use this function with very different values for the width:

import numpy as np from numpy import pi import matplotlib.pyplot as plt from scipy.signal import cwt, ricker fs = 1000.0 t0 = 0.0 t1 = 4.0 N = int((t1-t0)*fs) t = np.linspace(t0,t1,N) s = np.sin(2*pi * 50*t) + np.sin(2*pi * 100*t) widths1 = np.arange(0.1,10.0,0.1) widths2 = np.arange(1.0,500.0,1.0) cwtmatr1 = cwt(s,ricker,widths1) cwtmatr2 = cwt(s,ricker,widths2) plt.pcolor(t,widths1,cwtmatr1) plt.savefig('cwt1.png') plt.pcolor(t,widths2,cwtmatr2) plt.savefig('cwt2.png')

Producing the two images below. Neither seem very illuminating.  Thank you

• Constant frequency tones are probably not a particularly good set of signals to gain some understanding of the CWT. Put some Gaussian widows of various widths on those tone and see if what comes out is more obvious – Stanley Pawlukiewicz Jun 18 '18 at 14:46