[yt-users] Over plot particles

REMUDIN RESHID MEKURIA remudin at yahoo.com
Thu May 24 13:08:28 PDT 2012


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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20120524/f922fbfc/attachment.htm>


More information about the yt-users mailing list