[yt-users] data along rays
Elizabeth Tasker
taskere at mcmaster.ca
Tue Aug 9 10:49:45 PDT 2011
Hi,
I have a mystery:
Creating a ray via:
ray = pf.h.ray( com[c], com[nearestcore])
and I want to get the effective potential along it, for which I have a
subrountine for. However, yr gets stuck here:
if data.pf["HydroMethod"] == 2:
xvel[0:-1,0:-1,0:-1] =
0.5*(data["x-velocity"][slice(None,-1,None),0:-1,0:-1]+data["x-velocity"][slice(1,None,None),0:-1,0:-1])
I thought the problem was because a ray is a 1D data set and I was
trying to treat it like a 3D array, but what confuses me is that:
ray["DivV"]
works just fine but as the same sort of line within its definition.
http://yt.enzotools.org/doc/reference/field_list.html#divv
To make matters more confusing, if I copy out the definition of DivV
directly from universal_fields.py and implement it imaginatively as
DivV2, the code doesn't work, giving me:
/1/home/taskere/yt/scripts/iyt in _DivV2(field, data)
211 div_fac = 2.0
212 ds = div_fac * data['dx'].flat[0]
--> 213 f = data["x-velocity"][sl_right,1:-1,1:-1]/ds
214 f -= data["x-velocity"][sl_left ,1:-1,1:-1]/ds
215 if data.pf.dimensionality > 1:
IndexError: too many indices
What magic line does yt have to allow DivV to work for a ray?
Thanks,
Elizabeth
More information about the yt-users
mailing list