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

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Sun May 23 13:59:28 PDT 2010


Author: mturk
Date: Sun May 23 13:59:27 2010
New Revision: 1729
URL: http://yt.enzotools.org/changeset/1729

Log:
Added minimum_mass argument to particles callback.



Modified:
   trunk/yt/raven/Callbacks.py

Modified: trunk/yt/raven/Callbacks.py
==============================================================================
--- trunk/yt/raven/Callbacks.py	(original)
+++ trunk/yt/raven/Callbacks.py	Sun May 23 13:59:27 2010
@@ -800,12 +800,16 @@
     _type_name = "particles"
     region = None
     _descriptor = None
-    def __init__(self, width, p_size=1.0, col='k', marker='o', stride=1.0, ptype=None, stars_only=False, dm_only=False):
+    def __init__(self, width, p_size=1.0, col='k', marker='o', stride=1.0,
+                 ptype=None, stars_only=False, dm_only=False,
+                 minimum_mass=None):
         """
         Adds particle positions, based on a thick slab along *axis* with a
         *width* along the line of sight.  *p_size* controls the number of
         pixels per particle, and *col* governs the color.  *ptype* will
         restrict plotted particles to only those that are of a given type.
+        *minimum_mass* will require that the particles be of a given mass,
+        calculated via ParticleMassMsun, to be plotted.
         """
         PlotCallback.__init__(self)
         self.width = width
@@ -816,6 +820,7 @@
         self.ptype = ptype
         self.stars_only = stars_only
         self.dm_only = dm_only
+        self.minimum_mass = minimum_mass
 
     def __call__(self, plot):
         data = plot.data
@@ -838,6 +843,9 @@
         if self.dm_only:
             gg &= (reg["creation_time"] <= 0.0)
             if gg.sum() == 0: return
+        if self.minimum_mass is not None:
+            gg &= (reg["ParticleMassMsun"] >= self.minimum_mass)
+            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