[Numpy-discussion] (no subject)
David J Strozzi
strozzi2 at llnl.gov
Wed May 13 16:18:45 EDT 2009
Hi,
[You may want to edit the numpy homepage numpy.scipy.org to tell
people they must subscribe to post, and adding a link to
http://www.scipy.org/Mailing_Lists]
Many of you probably know of the interpreter yorick by Dave Munro. As
a Livermoron, I use it all the time. There are some built-in
functions there, analogous to but above and beyond numpy's sum() and
diff(), which are quite useful for common operations on gridded data.
Of course one can write their own, but maybe they should be cleanly
canonized?
For instance:
x = linspace(0,10,10)
y = sin(x)
It is common, say when integrating y(x), to take "point-centered"
data and want to zone-center it:
I = sum(zcen(y)*diff(x))
def zcen(x): return 0.5*(x[0:-1]+x[1:])
Besides zcen, yorick has builtins for "point centering", "un-zone
centering," etc. Also, due to its slick syntax you can give these
things as array "indexes":
x(zcen), y(dif), z(:,sum,:)
Just some thoughts,
David Strozzi
More information about the NumPy-Discussion
mailing list