[yt-users] Error: cannot convert float infinity to integer

j s oishi jsoishi at gmail.com
Tue Apr 6 16:32:46 PDT 2010


Hi JC,

Since the error is on the y-axis, maybe you have a zero or infinite
density somewhere in the grid. Could you try doing

data.h.find_max("Density")
data.h.find_min("Density")

to see if you have any corrupt densities ( <=0 or inf) on your grid?

j

On Tue, Apr 6, 2010 at 4:14 PM, Matthew Turk <matthewturk at gmail.com> wrote:
> Hi Jean-Claude,
>
> Does the error go away if you supply x_bounds=(1e-30, 1.0) to the
> add_profile_sphere call? If so, perhaps we just need a better mechanism for
> guessing the center for calculating radius in the plot collection object.
>
> -Matt
>
>
>
> On Apr 6, 2010, at 4:13 PM, Jean-Claude Passy <jcpassy at gmail.com> wrote:
>
>> Dear all,
>>
>> I get the following error when trying to plot a radial profile of the
>> density.  Does anyone have an idea how to solve this ?
>>
>> Thanks a lot,
>>
>> Jean-Claude
>>
>>
>> #####################################################################################################################
>>
>> In [42]: ls
>>
>> CommonEnvelope0001               CommonEnvelope0001.configure
>>  CommonEnvelope0001.harrays    CommonEnvelope0001.taskmap0000
>>
>> CommonEnvelope0001.boundary      CommonEnvelope0001.cpu0000
>>  CommonEnvelope0001.hierarchy  CommonEnvelope0001.taskmap0001
>>
>> CommonEnvelope0001.boundary.hdf  CommonEnvelope0001.cpu0001
>>  CommonEnvelope0001.memorymap  CommonEnvelope0001.yt
>>
>> In [43]: import yt.raven as R
>>
>> In [44]: import yt.lagos as L
>>
>> In [45]: filen = 'CommonEnvelope0001'
>>
>> In [46]: data = L.EnzoStaticOutput(filen)
>>
>> In [47]: plot_data = R.PlotCollection(data)
>>
>> yt         INFO       2010-04-06 15:39:02,963 Created plot collection with
>> default plot-center = [0.4921875, 0.4921875, 0.4921875]
>>
>> In [48]: plot_data.add_profile_sphere(0.5,'1',["Radius", "Density"])
>>
>> yt         INFO       2010-04-06 15:39:56,695 Getting field Radius from 1
>>
>> yt         INFO       2010-04-06 15:39:56,696 Getting field x from 1
>>
>> yt         INFO       2010-04-06 15:39:56,857 Getting field y from 1
>>
>> yt         INFO       2010-04-06 15:39:56,919 Getting field z from 1
>>
>> yt         INFO       2010-04-06 15:39:56,987 Getting field Density from 1
>>
>> Out[48]: <yt.raven.PlotTypes.Profile1DPlot object at 0x3724d90>
>>
>> In [49]: plot_data.save('DensityProfile', format = 'png')
>>
>>
>> ---------------------------------------------------------------------------
>>
>> OverflowError                             Traceback (most recent call
>> last)
>>
>> /rpod2/jcpassy/Enzo/enzo/src/yt/scripts/iyt in <module>()
>>
>> ----> 1
>>    2
>>    3
>>    4
>>    5
>> /rpod2/jcpassy/Enzo/enzo/src/yt/yt/raven/PlotCollection.pyc in save(self,
>> basename, format, override, force_save)
>>
>>   79             fn.append(plot.save_image(basename, \
>>
>>   80                       format=format, submit=self._run_id,
>>
>> ---> 81                       override=override, force_save=force_save))
>>
>>   82             if self.submit:
>>
>>   83                 im = plot.im.copy()
>>
>> /rpod2/jcpassy/Enzo/enzo/src/yt/yt/raven/PlotTypes.pyc in save_image(self,
>> prefix, format, submit, override, force_save)
>>
>>  110         *override* will force no filename generation beyond the
>> prefix.
>>
>>  111         """
>>
>> --> 112         self._redraw_image()
>>
>>  113         if not override:
>>
>>  114             self._generate_prefix(prefix)
>>
>> /rpod2/jcpassy/Enzo/enzo/src/yt/yt/raven/PlotTypes.pyc in
>> _redraw_image(self)
>>
>>  711         func(self.data[self.fields[0]][indices],
>>
>>  712              self.data[self.fields[1]][indices],
>>
>> --> 713              **self.plot_options)
>>
>>  714         self._autoset_label(self.fields[0], self.set_x_label, 'x')
>>
>>  715         self._autoset_label(self.fields[1], self.set_y_label, 'y')
>>
>> /rpod2/jcpassy/yt-x86_64/lib/python2.6/site-packages/matplotlib/axes.pyc
>> in loglog(self, *args, **kwargs)
>>
>>  3566         b =  self._hold
>>
>>  3567         self._hold = True # we've already processed the hold
>>
>> -> 3568         l = self.plot(*args, **kwargs)
>>
>>  3569         self._hold = b    # restore the hold
>>
>>  3570
>> /rpod2/jcpassy/yt-x86_64/lib/python2.6/site-packages/matplotlib/axes.pyc
>> in plot(self, *args, **kwargs)
>>
>>  3435
>>  3436
>> -> 3437         self.autoscale_view(scalex=scalex, scaley=scaley)
>>
>>  3438         return lines
>>
>>  3439
>> /rpod2/jcpassy/yt-x86_64/lib/python2.6/site-packages/matplotlib/axes.pyc
>> in autoscale_view(self, tight, scalex, scaley)
>>
>>  1625             self.set_xbound(XL)
>>
>>  1626         if scaley and self._autoscaleYon:
>>
>> -> 1627             YL = self.yaxis.get_major_locator().view_limits(y0,
>> y1)
>>
>>  1628             self.set_ybound(YL)
>>
>>  1629
>> /rpod2/jcpassy/yt-x86_64/lib/python2.6/site-packages/matplotlib/ticker.pyc
>> in view_limits(self, vmin, vmax)
>>
>>  1117             vmin = minpos
>>
>>  1118
>> -> 1119         if not is_decade(vmin,self._base): vmin =
>> decade_down(vmin,self._base)
>>
>>  1120         if not is_decade(vmax,self._base): vmax =
>> decade_up(vmax,self._base)
>>
>>  1121
>> /rpod2/jcpassy/yt-x86_64/lib/python2.6/site-packages/matplotlib/ticker.pyc
>> in is_decade(x, base)
>>
>>  1028 def is_decade(x,base=10):
>>
>>  1029     lx = math.log(x)/math.log(base)
>>
>> -> 1030     return lx==int(lx)
>>
>>  1031
>>  1032 class LogLocator(Locator):
>>
>> OverflowError: cannot convert float infinity to integer
>>
>>
>> #####################################################################################################################
>>
>> _______________________________________________
>> 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
>



-- 
----------------
i am dot org: www.jsoishi.org



More information about the yt-users mailing list