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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Sep 29 11:19:46 PDT 2014


12 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/0b1941bc4dc0/
Changeset:   0b1941bc4dc0
Branch:      yt
User:        chummels
Date:        2014-09-27 02:15:56+00:00
Summary:     Changing ProjectionPlot's "proj_style" attribute to be "style" attribute.
Affected #:  2 files

diff -r a7736c8f4158cb76b0453eca1a6f5046775ede01 -r 0b1941bc4dc04d10fd18be620750b4573a396b37 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -211,10 +211,10 @@
                  style = "integrate", field_parameters = None):
         YTSelectionContainer2D.__init__(self, axis, ds, field_parameters)
         if style == "sum":
-            self.proj_style = "integrate"
+            self.style = "integrate"
             self._sum_only = True
         else:
-            self.proj_style = style
+            self.style = style
             self._sum_only = False
         if style == "mip":
             self.func = np.max
@@ -258,7 +258,7 @@
                   self.ds.domain_left_edge[xax],
                   self.ds.domain_right_edge[yax])
         return QuadTree(np.array([xd,yd], dtype='int64'), nvals,
-                        bounds, style = self.proj_style)
+                        bounds, style = self.style)
 
     def get_data(self, fields = None):
         fields = fields or []
@@ -280,10 +280,10 @@
                     get_memory_usage()/1024.)
                 self._handle_chunk(chunk, fields, tree)
         # Note that this will briefly double RAM usage
-        if self.proj_style == "mip":
+        if self.style == "mip":
             merge_style = -1
             op = "max"
-        elif self.proj_style == "integrate":
+        elif self.style == "integrate":
             merge_style = 1
             op = "sum"
         else:
@@ -353,7 +353,7 @@
         tree.initialize_chunk(i1, i2, ilevel)
 
     def _handle_chunk(self, chunk, fields, tree):
-        if self.proj_style == "mip" or self._sum_only:
+        if self.style == "mip" or self._sum_only:
             dl = 1.0
         else:
             # This gets explicitly converted to cm

diff -r a7736c8f4158cb76b0453eca1a6f5046775ede01 -r 0b1941bc4dc04d10fd18be620750b4573a396b37 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -1197,6 +1197,24 @@
          The maximum level to project to.
     fontsize : integer
          The size of the fonts for the axis, colorbar, and tick labels.
+    style : string
+         The method of projection.  Valid methods are: 
+
+         "integrate" with no weight_field specified : integrate the requested
+         field along the line of sight.
+
+         "integrate" with a weight_field specified : weight the requested
+         field by the weighting field and integrate along the line of sight.
+
+         "mip" : pick out the maximum value of the field in the line of sight.
+
+         "sum" : This style is the same as integrate, except that it does not 
+         multiply by a path length when performing the integration, and is 
+         just a straight summation of the field along the given axis. 
+    window_size : float
+         The size of the window in inches. Set to 8 by default.
+    aspect : float
+         The aspect ratio of the plot.  Set to None for 1.
     field_parameters : dictionary
          A dictionary of field parameters than can be accessed by derived
          fields.
@@ -1218,19 +1236,19 @@
     def __init__(self, ds, 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,
-                 proj_style = "integrate", window_size=8.0, aspect=None):
+                 style = "integrate", window_size=8.0, aspect=None):
         ts = self._initialize_dataset(ds)
         self.ts = ts
         ds = self.ds = ts[0]
         axis = fix_axis(axis, ds)
         # If a non-weighted integral projection, assure field-label reflects that
-        if weight_field is None and proj_style == "integrate":
+        if weight_field is None and style == "integrate":
             self.projected = True
         (bounds, center) = get_window_parameters(axis, center, width, ds)
         if field_parameters is None: field_parameters = {}
         proj = ds.proj(fields, axis, weight_field=weight_field,
                        center=center, data_source=data_source,
-                       field_parameters = field_parameters, style = proj_style)
+                       field_parameters = field_parameters, style = style)
         PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
                              fontsize=fontsize, window_size=window_size, 
                              aspect=aspect)
@@ -1323,7 +1341,7 @@
 
 class OffAxisProjectionDummyDataSource(object):
     _type_name = 'proj'
-    proj_style = 'integrate'
+    style = 'integrate'
     _key_fields = []
     def __init__(self, center, ds, normal_vector, width, fields,
                  interpolated, resolution = (800,800), weight=None,
@@ -1435,7 +1453,7 @@
             weight=weight_field,  volume=volume, no_ghost=no_ghost,
             le=le, re=re, north_vector=north_vector)
         # If a non-weighted, integral projection, assure field-label reflects that
-        if weight_field is None and OffAxisProj.proj_style == "integrate":
+        if weight_field is None and OffAxisProj.style == "integrate":
             self.projected = True
         # Hard-coding the origin keyword since the other two options
         # aren't well-defined for off-axis data objects
@@ -1629,7 +1647,7 @@
         if source._type_name in ("slice", "cutting"):
             units = finfo.get_units()
         elif source._type_name == "proj":
-            if source.weight_field is not None or source.proj_style in ("mip", "sum"):
+            if source.weight_field is not None or source.style in ("mip", "sum"):
                 units = finfo.get_units()
             else:
                 units = finfo.get_projected_units()


https://bitbucket.org/yt_analysis/yt/commits/576dd9e3c842/
Changeset:   576dd9e3c842
Branch:      yt
User:        chummels
Date:        2014-09-27 02:17:47+00:00
Summary:     Merging.
Affected #:  2 files

diff -r 4cf5c5369df9b012759ab979330d8e356d1b0e00 -r 576dd9e3c8421964d890cf0eb76c9ff02bbadf8a yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -211,10 +211,10 @@
                  style = "integrate", field_parameters = None):
         YTSelectionContainer2D.__init__(self, axis, ds, field_parameters)
         if style == "sum":
-            self.proj_style = "integrate"
+            self.style = "integrate"
             self._sum_only = True
         else:
-            self.proj_style = style
+            self.style = style
             self._sum_only = False
         if style == "mip":
             self.func = np.max
@@ -260,7 +260,7 @@
                   self.ds.domain_left_edge[xax],
                   self.ds.domain_right_edge[yax])
         return QuadTree(np.array([xd,yd], dtype='int64'), nvals,
-                        bounds, style = self.proj_style)
+                        bounds, style = self.style)
 
     def get_data(self, fields = None):
         fields = fields or []
@@ -282,10 +282,10 @@
                     get_memory_usage()/1024.)
                 self._handle_chunk(chunk, fields, tree)
         # Note that this will briefly double RAM usage
-        if self.proj_style == "mip":
+        if self.style == "mip":
             merge_style = -1
             op = "max"
-        elif self.proj_style == "integrate":
+        elif self.style == "integrate":
             merge_style = 1
             op = "sum"
         else:
@@ -355,7 +355,7 @@
         tree.initialize_chunk(i1, i2, ilevel)
 
     def _handle_chunk(self, chunk, fields, tree):
