2

我有一个名为 self.data[_]['smooth_ISA'] 的浮点列表,我将这个列表提供给 peakutils.indexes(),如下所示:

索引 = peakutils.indexes(self.data[_]['smooth_ISA'], thres=0.1, min_dist=50)

但我收到了这个错误:

TypeError:只有整数标量数组可以转换为标量索引

你认为发生了什么?

谢谢

4

1 回答 1

1

就我而言,我可以通过将数据转换为 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)

我也打开了一个问题

他的函数文档确实指定它应该是:

y : ndarray (signed)
    1D amplitude data to search for peaks.

TypeError:只有整数标量数组可以转换为标量索引

于 2017-06-18T23:22:41.357 回答