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

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Thu May 15 17:35:07 PDT 2008


Author: mturk
Date: Thu May 15 17:35:07 2008
New Revision: 476
URL: http://yt.spacepope.org/changeset/476

Log:
Minor fix to call _redraw_image in the cutting plane image.

Added -- FINALLY -- access to the callbacks for grid boundaries and velocities.

Vector callbacks in *general* ... I'm not so sure about.  They are available,
but I don't know if I'm going to put them in to the menu item.

Contours, for sure.

I'm finally getting around to exposing some of the functionality that's been in
the code for months and months and months...



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

Modified: trunk/yt/raven/PlotTypes.py
==============================================================================
--- trunk/yt/raven/PlotTypes.py	(original)
+++ trunk/yt/raven/PlotTypes.py	Thu May 15 17:35:07 2008
@@ -428,6 +428,7 @@
         r_edge_y = +width_y/2.0
         self.set_xlim(l_edge_x, r_edge_x) # We have no real limits
         self.set_ylim(l_edge_y, r_edge_y) # At some point, perhaps calculate them?
+        self._redraw_image()
 
 class PhasePlot(RavenPlot):
     def __init__(self, data, fields, width=None, unit=None, bins=100,
@@ -805,11 +806,11 @@
         left_edge_py = (GLE[:,py_index]-y0)*dy
         right_edge_px = (GRE[:,px_index]-x0)*dx
         right_edge_py = (GRE[:,py_index]-y0)*dy
-        verts = na.array( 
+        verts = na.array(
                 [(left_edge_px, left_edge_px, right_edge_px, right_edge_px),
                  (left_edge_py, right_edge_py, right_edge_py, left_edge_py)])
         visible =  ( right_edge_px - left_edge_px > min_pix ) & \
-                   ( right_edge_px - left_edge_px > min_pix ) 
+                   ( right_edge_px - left_edge_px > min_pix )
         verts=verts.transpose()[visible,:,:]
         edgecolors = (0.0,0.0,0.0,alpha)
         grid_collection = matplotlib.collections.PolyCollection(
@@ -853,7 +854,7 @@
         left_edge_py = (center[yi] - widths/2.0 - y0)*dy
         right_edge_px = (center[xi] + widths/2.0 - x0)*dx
         right_edge_py = (center[yi] + widths/2.0 - y0)*dy
-        verts = na.array( 
+        verts = na.array(
                 [(left_edge_px, left_edge_px, right_edge_px, right_edge_px),
                  (left_edge_py, right_edge_py, right_edge_py, left_edge_py)])
         visible =  ( right_edge_px - left_edge_px > 25 ) & \

Modified: trunk/yt/reason/Notebook.py
==============================================================================
--- trunk/yt/reason/Notebook.py	(original)
+++ trunk/yt/reason/Notebook.py	Thu May 15 17:35:07 2008
@@ -343,10 +343,17 @@
         centerOnMax = self.popupmenu.Append(-1, "Center on max")
         centerHere = self.popupmenu.Append(-1, "Center here")
         self.popupmenu.AppendSeparator()
+        gridBoundaries = self.popupmenu.AppendCheckItem(-1, "Show Grid Boundaries")
+        gridBoundaries.Check(False)
+        velocities = self.popupmenu.AppendCheckItem(-1, "Show Velocities")
+        velocities.Check(False)
+        self.popupmenu.AppendSeparator()
         fullDomain = self.popupmenu.Append(-1, "Zoom Top")
 
         self.Bind(wx.EVT_MENU, self.OnCenterOnMax, centerOnMax)
         self.Bind(wx.EVT_MENU, self.OnCenterHere, centerHere)
+        self.Bind(wx.EVT_MENU, self.show_grid_boundaries, gridBoundaries)
+        self.Bind(wx.EVT_MENU, self.show_velocities, velocities)
         self.Bind(wx.EVT_MENU, self.fulldomain, fullDomain)
 
     def SetupFigure(self):
@@ -417,6 +424,26 @@
         Publisher().sendMessage(('viewchange','center'), c)
         self.UpdateWidth()
 
+    _grid_boundaries_cbid = None
+    def show_grid_boundaries(self, event):
+        if self._grid_boundaries_cbid is not None:
+            self.plot.remove_callback(self._grid_boundaries_cbid)
+            self._grid_boundaries_cbid = None
+        else:
+            self._grid_boundaries_cbid = \
+                self.plot.add_callback(raven.be.gridBoundaryCallback())
+
+    _velocities_cbid = None
+    def show_velocities(self, event):
+        if self._velocities_cbid is not None:
+            self.plot.remove_callback(self._velocities_cbid)
+            self._velocities_cbid = None
+        else:
+            xv = "%s-velocity" % (lagos.axis_names[lagos.x_dict[self.axis]])
+            yv = "%s-velocity" % (lagos.axis_names[lagos.y_dict[self.axis]])
+            self._velocities_cbid = \
+                self.plot.add_callback(raven.be.quiverCallback(xv,yv,self.axis,20))
+
     def OnCenterHere(self, event):
         xp, yp = self.ContextMenuPosition
         x, y = self.ConvertPositionToDataPosition(xp, yp)



More information about the yt-svn mailing list