[Yt-svn] yt-commit r1428 - trunk/yt/raven

britton at wrangler.dreamhost.com britton at wrangler.dreamhost.com
Thu Sep 3 13:23:43 PDT 2009


Author: britton
Date: Thu Sep  3 13:23:42 2009
New Revision: 1428
URL: http://yt.spacepope.org/changeset/1428

Log:
Added stars_only keyword to ParticleCallback to get particles with 
creation_time greater than 0.  This is to supplement the ptype keyword when 
no particle_type data exists.


Modified:
   trunk/yt/raven/Callbacks.py

Modified: trunk/yt/raven/Callbacks.py
==============================================================================
--- trunk/yt/raven/Callbacks.py	(original)
+++ trunk/yt/raven/Callbacks.py	Thu Sep  3 13:23:42 2009
@@ -744,7 +744,7 @@
     _type_name = "particles"
     region = None
     _descriptor = None
-    def __init__(self, width, p_size=1.0, col='k', stride=1.0, ptype=None):
+    def __init__(self, width, p_size=1.0, col='k', stride=1.0, ptype=None, stars_only=False):
         """
         Adds particle positions, based on a thick slab along *axis* with a
         *width* along the line of sight.  *p_size* controls the number of
@@ -757,6 +757,7 @@
         self.color = col
         self.stride = stride
         self.ptype = ptype
+        self.stars_only = stars_only
 
     def __call__(self, plot):
         data = plot.data
@@ -773,6 +774,9 @@
         if self.ptype is not None:
             gg &= (reg["particle_type"] == self.ptype)
             if gg.sum() == 0: return
+        if self.stars_only:
+            gg &= (reg["creation_time"] > 0.0)
+            if gg.sum() == 0: return
         plot._axes.hold(True)
         px, py = self.convert_to_pixels(plot,
                     [reg[field_x][gg][::self.stride],



More information about the yt-svn mailing list