[Yt-svn] yt-commit r506 - in trunk/yt: raven reason

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Thu May 29 17:04:06 PDT 2008


Author: mturk
Date: Thu May 29 17:04:05 2008
New Revision: 506
URL: http://yt.spacepope.org/changeset/506

Log:
Added rudimentary, full-width particle callbacks.

This will need -- obviously -- to be re-evaluated, as it should support the
full particle callback API, thus width and color-by.



Modified:
   trunk/yt/raven/Callbacks.py
   trunk/yt/reason/Notebook.py

Modified: trunk/yt/raven/Callbacks.py
==============================================================================
--- trunk/yt/raven/Callbacks.py	(original)
+++ trunk/yt/raven/Callbacks.py	Thu May 29 17:04:05 2008
@@ -77,8 +77,8 @@
         self.field_z = "particle_position_%s" % lagos.axis_names[axis]
 
     def __call__(self, plot):
-        z0 = plot.data.center[axis] - self.width/2.0
-        z1 = plot.data.center[axis] + self.width/2.0
+        z0 = plot.data.center[self.axis] - self.width/2.0
+        z1 = plot.data.center[self.axis] + self.width/2.0
         grids = plot.data._grids
         particles_x = na.concatenate([g[self.field_x] for g in grids]).ravel()
         particles_y = na.concatenate([g[self.field_y] for g in grids]).ravel()

Modified: trunk/yt/reason/Notebook.py
==============================================================================
--- trunk/yt/reason/Notebook.py	(original)
+++ trunk/yt/reason/Notebook.py	Thu May 29 17:04:05 2008
@@ -365,6 +365,8 @@
         self.popupmenu.AppendSeparator()
         self.grid_boundaries = self.popupmenu.AppendCheckItem(-1, "Show Grid Boundaries")
         self.grid_boundaries.Check(False)
+        self.particles = self.popupmenu.AppendCheckItem(-1, "Show particles")
+        self.particles.Check(False)
         self.velocities = self.popupmenu.AppendCheckItem(-1, "Show Velocities")
         self.velocities.Check(False)
         self.popupmenu.AppendSeparator()
@@ -376,6 +378,7 @@
         self.Bind(wx.EVT_MENU, self.OnCenterOnMax, self.center_on_max)
         self.Bind(wx.EVT_MENU, self.OnCenterHere, self.center_here)
         self.Bind(wx.EVT_MENU, self.show_grid_boundaries, self.grid_boundaries)
+        self.Bind(wx.EVT_MENU, self.show_particles, self.particles)
         self.Bind(wx.EVT_MENU, self.show_velocities, self.velocities)
         self.Bind(wx.EVT_MENU, self.take_log, self.take_log_menu)
         self.Bind(wx.EVT_MENU, self.fulldomain, fullDomain)
@@ -455,6 +458,7 @@
         else:
             self._grid_boundaries_cbid = \
                 self.plot.add_callback(raven.GridBoundaryCallback())
+        self.UpdateCanvas()
 
     _velocities_cbid = None
     def show_velocities(self, event):
@@ -466,6 +470,7 @@
             yv = "%s-velocity" % (lagos.axis_names[lagos.y_dict[self.axis]])
             self._velocities_cbid = \
                 self.plot.add_callback(raven.QuiverCallback(xv,yv,self.axis,20))
+        self.UpdateCanvas()
 
     _particles_cbid = None
     def show_particles(self, event):
@@ -474,7 +479,8 @@
             self._particles_cbid = None
         else:
             self._particles_cbid = \
-                self.plot.add_callback(raven.QuiverCallback(xv,yv,self.axis,20))
+                self.plot.add_callback(raven.ParticleCallback(self.axis, 1.0))
+        self.UpdateCanvas()
 
     def OnCenterHere(self, event):
         xp, yp = self.ContextMenuPosition
@@ -705,6 +711,7 @@
         self.center_here.Enable(False)
         self.grid_boundaries.Enable(False)
         self.velocities.Enable(False)
+        self.particles.Enable(False)
 
 class PhasePlotPage(PlotPage):
     def __init__(self, parent, status_bar, data_object, argdict, mw=None, CreationID = -1):



More information about the yt-svn mailing list