Hi all,<br><br>I've been trying to get a script (provided to me by
Britton) working to create a bunch of light rays from an Enzo
simulation. Depending on the initial seed value, it makes some of them
correctly but eventually fails with the following error:<br>
<br>Traceback (most recent call last):<br> File "make_light_rays.py", line 32, in <module><br> get_los_velocity=True, get_nearest_galaxy=False)<br> File "/home/student/jomo9722/Enzo/<div id=":1f6">
yt-x86_64/src/yt-hg/yt/analysis_modules/light_ray/light_ray.py", line 275, in make_light_ray<br>
(sub_ray[field])])<br> File "/home/student/jomo9722/Enzo/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 319, in __getitem__<br> self.get_data(key)<br> File "/home/student/jomo9722/Enzo/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 508, in get_data<br>
if field not in ("dts", "t") and self._generate_field(field):<br> File "/home/student/jomo9722/Enzo/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 349, in _generate_field<br>
self[field] = self.pf.field_info[field](self)<br> File "/home/student/jomo9722/Enzo/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py", line 316, in __call__<br> dd = self._function(self, data)<br>
File "/data/moloney/cosmology_test/test_new/ion_balance/SD93IonBalance.py", line 178, in _ion_number_density<br> return solarAbundance[atom] * data[fractionField] * data['Metallicity'] * \<br> File "/home/student/jomo9722/Enzo/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 319, in __getitem__<br>
self.get_data(key)<br> File "/home/student/jomo9722/Enzo/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 508, in get_data<br> if field not in ("dts", "t") and self._generate_field(field):<br>
File "/home/student/jomo9722/Enzo/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py", line 349, in _generate_field<br> self[field] = self.pf.field_info[field](self)<br> File "/home/student/jomo9722/Enzo/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py", line 316, in __call__<br>
dd = self._function(self, data)<br> File "/data/moloney/cosmology_test/test_new/ion_balance/SD93IonBalance.py", line 193, in _ion_fraction_field<br> fraction = na.power(10, interp(data))<br> File "/home/student/jomo9722/Enzo/yt-x86_64/src/yt-hg/yt/utilities/linear_interpolators.py", line 44, in __call__<br>
x_i = (na.digitize(x_vals, self.x_bins) - 1).astype('int32')<br>ValueError: Both x and bins must have non-zero length<br><br>Working
through the debugger, I found that for the segment where it failed the
periodic_ray function had produced the following list of segments.<br>
<br>[[array([ 0.16103374, 0.78830872, 0.24846128]), array([
0.14031834, 0.57367409, 1. ])], [array([ 0.14031834,
0.57367409, 1. ]), array([ 0.14031834, 0.57367409, 1.
])], [array([ 0.14031834, 0.57367409, 0. ]), array([
0.13268221, 0.49455532, 0.2770327 ])]]<br>
<br>The second segment here has identical start and end points, which is
leading yt to try to interpolate a field with nothing in it (and
therefore throwing the above error). It seems that what's happening is
that due to rounding errors the first segment being produced actually
has a value < 1 for the third dimension so that when it checks to see
if the segment hit any of the box walls it thinks that it didn't. It
then tries to start a new segment that's already at the boundary of the
box, producing a ray segment containing 0 grid cells.<br>
<br>Has anyone run into this problem before, and is there a fix for it
floating around out there somewhere? If not I could probably work
something up that checks to see if the distance from the segment
endpoint to the wall is < SmallNumber and set it equal to the value
at the wall if it is.<br>
<br>Thanks.<div class="yj6qo ajU"><div id=":1dy" class="ajR" tabindex="0"><img class="ajT" src="images/cleardot.gif"></div></div></div>