-        if self.proj_style == "mip" or self._sum_only:
+        if self.style == "mip" or self._sum_only:
             dl = 1.0
         else:
             # This gets explicitly converted to cm

diff -r 4cf5c5369df9b012759ab979330d8e356d1b0e00 -r 576dd9e3c8421964d890cf0eb76c9ff02bbadf8a yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -1109,6 +1109,24 @@
          The maximum level to project to.
     fontsize : integer
          The size of the fonts for the axis, colorbar, and tick labels.
+    style : string
+         The method of projection.  Valid methods are: 
+
+         "integrate" with no weight_field specified : integrate the requested
+         field along the line of sight.
+
+         "integrate" with a weight_field specified : weight the requested
+         field by the weighting field and integrate along the line of sight.
+
+         "mip" : pick out the maximum value of the field in the line of sight.
+
+         "sum" : This style is the same as integrate, except that it does not 
+         multiply by a path length when performing the integration, and is 
+         just a straight summation of the field along the given axis. 
+    window_size : float
+         The size of the window in inches. Set to 8 by default.
+    aspect : float
+         The aspect ratio of the plot.  Set to None for 1.
     field_parameters : dictionary
          A dictionary of field parameters than can be accessed by derived
          fields.
@@ -1130,20 +1148,20 @@
     def __init__(self, ds, 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,
-                 proj_style = "integrate", window_size=8.0, aspect=None):
+                 style = "integrate", window_size=8.0, aspect=None):
         ts = self._initialize_dataset(ds)
         self.ts = ts
         ds = self.ds = ts[0]
         axis = fix_axis(axis, ds)
         # If a non-weighted integral projection, assure field-label reflects that
-        if weight_field is None and proj_style == "integrate":
+        if weight_field is None and style == "integrate":
             self.projected = True
         (bounds, center, display_center) = \
                 get_window_parameters(axis, center, width, ds)
         if field_parameters is None: field_parameters = {}
         proj = ds.proj(fields, axis, weight_field=weight_field,
                        center=center, data_source=data_source,
-                       field_parameters = field_parameters, style = proj_style)
+                       field_parameters = field_parameters, style = style)
         PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
                              fontsize=fontsize, window_size=window_size, 
                              aspect=aspect)
@@ -1236,7 +1254,7 @@
 
 class OffAxisProjectionDummyDataSource(object):
     _type_name = 'proj'
-    proj_style = 'integrate'
+    style = 'integrate'
     _key_fields = []
     def __init__(self, center, ds, normal_vector, width, fields,
                  interpolated, resolution = (800,800), weight=None,
@@ -1348,7 +1366,7 @@
             weight=weight_field,  volume=volume, no_ghost=no_ghost,
             le=le, re=re, north_vector=north_vector)
         # If a non-weighted, integral projection, assure field-label reflects that
-        if weight_field is None and OffAxisProj.proj_style == "integrate":
+        if weight_field is None and OffAxisProj.style == "integrate":
             self.projected = True
         # Hard-coding the origin keyword since the other two options
         # aren't well-defined for off-axis data objects
@@ -1542,7 +1560,7 @@
         if source._type_name in ("slice", "cutting"):
             units = finfo.get_units()
         elif source._type_name == "proj":
-            if source.weight_field is not None or source.proj_style in ("mip", "sum"):
+            if source.weight_field is not None or source.style in ("mip", "sum"):
                 units = finfo.get_units()
             else:
                 units = finfo.get_projected_units()


https://bitbucket.org/yt_analysis/yt/commits/434d070db9c3/
Changeset:   434d070db9c3
Branch:      yt
User:        chummels
Date:        2014-09-27 03:29:12+00:00
Summary:     Fixing a bug with 'mip' projections where the units of the projected field had an extra factor of 'cm' or length.
Affected #:  1 file

diff -r 576dd9e3c8421964d890cf0eb76c9ff02bbadf8a -r 434d070db9c3b7b917630ff1b9b3286ed1b10a6b yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -324,7 +324,10 @@
             finfo = self.ds._get_field_info(*field)
             mylog.debug("Setting field %s", field)
             units = finfo.units
-            if self.weight_field is None and not self._sum_only:
+            # add length units to "projected units" if non-weighted 
+            # integral projection
+            if self.weight_field is None and not self._sum_only and \
+               self.style == 'integrate':
                 # See _handle_chunk where we mandate cm
                 if units == '':
                     input_units = "cm"
@@ -336,7 +339,9 @@
             self[field] = YTArray(field_data[fi].ravel(),
                                   input_units=input_units,
                                   registry=self.ds.unit_registry)
-            if self.weight_field is None and not self._sum_only:
+            # convert units if non-weighted integral projection
+            if self.weight_field is None and not self._sum_only and \
+               self.style == 'integrate':
                 u_obj = Unit(units, registry=self.ds.unit_registry)
                 if ((u_obj.is_code_unit or self.ds.no_cgs_equiv_length) and
                     not u_obj.is_dimensionless) and input_units != units:


https://bitbucket.org/yt_analysis/yt/commits/400d7f531874/
Changeset:   400d7f531874
Branch:      yt
User:        chummels
Date:        2014-09-27 03:39:58+00:00
Summary:     Making sure proj_style keyword is reinstated but deprecated in ProjectionPlot.
Affected #:  1 file

diff -r 434d070db9c3b7b917630ff1b9b3286ed1b10a6b -r 400d7f53187497adefdc02185510ef8bf239f597 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -1123,6 +1123,9 @@
          "sum" : This style is the same as integrate, except that it does not 
          multiply by a path length when performing the integration, and is 
          just a straight summation of the field along the given axis. 
+    proj_style : string
+         The method of projection--same as style keyword.  Deprecated as of 
+         version 3.0.2.  Please use style instead.
     window_size : float
          The size of the window in inches. Set to 8 by default.
     aspect : float
@@ -1148,11 +1151,14 @@
     def __init__(self, ds, 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,
-                 style = "integrate", window_size=8.0, aspect=None):
+                 style = "integrate", proj_style = None, window_size=8.0, aspect=None):
         ts = self._initialize_dataset(ds)
         self.ts = ts
         ds = self.ds = ts[0]
         axis = fix_axis(axis, ds)
+        # proj_style is deprecated, but if someone specifies then it trumps style.
+        if proj_style is not None:
+            style = proj_style
         # If a non-weighted integral projection, assure field-label reflects that
         if weight_field is None and style == "integrate":
             self.projected = True


https://bitbucket.org/yt_analysis/yt/commits/a6b4c076ee44/
Changeset:   a6b4c076ee44
Branch:      yt
User:        chummels
Date:        2014-09-27 14:27:41+00:00
Summary:     Changing "style" keyword in ProjectionPlot and projection class to "method" as per suggestions in PR.
Affected #:  2 files

