I am newbie in Signal Processing, I want find out the frequency rang each of level outputted by a Daubechies wavelet 'db4' transformation. The transformation is done with PyWavelets. I'm working in python and the code below outputs 5 detail levels and 1 approximation however I'm not sure which frequency range each level describes.
data = pywt.wavedec(X_train_ch1_raw[0], 'db4', level=5)
Your question is trickier than it seems.
The short answer is: use pywt's scale2freq
built-in function to return the frequency associated with a given wavelet at a given scale. For instance, the code below returns the frequency of the Daubechies 4 wavelet, at scale 5 (0.14285714285714285):
import pywt
pywt.scale2frequency('db4',5)
You could get to the same result by computing the central frequency of your db4 wavelet (0.7142857142857143) and then dividing by the scale (5)
import pywt
pywt.central_frequency('db4')/5
Please note that this is not the actual central frequency of the signal! This quantity is called a pseudo-frequency because it is independent from the signal being analyzed.
In order to recover the central frequency of the signal, you need to divide the pseudo-frequency by the sampling rate of the signal:
import pywt
pywt.scale2frequency('db4',5)/dt
Where dt
is your sampling rate.
I hope this helps!
PS: I suggest plotting the spectrum of the reconstructed signal to convince yourself that the central frequency matches the value output by the aforementioned analytical formula.