Continuous Wavelet Transform with Scipy.signal: what is parameter "widths" in cwt() function? How do time-frequency? I search to display a time-frequency signal with an original discrete temporal signal (sampling step = 0.001sec). I use Python and the library Scipy.signal. I use the function cwt(data, wavelet, widths) to do a continuous wavelet transform, with the complex morlet wavelet (or gabor wavelet).

First step: Obtain a scale-translation signal. 
In doubt, I associate directly the array “widths” with the array of the possible different scales. Because, I don’t understand what is parameter width if it’s not scale. Perhaps, you will tell me “it’s the width of your current wavelet”! But, even if it is, I don’t know how linked width with scale…

My second problem is to find and display the equivalent with frequency. In literature, I find this formula: Fa = Fc / (s*delta), where Fa is the final frequency, Fc the center frequency of a wavelet in Hz, s the scale and delta the sampling period. So, ok for scale (if I find the link with the width) and delta (=0.001sec), but it’s more complicated with center frequency of the wavelet. In scipy documentation, I find that:
“The fundamental frequency of this wavelet [morlet wavelet] in Hz is given by f = 2*s*w*r / M, where r is the sampling rate [s is here Scaling factor, windowed from -s*2*pi to +s*2*pi. Default is 1; w the width; and M the length of the wavelet].”
I think it’s the center frequency, is it? Maybe the solution to my first problem is here also (scaling factor and scale..?)..?

Thank you
complex morlet was added Aug 10, 2007
ricker and cwt were added Sep 20, 2011


There's no indication that cwt is meant to be compatible with morlet.  As cwt docstring says: 


  Wavelet function, which should take 2 arguments. ... second is a width parameter, defining the size of the wavelet (e.g. standard deviation of a gaussian).


The morlet function takes 4 arguments, the second of which is not a width parameter, it's a frequency parameter, so I don't think it is meant to be used with cwt. Using ricker as a template, you are supposed to define your own functions to use with cwt. In addition, cwt cannot handle complex wavelets (as of v0.18).

I'd suggest you try a different implementation that has this done for you:


Pyscellania has a Wavelets module (now mirrored at github) which implements real/complex Morlet, MexicanHat, Paul order 2, Paul order 4, 1st Derivative Of Gaussian, 4th Derivative Of Gaussian, Unnormalised version of continuous Haar transform, Normalised Haar
aaren/wavelets supports Morlet, Paul, DOG, Ricker
Machine Learning PYthon (mlpy) has mlpy.wavelet.cwt that supports Morlet, Paul, and Derivative Of Gaussian wavelets
Dapid/fast-pycwt supports Morlet and Ricker
ObsPy (seismological observatories) has a cwt module and "for now only 'morlet' is implemented"
pyCWT has Morlet wavelet