[Yt-svn] yt-commit r1151 - in trunk/yt: . lagos raven

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Thu Jan 29 13:44:49 PST 2009


Author: mturk
Date: Thu Jan 29 13:44:46 2009
New Revision: 1151
URL: http://yt.spacepope.org/changeset/1151

Log:
Added a marker callback, to annotate at a fixed point
Replaced md5 with hashlib (got rid of a deprecation warning)
Replaced sets with built-in (got rid of a deprecation warning)
Fixed a problem with iterating over numbers in the commands module, fixed hop
to work with multiple files



Modified:
   trunk/yt/commands.py
   trunk/yt/lagos/HierarchyType.py
   trunk/yt/lagos/OutputTypes.py
   trunk/yt/lagos/__init__.py
   trunk/yt/raven/Callbacks.py

Modified: trunk/yt/commands.py
==============================================================================
--- trunk/yt/commands.py	(original)
+++ trunk/yt/commands.py	Thu Jan 29 13:44:46 2009
@@ -162,7 +162,7 @@
             pfs = ["%s%04i" % (opts.basename, r)
                    for r in range(int(args[0]), int(args[1]), opts.skip) ]
         else: pfs = args
-        for arg in args:
+        for arg in pfs:
             func(self, subcmd, opts, arg)
     return arg_iterate
 
@@ -181,7 +181,7 @@
         """
         self.cmdloop()
 
-    @add_cmd_options(['outputfn','bn','thresh','dm_only'])
+    @add_cmd_options(['outputfn','bn','thresh','dm_only','skip'])
     @check_args
     def do_hop(self, subcmd, opts, arg):
         """

Modified: trunk/yt/lagos/HierarchyType.py
==============================================================================
--- trunk/yt/lagos/HierarchyType.py	(original)
+++ trunk/yt/lagos/HierarchyType.py	Thu Jan 29 13:44:46 2009
@@ -914,7 +914,7 @@
         field_list = self.get_data("/", "DataFields")
         if field_list is None:
             mylog.info("Gathering a field list (this may take a moment.)")
-            field_list = sets.Set()
+            field_list = set()
             random_sample = self._generate_random_grids()
             for grid in random_sample:
                 if not hasattr(grid, 'filename'): continue
@@ -924,7 +924,7 @@
                     mylog.debug("Grid %s is a bit funky?", grid.id)
                     continue
                 mylog.debug("Grid %s has: %s", grid.id, gf)
-                field_list = field_list.union(sets.Set(gf))
+                field_list = field_list.union(gf)
             field_list = self._join_field_lists(field_list)
             self.save_data(list(field_list),"/","DataFields")
         self.field_list = list(field_list)

Modified: trunk/yt/lagos/OutputTypes.py
==============================================================================
--- trunk/yt/lagos/OutputTypes.py	(original)
+++ trunk/yt/lagos/OutputTypes.py	Thu Jan 29 13:44:46 2009
@@ -81,10 +81,10 @@
         return self.basename
 
     def _hash(self):
-        import md5
+        import hashlib
         s = "%s;%s;%s" % (self.basename,
             self["InitialTime"], self["CurrentTimeIdentifier"])
-        return md5.md5(s).hexdigest()
+        return hashlib.md5(s).hexdigest()
 
 
     def __getitem__(self, key):

Modified: trunk/yt/lagos/__init__.py
==============================================================================
--- trunk/yt/lagos/__init__.py	(original)
+++ trunk/yt/lagos/__init__.py	Thu Jan 29 13:44:46 2009
@@ -49,7 +49,7 @@
 from math import ceil, floor, log10, pi
 import os, os.path, types, exceptions, re
 from stat import ST_CTIME
-import sets, shelve
+import shelve
 
 import time
 

Modified: trunk/yt/raven/Callbacks.py
==============================================================================
--- trunk/yt/raven/Callbacks.py	(original)
+++ trunk/yt/raven/Callbacks.py	Thu Jan 29 13:44:46 2009
@@ -505,6 +505,24 @@
         x,y = self.convert_to_pixels(plot, self.pos)
         plot._axes.text(x, y, self.text, **self.text_args)
 
+class MarkerAnnotateCallback(PlotCallback):
+    def __init__(self, pos, marker='x', plot_args=None):
+        self.pos = pos
+        self.marker = marker
+        if plot_args is None: plot_args = {}
+        self.plot_args = plot_args
+
+    def __call__(self, plot):
+        if len(self.pos) == 3:
+            pos = (self.pos[lagos.x_dict[plot.data.axis]],
+                   self.pos[lagos.y_dict[plot.data.axis]])
+        else: pos = self.pos
+        x,y = self.convert_to_pixels(plot, pos)
+        print x, y
+        plot._axes.hold(True)
+        plot._axes.plot((x,),(y,),self.marker, **self.plot_args)
+        plot._axes.hold(False)
+
 class SphereCallback(PlotCallback):
     def __init__(self, center, radius, circle_args = None,
                  text = None, text_args = None):



More information about the yt-svn mailing list