[NumPy-Tickets] [NumPy] #1440: Numpy 'where' cannot handle masked arrays with boolean arrays for masks

NumPy Trac numpy-tickets@scipy....
Sat Mar 27 15:31:55 CDT 2010


#1440: Numpy 'where' cannot handle masked arrays with boolean arrays for masks
---------------------------+------------------------------------------------
 Reporter:  brendanarnold  |       Owner:  somebody
     Type:  defect         |      Status:  new     
 Priority:  normal         |   Milestone:          
Component:  Other          |     Version:  1.3.0   
 Keywords:                 |  
---------------------------+------------------------------------------------
 To reproduce ...

 {{{

 In [1]: a = np.ma.arange(5)
 In [2]: a
 Out[2]:
 masked_array(data = [0 1 2 3 4],
              mask = False,
        fill_value = 999999)
 In [3]: np.where(a == 1)
 Out[3]:
 (masked_array(data = [1],
              mask = False,
        fill_value = 999999)
 ,)
 In [4]: a.mask = a == 1
 In [5]: a
 Out[5]:
 masked_array(data = [0 -- 2 3 4],
              mask = [False  True False False False],
        fill_value = 999999)
 In [6]: np.where(a == 1)
 ---------------------------------------------------------------------------
 ValueError                                Traceback (most recent call
 last)

 C:\Documents and Settings\ba1224\My Documents\Python\<ipython console> in
 <module>()

 C:\Python26\lib\site-packages\numpy\ma\core.pyc in
 __array_finalize__(self, obj)
    2445         # Finalize the mask ...........

    2446         if self._mask is not nomask:
 -> 2447             self._mask.shape = self.shape
    2448         return
    2449     #..................................


 ValueError: total size of new array must be unchanged
 }}}

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


More information about the NumPy-Tickets mailing list