[yt-users] data along rays
Matthew Turk
matthewturk at gmail.com
Tue Aug 9 11:13:15 PDT 2011
Hi Elizabeth,
You have to use the ValidateSpatial validator to ensure that the data handed
to te subroutine is 3D.
-Matt
On Aug 9, 2011 11:50 AM, "Elizabeth Tasker" <taskere at mcmaster.ca> wrote:
> 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
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20110809/50be53fa/attachment.html>
More information about the yt-users
mailing list