[yt-users] Over plot particles

Matthew Turk matthewturk at gmail.com
Thu May 24 13:15:38 PDT 2012


Hi Remudin,

The units between Enzo and Nyx are different -- and to get the recipe
to reflect that there are a few places that have to be modified.  In
response to the community survey results that came in, just yesterday
(coincidentally enough) Britton Smith and I have been going through
trying to make changes to the recipes to de-enzo-ify them and to make
it more clear what are units and what aren't.

I'm not sure this will fix the problem, but it might help!

On Fri, May 25, 2012 at 5:08 AM, REMUDIN RESHID MEKURIA
<remudin at yahoo.com> wrote:
> Thanks Casey,
>
> This is the script I used from yt-cookbook Overplot particles
>
> #!/usr/users/rmekuri/data/yt-x86_64/bin/python
>
>
> from yt.mods import * # set up our namespace
>
>
>
> fn = "plt00736" # parameter file to load
>
>
>
> pf = load(fn) # load data
>
>
> pc = PlotCollection(pf, [0.5, 0.5, 0.5])

Try changing [0.5, 0.5, 0.5] to "c" like this:

pc = PlotCollection(pf, "c")

this will put you at the domain center.

> p = pc.add_projection("Density", 0)
> p.modify["particles"](1.0) # 1.0 is the 'width' we want for our slab of

try changing this 1.0 to the full domain:

1.0/pf['unitary']

'unitary' is the unit meaning the full width of the domain.

>
>
>                             # particles -- this governs the allowable
> locations
>
>                             # of particles that show up on the image
>
>
>                             # NOTE: we can also supply a *ptype* to cut
> based
>
>                             # on a given (integer) particle type
>
>
> pc.set_width(1.0, '1') # change width of our plot to the full domain

Let's set this also to the full domain:

pc.set_width(1.0, 'unitary')


-Matt

>
>
> pc.save(fn) # save all plots
>
> Cheers,
>
> Remudin
>
>
> On 2012 Cam 24, at 22:03, Casey W. Stark wrote:
>
> Hi Remudin.
>
> Could you include the script that is generating the error?
>
> I'm not sure without the script, but it looks like you are trying to access
> the "particle_position_y" field and it is not in the plotfile you are
> working with.
>
> Best,
> Casey
>
>
> On Thu, May 24, 2012 at 11:15 AM, REMUDIN RESHID MEKURIA <remudin at yahoo.com>
> wrote:
>>
>> Dear all,
>>
>> Thank you for your help in advance.
>> I am currently running cosmological simulations using Nyx code.
>> And while trying to over plotting particles on the density slice, I
>> encountered the following error which I couldn't resolve. I will greatly
>> appreciate your help.
>>
>> Traceback (most recent call last):
>>   File "./OverPlotingParticles.py", line 14, in <module>
>>     pc.set_width(1.0, '1') # change width of our plot to the full domain
>>   File
>> "/home/uni06/cosmo/rmekuri/yt-x86_64/src/yt-hg/yt/visualization/plot_collection.py",
>> line 267, in set_width
>>     plot.set_width(width, unit)
>>   File
>> "/home/uni06/cosmo/rmekuri/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py",
>> line 441, in set_width
>>     self._refresh_display_width()
>>   File
>> "/home/uni06/cosmo/rmekuri/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py",
>> line 459, in _refresh_display_width
>>     self._redraw_image()
>>   File
>> "/home/uni06/cosmo/rmekuri/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py",
>> line 406, in _redraw_image
>>     self._run_callbacks()
>>   File
>> "/home/uni06/cosmo/rmekuri/yt-x86_64/src/yt-hg/yt/visualization/plot_types.py",
>> line 259, in _run_callbacks
>>     cb(self)
>>   File
>> "/home/uni06/cosmo/rmekuri/yt-x86_64/src/yt-hg/yt/visualization/plot_modifications.py",
>> line 985, in __call__
>>     &   ( reg[field_y] >= y0 ) & ( reg[field_y] <= y1 ) )
>>   File
>> "/home/uni06/cosmo/rmekuri/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
>> line 319, in __getitem__
>>     self.get_data(key)
>>   File
>> "/home/uni06/cosmo/rmekuri/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
>> line 2410, in get_data
>>     if self._generate_field(field):
>>   File
>> "/home/uni06/cosmo/rmekuri/yt-x86_64/src/yt-hg/yt/data_objects/data_containers.py",
>> line 352, in _generate_field
>>     raise KeyError(field)
>> KeyError: 'particle_position_y'
>>
>> With best regards,
>>
>>
>> Cheers,
>>
>> Remudin
>>
>> ------
>>
>> Remudin Reshid Mekuria                              phone: +49 (0)551
>> 39-13805
>>
>> IAG, Friedrich-Hund-Plaz 1                           fax: +49 (0)551
>> 39-5043
>>
>> D-37077 Goettingen
>>
>> Germany
>>
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
>
> ------
>
> Remudin Reshid Mekuria                              phone: +49 (0)551
> 39-13805
>
> IAG, Friedrich-Hund-Plaz 1                           fax: +49 (0)551 39-5043
>
> D-37077 Goettingen
>
> Germany
>
>
>
>
>
> _______________________________________________
> 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