[yt-users] yt.lagos.AMRRayBase

gso at physics.ucsd.edu gso at physics.ucsd.edu
Mon Nov 8 12:45:52 PST 2010


I was trying to find the values of a field between two arbitrary points,
so instead of ortho_ray which I think is limited to x,y,z, I used "ray"
instead.   My script worked, but when I tried another set of two points
they gave a bunch of errors.  I used the following two points:

field='Density'
end_pt = (0.6015625, 0.1015625, 0.3359375)
start_pt = (0.6953125, 0.1015625, 0.6640625)
profile = pf.h.ray(start_pt, end_pt, field)

it turns out that when part of the the two points are the exactly same (in
this case "y" portion) the code would spit out the error at the bottom of
this email.

is this a bug? I can just change the 0.1015625 to something else that's
very similar like 0.1015626 (changing only the last decimal digit) to
avoid this error for now, which shouldn't affect my answer too much.

From
G.S.

error:

In [187]: profile['t']
yt         INFO       2010-11-08 12:32:36,331 Getting field t from 2
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.0dev-py2.6-macosx-10.6-intel.egg/EGG-INFO/scripts/iyt
in <module>()
----> 1
      2
      3
      4
      5

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.0dev-py2.6-macosx-10.6-intel.egg/yt/lagos/BaseDataTypes.pyc
in __getitem__(self, key)
    247             if key not in self.fields:
    248                 self.fields.append(key)
--> 249             self.get_data(key)
    250         return self.data[key]
    251

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.0dev-py2.6-macosx-10.6-intel.egg/yt/lagos/BaseDataTypes.pyc
in get_data(self, fields, in_grids)
    422             self[field] = na.concatenate(
    423                 [self._get_data_from_grid(grid, field)
--> 424                  for grid in self._grids])
    425             if not self.data.has_key(field):
    426                 continue

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.0dev-py2.6-macosx-10.6-intel.egg/yt/lagos/BaseDataTypes.pyc
in _get_data_from_grid(self, grid, field)
    527
    528     def _get_data_from_grid(self, grid, field):
--> 529         mask = na.logical_and(self._get_cut_mask(grid),
    530                               grid.child_mask)
    531         if field == 'dts': return self._dts[grid.id][mask]

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.0dev-py2.6-macosx-10.6-intel.egg/yt/lagos/BaseDataTypes.pyc
in check_cache(self, grid)
     56             return func(self, grid)
     57         elif grid.id not in self._cut_masks:
---> 58             cm = func(self, grid)
     59             self._cut_masks[grid.id] = cm
     60         return self._cut_masks[grid.id]

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.0dev-py2.6-macosx-10.6-intel.egg/yt/lagos/BaseDataTypes.pyc
in _get_cut_mask(self, grid)
    540         from yt.amr_utils import VoxelTraversal
    541         VoxelTraversal(mask, ts, dts, grid.LeftEdge, grid.RightEdge,
--> 542                        grid.dds, self.center, self.vec)
    543         self._dts[grid.id] = na.abs(dts)
    544         self._ts[grid.id] = na.abs(ts)

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/yt-2.0dev-py2.6-macosx-10.6-intel.egg/yt/amr_utils.so
in yt.amr_utils.VoxelTraversal (yt/amr_utils.c:9986)()
    154
    155
--> 156
    157
    158

ZeroDivisionError: float division





More information about the yt-users mailing list