Reputation: 21
I am trying to perform scalogram generation (CWT coefficients based image). I am using physiological signals, namely phonocardiogram (PCG). I can't get images similar to an article I am trying to replicate.
So far I have based my approach on this article. I have replicated all the preprocessing steps for the exact same record shown. This is the processed PCG signal (identical to the plot presented on the article):
I am using the same wavelet (Morlet) through pywavelets and this is the code I use to generate it:
sampling_rate = fs = 2000
wavelet = pywt.ContinuousWavelet("morl")
scales = pywt.central_frequency(wavelet) * sampling_rate / np.arange(10, 150, 1)
pcg = sig[:10000]
pcg = preprocess_pcg(pcg) # here it contains all the preprocessing steps including band pass filter
data, f = pywt.cwt(pcg, scales, wavelet, sampling_period= 1/fs)
#Also tried scales = np.arange(7,160,1), it didnt solve the problem
When I try to export the scalogram, results differ a lot from the image in the article (and from the other images online as well).
This is the code I run to preprocess the signal and export the image
data=np.abs(data)
cmap = plt.get_cmap('jet', 256)
fig = plt.figure(figsize=(5,5))
ax = fig.add_subplot(111)
t = np.arange(data.shape[1]) / fs
ax.pcolormesh(t, f, data, cmap=cmap, vmin=data.min(), vmax=data.max(), shading='auto')
plt.show()
This is the image generated by it:
This one is with log scale y-axis:
Doesn't look bad, but the one presented in the article looks so much better and very different:
What am I doing wrong?
Upvotes: 1
Views: 706