我找不到简单的方法得到与密度曲线相关的极小值。 对于此类数据:
import matplotlib.pyplot as plt
from scipy.misc import electrocardiogram
from scipy.signal import find_peaks
import seaborn as sns
test = [7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 8, 7, 7, 8, 7, 7, 8, 7, 7, 8, 7, 8, 7, 7, 8, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 8, 7, 4, 4, 7, 8, 7]
sns.kdeplot(test)
我想得到与最后一个“峰值”相关的最后一个拐点,在这种情况下,它将是x=8附近的最小值。 我尝试了像get_peaks这样的函数,但这不起作用,因为我需要得到最后一个拐点之后的所有值,在某些情况下,例如:
test2 = [8, 7, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 8, 12]
get_peaks没有告诉我最后一个号码。 我的想法是得到最后一个极小值的x位置,然后得到所有高于极小值的数字
谢谢你的帮助
最好放置最新的
find_peaks()
实现。在这里,我尝试使用这个函数来获取它正如你所看到的,我可以得到第二个峰值是在coord
[7.921442255354041, 0.3685891140800782]
相关问题 更多 >
编程相关推荐