[yt-svn] commit/yt-3.0: 6 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jul 3 05:15:21 PDT 2013


6 new commits in yt-3.0:

https://bitbucket.org/yt_analysis/yt-3.0/commits/ac4accea24c1/
Changeset:   ac4accea24c1
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-03 00:09:53
Summary:     Only plot requested fields.  Closes #529.
Affected #:  1 file

diff -r 8594e3c7ecb9f39175b2013eb0adb5bfda100aa3 -r ac4accea24c18de98bfce8e8529594dbc464d249 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -55,7 +55,7 @@
 from yt.config import ytcfg
 from yt.funcs import \
     mylog, defaultdict, iterable, ensure_list, \
-    fix_axis, get_image_suffix
+    ensure_tuple, fix_axis, get_image_suffix
 from yt.utilities.lib import write_png_to_string
 from yt.utilities.definitions import \
     x_dict, x_names, \
@@ -784,6 +784,7 @@
             self._frb_generator = kwargs.pop("frb_generator")
         if self._plot_type is None:
             self._plot_type = kwargs.pop("plot_type")
+        self.plot_fields = ensure_list(kwargs.pop("fields"))
         font_size = kwargs.pop("fontsize", 18)
         font_path = matplotlib.get_data_path() + '/fonts/ttf/STIXGeneral.ttf'
         self._font_properties = FontProperties(size=font_size, fname=font_path)
@@ -816,8 +817,9 @@
             return 0.0, 0.0
         else:
             mylog.warn("origin = {0}".format(origin))
-            msg = ('origin keyword "{0}" not recognized, must declare "domain" '
-                   'or "center" as the last term in origin.').format(self.origin)
+            msg = \
+              ('origin keyword "{0}" not recognized, must declare "domain" '
+               'or "center" as the last term in origin.').format(self.origin)
             raise RuntimeError(msg)
 
         if origin[0] == 'lower':
@@ -854,13 +856,21 @@
         else:
             fields = self._frb.keys()
         self._colorbar_valid = True
-        for f in self.fields:
+        for f in self.plot_fields:
+            if isinstance(f, tuple):
+                pass
+            else:
+                for ftup in self.fields:
+                    if isinstance(ftup, tuple):
+                        if f == ftup[1]:
+                             f = ftup
             axis_index = self.data_source.axis
 
             xc, yc = self._setup_origin()
 
             if self._axes_unit_names is None:
-                unit = get_smallest_appropriate_unit(self.xlim[1] - self.xlim[0], self.pf)
+                unit = get_smallest_appropriate_unit(
+                    self.xlim[1] - self.xlim[0], self.pf)
                 (unit_x, unit_y) = (unit, unit)
             else:
                 (unit_x, unit_y) = self._axes_unit_names
@@ -875,15 +885,18 @@
             else:
                 zlim = (None, None)
 
-            plot_aspect = (self.xlim[1] - self.xlim[0]) / (self.ylim[1] - self.ylim[0])
+            plot_aspect = \
+              (self.xlim[1] - self.xlim[0]) / (self.ylim[1] - self.ylim[0])
 
             # This sets the size of the figure, and defaults to making one of the dimensions smaller.
             # This should protect against giant images in the case of a very large aspect ratio.
             cbar_frac = 0.0
             if plot_aspect > 1.0:
-                size = (self.window_size*(1.+cbar_frac), self.window_size/plot_aspect)
+                size = (self.window_size*(1.+cbar_frac),
+                        self.window_size/plot_aspect)
             else:
-                size = (plot_aspect*self.window_size*(1.+cbar_frac), self.window_size)
+                size = (plot_aspect*self.window_size*(1.+cbar_frac),
+                        self.window_size)
 
             # Correct the aspect ratio in case unit_x and unit_y are different
             aspect = self.pf[unit_x]/self.pf[unit_y]
@@ -1244,7 +1257,7 @@
         slc = pf.h.slice(axis, center[axis],
             field_parameters = field_parameters, center=center)
         slc.get_data(fields)
-        PWViewerMPL.__init__(self, slc, bounds, origin=origin,
+        PWViewerMPL.__init__(self, slc, bounds, fields=fields, origin=origin,
                              fontsize=fontsize)
         self.set_axes_unit(axes_unit)
 
@@ -1363,8 +1376,9 @@
             axes_unit = units
         if field_parameters is None: field_parameters = {}
         proj = pf.h.proj(fields, axis, weight_field=weight_field,
-                         center=center, data_source=data_source, field_parameters = field_parameters)
-        PWViewerMPL.__init__(self,proj,bounds,origin=origin,
+                         center=center, data_source=data_source,
+                         field_parameters = field_parameters)
+        PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
                              fontsize=fontsize)
         self.set_axes_unit(axes_unit)
 
@@ -1426,8 +1440,9 @@
         cutting.get_data(fields)
         # Hard-coding the origin keyword since the other two options
         # aren't well-defined for off-axis data objects
-        PWViewerMPL.__init__(self,cutting,bounds,origin='center-window',periodic=False,oblique=True,
-                             fontsize=fontsize)
+        PWViewerMPL.__init__(self, cutting, bounds, fields=fields,
+                             origin='center-window',periodic=False,
+                             oblique=True, fontsize=fontsize)
         self.set_axes_unit(axes_unit)
 
 class OffAxisProjectionDummyDataSource(object):
@@ -1530,18 +1545,23 @@
                  depth=(1, '1'), axes_unit=None, weight_field=None,
                  max_level=None, north_vector=None, volume=None, no_ghost=False,
                  le=None, re=None, interpolated=False, fontsize=18):
-        (bounds, center_rot, units) = GetObliqueWindowParameters(normal,center,width,pf,depth=depth)
+        (bounds, center_rot, units) = \
+          GetObliqueWindowParameters(normal,center,width,pf,depth=depth)
         if axes_unit is None and units != ('1', '1', '1'):
             axes_unit = units[:2]
         fields = ensure_list(fields)[:]
-        width = np.array((bounds[1] - bounds[0], bounds[3] - bounds[2], bounds[5] - bounds[4]))
-        OffAxisProj = OffAxisProjectionDummyDataSource(center_rot, pf, normal, width, fields, interpolated,
-                                                       weight=weight_field,  volume=volume, no_ghost=no_ghost,
-                                                       le=le, re=re, north_vector=north_vector)
+        width = np.array((bounds[1] - bounds[0],
+                          bounds[3] - bounds[2],
+                          bounds[5] - bounds[4]))
+        OffAxisProj = OffAxisProjectionDummyDataSource(
+            center_rot, pf, normal, width, fields, interpolated,
+            weight=weight_field,  volume=volume, no_ghost=no_ghost,
+            le=le, re=re, north_vector=north_vector)
         # Hard-coding the origin keyword since the other two options
         # aren't well-defined for off-axis data objects
