[Numpy-discussion] bug ! arr.mean() outside arr.min() .. arr.max() range

Sebastian Haase haase at msg.ucsf.edu
Fri Aug 11 16:44:16 CDT 2006


Hi!
b is a non-native byteorder array of type int16
but see further down: same after converting to native ...
>>> repr(b.dtype)
'dtype('>i2')'
>>> b.dtype.isnative
False
>>> b.shape
(38, 512, 512)

>>> b.max()
1279
>>> b.min()
0
>>> b.mean()
-65.279878014
>>> U.mmms(b)  # my "useful" function for min,max,mean,stddev
(0, 1279, 365.878016723, 123.112379036)

>>> c = b.copy()
>>> c.max()
1279
>>> c.min()
0
>>> c.mean()
-65.279878014
>>> d = N.asarray(b, b.dtype.newbyteorder('='))
>>> d.dtype.isnative
True
>>> 
>>> >>> d.max()
1279
>>> d.min()
0
>>> d.mean()
-65.279878014
>>> N.__version__
'1.0b2.dev2996'
>>> 

Sorry that I don't have a simple example - what could be wrong !?

- Sebastian Haase




More information about the Numpy-discussion mailing list