`.indexes` does not seem to work for `float64` types
Issue #11
invalid
Hi, I am trying to detect peaks in a simple dataset. the .indexes
method returns blank list for the dataset when I convert it into numpy's float64
datatype, but works when the data is converted to int
.
To replicate the issue:
col = [u'2161', u'183', u'167', u'270', u'164', u'475', u'327', u'279', u'0',
u'183', u'360', u'81', u'81', u'81', u'81', u'45', u'81', u'0', u'81', u'81']
import numpy as np
y1 = np.atleast_1d(col).astype('float64')
y2 = np.atleast_1d(col).astype('int')
import peakutils as pu
peaks1 = pu.indexes(y1)
peaks2 = pu.indexes(y2)
print "peaks1:", peaks1, "peaks2: ", peaks2
Result:
peaks1: [] peaks2: [ 3 5 10 16]
Is there something obvious I am missing. Any help would be great.
Comments (2)
-
repo owner -
repo owner - changed status to invalid
Doesn't shows on git HEAD.
- Log in to comment
Hi,
This is due to the threshold parameter. The first value is 2161, so the default threshold is 2161*0.3. Anything below it is not considered as peaks. If you pass thres=0.01, the peaks will be found.
However, I can't replicate this output. It shows [] and [] here (both Python 2 and 3). I think you are running and old version that couldn't handle int value properly.