tangerine0803
tangerine0803

Reputation: 21

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

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. :))

Upvotes: 0

Views: 187

Answers (1)

Vulwsztyn
Vulwsztyn

Reputation: 2271

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.

Upvotes: 0

Related Questions