[Numpy-discussion] problems with calculating numpy.float64

michael.stoelzle at email.de michael.stoelzle at email.de
Fri May 11 10:34:22 EDT 2007


Hello out there,

i try to run this Python-code snippet after I have imported:

import numpy as Numeric
import numpy as numpy
Numeric.Int = Numeric.int32		
Numeric.Float = Numeric.float64	

Code:

if m < maxN and n < maxN and self.activeWide[m+1, n+1]: 
                            try: 
                               deltaX = x[m+1] - x[m] 
                            except TypeError: 
                               print '#' * 70 
                               print 'type x', type(x)
                               type_a, type_b = map(type, (x[m + 1], x[m])) 
                               print 'type_a, type_b', type_a, type_b, type_a is type_b 
                               print '#' * 70 
                               raise

My result for this part looks like this:

----------------------------------------
<type 'numpy.ndarray'>
<type 'numpy.float64'> <type 'numpy.float64'> True
----------------------------------------
Inappropriate argument type.
unsupported operand type(s) for -: 'numpy.float64' and 'numpy.float64'
 line 161 in setIDs in file F:\Unstrut_2007\arc_egmo\gw.py
 line 71 in __init__ in file F:\Unstrut_2007\arc_egmo\mf2000\mf2000exe.py
 line 380 in makeInactiveFringeMap in file F:\Unstrut_2007\arc_egmo\mf2000\mf2000exe.py

This means that Python cant execute the line:

deltaX = x[m+1] - x[m] 

You can see the "Types" of the values between the
---
---
two lines above.

I reproduce this problem in my Python 2.4 interpreter on my Windows XP Prof. OS and there are no problems in calculating with these Types, everything is OK.

Thanks for your help
Greetz from Berlin, Germany
Michael






More information about the NumPy-Discussion mailing list