Hi Matt,

thanks for your quick reply.
It only gives me the gas fields:

-----------------------------
In [5]: pf.h.field_list
Out[5]: ['z-velocity', 'y-velocity', 'x-velocity', 'TotalEnergy', 'Density']
-----------------------------

Btw, I am using the latest dev version of yt (changeset 7439:34b95297062b).
Cheers,

JC


On Apr 24, 2013, at 7:52 AM, Matthew Turk <matthewturk@gmail.com> wrote:

Hi JC,

What's the output of:

pf.h.field_list

?

-Matt

On Wed, Apr 24, 2013 at 12:35 AM, Jean-Claude Passy <jcpassy@gmail.com> wrote:
Hi all,

sorry, I have a pretty dumb question.
I have a non-cosmological simulation with only 1 particle. I can get the
particle_mass field, but yt throws the following error when I try to grab
particle_index:

---------------------------------------------------------------------------------------------------------------------------------
In [1]: pf = load('CE0001')
yt : [INFO     ] 2013-04-24 00:32:02,190 Parameters: current_time
= 0.00149998503444
yt : [INFO     ] 2013-04-24 00:32:02,190 Parameters: domain_dimensions
= [32 32 32]
yt : [INFO     ] 2013-04-24 00:32:02,190 Parameters: domain_left_edge
= [ 0.  0.  0.]
yt : [INFO     ] 2013-04-24 00:32:02,190 Parameters: domain_right_edge
= [ 1.  1.  1.]
yt : [INFO     ] 2013-04-24 00:32:02,191 Parameters: cosmological_simulation
= 0.0

In [2]: region = pf.h.region([0.5, 0.5, 0.5], [0.0, 0.0, 0.0], [1.0, 1.0,
1.0])
yt : [INFO     ] 2013-04-24 00:32:05,802 Getting the binary hierarchy
yt : [INFO     ] 2013-04-24 00:32:05,805 Finished with binary hierarchy
reading

In [3]: region['particle_mass']
yt : [INFO     ] 2013-04-24 00:32:12,685 Getting particle_mass using
ParticleIO
Out[3]: array([ 6585896.1408])

In [4]: region['particle_index']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/Users/jcpassy/Work/yt-x86_64/src/yt-hg/scripts/iyt in <module>()
----> 1 region['particle_index']

/Users/jcpassy/Work/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc
in __getitem__(self, key)
   328             if key not in self.fields:
   329                 self.fields.append(key)
--> 330             self.get_data(key)
   331         return self.field_data[key]
   332

/Users/jcpassy/Work/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc
in get_data(self, fields, in_grids, force_particle_read)
  2614                     pass
  2615             if field not in self.hierarchy.field_list and not
in_grids:
-> 2616                 if self._generate_field(field):
  2617                     continue # True means we already assigned it
  2618             mylog.info("Getting field %s from %s", field,
len(self._grids))

/Users/jcpassy/Work/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.pyc
in _generate_field(self, field)
   361                 return True
   362         else: # Can't find the field, try as it might
--> 363             raise KeyError(field)
   364
   365     def _generate_field_in_grids(self, field, num_ghost_zones=0):

KeyError: 'particle_index'
---------------------------------------------------------------------------------------------------------------------------------

However, the field is there:

---------------------------------------------------------------------------------------------------------------------------------
[ 0:30:13] Obiwan:$ h5ls CE0001.cpu0000/Grid00000004
Dark_Matter_Density      Dataset {52, 52, 52}
Density                  Dataset {52, 52, 52}
TotalEnergy              Dataset {52, 52, 52}
particle_index           Dataset {1}
particle_mass            Dataset {1}
particle_position_x      Dataset {1}
particle_position_y      Dataset {1}
particle_position_z      Dataset {1}
particle_type            Dataset {1}
particle_velocity_x      Dataset {1}
particle_velocity_y      Dataset {1}
particle_velocity_z      Dataset {1}
x-velocity               Dataset {52, 52, 52}
y-velocity               Dataset {52, 52, 52}
z-velocity               Dataset {52, 52, 52}
[ 0:30:13] Obiwan:$ h5ls -d CE0001.cpu0000/Grid00000004/particle_index
particle_index           Dataset {1}
   Data:
       (0) 0
---------------------------------------------------------------------------------------------------------------------------------

Am I missing something obvious?

Thanks a lot for you help,

JC

_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org