diff -r 400d7f53187497adefdc02185510ef8bf239f597 -r a6b4c076ee445acf6ee3b29c5ac8fc3f94bcdf24 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -186,8 +186,8 @@
     data_source : `yt.data_objects.api.AMRData`, optional
         If specified, this will be the data source used for selecting
         regions to project.
-    style : string, optional
-        The style of projection to be performed.
+    method : string, optional
+        The method of projection to be performed.
         "integrate" : integration along the axis
         "mip" : maximum intensity projection
         "sum" : same as "integrate", except that we don't multiply by the path length
@@ -208,20 +208,20 @@
     _container_fields = ('px', 'py', 'pdx', 'pdy', 'weight_field')
     def __init__(self, field, axis, weight_field = None,
                  center = None, ds = None, data_source = None,
-                 style = "integrate", field_parameters = None):
+                 method = "integrate", field_parameters = None):
         YTSelectionContainer2D.__init__(self, axis, ds, field_parameters)
-        if style == "sum":
-            self.style = "integrate"
+        if method == "sum":
+            self.method = "integrate"
             self._sum_only = True
         else:
-            self.style = style
+            self.method = method
             self._sum_only = False
-        if style == "mip":
+        if self.method == "mip":
             self.func = np.max
-        elif style == "integrate" or style == "sum":
+        elif self.method == "integrate":
             self.func = np.sum # for the future
         else:
-            raise NotImplementedError(style)
+            raise NotImplementedError(self.method)
         self._set_center(center)
         if data_source is None: data_source = self.ds.all_data()
         for k, v in data_source.field_parameters.items():
@@ -260,7 +260,7 @@
                   self.ds.domain_left_edge[xax],
                   self.ds.domain_right_edge[yax])
         return QuadTree(np.array([xd,yd], dtype='int64'), nvals,
-                        bounds, style = self.style)
+                        bounds, method = self.method)
 
     def get_data(self, fields = None):
         fields = fields or []
@@ -282,10 +282,10 @@
                     get_memory_usage()/1024.)
                 self._handle_chunk(chunk, fields, tree)
         # Note that this will briefly double RAM usage
-        if self.style == "mip":
+        if self.method == "mip":
             merge_style = -1
             op = "max"
-        elif self.style == "integrate":
+        elif self.method == "integrate":
             merge_style = 1
             op = "sum"
         else:
@@ -327,7 +327,7 @@
             # add length units to "projected units" if non-weighted 
             # integral projection
             if self.weight_field is None and not self._sum_only and \
-               self.style == 'integrate':
+               self.method == 'integrate':
                 # See _handle_chunk where we mandate cm
                 if units == '':
                     input_units = "cm"
@@ -341,7 +341,7 @@
                                   registry=self.ds.unit_registry)
             # convert units if non-weighted integral projection
             if self.weight_field is None and not self._sum_only and \
-               self.style == 'integrate':
+               self.method == 'integrate':
                 u_obj = Unit(units, registry=self.ds.unit_registry)
                 if ((u_obj.is_code_unit or self.ds.no_cgs_equiv_length) and
                     not u_obj.is_dimensionless) and input_units != units:
@@ -360,7 +360,7 @@
         tree.initialize_chunk(i1, i2, ilevel)
 
     def _handle_chunk(self, chunk, fields, tree):
-        if self.style == "mip" or self._sum_only:
+        if self.method == "mip" or self._sum_only:
             dl = 1.0
         else:
             # This gets explicitly converted to cm

diff -r 400d7f53187497adefdc02185510ef8bf239f597 -r a6b4c076ee445acf6ee3b29c5ac8fc3f94bcdf24 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -1109,7 +1109,7 @@
          The maximum level to project to.
     fontsize : integer
          The size of the fonts for the axis, colorbar, and tick labels.
-    style : string
+    method : string
          The method of projection.  Valid methods are: 
 
          "integrate" with no weight_field specified : integrate the requested
@@ -1120,12 +1120,12 @@
 
          "mip" : pick out the maximum value of the field in the line of sight.
 
-         "sum" : This style is the same as integrate, except that it does not 
+         "sum" : This method is the same as integrate, except that it does not 
          multiply by a path length when performing the integration, and is 
          just a straight summation of the field along the given axis. 
     proj_style : string
-         The method of projection--same as style keyword.  Deprecated as of 
-         version 3.0.2.  Please use style instead.
+         The method of projection--same as method keyword.  Deprecated as of 
+         version 3.0.2.  Please use method instead.
     window_size : float
          The size of the window in inches. Set to 8 by default.
     aspect : float
@@ -1151,23 +1151,25 @@
     def __init__(self, ds, 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,
-                 style = "integrate", proj_style = None, window_size=8.0, aspect=None):
+                 method = "integrate", proj_style = None, window_size=8.0, 
+                 aspect=None):
         ts = self._initialize_dataset(ds)
         self.ts = ts
         ds = self.ds = ts[0]
         axis = fix_axis(axis, ds)
-        # proj_style is deprecated, but if someone specifies then it trumps style.
+        # proj_style is deprecated, but if someone specifies then it trumps 
+        # method.
         if proj_style is not None:
-            style = proj_style
+            method = proj_style
         # If a non-weighted integral projection, assure field-label reflects that
-        if weight_field is None and style == "integrate":
+        if weight_field is None and method == "integrate":
             self.projected = True
         (bounds, center, display_center) = \
                 get_window_parameters(axis, center, width, ds)
         if field_parameters is None: field_parameters = {}
         proj = ds.proj(fields, axis, weight_field=weight_field,
                        center=center, data_source=data_source,
-                       field_parameters = field_parameters, style = style)
+                       field_parameters = field_parameters, method = method)
         PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
                              fontsize=fontsize, window_size=window_size, 
                              aspect=aspect)
@@ -1260,7 +1262,7 @@
 
 class OffAxisProjectionDummyDataSource(object):
     _type_name = 'proj'
-    style = 'integrate'
+    method = 'integrate'
     _key_fields = []
     def __init__(self, center, ds, normal_vector, width, fields,
                  interpolated, resolution = (800,800), weight=None,
@@ -1372,7 +1374,7 @@
             weight=weight_field,  volume=volume, no_ghost=no_ghost,
             le=le, re=re, north_vector=north_vector)
         # If a non-weighted, integral projection, assure field-label reflects that
-        if weight_field is None and OffAxisProj.style == "integrate":
+        if weight_field is None and OffAxisProj.method == "integrate":
             self.projected = True
         # Hard-coding the origin keyword since the other two options
         # aren't well-defined for off-axis data objects
@@ -1566,7 +1568,7 @@
         if source._type_name in ("slice", "cutting"):
             units = finfo.get_units()
         elif source._type_name == "proj":
-            if source.weight_field is not None or source.style in ("mip", "sum"):
+            if source.weight_field is not None or source.method in ("mip", "sum"):
                 units = finfo.get_units()
             else:
                 units = finfo.get_projected_units()


