[Numpy-discussion] bug in numarray.maximum.reduce ?
Sebastian Haase
haase at msg.ucsf.edu
Tue Jun 29 17:08:01 EDT 2004
Hi,
Is this a bug?:
>>> # (import numarray as na ; 'd' is a 3 dimensional array)
>>> d.type()
Float32
>>> d[80, 136, 122]
80.3997039795
>>> na.maximum.reduce(d[:,136, 122])
85.8426361084
>>> na.maximum.reduce(d) [136, 122]
37.3658103943
>>>
>>>
>>> na.maximum.reduce(d,0)[136, 122]
37.3658103943
>>> na.maximum.reduce(d,1)[136, 122]
Traceback (most recent call last):
File "<input>", line 1, in ?
IndexError: Index out of range
I was using na.maximum.reduce(d) to get a "pixelwise" maximum along Z (axis
0). But as seen above it does not get it right. I then tried to reproduce
this with some simple arrays, but here it works just fine:
>>> a = na.arange(4*4*4)
>>> a.shape=(4,4,4)
>>> na.maximum.reduce(a)
[[48 49 50 51]
[52 53 54 55]
[56 57 58 59]
[60 61 62 63]]
>>> a = na.arange(4*4*4).astype(na.Float32)
>>> a.shape=(4,4,4)
>>> na.maximum.reduce(a)
[[ 48. 49. 50. 51.]
[ 52. 53. 54. 55.]
[ 56. 57. 58. 59.]
[ 60. 61. 62. 63.]]
>>>
Any hint ?
Regards,
Sebastian Haase
More information about the NumPy-Discussion
mailing list