我正在尝试使用 peakutils 来查找峰值。这是我的代码:
import pandas as pd
import peakutils
from peakutils import *
import matplotlib.pyplot as plt
estimated_data = pd.read_csv("file", header=None)
col1 = estimated_data[:][0] # First column data
col2 = estimated_data[:][1] # Second column data
index = peakutils.indexes(col2, thres=0.4, min_dist=1000)
plt.plot(col1, col2, lw=0.4, alpha=0.4)
plt.plot(col1[index], col2[index], marker="o", ls="", ms=3)
plt.show()
但是,当我运行它时,它显示一个错误:
Traceback (most recent call last):
File "/Users/shengjie/Library/Mobile Documents/com~apple~CloudDocs/Coding/try.py", line 10, in <module>
index = peakutils.indexes(col2, thres=0.4, min_dist=1000)
AttributeError: module 'peakutils' has no attribute 'indexes'
我曾尝试使用 python2.7 和 python3.6,但无论哪种方式都不起作用。
有人能帮我吗?