https://bitbucket.org/yt_analysis/yt/commits/382d37fe6e41/
Changeset:   382d37fe6e41
Branch:      yt
User:        chummels
Date:        2014-09-27 14:33:14+00:00
Summary:     Changing docs to be made in line with "style" changing to "method".
Affected #:  4 files

diff -r a6b4c076ee445acf6ee3b29c5ac8fc3f94bcdf24 -r 382d37fe6e41f26dffb43a360848c4adb029b4fb doc/source/analyzing/analysis_modules/PPVCube.ipynb
--- a/doc/source/analyzing/analysis_modules/PPVCube.ipynb
+++ b/doc/source/analyzing/analysis_modules/PPVCube.ipynb
@@ -291,7 +291,7 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "prj = yt.ProjectionPlot(ds, \"z\", [\"density\"], proj_style=\"sum\")\n",
+      "prj = yt.ProjectionPlot(ds, \"z\", [\"density\"], method=\"sum\")\n",
       "prj.set_log(\"density\", True)\n",
       "prj.set_zlim(\"density\", 1.0e-3, 0.2)\n",
       "prj.show()"
@@ -304,4 +304,4 @@
    "metadata": {}
   }
  ]
-}
\ No newline at end of file
+}

diff -r a6b4c076ee445acf6ee3b29c5ac8fc3f94bcdf24 -r 382d37fe6e41f26dffb43a360848c4adb029b4fb doc/source/cookbook/fits_radio_cubes.ipynb
--- a/doc/source/cookbook/fits_radio_cubes.ipynb
+++ b/doc/source/cookbook/fits_radio_cubes.ipynb
@@ -183,14 +183,14 @@
      "cell_type": "markdown",
      "metadata": {},
      "source": [
-      "We can also make a projection of all the emission along the line of sight. Since we're not doing an integration along a path length, we needed to specify `proj_style = \"sum\"`:"
+      "We can also make a projection of all the emission along the line of sight. Since we're not doing an integration along a path length, we needed to specify `method = \"sum\"`:"
      ]
     },
     {
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "prj = yt.ProjectionPlot(ds, \"z\", [\"intensity\"], proj_style=\"sum\", origin=\"native\")\n",
+      "prj = yt.ProjectionPlot(ds, \"z\", [\"intensity\"], method=\"sum\", origin=\"native\")\n",
       "prj.show()"
      ],
      "language": "python",

diff -r a6b4c076ee445acf6ee3b29c5ac8fc3f94bcdf24 -r 382d37fe6e41f26dffb43a360848c4adb029b4fb doc/source/cookbook/fits_xray_images.ipynb
--- a/doc/source/cookbook/fits_xray_images.ipynb
+++ b/doc/source/cookbook/fits_xray_images.ipynb
@@ -264,7 +264,7 @@
       "                   [\"flux\",\"projected_temperature\",\"pseudo_pressure\",\"pseudo_entropy\"], \n",
       "                   origin=\"native\", field_parameters={\"exposure_time\":exposure_time},\n",
       "                   data_source=circle_reg,\n",
-      "                   proj_style=\"sum\")\n",
+      "                   method=\"sum\")\n",
       "prj.set_log(\"flux\",True)\n",
       "prj.set_log(\"pseudo_pressure\",False)\n",
       "prj.set_log(\"pseudo_entropy\",False)\n",

diff -r a6b4c076ee445acf6ee3b29c5ac8fc3f94bcdf24 -r 382d37fe6e41f26dffb43a360848c4adb029b4fb doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -239,13 +239,13 @@
 Types of Projections
 """"""""""""""""""""
 
-There are several different styles of projections that can be made either 
+There are several different methods of projections that can be made either 
 when creating a projection with ds.proj() or when making a ProjectionPlot.  
-In either construction method, set the ``style`` keyword to be one of the 
+In either construction method, set the ``method`` keyword to be one of the 
 following:
 
 ``integrate`` (unweighted)
-    This is the default projection style. It simply integrates the 
+    This is the default projection method. It simply integrates the 
     requested field  :math:`f(x)` along a line of sight  :math:`\hat{n}` , 
     given by the axis parameter (e.g. :math:`\hat{i},\hat{j},` or 
     :math:`\hat{k}`).  The units of the projected field  
@@ -258,7 +258,7 @@
     g(X) = {\int\ {f(x)\hat{n}\cdot{dx}}}
 
 ``integrate`` (weighted)
-    When using the ``integrate``  style, a ``weight_field`` argument may also 
+    When using the ``integrate``  method, a ``weight_field`` argument may also 
     be specified, which will produce a weighted projection.  :math:`w(x)` 
     is the field used as a weight. One common example would 
     be to weight the "temperature" field by the "density" field. In this case, 
@@ -269,15 +269,15 @@
     g(X) = \frac{\int\ {f(x)w(x)\hat{n}\cdot{dx}}}{\int\ {w(x)\hat{n}\cdot{dx}}}
 
 ``mip`` 
-    This style picks out the maximum value of a field along the line of 
+    This method picks out the maximum value of a field along the line of 
     sight given by the axis parameter.
 
 ``sum``
-    This style is the same as ``integrate``, except that it does not 
+    This method is the same as ``integrate``, except that it does not 
     multiply by a path length when performing the integration, and is just a 
     straight summation of the field along the given axis. The units of the 
     projected field will be the same as those of the unprojected field. This 
-    style is typically only useful for datasets such as 3D FITS cubes where 
+    method is typically only useful for datasets such as 3D FITS cubes where 
     the third axis of the dataset is something like velocity or frequency.
 
 .. _off-axis-projections:


https://bitbucket.org/yt_analysis/yt/commits/974e906da750/
Changeset:   974e906da750
Branch:      yt
User:        chummels
Date:        2014-09-28 04:16:50+00:00
Summary:     Updating QuadTree cython code to include switch from QuadTree style keyword to method keyword
Affected #:  1 file

diff -r 382d37fe6e41f26dffb43a360848c4adb029b4fb -r 974e906da75008f36ae0fd6b143936de4a541452 yt/utilities/lib/QuadTree.pyx
--- a/yt/utilities/lib/QuadTree.pyx
+++ b/yt/utilities/lib/QuadTree.pyx
@@ -113,10 +113,10 @@
     cdef np.int64_t last_dims[2]
 
     def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,
-                  int nvals, bounds, style = "integrate"):
-        if style == "integrate":
+                  int nvals, bounds, method = "integrate"):
+        if method == "integrate":
             self.combine = QTN_add_value
-        elif style == "mip":
+        elif method == "mip":
             self.combine = QTN_max_value
         else:
             raise NotImplementedError
@@ -212,10 +212,10 @@
     def frombuffer(self, np.ndarray[np.int32_t, ndim=1] refined,
                          np.ndarray[np.float64_t, ndim=2] values,
                          np.ndarray[np.float64_t, ndim=1] wval,
-                         style):
-        if style == "mip" or style == -1:
+                         method):
+        if method == "mip" or method == -1:
             self.merged = -1
