我有一个名为self.data_的浮点数列表,我将这个列表提供给peakutils.indexes(),如下所示:
索引= peakutils.indexes(self.data_,thres=0.1,min_dist=50)
但是我得到了这个错误:
TypeError:只能将整数标量数组转换为标量索引
你觉得这是怎么回事?
谢谢
发布于 2017-06-19 07:22:41
在我的例子中,我能够通过将我的数据转换为numpy数组来使其工作。最近似乎有一些变化,不能将单个标量数组视为索引数组。
通过在peak.py中编辑这段代码,我特别能够让它为我工作,大约在第34行。
if isinstance(y, np.ndarray) and np.issubdtype(y.dtype, np.unsignedinteger):
raise ValueError("y must be signed")
if isinstance(y, list):
y = np.array(y)我也有opened an issue。
他的函数文档确实指定了它应该是:
y : ndarray (signed)
1D amplitude data to search for peaks.TypeError: only integer scalar arrays can be converted to a scalar index
https://stackoverflow.com/questions/43267633
复制相似问题