Re: [Numpy-discussion] question about ufuncs

2009-02-06 Thread Darren Dale
On Fri, Feb 6, 2009 at 6:11 PM, Darren Dale wrote: > On Fri, Feb 6, 2009 at 5:18 PM, Pierre GM wrote: > >> >> On Feb 6, 2009, at 4:25 PM, Darren Dale wrote: >> >> > >> > I've been looking at how ma implements things like multiply() and >> > MaskedArray.__mul__. I'm surprised that MaskedArray.__m

Re: [Numpy-discussion] question about ufuncs

2009-02-06 Thread Darren Dale
On Fri, Feb 6, 2009 at 5:18 PM, Pierre GM wrote: > > On Feb 6, 2009, at 4:25 PM, Darren Dale wrote: > > > > > I've been looking at how ma implements things like multiply() and > > MaskedArray.__mul__. I'm surprised that MaskedArray.__mul__ actually > > calls ma.multiply() rather than calling > >

Re: [Numpy-discussion] question about ufuncs

2009-02-06 Thread Pierre GM
On Feb 6, 2009, at 4:25 PM, Darren Dale wrote: > > I've been looking at how ma implements things like multiply() and > MaskedArray.__mul__. I'm surprised that MaskedArray.__mul__ actually > calls ma.multiply() rather than calling > super(MaskedArray,self).__mul__(). There's some under-the-

Re: [Numpy-discussion] question about ufuncs

2009-02-06 Thread Darren Dale
On Sun, Feb 1, 2009 at 7:39 PM, Darren Dale wrote: > On Sun, Feb 1, 2009 at 7:33 PM, Pierre GM wrote: > >> >> On Feb 1, 2009, at 6:32 PM, Darren Dale wrote: >> > >> > >> > Is there an analog to __array_wrap__ for preprocessing arrays on >> > their way *into* a ufunc? For example, it would be nic

Re: [Numpy-discussion] question about ufuncs

2009-02-01 Thread Darren Dale
On Sun, Feb 1, 2009 at 7:33 PM, Pierre GM wrote: > > On Feb 1, 2009, at 6:32 PM, Darren Dale wrote: > > > > > > Is there an analog to __array_wrap__ for preprocessing arrays on > > their way *into* a ufunc? For example, it would be nice if one could > > do something like: > > > > numpy.sin([1,2,3

Re: [Numpy-discussion] question about ufuncs

2009-02-01 Thread Pierre GM
On Feb 1, 2009, at 6:32 PM, Darren Dale wrote: > > > Is there an analog to __array_wrap__ for preprocessing arrays on > their way *into* a ufunc? For example, it would be nice if one could > do something like: > > numpy.sin([1,2,3]*arcseconds) > > where we have the opportunity to inspect the c

[Numpy-discussion] question about ufuncs

2009-02-01 Thread Darren Dale
I've been playing with __array_wrap__ to make quantities with units play well with numpy's ufuncs. For example, __array_wrap__ makes it is possible to do the following: >>> numpy.sqrt([1.,4.,9.]*m**2) array([1.,2.,3.])*m Is there an analog to __array_wrap__ for preprocessing arrays on their way *