[Yt-svn] yt-commit r1474 - branches/yt-1.5/yt/raven trunk/yt/raven

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Mon Oct 5 15:34:54 PDT 2009


Author: mturk
Date: Mon Oct  5 15:34:53 2009
New Revision: 1474
URL: http://yt.enzotools.org/changeset/1474

Log:
Added some docstrings to the callbacks and moved other docstrings around.



Modified:
   branches/yt-1.5/yt/raven/Callbacks.py
   trunk/yt/raven/Callbacks.py

Modified: branches/yt-1.5/yt/raven/Callbacks.py
==============================================================================
--- branches/yt-1.5/yt/raven/Callbacks.py	(original)
+++ branches/yt-1.5/yt/raven/Callbacks.py	Mon Oct  5 15:34:53 2009
@@ -298,6 +298,9 @@
 class LabelCallback(PlotCallback):
     _type_name = "axis_label"
     def __init__(self, label):
+        """
+        This adds a label to the plot.
+        """
         PlotCallback.__init__(self)
         self.label = label
 
@@ -504,6 +507,10 @@
 class ArrowCallback(PlotCallback):
     _type_name = "arrow"
     def __init__(self, pos, code_size, plot_args = None):
+        """
+        This adds an arrow pointing at *pos* with size *code_size* in code
+        units.  *plot_args* is a dict fed to matplotlib with arrow properties.
+        """
         self.pos = pos
         self.code_size = code_size
         if plot_args is None: plot_args = {}
@@ -520,6 +527,10 @@
 class PointAnnotateCallback(PlotCallback):
     _type_name = "point"
     def __init__(self, pos, text, text_args = None):
+        """
+        This adds *text* at position *pos*, where *pos* is in code-space.
+        *text_args* is a dict fed to the text placement code.
+        """
         self.pos = pos
         self.text = text
         self.text_args = text_args
@@ -531,6 +542,10 @@
 class MarkerAnnotateCallback(PlotCallback):
     _type_name = "marker"
     def __init__(self, pos, marker='x', plot_args=None):
+        """
+        Adds text *marker* at *pos* in code-arguments.  *plot_args* is a dict
+        that will be forwarded to the plot command.
+        """
         self.pos = pos
         self.marker = marker
         if plot_args is None: plot_args = {}
@@ -550,6 +565,11 @@
     _type_name = "sphere"
     def __init__(self, center, radius, circle_args = None,
                  text = None, text_args = None):
+        """
+        A sphere centered at *center* in code units with radius *radius* in
+        code units will be created, with optional *circle_args*, *text*, and
+        *text_args*.
+        """
         self.center = center
         self.radius = radius
         if circle_args is None: circle_args = {}
@@ -583,6 +603,10 @@
                  annotate=False, min_size=20, max_size=10000000,
                  font_size=8, print_halo_size=False,
                  print_halo_mass=False, width=None):
+        """
+        Accepts a :class:`yt.lagos.HopList` *hop_output* and plots up to
+        *max_number* (None for unlimited) halos as circles.
+        """
         self.hop_output = hop_output
         self.max_number = max_number
         self.annotate = annotate
@@ -629,15 +653,15 @@
                     fontsize=self.font_size)
 
 class HopParticleCallback(PlotCallback):
-    """
-    Adds particle positions for the members of each halo as identified
-    by HOP. Along *axis* up to *max_number* groups in *hop_output* that are
-    larger than *min_size* are plotted with *p_size* pixels per particle; 
-    *alpha* determines the opacity of each particle.
-    """
     _type_name = "hop_particles"
     def __init__(self, hop_output, p_size=1.0,
                 max_number=None, min_size=20, alpha=0.2):
+        """
+        Adds particle positions for the members of each halo as identified
+        by HOP. Along *axis* up to *max_number* groups in *hop_output* that are
+        larger than *min_size* are plotted with *p_size* pixels per particle; 
+        *alpha* determines the opacity of each particle.
+        """
         self.hop_output = hop_output
         self.p_size = p_size
         self.max_number = max_number
@@ -667,17 +691,6 @@
             plot._axes.set_ylim(yy0,yy1)
             plot._axes.hold(False)
 
-class FloorToValueInPlot(PlotCallback):
-    _type_name = "floor"
-    def __init__(self):
-        pass
-
-    def __call__(self, plot):
-        aa = plot.image._A
-        min_val = aa[aa>0].min()
-        aa[aa==0] = min_val
-
-
 class VobozCircleCallback(PlotCallback):
     _type_name = "voboz_circle"
     def __init__(self, voboz_output, max_number=None,
@@ -718,12 +731,12 @@
                         fontsize=self.font_size)
 
 class CoordAxesCallback(PlotCallback):
-    """Creates x and y axes for a VMPlot. In the future, it will
-    attempt to guess the proper units to use.
-
-    """
     _type_name = "coord_axes"
     def __init__(self,unit=None,coords=False):
