.indexes doesn't work for uint?

Issue #6 resolved
Former user created an issue

Hi! ' Thanks for this code! As a Matlab user this is very intuitive. I encountered a problem when I wanted to find the peaks of a signal. My signal (or rather image) consists of uint16. When I try to find peaks .indexes returns an empty array. When I try the same by manually 'making' the same signal/array with int32 it returns the correct peaks. Is this intentional?

Cheers!

Comments (2)

  1. Lucas Hermann Negri repo owner

    Hello,

    peakutils.indexes() should work only on signed types, as it relies on computing the first difference of the data to check for peaks. Instead of automatically converting to a signed type, I've changed it to be explicit: specify this on the documentation and raise an exception if called with an unsigned type.

    You can convert it to a signed type before calling indexes, that is:

    idx = peakutils.indexes(y.astype(np.int16))
    

    Beware that peakutils will not report plateaus for now (and they are more probable of occurring in integer data).

  2. Log in to comment