[NumPy-Tickets] [NumPy] #1717: npma.sum(a_ma, axis=1) fails when no masked values are found

NumPy Trac numpy-tickets@scipy....
Tue Jan 18 07:31:54 CST 2011


#1717: npma.sum(a_ma,axis=1) fails when no masked values are found
------------------------------------+---------------------------------------
 Reporter:  markhmoulton@…          |       Owner:  pierregm
     Type:  defect                  |      Status:  new     
 Priority:  normal                  |   Milestone:  2.0.0   
Component:  numpy.ma                |     Version:  1.4.0   
 Keywords:  mask, sum, axis=1       |  
------------------------------------+---------------------------------------

Comment(by rgommers):

 Works for me:

 {{{
 In [14]: a = np.array([[0, 3, 1], [1, 0, 2], [1, 4, 4], [3, 0, 3]])

 In [15]: a
 Out[15]:
 array([[0, 3, 1],
        [1, 0, 2],
        [1, 4, 4],
        [3, 0, 3]])

 In [16]: a0 = np.ma.masked_values(a,0)

 In [17]: np.ma.sum(a0, axis=1)
 Out[17]:
 masked_array(data = [4 3 9 6],
              mask = [False False False False],
        fill_value = 999999)


 In [18]: a9_ma = np.ma.masked_values(a,9)

 In [19]: np.ma.sum(a9_ma, axis=1)
 Out[19]:
 masked_array(data = [4 3 9 6],
              mask = False,
        fill_value = 999999)
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1717#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list