def get_local_maxima(x, y):
"""
This function ...
:param x:
:param y:
:return:
"""
m = argrelextrema(y, np.greater)[0].tolist()
# Find the index of the absolute maximum (should also be included, is not for example when it is at the edge)
index = np.argmax(y)
if index not in m: m.append(index)
x_maxima = [x[i] for i in m]
y_maxima = [y[i] for i in m]
return x_maxima, y_maxima
# -----------------------------------------------------------------
评论列表
文章目录