I am trying to use peakutils to find the peak. Here is my code:
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()
However, when I run it, it shows an error:
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'
I have tried to use python2.7 and python3.6 but it didn't work either way.
Can someone help me?
Since you do import peakutils
, you don't need this line:
from peakutils import *
Remove that extra line and it should work.