[NumPy-Tickets] [NumPy] #1688: MaskedArray.__str__ fails with ValueError if data are record array
NumPy Trac
numpy-tickets@scipy....
Mon Nov 29 12:15:04 CST 2010
#1688: MaskedArray.__str__ fails with ValueError if data are record array
----------------------+-----------------------------------------------------
Reporter: gerrit | Owner: pierregm
Type: defect | Status: new
Priority: normal | Milestone: 2.0.0
Component: numpy.ma | Version: devel
Keywords: |
----------------------+-----------------------------------------------------
When a MaskedArray's data are a record array,, string representation fails
with a ValueError as the mask does not contain the mapping of field names
that the data does.
It appears the records are not carried on to the mask.
{{{
$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> Z = np.empty((5,), dtype=[('A', np.float32), ('B', np.uint32)])
>>> M = np.ma.masked_where(np.array([True, False, True, False, True]), Z)
>>> print M
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/storage4/home/gerrit/.local/lib/python2.6/site-
packages/numpy/ma/core.py", line 3558, in __str__
_recursive_printoption(res, m, f)
File "/storage4/home/gerrit/.local/lib/python2.6/site-
packages/numpy/ma/core.py", line 2292, in _recursive_printoption
(curdata, curmask) = (result[name], mask[name])
ValueError: field named A not found.
>>> print np.version.version
2.0.0.dev-12d0200
}}}
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1688>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list