Crawdad_Buckwheat
Crawdad_Buckwheat

Reputation: 323

peakutils.indexes gives TypeError: only integer scalar arrays can be converted to a scalar index

I have a list of floats called self.data[_]['smooth_ISA'] I'm giving this list to peakutils.indexes() like this:

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

But I'm getting this error:

TypeError: only integer scalar arrays can be converted to a scalar index

What do you think is going on?

Thanks

Upvotes: 2

Views: 1502

Answers (1)

will.mont
will.mont

Reputation: 81

In my case, I was able to get this to work by converting my data to a numpy array. There appears to be some change recently, in which you can't treat single scalar array as indexed array.

I was able to get this to work for me specifically by editing this within peak.py, approximately line 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)

I've also opened an issue.

His documentation for the function does specify that it should be:

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

TypeError: only integer scalar arrays can be converted to a scalar index

Upvotes: 1

Related Questions