-        elif style == "integrate" or style == 1:
+        elif method == "integrate" or method == 1:
             self.merged = 1
         cdef int curpos = 0
         cdef QuadTreeNode *root
@@ -348,11 +348,11 @@
     @cython.boundscheck(False)
     @cython.wraparound(False)
     @cython.cdivision(True)
-    def get_all(self, int count_only = 0, int style = 1):
+    def get_all(self, int count_only = 0, int method = 1):
         cdef int i, j, vi
         cdef int total = 0
         vals = []
-        self.merged = style
+        self.merged = method
         for i in range(self.top_grid_dims[0]):
             for j in range(self.top_grid_dims[1]):
                 total += self.count(self.root_nodes[i][j])
@@ -540,14 +540,14 @@
     else:
         raise RuntimeError
 
-def merge_quadtrees(QuadTree qt1, QuadTree qt2, style = 1):
+def merge_quadtrees(QuadTree qt1, QuadTree qt2, method = 1):
     cdef int i, j
     qt1.num_cells = 0
     cdef QTN_combine *func
-    if style == 1:
+    if method == 1:
         qt1.merged = 1
         func = QTN_add_value
-    elif style == -1:
+    elif method == -1:
         qt1.merged = -1
         func = QTN_max_value
     else:


https://bitbucket.org/yt_analysis/yt/commits/744fa4a87b3f/
Changeset:   744fa4a87b3f
Branch:      yt
User:        chummels
Date:        2014-09-28 12:51:12+00:00
Summary:     Updating QuadTree object to accept deprecated style keyword.
Affected #:  2 files

diff -r 974e906da75008f36ae0fd6b143936de4a541452 -r 744fa4a87b3faea16638a6c6430db6f344d954c3 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -191,6 +191,9 @@
         "integrate" : integration along the axis
         "mip" : maximum intensity projection
         "sum" : same as "integrate", except that we don't multiply by the path length
+    style : string, optional
+        The same as the method keyword.  Deprecated as of version 3.0.2.  
+        Please use method keyword instead.
     field_parameters : dict of items
         Values to be passed as field parameters that can be
         accessed by generated fields.
@@ -208,8 +211,14 @@
     _container_fields = ('px', 'py', 'pdx', 'pdy', 'weight_field')
     def __init__(self, field, axis, weight_field = None,
                  center = None, ds = None, data_source = None,
-                 method = "integrate", field_parameters = None):
+                 style = None, method = "integrate", 
+                 field_parameters = None):
         YTSelectionContainer2D.__init__(self, axis, ds, field_parameters)
+        # Style is deprecated, but if it is set, then it trumps method
+        # keyword.  TODO: Remove this keyword and this check at some point in 
+        # the future.
+        if style is not None:
+            method = style
         if method == "sum":
             self.method = "integrate"
             self._sum_only = True

diff -r 974e906da75008f36ae0fd6b143936de4a541452 -r 744fa4a87b3faea16638a6c6430db6f344d954c3 yt/utilities/lib/QuadTree.pyx
--- a/yt/utilities/lib/QuadTree.pyx
+++ b/yt/utilities/lib/QuadTree.pyx
@@ -113,7 +113,9 @@
     cdef np.int64_t last_dims[2]
 
     def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,
-                  int nvals, bounds, method = "integrate"):
+                  int nvals, bounds, style = None, method = "integrate"):
+        if style is not None:
+            method = style
         if method == "integrate":
             self.combine = QTN_add_value
         elif method == "mip":


https://bitbucket.org/yt_analysis/yt/commits/ee6b6c9776f8/
Changeset:   ee6b6c9776f8
Branch:      yt
User:        chummels
Date:        2014-09-28 13:07:01+00:00
Summary:     Adding nosetest to test for use of 'mip' and 'sum' methods.
Affected #:  1 file

diff -r 744fa4a87b3faea16638a6c6430db6f344d954c3 -r ee6b6c9776f888aeeb932c1887f81ebfa1004a87 yt/visualization/tests/test_plotwindow.py
--- a/yt/visualization/tests/test_plotwindow.py
+++ b/yt/visualization/tests/test_plotwindow.py
@@ -146,6 +146,12 @@
     ('gas', 'density'),
 )
 
+PROJECTION_METHODS = (
+    'integrate',
+    'sum',
+    'mip'
+)
+
 @requires_ds(M7)
 def test_attributes():
     """Test plot member functions that aren't callbacks"""
@@ -240,6 +246,7 @@
         projections_c = []
         projections_wf = []
         projections_w = {}
+        projections_m = []
         for dim in range(3):
             projections.append(ProjectionPlot(test_ds, dim, "density"))
             projections_ds.append(ProjectionPlot(test_ds, dim, "density",
@@ -253,6 +260,9 @@
         for wf in WEIGHT_FIELDS:
             projections_wf.append(ProjectionPlot(test_ds, dim, "density",
                                                  weight_field=wf))
+        for m in PROJECTION_METHODS:
+            projections_m.append(ProjectionPlot(test_ds, dim, "density",
+                                                 method=m))
 
         cls.slices = [SlicePlot(test_ds, dim, "density") for dim in range(3)]
         cls.projections = projections
@@ -260,6 +270,7 @@
         cls.projections_c = projections_c
         cls.projections_wf = projections_wf
         cls.projections_w = projections_w
+        cls.projections_m = projections_m
         cls.offaxis_slice = OffAxisSlicePlot(test_ds, normal, "density")
         cls.offaxis_proj = OffAxisProjectionPlot(test_ds, normal, "density")
 
@@ -296,6 +307,10 @@
     def test_projection_plot_wf(self, dim):
         self.projections_wf[dim].save()
 
+    @parameterized.expand([(i, ) for i in range(len(PROJECTION_METHODS))])
+    def test_projection_plot_m(self, dim):
+        self.projections_m[dim].save()
+
     @parameterized.expand(
         param.explicit((fname, ))
         for fname in TEST_FLNMS)


https://bitbucket.org/yt_analysis/yt/commits/0fddd8e36a9b/
Changeset:   0fddd8e36a9b
Branch:      yt
User:        chummels
Date:        2014-09-28 13:17:36+00:00
Summary:     Updating the docs to note the change in style -> method in QuadTree object.
Affected #:  1 file

diff -r ee6b6c9776f888aeeb932c1887f81ebfa1004a87 -r 0fddd8e36a9b06d7cb341ef399eeb199aad4a88b doc/source/analyzing/objects.rst
--- a/doc/source/analyzing/objects.rst
+++ b/doc/source/analyzing/objects.rst
@@ -225,12 +225,12 @@
 
 **Projection** 
     | Class :class:`~yt.data_objects.construction_data_containers.YTQuadTreeProjBase`
-    | Usage: ``proj(field, axis, weight_field=None, center=None, ds=None, data_source=None, style="integrate", field_parameters=None)``
+    | Usage: ``proj(field, axis, weight_field=None, center=None, ds=None, data_source=None, method="integrate", field_parameters=None)``
     | A 2D projection of a 3D volume along one of the axis directions.  
       By default, this is a line integral through the entire simulation volume 
       (although it can be a subset of that volume specified by a data object
       with the ``data_source`` keyword).  Alternatively, one can specify 
-      a weight_field and different ``style`` values to change the nature
+      a weight_field and different ``method`` values to change the nature
       of the projection outcome.  See :ref:`projection-types` for more information.
 
 **Streamline** 


https://bitbucket.org/yt_analysis/yt/commits/f827ebe4d6bb/
Changeset:   f827ebe4d6bb
Branch:      yt
User:        chummels
Date:        2014-09-29 15:02:13+00:00
Summary:     Removing unnecessary change to QuadTree cython code.
Affected #:  1 file

diff -r 0fddd8e36a9b06d7cb341ef399eeb199aad4a88b -r f827ebe4d6bbc0f2e116882251392542b237e101 yt/utilities/lib/QuadTree.pyx
--- a/yt/utilities/lib/QuadTree.pyx
+++ b/yt/utilities/lib/QuadTree.pyx
@@ -113,9 +113,7 @@
     cdef np.int64_t last_dims[2]
 
     def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,
-                  int nvals, bounds, style = None, method = "integrate"):
-        if style is not None:
-            method = style
+                  int nvals, bounds, method = "integrate"):
         if method == "integrate":
             self.combine = QTN_add_value
         elif method == "mip":


