[Numpy-discussion] masked arrays of structured arrays

Pierre GM pgmdevlist@gmail....
Sun Aug 30 12:19:43 CDT 2009


Oops, overlooked this one ...


On Aug 22, 2009, at 7:58 AM, Ernest Adrogué wrote:

> Hi there,
>
> Here is a structured array with 3 fields each of which has 3 fields
> in turn:
>
> However if try the same with a masked array, it fails:
>
> In [14]: x = np.ma.masked_all(2, dtype=desc)
>
> In [15]: x['x']['b'] = 2
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent  
> call last)
>
> /home/ernest/<ipython console> in <module>()
>
> /usr/lib/python2.5/site-packages/numpy/ma/core.pyc in  
> __setitem__(self, indx, value)
>   1574             if self._mask is nomask:
>   1575                 self._mask = make_mask_none(self.shape,  
> self.dtype)
> -> 1576             ndarray.__setitem__(self._mask, indx,  
> getmask(value))
>   1577             return
>   1578         #........................................
>
> ValueError: field named b not found.
>
> Any idea of what the problem is?

I can't reproduce that with a recent SVN version (r7348). What version  
of numpy are you using ?


More information about the NumPy-Discussion mailing list