[Numpy-discussion] Conversion from numarray to numpy
Michał Szpadzik
mszpadzik at o2.pl
Wed Jul 11 06:52:52 EDT 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