[Yt-svn] yt-commit r542 - in trunk/yt: lagos reason

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Thu Jun 5 23:01:16 PDT 2008


Author: mturk
Date: Thu Jun  5 23:01:15 2008
New Revision: 542
URL: http://yt.spacepope.org/changeset/542

Log:

 * Added centered sphere (closes #113)
 * Removed silly 'hithere' comment that shouldn't have snuck in
 * Minor stubs for fido actions added (for #101)
 * Removed the default grabbing-of-density for new spheres.  Who thought that
was a good idea?



Modified:
   trunk/yt/lagos/HierarchyType.py
   trunk/yt/reason/App.py
   trunk/yt/reason/Notebook.py
   trunk/yt/reason/Toolbars.py

Modified: trunk/yt/lagos/HierarchyType.py
==============================================================================
--- trunk/yt/lagos/HierarchyType.py	(original)
+++ trunk/yt/lagos/HierarchyType.py	Thu Jun  5 23:01:15 2008
@@ -190,7 +190,6 @@
             mode = 'a'
         try:
             self.__data_file = tables.openFile(fn, mode)
-            self.hithere = self.__data_file
             my_name = self.get_data("/","MyName")
             if my_name is None:
                 self.save_data(str(self.parameter_file), "/", "MyName")

Modified: trunk/yt/reason/App.py
==============================================================================
--- trunk/yt/reason/App.py	(original)
+++ trunk/yt/reason/App.py	Thu Jun  5 23:01:15 2008
@@ -175,6 +175,12 @@
                 ni = self.data_tree.AppendItem(cRoot,
                     "%s" % (os.path.basename(fn)), data=tid)
 
+    def _remove_fido_output(self, event=None):
+        pass
+
+    def _remove_fido_outputcollection(self, event=None):
+        pass
+
     def __setup_toolbar(self):
         # Tool Bar
         self._VMTB_REREADFIDO = wx.NewId()
@@ -475,7 +481,7 @@
         #tid = self.data_tree.GetFirstSelected()
         tid = self.data_tree.GetSelection()
         ii = self.data_tree.GetItemData(tid).GetData()[0]
-        if isinstance(ii, types.StringTypes):
+        if isinstance(ii, types.StringTypes): # We promote
             ii = lagos.EnzoStaticOutput(ii) # Instantiate here
             self.outputs.append(ii)
             fn, z, t, mids = self.data_tree.GetItemData(tid).GetData()

Modified: trunk/yt/reason/Notebook.py
==============================================================================
--- trunk/yt/reason/Notebook.py	(original)
+++ trunk/yt/reason/Notebook.py	Thu Jun  5 23:01:15 2008
@@ -34,7 +34,7 @@
 
 To access the various plotting functions, right click on a dataset in the tree over to the left.  Then you can right-click in the window to shuffle around the center, to change the color map, to save it, and so on.  And then give a shot to shift-clicking in two places -- the first will define the center, the second will define the outer-edge.  Then you can phase plot the sphere!
 
-If you experience any troubles, drop me a line (matt at yt.spacepope.org) or just fill out a ticket at yt.spacepope.org.
+If you experience any troubles, drop me a line (matthewturk at gmail.com) or just fill out a ticket at yt.enzotools.org.
 """
 
 class PlotPanel(wx.Panel):
@@ -378,6 +378,7 @@
         self.take_log_menu.Check(self.plot.log_field)
         fullDomain = self.popupmenu.Append(-1, "Zoom Top")
         bulk_velocity = self.popupmenu.Append(-1, "Set Bulk Velocity")
+        centered_sphere = self.popupmenu.Append(-1, "Get Sphere")
 
         self.Bind(wx.EVT_MENU, self.OnCenterOnMax, self.center_on_max)
         self.Bind(wx.EVT_MENU, self.OnCenterHere, self.center_here)
@@ -387,6 +388,7 @@
         self.Bind(wx.EVT_MENU, self.take_log, self.take_log_menu)
         self.Bind(wx.EVT_MENU, self.fulldomain, fullDomain)
         self.Bind(wx.EVT_MENU, self.set_bulk_velocity, bulk_velocity)
+        self.Bind(wx.EVT_MENU, self.get_centered_sphere, centered_sphere)
 
     def SetupFigure(self):
         PlotPage.SetupFigure(self)
@@ -535,7 +537,7 @@
                 cc[lagos.x_dict[self.axis]] = xd
                 cc[lagos.y_dict[self.axis]] = yd
                 sphere = self.outputfile.hierarchy.sphere( \
-                    cc, r, fields = ["Density"])
+                    cc, r)
                 self.mw._add_sphere("Sphere: %0.3e %s" \
                         % (r*unit, unitname), sphere)
                 self.AmDrawingCircle = False
@@ -624,6 +626,16 @@
                                     ('bulk_velocity', bv))
             Publisher().sendMessage(('viewchange','wipe'),())
 
+    def get_centered_sphere(self, *args):
+        rv = Toolbars.GetSphereRadius(self.outputfile, self.center)
+        if rv is not None:
+            radius, unit = rv
+            sphere = self.outputfile.hierarchy.sphere( \
+                self.center,
+                radius/self.outputfile[unit])
+            self.mw._add_sphere("Sphere: %0.3e %s" \
+                    % (radius, unit), sphere)
+
     def WipePlotDataFromMessage(self, message):
         self.data.clear_data()
         self.UpdateCanvas()

Modified: trunk/yt/reason/Toolbars.py
==============================================================================
--- trunk/yt/reason/Toolbars.py	(original)
+++ trunk/yt/reason/Toolbars.py	Thu Jun  5 23:01:15 2008
@@ -145,26 +145,16 @@
     dlg.Destroy()
     return w, u
 
-def GetAngularMomentumVector(outputfile, center):
+def GetSphereRadius(outputfile, center):
     dlg = ReasonWidthSelectionWindow(outputfile,
                 "Radius Selector",
-            "With the current display-center, over \n" + \
-            "what radius should bulk velocity be calculated?")
+            "With the current display-center, how large\n" + \
+            "should our sphere be?")
     resp = dlg.ShowModal()
-    bv = None
-    if resp == wx.ID_OK:
-        w, u = dlg.GetData()
-        sp = outputfile.h.sphere(center=center, radius=w/outputfile[u])
-        bv = sp.quantities["BulkVelocity"](lazy_reader=True)
-        if na.any(na.isnan(bv)):
-            err = wx.MessageDialog(None, "Error",
-                            "The values were bad.  Try a bigger sphere?",
-                            wx.OK)
-            err.ShowModal()
-            err.Destroy()
-            bv = None
+    tr = None
+    if resp == wx.ID_OK: tr = dlg.GetData()
     dlg.Destroy()
-    return bv
+    return tr
 
 def GetBulkVelocity(outputfile, center):
     dlg = ReasonWidthSelectionWindow(outputfile,



More information about the yt-svn mailing list