[yt-users] Analyzing DM-only data

kcai at pa.uky.edu kcai at pa.uky.edu
Tue Dec 22 14:27:38 PST 2009


Hi Matt and Eric,
    Thank you for all this information; I have just tried with iyt:
pf = load("RD0000/RD0000", data_style=6)
pc = PlotCollection(pf, center=...)
and then I ran

print pf.h.field_list

and got
['particle_velocity_z', 'particle_position_z', 'particle_position_x',  
'particle_position_y', 'particle_index',  
'particle_mass','particle_velocity_x', 'particle_velocity_y']

so that worked.
But then, when I tried with pc.add_slice('particle_position_y', 0)
or 'particle_mass', I got seg faults...
- which of the fields *can* I plot in x?

Thanks,
Kai

Quoting Matthew Turk <matthewturk at gmail.com>:

> Hi Kai,
>
> As a quick note (sorry for not kicking in earlier) if you are using
> yt-1.5 you should be using data_style=6 , not
> data_style='enzo_packed_3d'.  There was a change between 1.5 and the
> current trunk, and the previous email message referred to the trunk.
>
> The import differences Eric noted above are new to me and I'm still
> looking into them...
>
> Best,
>
> Matt
>
> On Tue, Dec 22, 2009 at 4:37 PM,  <kcai at pa.uky.edu> wrote:
>> Hi Eric,
>>   Thanks for figuring it out. Then how do I load "lagos" under iyt?
>> Or I'll have to go with a script? You mentioned raven as well, but then what
>> is its relationship with lagos? I am a bit confused...
>>
>> Thanks,
>>
>> Kai
>>
>> PS. sorry, but I only know very little YT (and nothing about python)...
>>
>>
>> Quoting Eric Hallman <Eric.Hallman at colorado.edu>:
>>
>>> Ok, I am not 100% sure what is going on, I've only tried this a few
>>> times with dm_only, but I have noticed not too many other people are
>>> around, so I will tell you what I know.
>>>
>>> There are some quirky things with dm_only, for instance:
>>>
>>> if you start with
>>> from yt.mods import *
>>> pf = EnzoStaticOutput("datasetname",data_style="enzo_packed_3d")
>>>
>>> (or pf = load(...))
>>>  the behavior of creating plot collections, reading field lists is
>>> different than if you use
>>>
>>> from yt.lagos import *
>>> pf = EnzoStaticOutput("datasetname",data_style="enzo_packed_3d")
>>>
>>> In the first case, if you type
>>>
>>> print pf.h.field_list
>>>
>>> it fails
>>>
>>> in the second case, it works.  Unclear why.
>>>
>>> You can project quantities, or take slices, but not for all the
>>> particle quantities as they are (as near as I can tell).  Some of the
>>> derived quantites (e.g. particle_density_pyx) can be projected without
>>> a problem, once you import raven.  Though I am not the expert on the
>>> particle quantities, I seem to remember that you can only take slices/
>>> projections with grid quantities.
>>>
>>> Anyway, I would start with loading up the data by importing lagos
>>> first, loading the dataset, then check your field list and derived
>>> field list for what you want to make slices of.  There is some more
>>> documentation on the enzotools site on how to manage particle data etc.
>>>
>>> Hopefully someone else can help with the real answers here at some  point.
>>>
>>> Sorry I couldn't help more.
>>>
>>>
>>> On Dec 22, 2009, at 12:52 PM, kcai at pa.uky.edu wrote:
>>>
>>>> Hi Eric,
>>>>
>>>> Quoting Eric Hallman <Eric.Hallman at colorado.edu>:
>>>>
>>>>> Kai,
>>>>> I am getting a completely different error than you are, but I also
>>>>> fail at the same step.  Which version of yt are you using?
>>>>>
>>>> I think it is yt-1.5, but I'm not 100% sure. I used the  installation
>>>>  script.
>>>>
>>>>> I will see if I can get this figured out.
>>>>>
>>>>>
>>>> Thank you for this!
>>>> Kai
>>>>
>>>>
>>>>> On Dec 22, 2009, at 11:58 AM, kcai at pa.uky.edu wrote:
>>>>>
>>>>>> Eric,
>>>>>> No, 'Dark_Matter_Density' does not work, either...
>>>>>> -> similar error:
>>>>>>
>>>>>> In [5]: pc.add_slice('Dark_Matter_Density', 0)
>>>>>> Exception AttributeError: "EnzoHierarchy instance has no   attribute
>>>>>>  '_data_file'" in <bound method EnzoHierarchy.__del__   of
>>>>>> <yt.lagos.HierarchyType.EnzoHierarchy instance at     
>>>>>> 0x2aa1cfbcf8>>   ignored
>>>>>>
>>>>>> ---------------------------------------------------------------------------
>>>>>> KeyError                                  Traceback (most recent
>>>>>>  call last)
>>>>>>
>>>>>> /share/home/kca223/src/yt-1.5/scripts/iyt in <module>()
>>>>>> ----> 1
>>>>>>  2
>>>>>>  3
>>>>>>  4
>>>>>>  5
>>>>>>
>>>>>> /share/home/kca223/src/yt-1.5/yt/raven/PlotCollection.pyc in
>>>>>> add_slice(self, *args, **kwargs)
>>>>>> 180         *fig_size* in (height_inches, width_inches)
>>>>>> 181         """
>>>>>> --> 182         return self.__add_slice(PlotTypes.SlicePlot,   *args,
>>>>>>  **kwargs)
>>>>>> 183
>>>>>> 184     def add_slice_interpolated(self, *args, **kwargs):
>>>>>>
>>>>>> /share/home/kca223/src/yt-1.5/yt/raven/PlotCollection.pyc in
>>>>>> __add_slice(self, ptype, field, axis, coord, center,   use_colorbar,
>>>>>>  figure, axes, fig_size, periodic, data_source,   **kwargs)
>>>>>> 204             coord = center[axis]
>>>>>> 205         if data_source is None:
>>>>>> --> 206             data_source = self.pf.hierarchy.slice(axis,
>>>>>>  coord, field, center, **kwargs)
>>>>>> 207         p = self._add_plot(ptype(data_source, field,
>>>>>> use_colorbar=use_colorbar,
>>>>>> 208                          axes=axes, figure=figure,
>>>>>>
>>>>>> /share/home/kca223/src/yt-1.5/yt/lagos/OutputTypes.pyc in
>>>>>> _get_hierarchy(self)
>>>>>> 144             if self._hierarchy_class == None:
>>>>>> 145                 raise RuntimeError("You should not     instantiate
>>>>>> StaticOutput.")
>>>>>> --> 146             self.__hierarchy =   self._hierarchy_class(self,
>>>>>>  data_style=self.data_style)
>>>>>> 147         return self.__hierarchy
>>>>>> 148
>>>>>>
>>>>>> /share/home/kca223/src/yt-1.5/yt/lagos/HierarchyType.pyc in
>>>>>> __init__(self, pf, data_style)
>>>>>> 689                 break
>>>>>> 690         self.__guess_data_style(pf["TopGridRank"],  testGrid,
>>>>>> testGridID)
>>>>>> --> 691         self._setup_data_queue()
>>>>>> 692         # For some reason, r8 seems to want Float64
>>>>>> 693         if pf.has_key("CompilerPrecision") \
>>>>>>
>>>>>> /share/home/kca223/src/yt-1.5/yt/lagos/HierarchyType.pyc in
>>>>>> _setup_data_queue(self)
>>>>>> 137
>>>>>> 138     def _setup_data_queue(self):
>>>>>> --> 139         self.queue = _data_style_funcs[self.data_style][5]()
>>>>>> 140
>>>>>> 141     def _setup_grid_corners(self):
>>>>>>
>>>>>> KeyError: 'enzo_packed_3d'
>>>>>>
>>>>>> I think it is I did not set the "data_style" right...
>>>>>>
>>>>>> Thanks,
>>>>>> Kai
>>>>>>
>>>>>>
>>>>>> Quoting Eric Hallman <Eric.Hallman at colorado.edu>:
>>>>>>
>>>>>>> ,
>>>>>>> I think the solution is that dark matter only runs do not have the
>>>>>>> field "Density", but only dark matter density is defined as a  field.
>>>>>>> Density is a baryon field.
>>>>>>>
>>>>>>>
>>>>>>> On Dec 22, 2009, at 9:18 AM, kcai at pa.uky.edu wrote:
>>>>>>>
>>>>>>>> Sorry - forgot to change the subject of last email...
>>>>>>>>
>>>>>>>> Quoting kcai at pa.uky.edu:
>>>>>>>>
>>>>>>>>> Hi Matt,
>>>>>>>>> Last night I was browsing the archives of the yt-users list, and
>>>>>>>>> came across this thread of emails:
>>>>>>>>>
>>>>>>>>> [yt-users] corrupt enzo restart file?
>>>>>>>>> Matthew Turk matthewturk at gmail.com
>>>>>>>>> Thu Nov 12 09:30:36 PST 2009
>>>>>>>>>
>>>>>>>>> Hi Stephen,
>>>>>>>>>
>>>>>>>>> A problem with the way yt opens up dark matter only simulations  is
>>>>>>>>> that the data_style has to be specified.  This would be, for
>>>>>>>>> running
>>>>>>>>> on trunk, done with the parameter:
>>>>>>>>>
>>>>>>>>> data_style="enzo_packed_3d"
>>>>>>>>>
>>>>>>>>> to the StaticOutput initialization.  Britton Smith has done  some
>>>>>>>>>  work
>>>>>>>>> recently on improving this, so he might be able to chime in  with
>>>>>>>>>  more
>>>>>>>>> info.
>>>>>>>>>
>>>>>>>>> -Matt
>>>>>>>>>
>>>>>>>>> On Thu, Nov 12, 2009 at 9:27 AM, Stephen Skory <stephenskory at
>>>>>>>>> yahoo.com> wrote:
>>>>>>>>>>
>>>>>>>>>> Hi all,
>>>>>>>>>>
>>>>>>>>>> I am getting this error <http://paste.enzotools.org/show/257/  >
>>>>>>>>>>  when I attempt to instantiate the grid hierarchy.
>>>>>>>>>
>>>>>>>>> ......
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I am encountering the same "TypeError" when I tried to analyze  a
>>>>>>>>> DM- only run.
>>>>>>>>> But I use iyt (the interactive yt) - how do I add the     data_style
>>>>>>>>>   then? I tried
>>>>>>>>> with
>>>>>>>>>
>>>>>>>>> pf = load("RD0000/RD0000", data_style="enzo_packed_3d")
>>>>>>>>> and then
>>>>>>>>> In [3]: pc = PlotCollection(pf, center=[0.5,0.5,0.5])
>>>>>>>>> yt         INFO       2009-12-22 00:01:13,536 Created plot
>>>>>>>>> collection
>>>>>>>>> with default plot-center = [0.5, 0.5, 0.5]
>>>>>>>>>
>>>>>>>>> But when I tried to plot a slice, I got:
>>>>>>>>> In [4]: pc.add_slice("Density", 0)
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------------
>>>>>>>>> KeyError                                  Traceback (most     recent
>>>>>>>>>   call last)
>>>>>>>>>
>>>>>>>>> /share/home/kca223/src/yt-1.5/scripts/iyt in <module>()
>>>>>>>>> ----> 1
>>>>>>>>> 2
>>>>>>>>> 3
>>>>>>>>> 4
>>>>>>>>> 5
>>>>>>>>>
>>>>>>>>> /share/home/kca223/src/yt-1.5/yt/raven/PlotCollection.pyc in
>>>>>>>>> add_slice(self, *args, **kwargs)
>>>>>>>>> 180         *fig_size* in (height_inches, width_inches)
>>>>>>>>> 181         """
>>>>>>>>> --> 182         return self.__add_slice(PlotTypes.SlicePlot,
>>>>>>>>> *args,  **kwargs)
>>>>>>>>> 183
>>>>>>>>> 184     def add_slice_interpolated(self, *args, **kwargs):
>>>>>>>>>
>>>>>>>>> /share/home/kca223/src/yt-1.5/yt/raven/PlotCollection.pyc in
>>>>>>>>> __add_slice(self, ptype, field, axis, coord, center,  use_colorbar,
>>>>>>>>> figure, axes, fig_size, periodic, data_source, **kwargs)
>>>>>>>>> 204             coord = center[axis]
>>>>>>>>> 205         if data_source is None:
>>>>>>>>> --> 206             data_source =   self.pf.hierarchy.slice(axis,
>>>>>>>>>  coord,
>>>>>>>>> field, center, **kwargs)
>>>>>>>>> 207         p = self._add_plot(ptype(data_source, field,
>>>>>>>>> use_colorbar=use_colorbar,
>>>>>>>>> 208                          axes=axes, figure=figure,
>>>>>>>>>
>>>>>>>>> /share/home/kca223/src/yt-1.5/yt/lagos/OutputTypes.pyc in
>>>>>>>>>  _get_hierarchy(self)
>>>>>>>>> 144             if self._hierarchy_class == None:
>>>>>>>>> 145                 raise RuntimeError("You should not  instantiate
>>>>>>>>> StaticOutput.")
>>>>>>>>> --> 146             self.__hierarchy =  self._hierarchy_class(self,
>>>>>>>>> data_style=self.data_style)
>>>>>>>>> 147         return self.__hierarchy
>>>>>>>>> 148
>>>>>>>>>
>>>>>>>>> /share/home/kca223/src/yt-1.5/yt/lagos/HierarchyType.pyc in
>>>>>>>>> __init__(self, pf, data_style)
>>>>>>>>> 689                 break
>>>>>>>>> 690         self.__guess_data_style(pf["TopGridRank"], testGrid,
>>>>>>>>> testGridID)
>>>>>>>>> --> 691         self._setup_data_queue()
>>>>>>>>> 692         # For some reason, r8 seems to want Float64
>>>>>>>>> 693         if pf.has_key("CompilerPrecision") \
>>>>>>>>>
>>>>>>>>> /share/home/kca223/src/yt-1.5/yt/lagos/HierarchyType.pyc in
>>>>>>>>> _setup_data_queue(self)
>>>>>>>>> 137
>>>>>>>>> 138     def _setup_data_queue(self):
>>>>>>>>> --> 139         self.queue = _data_style_funcs[self.data_style] [5]
>>>>>>>>> ()
>>>>>>>>> 140
>>>>>>>>> 141     def _setup_grid_corners(self):
>>>>>>>>>
>>>>>>>>> KeyError: 'enzo_packed_3d'
>>>>>>>>>
>>>>>>>>> Thanks a lot!
>>>>>>>>> Kai
>>>>>>>>>
>>>>>>>>
>>>>>>>>> This message was sent using IMP, the Internet Messaging Program.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ----------------------------------------------------------------
>>>>>>>> This message was sent using IMP, the Internet Messaging Program.
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> yt-users mailing list
>>>>>>>> yt-users at lists.spacepope.org
>>>>>>>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>>>>>>
>>>>>>> Dr. Eric J. Hallman
>>>>>>> NSF Astronomy and Astrophysics Postdoctoral Fellow
>>>>>>> Center for Astrophysics and Space Astronomy
>>>>>>> University of Colorado at Boulder
>>>>>>> hallman (at) casa.colorado.edu
>>>>>>> Phone: (312) 725-4626
>>>>>>> http://solo.colorado.edu/~hallman/
>>>>>>
>>>>
>>>>
>>>>
>>>> ----------------------------------------------------------------
>>>> This message was sent using IMP, the Internet Messaging Program.
>>>
>>> Dr. Eric J. Hallman
>>> NSF Astronomy and Astrophysics Postdoctoral Fellow
>>> Center for Astrophysics and Space Astronomy
>>> University of Colorado at Boulder
>>> hallman (at) casa.colorado.edu
>>> Phone: (312) 725-4626
>>> http://solo.colorado.edu/~hallman/
>>
>>

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the yt-users mailing list