> ray = pf.h.ortho_ray(0, (0.0,0.0))
which then gave me
yt : [INFO ] 2014-06-23 14:15:52,664 Getting field x from 8
ERROR: ValueError: cannot convert float NaN to integer [yt.data_objects.data_containers]
astropy: [ERROR ] 2014-06-23 14:15:52,664 ValueError: cannot convert float NaN to integer
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-157-318ebcfbdb94> in <module>()
----> 1 ray = pf.h.ortho_ray(0, (0.0,0.0))
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in __init__(self, axis, coords, fields, pf, **kwargs)
578 self.px, self.py = coords
579 self.sort_by = axis_names[self.axis]
--> 580 self._refresh_data()
581
582 @property
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in _refresh_data(self)
304 """
305 self.clear_data()
--> 306 self.get_data()
307
308 def keys(self):
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in get_data(self, fields, in_grids)
523 self[field] = np.concatenate(
524 [self._get_data_from_grid(grid, field)
--> 525 for grid in self._grids])
526 if not self.field_data.has_key(field):
527 continue
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in save_state(self, grid, field, *args, **kwargs)
79 old_keys = grid.field_data.keys()
80 grid.field_parameters = self.field_parameters
---> 81 tr = func(self, grid, field, *args, **kwargs)
82 grid.field_parameters = old_params
83 grid.field_data = YTFieldData( [(k, grid.field_data[k]) for k in old_keys] )
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in _get_data_from_grid(self, grid, field)
599 gdx = just_one(grid[self.px_dx])
600 gdy = just_one(grid[self.py_dx])
--> 601 x_coord = int((self.px - grid.LeftEdge[self.px_ax])/gdx)
602 y_coord = int((self.py - grid.LeftEdge[self.py_ax])/gdy)
603 sl = [None,None,None]
ValueError: cannot convert float NaN to integer
Without doing anything wrong, perhaps I'm just a bad influence.
Luke
Hi Luke,
You didn't do anything wrong. :) yt should be able to accept rays
through "ray" that are orthogonal to the axes, but it can't because of
some sloppiness. You have two options -- either use "ortho_ray"
instead of "ray", which will make it orthogonal (and probably be a bit
faster) or add jitter to the tune of 1e-12 to your 0.0 entries.
-Matt
On Mon, Jun 23, 2014 at 11:44 AM, Luke Zoltan Kelley
<lkelley@cfa.harvard.edu> wrote:
Hello yt-users,
Just starting using YT, please forgive simple problems.
I have 1D spherical FLASH data which I'm trying to plot. I thought I should use a 'ray', so I created one as such and try to access the data but I'm getting a ZeroDivision Error:
from yt.mods import *
pf = load('starwind_hdf5_plt_cnt_0000')
In [141]: ray = pf.h.ray([0.0,0.0,0.0],[1.0e11,0.0,0.0], fields=["Density"])
In [142]: ray['Density']
yt : [INFO ] 2014-06-23 12:40:51,841 Getting field t from 138
ERROR: ZeroDivisionError: float division [IPython.core.interactiveshell]
astropy: [ERROR ] 2014-06-23 12:40:51,846 ZeroDivisionError: float division
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
<ipython-input-142-c8a80a171d35> in <module>()
----> 1 ray['Density']
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in __getitem__(self, key)
316 if key not in self.fields:
317 self.fields.append(key)
--> 318 self.get_data(key)
319 return self.field_data[key]
320
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in get_data(self, fields, in_grids)
523 self[field] = np.concatenate(
524 [self._get_data_from_grid(grid, field)
--> 525 for grid in self._grids])
526 if not self.field_data.has_key(field):
527 continue
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in save_state(self, grid, field, *args, **kwargs)
79 old_keys = grid.field_data.keys()
80 grid.field_parameters = self.field_parameters
---> 81 tr = func(self, grid, field, *args, **kwargs)
82 grid.field_parameters = old_params
83 grid.field_data = YTFieldData( [(k, grid.field_data[k]) for k in old_keys] )
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in _get_data_from_grid(self, grid, field)
689 @restore_grid_state
690 def _get_data_from_grid(self, grid, field):
--> 691 mask = np.logical_and(self._get_cut_mask(grid),
692 grid.child_mask)
693 if field == 'dts': return self._dts[grid.id][mask]
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in check_cache(self, grid)
109 elif grid.id not in self._cut_masks or \
110 hasattr(self, "_boolean_touched"):
--> 111 cm = func(self, grid)
112 self._cut_masks[grid.id] = cm
113 return self._cut_masks[grid.id]
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc in _get_cut_mask(self, grid)
704 ts = np.zeros(grid.ActiveDimensions, dtype='float64')
705 VoxelTraversal(mask, ts, dts, grid.LeftEdge, grid.RightEdge,
--> 706 grid.dds, self.center, self.vec)
707 self._dts[grid.id] = np.abs(dts)
708 self._ts[grid.id] = np.abs(ts)
/Users/lzkelley/Applications/yt/yt-x86_64/src/yt-hg/yt/utilities/lib/RayIntegrators.so in yt.utilities.lib.RayIntegrators.VoxelTraversal (yt/utilities/lib/RayIntegrators.c:3408)()
ZeroDivisionError: float division
yt instinfo
Version = 2.6.1
Changeset = c7bae05dd4ef
Any ideas what I'm doing wrong?
Thanks!
Luke
_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org