PyWavelets / pywt

PyWavelets - Wavelet Transforms in Python
http://pywavelets.readthedocs.org
MIT License
2.07k stars 482 forks source link

Request features for extending cwt analysis to negative scales/frequencies #431

Open rohong opened 6 years ago

rohong commented 6 years ago

I was using cwt to draw the spectrogram/scalogram for similar Doppler signals but found that it only returns positive scales/frequencies. This negative scales/frequencies can be important for Doppler detection system, since most Doppler ultrasound systems employ quadrature mixers at the detection stages.

The complex Fourier transform is the conventional method to extract the directional information in the frequency domain. In FT method, the in-phase (I) and quadrature (Q) components are combined as a complex-valued array (I + 1j * Q), and STFT of it with two-sided frequency can give the sonogram/spectrogram. Then the phase velocity can be extracted from this time-frequency representation, as shown in those figures. The forward flow corresponds to positive frequencies, and reverse flow is linked to negative frequencies.

It woudl be great if cwt funciton can give similar results. I also learned from docs the MATLAB's cwt can give negative scales, though they don's show any exmaples about it. I'm wondering if cwt function can work with negative scales/frequencies.

grlee77 commented 6 years ago

I also learned from docs the MATLAB's cwt can give negative scales, though they don's show any exmaples about it. I'm wondering if cwt function can work with negative scales/frequencies.

I think that is true for the newer implementation of cwt introduced in MATLAB around 2015 or so. The cwt in PyWavelets behaves like MATLAB's prior implementation documented at: https://www.mathworks.com/help/wavelet/ref/cwtold.html

I don't think that one supports negative scales/frequencies.

The original contributor of the CWT functionality in PyWavelets has not been active here lately and I don't know of any active plans to update the CWT in PyWavelets. I will leave this open as a feature request.