I am facing the error mentioned in subject line. error is encountered at data_temp=filtered[a:b] TypeError: only integer arrays with one element can be converted to an index what can be error The code snippet is as follows
'''left=some array right =some array, both are having same length. filtered is datafile(.txt) containing 4000 sample values left=(array([ 107, 594, 1082, 1569, 2057, 2545, 3033, 3520]),) right=(array([ 133, 621, 1109, 1597, 2085, 2573, 3061, 3550]),) maxval=empty(a) minval=empty(a) maxloc=empty(a) minloc=empty(a) data_temp=empty(a) a1=len(left) for i in arange(a1): a=left[i] b=right[i] print a,b data_temp=filtered[a:b] maxloc[i]=data_temp.argmax() maxval[i]=data_temp[maxloc] minloc[i]=data_temp.argmin() minval[i]=data_temp[minloc] maxloc[i] = maxloc[i]-1+left[i]# % add offset of present location minloc[i] = minloc[i]-1+left[i]# % add offset of present location''' R_index = maxloc R_t = t[maxloc] Thanks in advance Regards Yogesh
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion