[yt-users] particle density projection plot in yt-3.0

Matthew Turk matthewturk at gmail.com
Thu Sep 19 12:43:37 PDT 2013


Hi Junhwan,

We're still working some of the kinks out, but I think you will be
able to get what you are looking for by projecting the field
("deposit", "all_density") .  This would look like:

pc = ProjectionPlot(pf, "x", ("deposit","all_density"), width = (1.0, 'mpccm'))

On Thu, Sep 19, 2013 at 12:14 PM, Junhwan Choi (최준환)
<choi.junhwan at gmail.com> wrote:
> Now, I try to move on yt-3.0.
> For the test, I tried the following projection plot for DM and gas from the
> enzo simulation.
> =============================
> from yt.mods import *
> import matplotlib.pylab as pylab
>
> pf = load("../DD0023/DD0023")
> pc = ProjectionPlot(pf, "x", "ComovingDensity", width = (1.0, 'mpccm'))
> pc.save("cen_L1M")
> pc = ProjectionPlot(pf, "x", "particle_density", width = (1.0, 'mpccm'))
> pc.save("cen_L1M")
> =============================
>
> I found that the gas Projection density plot works but the DM projection
> plot crashs and gives me following message
> ============================
> yt : [INFO     ] 2013-09-18 12:00:51,613 Parameters: current_time
> = 23.8165517864
> yt : [INFO     ] 2013-09-18 12:00:51,613 Parameters: domain_dimensions
> = [128 128 128]
> yt : [INFO     ] 2013-09-18 12:00:51,614 Parameters: domain_left_edge
> = [ 0.  0.  0.]
> yt : [INFO     ] 2013-09-18 12:00:51,614 Parameters: domain_right_edge
> = [ 1.  1.  1.]
> yt : [INFO     ] 2013-09-18 12:00:51,614 Parameters: cosmological_simulation
> = 1
> yt : [INFO     ] 2013-09-18 12:00:51,614 Parameters: current_redshift
> = 20.1060163976
> yt : [INFO     ] 2013-09-18 12:00:51,614 Parameters: omega_lambda
> = 0.721
> yt : [INFO     ] 2013-09-18 12:00:51,614 Parameters: omega_matter
> = 0.279
> yt : [INFO     ] 2013-09-18 12:00:51,614 Parameters: hubble_constant
> = 0.701
> Parsing Hierarchy100%
> ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> Time: 00:\
> 00:00
> yt : [INFO     ] 2013-09-18 12:00:52,334 Gathering a field list (this may
> take a moment.)
> Traceback (most recent call last):
>   File "test.py", line 11, in <module>
>     pc = ProjectionPlot(pf, "x", "particle_density", width = (1.0, 'mpccm'))
>   File "/Users/jhchoi/common/src/yt-3.0-hg/yt/visualization/plot_window.py",
> line 1410, in __init__
>     field_parameters = field_parameters)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/construction_data_containers.py",
> line 234, in __init__
>     self.get_data(field)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/construction_data_containers.py",
> line 278, in get_data
>     chunk_fields, "io")):
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/utilities/parallel_tools/parallel_analysis_interface.py",
> line 434, in parallel_objects
>     for obj_id, obj in oiter:
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 450, in chunks
>     self.get_data(fields)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 536, in get_data
>     self._generate_fields(fields_to_generate)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 552, in _generate_fields
>     self.field_data[field] = self._generate_field(field)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 219, in _generate_field
>     tr = self._generate_fluid_field(field)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 236, in _generate_fluid_field
>     rv = self._generate_spatial_fluid(field, ngt_exception.ghost_zones)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 252, in _generate_spatial_fluid
>     ind += o.select(self.selector, self[field], rv, ind)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 189, in __getitem__
>     self.get_data(f)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 536, in get_data
>     self._generate_fields(fields_to_generate)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 552, in _generate_fields
>     self.field_data[field] = self._generate_field(field)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 219, in _generate_field
>     tr = self._generate_fluid_field(field)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 238, in _generate_fluid_field
>     rv = finfo(gen_obj)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/field_info_container.py",
> line 488, in __call__
>     dd = self._function(self, data)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/universal_fields.py",
> line 991, in _pdensity
>     pmass = data[('deposit','all_mass')]
>   File "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/grid_patch.py",
> line 85, in __getitem__
>     tr = super(AMRGridPatch, self).__getitem__(key)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 189, in __getitem__
>     self.get_data(f)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 536, in get_data
>     self._generate_fields(fields_to_generate)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 552, in _generate_fields
>     self.field_data[field] = self._generate_field(field)
>   File
> "/Users/jhchoi/common/src/yt-3.0-hg/yt/data_objects/data_containers.py",
> line 221, in _generate_field
>     raise YTCouldNotGenerateField(field, self.pf)
> yt.utilities.exceptions.YTCouldNotGenerateField: Could field '('all',
> 'particle_position_x')' in DD0023 could not be generated.
> =====================================
>
> Do you have any idea what is the problem?
> This script has been working fine in yt-2.5.4.
>
> Thank you in advance,
> Junhwan
>
>
>
> _______________________________________________
> 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