[yt-users] add_ray problem

Matthew Turk matthewturk at gmail.com
Thu Oct 21 00:53:07 PDT 2010


Hi Dave,

This is a bug, and I was able to replicate it.  If you jitter the
0.5*dx on either side, it will work.  The "ray" object was written for
*non*-orthogonal rays, but you're feeding it an orthogonal ray.  Use
ortho_ray for rays aligned with the grid axes.  What's happening here
is that the code doesn't check that you have 0-delta in the x,y
directions and it performs a division to get the delta on those
directions.  Specifically, it does this:

        tl = (left_edge[i] - u[i])/v[i]
        tr = (right_edge[i] - u[i])/v[i]

to calculate where a ray intersects a grid boundary.  v[i] here is zero.

Anyway, you can either jitter a bit on the endpoints (which will keep
probably the same *values* returned but change the parameter 't' you
get back) or use an orthogonal ray object, which should be faster
anyway.  The fix, which I'l lapply the next time I re-cythonize and
commit the amr_utils.so module, is probably the same or similar to the
volume rendering fix from a few weeks ago.

-Matt

On Wed, Oct 20, 2010 at 9:11 PM, David Collins
<dcollins at physics.ucsd.edu> wrote:
> Alas, I tried:
>
> dx=pf.h.get_smallest_dx()
> this_ray = pf.h.ray([0.5*dx]*3,[0.5*dx, 0.5*dx, 1],'Density')
>
> and got the same result.
>
> d.
>
> On Wed, Oct 20, 2010 at 7:40 PM, Britton Smith <brittonsmith at gmail.com> wrote:
>> Hi Dave,
>>
>> I believe the problem is that the ray travels right down cell boundaries
>> with ever entering any cells.  The ray tool expects the ray to go into cells
>> and will not interpolate between cells if it's right on the boundary.  The
>> divide by zero is coming from trying to calculate exactly where the ray
>> intersects cell boundaries in each direction.  If you move the start or end
>> positions just a hair in both the x and y, it should be fine.
>>
>> Britton
>>
>> On Wed, Oct 20, 2010 at 8:13 PM, david collins <antpuncher at gmail.com> wrote:
>>>
>>> Hi, all--
>>>
>>> I'm having trouble with add_ray.  I'm trying to do the following, but
>>> I get the error that follows the following.  I saw that Dr. Tasker
>>> recently did a nearly identical thing with more success.  I've tried
>>> it both on Triton, with the projects install at
>>> /projects/lca-group/bla and a trunk install on Kraken.  Any thoughts?
>>> It works if I use [0.0]*3 and [1.0]*3 as my endpoints.
>>>
>>> >>> this_ray = pf.h.ray([0.5]*3,[0.5,0.5,1.0],'Density')
>>> >>> f='x-velocity'
>>> >>> L = plt.plot(this_ray['x'],this_ray[f])
>>>
>>> Traceback (most recent call last):
>>>  File "<stdin>", line 1, in <module>
>>>  File "tmp.py", line 5, in <module>
>>>    L = plt.plot(this_ray['x'],this_ray[f])
>>>  File
>>> "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/BaseDataTypes.py",
>>> line 249, in __getitem__
>>>    self.get_data(key)
>>>  File
>>> "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/BaseDataTypes.py",
>>> line 424, in get_data
>>>    for grid in self._grids])
>>>  File
>>> "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/BaseDataTypes.py",
>>> line 529, in _get_data_from_grid
>>>    mask = na.logical_and(self._get_cut_mask(grid),
>>>  File
>>> "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/BaseDataTypes.py",
>>> line 58, in check_cache
>>>    cm = func(self, grid)
>>>  File
>>> "/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/BaseDataTypes.py",
>>> line 542, in _get_cut_mask
>>>    grid.dds, self.center, self.vec)
>>>  File "RayIntegrators.pyx", line 156, in yt.amr_utils.VoxelTraversal
>>> (yt/amr_utils.c:9986)
>>> ZeroDivisionError: float division
>>> >>> lagos
>>> <module 'yt.lagos' from
>>>
>>> '/projects/lca-group/local-dev/lib/python2.6/site-packages/yt-2.0dev-py2.6-linux-x86_64.egg/yt/lagos/__init__.pyc'>
>>>
>>> --
>>> Sent from my Stone Tablet and carried by my Pterodactyl.
>>> _______________________________________________
>>> yt-users mailing list
>>> yt-users at lists.spacepope.org
>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>
>
>
> --
> Sent from my Stone Tablet and carried by my Pterodactyl.
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>



More information about the yt-users mailing list