Below is an example:
import numpy as np
from scipy.signal import argrelextrema
a = np.array([1,2,3,4,5,4,3,2,1,2,3,2,1,2,3,4,5,6,5,4,3,2,1])
# determine the indices of the local maxima
maxInd = argrelextrema(a, np.greater)
# get the actual values using these indices
a[maxInd]
Comments
0 comments
Article is closed for comments.