https://bitbucket.org/yt_analysis/yt/commits/90dad9d0c93b/
Changeset:   90dad9d0c93b
Branch:      yt
User:        MatthewTurk
Date:        2014-09-29 18:19:34+00:00
Summary:     Merged in chummels/yt (pull request #1224)

[APICHANGE] [BUGFIX] Changing ProjectionPlot's "proj_style" attribute to be "style" attribute
Affected #:  9 files

diff -r 64c466c241dccbffa835bfe3c8ee042996a03273 -r 90dad9d0c93ba29a7ce3ed072c09a391d758fdf1 doc/source/analyzing/analysis_modules/PPVCube.ipynb
--- a/doc/source/analyzing/analysis_modules/PPVCube.ipynb
+++ b/doc/source/analyzing/analysis_modules/PPVCube.ipynb
@@ -291,7 +291,7 @@
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "prj = yt.ProjectionPlot(ds, \"z\", [\"density\"], proj_style=\"sum\")\n",
+      "prj = yt.ProjectionPlot(ds, \"z\", [\"density\"], method=\"sum\")\n",
       "prj.set_log(\"density\", True)\n",
       "prj.set_zlim(\"density\", 1.0e-3, 0.2)\n",
       "prj.show()"
@@ -304,4 +304,4 @@
    "metadata": {}
   }
  ]
-}
\ No newline at end of file
+}

diff -r 64c466c241dccbffa835bfe3c8ee042996a03273 -r 90dad9d0c93ba29a7ce3ed072c09a391d758fdf1 doc/source/analyzing/objects.rst
--- a/doc/source/analyzing/objects.rst
+++ b/doc/source/analyzing/objects.rst
@@ -225,12 +225,12 @@
 
 **Projection** 
     | Class :class:`~yt.data_objects.construction_data_containers.YTQuadTreeProjBase`
-    | Usage: ``proj(field, axis, weight_field=None, center=None, ds=None, data_source=None, style="integrate", field_parameters=None)``
+    | Usage: ``proj(field, axis, weight_field=None, center=None, ds=None, data_source=None, method="integrate", field_parameters=None)``
     | A 2D projection of a 3D volume along one of the axis directions.  
       By default, this is a line integral through the entire simulation volume 
       (although it can be a subset of that volume specified by a data object
       with the ``data_source`` keyword).  Alternatively, one can specify 
-      a weight_field and different ``style`` values to change the nature
+      a weight_field and different ``method`` values to change the nature
       of the projection outcome.  See :ref:`projection-types` for more information.
 
 **Streamline** 

diff -r 64c466c241dccbffa835bfe3c8ee042996a03273 -r 90dad9d0c93ba29a7ce3ed072c09a391d758fdf1 doc/source/cookbook/fits_radio_cubes.ipynb
--- a/doc/source/cookbook/fits_radio_cubes.ipynb
+++ b/doc/source/cookbook/fits_radio_cubes.ipynb
@@ -183,14 +183,14 @@
      "cell_type": "markdown",
      "metadata": {},
      "source": [
-      "We can also make a projection of all the emission along the line of sight. Since we're not doing an integration along a path length, we needed to specify `proj_style = \"sum\"`:"
+      "We can also make a projection of all the emission along the line of sight. Since we're not doing an integration along a path length, we needed to specify `method = \"sum\"`:"
      ]
     },
     {
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "prj = yt.ProjectionPlot(ds, \"z\", [\"intensity\"], proj_style=\"sum\", origin=\"native\")\n",
+      "prj = yt.ProjectionPlot(ds, \"z\", [\"intensity\"], method=\"sum\", origin=\"native\")\n",
       "prj.show()"
      ],
      "language": "python",

diff -r 64c466c241dccbffa835bfe3c8ee042996a03273 -r 90dad9d0c93ba29a7ce3ed072c09a391d758fdf1 doc/source/cookbook/fits_xray_images.ipynb
--- a/doc/source/cookbook/fits_xray_images.ipynb
+++ b/doc/source/cookbook/fits_xray_images.ipynb
@@ -264,7 +264,7 @@
       "                   [\"flux\",\"projected_temperature\",\"pseudo_pressure\",\"pseudo_entropy\"], \n",
       "                   origin=\"native\", field_parameters={\"exposure_time\":exposure_time},\n",
       "                   data_source=circle_reg,\n",
-      "                   proj_style=\"sum\")\n",
+      "                   method=\"sum\")\n",
       "prj.set_log(\"flux\",True)\n",
       "prj.set_log(\"pseudo_pressure\",False)\n",
       "prj.set_log(\"pseudo_entropy\",False)\n",

diff -r 64c466c241dccbffa835bfe3c8ee042996a03273 -r 90dad9d0c93ba29a7ce3ed072c09a391d758fdf1 doc/source/visualizing/plots.rst
--- a/doc/source/visualizing/plots.rst
+++ b/doc/source/visualizing/plots.rst
@@ -239,13 +239,13 @@
 Types of Projections
 """"""""""""""""""""
 
-There are several different styles of projections that can be made either 
+There are several different methods of projections that can be made either 
 when creating a projection with ds.proj() or when making a ProjectionPlot.  
-In either construction method, set the ``style`` keyword to be one of the 
+In either construction method, set the ``method`` keyword to be one of the 
 following:
 
 ``integrate`` (unweighted)
-    This is the default projection style. It simply integrates the 
+    This is the default projection method. It simply integrates the 
     requested field  :math:`f(x)` along a line of sight  :math:`\hat{n}` , 
     given by the axis parameter (e.g. :math:`\hat{i},\hat{j},` or 
     :math:`\hat{k}`).  The units of the projected field  
