[Yt-dev] Radius Calculation
Matthew Turk
matthewturk at gmail.com
Thu Apr 16 11:39:45 PDT 2009
Hi guys,
I've been exploring the idea of changing radius to be correct for
periodic boxes. Right now it is incorrect; each component (x,y,z)
should not have a distance greater than 0.5 * domain_size. The
easiest way to do this would be:
rx = min( abs( x - center_x ), abs( x - center_x - domain_x) )
I think the best way to do this is to set up a NumPy ufunc
http://docs.scipy.org/doc/numpy/user/c-info.beyond-basics.html#creating-a-new-universal-function
that accepts three arrays, along with the center and the domain width,
and then returns the radius. What do you all think? Alternatively,
I'm thinking maybe just a regular function that gets the arrays and
returns one would be better; the ufunc machinery is a bit complicated
and I might get confused. Once I come up with it, will somebody be
able to look over my work?
-Matt
More information about the yt-dev
mailing list