[Numpy-discussion] Numpy 1.4 MaskedArray bug?

Pauli Virtanen pav@iki...
Tue Jan 12 12:32:09 CST 2010


ti, 2010-01-12 kello 12:51 -0500, Pierre GM kirjoitti:
[clip] 
> >>>> a = numpy.ma.MaskedArray([[1,2,3],[4,5,6]])
> >>>> numpy.ma.sum(a, 1)
> > Traceback (most recent call last):
> >  File "<stdin>", line 1, in <module>
> >  File
> > "/usr/lib64/python2.5/site-packages/numpy-1.4.0-py2.5-linux-x86_64.egg/n
> > umpy/ma/core.py", line 5682, in __call__
> >    return method(*args, **params)
> >  File
> > "/usr/lib64/python2.5/site-packages/numpy-1.4.0-py2.5-linux-x86_64.egg/n
> > umpy/ma/core.py", line 4357, in sum
> >    newmask = _mask.all(axis=axis)
> > ValueError: axis(=1) out of bounds
> 
> Confirmed.
> Before I take full blame for it, can you try the following on both 1.3 and 1.4 ?
> >>> np.array(False).all().sum(1)

Oh crap, it's mostly my fault:

http://projects.scipy.org/numpy/ticket/1286
http://projects.scipy.org/numpy/changeset/7697
http://projects.scipy.org/numpy/browser/trunk/doc/release/1.4.0-notes.rst#deprecations

Pretty embarassing, as very simple things break, although the test suite
miraculously passes...

> Back to your problem: I'll fix that ASAIC, but it'll be on the SVN. Meanwhile, you can:
> * Use -1 instead of 1 for your axis.
> * Force the definition of a mask when you define your array with masked_array(...,mask=False)

Sounds like we need a 1.4.1 out at some point not too far in the future,
then.

	Pauli




More information about the NumPy-Discussion mailing list