Continuous Wavelet Tranform- How to choose the scales
Asked Answered
J

0

6

I have a signal coming from an accelerometer which has already been filtered in the band 0.5-15Hz. I would like to understand in particular how frequencies are distributed in two bands (0.5-3, 3-6) over time, so I thought about using CWT with morlet as mother wavelet. I am using the cwt from pwyt library. Here's my code:

wavelet="morl"
threshold_scale=5
threshold_freq=3

plt.figure()
#scales=(pywt.central_frequency(wavelet, precision=8)/(0.5*(np.arange(0,16,1)+1)))*200.0
coeffs, freqs = pywt.cwt(a_x, scales, wavelet = wavelet, sampling_period=1/200.0)
coeffs_ax=np.abs(coeffs)
plt.imshow(coeffs_ax, cmap = 'coolwarm', aspect = 'auto', origin='lower', interpolation="spline36")
plt.axhline(y=threshold_scale, color='r')
plt.title("Scalogram of a_x")
plt.ylabel('Scale')
plt.xlabel('Time')
plt.plot(target, color='y')


and i get this result: https://i.sstatic.net/XZGAF.jpg

I am not sure if I correctly understood how scales work. I computed using a formula I have found looking around the scales that corresponds to the frequency I am interested in, with a 0.5Hz step (ex: 0.5-1-1.5-2.0 ecc up to 15) and I have used only them, even if looking online many suggest to use as scale np.range(n) with n=64, 128 ecc The scales I compute actually exceed these values proposed online. Am I setting them wrong? Moverover, can I say from the graph that what's below 5 (red line) corresponds to frequencies 0.5-3Hz and above to frequencies 3-6Hz? The y-axis actually correspond to the index in the vector scale, not to the scale magnitude itself...

Junie answered 15/5, 2020 at 17:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.