Reputation: 165
I have been playing around with the scipy find_peaks() function. I would be interested in finding the vertical distance between a peak and its side lobes, but so far I haven’t been able to find it with the find_peaks() function. Does anyone have any suggestions?
Thanks!
Upvotes: 1
Views: 2654
Reputation: 3515
It's more usual to look at peak_prominences()
than the difference between the height of the peak and adjacent peaks.
That being said, scipy.signal.find_peaks()
returns the x-indices of the peaks that it finds, which you can use to determine the heights at each peak.
Identify the highest peak (numpy.max
/numpy.argmax
) then take the peak before (index-1
) and after (index+1
), which correspond to the sidelobes. Choose an algorithm to work out the height you're interested in e.g. difference = peak - mean(sidelobes)
and voila!
Upvotes: 1