PyWavelets / pywt

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

Scale in Continuous Wavelet Transform #616

Closed purushottam22 closed 2 years ago

purushottam22 commented 2 years ago

What scale value can be used in the python code :- pywt.cwt(data, scales, wavelet) ?

I am using 'mexh' Wavelet function. Data is the p-signals of ECG from Modified Lead 2 (ML2). Signal frequency is 360Hz.

I am using this cwt function for preprocessing the ECG signal. The ECG signal used is 100 record form MIT-BIH Arrhythmia Database (https://physionet.org/content/mitdb/1.0.0/).

Original Image :- img1

At Scale = 0.25 img4

At Scale = 0.5 img3

At scale = 1 img2

Dymytriy-Zyunkin commented 2 years ago

I was curious about this also. Is there an algorithmic approach for picking the best scale? I'm familiar with spectrograms, but I am unsure how to extract the best scale to use.

For reference, a spectrogram looks something like this:

image

purushottam22 commented 2 years ago

Thanks Dymytriy.

IsmailElnaggar commented 2 years ago

See their documentation on choosing a scales here:

https://pywavelets.readthedocs.io/en/latest/ref/cwt.html#choosing-the-scales-for-cwt

Specifically the function pywt.scale2frequency()

It's of course signal and wavelet dependent.

I don't know what your plans are with your signals but you probably would want to select scales that correspond to a frequency range between 1-50Hz something like that for P-waves.