[yt-users] Fortran kD Tree Setup and Clumps

Francia F. Riesco ff2214 at columbia.edu
Thu Aug 30 09:38:48 PDT 2012


   Everybody good afternoon,
     about Fortran kD Tree Setup, just to keep thread with my fix.
     1) I downloaded the YT-DEV version and it didn't fix my problem.
     However, when I downloaded Forthon-0.8.7.tgz it did the trick.

     2) Now I want to talk about another issue that I am getting. This time
     is with clumps. I am using an enzo data, with the code example in the
     YT documentation. this is my code:

     -----
     import sys
     from yt.mods import * # set up our namespace
     from yt.analysis_modules.level_sets.api import *
     import yt.frontends.enzo.api
     yt.frontends.enzo.api.EnzoHierarchy._bn = "%s.grid.cpu%%04i"
     fn = "/astro/data/redshift0058/redshift0058" # parameter file to load
     field = "Density"
     step = 10.0
     pf = load(fn) # load data
     c = [0.403290331 , 0.471765608 , 0.461319029]
     r = [0.411690331 , 0.480165608 , 0.469719029]
     l = [0.394890331 , 0.463365608 , 0.452919029]

     data_source = pf.h.region(c,l,r)
     c_min = 10**na.floor(na.log10(data_source[field]).min()  )
     c_max = 10**na.floor(na.log10(data_source[field]).max()+1)


     master_clump = Clump(data_source, None, field)


     find_clumps(master_clump, c_min, c_max, step)
     f = open('%s_clump_hierarchy.txt' % pf,'w')
     write_clump_hierarchy(master_clump, 0, f)
     f.close()



     f = open('%s_clumps.txt' % pf,'w')
     write_clumps(master_clump,0,f)
     f.close()

     ---------
     and I got the follow error.

     Traceback (most recent call last):
        File "/astro/py/clump.py", line 34, in <module>
          find_clumps(master_clump, c_min, c_max, step)
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.py", line 181,  
in
     find_clumps
          find_clumps(clump, min_val*d_clump, max_val, d_clump)
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.py", line 181,  
in
     find_clumps
          find_clumps(clump, min_val*d_clump, max_val, d_clump)
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.py", line 190,  
in
     find_clumps
          elif (child._isValid()):
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/analysis_modules/level_sets/clump_handling.py", line 144,  
in
     _isValid
          self.function_value = eval(self.function)
        File "<string>", line 1, in <module>
        File
     "/astro/yt-dev/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py",
     line 94, in __call__
          return self._call_func_unlazy(args, kwargs)
        File
     "/astro/yt-dev/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py",
     line 119, in _call_func_unlazy
          retval = self.func(self._data_source, *args, **kwargs)
        File
     "/astro/yt-dev/yt-x86_64/src/yt-hg/yt/data_objects/derived_quantities.py",
     line 360, in _IsBound
          thermal = (data["ThermalEnergy"] * mass_to_use).sum()
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",  
line
     327, in __getitem__
          self.get_data(key)
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",  
line
     2536, in get_data
          if self._generate_field(field):
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",  
line
     359, in _generate_field
          self[field] = self.pf.field_info[field](self)
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/data_objects/field_info_container.py",
     line 316, in __call__
          dd = self._function(self, data)
        File
     "/astro/yt-dev/yt-x86_64/src/yt-hg/yt/frontends/enzo/fields.py", line
     134, in _ThermalEnergy
          return data["TotalEnergy"]
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",  
line
     327, in __getitem__
          self.get_data(key)
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",  
line
     2536, in get_data
          if self._generate_field(field):
        File
      
"/astro/yt-dev/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",  
line
     363, in _generate_field
          raise KeyError(field)
     KeyError: 'TotalEnergy'



     I did it with the whole data (it took forever), however, I got the
     same exactly error. Anybody has an advice??

-- 
Francia F.R.



More information about the yt-users mailing list