-        PWViewerMPL.__init__(self, OffAxisProj, bounds, origin='center-window', periodic=False,
-                             oblique=True, fontsize=fontsize)
+        PWViewerMPL.__init__(
+            self, OffAxisProj, bounds, fields=fields, origin='center-window',
+            periodic=False, oblique=True, fontsize=fontsize)
         self.set_axes_unit(axes_unit)
 
 _metadata_template = """


https://bitbucket.org/yt_analysis/yt-3.0/commits/1bee0402a19f/
Changeset:   1bee0402a19f
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-03 01:39:56
Summary:     Fixes for failing to_pw() tests.
Affected #:  2 files

diff -r ac4accea24c18de98bfce8e8529594dbc464d249 -r 1bee0402a19fd578a677a29b40e8df1ec632bb7a yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -603,14 +603,15 @@
     def _get_pw(self, fields, center, width, origin, axes_unit, plot_type):
         axis = self.axis
         self.fields = [k for k in self.field_data.keys()
-                       if k not in self._container_fields]
+                       if k not in self._key_fields]
         from yt.visualization.plot_window import \
             GetWindowParameters, PWViewerMPL
         from yt.visualization.fixed_resolution import FixedResolutionBuffer
         (bounds, center, units) = GetWindowParameters(axis, center, width, self.pf)
         if axes_unit is None and units != ('1', '1'):
             axes_unit = units
-        pw = PWViewerMPL(self, bounds, origin=origin, frb_generator=FixedResolutionBuffer, 
+        pw = PWViewerMPL(self, bounds, fields=list(self.fields), origin=origin,
+                         frb_generator=FixedResolutionBuffer,
                          plot_type=plot_type)
         pw.set_axes_unit(axes_unit)
         return pw

diff -r ac4accea24c18de98bfce8e8529594dbc464d249 -r 1bee0402a19fd578a677a29b40e8df1ec632bb7a yt/data_objects/selection_data_containers.py
--- a/yt/data_objects/selection_data_containers.py
+++ b/yt/data_objects/selection_data_containers.py
@@ -490,14 +490,21 @@
         """
         normal = self.normal
         center = self.center
+        self.fields = [k for k in self.field_data.keys()
+                       if k not in self._key_fields]
         from yt.visualization.plot_window import \
             GetObliqueWindowParameters, PWViewerMPL
-        from yt.visualization.fixed_resolution import ObliqueFixedResolutionBuffer
-        (bounds, center_rot, units) = GetObliqueWindowParameters(normal, center, width, self.pf)
+        from yt.visualization.fixed_resolution import \
+            ObliqueFixedResolutionBuffer
+        (bounds, center_rot, units) = \
+          GetObliqueWindowParameters(normal, center, width, self.pf)
         if axes_unit is None and units != ('1', '1'):
             axes_units = units
-        pw = PWViewerMPL(self, bounds, origin='center-window', periodic=False, oblique=True,
-                         frb_generator=ObliqueFixedResolutionBuffer, plot_type='OffAxisSlice')
+        pw = PWViewerMPL(
+            self, bounds, fields=self.fields, origin='center-window',
+            periodic=False, oblique=True,
+            frb_generator=ObliqueFixedResolutionBuffer,
+            plot_type='OffAxisSlice')
         pw.set_axes_unit(axes_unit)
         return pw
 


https://bitbucket.org/yt_analysis/yt-3.0/commits/c5ea3a0ce599/
Changeset:   c5ea3a0ce599
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-03 06:10:45
Summary:     Using determine fields to avoid unecessary tuple disentangling.
Affected #:  1 file

diff -r 1bee0402a19fd578a677a29b40e8df1ec632bb7a -r c5ea3a0ce599d3f1015106e41be734d8bf357a5a yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -856,14 +856,7 @@
         else:
             fields = self._frb.keys()
         self._colorbar_valid = True
-        for f in self.plot_fields:
-            if isinstance(f, tuple):
-                pass
-            else:
-                for ftup in self.fields:
-                    if isinstance(ftup, tuple):
-                        if f == ftup[1]:
-                             f = ftup
+        for f in self.data_source._determine_fields(self.plot_fields):
             axis_index = self.data_source.axis
 
             xc, yc = self._setup_origin()


https://bitbucket.org/yt_analysis/yt-3.0/commits/22f1ff74887f/
Changeset:   22f1ff74887f
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-03 06:11:21
Summary:     More whitespace fixes.  This whole file now fits inside an 80 character terminal.
Affected #:  1 file

diff -r c5ea3a0ce599d3f1015106e41be734d8bf357a5a -r 22f1ff74887f7070588c443b37b84fbd2c3ec03b yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -75,7 +75,8 @@
 # included in matplotlib (not in gentoo, yes in everything else)
 # Also accounting for the fact that in 1.2.0, pyparsing got renamed.
 try:
-    if version.LooseVersion(matplotlib.__version__) < version.LooseVersion("1.2.0"):
+    if version.LooseVersion(matplotlib.__version__) <
+        version.LooseVersion("1.2.0"):
         from matplotlib.pyparsing import ParseFatalException
     else:
         from matplotlib.pyparsing_py2 import ParseFatalException
@@ -197,7 +198,8 @@
         width = validate_iterable_width(width)
     else:
         try:
-            assert isinstance(width, Number), "width (%s) is invalid" % str(width)
+            assert isinstance(width, Number), \
+              "width (%s) is invalid" % str(width)
         except AssertionError, e:
             raise YTInvalidWidthError(e)
         width = ((width, '1'), (width, '1'))
@@ -208,7 +210,8 @@
             assert_valid_width_tuple(depth)
         else:
             try:
-                assert isinstance(depth, Number), "width (%s) is invalid" % str(depth)
+                assert isinstance(depth, Number), \
+                  "width (%s) is invalid" % str(depth)
             except AssertionError, e:
                 raise YTInvalidWidthError(e)
             depth = ((depth, '1'),)
@@ -270,7 +273,8 @@
 
     Parameters
     ----------
-    data_source : :class:`yt.data_objects.data_containers.AMRProjBase` or :class:`yt.data_objects.data_containers.AMRSliceBase`
+    data_source : :class:`yt.data_objects.data_containers.AMRProjBase` or
+                  :class:`yt.data_objects.data_containers.AMRSliceBase`
         This is the source to be pixelized, which can be a projection or a
         slice.  (For cutting planes, see
         `yt.visualization.fixed_resolution.ObliqueFixedResolutionBuffer`.)
@@ -294,7 +298,8 @@
     _vector_info = None
     _frb = None
     def __init__(self, data_source, bounds, buff_size=(800,800), antialias=True,
-                 periodic=True, origin='center-window', oblique=False, window_size=10.0):
+                 periodic=True, origin='center-window', oblique=False,
+                 window_size=10.0):
         if not hasattr(self, "pf"):
             self.pf = data_source.pf
             ts = self._initialize_dataset(self.pf)