+        """
+        Creates x and y axes for a VMPlot. In the future, it will
+        attempt to guess the proper units to use.
+        """
         PlotCallback.__init__(self)
         self.unit = unit
         self.coords = coords

Modified: trunk/yt/raven/Callbacks.py
==============================================================================
--- trunk/yt/raven/Callbacks.py	(original)
+++ trunk/yt/raven/Callbacks.py	Mon Oct  5 15:34:53 2009
@@ -241,6 +241,9 @@
 class LabelCallback(PlotCallback):
     _type_name = "axis_label"
     def __init__(self, label):
+        """
+        This adds a label to the plot.
+        """
         PlotCallback.__init__(self)
         self.label = label
 
@@ -447,6 +450,10 @@
 class ArrowCallback(PlotCallback):
     _type_name = "arrow"
     def __init__(self, pos, code_size, plot_args = None):
+        """
+        This adds an arrow pointing at *pos* with size *code_size* in code
+        units.  *plot_args* is a dict fed to matplotlib with arrow properties.
+        """
         self.pos = pos
         self.code_size = code_size
         if plot_args is None: plot_args = {}
@@ -463,6 +470,10 @@
 class PointAnnotateCallback(PlotCallback):
     _type_name = "point"
     def __init__(self, pos, text, text_args = None):
+        """
+        This adds *text* at position *pos*, where *pos* is in code-space.
+        *text_args* is a dict fed to the text placement code.
+        """
         self.pos = pos
         self.text = text
         self.text_args = text_args
@@ -474,6 +485,10 @@
 class MarkerAnnotateCallback(PlotCallback):
     _type_name = "marker"
     def __init__(self, pos, marker='x', plot_args=None):
+        """
+        Adds text *marker* at *pos* in code-arguments.  *plot_args* is a dict
+        that will be forwarded to the plot command.
+        """
         self.pos = pos
         self.marker = marker
         if plot_args is None: plot_args = {}
@@ -494,6 +509,11 @@
     _type_name = "sphere"
     def __init__(self, center, radius, circle_args = None,
                  text = None, text_args = None):
+        """
+        A sphere centered at *center* in code units with radius *radius* in
+        code units will be created, with optional *circle_args*, *text*, and
+        *text_args*.
+        """
         self.center = center
         self.radius = radius
         if circle_args is None: circle_args = {}
@@ -527,6 +547,10 @@
                  annotate=False, min_size=20, max_size=10000000,
                  font_size=8, print_halo_size=False,
                  print_halo_mass=False, width=None):
+        """
+        Accepts a :class:`yt.lagos.HopList` *hop_output* and plots up to
+        *max_number* (None for unlimited) halos as circles.
+        """
         self.hop_output = hop_output
         self.max_number = max_number
         self.annotate = annotate
@@ -573,15 +597,15 @@
                     fontsize=self.font_size)
 
 class HopParticleCallback(PlotCallback):
-    """
-    Adds particle positions for the members of each halo as identified
-    by HOP. Along *axis* up to *max_number* groups in *hop_output* that are
-    larger than *min_size* are plotted with *p_size* pixels per particle; 
-    *alpha* determines the opacity of each particle.
-    """
     _type_name = "hop_particles"
     def __init__(self, hop_output, p_size=1.0,
                 max_number=None, min_size=20, alpha=0.2):
+        """
+        Adds particle positions for the members of each halo as identified
+        by HOP. Along *axis* up to *max_number* groups in *hop_output* that are
+        larger than *min_size* are plotted with *p_size* pixels per particle; 
+        *alpha* determines the opacity of each particle.
+        """
         self.hop_output = hop_output
         self.p_size = p_size
         self.max_number = max_number
@@ -611,17 +635,6 @@
             plot._axes.set_ylim(yy0,yy1)
             plot._axes.hold(False)
 
-class FloorToValueInPlot(PlotCallback):
-    _type_name = "floor"
-    def __init__(self):
-        pass
-
-    def __call__(self, plot):
-        aa = plot.image._A
-        min_val = aa[aa>0].min()
-        aa[aa==0] = min_val
-
-
 class VobozCircleCallback(PlotCallback):
     _type_name = "voboz_circle"
     def __init__(self, voboz_output, max_number=None,
@@ -662,12 +675,12 @@
                         fontsize=self.font_size)
 
 class CoordAxesCallback(PlotCallback):
-    """Creates x and y axes for a VMPlot. In the future, it will
-    attempt to guess the proper units to use.
-
-    """
     _type_name = "coord_axes"
     def __init__(self,unit=None,coords=False):
+        """
+        Creates x and y axes for a VMPlot. In the future, it will
+        attempt to guess the proper units to use.
+        """
         PlotCallback.__init__(self)
         self.unit = unit
         self.coords = coords



More information about the yt-svn mailing list