[NumPy-Tickets] [NumPy] #1559: atleast_?d() breaks masked arrays

NumPy Trac numpy-tickets@scipy....
Tue Jul 27 10:16:12 CDT 2010


#1559: atleast_?d() breaks masked arrays
------------------------+---------------------------------------------------
 Reporter:  weathergod  |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  high        |   Milestone:  1.5.0   
Component:  Other       |     Version:          
 Keywords:              |  
------------------------+---------------------------------------------------
 calling a function like .atleast_2d() to change the number of dimensions
 an array has can break the original masked array object.  See the
 following example using a 1d masked array:
 {{{
 >>> import numpy
 >>> a = numpy.ma.masked_array([0.0, 1.2, 3.5], mask=[False, True, False])
 >>> b = numpy.atleast_2d(a)
 >>> b
 masked_array(data =
  [[0.0 -- 3.5]],
              mask =
  [[False  True False]],
        fill_value = 1e+20)

 >>> a
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/home/bvr/Programs/numpy/numpy/ma/core.py", line 3570, in __repr__
     data=str(self), mask=str(self._mask),
   File "/home/bvr/Programs/numpy/numpy/ma/core.py", line 3554, in __str__
     res[m] = f
 ValueError: boolean index array should have 1 dimension
 >>>
 }}}
 The problem does not occur if there is no change to the number of
 dimensions.

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


More information about the NumPy-Tickets mailing list