[Numpy-discussion] question about ufuncs
Darren Dale
dsdale24@gmail....
Sun Feb 1 17:32:41 CST 2009
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
*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 context, convert the Quantity
to units of radians, and then actually call the ufunc. Is this possible, or
does one have to reimplement such functions?
Thanks,
Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20090201/d8911fd4/attachment.html
More information about the Numpy-discussion
mailing list