[yt-svn] commit/yt: 12 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Mar 28 01:42:20 PDT 2016


12 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/02c5536607fd/
Changeset:   02c5536607fd
Branch:      yt
User:        chummels
Date:        2015-12-05 19:25:41+00:00
Summary:     Adding width and starting_pos kwargs to annotate_arrow() callback
Affected #:  1 file

diff -r 315acc8b8296a1655efbc5fa6dfc9c88fab44b62 -r 02c5536607fd7a9e07c2522ecfd26aa362cabb56 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -901,11 +901,13 @@
 
 class ArrowCallback(PlotCallback):
     """
-    annotate_arrow(pos, length=0.03, coord_system='data', plot_args=None):
+    annotate_arrow(pos, length=0.03, width=0.06, starting_pos=None, 
+                   coord_system='data', plot_args=None):
 
     Overplot an arrow pointing at a position for highlighting a specific
     feature.  Arrow points from lower left to the designated position with
-    arrow length "length".
+    arrow length "length" unless starting_pos is set to specify tail location 
+    of arrow.
 
     Parameters
     ----------
@@ -914,6 +916,15 @@
 
     length : float, optional
         The length, in axis units, of the arrow.
+        Default: 0.03
+
+    width : float, optional
+        The width, in axis units, of the arrow.
+        Default: 0.06
+
+    starting_pos : 2- or 3-element tuple, list, or array, optional
+        These are the coordinates from which the arrow starts towards its
+        point.  Not compatible with 'length' kwarg.
 
     coord_system : string, optional
         This string defines the coordinate system of the coordinates of pos
@@ -948,18 +959,20 @@
     >>> import yt
     >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
     >>> s = yt.SlicePlot(ds, 'z', 'density')
-    >>> s.annotate_arrow([0.1, -0.1, length=0.06, coord_system='plot',
+    >>> s.annotate_arrow([0.1, -0.1], length=0.06, coord_system='plot',
     ...                  plot_args={'color':'red'})
     >>> s.save()
 
     """
     _type_name = "arrow"
-    def __init__(self, pos, code_size=None, length=0.03, coord_system='data',
-                 plot_args=None):
+    def __init__(self, pos, code_size=None, length=0.03, width=0.06, 
+                 starting_pos=None, coord_system='data', plot_args=None):
         def_plot_args = {'color':'white', 'linewidth':2}
         self.pos = pos
         self.code_size = code_size
         self.length = length
+        self.width = width
+        self.starting_pos = starting_pos
         self.coord_system = coord_system
         self.transform = None
         if plot_args is None: plot_args = def_plot_args
@@ -981,11 +994,20 @@
             self.code_size = self.code_size * self.pixel_scale(plot)[0]
             dx = dy = self.code_size
         else:
-            dx = (xx1-xx0) * self.length
-            dy = (yy1-yy0) * self.length
+            if self.starting_pos is not None:
+                start_x,start_y = self.sanitize_coord_system(plot, \
+                                       self.starting_pos, \
+                                       coord_system=self.coord_system)
+                dx = x - start_x
+                dy = y - start_y
+            else:
+                dx = (xx1-xx0) * 2**(0.5) * self.length
+                dy = (yy1-yy0) * 2**(0.5) * self.length
         plot._axes.hold(True)
         from matplotlib.patches import Arrow
