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] Deprecate boolean math operators?

2013-12-05 Thread josef . pktd
On Thu, Dec 5, 2013 at 11:00 PM, Alexander Belopolsky wrote: > > On Thu, Dec 5, 2013 at 10:35 PM, wrote: >> >> what about np.dot,np.dot(mask, x) which is the same as (mask * >> x).sum(0) ? > > > I am not sure which way your argument goes, but I don't think you would find > the following natur

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

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Alexander Belopolsky
On Thu, Dec 5, 2013 at 11:05 PM, Alan G Isaac wrote: > For + and * (and thus `dot`), this will "fix" something that is not broken. + and * are not broken - just redundant given | and &. What is really broken is -, both unary and binary: >>> int(np.bool_(0) - np.bool_(1)) 1 >>> int(-np.bool_(0

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Alan G Isaac
For + and * (and thus `dot`), this will "fix" something that is not broken. It is in fact in conformance with a large literature on boolean arrays and boolean matrices. That not everyone pays attention to this literature does not constitute a reason to break the extant, correct behavior. I'm sure

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread josef . pktd
On Thu, Dec 5, 2013 at 10:56 PM, Alexander Belopolsky wrote: > On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg > wrote: >> there was a discussion that for numpy booleans math operators +,-,* (and >> the unary -), while defined, are not very helpful. > > It has been suggested at the Github that the

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Alexander Belopolsky
On Thu, Dec 5, 2013 at 10:35 PM, wrote: > what about np.dot,np.dot(mask, x) which is the same as (mask * > x).sum(0) ? I am not sure which way your argument goes, but I don't think you would find the following natural: >>> x = array([True, True]) >>> dot(x,x) True >>> (x*x).sum() 2 >>> (x*

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Alexander Belopolsky
On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg wrote: > there was a discussion that for numpy booleans math operators +,-,* (and > the unary -), while defined, are not very helpful. It has been suggested at the Github that there is an area where it is useful to have linear algebra operations like

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread josef . pktd
On Thu, Dec 5, 2013 at 10:33 PM, wrote: > On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg > wrote: >> Hey, >> >> there was a discussion that for numpy booleans math operators +,-,* (and >> the unary -), while defined, are not very helpful. I have set up a quick >> PR with start (needs some fixes

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread josef . pktd
On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg wrote: > Hey, > > there was a discussion that for numpy booleans math operators +,-,* (and > the unary -), while defined, are not very helpful. I have set up a quick > PR with start (needs some fixes inside numpy still): > > https://github.com/numpy/n

[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]]

Re: [Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Alexander Belopolsky
On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg wrote: > For the moment I saw one "annoying" change in > numpy, and that is `abs(x - y)` being used for allclose and working > nicely currently. > It would probably be an improvement if allclose returned all(x == y) unless one of the arguments is ine

[Numpy-discussion] Deprecate boolean math operators?

2013-12-05 Thread Sebastian Berg
Hey, there was a discussion that for numpy booleans math operators +,-,* (and the unary -), while defined, are not very helpful. I have set up a quick PR with start (needs some fixes inside numpy still): https://github.com/numpy/numpy/pull/4105 The idea is to deprecate these, since the binary op

Re: [Numpy-discussion] no more search capability?

2013-12-05 Thread Slavin, Jonathan
Answering part of my own question, I see that there is still a search capability on one of the numpy web pages, but it's not where it used to be and, in my opinion, is not easy to find. There used to be a search box on each web page of the numpy docs. Jon On Thu, Dec 5, 2013 at 1:00 PM, wrote:

[Numpy-discussion] no more search capability?

2013-12-05 Thread Slavin, Jonathan
Hi all, Although I like the look of the newly designed numpy/scipy web pages, I have to say that I really miss the search capability. Is there any motion toward restoring that? Jon -- Jonathan D. Slavin Harvard-Smithsonian