[yt-users] ray objects
Sam Skillman
samskillman at gmail.com
Tue Aug 16 12:41:12 PDT 2011
Hi Elizabeth,
So the issue here, I think, is that while the rays are sorted, they traverse
varying sized cells. When you query the field 'x', you are actually
querying the 'x' value of the cell that the ray intersects, not the position
of the ray itself. This, in combination with the fact that fields like 'x'
are cell centered, means that you can see weird jumps when you go from a
highly refined cell to a root grid cell. You could check this by looking at
what ray1['dx'] is, and if it is large for the second value, then this is
the issue.
If you'd like to recover the x,y, position of the ray at that point, I would
use the field 't', which is the integral of dt (distance) along the ray.
You could then use the starting position and the direction to recover the
position along the ray.
That said, if all you are worried about is the Density, it should in fact be
giving you the ordered density values. If you were to
matplotlib.pylab.plot(ray1['t'], ray1['Density']) it should give you a plot
of the density along the ray.
For reference, much of this is described here:
http://yt.enzotools.org/doc/analyzing/generating_processed_data.html#line-queries-and-planar-integrals
Best,
Sam
On Tue, Aug 16, 2011 at 12:49 PM, Elizabeth Tasker <taskere at mcmaster.ca>wrote:
> Hi,
>
> When you create a ray object with yt, e.g.
>
> ray1 = pf.h.ray([10,16,16], [10.3,16.1,16])
>
> I was expecting to get the values of the cells that lie inbetween those two
> sets of co-ordinates. Instead, it looks like the first two values back at
> the start and end points. .e.g.:
>
> -------> print(ray1["x"])
> Warning: divide by zero encountered in divide
> Warning: invalid value encountered in multiply
> Warning: divide by zero encountered in divide
> Warning: invalid value encountered in multiply
> yt : [INFO ] 2011-08-16 14:47:27,962 Getting field t from 92
> yt : [INFO ] 2011-08-16 14:47:28,972 Getting field x from 92
> [ 10.0078125 10.30078125 10.0234375 10.0390625 10.0390625
> 10.0546875 10.0703125 10.0859375 10.0859375 10.1015625
> 10.1171875 10.1328125 10.1328125 10.1484375 10.1640625
> 10.17578125 10.18359375 10.18359375 10.19140625 10.19921875
> 10.20703125 10.20703125 10.21484375 10.22265625 10.23046875
> 10.23046875 10.23828125 10.24609375 10.25390625 10.25390625
> 10.26171875 10.26953125 10.27734375 10.27734375 10.28515625
> 10.29296875]
>
> In [53]: print ray1["y"]
> -------> print(ray1["y"])
> yt : [INFO ] 2011-08-16 14:48:23,698 Getting field y from 92
> [ 16.0078125 16.09765625 16.0078125 16.0078125 16.0234375
> 16.0234375 16.0234375 16.0234375 16.0390625 16.0390625
> 16.0390625 16.0390625 16.0546875 16.0546875 16.0546875
> 16.05859375 16.05859375 16.06640625 16.06640625 16.06640625
> 16.06640625 16.07421875 16.07421875 16.07421875 16.07421875
> 16.08203125 16.08203125 16.08203125 16.08203125 16.08984375
> 16.08984375 16.08984375 16.08984375 16.09765625 16.09765625
> 16.09765625]
>
>
> Is that right? Should I ignore the first two values of ray1 when I'm
> examining the data, e.g. ray1["Density"]?
>
> Thanks!
>
> Elizabeth
>
> ______________________________**_________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/**listinfo.cgi/yt-users-**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/20110816/a28bf0f8/attachment.html>
More information about the yt-users
mailing list