@@ -311,7 +316,8 @@
         self.set_window(bounds) # this automatically updates the data and plot
         self.origin = origin
         if self.data_source.center is not None and oblique == False:
-            center = [self.data_source.center[i] for i in range(len(self.data_source.center))
+            center = [self.data_source.center[i] for i in
+                      range(len(self.data_source.center))
                       if i != self.data_source.axis]
             self.set_center(center)
         self._initfinished = True
@@ -461,9 +467,10 @@
 
         parameters
         ----------
-        width : float, array of floats, (float, unit) tuple, or tuple of (float, unit) tuples.
-             Width can have four different formats to support windows with variable
-             x and y widths.  They are:
+        width : float, array of floats, (float, unit) tuple, or tuple of
+                (float, unit) tuples.
+             Width can have four different formats to support windows with
+             variable x and y widths.  They are:
 
              ==================================     =======================
              format                                 example
@@ -474,13 +481,14 @@
              (float, float)                         (0.2, 0.3)
              ==================================     =======================
 
-             For example, (10, 'kpc') requests a plot window that is 10 kiloparsecs
-             wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a window
-             that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along
-             the y axis.  In the other two examples, code units are assumed, for example
-             (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3
-             in code units.  If units are provided the resulting plot axis labels will
-             use the supplied units.
+             For example, (10, 'kpc') requests a plot window that is 10
+             kiloparsecs wide in the x and y directions,
+             ((10,'kpc'),(15,'kpc')) requests a window that is 10 kiloparsecs
+             wide along the x axis and 15 kiloparsecs wide along the y axis.
+             In the other two examples, code units are assumed, for example
+             (0.2, 0.3) requests a plot that has an x width of 0.2 and a y
+             width of 0.3 in code units.  If units are provided the resulting
+             plot axis labels will use the supplied units.
         unit : str
              the unit the width has been specified in. If width is a tuple, this
              argument is ignored. Defaults to code units.
@@ -734,9 +742,9 @@
             image extents will be displayed in.  If set to None, any previous
             units will be reset.  If the unit is None, the default is chosen.
             If unit_name is '1', 'u', or 'unitary', it will not display the
-            units, and only show the axes name. If unit_name is a tuple, the first
-            element is assumed to be the unit for the x axis and the second element
-            the unit for the y axis.
+            units, and only show the axes name. If unit_name is a tuple, the
+            first element is assumed to be the unit for the x axis and the
+            second element the unit for the y axis.
 
         Raises
         ------
@@ -881,8 +889,9 @@
             plot_aspect = \
               (self.xlim[1] - self.xlim[0]) / (self.ylim[1] - self.ylim[0])
 
-            # This sets the size of the figure, and defaults to making one of the dimensions smaller.
-            # This should protect against giant images in the case of a very large aspect ratio.
+            # This sets the size of the figure, and defaults to making one of
+            # the dimensions smaller.  This should protect against giant images
+            # in the case of a very large aspect ratio.
             cbar_frac = 0.0
             if plot_aspect > 1.0:
                 size = (self.window_size*(1.+cbar_frac),
@@ -896,7 +905,8 @@
 
             image = self._frb[f]
 
-            if image.max() == image.min() and self._field_transform[f] == log_transform:
+            if image.max() == image.min():
+              if self._field_transform[f] == log_transform:
                 mylog.warning("Plot image for field %s has zero dynamic " \
                               "range. Min = Max = %d." % \
                               (f, image.max()))
@@ -984,8 +994,8 @@
         :py:class:`matplotlib.font_manager.FontProperties`.
 
         Possible keys include
-        * family - The font family. Can be serif, sans-serif, cursive, 'fantasy' or
-          'monospace'.
+        * family - The font family. Can be serif, sans-serif, cursive,
+          fantasy, monospace, or a specific font name.
         * style - The font style. Either normal, italic or oblique.
         * color - A valid color string like 'r', 'g', 'red', 'cobalt', and
           'orange'.
@@ -1134,8 +1144,8 @@
             raise YTNotInsideNotebook
 
     def display(self, name=None, mpl_kwargs=None):
-        """Will attempt to show the plot in in an IPython notebook.  Failing that, the 
-        plot will be saved to disk."""
+        """Will attempt to show the plot in in an IPython notebook.  Failing
+        that, the plot will be saved to disk."""
         try:
             return self.show()
         except YTNotInsideNotebook:
@@ -1161,7 +1171,8 @@
          or the axis name itself
     fields : string
          The name of the field(s) to be plotted.
-    center : two or three-element vector of sequence floats, 'c', or 'center', or 'max'
+    center : two or three-element vector of sequence floats, 'c', or 'center',
+             or 'max'
          The coordinate of the center of the image.  If left blank,
          the image centers on the location of the maximum density
          cell.  If set to 'c' or 'center', the plot is centered on
@@ -1181,12 +1192,12 @@
          ==================================     =======================
 
          For example, (10, 'kpc') requests a plot window that is 10 kiloparsecs
-         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a window
-         that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along
-         the y axis.  In the other two examples, code units are assumed, for example
-         (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3
-         in code units.  If units are provided the resulting plot axis labels will
-         use the supplied units.
+         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a
+         window that is 10 kiloparsecs wide along the x axis and 15
+         kiloparsecs wide along the y axis.  In the other two examples, code
+         units are assumed, for example (0.2, 0.3) requests a plot that has an
+         x width of 0.2 and a y width of 0.3 in code units.  If units are
+         provided the resulting plot axis labels will use the supplied units.
     axes_unit : A string
          The name of the unit for the tick labels on the x and y axes.
          Defaults to None, which automatically picks an appropriate unit.
@@ -1197,14 +1208,15 @@
          represented by '-' separated string or a tuple of strings.  In the
          first index the y-location is given by 'lower', 'upper', or 'center'.
          The second index is the x-location, given as 'left', 'right', or
-         'center'.  Finally, the whether the origin is applied in 'domain' space,
-         plot 'window' space or 'native' simulation coordinate system is given.
-         For example, both 'upper-right-domain' and ['upper', 'right', 'domain']
-         both place the origin in the upper right hand corner of domain space.
-         If x or y are not given, a value is inffered.  For instance, 'left-domain'
-         corresponds to the lower-left hand corner of the simulation domain,
-         'center-domain' corresponds to the center of the simulation domain,
-         or 'center-window' for the center of the plot window. Further examples:
+         'center'.  Finally, the whether the origin is applied in 'domain'
+         space, plot 'window' space or 'native' simulation coordinate system
+         is given. For example, both 'upper-right-domain' and ['upper',
+         'right', 'domain'] both place the origin in the upper right hand
+         corner of domain space. If x or y are not given, a value is inffered.
+         For instance, 'left-domain' corresponds to the lower-left hand corner
+         of the simulation domain, 'center-domain' corresponds to the center
+         of the simulation domain, or 'center-window' for the center of the
+         plot window. Further examples:
 
          ==================================     ============================
          format                                 example
@@ -1221,7 +1233,8 @@
     fontsize : integer
          The size of the fonts for the axis, colorbar, and tick labels.
     field_parameters : dictionary
-         A dictionary of field parameters than can be accessed by derived fields.
+         A dictionary of field parameters than can be accessed by derived
+         fields.
 
     Examples
     --------
@@ -1274,7 +1287,8 @@
          or the axis name itself
     fields : string
         The name of the field(s) to be plotted.
-    center : two or three-element vector of sequence floats, 'c', or 'center', or 'max'
+    center : two or three-element vector of sequence floats, 'c', or 'center',
+             or 'max'
          The coordinate of the center of the image.  If left blank,
          the image centers on the location of the maximum density
          cell.  If set to 'c' or 'center', the plot is centered on
@@ -1294,12 +1308,12 @@
          ==================================     =======================
 
          For example, (10, 'kpc') requests a plot window that is 10 kiloparsecs
-         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a window
-         that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along
-         the y axis.  In the other two examples, code units are assumed, for example
-         (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3
-         in code units.  If units are provided the resulting plot axis labels will
-         use the supplied units.
+         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a
+         window that is 10 kiloparsecs wide along the x axis and 15
+         kiloparsecs wide along the y axis.  In the other two examples, code
+         units are assumed, for example (0.2, 0.3) requests a plot that has an
+         x width of 0.2 and a y width of 0.3 in code units.  If units are
+         provided the resulting plot axis labels will use the supplied units.
     axes_unit : A string
          The name of the unit for the tick labels on the x and y axes.
          Defaults to None, which automatically picks an appropriate unit.
@@ -1310,14 +1324,15 @@
          represented by '-' separated string or a tuple of strings.  In the
          first index the y-location is given by 'lower', 'upper', or 'center'.
          The second index is the x-location, given as 'left', 'right', or
-         'center'.  Finally, the whether the origin is applied in 'domain' space,
-         plot 'window' space or 'native' simulation coordinate system is given.
-         For example, both 'upper-right-domain' and ['upper', 'right', 'domain']
-         both place the origin in the upper right hand corner of domain space.
-         If x or y are not given, a value is inffered.  For instance, 'left-domain'
-         corresponds to the lower-left hand corner of the simulation domain,
-         'center-domain' corresponds to the center of the simulation domain,
-         or 'center-window' for the center of the plot window. Further examples:
+         'center'.  Finally, the whether the origin is applied in 'domain'
+         space, plot 'window' space or 'native' simulation coordinate system
+         is given. For example, both 'upper-right-domain' and ['upper',
+         'right', 'domain'] both place the origin in the upper right hand
+         corner of domain space. If x or y are not given, a value is inffered.
+         For instance, 'left-domain' corresponds to the lower-left hand corner
+         of the simulation domain, 'center-domain' corresponds to the center
+         of the simulation domain, or 'center-window' for the center of the
+         plot window. Further examples:
 
          ==================================     ============================
          format                                 example
@@ -1333,8 +1348,8 @@
          ==================================     ============================
 
     data_source : AMR3DData Object
-         Object to be used for data selection.  Defaults to a region covering the
-         entire simulation.
+         Object to be used for data selection.  Defaults to a region covering
+         the entire simulation.
     weight_field : string
          The name of the weighting field.  Set to None for no weight.
     max_level: int
@@ -1342,7 +1357,8 @@
     fontsize : integer
          The size of the fonts for the axis, colorbar, and tick labels.
     field_parameters : dictionary
-         A dictionary of field parameters than can be accessed by derived fields.
+         A dictionary of field parameters than can be accessed by derived
+         fields.
 
     Examples
     --------
@@ -1358,8 +1374,8 @@
     _frb_generator = FixedResolutionBuffer
 
     def __init__(self, pf, axis, fields, center='c', width=None, axes_unit=None,
-                 weight_field=None, max_level=None, origin='center-window', fontsize=18, 
-                 field_parameters=None, data_source=None):
+                 weight_field=None, max_level=None, origin='center-window',
+                 fontsize=18, field_parameters=None, data_source=None):
         ts = self._initialize_dataset(pf)
         self.ts = ts
         pf = self.pf = ts[0]
@@ -1415,7 +1431,8 @@
     fontsize : integer
          The size of the fonts for the axis, colorbar, and tick labels.
     field_parameters : dictionary
-         A dictionary of field parameters than can be accessed by derived fields.
+         A dictionary of field parameters than can be accessed by derived
+         fields.
     """
 
     _plot_type = 'OffAxisSlice'
@@ -1424,7 +1441,8 @@
     def __init__(self, pf, normal, fields, center='c', width=None,
                  axes_unit=None, north_vector=None, fontsize=18,
                  field_parameters=None):
-        (bounds, center_rot, units) = GetObliqueWindowParameters(normal,center,width,pf)
+        (bounds, center_rot, units) = \
+          GetObliqueWindowParameters(normal,center,width,pf)
         if axes_unit is None and units != ('1', '1'):
             axes_unit = units
         if field_parameters is None: field_parameters = {}
@@ -1504,12 +1522,12 @@
          ==================================     =======================
 
          For example, (10, 'kpc') requests a plot window that is 10 kiloparsecs
-         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a window
-         that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along
-         the y axis.  In the other two examples, code units are assumed, for example
-         (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3
-         in code units.  If units are provided the resulting plot axis labels will
-         use the supplied units.
+         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a
+         window that is 10 kiloparsecs wide along the x axis and 15
+         kiloparsecs wide along the y axis.  In the other two examples, code
+         units are assumed, for example (0.2, 0.3) requests a plot that has an
+         x width of 0.2 and a y width of 0.3 in code units.  If units are
+         provided the resulting plot axis labels will use the supplied units.
     depth : A tuple or a float
         A tuple containing the depth to project thourhg and the string
         key of the unit: (width, 'unit').  If set to a float, code units
@@ -1797,13 +1815,15 @@
             self._field_transform[field] = linear_transform
 
 class WindowPlotMPL(ImagePlotMPL):
-    def __init__(self, data, cbname, cmap, extent, aspect, zlim, size, fontsize):
+    def __init__(self, data, cbname, cmap, extent, aspect, zlim, size,
+                 fontsize):
         fsize, axrect, caxrect = self._get_best_layout(size, fontsize)
         if np.any(np.array(axrect) < 0):
-            mylog.warning('The axis ratio of the requested plot is very narrow.  '
-                          'There is a good chance the plot will not look very good, '
-                          'consider making the plot manually using FixedResolutionBuffer '
-                          'and matplotlib.')
+            msg = 'The axis ratio of the requested plot is very narrow. ' \
+                  'There is a good chance the plot will not look very good, '
+                  'consider making the plot manually using '
+                  'FixedResolutionBuffer and matplotlib.')
+            mylog.warn(msg)
             axrect  = (0.07, 0.10, 0.80, 0.80)
             caxrect = (0.87, 0.10, 0.04, 0.80)
         ImagePlotMPL.__init__(self, fsize, axrect, caxrect, zlim)


https://bitbucket.org/yt_analysis/yt-3.0/commits/fa97d1a3cfe8/
Changeset:   fa97d1a3cfe8
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-03 06:48:41
Summary:     Fixing some syntax errors.
Affected #:  1 file

diff -r 22f1ff74887f7070588c443b37b84fbd2c3ec03b -r fa97d1a3cfe850c9a3367afb95c8a203ed226790 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -75,7 +75,7 @@
 # included in matplotlib (not in gentoo, yes in everything else)
 # Also accounting for the fact that in 1.2.0, pyparsing got renamed.
 try:
-    if version.LooseVersion(matplotlib.__version__) <
+    if version.LooseVersion(matplotlib.__version__) < \
         version.LooseVersion("1.2.0"):
         from matplotlib.pyparsing import ParseFatalException
     else:
@@ -1820,9 +1820,9 @@
         fsize, axrect, caxrect = self._get_best_layout(size, fontsize)
         if np.any(np.array(axrect) < 0):
             msg = 'The axis ratio of the requested plot is very narrow. ' \
-                  'There is a good chance the plot will not look very good, '
-                  'consider making the plot manually using '
-                  'FixedResolutionBuffer and matplotlib.')
+                  'There is a good chance the plot will not look very good, ' \
+                  'consider making the plot manually using ' \
+                  'FixedResolutionBuffer and matplotlib.'
             mylog.warn(msg)
             axrect  = (0.07, 0.10, 0.80, 0.80)
             caxrect = (0.87, 0.10, 0.04, 0.80)


https://bitbucket.org/yt_analysis/yt-3.0/commits/2edc94f8cf08/
Changeset:   2edc94f8cf08
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-07-03 14:15:14
Summary:     Merged in ngoldbaum/yt-3.0 (pull request #58)

Only plot requested fields.  Closes #529.
Affected #:  3 files

diff -r 2d1f7f07cce0c5d44e0092982a48027ad24c0114 -r 2edc94f8cf0819f4eaede36d7dc2dc0556982e04 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -603,14 +603,15 @@
     def _get_pw(self, fields, center, width, origin, axes_unit, plot_type):
         axis = self.axis
         self.fields = [k for k in self.field_data.keys()
-                       if k not in self._container_fields]
+                       if k not in self._key_fields]
         from yt.visualization.plot_window import \
             GetWindowParameters, PWViewerMPL
         from yt.visualization.fixed_resolution import FixedResolutionBuffer
         (bounds, center, units) = GetWindowParameters(axis, center, width, self.pf)
         if axes_unit is None and units != ('1', '1'):
             axes_unit = units
-        pw = PWViewerMPL(self, bounds, origin=origin, frb_generator=FixedResolutionBuffer, 
+        pw = PWViewerMPL(self, bounds, fields=list(self.fields), origin=origin,
+                         frb_generator=FixedResolutionBuffer,
                          plot_type=plot_type)
         pw.set_axes_unit(axes_unit)
         return pw

diff -r 2d1f7f07cce0c5d44e0092982a48027ad24c0114 -r 2edc94f8cf0819f4eaede36d7dc2dc0556982e04 yt/data_objects/selection_data_containers.py
--- a/yt/data_objects/selection_data_containers.py
+++ b/yt/data_objects/selection_data_containers.py
@@ -490,14 +490,21 @@
         """
         normal = self.normal
         center = self.center
+        self.fields = [k for k in self.field_data.keys()
+                       if k not in self._key_fields]
         from yt.visualization.plot_window import \
             GetObliqueWindowParameters, PWViewerMPL
-        from yt.visualization.fixed_resolution import ObliqueFixedResolutionBuffer
-        (bounds, center_rot, units) = GetObliqueWindowParameters(normal, center, width, self.pf)
+        from yt.visualization.fixed_resolution import \
+            ObliqueFixedResolutionBuffer
+        (bounds, center_rot, units) = \
+          GetObliqueWindowParameters(normal, center, width, self.pf)
         if axes_unit is None and units != ('1', '1'):
             axes_units = units
-        pw = PWViewerMPL(self, bounds, origin='center-window', periodic=False, oblique=True,
-                         frb_generator=ObliqueFixedResolutionBuffer, plot_type='OffAxisSlice')
+        pw = PWViewerMPL(
+            self, bounds, fields=self.fields, origin='center-window',
+            periodic=False, oblique=True,
+            frb_generator=ObliqueFixedResolutionBuffer,
+            plot_type='OffAxisSlice')
         pw.set_axes_unit(axes_unit)
         return pw
 

diff -r 2d1f7f07cce0c5d44e0092982a48027ad24c0114 -r 2edc94f8cf0819f4eaede36d7dc2dc0556982e04 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -55,7 +55,7 @@
 from yt.config import ytcfg
 from yt.funcs import \
     mylog, defaultdict, iterable, ensure_list, \
-    fix_axis, get_image_suffix
+    ensure_tuple, fix_axis, get_image_suffix
 from yt.utilities.lib import write_png_to_string
 from yt.utilities.definitions import \
     x_dict, x_names, \
@@ -75,7 +75,8 @@
 # included in matplotlib (not in gentoo, yes in everything else)
 # Also accounting for the fact that in 1.2.0, pyparsing got renamed.
 try:
-    if version.LooseVersion(matplotlib.__version__) < version.LooseVersion("1.2.0"):
+    if version.LooseVersion(matplotlib.__version__) < \
+        version.LooseVersion("1.2.0"):
         from matplotlib.pyparsing import ParseFatalException
     else:
         from matplotlib.pyparsing_py2 import ParseFatalException
@@ -197,7 +198,8 @@
         width = validate_iterable_width(width)
     else:
         try:
-            assert isinstance(width, Number), "width (%s) is invalid" % str(width)
+            assert isinstance(width, Number), \
+              "width (%s) is invalid" % str(width)
         except AssertionError, e:
             raise YTInvalidWidthError(e)
         width = ((width, '1'), (width, '1'))
@@ -208,7 +210,8 @@
             assert_valid_width_tuple(depth)
         else:
             try:
-                assert isinstance(depth, Number), "width (%s) is invalid" % str(depth)
+                assert isinstance(depth, Number), \
+                  "width (%s) is invalid" % str(depth)
             except AssertionError, e:
                 raise YTInvalidWidthError(e)
             depth = ((depth, '1'),)
@@ -270,7 +273,8 @@
 
     Parameters
     ----------
-    data_source : :class:`yt.data_objects.data_containers.AMRProjBase` or :class:`yt.data_objects.data_containers.AMRSliceBase`
+    data_source : :class:`yt.data_objects.data_containers.AMRProjBase` or
+                  :class:`yt.data_objects.data_containers.AMRSliceBase`
         This is the source to be pixelized, which can be a projection or a
         slice.  (For cutting planes, see
         `yt.visualization.fixed_resolution.ObliqueFixedResolutionBuffer`.)
@@ -294,7 +298,8 @@
     _vector_info = None
     _frb = None
     def __init__(self, data_source, bounds, buff_size=(800,800), antialias=True,
-                 periodic=True, origin='center-window', oblique=False, window_size=10.0):
+                 periodic=True, origin='center-window', oblique=False,
+                 window_size=10.0):
         if not hasattr(self, "pf"):
             self.pf = data_source.pf
             ts = self._initialize_dataset(self.pf)
@@ -311,7 +316,8 @@
         self.set_window(bounds) # this automatically updates the data and plot
         self.origin = origin
         if self.data_source.center is not None and oblique == False:
-            center = [self.data_source.center[i] for i in range(len(self.data_source.center))
+            center = [self.data_source.center[i] for i in
+                      range(len(self.data_source.center))
                       if i != self.data_source.axis]
             self.set_center(center)
         self._initfinished = True
@@ -461,9 +467,10 @@
 
         parameters
         ----------
-        width : float, array of floats, (float, unit) tuple, or tuple of (float, unit) tuples.
-             Width can have four different formats to support windows with variable
-             x and y widths.  They are:
+        width : float, array of floats, (float, unit) tuple, or tuple of
+                (float, unit) tuples.
+             Width can have four different formats to support windows with
+             variable x and y widths.  They are:
 
              ==================================     =======================
              format                                 example
@@ -474,13 +481,14 @@
              (float, float)                         (0.2, 0.3)
              ==================================     =======================
 
-             For example, (10, 'kpc') requests a plot window that is 10 kiloparsecs
-             wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a window
-             that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along
-             the y axis.  In the other two examples, code units are assumed, for example
-             (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3
-             in code units.  If units are provided the resulting plot axis labels will
-             use the supplied units.
+             For example, (10, 'kpc') requests a plot window that is 10
+             kiloparsecs wide in the x and y directions,
+             ((10,'kpc'),(15,'kpc')) requests a window that is 10 kiloparsecs
+             wide along the x axis and 15 kiloparsecs wide along the y axis.
+             In the other two examples, code units are assumed, for example
+             (0.2, 0.3) requests a plot that has an x width of 0.2 and a y
+             width of 0.3 in code units.  If units are provided the resulting
+             plot axis labels will use the supplied units.
         unit : str
              the unit the width has been specified in. If width is a tuple, this
              argument is ignored. Defaults to code units.
@@ -734,9 +742,9 @@
             image extents will be displayed in.  If set to None, any previous
             units will be reset.  If the unit is None, the default is chosen.
             If unit_name is '1', 'u', or 'unitary', it will not display the
-            units, and only show the axes name. If unit_name is a tuple, the first
-            element is assumed to be the unit for the x axis and the second element
-            the unit for the y axis.
+            units, and only show the axes name. If unit_name is a tuple, the
+            first element is assumed to be the unit for the x axis and the
+            second element the unit for the y axis.
 
         Raises
         ------
@@ -784,6 +792,7 @@
             self._frb_generator = kwargs.pop("frb_generator")
         if self._plot_type is None:
             self._plot_type = kwargs.pop("plot_type")
+        self.plot_fields = ensure_list(kwargs.pop("fields"))
         font_size = kwargs.pop("fontsize", 18)
         font_path = matplotlib.get_data_path() + '/fonts/ttf/STIXGeneral.ttf'
         self._font_properties = FontProperties(size=font_size, fname=font_path)
@@ -816,8 +825,9 @@
             return 0.0, 0.0
         else:
             mylog.warn("origin = {0}".format(origin))
-            msg = ('origin keyword "{0}" not recognized, must declare "domain" '
-                   'or "center" as the last term in origin.').format(self.origin)
+            msg = \
+              ('origin keyword "{0}" not recognized, must declare "domain" '
+               'or "center" as the last term in origin.').format(self.origin)
             raise RuntimeError(msg)
 
         if origin[0] == 'lower':
@@ -854,13 +864,14 @@
         else:
             fields = self._frb.keys()
         self._colorbar_valid = True
-        for f in self.fields:
+        for f in self.data_source._determine_fields(self.plot_fields):
             axis_index = self.data_source.axis
 
             xc, yc = self._setup_origin()
 
             if self._axes_unit_names is None:
-                unit = get_smallest_appropriate_unit(self.xlim[1] - self.xlim[0], self.pf)
+                unit = get_smallest_appropriate_unit(
+                    self.xlim[1] - self.xlim[0], self.pf)
                 (unit_x, unit_y) = (unit, unit)
             else:
                 (unit_x, unit_y) = self._axes_unit_names
@@ -875,22 +886,27 @@
             else:
                 zlim = (None, None)
 
-            plot_aspect = (self.xlim[1] - self.xlim[0]) / (self.ylim[1] - self.ylim[0])
+            plot_aspect = \
+              (self.xlim[1] - self.xlim[0]) / (self.ylim[1] - self.ylim[0])
 
-            # This sets the size of the figure, and defaults to making one of the dimensions smaller.
-            # This should protect against giant images in the case of a very large aspect ratio.
+            # This sets the size of the figure, and defaults to making one of
+            # the dimensions smaller.  This should protect against giant images
+            # in the case of a very large aspect ratio.
             cbar_frac = 0.0
             if plot_aspect > 1.0:
-                size = (self.window_size*(1.+cbar_frac), self.window_size/plot_aspect)
+                size = (self.window_size*(1.+cbar_frac),
+                        self.window_size/plot_aspect)
             else:
-                size = (plot_aspect*self.window_size*(1.+cbar_frac), self.window_size)
+                size = (plot_aspect*self.window_size*(1.+cbar_frac),
+                        self.window_size)
 
             # Correct the aspect ratio in case unit_x and unit_y are different
             aspect = self.pf[unit_x]/self.pf[unit_y]
 
             image = self._frb[f]
 
-            if image.max() == image.min() and self._field_transform[f] == log_transform:
+            if image.max() == image.min():
+              if self._field_transform[f] == log_transform:
                 mylog.warning("Plot image for field %s has zero dynamic " \
                               "range. Min = Max = %d." % \
                               (f, image.max()))
@@ -978,8 +994,8 @@
         :py:class:`matplotlib.font_manager.FontProperties`.
 
         Possible keys include
-        * family - The font family. Can be serif, sans-serif, cursive, 'fantasy' or
-          'monospace'.
+        * family - The font family. Can be serif, sans-serif, cursive,
+          fantasy, monospace, or a specific font name.
         * style - The font style. Either normal, italic or oblique.
         * color - A valid color string like 'r', 'g', 'red', 'cobalt', and
           'orange'.
@@ -1128,8 +1144,8 @@
             raise YTNotInsideNotebook
 
     def display(self, name=None, mpl_kwargs=None):
-        """Will attempt to show the plot in in an IPython notebook.  Failing that, the 
-        plot will be saved to disk."""
+        """Will attempt to show the plot in in an IPython notebook.  Failing
+        that, the plot will be saved to disk."""
         try:
             return self.show()
         except YTNotInsideNotebook:
@@ -1155,7 +1171,8 @@
          or the axis name itself
     fields : string
          The name of the field(s) to be plotted.
-    center : two or three-element vector of sequence floats, 'c', or 'center', or 'max'
+    center : two or three-element vector of sequence floats, 'c', or 'center',
+             or 'max'
          The coordinate of the center of the image.  If left blank,
          the image centers on the location of the maximum density
          cell.  If set to 'c' or 'center', the plot is centered on
@@ -1175,12 +1192,12 @@
          ==================================     =======================
 
          For example, (10, 'kpc') requests a plot window that is 10 kiloparsecs
-         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a window
-         that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along
-         the y axis.  In the other two examples, code units are assumed, for example
-         (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3
-         in code units.  If units are provided the resulting plot axis labels will
-         use the supplied units.
+         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a
+         window that is 10 kiloparsecs wide along the x axis and 15
+         kiloparsecs wide along the y axis.  In the other two examples, code
+         units are assumed, for example (0.2, 0.3) requests a plot that has an
+         x width of 0.2 and a y width of 0.3 in code units.  If units are
+         provided the resulting plot axis labels will use the supplied units.
     axes_unit : A string
          The name of the unit for the tick labels on the x and y axes.
          Defaults to None, which automatically picks an appropriate unit.
@@ -1191,14 +1208,15 @@
          represented by '-' separated string or a tuple of strings.  In the
          first index the y-location is given by 'lower', 'upper', or 'center'.
          The second index is the x-location, given as 'left', 'right', or
-         'center'.  Finally, the whether the origin is applied in 'domain' space,
-         plot 'window' space or 'native' simulation coordinate system is given.
-         For example, both 'upper-right-domain' and ['upper', 'right', 'domain']
-         both place the origin in the upper right hand corner of domain space.
-         If x or y are not given, a value is inffered.  For instance, 'left-domain'
-         corresponds to the lower-left hand corner of the simulation domain,
-         'center-domain' corresponds to the center of the simulation domain,
-         or 'center-window' for the center of the plot window. Further examples:
+         'center'.  Finally, the whether the origin is applied in 'domain'
+         space, plot 'window' space or 'native' simulation coordinate system
+         is given. For example, both 'upper-right-domain' and ['upper',
+         'right', 'domain'] both place the origin in the upper right hand
+         corner of domain space. If x or y are not given, a value is inffered.
+         For instance, 'left-domain' corresponds to the lower-left hand corner
+         of the simulation domain, 'center-domain' corresponds to the center
+         of the simulation domain, or 'center-window' for the center of the
+         plot window. Further examples:
 
          ==================================     ============================
          format                                 example
@@ -1215,7 +1233,8 @@
     fontsize : integer
          The size of the fonts for the axis, colorbar, and tick labels.
     field_parameters : dictionary
-         A dictionary of field parameters than can be accessed by derived fields.
+         A dictionary of field parameters than can be accessed by derived
+         fields.
 
     Examples
     --------
@@ -1244,7 +1263,7 @@
         slc = pf.h.slice(axis, center[axis],
             field_parameters = field_parameters, center=center)
         slc.get_data(fields)
-        PWViewerMPL.__init__(self, slc, bounds, origin=origin,
+        PWViewerMPL.__init__(self, slc, bounds, fields=fields, origin=origin,
                              fontsize=fontsize)
         self.set_axes_unit(axes_unit)
 
@@ -1268,7 +1287,8 @@
          or the axis name itself
     fields : string
         The name of the field(s) to be plotted.
-    center : two or three-element vector of sequence floats, 'c', or 'center', or 'max'
+    center : two or three-element vector of sequence floats, 'c', or 'center',
+             or 'max'
          The coordinate of the center of the image.  If left blank,
          the image centers on the location of the maximum density
          cell.  If set to 'c' or 'center', the plot is centered on
@@ -1288,12 +1308,12 @@
          ==================================     =======================
 
          For example, (10, 'kpc') requests a plot window that is 10 kiloparsecs
-         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a window
-         that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along
-         the y axis.  In the other two examples, code units are assumed, for example
-         (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3
-         in code units.  If units are provided the resulting plot axis labels will
-         use the supplied units.
+         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a
+         window that is 10 kiloparsecs wide along the x axis and 15
+         kiloparsecs wide along the y axis.  In the other two examples, code
+         units are assumed, for example (0.2, 0.3) requests a plot that has an
+         x width of 0.2 and a y width of 0.3 in code units.  If units are
+         provided the resulting plot axis labels will use the supplied units.
     axes_unit : A string
          The name of the unit for the tick labels on the x and y axes.
          Defaults to None, which automatically picks an appropriate unit.
@@ -1304,14 +1324,15 @@
          represented by '-' separated string or a tuple of strings.  In the
          first index the y-location is given by 'lower', 'upper', or 'center'.
          The second index is the x-location, given as 'left', 'right', or
-         'center'.  Finally, the whether the origin is applied in 'domain' space,
-         plot 'window' space or 'native' simulation coordinate system is given.
-         For example, both 'upper-right-domain' and ['upper', 'right', 'domain']
-         both place the origin in the upper right hand corner of domain space.
-         If x or y are not given, a value is inffered.  For instance, 'left-domain'
-         corresponds to the lower-left hand corner of the simulation domain,
-         'center-domain' corresponds to the center of the simulation domain,
-         or 'center-window' for the center of the plot window. Further examples:
+         'center'.  Finally, the whether the origin is applied in 'domain'
+         space, plot 'window' space or 'native' simulation coordinate system
+         is given. For example, both 'upper-right-domain' and ['upper',
+         'right', 'domain'] both place the origin in the upper right hand
+         corner of domain space. If x or y are not given, a value is inffered.
+         For instance, 'left-domain' corresponds to the lower-left hand corner
+         of the simulation domain, 'center-domain' corresponds to the center
+         of the simulation domain, or 'center-window' for the center of the
+         plot window. Further examples:
 
          ==================================     ============================
          format                                 example
@@ -1327,8 +1348,8 @@
          ==================================     ============================
 
     data_source : AMR3DData Object
-         Object to be used for data selection.  Defaults to a region covering the
-         entire simulation.
+         Object to be used for data selection.  Defaults to a region covering
+         the entire simulation.
     weight_field : string
          The name of the weighting field.  Set to None for no weight.
     max_level: int
@@ -1336,7 +1357,8 @@
     fontsize : integer
          The size of the fonts for the axis, colorbar, and tick labels.
     field_parameters : dictionary
-         A dictionary of field parameters than can be accessed by derived fields.
+         A dictionary of field parameters than can be accessed by derived
+         fields.
 
     Examples
     --------
@@ -1352,8 +1374,8 @@
     _frb_generator = FixedResolutionBuffer
 
     def __init__(self, pf, axis, fields, center='c', width=None, axes_unit=None,
-                 weight_field=None, max_level=None, origin='center-window', fontsize=18, 
-                 field_parameters=None, data_source=None):
+                 weight_field=None, max_level=None, origin='center-window',
+                 fontsize=18, field_parameters=None, data_source=None):
         ts = self._initialize_dataset(pf)
         self.ts = ts
         pf = self.pf = ts[0]
@@ -1363,8 +1385,9 @@
             axes_unit = units
         if field_parameters is None: field_parameters = {}
         proj = pf.h.proj(fields, axis, weight_field=weight_field,
-                         center=center, data_source=data_source, field_parameters = field_parameters)
-        PWViewerMPL.__init__(self,proj,bounds,origin=origin,
+                         center=center, data_source=data_source,
+                         field_parameters = field_parameters)
+        PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
                              fontsize=fontsize)
         self.set_axes_unit(axes_unit)
 
@@ -1408,7 +1431,8 @@
     fontsize : integer
          The size of the fonts for the axis, colorbar, and tick labels.
     field_parameters : dictionary
-         A dictionary of field parameters than can be accessed by derived fields.
+         A dictionary of field parameters than can be accessed by derived
+         fields.
     """
 
     _plot_type = 'OffAxisSlice'
@@ -1417,7 +1441,8 @@
     def __init__(self, pf, normal, fields, center='c', width=None,
                  axes_unit=None, north_vector=None, fontsize=18,
                  field_parameters=None):
-        (bounds, center_rot, units) = GetObliqueWindowParameters(normal,center,width,pf)
+        (bounds, center_rot, units) = \
+          GetObliqueWindowParameters(normal,center,width,pf)
         if axes_unit is None and units != ('1', '1'):
             axes_unit = units
         if field_parameters is None: field_parameters = {}
@@ -1426,8 +1451,9 @@
         cutting.get_data(fields)
         # Hard-coding the origin keyword since the other two options
         # aren't well-defined for off-axis data objects
-        PWViewerMPL.__init__(self,cutting,bounds,origin='center-window',periodic=False,oblique=True,
-                             fontsize=fontsize)
+        PWViewerMPL.__init__(self, cutting, bounds, fields=fields,
+                             origin='center-window',periodic=False,
+                             oblique=True, fontsize=fontsize)
         self.set_axes_unit(axes_unit)
 
 class OffAxisProjectionDummyDataSource(object):
@@ -1496,12 +1522,12 @@
          ==================================     =======================
 
          For example, (10, 'kpc') requests a plot window that is 10 kiloparsecs
-         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a window
-         that is 10 kiloparsecs wide along the x axis and 15 kiloparsecs wide along
-         the y axis.  In the other two examples, code units are assumed, for example
-         (0.2, 0.3) requests a plot that has an x width of 0.2 and a y width of 0.3
-         in code units.  If units are provided the resulting plot axis labels will
-         use the supplied units.
+         wide in the x and y directions, ((10,'kpc'),(15,'kpc')) requests a
+         window that is 10 kiloparsecs wide along the x axis and 15
+         kiloparsecs wide along the y axis.  In the other two examples, code
+         units are assumed, for example (0.2, 0.3) requests a plot that has an
+         x width of 0.2 and a y width of 0.3 in code units.  If units are
+         provided the resulting plot axis labels will use the supplied units.
     depth : A tuple or a float
         A tuple containing the depth to project thourhg and the string
         key of the unit: (width, 'unit').  If set to a float, code units
@@ -1530,18 +1556,23 @@
                  depth=(1, '1'), axes_unit=None, weight_field=None,
                  max_level=None, north_vector=None, volume=None, no_ghost=False,
                  le=None, re=None, interpolated=False, fontsize=18):
-        (bounds, center_rot, units) = GetObliqueWindowParameters(normal,center,width,pf,depth=depth)
+        (bounds, center_rot, units) = \
+          GetObliqueWindowParameters(normal,center,width,pf,depth=depth)
         if axes_unit is None and units != ('1', '1', '1'):
             axes_unit = units[:2]
         fields = ensure_list(fields)[:]
-        width = np.array((bounds[1] - bounds[0], bounds[3] - bounds[2], bounds[5] - bounds[4]))
-        OffAxisProj = OffAxisProjectionDummyDataSource(center_rot, pf, normal, width, fields, interpolated,
-                                                       weight=weight_field,  volume=volume, no_ghost=no_ghost,
-                                                       le=le, re=re, north_vector=north_vector)
+        width = np.array((bounds[1] - bounds[0],
+                          bounds[3] - bounds[2],
+                          bounds[5] - bounds[4]))
+        OffAxisProj = OffAxisProjectionDummyDataSource(
+            center_rot, pf, normal, width, fields, interpolated,
+            weight=weight_field,  volume=volume, no_ghost=no_ghost,
+            le=le, re=re, north_vector=north_vector)
         # Hard-coding the origin keyword since the other two options
         # aren't well-defined for off-axis data objects
-        PWViewerMPL.__init__(self, OffAxisProj, bounds, origin='center-window', periodic=False,
-                             oblique=True, fontsize=fontsize)
+        PWViewerMPL.__init__(
+            self, OffAxisProj, bounds, fields=fields, origin='center-window',
+            periodic=False, oblique=True, fontsize=fontsize)
         self.set_axes_unit(axes_unit)
 
 _metadata_template = """
@@ -1784,13 +1815,15 @@
             self._field_transform[field] = linear_transform
 
 class WindowPlotMPL(ImagePlotMPL):
-    def __init__(self, data, cbname, cmap, extent, aspect, zlim, size, fontsize):
+    def __init__(self, data, cbname, cmap, extent, aspect, zlim, size,
+                 fontsize):
         fsize, axrect, caxrect = self._get_best_layout(size, fontsize)
         if np.any(np.array(axrect) < 0):
-            mylog.warning('The axis ratio of the requested plot is very narrow.  '
-                          'There is a good chance the plot will not look very good, '
-                          'consider making the plot manually using FixedResolutionBuffer '
-                          'and matplotlib.')
+            msg = 'The axis ratio of the requested plot is very narrow. ' \
+                  'There is a good chance the plot will not look very good, ' \
+                  'consider making the plot manually using ' \
+                  'FixedResolutionBuffer and matplotlib.'
+            mylog.warn(msg)
             axrect  = (0.07, 0.10, 0.80, 0.80)
             caxrect = (0.87, 0.10, 0.04, 0.80)
         ImagePlotMPL.__init__(self, fsize, axrect, caxrect, zlim)

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

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list