@@ -258,7 +258,7 @@
     g(X) = {\int\ {f(x)\hat{n}\cdot{dx}}}
 
 ``integrate`` (weighted)
-    When using the ``integrate``  style, a ``weight_field`` argument may also 
+    When using the ``integrate``  method, a ``weight_field`` argument may also 
     be specified, which will produce a weighted projection.  :math:`w(x)` 
     is the field used as a weight. One common example would 
     be to weight the "temperature" field by the "density" field. In this case, 
@@ -269,15 +269,15 @@
     g(X) = \frac{\int\ {f(x)w(x)\hat{n}\cdot{dx}}}{\int\ {w(x)\hat{n}\cdot{dx}}}
 
 ``mip`` 
-    This style picks out the maximum value of a field along the line of 
+    This method picks out the maximum value of a field along the line of 
     sight given by the axis parameter.
 
 ``sum``
-    This style is the same as ``integrate``, except that it does not 
+    This method is the same as ``integrate``, except that it does not 
     multiply by a path length when performing the integration, and is just a 
     straight summation of the field along the given axis. The units of the 
     projected field will be the same as those of the unprojected field. This 
-    style is typically only useful for datasets such as 3D FITS cubes where 
+    method is typically only useful for datasets such as 3D FITS cubes where 
     the third axis of the dataset is something like velocity or frequency.
 
 .. _off-axis-projections:

diff -r 64c466c241dccbffa835bfe3c8ee042996a03273 -r 90dad9d0c93ba29a7ce3ed072c09a391d758fdf1 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -186,11 +186,14 @@
     data_source : `yt.data_objects.api.AMRData`, optional
         If specified, this will be the data source used for selecting
         regions to project.
-    style : string, optional
-        The style of projection to be performed.
+    method : string, optional
+        The method of projection to be performed.
         "integrate" : integration along the axis
         "mip" : maximum intensity projection
         "sum" : same as "integrate", except that we don't multiply by the path length
+    style : string, optional
+        The same as the method keyword.  Deprecated as of version 3.0.2.  
+        Please use method keyword instead.
     field_parameters : dict of items
         Values to be passed as field parameters that can be
         accessed by generated fields.
@@ -208,20 +211,26 @@
     _container_fields = ('px', 'py', 'pdx', 'pdy', 'weight_field')
     def __init__(self, field, axis, weight_field = None,
                  center = None, ds = None, data_source = None,
-                 style = "integrate", field_parameters = None):
+                 style = None, method = "integrate", 
+                 field_parameters = None):
         YTSelectionContainer2D.__init__(self, axis, ds, field_parameters)
-        if style == "sum":
-            self.proj_style = "integrate"
+        # Style is deprecated, but if it is set, then it trumps method
+        # keyword.  TODO: Remove this keyword and this check at some point in 
+        # the future.
+        if style is not None:
+            method = style
+        if method == "sum":
+            self.method = "integrate"
             self._sum_only = True
         else:
-            self.proj_style = style
+            self.method = method
             self._sum_only = False
-        if style == "mip":
+        if self.method == "mip":
             self.func = np.max
-        elif style == "integrate" or style == "sum":
+        elif self.method == "integrate":
             self.func = np.sum # for the future
         else:
-            raise NotImplementedError(style)
+            raise NotImplementedError(self.method)
         self._set_center(center)
         if data_source is None: data_source = self.ds.all_data()
         for k, v in data_source.field_parameters.items():
@@ -260,7 +269,7 @@
                   self.ds.domain_left_edge[xax],
                   self.ds.domain_right_edge[yax])
         return QuadTree(np.array([xd,yd], dtype='int64'), nvals,
-                        bounds, style = self.proj_style)
+                        bounds, method = self.method)
 
     def get_data(self, fields = None):
         fields = fields or []
@@ -282,10 +291,10 @@
                     get_memory_usage()/1024.)
                 self._handle_chunk(chunk, fields, tree)
         # Note that this will briefly double RAM usage
-        if self.proj_style == "mip":
+        if self.method == "mip":
             merge_style = -1
             op = "max"
-        elif self.proj_style == "integrate":
+        elif self.method == "integrate":
             merge_style = 1
             op = "sum"
         else:
@@ -324,7 +333,10 @@
             finfo = self.ds._get_field_info(*field)
             mylog.debug("Setting field %s", field)
             units = finfo.units
-            if self.weight_field is None and not self._sum_only:
+            # add length units to "projected units" if non-weighted 
+            # integral projection
+            if self.weight_field is None and not self._sum_only and \
+               self.method == 'integrate':
                 # See _handle_chunk where we mandate cm
                 if units == '':
                     input_units = "cm"
@@ -336,7 +348,9 @@
             self[field] = YTArray(field_data[fi].ravel(),
                                   input_units=input_units,
                                   registry=self.ds.unit_registry)
-            if self.weight_field is None and not self._sum_only:
+            # convert units if non-weighted integral projection
+            if self.weight_field is None and not self._sum_only and \
+               self.method == 'integrate':
                 u_obj = Unit(units, registry=self.ds.unit_registry)
                 if ((u_obj.is_code_unit or self.ds.no_cgs_equiv_length) and
                     not u_obj.is_dimensionless) and input_units != units:
@@ -355,7 +369,7 @@
         tree.initialize_chunk(i1, i2, ilevel)
 
     def _handle_chunk(self, chunk, fields, tree):
-        if self.proj_style == "mip" or self._sum_only:
+        if self.method == "mip" or self._sum_only:
             dl = 1.0
         else:
             # This gets explicitly converted to cm

diff -r 64c466c241dccbffa835bfe3c8ee042996a03273 -r 90dad9d0c93ba29a7ce3ed072c09a391d758fdf1 yt/utilities/lib/QuadTree.pyx
--- a/yt/utilities/lib/QuadTree.pyx
+++ b/yt/utilities/lib/QuadTree.pyx
@@ -113,10 +113,10 @@
     cdef np.int64_t last_dims[2]
 
     def __cinit__(self, np.ndarray[np.int64_t, ndim=1] top_grid_dims,
-                  int nvals, bounds, style = "integrate"):
-        if style == "integrate":
+                  int nvals, bounds, method = "integrate"):
+        if method == "integrate":
             self.combine = QTN_add_value
-        elif style == "mip":
+        elif method == "mip":
             self.combine = QTN_max_value
         else:
             raise NotImplementedError
@@ -212,10 +212,10 @@
     def frombuffer(self, np.ndarray[np.int32_t, ndim=1] refined,
                          np.ndarray[np.float64_t, ndim=2] values,
                          np.ndarray[np.float64_t, ndim=1] wval,
-                         style):
-        if style == "mip" or style == -1:
+                         method):
+        if method == "mip" or method == -1:
             self.merged = -1
-        elif style == "integrate" or style == 1:
+        elif method == "integrate" or method == 1:
             self.merged = 1
         cdef int curpos = 0
         cdef QuadTreeNode *root
