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

Jean-Claude Passy jcpassy at gmail.com
Wed Apr 7 11:48:52 PDT 2010


Hi Jeff,

again, it seems to be working just fine. Strange...
The mass units are in Enzo units, right ?

JC

############################################################################################

In [66]: from yt.mods import *

In [67]: fn = 'CommonEnvelope0001'

In [68]: v, c = pf.h.find_max("Density")

In [69]: sp = pf.h.sphere(c, 1.0/pf["mpc"])

In [70]: baryon_mass, particle_mass = sp.quantities["TotalQuantity"](        ["CellMassMsun", "ParticleMassMsun"], lazy_reader=True)

In [72]: print "Total mass in sphere is %0.5e (gas = %0.5e / particles = %0.5e)" % (baryon_mass + particle_mass, baryon_mass, particle_mass)

-------> print("Total mass in sphere is %0.5e (gas = %0.5e / particles = %0.5e)" % (baryon_mass + particle_mass, baryon_mass, particle_mass))

Total mass in sphere is 1.00000e+00 (gas = 9.88705e-01 / particles = 1.12978e-02)

############################################################################################



j s oishi a écrit :
> Hi JC,
>
> Strange. Did you try any other quantities? Momenta, energy? Did you
> try summing the radial profile of the density (there is a recipe:
> http://yt.enzotools.org/doc/cookbook/recipes.html#sum-mass-in-sphere)
> to see if there is a problem with the radial profile?
>
> j
>
> On Wed, Apr 7, 2010 at 8:56 AM, Jean-Claude Passy <jcpassy at gmail.com> wrote:
>   
>> Hi Jeff,
>>
>> it does not seem there is any corrupt density.
>> Any idea ?
>>
>> JC
>>
>> ########################################################################################################################
>>
>> In [78]: data.h.find_max("Density")
>>
>> Out[78]: (107.99709, array([ 0.4921875,  0.4921875,  0.4921875]))
>>
>> In [79]: data.h.find_min("Density")
>>
>> yt.lagos   INFO       2010-04-07 08:43:12,716 Min Value is 1.00989e-05 at
>> 0.0078125000000000 0.0078125000000000 0.0078125000000000 in grid
>> EnzoGrid_0001 at level 0
>>
>> Out[79]: (1.0098941e-05, array([ 0.0078125,  0.0078125,  0.0078125]))
>>
>> #########################################################################################################################
>>
>> j s oishi a écrit :
>>
>> 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
>>
>>
>>
>>
>>
>> _______________________________________________
>> yt-users mailing list
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
>>
>>     
>
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20100407/ca93238c/attachment.html>


More information about the yt-users mailing list