[yt-users] Callback: nparticles

Elizabeth Harper-Clark h-clark at cita.utoronto.ca
Mon Jan 4 10:42:51 PST 2010


Hi guys,

I want to use the nparticles rather than the particles callback so that I
only plot PARTICLE_TYPE_MUST_REFINE (4). I am trying (full script at end of
email):

    p.modify["nparticles"](1.0,p_
size=4.0, col='g', ptype='4')

I tried with and without ' around the 4 but both times I get:

Traceback (most recent call last):
  File "Density_movie.py", line 29, in <module>
    p.modify["nparticles"](1.0,p_size=4.0, col='g', ptype='4')
  File
"/scratch/YT-x86_64/lib/python2.5/site-packages/yt-1.6dev-py2.5-linux-x86_64.egg/yt/raven/PlotTypes.py",
line 52, in __getitem__
    raise KeyError(item)
KeyError: 'nparticles'

Any idea what I am doing wrong?

Many thanks,

Libby

Density_movie.py:

from yt.mods import *
import pylab
import sys
import cmath
import matplotlib.ticker

#
# Code to make the frames for a movie showing density projection
#

rho_min = 1.e-22
rho_max = 1.e-32

frame_template = "aaWoC/%s/densityframe_%01i_%04i"

for n in range(12,200): # make density projection with particles on
    #pf = lagos.EnzoStaticOutput("WOCbin/%s/DD%04i/data%04i" %
(sys.argv[-1],n, n))
    pf = lagos.EnzoStaticOutput("WOCbin2/%s/DD%04i/data%04i" %
(sys.argv[-1],n, n))
    #print pf.h.field_list
    pc = raven.PlotCollection(pf, center=(0.5,0.5,0.5))
    time = pf["InitialTime"]*pf["years"]
    for ax in range(1):
        p = pc.add_projection("Density", ax, weight_field="Density")
        #pc.set_zlim(rho_min, rho_max)
        p.set_cmap('hot')
        sp = pf.h.all_data()
        colours = sp["ParticleMassMsun"]
        if sp["ParticleMassMsun"].size > 0:
            p.modify["nparticles"](1.0,p_size=4.0, col='g', ptype='4')
        p.modify["text"]((0.1,0.9),"time = %i years" %
(pf["InitialTime"]*pf["years"]), text_args = {'color':'w'})
        #p.set_width(0.1, 'pc')
        pc.save(frame_template % (sys.argv[-1],ax,n), override=True)



-- 
Elizabeth Harper-Clark MA MSci
PhD Candidate, Astrophysics, UofT

www.astro.utoronto.ca/~h-clark
h-clark at cita.utoronto.ca
AIM: edphc1
MSN: edphc1 at hotmail.com
Skype: eharperclark
Office phone: 416-978-5759
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20100104/b3689c59/attachment.htm>


More information about the yt-users mailing list