[NumPy-Tickets] [NumPy] #1394: np.isnan not working correctly with vector columns in masked structure arrays

NumPy Trac numpy-tickets@scipy....
Tue Feb 9 08:32:11 CST 2010


#1394: np.isnan not working correctly with vector columns in masked structure
arrays
------------------------+---------------------------------------------------
 Reporter:  robitaille  |       Owner:  pierregm
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:          
Component:  numpy.ma    |     Version:  devel   
 Keywords:              |  
------------------------+---------------------------------------------------
 The following example fails:

 {{{
 import numpy as np
 import numpy.ma as ma

 arr = ma.zeros((5),dtype=[('a',np.float32,3)])
 np.isnan(arr['a'])
 }}}

 giving:

 {{{
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)

 /Users/tom/tmp/test_masked.py in <module>()
       3
       4 arr = ma.zeros((5),dtype=[('a',np.float32,3)])
 ----> 5 np.isnan(arr['a'])
       6
       7

 /Users/tom/Library/Python/2.6/site-packages/numpy/ma/core.pyc in
 __array_wrap__(self, obj, context)
    2806         Wraps the numpy array and sets the mask according to
 context.
    2807         """
 -> 2808         result = obj.view(type(self))
    2809         result._update_from(self)
    2810         #..........


 /Users/tom/Library/Python/2.6/site-packages/numpy/ma/core.pyc in
 view(self, dtype, type)
    2879                 pass
    2880         # Make sure to reset the _fill_value if needed

 -> 2881         if getattr(output, '_fill_value', None):
    2882             output._fill_value = None
    2883         return output

 ValueError: The truth value of an array with more than one element is
 ambiguous. Use a.any() or a.all()
 }}}

 This is in NumPy r8095

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1394>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list