How to find local maximum (minimum) more accurate in python?

185 Views Asked by At

I'm wondering when using Scipy api (as the code below) to find the local maximum and local minimum, the result (as the picture attached) are seems to be not accuracy as imagine. Is there any tips or method which can increase the accuracy?

argrelextrema(z, np.greater)
argrelextrema(z, np.less)

enter image description here

Please comment to me if you have any ideas, that will help me a lot. So many thanks. :))

1

There are 1 best solutions below

0
On

I appears that you mark the next one after the min/max as the min or max, just subtract 1 from the indexes of your local mins/maxes.