@@ -348,11 +348,11 @@
     @cython.boundscheck(False)
     @cython.wraparound(False)
     @cython.cdivision(True)
-    def get_all(self, int count_only = 0, int style = 1):
+    def get_all(self, int count_only = 0, int method = 1):
         cdef int i, j, vi
         cdef int total = 0
         vals = []
-        self.merged = style
+        self.merged = method
         for i in range(self.top_grid_dims[0]):
             for j in range(self.top_grid_dims[1]):
                 total += self.count(self.root_nodes[i][j])
@@ -540,14 +540,14 @@
     else:
         raise RuntimeError
 
-def merge_quadtrees(QuadTree qt1, QuadTree qt2, style = 1):
+def merge_quadtrees(QuadTree qt1, QuadTree qt2, method = 1):
     cdef int i, j
     qt1.num_cells = 0
     cdef QTN_combine *func
-    if style == 1:
+    if method == 1:
         qt1.merged = 1
         func = QTN_add_value
-    elif style == -1:
+    elif method == -1:
         qt1.merged = -1
         func = QTN_max_value
     else:

diff -r 64c466c241dccbffa835bfe3c8ee042996a03273 -r 90dad9d0c93ba29a7ce3ed072c09a391d758fdf1 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -1109,6 +1109,27 @@
          The maximum level to project to.
     fontsize : integer
          The size of the fonts for the axis, colorbar, and tick labels.
+    method : string
+         The method of projection.  Valid methods are: 
+
+         "integrate" with no weight_field specified : integrate the requested
+         field along the line of sight.
+
+         "integrate" with a weight_field specified : weight the requested
+         field by the weighting field and integrate along the line of sight.
+
+         "mip" : pick out the maximum value of the field in the line of sight.
+
+         "sum" : This method is the same as integrate, except that it does not 
+         multiply by a path length when performing the integration, and is 
+         just a straight summation of the field along the given axis. 
+    proj_style : string
+         The method of projection--same as method keyword.  Deprecated as of 
+         version 3.0.2.  Please use method instead.
+    window_size : float
+         The size of the window in inches. Set to 8 by default.
+    aspect : float
+         The aspect ratio of the plot.  Set to None for 1.
     field_parameters : dictionary
          A dictionary of field parameters than can be accessed by derived
          fields.
@@ -1130,20 +1151,25 @@
     def __init__(self, ds, 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,
-                 proj_style = "integrate", window_size=8.0, aspect=None):
+                 method = "integrate", proj_style = None, window_size=8.0, 
+                 aspect=None):
         ts = self._initialize_dataset(ds)
         self.ts = ts
         ds = self.ds = ts[0]
         axis = fix_axis(axis, ds)
+        # proj_style is deprecated, but if someone specifies then it trumps 
+        # method.
+        if proj_style is not None:
+            method = proj_style
         # If a non-weighted integral projection, assure field-label reflects that
-        if weight_field is None and proj_style == "integrate":
+        if weight_field is None and method == "integrate":
             self.projected = True
         (bounds, center, display_center) = \
                 get_window_parameters(axis, center, width, ds)
         if field_parameters is None: field_parameters = {}
         proj = ds.proj(fields, axis, weight_field=weight_field,
                        center=center, data_source=data_source,
-                       field_parameters = field_parameters, style = proj_style)
+                       field_parameters = field_parameters, method = method)
         PWViewerMPL.__init__(self, proj, bounds, fields=fields, origin=origin,
                              fontsize=fontsize, window_size=window_size, 
                              aspect=aspect)
@@ -1236,7 +1262,7 @@
 
 class OffAxisProjectionDummyDataSource(object):
     _type_name = 'proj'
-    proj_style = 'integrate'
+    method = 'integrate'
     _key_fields = []
     def __init__(self, center, ds, normal_vector, width, fields,
                  interpolated, resolution = (800,800), weight=None,
@@ -1348,7 +1374,7 @@
             weight=weight_field,  volume=volume, no_ghost=no_ghost,
             le=le, re=re, north_vector=north_vector)
         # If a non-weighted, integral projection, assure field-label reflects that
-        if weight_field is None and OffAxisProj.proj_style == "integrate":
+        if weight_field is None and OffAxisProj.method == "integrate":
             self.projected = True
         # Hard-coding the origin keyword since the other two options
         # aren't well-defined for off-axis data objects
@@ -1542,7 +1568,7 @@
         if source._type_name in ("slice", "cutting"):
             units = finfo.get_units()
         elif source._type_name == "proj":
-            if source.weight_field is not None or source.proj_style in ("mip", "sum"):
+            if source.weight_field is not None or source.method in ("mip", "sum"):
                 units = finfo.get_units()
             else:
                 units = finfo.get_projected_units()

diff -r 64c466c241dccbffa835bfe3c8ee042996a03273 -r 90dad9d0c93ba29a7ce3ed072c09a391d758fdf1 yt/visualization/tests/test_plotwindow.py
--- a/yt/visualization/tests/test_plotwindow.py
+++ b/yt/visualization/tests/test_plotwindow.py
@@ -146,6 +146,12 @@
     ('gas', 'density'),
 )
 
+PROJECTION_METHODS = (
+    'integrate',
+    'sum',
+    'mip'
+)
+
 @requires_ds(M7)
 def test_attributes():
     """Test plot member functions that aren't callbacks"""
@@ -240,6 +246,7 @@
         projections_c = []
         projections_wf = []
         projections_w = {}
+        projections_m = []
         for dim in range(3):
             projections.append(ProjectionPlot(test_ds, dim, "density"))
             projections_ds.append(ProjectionPlot(test_ds, dim, "density",
@@ -253,6 +260,9 @@
         for wf in WEIGHT_FIELDS:
             projections_wf.append(ProjectionPlot(test_ds, dim, "density",
                                                  weight_field=wf))
+        for m in PROJECTION_METHODS:
+            projections_m.append(ProjectionPlot(test_ds, dim, "density",
+                                                 method=m))
 
         cls.slices = [SlicePlot(test_ds, dim, "density") for dim in range(3)]
         cls.projections = projections
@@ -260,6 +270,7 @@
         cls.projections_c = projections_c
         cls.projections_wf = projections_wf
         cls.projections_w = projections_w
+        cls.projections_m = projections_m
         cls.offaxis_slice = OffAxisSlicePlot(test_ds, normal, "density")
         cls.offaxis_proj = OffAxisProjectionPlot(test_ds, normal, "density")
 
@@ -296,6 +307,10 @@
     def test_projection_plot_wf(self, dim):
         self.projections_wf[dim].save()
 
+    @parameterized.expand([(i, ) for i in range(len(PROJECTION_METHODS))])
+    def test_projection_plot_m(self, dim):
+        self.projections_m[dim].save()
+
     @parameterized.expand(
         param.explicit((fname, ))
         for fname in TEST_FLNMS)

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.



More information about the yt-svn mailing list