-        arrow = Arrow(x-dx, y-dy, dx, dy, width=dx,
+        print "length = %f" % self.length
+        print "width = %f" % self.width
+        arrow = Arrow(x-dx, y-dy, dx, dy, width=self.width,
                       transform=self.transform, **self.plot_args)
         plot._axes.add_patch(arrow)
         plot._axes.set_xlim(xx0,xx1)


https://bitbucket.org/yt_analysis/yt/commits/a5b85b78c5a0/
Changeset:   a5b85b78c5a0
Branch:      yt
User:        chummels
Date:        2015-12-05 19:45:18+00:00
Summary:     Removing print statements.
Affected #:  1 file

diff -r 02c5536607fd7a9e07c2522ecfd26aa362cabb56 -r a5b85b78c5a0f9508f7808ce51c716386f878db9 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -901,7 +901,7 @@
 
 class ArrowCallback(PlotCallback):
     """
-    annotate_arrow(pos, length=0.03, width=0.06, starting_pos=None, 
+    annotate_arrow(pos, length=0.03, width=0.03, starting_pos=None, 
                    coord_system='data', plot_args=None):
 
     Overplot an arrow pointing at a position for highlighting a specific
@@ -920,7 +920,7 @@
 
     width : float, optional
         The width, in axis units, of the arrow.
-        Default: 0.06
+        Default: 0.03
 
     starting_pos : 2- or 3-element tuple, list, or array, optional
         These are the coordinates from which the arrow starts towards its
@@ -965,7 +965,7 @@
 
     """
     _type_name = "arrow"
-    def __init__(self, pos, code_size=None, length=0.03, width=0.06, 
+    def __init__(self, pos, code_size=None, length=0.03, width=0.03, 
                  starting_pos=None, coord_system='data', plot_args=None):
         def_plot_args = {'color':'white', 'linewidth':2}
         self.pos = pos
@@ -1005,8 +1005,6 @@
                 dy = (yy1-yy0) * 2**(0.5) * self.length
         plot._axes.hold(True)
         from matplotlib.patches import Arrow
-        print "length = %f" % self.length
-        print "width = %f" % self.width
         arrow = Arrow(x-dx, y-dy, dx, dy, width=self.width,
                       transform=self.transform, **self.plot_args)
         plot._axes.add_patch(arrow)


https://bitbucket.org/yt_analysis/yt/commits/027833076b4c/
Changeset:   027833076b4c
Branch:      yt
User:        chummels
Date:        2015-12-05 20:25:36+00:00
Summary:     Updating annotate_arrow to use pyplot arrow instead of patches arrow.
Affected #:  1 file

diff -r a5b85b78c5a0f9508f7808ce51c716386f878db9 -r 027833076b4c117e5f537e16e2f7fb7d54e88d3b yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -901,7 +901,8 @@
 
 class ArrowCallback(PlotCallback):
     """
-    annotate_arrow(pos, length=0.03, width=0.03, starting_pos=None, 
+    annotate_arrow(pos, length=0.03, width=0.003, head_length=None, 
+                   head_width=0.02, starting_pos=None, 
                    coord_system='data', plot_args=None):
 
     Overplot an arrow pointing at a position for highlighting a specific
@@ -919,8 +920,17 @@
         Default: 0.03
 
     width : float, optional
-        The width, in axis units, of the arrow.
-        Default: 0.03
+        The width, in axis units, of the tail line of the arrow.
+        Default: 0.003
+
+    head_length : float, optional
+        The length, in axis units, of the head of the arrow.  If set
+        to None, use 1.5*head_width
+        Default: None
+
+    head_width : float, optional
+        The width, in axis units, of the head of the arrow.
+        Default: 0.02
 
     starting_pos : 2- or 3-element tuple, list, or array, optional
         These are the coordinates from which the arrow starts towards its
@@ -942,7 +952,7 @@
 
     plot_args : dictionary, optional
         This dictionary is passed to the MPL arrow function for generating
-        the arrow.  By default, it is: {'color':'white', 'linewidth':2}
+        the arrow.  By default, it is: {'color':'white'}
 
     Examples
     --------
@@ -965,13 +975,16 @@
 
     """
     _type_name = "arrow"
-    def __init__(self, pos, code_size=None, length=0.03, width=0.03, 
+    def __init__(self, pos, code_size=None, length=0.03, width=0.003, 
+                 head_width=0.02, head_length=None,
                  starting_pos=None, coord_system='data', plot_args=None):
-        def_plot_args = {'color':'white', 'linewidth':2}
+        def_plot_args = {'color':'white'}
         self.pos = pos
         self.code_size = code_size
         self.length = length
         self.width = width
+        self.head_width = head_width
+        self.head_length = head_length
         self.starting_pos = starting_pos
         self.coord_system = coord_system
         self.transform = None
@@ -1003,11 +1016,16 @@
             else:
                 dx = (xx1-xx0) * 2**(0.5) * self.length
                 dy = (yy1-yy0) * 2**(0.5) * self.length
+        # If the arrow is 0 length
+        if dx == dy == 0:
+            warnings.warn("The arrow has zero length.  Not annotating.")
+            return
         plot._axes.hold(True)
-        from matplotlib.patches import Arrow
-        arrow = Arrow(x-dx, y-dy, dx, dy, width=self.width,
-                      transform=self.transform, **self.plot_args)
-        plot._axes.add_patch(arrow)
+        plot._axes.arrow(x-dx, y-dy, dx, dy, width=self.width, 
+                         head_width=self.head_width, 
+                         head_length=self.head_length, 
+                         transform=self.transform, 
+                         length_includes_head=True, **self.plot_args)
         plot._axes.set_xlim(xx0,xx1)
         plot._axes.set_ylim(yy0,yy1)
         plot._axes.hold(False)


https://bitbucket.org/yt_analysis/yt/commits/eef6d0b77712/
Changeset:   eef6d0b77712
Branch:      yt
User:        chummels
Date:        2015-12-05 20:48:54+00:00
Summary:     Updating annotate_ray to allow rays to be plotted as arrows if desired.
Affected #:  1 file

diff -r 027833076b4c117e5f537e16e2f7fb7d54e88d3b -r eef6d0b777127b3940061d0834c76bb612004db5 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -1992,6 +1992,9 @@
     Adds a line representing the projected path of a ray across the plot.
     The ray can be either a YTOrthoRay, YTRay, or a LightRay object.
     annotate_ray() will properly account for periodic rays across the volume.
+    If arrow is set to True, uses the MPL.pyplot.arrow function, otherwise
+    uses the MPL.pyplot.plot function to plot a normal line.  Adjust 
+    plot_args accordingly.
 
     Parameters
     ----------
@@ -2003,6 +2006,11 @@
         object, it will only plot the segment of the LightRay that intersects
         the dataset currently displayed.
 
+    arrow : boolean, optional
+        Whether or not to place an arrowhead on the front of the ray as it
+        traverses the box.
+        Default: False
+
     plot_args : dictionary, optional
         A dictionary of any arbitrary parameters to be passed to the Matplotlib
         line object.  Defaults: {'color':'white', 'linewidth':2}.
@@ -2033,10 +2041,11 @@
 
     """
     _type_name = "ray"
-    def __init__(self, ray, plot_args=None):
+    def __init__(self, ray, arrow=False, plot_args=None):
         PlotCallback.__init__(self)
         def_plot_args = {'color':'white', 'linewidth':2}
         self.ray = ray
+        self.arrow = arrow
         if plot_args is None: plot_args = def_plot_args
         self.plot_args = plot_args
 
@@ -2107,10 +2116,16 @@
             segments = [[start_coord, end_coord]]
 
         for segment in segments:
-            lcb = LinePlotCallback(segment[0], segment[1],
+            if self.arrow:
+                #import pdb; pdb.set_trace()
+                cb = ArrowCallback(segment[1], starting_pos=segment[0], 
                                    coord_system='data',
                                    plot_args=self.plot_args)
-            lcb(plot)
+            else:
+                cb = LinePlotCallback(segment[0], segment[1],
+                                   coord_system='data',
+                                   plot_args=self.plot_args)
+            cb(plot)
 
         return plot
 


https://bitbucket.org/yt_analysis/yt/commits/6907a36bd0a6/
Changeset:   6907a36bd0a6
Branch:      yt
User:        chummels
Date:        2015-12-05 21:46:53+00:00
Summary:     Making sanitize_coord_system actually return a tuple of floats for coordinates instead of a tuple of ndarrays.
Affected #:  1 file

diff -r eef6d0b777127b3940061d0834c76bb612004db5 -r 6907a36bd0a609cc8013f8cd2a7b7fa256381adf yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -156,6 +156,9 @@
                                   "need to be in 3D")
             coord = self.project_coords(plot, coord)
             coord = self.convert_to_plot(plot, coord)
+            # Convert coordinates from a tuple of ndarray to a tuple of floats
+            # since not all callbacks are OK with ndarrays as coords (eg arrow)
+            coord = (coord[0][0], coord[1][0])
         # if in plot coords, define the transform correctly
         if coord_system == "data" or coord_system == "plot":
             self.transform = plot._axes.transData
@@ -2117,7 +2120,6 @@
 
         for segment in segments:
             if self.arrow:
-                #import pdb; pdb.set_trace()
                 cb = ArrowCallback(segment[1], starting_pos=segment[0], 
                                    coord_system='data',
                                    plot_args=self.plot_args)


https://bitbucket.org/yt_analysis/yt/commits/8973f6081f8b/
Changeset:   8973f6081f8b
Branch:      yt
User:        chummels
Date:        2015-12-06 08:48:51+00:00
Summary:     Normaling arrow heads to current plot.  Assuring only final ray segment gets arrow head.
Affected #:  1 file

diff -r 6907a36bd0a609cc8013f8cd2a7b7fa256381adf -r 8973f6081f8b504029a5d0be3939d3718da587c1 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -978,8 +978,8 @@
 
     """
     _type_name = "arrow"
-    def __init__(self, pos, code_size=None, length=0.03, width=0.003, 
-                 head_width=0.02, head_length=None,
+    def __init__(self, pos, code_size=None, length=0.03, width=0.0001, 
+                 head_width=0.01, head_length=0.01,
                  starting_pos=None, coord_system='data', plot_args=None):
         def_plot_args = {'color':'white'}
         self.pos = pos
@@ -999,7 +999,13 @@
                                coord_system=self.coord_system)
         xx0, xx1 = plot._axes.get_xlim()
         yy0, yy1 = plot._axes.get_ylim()
-
+        # normalize all of the kwarg lengths to the plot size
+        plot_diag = ((yy1-yy0)**2 + (xx1-xx0)**2)**(0.5)
+        self.length *= plot_diag
+        self.width *= plot_diag
+        self.head_width *= plot_diag
+        if self.head_length is not None:
+            self.head_length *= plot_diag
         if self.code_size is not None:
             warnings.warn("The code_size keyword is deprecated.  Please use "
                           "the length keyword in 'axis' units instead. "
@@ -2118,17 +2124,24 @@
         else:
             segments = [[start_coord, end_coord]]
 
-        for segment in segments:
-            if self.arrow:
-                cb = ArrowCallback(segment[1], starting_pos=segment[0], 
-                                   coord_system='data',
-                                   plot_args=self.plot_args)
-            else:
-                cb = LinePlotCallback(segment[0], segment[1],
-                                   coord_system='data',
-                                   plot_args=self.plot_args)
+        # To assure that the last ray segment has an arrow if so desired
+        # and all other ray segments are lines
+        for segment in segments[:-1]:
+            cb = LinePlotCallback(segment[0], segment[1],
+                                  coord_system='data',
+                                  plot_args=self.plot_args)
             cb(plot)
-
+        segment = segments[-1]
+        if self.arrow:
+            cb = ArrowCallback(segment[1], starting_pos=segment[0], 
+                               coord_system='data',
+                               plot_args=self.plot_args)
+        else:
+           cb = LinePlotCallback(segment[0], segment[1],
+                               coord_system='data',
+                               plot_args=self.plot_args)
+        cb(plot)
+ 
         return plot
 
 class LineIntegralConvolutionCallback(PlotCallback):


https://bitbucket.org/yt_analysis/yt/commits/7574d2271d1f/
Changeset:   7574d2271d1f
Branch:      yt
User:        chummels
Date:        2016-03-15 23:28:47+00:00
Summary:     Cleaning up docs for annotate_ray.
Affected #:  1 file

diff -r 8973f6081f8b504029a5d0be3939d3718da587c1 -r 7574d2271d1f4e16bf4fda604f1cf41680377051 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -904,13 +904,13 @@
 
 class ArrowCallback(PlotCallback):
     """
-    annotate_arrow(pos, length=0.03, width=0.003, head_length=None, 
-                   head_width=0.02, starting_pos=None, 
+    annotate_arrow(pos, length=0.03, width=0.003, head_length=None,
+                   head_width=0.02, starting_pos=None,
                    coord_system='data', plot_args=None):
 
     Overplot an arrow pointing at a position for highlighting a specific
     feature.  Arrow points from lower left to the designated position with
-    arrow length "length" unless starting_pos is set to specify tail location 
+    arrow length "length" unless starting_pos is set to specify tail location
     of arrow.
 
     Parameters
@@ -978,7 +978,7 @@
 
     """
     _type_name = "arrow"
-    def __init__(self, pos, code_size=None, length=0.03, width=0.0001, 
+    def __init__(self, pos, code_size=None, length=0.03, width=0.0001,
                  head_width=0.01, head_length=0.01,
                  starting_pos=None, coord_system='data', plot_args=None):
         def_plot_args = {'color':'white'}
@@ -1030,10 +1030,10 @@
             warnings.warn("The arrow has zero length.  Not annotating.")
             return
         plot._axes.hold(True)
-        plot._axes.arrow(x-dx, y-dy, dx, dy, width=self.width, 
-                         head_width=self.head_width, 
-                         head_length=self.head_length, 
-                         transform=self.transform, 
+        plot._axes.arrow(x-dx, y-dy, dx, dy, width=self.width,
+                         head_width=self.head_width,
+                         head_length=self.head_length,
+                         transform=self.transform,
                          length_includes_head=True, **self.plot_args)
         plot._axes.set_xlim(xx0,xx1)
         plot._axes.set_ylim(yy0,yy1)
@@ -1796,8 +1796,8 @@
     axis length.  Additional customization of the scale bar is possible by
     adjusting the text_args and size_bar_args dictionaries.  The text_args
     dictionary accepts matplotlib's font_properties arguments to override
-    the default font_properties for the current plot.  The size_bar_args 
-    dictionary accepts keyword arguments for the AnchoredSizeBar class in 
+    the default font_properties for the current plot.  The size_bar_args
+    dictionary accepts keyword arguments for the AnchoredSizeBar class in
     matplotlib's axes_grid toolkit.
 
     Parameters
@@ -1877,7 +1877,7 @@
     _type_name = "scale"
     def __init__(self, corner='lower_right', coeff=None, unit=None, pos=None,
                  max_frac=0.16, min_frac=0.015, coord_system='axis',
-                 text_args=None, size_bar_args=None, draw_inset_box=False, 
+                 text_args=None, size_bar_args=None, draw_inset_box=False,
                  inset_box_args=None):
 
         def_size_bar_args = {
@@ -1970,7 +1970,7 @@
         # FontProperties instances use set_<property>() setter functions
         for key, val in self.text_args.items():
             setter_func = "set_"+key
-            try: 
+            try:
                 getattr(fontproperties, setter_func)(val)
             except AttributeError:
                 raise AttributeError("Cannot set text_args keyword " \
@@ -2002,7 +2002,7 @@
     The ray can be either a YTOrthoRay, YTRay, or a LightRay object.
     annotate_ray() will properly account for periodic rays across the volume.
     If arrow is set to True, uses the MPL.pyplot.arrow function, otherwise
-    uses the MPL.pyplot.plot function to plot a normal line.  Adjust 
+    uses the MPL.pyplot.plot function to plot a normal line.  Adjust
     plot_args accordingly.
 
     Parameters
@@ -2016,8 +2016,8 @@
         the dataset currently displayed.
 
     arrow : boolean, optional
-        Whether or not to place an arrowhead on the front of the ray as it
-        traverses the box.
+        Whether or not to place an arrowhead on the front of the ray to denote
+        direction
         Default: False
 
     plot_args : dictionary, optional
@@ -2133,7 +2133,7 @@
             cb(plot)
         segment = segments[-1]
         if self.arrow:
-            cb = ArrowCallback(segment[1], starting_pos=segment[0], 
+            cb = ArrowCallback(segment[1], starting_pos=segment[0],
                                coord_system='data',
                                plot_args=self.plot_args)
         else:
@@ -2141,7 +2141,6 @@
                                coord_system='data',
                                plot_args=self.plot_args)
         cb(plot)
- 
         return plot
 
 class LineIntegralConvolutionCallback(PlotCallback):
@@ -2151,7 +2150,7 @@
                                        cmap='binary', alpha=0.8,
                                        const_alpha=False):
 
-    Add the line integral convolution to the plot for vector fields 
+    Add the line integral convolution to the plot for vector fields
     visualization. Two component of vector fields needed to be provided
     (i.e., velocity_x and velocity_y, magentic_field_x and magnetic_field_y).
 
@@ -2248,7 +2247,7 @@
         lic_data_clip = np.clip(lic_data,self.lim[0],self.lim[1])
 
         if self.const_alpha:
-            plot._axes.imshow(lic_data_clip, extent=extent, cmap=self.cmap, 
+            plot._axes.imshow(lic_data_clip, extent=extent, cmap=self.cmap,
                               alpha=self.alpha)
         else:
             lic_data_rgba = cm.ScalarMappable(norm=None, cmap=self.cmap).\


https://bitbucket.org/yt_analysis/yt/commits/52b7292e3caf/
Changeset:   52b7292e3caf
Branch:      yt
User:        chummels
Date:        2016-03-16 18:54:59+00:00
Summary:     Merging with tip.
Affected #:  457 files

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 .hgchurn
--- a/.hgchurn
+++ b/.hgchurn
@@ -22,4 +22,21 @@
 ngoldbau at ucsc.edu = goldbaum at ucolick.org
 biondo at wisc.edu = Biondo at wisc.edu
 samgeen at googlemail.com = samgeen at gmail.com
-fbogert = fbogert at ucsc.edu
\ No newline at end of file
+fbogert = fbogert at ucsc.edu
+bwoshea = oshea at msu.edu
+mornkr at slac.stanford.edu = me at jihoonkim.org
+kbarrow = kssbarrow at gatech.edu
+kssbarrow at gmail.com = kssbarrow at gatech.edu
+kassbarrow at gmail.com = kssbarrow at gatech.edu
+antoine.strugarek at cea.fr = strugarek at astro.umontreal.ca
+rosen at ucolick.org = alrosen at ucsc.edu
+jzuhone = jzuhone at gmail.com
+karraki at nmsu.edu = karraki at gmail.com
+hckr at eml.cc = astrohckr at gmail.com
+julian3 at illinois.edu = astrohckr at gmail.com
+cosmosquark = bthompson2090 at gmail.com
+chris.m.malone at lanl.gov = chris.m.malone at gmail.com
+jnaiman at ucolick.org = jnaiman
+migueld.deval = miguel at archlinux.net
+slevy at ncsa.illinois.edu = salevy at illinois.edu
+malzraa at gmail.com = kellerbw at mcmaster.ca
\ No newline at end of file

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 .hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -28,31 +28,34 @@
 yt/utilities/spatial/ckdtree.c
 yt/utilities/lib/alt_ray_tracers.c
 yt/utilities/lib/amr_kdtools.c
+yt/utilities/lib/basic_octree.c
 yt/utilities/lib/bitarray.c
-yt/utilities/lib/CICDeposit.c
-yt/utilities/lib/ContourFinding.c
-yt/utilities/lib/DepthFirstOctree.c
+yt/utilities/lib/bounding_volume_hierarchy.c
+yt/utilities/lib/contour_finding.c
+yt/utilities/lib/depth_first_octree.c
 yt/utilities/lib/element_mappings.c
-yt/utilities/lib/FixedInterpolator.c
 yt/utilities/lib/fortran_reader.c
 yt/utilities/lib/freetype_writer.c
 yt/utilities/lib/geometry_utils.c
 yt/utilities/lib/image_utilities.c
-yt/utilities/lib/Interpolators.c
+yt/utilities/lib/interpolators.c
 yt/utilities/lib/kdtree.c
 yt/utilities/lib/line_integral_convolution.c
+yt/utilities/lib/mesh_construction.cpp
+yt/utilities/lib/mesh_intersection.cpp
+yt/utilities/lib/mesh_samplers.cpp
+yt/utilities/lib/mesh_traversal.cpp
 yt/utilities/lib/mesh_utilities.c
 yt/utilities/lib/misc_utilities.c
-yt/utilities/lib/Octree.c
-yt/utilities/lib/GridTree.c
+yt/utilities/lib/particle_mesh_operations.c
 yt/utilities/lib/origami.c
+yt/utilities/lib/particle_mesh_operations.c
 yt/utilities/lib/pixelization_routines.c
 yt/utilities/lib/png_writer.c
-yt/utilities/lib/PointsInVolume.c
-yt/utilities/lib/QuadTree.c
-yt/utilities/lib/RayIntegrators.c
+yt/utilities/lib/points_in_volume.c
+yt/utilities/lib/quad_tree.c
+yt/utilities/lib/ray_integrators.c
 yt/utilities/lib/ragged_arrays.c
-yt/utilities/lib/VolumeIntegrator.c
 yt/utilities/lib/grid_traversal.c
 yt/utilities/lib/marching_cubes.c
 yt/utilities/lib/png_writer.h

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 CONTRIBUTING.rst
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -795,8 +795,8 @@
    rather than explicitly. Ex: ``super(SpecialGridSubclass, self).__init__()``
    rather than ``SpecialGrid.__init__()``.
  * Docstrings should describe input, output, behavior, and any state changes
-   that occur on an object.  See the file ``doc/docstring_example.txt`` for a
-   fiducial example of a docstring.
+   that occur on an object.  See :ref:`docstrings` below for a fiducial example
+   of a docstring.
  * Use only one top-level import per line. Unless there is a good reason not to,
    imports should happen at the top of the file, after the copyright blurb.
  * Never compare with ``True`` or ``False`` using ``==`` or ``!=``, always use
@@ -843,7 +843,7 @@
    be avoided, they must be explained, even if they are only to be passed on to
    a nested function.
 
-.. _docstrings
+.. _docstrings:
 
 Docstrings
 ----------

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 CREDITS
--- a/CREDITS
+++ b/CREDITS
@@ -4,20 +4,30 @@
                 Tom Abel (tabel at stanford.edu)
                 Gabriel Altay (gabriel.altay at gmail.com)
                 Kenza Arraki (karraki at gmail.com)
+                Kirk Barrow (kssbarrow at gatech.edu)
+                Ricarda Beckmann (Ricarda.Beckmann at astro.ox.ac.uk)
                 Elliott Biondo (biondo at wisc.edu)
                 Alex Bogert (fbogert at ucsc.edu)
+                André-Patrick Bubel (code at andre-bubel.de)
                 Pengfei Chen (madcpf at gmail.com)
                 David Collins (dcollins4096 at gmail.com)
                 Brian Crosby (crosby.bd at gmail.com)
                 Andrew Cunningham (ajcunn at gmail.com)
                 Miguel de Val-Borro (miguel.deval at gmail.com)
+                Bili Dong (qobilidop at gmail.com)
+                Nicholas Earl (nchlsearl at gmail.com)
                 Hilary Egan (hilaryye at gmail.com)
+                Daniel Fenn (df11c at my.fsu.edu)
                 John Forces (jforbes at ucolick.org)
+                Adam Ginsburg (keflavich at gmail.com)
                 Sam Geen (samgeen at gmail.com)
                 Nathan Goldbaum (goldbaum at ucolick.org)
+                William Gray (graywilliamj at gmail.com)
                 Markus Haider (markus.haider at uibk.ac.at)
                 Eric Hallman (hallman13 at gmail.com)
                 Cameron Hummels (chummels at gmail.com)
+                Anni Järvenpää (anni.jarvenpaa at gmail.com)
+                Allyson Julian (astrohckr at gmail.com)
                 Christian Karch (chiffre at posteo.de)
                 Ben W. Keller (kellerbw at mcmaster.ca)
                 Ji-hoon Kim (me at jihoonkim.org)
@@ -25,11 +35,15 @@
                 Kacper Kowalik (xarthisius.kk at gmail.com)
                 Mark Krumholz (mkrumhol at ucsc.edu)
                 Michael Kuhlen (mqk at astro.berkeley.edu)
+                Meagan Lang (langmm.astro at gmail.com)
+                Doris Lee (dorislee at berkeley.edu)
                 Eve Lee (elee at cita.utoronto.ca)
                 Sam Leitner (sam.leitner at gmail.com)
+                Stuart Levy (salevy at illinois.edu)
                 Yuan Li (yuan at astro.columbia.edu)
                 Chris Malone (chris.m.malone at gmail.com)
                 Josh Maloney (joshua.moloney at colorado.edu)
+                Jonah Miller (jonah.maxwell.miller at gmail.com)
                 Chris Moody (cemoody at ucsc.edu)
                 Stuart Mumford (stuart at mumford.me.uk)
                 Andrew Myers (atmyers at astro.berkeley.edu)
@@ -44,6 +58,7 @@
                 Mark Richardson (Mark.L.Richardson at asu.edu)
                 Thomas Robitaille (thomas.robitaille at gmail.com)
                 Anna Rosen (rosen at ucolick.org)
+                Chuck Rozhon (rozhon2 at illinois.edu)
                 Douglas Rudd (drudd at uchicago.edu)
                 Anthony Scopatz (scopatz at gmail.com)
                 Noel Scudder (noel.scudder at stonybrook.edu)
@@ -59,6 +74,7 @@
                 Ji Suoqing (jisuoqing at gmail.com)
                 Elizabeth Tasker (tasker at astro1.sci.hokudai.ac.jp)
                 Benjamin Thompson (bthompson2090 at gmail.com)
+                Robert Thompson (rthompsonj at gmail.com)
                 Stephanie Tonnesen (stonnes at gmail.com)
                 Matthew Turk (matthewturk at gmail.com)
                 Rich Wagner (rwagner at physics.ucsd.edu)

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 MANIFEST.in
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,4 +1,4 @@
-include README* CREDITS COPYING.txt CITATION requirements.txt optional-requirements.txt
+include README* CREDITS COPYING.txt CITATION requirements.txt optional-requirements.txt setupext.py
 include yt/visualization/mapserver/html/map_index.html
 include yt/visualization/mapserver/html/leaflet/*.css
 include yt/visualization/mapserver/html/leaflet/*.js

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 clean.sh
--- a/clean.sh
+++ b/clean.sh
@@ -1,4 +1,1 @@
-find . -name "*.so" -exec rm -v {} \;
-find . -name "*.pyc" -exec rm -v {} \;
-find . -name "__config__.py" -exec rm -v {} \;
-rm -rvf build dist
+hg --config extensions.purge= purge --all yt

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 doc/extensions/notebook_sphinxext.py
--- a/doc/extensions/notebook_sphinxext.py
+++ /dev/null
@@ -1,241 +0,0 @@
-import errno
-import os
-import shutil
-import string
-import re
-import tempfile
-import uuid
-from sphinx.util.compat import Directive
-from docutils import nodes
-from docutils.parsers.rst import directives
-from IPython.config import Config
-from IPython.nbconvert import html, python
-from IPython.nbformat import current as nbformat
-from runipy.notebook_runner import NotebookRunner, NotebookError
-
-class NotebookDirective(Directive):
-    """Insert an evaluated notebook into a document
-
-    This uses runipy and nbconvert to transform a path to an unevaluated notebook
-    into html suitable for embedding in a Sphinx document.
-    """
-    required_arguments = 1
-    optional_arguments = 1
-    option_spec = {'skip_exceptions': directives.flag}
-    final_argument_whitespace = True
-
-    def run(self): # check if there are spaces in the notebook name
-        nb_path = self.arguments[0]
-        if ' ' in nb_path: raise ValueError(
-            "Due to issues with docutils stripping spaces from links, white "
-            "space is not allowed in notebook filenames '{0}'".format(nb_path))
-        # check if raw html is supported
-        if not self.state.document.settings.raw_enabled:
-            raise self.warning('"%s" directive disabled.' % self.name)
-
-        cwd = os.getcwd()
-        tmpdir = tempfile.mkdtemp()
-        os.chdir(tmpdir)
-
-        # get path to notebook
-        nb_filename = self.arguments[0]
-        nb_basename = os.path.basename(nb_filename)
-        rst_file = self.state_machine.document.attributes['source']
-        rst_dir = os.path.abspath(os.path.dirname(rst_file))
-        nb_abs_path = os.path.abspath(os.path.join(rst_dir, nb_filename))
-
-        # Move files around.
-        rel_dir = os.path.relpath(rst_dir, setup.confdir)
-        dest_dir = os.path.join(setup.app.builder.outdir, rel_dir)
-        dest_path = os.path.join(dest_dir, nb_basename)
-
-        image_dir, image_rel_dir = make_image_dir(setup, rst_dir)
-
-        # Ensure desination build directory exists
-        thread_safe_mkdir(os.path.dirname(dest_path))
-
-        # Copy unevaluated notebook
-        shutil.copyfile(nb_abs_path, dest_path)
-
-        # Construct paths to versions getting copied over
-        dest_path_eval = string.replace(dest_path, '.ipynb', '_evaluated.ipynb')
-        dest_path_script = string.replace(dest_path, '.ipynb', '.py')
-        rel_path_eval = string.replace(nb_basename, '.ipynb', '_evaluated.ipynb')
-        rel_path_script = string.replace(nb_basename, '.ipynb', '.py')
-
-        # Create python script vesion
-        script_text = nb_to_python(nb_abs_path)
-        f = open(dest_path_script, 'w')
-        f.write(script_text.encode('utf8'))
-        f.close()
-
-        skip_exceptions = 'skip_exceptions' in self.options
-
-        ret = evaluate_notebook(
-            nb_abs_path, dest_path_eval, skip_exceptions=skip_exceptions)
-
-        try:
-            evaluated_text, resources = ret
-            evaluated_text = write_notebook_output(
-                resources, image_dir, image_rel_dir, evaluated_text)
-        except ValueError:
-            # This happens when a notebook raises an unhandled exception
-            evaluated_text = ret
-
-        # Create link to notebook and script files
-        link_rst = "(" + \
-                   formatted_link(nb_basename) + "; " + \
-                   formatted_link(rel_path_eval) + "; " + \
-                   formatted_link(rel_path_script) + \
-                   ")"
-
-        self.state_machine.insert_input([link_rst], rst_file)
-
-        # create notebook node
-        attributes = {'format': 'html', 'source': 'nb_path'}
-        nb_node = notebook_node('', evaluated_text, **attributes)
-        (nb_node.source, nb_node.line) = \
-            self.state_machine.get_source_and_line(self.lineno)
-
-        # add dependency
-        self.state.document.settings.record_dependencies.add(nb_abs_path)
-
-        # clean up
-        os.chdir(cwd)
-        shutil.rmtree(tmpdir, True)
-
-        return [nb_node]
-
-
-class notebook_node(nodes.raw):
-    pass
-
-def nb_to_python(nb_path):
-    """convert notebook to python script"""
-    exporter = python.PythonExporter()
-    output, resources = exporter.from_filename(nb_path)
-    return output
-
-def nb_to_html(nb_path):
-    """convert notebook to html"""
-    c = Config({'ExtractOutputPreprocessor':{'enabled':True}})
-
-    exporter = html.HTMLExporter(template_file='full', config=c)
-    notebook = nbformat.read(open(nb_path), 'json')
-    output, resources = exporter.from_notebook_node(notebook)
-    header = output.split('<head>', 1)[1].split('</head>',1)[0]
-    body = output.split('<body>', 1)[1].split('</body>',1)[0]
-
-    # http://imgur.com/eR9bMRH
-    header = header.replace('<style', '<style scoped="scoped"')
-    header = header.replace('body {\n  overflow: visible;\n  padding: 8px;\n}\n',
-                            '')
-    header = header.replace("code,pre{", "code{")
-
-    # Filter out styles that conflict with the sphinx theme.
-    filter_strings = [
-        'navbar',
-        'body{',
-        'alert{',
-        'uneditable-input{',
-        'collapse{',
-    ]
-
-    filter_strings.extend(['h%s{' % (i+1) for i in range(6)])
-
-    line_begin = [
-        'pre{',
-        'p{margin'
-    ]
-
-    filterfunc = lambda x: not any([s in x for s in filter_strings])
-    header_lines = filter(filterfunc, header.split('\n'))
-
-    filterfunc = lambda x: not any([x.startswith(s) for s in line_begin])
-    header_lines = filter(filterfunc, header_lines)
-
-    header = '\n'.join(header_lines)
-
-    # concatenate raw html lines
-    lines = ['<div class="ipynotebook">']
-    lines.append(header)
-    lines.append(body)
-    lines.append('</div>')
-    return '\n'.join(lines), resources
-
-def evaluate_notebook(nb_path, dest_path=None, skip_exceptions=False):
-    # Create evaluated version and save it to the dest path.
-    notebook = nbformat.read(open(nb_path), 'json')
-    nb_runner = NotebookRunner(notebook, pylab=False)
-    try:
-        nb_runner.run_notebook(skip_exceptions=skip_exceptions)
-    except NotebookError as e:
-        print('')
-        print(e)
-        # Return the traceback, filtering out ANSI color codes.
-        # http://stackoverflow.com/questions/13506033/filtering-out-ansi-escape-sequences
-        return "Notebook conversion failed with the " \
-               "following traceback: \n%s" % \
-            re.sub(r'\\033[\[\]]([0-9]{1,2}([;@][0-9]{0,2})*)*[mKP]?', '',
-                   str(e))
-
-    if dest_path is None:
-        dest_path = 'temp_evaluated.ipynb'
-    nbformat.write(nb_runner.nb, open(dest_path, 'w'), 'json')
-    ret = nb_to_html(dest_path)
-    if dest_path is 'temp_evaluated.ipynb':
-        os.remove(dest_path)
-    return ret
-
-def formatted_link(path):
-    return "`%s <%s>`__" % (os.path.basename(path), path)
-
-def visit_notebook_node(self, node):
-    self.visit_raw(node)
-
-def depart_notebook_node(self, node):
-    self.depart_raw(node)
-
-def setup(app):
-    setup.app = app
-    setup.config = app.config
-    setup.confdir = app.confdir
-
-    app.add_node(notebook_node,
-                 html=(visit_notebook_node, depart_notebook_node))
-
-    app.add_directive('notebook', NotebookDirective)
-
-    retdict = dict(
-        version='0.1',
-        parallel_read_safe=True,
-        parallel_write_safe=True
-    )
-
-    return retdict
-
-def make_image_dir(setup, rst_dir):
-    image_dir = setup.app.builder.outdir + os.path.sep + '_images'
-    rel_dir = os.path.relpath(setup.confdir, rst_dir)
-    image_rel_dir = rel_dir + os.path.sep + '_images'
-    thread_safe_mkdir(image_dir)
-    return image_dir, image_rel_dir
-
-def write_notebook_output(resources, image_dir, image_rel_dir, evaluated_text):
-    my_uuid = uuid.uuid4().hex
-
-    for output in resources['outputs']:
-        new_name = image_dir + os.path.sep + my_uuid + output
-        new_relative_name = image_rel_dir + os.path.sep + my_uuid + output
-        evaluated_text = evaluated_text.replace(output, new_relative_name)
-        with open(new_name, 'wb') as f:
-            f.write(resources['outputs'][output])
-    return evaluated_text
-
-def thread_safe_mkdir(dirname):
-    try:
-        os.makedirs(dirname)
-    except OSError as e:
-        if e.errno != errno.EEXIST:
-            raise
-        pass

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 doc/extensions/notebookcell_sphinxext.py
--- a/doc/extensions/notebookcell_sphinxext.py
+++ /dev/null
@@ -1,87 +0,0 @@
-import os
-import shutil
-import io
-import tempfile
-from sphinx.util.compat import Directive
-from docutils.parsers.rst import directives
-from IPython.nbformat import current
-from notebook_sphinxext import \
-    notebook_node, visit_notebook_node, depart_notebook_node, \
-    evaluate_notebook, make_image_dir, write_notebook_output
-
-
-class NotebookCellDirective(Directive):
-    """Insert an evaluated notebook cell into a document
-
-    This uses runipy and nbconvert to transform an inline python
-    script into html suitable for embedding in a Sphinx document.
-    """
-    required_arguments = 0
-    optional_arguments = 1
-    has_content = True
-    option_spec = {'skip_exceptions': directives.flag}
-
-    def run(self):
-        # check if raw html is supported
-        if not self.state.document.settings.raw_enabled:
-            raise self.warning('"%s" directive disabled.' % self.name)
-
-        cwd = os.getcwd()
-        tmpdir = tempfile.mkdtemp()
-        os.chdir(tmpdir)
-
-        rst_file = self.state_machine.document.attributes['source']
-        rst_dir = os.path.abspath(os.path.dirname(rst_file))
-
-        image_dir, image_rel_dir = make_image_dir(setup, rst_dir)
-
-        # Construct notebook from cell content
-        content = "\n".join(self.content)
-        with open("temp.py", "w") as f:
-            f.write(content)
-
-        convert_to_ipynb('temp.py', 'temp.ipynb')
-
-        skip_exceptions = 'skip_exceptions' in self.options
-
-        evaluated_text, resources = evaluate_notebook(
-            'temp.ipynb', skip_exceptions=skip_exceptions)
-
-        evaluated_text = write_notebook_output(
-            resources, image_dir, image_rel_dir, evaluated_text)
-
-        # create notebook node
-        attributes = {'format': 'html', 'source': 'nb_path'}
-        nb_node = notebook_node('', evaluated_text, **attributes)
-        (nb_node.source, nb_node.line) = \
-            self.state_machine.get_source_and_line(self.lineno)
-
-        # clean up
-        os.chdir(cwd)
-        shutil.rmtree(tmpdir, True)
-
-        return [nb_node]
-
-def setup(app):
-    setup.app = app
-    setup.config = app.config
-    setup.confdir = app.confdir
-
-    app.add_node(notebook_node,
-                 html=(visit_notebook_node, depart_notebook_node))
-
-    app.add_directive('notebook-cell', NotebookCellDirective)
-
-    retdict = dict(
-        version='0.1',
-        parallel_read_safe=True,
-        parallel_write_safe=True
-    )
-
-    return retdict
-
-def convert_to_ipynb(py_file, ipynb_file):
-    with io.open(py_file, 'r', encoding='utf-8') as f:
-        notebook = current.reads(f.read(), format='py')
-    with io.open(ipynb_file, 'w', encoding='utf-8') as f:
-        current.write(notebook, f, format='ipynb')

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 doc/extensions/numpydocmod/__init__.py
--- a/doc/extensions/numpydocmod/__init__.py
+++ /dev/null
@@ -1,1 +0,0 @@
-from numpydoc import setup

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 doc/extensions/numpydocmod/comment_eater.py
--- a/doc/extensions/numpydocmod/comment_eater.py
+++ /dev/null
@@ -1,158 +0,0 @@
-from cStringIO import StringIO
-import compiler
-import inspect
-import textwrap
-import tokenize
-
-from compiler_unparse import unparse
-
-
-class Comment(object):
-    """ A comment block.
-    """
-    is_comment = True
-    def __init__(self, start_lineno, end_lineno, text):
-        # int : The first line number in the block. 1-indexed.
-        self.start_lineno = start_lineno
-        # int : The last line number. Inclusive!
-        self.end_lineno = end_lineno
-        # str : The text block including '#' character but not any leading spaces.
-        self.text = text
-
-    def add(self, string, start, end, line):
-        """ Add a new comment line.
-        """
-        self.start_lineno = min(self.start_lineno, start[0])
-        self.end_lineno = max(self.end_lineno, end[0])
-        self.text += string
-
-    def __repr__(self):
-        return '%s(%r, %r, %r)' % (self.__class__.__name__, self.start_lineno,
-            self.end_lineno, self.text)
-
-
-class NonComment(object):
-    """ A non-comment block of code.
-    """
-    is_comment = False
-    def __init__(self, start_lineno, end_lineno):
-        self.start_lineno = start_lineno
-        self.end_lineno = end_lineno
-
-    def add(self, string, start, end, line):
-        """ Add lines to the block.
-        """
-        if string.strip():
-            # Only add if not entirely whitespace.
-            self.start_lineno = min(self.start_lineno, start[0])
-            self.end_lineno = max(self.end_lineno, end[0])
-
-    def __repr__(self):
-        return '%s(%r, %r)' % (self.__class__.__name__, self.start_lineno,
-            self.end_lineno)
-
-
-class CommentBlocker(object):
-    """ Pull out contiguous comment blocks.
-    """
-    def __init__(self):
-        # Start with a dummy.
-        self.current_block = NonComment(0, 0)
-
-        # All of the blocks seen so far.
-        self.blocks = []
-
-        # The index mapping lines of code to their associated comment blocks.
-        self.index = {}
-
-    def process_file(self, file):
-        """ Process a file object.
-        """
-        for token in tokenize.generate_tokens(file.next):
-            self.process_token(*token)
-        self.make_index()
-
-    def process_token(self, kind, string, start, end, line):
-        """ Process a single token.
-        """
-        if self.current_block.is_comment:
-            if kind == tokenize.COMMENT:
-                self.current_block.add(string, start, end, line)
-            else:
-                self.new_noncomment(start[0], end[0])
-        else:
-            if kind == tokenize.COMMENT:
-                self.new_comment(string, start, end, line)
-            else:
-                self.current_block.add(string, start, end, line)
-
-    def new_noncomment(self, start_lineno, end_lineno):
-        """ We are transitioning from a noncomment to a comment.
-        """
-        block = NonComment(start_lineno, end_lineno)
-        self.blocks.append(block)
-        self.current_block = block
-
-    def new_comment(self, string, start, end, line):
-        """ Possibly add a new comment.
-        
-        Only adds a new comment if this comment is the only thing on the line.
-        Otherwise, it extends the noncomment block.
-        """
-        prefix = line[:start[1]]
-        if prefix.strip():
-            # Oops! Trailing comment, not a comment block.
-            self.current_block.add(string, start, end, line)
-        else:
-            # A comment block.
-            block = Comment(start[0], end[0], string)
-            self.blocks.append(block)
-            self.current_block = block
-
-    def make_index(self):
-        """ Make the index mapping lines of actual code to their associated
-        prefix comments.
-        """
-        for prev, block in zip(self.blocks[:-1], self.blocks[1:]):
-            if not block.is_comment:
-                self.index[block.start_lineno] = prev
-
-    def search_for_comment(self, lineno, default=None):
-        """ Find the comment block just before the given line number.
-
-        Returns None (or the specified default) if there is no such block.
-        """
-        if not self.index:
-            self.make_index()
-        block = self.index.get(lineno, None)
-        text = getattr(block, 'text', default)
-        return text
-
-
-def strip_comment_marker(text):
-    """ Strip # markers at the front of a block of comment text.
-    """
-    lines = []
-    for line in text.splitlines():
-        lines.append(line.lstrip('#'))
-    text = textwrap.dedent('\n'.join(lines))
-    return text
-
-
-def get_class_traits(klass):
-    """ Yield all of the documentation for trait definitions on a class object.
-    """
-    # FIXME: gracefully handle errors here or in the caller?
-    source = inspect.getsource(klass)
-    cb = CommentBlocker()
-    cb.process_file(StringIO(source))
-    mod_ast = compiler.parse(source)
-    class_ast = mod_ast.node.nodes[0]
-    for node in class_ast.code.nodes:
-        # FIXME: handle other kinds of assignments?
-        if isinstance(node, compiler.ast.Assign):
-            name = node.nodes[0].name
-            rhs = unparse(node.expr).strip()
-            doc = strip_comment_marker(cb.search_for_comment(node.lineno, default=''))
-            yield name, rhs, doc
-

diff -r 7574d2271d1f4e16bf4fda604f1cf41680377051 -r 52b7292e3caf231d622322be093b39bc35029222 doc/extensions/numpydocmod/compiler_unparse.py
--- a/doc/extensions/numpydocmod/compiler_unparse.py
+++ /dev/null
@@ -1,860 +0,0 @@
-""" Turn compiler.ast structures back into executable python code.
-
-    The unparse method takes a compiler.ast tree and transforms it back into
-    valid python code.  It is incomplete and currently only works for
-    import statements, function calls, function definitions, assignments, and
-    basic expressions.
-
-    Inspired by python-2.5-svn/Demo/parser/unparse.py
-
-    fixme: We may want to move to using _ast trees because the compiler for
-           them is about 6 times faster than compiler.compile.
-"""
-
-import sys
-import cStringIO
-from compiler.ast import Const, Name, Tuple, Div, Mul, Sub, Add
-
-def unparse(ast, single_line_functions=False):
-    s = cStringIO.StringIO()
-    UnparseCompilerAst(ast, s, single_line_functions)
-    return s.getvalue().lstrip()
-
-op_precedence = { 'compiler.ast.Power':3, 'compiler.ast.Mul':2, 'compiler.ast.Div':2,
-                  'compiler.ast.Add':1, 'compiler.ast.Sub':1 }
-
-class UnparseCompilerAst:
-    """ Methods in this class recursively traverse an AST and
-        output source code for the abstract syntax; original formatting
-        is disregarged.
-    """
-
-    #########################################################################
-    # object interface.
-    #########################################################################
-
-    def __init__(self, tree, file = sys.stdout, single_line_functions=False):
-        """ Unparser(tree, file=sys.stdout) -> None.
-
-            Print the source for tree to file.
-        """
-        self.f = file
-        self._single_func = single_line_functions
-        self._do_indent = True
-        self._indent = 0
-        self._dispatch(tree)
-        self._write("\n")
-        self.f.flush()
-
-    #########################################################################
-    # Unparser private interface.
-    #########################################################################
-
-    ### format, output, and dispatch methods ################################
-
-    def _fill(self, text = ""):
-        "Indent a piece of text, according to the current indentation level"
-        if self._do_indent:
-            self._write("\n"+"    "*self._indent + text)
-        else:
-            self._write(text)
-
-    def _write(self, text):
-        "Append a piece of text to the current line."
-        self.f.write(text)
-
-    def _enter(self):
-        "Print ':', and increase the indentation."
-        self._write(": ")
-        self._indent += 1
-
-    def _leave(self):
-        "Decrease the indentation level."
-        self._indent -= 1
-
-    def _dispatch(self, tree):
-        "_dispatcher function, _dispatching tree type T to method _T."
-        if isinstance(tree, list):
-            for t in tree:
-                self._dispatch(t)
-            return
-        meth = getattr(self, "_"+tree.__class__.__name__)
-        if tree.__class__.__name__ == 'NoneType' and not self._do_indent:
-            return
-        meth(tree)
-
-
-    #########################################################################
-    # compiler.ast unparsing methods.
-    #
-    # There should be one method per concrete grammar type. They are
-    # organized in alphabetical order.
-    #########################################################################
-
-    def _Add(self, t):
-        self.__binary_op(t, '+')
-
-    def _And(self, t):
-        self._write(" (")
-        for i, node in enumerate(t.nodes):
-            self._dispatch(node)
-            if i != len(t.nodes)-1:
-                self._write(") and (")
-        self._write(")")
-               
-    def _AssAttr(self, t):
-        """ Handle assigning an attribute of an object
-        """
-        self._dispatch(t.expr)
-        self._write('.'+t.attrname)
- 
-    def _Assign(self, t):
-        """ Expression Assignment such as "a = 1".
-
-            This only handles assignment in expressions.  Keyword assignment
-            is handled separately.
-        """
-        self._fill()
-        for target in t.nodes:
-            self._dispatch(target)
-            self._write(" = ")
-        self._dispatch(t.expr)
-        if not self._do_indent:
-            self._write('; ')
-
-    def _AssName(self, t):
-        """ Name on left hand side of expression.
-
-            Treat just like a name on the right side of an expression.
-        """
-        self._Name(t)
-
-    def _AssTuple(self, t):
-        """ Tuple on left hand side of an expression.
-        """
-
-        # _write each elements, separated by a comma.
-        for element in t.nodes[:-1]:
-            self._dispatch(element)
-            self._write(", ")
-
-        # Handle the last one without writing comma
-        last_element = t.nodes[-1]
-        self._dispatch(last_element)
-
-    def _AugAssign(self, t):
-        """ +=,-=,*=,/=,**=, etc. operations
-        """
-        
-        self._fill()
-        self._dispatch(t.node)
-        self._write(' '+t.op+' ')
-        self._dispatch(t.expr)
-        if not self._do_indent:
-            self._write(';')
-            
-    def _Bitand(self, t):
-        """ Bit and operation.
-        """
-        
-        for i, node in enumerate(t.nodes):
-            self._write("(")
-            self._dispatch(node)
-            self._write(")")
-            if i != len(t.nodes)-1:
-                self._write(" & ")
-                
-    def _Bitor(self, t):
-        """ Bit or operation
-        """
-        
-        for i, node in enumerate(t.nodes):
-            self._write("(")
-            self._dispatch(node)
-            self._write(")")
-            if i != len(t.nodes)-1:
-                self._write(" | ")
-                
-    def _CallFunc(self, t):
-        """ Function call.
-        """
-        self._dispatch(t.node)
-        self._write("(")
-        comma = False
-        for e in t.args:
-            if comma: self._write(", ")
-            else: comma = True
-            self._dispatch(e)
-        if t.star_args:
-            if comma: self._write(", ")
-            else: comma = True
-            self._write("*")
-            self._dispatch(t.star_args)
-        if t.dstar_args:
-            if comma: self._write(", ")
-            else: comma = True
-            self._write("**")
-            self._dispatch(t.dstar_args)
-        self._write(")")
-
-    def _Compare(self, t):
-        self._dispatch(t.expr)
-        for op, expr in t.ops:
-            self._write(" " + op + " ")
-            self._dispatch(expr)
-
-    def _Const(self, t):
-        """ A constant value such as an integer value, 3, or a string, "hello".
-        """
-        self._dispatch(t.value)
-
-    def _Decorators(self, t):
-        """ Handle function decorators (eg. @has_units)
-        """
-        for node in t.nodes:
-            self._dispatch(node)
-
-    def _Dict(self, t):
-        self._write("{")
-        for  i, (k, v) in enumerate(t.items):
-            self._dispatch(k)
-            self._write(": ")
-            self._dispatch(v)
-            if i < len(t.items)-1:
-                self._write(", ")
-        self._write("}")
-
-    def _Discard(self, t):
-        """ Node for when return value is ignored such as in "foo(a)".
-        """
-        self._fill()
-        self._dispatch(t.expr)
-
-    def _Div(self, t):
-        self.__binary_op(t, '/')
-
-    def _Ellipsis(self, t):
-        self._write("...")
-
-    def _From(self, t):
-        """ Handle "from xyz import foo, bar as baz".
-        """
-        # fixme: Are From and ImportFrom handled differently?
-        self._fill("from ")
-        self._write(t.modname)
-        self._write(" import ")
-        for i, (name,asname) in enumerate(t.names):
-            if i != 0:
-                self._write(", ")
-            self._write(name)
-            if asname is not None:
-                self._write(" as "+asname)
-                
-    def _Function(self, t):
-        """ Handle function definitions
-        """
-        if t.decorators is not None:
-            self._fill("@")
-            self._dispatch(t.decorators)
-        self._fill("def "+t.name + "(")
-        defaults = [None] * (len(t.argnames) - len(t.defaults)) + list(t.defaults)
-        for i, arg in enumerate(zip(t.argnames, defaults)):
-            self._write(arg[0])
-            if arg[1] is not None:
-                self._write('=')
-                self._dispatch(arg[1])
-            if i < len(t.argnames)-1:
-                self._write(', ')
-        self._write(")")
-        if self._single_func:
-            self._do_indent = False
-        self._enter()
-        self._dispatch(t.code)
-        self._leave()
-        self._do_indent = True
-
-    def _Getattr(self, t):
-        """ Handle getting an attribute of an object
-        """
-        if isinstance(t.expr, (Div, Mul, Sub, Add)):
-            self._write('(')
-            self._dispatch(t.expr)
-            self._write(')')
-        else:
-            self._dispatch(t.expr)
-            
-        self._write('.'+t.attrname)
-        
-    def _If(self, t):
-        self._fill()
-        
-        for i, (compare,code) in enumerate(t.tests):
-            if i == 0:
-                self._write("if ")
-            else:
-                self._write("elif ")
-            self._dispatch(compare)
-            self._enter()
-            self._fill()
-            self._dispatch(code)
-            self._leave()
-            self._write("\n")
-
-        if t.else_ is not None:
-            self._write("else")
-            self._enter()
-            self._fill()
-            self._dispatch(t.else_)
-            self._leave()
-            self._write("\n")
-            
-    def _IfExp(self, t):
-        self._dispatch(t.then)
-        self._write(" if ")
-        self._dispatch(t.test)
-
-        if t.else_ is not None:
-            self._write(" else (")
-            self._dispatch(t.else_)
-            self._write(")")
-
-    def _Import(self, t):
-        """ Handle "import xyz.foo".
-        """
-        self._fill("import ")
-        
-        for i, (name,asname) in enumerate(t.names):
-            if i != 0:
-                self._write(", ")
-            self._write(name)
-            if asname is not None:
-                self._write(" as "+asname)
-
-    def _Keyword(self, t):
-        """ Keyword value assignment within function calls and definitions.
-        """
-        self._write(t.name)
-        self._write("=")
-        self._dispatch(t.expr)
-        
-    def _List(self, t):
-        self._write("[")
-        for  i,node in enumerate(t.nodes):
-            self._dispatch(node)
-            if i < len(t.nodes)-1:
-                self._write(", ")
-        self._write("]")
-
-    def _Module(self, t):
-        if t.doc is not None:
-            self._dispatch(t.doc)
-        self._dispatch(t.node)
-
-    def _Mul(self, t):
-        self.__binary_op(t, '*')
-
-    def _Name(self, t):
-        self._write(t.name)
-
-    def _NoneType(self, t):
-        self._write("None")
-        
-    def _Not(self, t):
-        self._write('not (')
-        self._dispatch(t.expr)
-        self._write(')')
-        
-    def _Or(self, t):
-        self._write(" (")
-        for i, node in enumerate(t.nodes):
-            self._dispatch(node)
-            if i != len(t.nodes)-1:
-                self._write(") or (")
-        self._write(")")
-                
-    def _Pass(self, t):
-        self._write("pass\n")
-
-    def _Printnl(self, t):
-        self._fill("print ")
-        if t.dest:
-            self._write(">> ")
-            self._dispatch(t.dest)
-            self._write(", ")
-        comma = False
-        for node in t.nodes:
-            if comma: self._write(', ')
-            else: comma = True
-            self._dispatch(node)
-
-    def _Power(self, t):
-        self.__binary_op(t, '**')
-
-    def _Return(self, t):
-        self._fill("return ")
-        if t.value:
-            if isinstance(t.value, Tuple):
-                text = ', '.join([ name.name for name in t.value.asList() ])
-                self._write(text)
-            else:
-                self._dispatch(t.value)
-            if not self._do_indent:
-                self._write('; ')
-
-    def _Slice(self, t):
-        self._dispatch(t.expr)
-        self._write("[")
-        if t.lower:
-            self._dispatch(t.lower)
-        self._write(":")
-        if t.upper:
-            self._dispatch(t.upper)
-        #if t.step:
-        #    self._write(":")
-        #    self._dispatch(t.step)
-        self._write("]")
-
-    def _Sliceobj(self, t):
-        for i, node in enumerate(t.nodes):
-            if i != 0:
-                self._write(":")
-            if not (isinstance(node, Const) and node.value is None):
-                self._dispatch(node)
-
-    def _Stmt(self, tree):
-        for node in tree.nodes:
-            self._dispatch(node)
-
-    def _Sub(self, t):
-        self.__binary_op(t, '-')
-
-    def _Subscript(self, t):
-        self._dispatch(t.expr)
-        self._write("[")
-        for i, value in enumerate(t.subs):
-            if i != 0:
-                self._write(",")
-            self._dispatch(value)
-        self._write("]")
-
-    def _TryExcept(self, t):
-        self._fill("try")
-        self._enter()
-        self._dispatch(t.body)
-        self._leave()
-
-        for handler in t.handlers:
-            self._fill('except ')
-            self._dispatch(handler[0])
-            if handler[1] is not None:
-                self._write(', ')
-                self._dispatch(handler[1])
-            self._enter()
-            self._dispatch(handler[2])
-            self._leave()
-            
-        if t.else_:
-            self._fill("else")
-            self._enter()
-            self._dispatch(t.else_)
-            self._leave()
-
-    def _Tuple(self, t):
-
-        if not t.nodes:
-            # Empty tuple.
-            self._write("()")
-        else:
-            self._write("(")
-
-            # _write each elements, separated by a comma.
-            for element in t.nodes[:-1]:
-                self._dispatch(element)
-                self._write(", ")
-
-            # Handle the last one without writing comma
-            last_element = t.nodes[-1]
-            self._dispatch(last_element)
-
-            self._write(")")
-            
-    def _UnaryAdd(self, t):
-        self._write("+")
-        self._dispatch(t.expr)
-        
-    def _UnarySub(self, t):
-        self._write("-")
-        self._dispatch(t.expr)        
-
-    def _With(self, t):
-        self._fill('with ')
-        self._dispatch(t.expr)
-        if t.vars:
-            self._write(' as ')
-            self._dispatch(t.vars.name)
-        self._enter()
-        self._dispatch(t.body)
-        self._leave()
-        self._write('\n')
-        
-    def _int(self, t):
-        self._write(repr(t))
-
-    def __binary_op(self, t, symbol):
-        # Check if parenthesis are needed on left side and then dispatch
-        has_paren = False
-        left_class = str(t.left.__class__)
-        if (left_class in op_precedence.keys() and
-            op_precedence[left_class] < op_precedence[str(t.__class__)]):
-            has_paren = True
-        if has_paren:
-            self._write('(')
-        self._dispatch(t.left)
-        if has_paren:
-            self._write(')')
-        # Write the appropriate symbol for operator
-        self._write(symbol)
-        # Check if parenthesis are needed on the right side and then dispatch
-        has_paren = False
-        right_class = str(t.right.__class__)
-        if (right_class in op_precedence.keys() and
-            op_precedence[right_class] < op_precedence[str(t.__class__)]):
-            has_paren = True
-        if has_paren:
-            self._write('(')
-        self._dispatch(t.right)
-        if has_paren:
-            self._write(')')
-
-    def _float(self, t):
-        # if t is 0.1, str(t)->'0.1' while repr(t)->'0.1000000000001'
-        # We prefer str here.
-        self._write(str(t))
-
-    def _str(self, t):
-        self._write(repr(t))
-        
-    def _tuple(self, t):
-        self._write(str(t))
-
-    #########################################################################
-    # These are the methods from the _ast modules unparse.
-    #
-    # As our needs to handle more advanced code increase, we may want to
-    # modify some of the methods below so that they work for compiler.ast.
-    #########################################################################
-
-#    # stmt
-#    def _Expr(self, tree):
-#        self._fill()
-#        self._dispatch(tree.value)
-#
-#    def _Import(self, t):
-#        self._fill("import ")
-#        first = True
-#        for a in t.names:
-#            if first:
-#                first = False
-#            else:
-#                self._write(", ")
-#            self._write(a.name)
-#            if a.asname:
-#                self._write(" as "+a.asname)
-#
-##    def _ImportFrom(self, t):
-##        self._fill("from ")
-##        self._write(t.module)
-##        self._write(" import ")
-##        for i, a in enumerate(t.names):
-##            if i == 0:
-##                self._write(", ")
-##            self._write(a.name)
-##            if a.asname:
-##                self._write(" as "+a.asname)
-##        # XXX(jpe) what is level for?
-##
-#
-#    def _Break(self, t):
-#        self._fill("break")
-#
-#    def _Continue(self, t):
-#        self._fill("continue")
-#
-#    def _Delete(self, t):
-#        self._fill("del ")
-#        self._dispatch(t.targets)
-#
-#    def _Assert(self, t):
-#        self._fill("assert ")
-#        self._dispatch(t.test)
-#        if t.msg:
-#            self._write(", ")
-#            self._dispatch(t.msg)
-#
-#    def _Exec(self, t):
-#        self._fill("exec ")
-#        self._dispatch(t.body)
-#        if t.globals:
-#            self._write(" in ")
-#            self._dispatch(t.globals)
-#        if t.locals:
-#            self._write(", ")
-#            self._dispatch(t.locals)
-#
-#    def _Print(self, t):
-#        self._fill("print ")
-#        do_comma = False
-#        if t.dest:
-#            self._write(">>")
-#            self._dispatch(t.dest)
-#            do_comma = True
-#        for e in t.values:
-#            if do_comma:self._write(", ")
-#            else:do_comma=True
-#            self._dispatch(e)
-#        if not t.nl:
-#            self._write(",")
-#
-#    def _Global(self, t):
-#        self._fill("global")
-#        for i, n in enumerate(t.names):
-#            if i != 0:
-#                self._write(",")
-#            self._write(" " + n)
-#
-#    def _Yield(self, t):
-#        self._fill("yield")
-#        if t.value:
-#            self._write(" (")
-#            self._dispatch(t.value)
-#            self._write(")")
-#
-#    def _Raise(self, t):
-#        self._fill('raise ')
-#        if t.type:
-#            self._dispatch(t.type)
-#        if t.inst:
-#            self._write(", ")
-#            self._dispatch(t.inst)
-#        if t.tback:
-#            self._write(", ")
-#            self._dispatch(t.tback)
-#
-#
-#    def _TryFinally(self, t):
-#        self._fill("try")
-#        self._enter()
-#        self._dispatch(t.body)
-#        self._leave()
-#
-#        self._fill("finally")
-#        self._enter()
-#        self._dispatch(t.finalbody)
-#        self._leave()
-#
-#    def _excepthandler(self, t):
-#        self._fill("except ")
-#        if t.type:
-#            self._dispatch(t.type)
-#        if t.name:
-#            self._write(", ")
-#            self._dispatch(t.name)
-#        self._enter()
-#        self._dispatch(t.body)
-#        self._leave()
-#
-#    def _ClassDef(self, t):
-#        self._write("\n")
-#        self._fill("class "+t.name)
-#        if t.bases:
-#            self._write("(")
-#            for a in t.bases:
-#                self._dispatch(a)
-#                self._write(", ")
-#            self._write(")")
-#        self._enter()
-#        self._dispatch(t.body)
-#        self._leave()
-#
-#    def _FunctionDef(self, t):
-#        self._write("\n")
-#        for deco in t.decorators:
-#            self._fill("@")
-#            self._dispatch(deco)
-#        self._fill("def "+t.name + "(")
-#        self._dispatch(t.args)
-#        self._write(")")
-#        self._enter()
-#        self._dispatch(t.body)
-#        self._leave()
-#
-#    def _For(self, t):
-#        self._fill("for ")
-#        self._dispatch(t.target)
-#        self._write(" in ")
-#        self._dispatch(t.iter)
-#        self._enter()
-#        self._dispatch(t.body)
-#        self._leave()
-#        if t.orelse:
-#            self._fill("else")
-#            self._enter()
-#            self._dispatch(t.orelse)
-#            self._leave
-#
-#    def _While(self, t):
-#        self._fill("while ")
-#        self._dispatch(t.test)
-#        self._enter()
-#        self._dispatch(t.body)
-#        self._leave()
-#        if t.orelse:
-#            self._fill("else")
-#            self._enter()
-#            self._dispatch(t.orelse)
-#            self._leave
-#
-#    # expr
-#    def _Str(self, tree):
-#        self._write(repr(tree.s))
-##
-#    def _Repr(self, t):
-#        self._write("`")
-#        self._dispatch(t.value)
-#        self._write("`")
-#
-#    def _Num(self, t):
-#        self._write(repr(t.n))
-#
-#    def _ListComp(self, t):
-#        self._write("[")
-#        self._dispatch(t.elt)
-#        for gen in t.generators:
-#            self._dispatch(gen)
-#        self._write("]")
-#
-#    def _GeneratorExp(self, t):
-#        self._write("(")
-#        self._dispatch(t.elt)
-#        for gen in t.generators:
-#            self._dispatch(gen)
-#        self._write(")")
-#
-#    def _comprehension(self, t):
-#        self._write(" for ")
-#        self._dispatch(t.target)
-#        self._write(" in ")
-#        self._dispatch(t.iter)
-#        for if_clause in t.ifs:
-#            self._write(" if ")
-#            self._dispatch(if_clause)
-#
-#    def _IfExp(self, t):
-#        self._dispatch(t.body)
-#        self._write(" if ")
-#        self._dispatch(t.test)
-#        if t.orelse:
-#            self._write(" else ")
-#            self._dispatch(t.orelse)
-#
-#    unop = {"Invert":"~", "Not": "not", "UAdd":"+", "USub":"-"}
-#    def _UnaryOp(self, t):
-#        self._write(self.unop[t.op.__class__.__name__])
-#        self._write("(")
-#        self._dispatch(t.operand)
-#        self._write(")")
-#
-#    binop = { "Add":"+", "Sub":"-", "Mult":"*", "Div":"/", "Mod":"%",
-#                    "LShift":">>", "RShift":"<<", "BitOr":"|", "BitXor":"^", "BitAnd":"&",
-#                    "FloorDiv":"//", "Pow": "**"}
-#    def _BinOp(self, t):
-#        self._write("(")
-#        self._dispatch(t.left)
-#        self._write(")" + self.binop[t.op.__class__.__name__] + "(")
-#        self._dispatch(t.right)
-#        self._write(")")
-#
-#    boolops = {_ast.And: 'and', _ast.Or: 'or'}
-#    def _BoolOp(self, t):
-#        self._write("(")
-#        self._dispatch(t.values[0])
-#        for v in t.values[1:]:
-#            self._write(" %s " % self.boolops[t.op.__class__])
-#            self._dispatch(v)
-#        self._write(")")
-#
-#    def _Attribute(self,t):
-#        self._dispatch(t.value)
-#        self._write(".")
-#        self._write(t.attr)
-#
-##    def _Call(self, t):
-##        self._dispatch(t.func)
-##        self._write("(")
-##        comma = False
-##        for e in t.args:
-##            if comma: self._write(", ")
-##            else: comma = True
-##            self._dispatch(e)
-##        for e in t.keywords:
-##            if comma: self._write(", ")
-##            else: comma = True
-##            self._dispatch(e)
-##        if t.starargs:
-##            if comma: self._write(", ")
-##            else: comma = True
-##            self._write("*")
-##            self._dispatch(t.starargs)
-##        if t.kwargs:
-##            if comma: self._write(", ")
-##            else: comma = True
-##            self._write("**")
-##            self._dispatch(t.kwargs)
-##        self._write(")")
-#
-#    # slice
-#    def _Index(self, t):
-#        self._dispatch(t.value)
-#
-#    def _ExtSlice(self, t):
-#        for i, d in enumerate(t.dims):
-#            if i != 0:
-#                self._write(': ')
-#            self._dispatch(d)
-#
-#    # others
-#    def _arguments(self, t):
-#        first = True
-#        nonDef = len(t.args)-len(t.defaults)
-#        for a in t.args[0:nonDef]:
-#            if first:first = False
-#            else: self._write(", ")
-#            self._dispatch(a)
-#        for a,d in zip(t.args[nonDef:], t.defaults):
-#            if first:first = False
-#            else: self._write(", ")
-#            self._dispatch(a),
-#            self._write("=")
-#            self._dispatch(d)
-#        if t.vararg:
-#            if first:first = False
-#            else: self._write(", ")
-#            self._write("*"+t.vararg)
-#        if t.kwarg:
-#            if first:first = False
-#            else: self._write(", ")
-#            self._write("**"+t.kwarg)
-#
-##    def _keyword(self, t):
-##        self._write(t.arg)
-##        self._write("=")
-##        self._dispatch(t.value)
-#
-#    def _Lambda(self, t):
-#        self._write("lambda ")
-#        self._dispatch(t.args)
-#        self._write(": ")
-#        self._dispatch(t.body)
-
-
-

This diff is so big that we needed to truncate the remainder.

https://bitbucket.org/yt_analysis/yt/commits/8919b2de7e36/
Changeset:   8919b2de7e36
Branch:      yt
User:        chummels
Date:        2016-03-16 19:11:39+00:00
Summary:     Clarifying documentation on annotate_arrow callback.
Affected #:  1 file

diff -r 52b7292e3caf231d622322be093b39bc35029222 -r 8919b2de7e36e1a39879cf2a6d42276273073272 yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -913,9 +913,16 @@
                    coord_system='data', plot_args=None):
 
     Overplot an arrow pointing at a position for highlighting a specific
-    feature.  Arrow points from lower left to the designated position with
-    arrow length "length" unless starting_pos is set to specify tail location
-    of arrow.
+    feature.  By default, wrrow points from lower left to the designated 
+    position with arrow length "length" unless starting_pos is set to specify 
+    tail location of arrow.
+
+    coord_system keyword refers to positions set in pos arg and starting_pos
+    keyword, which by default are in data coordinates.
+
+    length, width, head_length, and head_width keywords for the arrow are all 
+    in axis units, ie relative to the size of the plot axes as 1, even if
+    the position of the arrow is set relative to another coordinate system.
 
     Parameters
     ----------


https://bitbucket.org/yt_analysis/yt/commits/7730a2abd258/
Changeset:   7730a2abd258
Branch:      yt
User:        chummels
Date:        2016-03-16 19:12:57+00:00
Summary:     Correcting typo in docstrings for annotate_arrow()
Affected #:  1 file

diff -r 8919b2de7e36e1a39879cf2a6d42276273073272 -r 7730a2abd2588614480cf3e881d814b7e739e17b yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -913,7 +913,7 @@
                    coord_system='data', plot_args=None):
 
     Overplot an arrow pointing at a position for highlighting a specific
-    feature.  By default, wrrow points from lower left to the designated 
+    feature.  By default, arrow points from lower left to the designated 
     position with arrow length "length" unless starting_pos is set to specify 
     tail location of arrow.
 


https://bitbucket.org/yt_analysis/yt/commits/4dfcc6bdf74a/
Changeset:   4dfcc6bdf74a
Branch:      yt
User:        chummels
Date:        2016-03-16 19:31:52+00:00
Summary:     Clarifying docstrings for annotate_arrow
Affected #:  1 file

diff -r 7730a2abd2588614480cf3e881d814b7e739e17b -r 4dfcc6bdf74a117625634ced4f64bd52b74c2f2e yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -913,16 +913,18 @@
                    coord_system='data', plot_args=None):
 
     Overplot an arrow pointing at a position for highlighting a specific
-    feature.  By default, arrow points from lower left to the designated 
-    position with arrow length "length" unless starting_pos is set to specify 
-    tail location of arrow.
+    feature.  By default, arrow points from lower left to the designated
+    position "pos" with arrow length "length".  Alternatively, if
+    "starting_pos" is set, arrow will stretch from "starting_pos" to "pos"
+    and "length" will be disregarded.
 
-    coord_system keyword refers to positions set in pos arg and starting_pos
-    keyword, which by default are in data coordinates.
+    "coord_system" keyword refers to positions set in "pos" arg and
+    "starting_pos" keyword, which by default are in data coordinates.
 
-    length, width, head_length, and head_width keywords for the arrow are all 
-    in axis units, ie relative to the size of the plot axes as 1, even if
-    the position of the arrow is set relative to another coordinate system.
+    "length", "width", "head_length", and "head_width" keywords for the arrow
+    are all in axis units, ie relative to the size of the plot axes as 1,
+    even if the position of the arrow is set relative to another coordinate
+    system.
 
     Parameters
     ----------
@@ -1028,8 +1030,8 @@
             dx = dy = self.code_size
         else:
             if self.starting_pos is not None:
-                start_x,start_y = self.sanitize_coord_system(plot, \
-                                       self.starting_pos, \
+                start_x,start_y = self.sanitize_coord_system(plot,
+                                       self.starting_pos,
                                        coord_system=self.coord_system)
                 dx = x - start_x
                 dy = y - start_y


https://bitbucket.org/yt_analysis/yt/commits/bba384360818/
Changeset:   bba384360818
Branch:      yt
User:        brittonsmith
Date:        2016-03-28 08:42:09+00:00
Summary:     Merged in chummels/yt (pull request #2043)

Enhancing annotate_ray and annotate_arrow callbacks
Affected #:  1 file

diff -r be993079427c300e09b4b6430e3c8d90af0c3500 -r bba3843608189ecf29b8ad109ae02546bbd272af yt/visualization/plot_modifications.py
--- a/yt/visualization/plot_modifications.py
+++ b/yt/visualization/plot_modifications.py
@@ -158,6 +158,9 @@
                                   "need to be in 3D")
             coord = self.project_coords(plot, coord)
             coord = self.convert_to_plot(plot, coord)
+            # Convert coordinates from a tuple of ndarray to a tuple of floats
+            # since not all callbacks are OK with ndarrays as coords (eg arrow)
+            coord = (coord[0][0], coord[1][0])
         # if in plot coords, define the transform correctly
         if coord_system == "data" or coord_system == "plot":
             self.transform = plot._axes.transData
@@ -905,11 +908,23 @@
 
 class ArrowCallback(PlotCallback):
     """
-    annotate_arrow(pos, length=0.03, coord_system='data', plot_args=None):
+    annotate_arrow(pos, length=0.03, width=0.003, head_length=None,
+                   head_width=0.02, starting_pos=None,
+                   coord_system='data', plot_args=None):
 
     Overplot an arrow pointing at a position for highlighting a specific
-    feature.  Arrow points from lower left to the designated position with
-    arrow length "length".
+    feature.  By default, arrow points from lower left to the designated
+    position "pos" with arrow length "length".  Alternatively, if
+    "starting_pos" is set, arrow will stretch from "starting_pos" to "pos"
+    and "length" will be disregarded.
+
+    "coord_system" keyword refers to positions set in "pos" arg and
+    "starting_pos" keyword, which by default are in data coordinates.
+
+    "length", "width", "head_length", and "head_width" keywords for the arrow
+    are all in axis units, ie relative to the size of the plot axes as 1,
+    even if the position of the arrow is set relative to another coordinate
+    system.
 
     Parameters
     ----------
@@ -918,6 +933,24 @@
 
     length : float, optional
         The length, in axis units, of the arrow.
+        Default: 0.03
+
+    width : float, optional
+        The width, in axis units, of the tail line of the arrow.
+        Default: 0.003
+
+    head_length : float, optional
+        The length, in axis units, of the head of the arrow.  If set
+        to None, use 1.5*head_width
+        Default: None
+
+    head_width : float, optional
+        The width, in axis units, of the head of the arrow.
+        Default: 0.02
+
+    starting_pos : 2- or 3-element tuple, list, or array, optional
+        These are the coordinates from which the arrow starts towards its
+        point.  Not compatible with 'length' kwarg.
 
     coord_system : string, optional
         This string defines the coordinate system of the coordinates of pos
@@ -935,7 +968,7 @@
 
     plot_args : dictionary, optional
         This dictionary is passed to the MPL arrow function for generating
-        the arrow.  By default, it is: {'color':'white', 'linewidth':2}
+        the arrow.  By default, it is: {'color':'white'}
 
     Examples
     --------
@@ -952,18 +985,23 @@
     >>> import yt
     >>> ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
     >>> s = yt.SlicePlot(ds, 'z', 'density')
-    >>> s.annotate_arrow([0.1, -0.1, length=0.06, coord_system='plot',
+    >>> s.annotate_arrow([0.1, -0.1], length=0.06, coord_system='plot',
     ...                  plot_args={'color':'red'})
     >>> s.save()
 
     """
     _type_name = "arrow"
-    def __init__(self, pos, code_size=None, length=0.03, coord_system='data',
-                 plot_args=None):
-        def_plot_args = {'color':'white', 'linewidth':2}
+    def __init__(self, pos, code_size=None, length=0.03, width=0.0001,
+                 head_width=0.01, head_length=0.01,
+                 starting_pos=None, coord_system='data', plot_args=None):
+        def_plot_args = {'color':'white'}
         self.pos = pos
         self.code_size = code_size
         self.length = length
+        self.width = width
+        self.head_width = head_width
+        self.head_length = head_length
+        self.starting_pos = starting_pos
         self.coord_system = coord_system
         self.transform = None
         if plot_args is None: plot_args = def_plot_args
@@ -974,7 +1012,13 @@
                                coord_system=self.coord_system)
         xx0, xx1 = plot._axes.get_xlim()
         yy0, yy1 = plot._axes.get_ylim()
-
+        # normalize all of the kwarg lengths to the plot size
+        plot_diag = ((yy1-yy0)**2 + (xx1-xx0)**2)**(0.5)
+        self.length *= plot_diag
+        self.width *= plot_diag
+        self.head_width *= plot_diag
+        if self.head_length is not None:
+            self.head_length *= plot_diag
         if self.code_size is not None:
             warnings.warn("The code_size keyword is deprecated.  Please use "
                           "the length keyword in 'axis' units instead. "
@@ -985,13 +1029,25 @@
             self.code_size = self.code_size * self.pixel_scale(plot)[0]
             dx = dy = self.code_size
         else:
-            dx = (xx1-xx0) * self.length
-            dy = (yy1-yy0) * self.length
+            if self.starting_pos is not None:
+                start_x,start_y = self.sanitize_coord_system(plot,
+                                       self.starting_pos,
+                                       coord_system=self.coord_system)
+                dx = x - start_x
+                dy = y - start_y
+            else:
+                dx = (xx1-xx0) * 2**(0.5) * self.length
+                dy = (yy1-yy0) * 2**(0.5) * self.length
+        # If the arrow is 0 length
+        if dx == dy == 0:
+            warnings.warn("The arrow has zero length.  Not annotating.")
+            return
         plot._axes.hold(True)
-        from matplotlib.patches import Arrow
-        arrow = Arrow(x-dx, y-dy, dx, dy, width=dx,
-                      transform=self.transform, **self.plot_args)
-        plot._axes.add_patch(arrow)
+        plot._axes.arrow(x-dx, y-dy, dx, dy, width=self.width,
+                         head_width=self.head_width,
+                         head_length=self.head_length,
+                         transform=self.transform,
+                         length_includes_head=True, **self.plot_args)
         plot._axes.set_xlim(xx0,xx1)
         plot._axes.set_ylim(yy0,yy1)
         plot._axes.hold(False)
@@ -1837,8 +1893,8 @@
     axis length.  Additional customization of the scale bar is possible by
     adjusting the text_args and size_bar_args dictionaries.  The text_args
     dictionary accepts matplotlib's font_properties arguments to override
-    the default font_properties for the current plot.  The size_bar_args 
-    dictionary accepts keyword arguments for the AnchoredSizeBar class in 
+    the default font_properties for the current plot.  The size_bar_args
+    dictionary accepts keyword arguments for the AnchoredSizeBar class in
     matplotlib's axes_grid toolkit.
 
     Parameters
@@ -1918,7 +1974,7 @@
     _type_name = "scale"
     def __init__(self, corner='lower_right', coeff=None, unit=None, pos=None,
                  max_frac=0.16, min_frac=0.015, coord_system='axis',
-                 text_args=None, size_bar_args=None, draw_inset_box=False, 
+                 text_args=None, size_bar_args=None, draw_inset_box=False,
                  inset_box_args=None):
 
         def_size_bar_args = {
@@ -2011,7 +2067,7 @@
         # FontProperties instances use set_<property>() setter functions
         for key, val in self.text_args.items():
             setter_func = "set_"+key
-            try: 
+            try:
                 getattr(fontproperties, setter_func)(val)
             except AttributeError:
                 raise AttributeError("Cannot set text_args keyword " \
@@ -2042,6 +2098,9 @@
     Adds a line representing the projected path of a ray across the plot.
     The ray can be either a YTOrthoRay, YTRay, or a LightRay object.
     annotate_ray() will properly account for periodic rays across the volume.
+    If arrow is set to True, uses the MPL.pyplot.arrow function, otherwise
+    uses the MPL.pyplot.plot function to plot a normal line.  Adjust
+    plot_args accordingly.
 
     Parameters
     ----------
@@ -2053,6 +2112,11 @@
         object, it will only plot the segment of the LightRay that intersects
         the dataset currently displayed.
 
+    arrow : boolean, optional
+        Whether or not to place an arrowhead on the front of the ray to denote
+        direction
+        Default: False
+
     plot_args : dictionary, optional
         A dictionary of any arbitrary parameters to be passed to the Matplotlib
         line object.  Defaults: {'color':'white', 'linewidth':2}.
@@ -2083,10 +2147,11 @@
 
     """
     _type_name = "ray"
-    def __init__(self, ray, plot_args=None):
+    def __init__(self, ray, arrow=False, plot_args=None):
         PlotCallback.__init__(self)
         def_plot_args = {'color':'white', 'linewidth':2}
         self.ray = ray
+        self.arrow = arrow
         if plot_args is None: plot_args = def_plot_args
         self.plot_args = plot_args
 
@@ -2156,12 +2221,23 @@
         else:
             segments = [[start_coord, end_coord]]
 
-        for segment in segments:
-            lcb = LinePlotCallback(segment[0], segment[1],
-                                   coord_system='data',
-                                   plot_args=self.plot_args)
-            lcb(plot)
-
+        # To assure that the last ray segment has an arrow if so desired
+        # and all other ray segments are lines
+        for segment in segments[:-1]:
+            cb = LinePlotCallback(segment[0], segment[1],
+                                  coord_system='data',
+                                  plot_args=self.plot_args)
+            cb(plot)
+        segment = segments[-1]
+        if self.arrow:
+            cb = ArrowCallback(segment[1], starting_pos=segment[0],
+                               coord_system='data',
+                               plot_args=self.plot_args)
+        else:
+           cb = LinePlotCallback(segment[0], segment[1],
+                               coord_system='data',
+                               plot_args=self.plot_args)
+        cb(plot)
         return plot
 
 class LineIntegralConvolutionCallback(PlotCallback):
@@ -2171,7 +2247,7 @@
                                        cmap='binary', alpha=0.8,
                                        const_alpha=False):
 
-    Add the line integral convolution to the plot for vector fields 
+    Add the line integral convolution to the plot for vector fields
     visualization. Two component of vector fields needed to be provided
     (i.e., velocity_x and velocity_y, magentic_field_x and magnetic_field_y).
 
@@ -2268,7 +2344,7 @@
         lic_data_clip = np.clip(lic_data,self.lim[0],self.lim[1])
 
         if self.const_alpha:
-            plot._axes.imshow(lic_data_clip, extent=extent, cmap=self.cmap, 
+            plot._axes.imshow(lic_data_clip, extent=extent, cmap=self.cmap,
                               alpha=self.alpha)
         else:
             lic_data_rgba = cm.ScalarMappable(norm=None, cmap=self.cmap).\

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160328/538d41f0/attachment-0001.htm>


More information about the yt-svn mailing list