I am trying to identify the R peak of an ECG. I have used the following line of code to do this:
peaks=signal.find_peaks_cwt(signal_slice, widths=np.arange(1,80))
fig, ax = plt.subplots()
ax.set_title('Detect R peak')
ax.plot(signal_slice)
for peak in peaks:
ax.axvline(x=peak, color='r')
And I get the following output:
However, with the following signal it inaccurately detects the smaller peak also.
Is there any extra parameter I could add to the scipy.signal.find_peaks_cwt to make this more accurate? Or any way of using peakutils to do so?
Now it has stopped wrongly detecting the small peaks, but still seems to randomly miss the large peak, does anyone know why?