Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-29 Thread Bruce Southey
On 03/27/2010 01:31 PM, Ryan May wrote: On Sat, Mar 27, 2010 at 11:12 AM,josef.p...@gmail.com wrote: On Sat, Mar 27, 2010 at 1:00 PM, Ryan Mayrma...@gmail.com wrote: On Mon, Mar 22, 2010 at 8:14 AM, Ryan Mayrma...@gmail.com wrote: On Sun, Mar 21, 2010 at 11:57

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-29 Thread Ryan May
On Mon, Mar 29, 2010 at 8:00 AM, Bruce Southey bsout...@gmail.com wrote: On 03/27/2010 01:31 PM, Ryan May wrote: Because of the call to asarray(), the mask is completely discarded and you end up with identical results to an unmasked array, which is not what I'd expect.  Worse, the actual

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-29 Thread Ryan May
Hi, I decided that having actual code that does what I want and keeps backwards compatibility (and adds tests) might be better than arguing semantics. I've updated my patch to: * Uses the array.sum() method instead of add.reduce to make subclasses fully work (this was still breaking masked

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-29 Thread Bruce Southey
On 03/29/2010 10:17 AM, Ryan May wrote: On Mon, Mar 29, 2010 at 8:00 AM, Bruce Southeybsout...@gmail.com wrote: On 03/27/2010 01:31 PM, Ryan May wrote: Because of the call to asarray(), the mask is completely discarded and you end up with identical results to an unmasked array,

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-28 Thread Darren Dale
On Sat, Mar 27, 2010 at 10:23 PM, josef.p...@gmail.com wrote: subclasses of ndarray, like masked_arrays and quantities, and classes that delegate to array calculations, like pandas, can redefine anything. So there is not much that can be relied on if any subclass is allowed to be used inside

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-27 Thread Ryan May
On Mon, Mar 22, 2010 at 8:14 AM, Ryan May rma...@gmail.com wrote: On Sun, Mar 21, 2010 at 11:57 PM,  josef.p...@gmail.com wrote: On Mon, Mar 22, 2010 at 12:49 AM, Ryan May rma...@gmail.com wrote: Hi, I found that trapz() doesn't work with subclasses:

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-27 Thread josef . pktd
On Sat, Mar 27, 2010 at 1:00 PM, Ryan May rma...@gmail.com wrote: On Mon, Mar 22, 2010 at 8:14 AM, Ryan May rma...@gmail.com wrote: On Sun, Mar 21, 2010 at 11:57 PM,  josef.p...@gmail.com wrote: On Mon, Mar 22, 2010 at 12:49 AM, Ryan May rma...@gmail.com wrote: Hi, I found that trapz()

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-27 Thread Ryan May
On Sat, Mar 27, 2010 at 11:12 AM, josef.p...@gmail.com wrote: On Sat, Mar 27, 2010 at 1:00 PM, Ryan May rma...@gmail.com wrote: On Mon, Mar 22, 2010 at 8:14 AM, Ryan May rma...@gmail.com wrote: On Sun, Mar 21, 2010 at 11:57 PM,  josef.p...@gmail.com wrote: On Mon, Mar 22, 2010 at 12:49 AM,

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-27 Thread josef . pktd
On Sat, Mar 27, 2010 at 2:31 PM, Ryan May rma...@gmail.com wrote: On Sat, Mar 27, 2010 at 11:12 AM,  josef.p...@gmail.com wrote: On Sat, Mar 27, 2010 at 1:00 PM, Ryan May rma...@gmail.com wrote: On Mon, Mar 22, 2010 at 8:14 AM, Ryan May rma...@gmail.com wrote: On Sun, Mar 21, 2010 at 11:57 PM,

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-27 Thread Ryan May
On Sat, Mar 27, 2010 at 8:23 PM, josef.p...@gmail.com wrote: Matrices have been part of numpy for a long time and your patch would break backwards compatibility in a pretty serious way. Yeah, and I should admit that I realize that makes this particular patch a no-go. However, that to me

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-27 Thread josef . pktd
On Sat, Mar 27, 2010 at 11:37 PM, Ryan May rma...@gmail.com wrote: On Sat, Mar 27, 2010 at 8:23 PM,  josef.p...@gmail.com wrote: Matrices have been part of numpy for a long time and your patch would break backwards compatibility in a pretty serious way. Yeah, and I should admit that I realize

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-22 Thread Ryan May
On Sun, Mar 21, 2010 at 11:57 PM, josef.p...@gmail.com wrote: On Mon, Mar 22, 2010 at 12:49 AM, Ryan May rma...@gmail.com wrote: Hi, I found that trapz() doesn't work with subclasses: http://projects.scipy.org/numpy/ticket/1438 A simple patch (attached) to change asarray() to asanyarray()

Re: [Numpy-discussion] numpy.trapz() doesn't respect subclass

2010-03-21 Thread josef . pktd
On Mon, Mar 22, 2010 at 12:49 AM, Ryan May rma...@gmail.com wrote: Hi, I found that trapz() doesn't work with subclasses: http://projects.scipy.org/numpy/ticket/1438 A simple patch (attached) to change asarray() to asanyarray() fixes the problem fine. Are you sure this function works with