我使用^{
import numpy as np
from scipy.signal import find_peaks
x=np.array([9.8,57.,53.,37.,24.,19.,16.,15.,13.,13.,12.,12.,11.,11.,11.,11.,11.,11.,10.,13.,13.,13.,15.,13.,12.,14.,15.,14.,51.,34.,24.,20.,24.,22.,18.,57.,63.,38.,27.,28.,31.,33.,94.,71.,48.,40.,43.,39.,31.,27.,22.,21.,20.,19.,18.,18.,19.,20.,20.,49.,62.,48.,43.,34.,33.,28.,26.,26.,24.,23.,23.,26.,27.,70.,97.,57.,46.,68.,82.,59.,49.,37.,40.,45.,36.,33.,28.,22.,23.,284.,524.,169.,111.,148.,98.,68.,50.,38.,30.,28.])
peaks, _ = find_peaks(x)
mins, _ =find_peaks(x*-1)
看起来像:
现在我有兴趣找到最接近每一个峰值的最小值。所以我可以把它们区别开来。你知道吗
在浏览了find_peaks
文档之后,参数^{
prominences = peak_prominences(x, peaks)[0]
contour_heights = x[peaks] - prominences
然后看起来像:
经过检查,peak_prominences
发现了峰值之前的最小值。对于我的应用程序,我需要最接近的峰值,不管它是在前面还是后面。你知道吗
如何使用mins
为peak_prominence
计算定义参数wlen
。?你知道吗
既然mins
由极小值的指数组成,我如何用它来定义wlen
?我基本上需要找到以min为单位的指数来限制每个峰值(即peaks[i]
)。你知道吗
仅仅使用mins
和peaks
是否有更好的方法来实现这一点?你知道吗
以下是你要找的吗?你知道吗
下面是用虚线表示的
peaks
、mins
和peaks
最近的mins
对的图。请注意,有mins
最接近多个peaks
。你知道吗相关问题 更多 >
编程相关推荐