Re: [Numpy-discussion] surprising behavior of np.asarray on masked arrays

2013-12-05 Thread Eric Firing
On 2013/12/05 5:14 PM, Faraz Mirzaei wrote: > Hi, > > If I pass a masked array through np.asarray, I get original unmasked array. > > Example: > > test = np.array([[1, 0], [-1, 3]]) > > testMasked = ma.masked_less_equal(test, 0) > > > print testMasked > > [[1 --] > > [-- 3]] > > > print testMaske

Re: [Numpy-discussion] surprising behavior of np.asarray on masked arrays

2013-12-05 Thread Stéfan van der Walt
Hi Faraz On Thu, 05 Dec 2013 19:14:01 -0800, Faraz Mirzaei wrote: > If I pass a masked array through np.asarray, I get original unmasked array. `asarray` disregards any information attached to the underlying ndarray by the subclass. To preserve the subclass, you'd need to use `asanyarray`. The

[Numpy-discussion] surprising behavior of np.asarray on masked arrays

2013-12-05 Thread Faraz Mirzaei
Hi, If I pass a masked array through np.asarray, I get original unmasked array. Example: test = np.array([[1, 0], [-1, 3]]) testMasked = ma.masked_less_equal(test, 0) print testMasked [[1 --] [-- 3]] print testMasked.fill_value 99 print np.asarray(testMasked) [[ 1 0] [-1 3]]