[yt-users] Assertion Error in python2.5 yt

rsoares dlleuz at xmission.com
Wed Sep 24 19:39:58 PDT 2008


Hi,

I don't know why I'm getting "AssertionError" and "KeyError: 'Density'"
below.

Anyone can explain?

Thanks,

R.Soares


>>> import yt.lagos as lagos
yt.lagos   WARNING    2008-09-24 20:26:36,993 No HDF4 support
>>> a = lagos.EnzoStaticOutput("RedshiftOutput0004")
>>> v,c = a.h.find_max("Density")
yt.lagos   INFO       2008-09-24 20:27:38,292 Skipping serialization!
yt.lagos   INFO       2008-09-24 20:27:38,292 Caching hierarchy
information
yt.lagos   INFO       2008-09-24 20:27:38,299 Gathering a field list
(this may take a moment.)
Warning: invalid value encountered in sqrt
Warning: invalid value encountered in divide
Warning: invalid value encountered in divide
Warning: invalid value encountered in sqrt
yt.lagos   INFO       2008-09-24 20:27:38,799 Max Value is 1.75364e-25
at 0.2890625000000000 0.2812500000000000 0.4843750000000000 in grid
Grid_0001 at level 0 [36 35 61]
>>> print v
1.75364112031e-25
>>> print c
[ 0.2890625  0.28125    0.484375 ]

>>> sphere = a.h.sphere([0.5,0.5,0.5],0.1/a["kpc"]) 
>>> prof =
lagos.BinnedProfile1D(sphere,16,"Radiuskpc",0.0001,0.1,True,True)
>>> prof.add_fields(["Density"])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/home/robyn/yt-pentiumD/lib/python2.5/site-packages/yt/lagos/Profiles.py", line 105, in add_fields
    self._lazy_add_fields(fields, weight, accumulation)
  File
"/home/robyn/yt-pentiumD/lib/python2.5/site-packages/yt/lagos/Profiles.py", line 64, in _lazy_add_fields
    pbar = get_pbar('Binning grids', len(self._data_source._grids))
  File
"/home/robyn/yt-pentiumD/lib/python2.5/site-packages/yt/funcs.py", line
127, in get_pbar
    maxval=maxval).start()
  File
"/home/robyn/yt-pentiumD/lib/python2.5/site-packages/yt/progressbar.py",
line 213, in __init__
    assert maxval > 0
AssertionError


>>> print prof["Density"]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/home/robyn/yt-pentiumD/lib/python2.5/site-packages/yt/lagos/Profiles.py", line 115, in __getitem__
    return self._data[key]
KeyError: 'Density'





More information about the yt-users mailing list