Issue
I have a list of points where I need to find peak points and group them. I am using find_peak()
function from scipy.signal to find the peak points, Now I need to group the peak points which correspond to the same hill (as mentioned below). How can we do this, any suggestion would be of great help.
Code
from matplotlib import pyplot as plt
from scipy.signal import find_peaks
# lst has list of points
A = np.array(lst)
peaks, _ = find_peaks(A)
plt.figure()
plt.plot(lst)
plt.plot(peaks, A[peaks], "ro")
plt.grid()
plt.show()
Solution
A typical way to group peaks is to low-pass filter the waveform. Lower the frequency cut-off of the low-pass filter until the peaks you think belong together for your "hills" merge. Then try the find peaks function.
Answered By - hotpaw2
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.