I have four arrays of signal, I am trying to find the peaks in those signal. I am following this blog, but not able to detect peaks accurately. Plots of four signal looks like this :
My code to generate the peaks is :
def plot_peaks(time, singal):
index_data = indexes = scipy.signal.argrelextrema(
np.array(signal),
comparator=np.greater,order=2
)
plt.plot(time,singal)
plt.plot(time[index_data[0]],signal[index_data[0]], alpha = 0.5,marker = 'o', mec = 'r',ms = 9, ls = ":",label='%d %s' % (index_data[0].size-1, 'Peaks'))
plt.legend(loc='best', framealpha=.5, numpoints=1)
plt.xlabel('Time(s)', fontsize=14)
plt.ylabel('Amplitude', fontsize=14)
which is resulting like this:
But I want to show the maximum peaks only, but this code is generating a lot of minor peaks too. How to accurately generate maximum peaks?
I tried scipy code, but Confused with parameters that function
peaks, _ = find_peaks(x, height=0)