[yt-users] cannot find some particle fields

Matthew Turk matthewturk at gmail.com
Wed Apr 24 10:20:43 PDT 2013


On Wed, Apr 24, 2013 at 1:29 PM, Jean-Claude Passy <jcpassy at gmail.com> wrote:
> Hi Matt,
>
> don't feel bad, it worked!
> I will try to remember to remove that file before emailing the list. I think that this trick solved about half of the problems I have had... ;-)
>

For everybody following along at home: what happens is that Enzo does
not store a list of "here are the fields that might be in the file."
So yt randomly samples grids until it gets some.  I thought we
manually ensured that particle-ful grids were sampled, but evidently
not.  Then this field list (to save time) is dumped in a .yt file.  So
if you miss a grid that has a field, it won't show up.

There has been discussion recently of disabling this behavior by default:

http://lists.spacepope.org/pipermail/yt-dev-spacepope.org/2013-April/003029.html

-Matt

> Cheers,
>
> JC
>
> On Apr 24, 2013, at 1:05 PM, Matthew Turk <matthewturk at gmail.com> wrote:
>
>> Hi JC,
>>
>> THis looks like another failure of the field detection algorithm.
>> We're working on improving it, but it's set up this way because there
>> is no canonical list of Enzo fields, and there's no way to check every
>> grid without slowing thigns down considerably.  I know this is
>> terrible to suggest, and I feel bad for doing so, but you might be
>> able to get something if you remove the .yt and try again.  :-(
>>
>> -Matt
>>
>> On Wed, Apr 24, 2013 at 11:39 AM, Jean-Claude Passy <jcpassy at gmail.com> wrote:
>>> 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 at 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 at 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 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
>>>
>> _______________________________________________
>> 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



More information about the yt-users mailing list