
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,
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')
Have you added a new function to yt/raven/Callbacks.py that does what you want, and that you've named (_type_name = "nparticles") correctly? There is no function currently named that in trunk.
_______________________________________________________ sskory@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student ________________________________(_)_\(_)_______________

ah, I had assumed it was there since it is on:
http://yt.enzotools.org/doc/advanced/callbacks.html#available-callbacks
!!!
Thanks, I will look into it properly now,
Libby
2010/1/4 Stephen Skory stephenskory@yahoo.com
Elizabeth,
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')
Have you added a new function to yt/raven/Callbacks.py that does what you want, and that you've named (_type_name = "nparticles") correctly? There is no function currently named that in trunk.
sskory@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ http://physics.ucsd.edu/%7Esskory/ _.>/ _Graduate Student ________________________________(_)_\(_)_______________ _______________________________________________ yt-users mailing list yt-users@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org

ah, I had assumed it was there since it is on:
http://yt.enzotools.org/doc/advanced/callbacks.html#available-callbacks
!!!
Thanks, I will look into it properly now,
So that everyone else is clear who is following along, what I think happened is Libby upgraded her trunk installation, which changed the name of the callback, but the online docs are slightly behind. The good news is that very soon the docs will be updated online to coincide with a point release of yt, and this disconnect should be temporary.
_______________________________________________________ sskory@physics.ucsd.edu o__ Stephen Skory http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student ________________________________(_)_\(_)_______________
participants (2)
-
Elizabeth Harper-Clark
-
Stephen Skory