Numpy error in peak.py indexes function
Hey, I was using this and I tried using some range-finding for by passing in some variables for peakutils.indexes(pixel_array, thres=arg1, min_dist=arg2).
When the peaks array is created, and this if statement is evaluated true:
if peaks.size > 1 and min_dist > 1
Gives a TypeError TypeError: only integer scalar arrays can be converted to a scalar index
at:
highest = peaks[np.argsort(y[peaks])][::-1]
I looked online and it appears that there was a recent numpy change, in how numpy treats lists. https://stackoverflow.com/questions/42128830/typeerror-only-integer-scalar-arrays-can-be-converted-to-a-scalar-index.
I was able to get this to work by adding this after your unsigned and numpy array. I then did a quick check using my data for many values greater than 1.
if isinstance(y, list):
y = np.array(y)
I saw you specified an numpy array for y
, so I wasn't sure if this is a new or old bug. But there are other numpy issues (in other packages that have numpy as a requirement) that arose in the last few months for people with newer versions of numpy
Comments (5)
-
repo owner -
repo owner Hi William,
Could you post a snippet that reproduces this bug?
Thanks.
-
repo owner - changed status to on hold
-
I also can confirm this issue and William’s suggestion is a work around. If you provide y as a list, it prokes that error.
-
repo owner Hi, @griffxcode , can you provide a snippet that reproduces this bug along with your numpy and peakutils version?
- Log in to comment
Hi William,
Thanks for raising the issue. I will verify it.