[Numpy-discussion] Conversion from numarray to numpy
Michał Szpadzik
mszpadzik@o2...
Wed Jul 11 05:52:52 CDT 2007
Some time ago I wrote small lib for signal processing. Now I'm trying to
convert it from numarray to numpy, and I've problem:
Code in numarray:
for i in range(len(myinput)-m+1):
cin=tempmatr[:]
ctmp=tempmatr[i]
xtmp=(numarray.abs(cin-ctmp))<=r
x2tmp=numarray.sum(numarray.transpose(xtmp))
mcount=numarray.sum(x2tmp==m)
allcount=allcount+mcount
Code in numpy:
for i in range(len(myinput)-m+1):
cin=tempmatr[:]
ctmp=tempmatr[i]
xtmp=(numpy.abs(cin-ctmp))<=r
x2tmp=numpy.sum(numpy.transpose(xtmp))
mcount=numpy.sum(x2tmp==m)
allcount=allcount+mcount
In numarray line:
xtmp=(numarray.abs(cin-ctmp))<=r
returns array of ones and zeros, but in numpy
xtmp=(numpy.abs(cin-ctmp))<=r
returns True/False
I would like to know how change this True/False to 1/0
THX
--
Mike Szpadzik
More information about the Numpy-discussion
mailing list