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

Bitbucket commits-noreply at bitbucket.org
Fri Aug 10 04:59:44 PDT 2012


2 new commits in yt-3.0:


https://bitbucket.org/yt_analysis/yt-3.0/changeset/b30a08d98d4c/
changeset:   b30a08d98d4c
branch:      yt-3.0
user:        MatthewTurk
date:        2012-08-10 13:17:20
summary:     Switching the projection arguments order.  Closes #292.
affected #:  10 files

diff -r 0f3bd806c1fdbd8f4080e0a34c7f04ca2f6160c5 -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e yt/analysis_modules/cosmological_observation/light_cone/light_cone_projection.py
--- a/yt/analysis_modules/cosmological_observation/light_cone/light_cone_projection.py
+++ b/yt/analysis_modules/cosmological_observation/light_cone/light_cone_projection.py
@@ -82,7 +82,7 @@
         these_field_cuts.append(cut_mask)
 
     # Make projection.
-    proj = lightConeSlice['object'].h.proj(lightConeSlice['projection_axis'], field,
+    proj = lightConeSlice['object'].h.proj(field, lightConeSlice['projection_axis'], 
                                            weight_field, center=region_center,
                                            field_cuts=these_field_cuts, node_name=node_name)
 


diff -r 0f3bd806c1fdbd8f4080e0a34c7f04ca2f6160c5 -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e yt/analysis_modules/halo_profiler/multi_halo_profiler.py
--- a/yt/analysis_modules/halo_profiler/multi_halo_profiler.py
+++ b/yt/analysis_modules/halo_profiler/multi_halo_profiler.py
@@ -802,7 +802,7 @@
                 y_axis = coords[1]
 
                 for hp in self.projection_fields:
-                    projections.append(self.pf.h.proj(w, hp['field'],
+                    projections.append(self.pf.h.proj(hp['field'], w,
                                                       weight_field=hp['weight_field'],
                                                       source=region, center=halo['center'],
                                                       serialize=False))


diff -r 0f3bd806c1fdbd8f4080e0a34c7f04ca2f6160c5 -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -153,7 +153,7 @@
     _key_fields = YTSelectionContainer2D._key_fields + ['weight_field']
     _type_name = "proj"
     _con_args = ('axis', 'field', 'weight_field')
-    def __init__(self, axis, field, weight_field = None,
+    def __init__(self, field, axis, weight_field = None,
                  max_level = None, center = None, pf = None,
                  source=None, node_name = None, field_cuts = None,
                  preload_style='level', serialize=True,
@@ -177,12 +177,12 @@
 
         Parameters
         ----------
-        axis : int
-            The axis along which to slice.  Can be 0, 1, or 2 for x, y, z.
         field : string
             This is the field which will be "projected" along the axis.  If
             multiple are specified (in a list) they will all be projected in
             the first pass.
+        axis : int
+            The axis along which to slice.  Can be 0, 1, or 2 for x, y, z.
         weight_field : string
             If supplied, the field being projected will be multiplied by this
             weight value before being integrated, and at the conclusion of the
@@ -217,7 +217,7 @@
         --------
 
         >>> pf = load("RedshiftOutput0005")
-        >>> qproj = pf.h.quad_proj(0, "Density")
+        >>> qproj = pf.h.proj("Density", 0)
         >>> print qproj["Density"]
         """
         YTSelectionContainer2D.__init__(self, axis, field, pf, node_name = None, **kwargs)
@@ -484,7 +484,7 @@
     _key_fields = YTSelectionContainer2D._key_fields + ['weight_field']
     _type_name = "overlap_proj"
     _con_args = ('axis', 'field', 'weight_field')
-    def __init__(self, axis, field, weight_field = None,
+    def __init__(self, field, axis, weight_field = None,
                  max_level = None, center = None, pf = None,
                  source=None, node_name = None, field_cuts = None,
                  preload_style=None, serialize=True, **kwargs):
@@ -503,12 +503,12 @@
 
         Parameters
         ----------
-        axis : int
-            The axis along which to slice.  Can be 0, 1, or 2 for x, y, z.
         field : string
             This is the field which will be "projected" along the axis.  If
             multiple are specified (in a list) they will all be projected in
             the first pass.
+        axis : int or axis
+            The axis along which to slice.  Can be 0, 1, or 2 for x, y, z.
         weight_field : string
             If supplied, the field being projected will be multiplied by this
             weight value before being integrated, and at the conclusion of the
@@ -543,7 +543,7 @@
         --------
 
         >>> pf = load("RedshiftOutput0005")
-        >>> proj = pf.h.proj(0, "Density")
+        >>> proj = pf.h.proj("Density", "x")
         >>> print proj["Density"]
         """
         YTSelectionContainer2D.__init__(self, axis, field, pf, node_name = None, **kwargs)


diff -r 0f3bd806c1fdbd8f4080e0a34c7f04ca2f6160c5 -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -586,7 +586,7 @@
         Examples
         --------
 
-        >>> proj = pf.h.proj(0, "Density")
+        >>> proj = pf.h.proj("Density", 0)
         >>> frb = proj.to_frb( (100.0, 'kpc'), 1024)
         >>> write_image(na.log10(frb["Density"]), 'density_100kpc.png')
         """


diff -r 0f3bd806c1fdbd8f4080e0a34c7f04ca2f6160c5 -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e yt/gui/reason/widget_store.py
--- a/yt/gui/reason/widget_store.py
+++ b/yt/gui/reason/widget_store.py
@@ -92,7 +92,7 @@
     def create_proj(self, pf, axis, field, weight):
         if weight == "None": weight = None
         axis = inv_axis_names[axis.lower()]
-        proj = pf.h.proj(axis,field, weight_field=weight, periodic = True)
+        proj = pf.h.proj(field, axis, weight_field=weight, periodic = True)
         xax, yax = x_dict[axis], y_dict[axis]
         DLE, DRE = pf.domain_left_edge, pf.domain_right_edge
         pw = PWViewerExtJS(proj, (DLE[xax], DRE[xax], DLE[yax], DRE[yax]),


diff -r 0f3bd806c1fdbd8f4080e0a34c7f04ca2f6160c5 -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e yt/utilities/answer_testing/default_tests.py
--- a/yt/utilities/answer_testing/default_tests.py
+++ b/yt/utilities/answer_testing/default_tests.py
@@ -59,7 +59,7 @@
             if self.pf.field_info[field].particle_type: continue
             results[field] = []
             for ax in range(3):
-                t = self.pf.h.proj(ax, field)
+                t = self.pf.h.proj(field, ax)
                 results[field].append(t.field_data)
         self.result = results
 


diff -r 0f3bd806c1fdbd8f4080e0a34c7f04ca2f6160c5 -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e yt/utilities/answer_testing/hydro_tests.py
--- a/yt/utilities/answer_testing/hydro_tests.py
+++ b/yt/utilities/answer_testing/hydro_tests.py
@@ -37,7 +37,7 @@
     def run(self):
         # First we get our flattened projection -- this is the
         # Density, px, py, pdx, and pdy
-        proj = self.pf.h.proj(self.axis, self.field,
+        proj = self.pf.h.proj(self.field, self.axis, 
                               weight_field=self.weight_field)
         # Now let's stick it in a buffer
         pixelized_proj = self.pixelize(proj, self.field)


diff -r 0f3bd806c1fdbd8f4080e0a34c7f04ca2f6160c5 -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e yt/visualization/fixed_resolution.py
--- a/yt/visualization/fixed_resolution.py
+++ b/yt/visualization/fixed_resolution.py
@@ -81,7 +81,7 @@
         To make a projection and then several images, you can generate a
         single FRB and then access multiple fields:
 
-        >>> proj = pf.h.proj(0, "Density")
+        >>> proj = pf.h.proj("Density", "y")
         >>> frb1 = FixedResolutionBuffer(proj, (0.2, 0.3, 0.4, 0.5),
                         (1024, 1024))
         >>> print frb1["Density"].max()


diff -r 0f3bd806c1fdbd8f4080e0a34c7f04ca2f6160c5 -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e yt/visualization/plot_collection.py
--- a/yt/visualization/plot_collection.py
+++ b/yt/visualization/plot_collection.py
@@ -779,7 +779,7 @@
         if center == None:
             center = self.c
         if obj is None:
-            obj = self.pf.hierarchy.proj(axis, field, weight_field,
+            obj = self.pf.hierarchy.proj(field, axis, weight_field,
                                          source = data_source, center=center,
                                          **field_parameters)
         p = self._add_plot(PCProjectionPlot(obj, field,
@@ -873,7 +873,7 @@
         LE[axis] -= thickness/2.0
         RE[axis] += thickness/2.0
         region = self.pf.h.region(center, LE, RE)
-        obj = self.pf.hierarchy.proj(axis, field, weight_field,
+        obj = self.pf.hierarchy.proj(field, axis, weight_field,
                                      source = region, center=center,
                                      **field_parameters)
         p = self._add_plot(PCProjectionPlot(obj, field,
@@ -1363,7 +1363,7 @@
         angular momentum vector.
 
         >>> pf = load("RD0005-mine/RedshiftOutput0005")
-        >>> proj = pf.h.proj(0, "Density")
+        >>> proj = pf.h.proj("Density", 0)
         >>> frb = FixedResolutionBuffer(proj, (0.2, 0.3, 0.4, 0.5), (512, 512))
         >>> p = pc.add_fixed_resolution_plot(frb, "Density")
         """
@@ -1823,7 +1823,7 @@
     --------
 
     >>> pf = load("DD0030/DD0030")
-    >>> p = pf.h.proj(0, "Density")
+    >>> p = pf.h.proj("Density", "z")
     >>> matplotlib_widget(p, "Density", 1024)
 
     """


diff -r 0f3bd806c1fdbd8f4080e0a34c7f04ca2f6160c5 -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -867,13 +867,13 @@
         This is a very simple way of creating a projection plot.
         
         >>> pf = load('galaxy0030/galaxy0030')
-        >>> p = ProjectionPlot(pf,2,'Density','c',(20,'kpc'))
+        >>> p = ProjectionPlot(pf, 'z', 'Density', 'c', (20,'kpc'))
         >>> p.save('sliceplot')
         
         """
         axis = fix_axis(axis)
         (bounds,center) = GetBoundsAndCenter(axis,center,width,pf)
-        proj = pf.h.proj(axis,fields,weight_field=weight_field,max_level=max_level,center=center)
+        proj = pf.h.proj(fields, axis, weight_field=weight_field,max_level=max_level,center=center)
         PWViewerMPL.__init__(self,proj,bounds,origin=origin)
 
 class OffAxisSlicePlot(PWViewerMPL):



https://bitbucket.org/yt_analysis/yt-3.0/changeset/e5e4c9adfee2/
changeset:   e5e4c9adfee2
branch:      yt-3.0
user:        MatthewTurk
date:        2012-08-10 13:59:35
summary:     Removing a considerable amount of machinery that is largely not necessary,
unused, or that should be replaced.

 * All serialization functions have been removed, to be replaced with more
   modern routines once this branch has reached basic functionality.
 * Most pre-loading of fields has been removed, and the arguments to the
   YTSelectionContainer / YTDataContainer objects have been updated
 * Bare kwargs have been replaced with explicit field_parameters arguments.
   This should ensure that typo'd arguments don't get passed as
   field_parameters instead of as the argument they're meant as.  (Field
   parameters will eventually be replaced with explicit objects tied to
   strings, so that unknown parameters can be identified.)
 * The .fields property on data containers has been removed, as it was
   mostly degenerate with the keys in field_data.
 * A number of dicts that cached indices and the like have been removed.
affected #:  3 files

diff -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e -r e5e4c9adfee291745cfcb3aa7dab109874e46de4 yt/data_objects/construction_data_containers.py
--- a/yt/data_objects/construction_data_containers.py
+++ b/yt/data_objects/construction_data_containers.py
@@ -245,9 +245,7 @@
         self._max_level = max_level
         self._weight = weight_field
         self.preload_style = preload_style
-        self._deserialize(node_name)
         self._refresh_data()
-        if self._okay_to_serialize and self.serialize: self._serialize(node_name=self._node_name)
 
     @property
     def _mrep(self):
@@ -261,24 +259,6 @@
         if field in self._key_fields: return field
         return "%s_%s" % (field, self._weight)
 
-    def _initialize_source(self, source = None):
-        if source is None:
-            source = self.pf.h.all_data()
-            self._check_region = False
-            #self._okay_to_serialize = (not check)
-        else:
-            self._distributed = False
-            self._okay_to_serialize = False
-            self._check_region = True
-        self.source = source
-        if self._field_cuts is not None:
-            # Override if field cuts are around; we don't want to serialize!
-            self._check_region = True
-            self._okay_to_serialize = False
-        if self._node_name is not None:
-            self._node_name = "%s/%s" % (self._top_node,self._node_name)
-            self._okay_to_serialize = True
-
     def _get_tree(self, nvals):
         xd = self.pf.domain_dimensions[x_dict[self.axis]]
         yd = self.pf.domain_dimensions[y_dict[self.axis]]
@@ -301,9 +281,8 @@
             convs[:] = 1.0
         return dls, convs
 
-    def get_data(self, fields = None):
-        if fields is None: fields = ensure_list(self.fields)[:]
-        else: fields = ensure_list(fields)
+    def get_data(self, fields):
+        fields = ensure_list(fields)
         # We need a new tree for every single set of fields we add
         self._obtain_fields(fields, self._node_name)
         fields = [f for f in fields if f not in self.field_data]
@@ -722,9 +701,8 @@
                 raise ValueError(grid1, self.__retval_coords[grid1.id])
         pbar.finish()
 
-    def get_data(self, fields = None):
-        if fields is None: fields = ensure_list(self.fields)[:]
-        else: fields = ensure_list(fields)
+    def get_data(self, fields):
+        fields = ensure_list(fields)
         self._obtain_fields(fields, self._node_name)
         fields = [f for f in fields if f not in self.field_data]
         if len(fields) == 0: return
@@ -916,13 +894,10 @@
         self['dy'] = self.dds[1] * na.ones(self.ActiveDimensions, dtype='float64')
         self['dz'] = self.dds[2] * na.ones(self.ActiveDimensions, dtype='float64')
 
-    def get_data(self, fields=None):
+    def get_data(self, fields):
         if self._grids is None:
             self._get_list_of_grids()
-        if fields is None:
-            fields = self.fields[:]
-        else:
-            fields = ensure_list(fields)
+        fields = ensure_list(fields)
         obtain_fields = []
         for field in fields:
             if self.field_data.has_key(field): continue
@@ -960,7 +935,7 @@
         else: # Can't find the field, try as it might
             raise KeyError(field)
 
-    def flush_data(self, field=None):
+    def flush_data(self, fields=None):
         """
         Any modifications made to the data in this object are pushed back
         to the originating grids, except the cells where those grids are both
@@ -968,12 +943,8 @@
         """
         self._get_list_of_grids()
         # We don't generate coordinates here.
-        if field == None:
-            fields_to_get = self.fields[:]
-        else:
-            fields_to_get = ensure_list(field)
         for grid in self._grids:
-            self._flush_data_to_grid(grid, fields_to_get)
+            self._flush_data_to_grid(grid, ensure_list(fields))
 
     def _get_data_from_grid(self, grid, fields):
         ll = int(grid.Level == self.level)
@@ -1055,13 +1026,10 @@
         # We reverse the order to ensure that coarse grids are first
         self._grids = self._grids[::-1]
 
-    def get_data(self, field=None):
+    def get_data(self, field):
         self._get_list_of_grids()
         # We don't generate coordinates here.
-        if field == None:
-            fields_to_get = self.fields[:]
-        else:
-            fields_to_get = ensure_list(field)
+        fields_to_get = ensure_list(field)
         fields_to_get = [f for f in fields_to_get if f not in self.field_data]
         # Note that, thanks to some trickery, we have different dimensions
         # on the field than one might think from looking at the dx and the
@@ -1157,8 +1125,8 @@
     _top_node = "/Projections"
     _type_name = "fixed_res_proj"
     _con_args = ('axis', 'field', 'weight_field')
-    def __init__(self, axis, level, left_edge, dims,
-                 fields = None, pf=None, **kwargs):
+    def __init__(self, axis, level, left_edge, dims, pf=None,
+                 field_parameters = None):
         """
         This is a data structure that projects grids, but only to fixed (rather
         than variable) resolution.
@@ -1185,10 +1153,7 @@
         dims : array of ints
             The dimensions of the projection (which, in concert with the
             left_edge, serves to define its right edge.)
-        fields : list of strings, optional
-            If you want the object to pre-retrieve a set of fields, supply them
-            here.  This is not necessary.
-        kwargs : dict of items
+        field_parameters : dict of items
             Any additional values are passed as field parameters that can be
             accessed by generated fields.
 
@@ -1199,7 +1164,7 @@
         >>> fproj = pf.h.fixed_res_proj(1, [0, 0, 0], [64, 64, 64], ["Density"])
         >>> print fproj["Density"]
         """
-        YTSelectionContainer2D.__init__(self, axis, fields, pf, **kwargs)
+        YTSelectionContainer2D.__init__(self, axis, pf, field_parameters)
         self.left_edge = na.array(left_edge)
         self.level = level
         self.dds = self.pf.h.select_grids(self.level)[0].dds.copy()
@@ -1241,17 +1206,14 @@
         self['pdy'] = self.dds[yax]
 
     #@time_execution
-    def get_data(self, fields = None):
+    def get_data(self, fields):
         """
         Iterates over the list of fields and generates/reads them all.
         """
         self._get_list_of_grids()
         if not self.has_key('pdx'):
             self._generate_coords()
-        if fields == None:
-            fields_to_get = [f for f in self.fields if f not in self._key_fields]
-        else:
-            fields_to_get = ensure_list(fields)
+        fields_to_get = ensure_list(fields)
         if len(fields_to_get) == 0: return
         temp_data = {}
         for field in fields_to_get:


diff -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e -r e5e4c9adfee291745cfcb3aa7dab109874e46de4 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -99,7 +99,7 @@
             if hasattr(cls, "_type_name") and not cls._skip_add:
                 data_object_registry[cls._type_name] = cls
 
-    def __init__(self, pf, fields, **kwargs):
+    def __init__(self, pf, field_parameters):
         """
         Typically this is never called directly, but only due to inheritance.
         It associates a :class:`~yt.data_objects.api.StaticOutput` with the class,
@@ -111,19 +111,15 @@
             self.hierarchy = pf.hierarchy
         self.hierarchy.objects.append(weakref.proxy(self))
         mylog.debug("Appending object to %s (type: %s)", self.pf, type(self))
-        if fields == None: fields = []
-        self.fields = ensure_list(fields)[:]
         self.field_data = YTFieldData()
-        self.field_parameters = {}
-        self.__set_default_field_parameters()
-        self._cut_masks = {}
-        self._point_indices = {}
-        self._vc_data = {}
-        for key, val in kwargs.items():
+        if field_parameters is None: field_parameters = {}
+        self._set_default_field_parameters()
+        for key, val in field_parameters.items():
             mylog.debug("Setting %s to %s", key, val)
             self.set_field_parameter(key, val)
 
-    def __set_default_field_parameters(self):
+    def _set_default_field_parameters(self):
+        self.field_parameters = {}
         self.set_field_parameter("center",na.zeros(3,dtype='float64'))
         self.set_field_parameter("bulk_velocity",na.zeros(3,dtype='float64'))
 
@@ -179,15 +175,6 @@
         """
         self.field_data.clear()
 
-    def clear_cache(self):
-        """
-        Clears out all cache, freeing memory.
-        """
-        for _cm in self._cut_masks: del _cm
-        for _pi in self._point_indices: del _pi
-        for _field in self._vc_data:
-            for _vc in _field: del _vc
-
     def has_key(self, key):
         """
         Checks if a data field already exists.
@@ -214,17 +201,12 @@
         """
         Sets a field to be some other value.
         """
-        if key not in self.fields: self.fields.append(key)
         self.field_data[key] = val
 
     def __delitem__(self, key):
         """
         Deletes a field
         """
-        try:
-            del self.fields[self.fields.index(key)]
-        except ValueError:
-            pass
         del self.field_data[key]
 
     def _generate_field(self, field):
@@ -528,8 +510,9 @@
 
 class YTSelectionContainer1D(YTSelectionContainer):
     _spatial = False
-    def __init__(self, pf, fields, **kwargs):
-        super(YTSelectionContainer1D, self).__init__(pf, fields, **kwargs)
+    def __init__(self, pf, field_parameters):
+        super(YTSelectionContainer1D, self).__init__(
+            pf, field_parameters)
         self._grids = None
         self._sortkey = None
         self._sorted = {}
@@ -541,16 +524,16 @@
     thus does not have as many actions as the 3-D data types.
     """
     _spatial = False
-    def __init__(self, axis, fields, pf=None, **kwargs):
+    def __init__(self, axis, pf, field_parameters):
         """
         Prepares the YTSelectionContainer2D, normal to *axis*.  If *axis* is 4, we are not
         aligned with any axis.
         """
         ParallelAnalysisInterface.__init__(self)
         self.axis = axis
-        super(YTSelectionContainer2D, self).__init__(pf, fields, **kwargs)
-        self.field = ensure_list(fields)[0]
-        self.set_field_parameter("axis",axis)
+        super(YTSelectionContainer2D, self).__init__(
+            pf, field_parameters)
+        self.set_field_parameter("axis", axis)
         
     def _convert_field_name(self, field):
         return field
@@ -633,42 +616,6 @@
         pw = PWViewerMPL(self, bounds)
         return pw
 
-    _okay_to_serialize = True
-
-    def _store_fields(self, fields, node_name = None, force = False):
-        fields = ensure_list(fields)
-        if node_name is None: node_name = self._gen_node_name()
-        for field in fields:
-            #mylog.debug("Storing %s in node %s",
-                #self._convert_field_name(field), node_name)
-            self.hierarchy.save_data(self[field], node_name,
-                self._convert_field_name(field), force = force,
-                passthrough = True)
-
-    def _obtain_fields(self, fields, node_name = None):
-        if not self._okay_to_serialize: return
-        fields = ensure_list(fields)
-        if node_name is None: node_name = self._gen_node_name()
-        for field in fields:
-            #mylog.debug("Trying to obtain %s from node %s",
-                #self._convert_field_name(field), node_name)
-            fdata=self.hierarchy.get_data(node_name, 
-                self._convert_field_name(field))
-            if fdata is not None:
-                #mylog.debug("Got %s from node %s", field, node_name)
-                self[field] = fdata[:]
-        return True
-
-    def _deserialize(self, node_name = None):
-        if not self._okay_to_serialize: return
-        self._obtain_fields(self._key_fields, node_name)
-        self._obtain_fields(self.fields, node_name)
-
-    def _serialize(self, node_name = None, force = False):
-        if not self._okay_to_serialize: return
-        self._store_fields(self._key_fields, node_name, force)
-        self._store_fields(self.fields, node_name, force)
-
 class YTSelectionContainer3D(YTSelectionContainer):
     _key_fields = ['x','y','z','dx','dy','dz']
     """
@@ -677,14 +624,14 @@
     """
     _spatial = False
     _num_ghost_zones = 0
-    def __init__(self, center, fields, pf = None, **kwargs):
+    def __init__(self, center, pf = None, field_parameters = None):
         """
         Returns an instance of YTSelectionContainer3D, or prepares one.  Usually only
         used as a base class.  Note that *center* is supplied, but only used
         for fields and quantities that require it.
         """
         ParallelAnalysisInterface.__init__(self)
-        super(YTSelectionContainer3D, self).__init__(pf, fields, **kwargs)
+        super(YTSelectionContainer3D, self).__init__(pf, field_parameters)
         self._set_center(center)
         self.coords = None
         self._grids = None


diff -r b30a08d98d4c8f44bb2a5de91d68a00079a27d0e -r e5e4c9adfee291745cfcb3aa7dab109874e46de4 yt/data_objects/selection_data_containers.py
--- a/yt/data_objects/selection_data_containers.py
+++ b/yt/data_objects/selection_data_containers.py
@@ -52,7 +52,7 @@
     _key_fields = ['x','y','z','dx','dy','dz']
     _type_name = "ortho_ray"
     _con_args = ('axis', 'coords')
-    def __init__(self, axis, coords, fields=None, pf=None, **kwargs):
+    def __init__(self, axis, coords, pf=None, field_parameters = None):
         """
         This is an orthogonal ray cast through the entire domain, at a specific
         coordinate.
@@ -74,7 +74,7 @@
         fields : list of strings, optional
             If you want the object to pre-retrieve a set of fields, supply them
             here.  This is not necessary.
-        kwargs : dict of items
+        field_parameters : dict of items
             Any additional values are passed as field parameters that can be
             accessed by generated fields.
 
@@ -85,7 +85,7 @@
         >>> oray = pf.h.ortho_ray(0, (0.2, 0.74))
         >>> print oray["Density"]
         """
-        YTSelectionContainer1D.__init__(self, pf, fields, **kwargs)
+        super(YTOrthoRayBase, self).__init__(pf, field_parameters)
         self.axis = axis
         self.px_ax = x_dict[self.axis]
         self.py_ax = y_dict[self.axis]
@@ -102,7 +102,7 @@
     _type_name = "ray"
     _con_args = ('start_point', 'end_point')
     sort_by = 't'
-    def __init__(self, start_point, end_point, fields=None, pf=None, **kwargs):
+    def __init__(self, start_point, end_point, pf=None, field_parameters = None):
         """
         This is an arbitrarily-aligned ray cast through the entire domain, at a
         specific coordinate.
@@ -123,7 +123,7 @@
         fields : list of strings, optional
             If you want the object to pre-retrieve a set of fields, supply them
             here.  This is not necessary.
-        kwargs : dict of items
+        field_parameters : dict of items
             Any additional values are passed as field parameters that can be
             accessed by generated fields.
 
@@ -134,7 +134,7 @@
         >>> ray = pf.h._ray((0.2, 0.74, 0.11), (0.4, 0.91, 0.31))
         >>> print ray["Density"], ray["t"], ray["dts"]
         """
-        YTSelectionContainer1D.__init__(self, pf, fields, **kwargs)
+        super(YTRayBase, self).__init__(pf, field_parameters)
         self.start_point = na.array(start_point, dtype='float64')
         self.end_point = na.array(end_point, dtype='float64')
         self.vec = self.end_point - self.start_point
@@ -170,8 +170,8 @@
     _con_args = ('axis', 'coord')
     _container_fields = ("px", "py", "pdx", "pdy")
 
-    def __init__(self, axis, coord, fields = None, center=None, pf=None,
-                 node_name = False, **kwargs):
+    def __init__(self, axis, coord, center=None, pf=None,
+                 field_parameters = None):
         """
         This is a data object corresponding to a slice through the simulation
         domain.
@@ -190,16 +190,10 @@
         coord : float
             The coordinate along the axis at which to slice.  This is in
             "domain" coordinates.
-        fields : list of strings, optional
-            If you want the object to pre-retrieve a set of fields, supply them
-            here.  This is not necessary.
         center : array_like, optional
             The 'center' supplied to fields that use it.  Note that this does
             not have to have `coord` as one value.  Strictly optional.
-        node_name: string, optional
-            The node in the .yt file to find or store this slice at.  Should
-            probably not be used.
-        kwargs : dict of items
+        field_parameters : dict of items
             Any additional values are passed as field parameters that can be
             accessed by generated fields.
 
@@ -210,12 +204,9 @@
         >>> slice = pf.h.slice(0, 0.25)
         >>> print slice["Density"]
         """
-        YTSelectionContainer2D.__init__(self, axis, fields, pf, **kwargs)
+        YTSelectionContainer2D.__init__(self, axis, pf, field_parameters)
         self._set_center(center)
         self.coord = coord
-        if node_name is not False:
-            if node_name is True: self._deserialize()
-            else: self._deserialize(node_name)
 
     def reslice(self, coord):
         """
@@ -277,8 +268,8 @@
     _con_args = ('normal', 'center')
     _container_fields = ("px", "py", "pz", "pdx", "pdy", "pdz")
 
-    def __init__(self, normal, center, fields = None, node_name = None,
-                 north_vector = None, **kwargs):
+    def __init__(self, normal, center, pf = None,
+                 north_vector = None, field_parameters = None):
         """
         This is a data object corresponding to an oblique slice through the
         simulation domain.
@@ -300,10 +291,7 @@
         fields : list of strings, optional
             If you want the object to pre-retrieve a set of fields, supply them
             here.  This is not necessary.
-        node_name: string, optional
-            The node in the .yt file to find or store this slice at.  Should
-            probably not be used.
-        kwargs : dict of items
+        field_parameters : dict of items
             Any additional values are passed as field parameters that can be
             accessed by generated fields.
 
@@ -322,7 +310,7 @@
         >>> cp = pf.h.cutting([0.1, 0.2, -0.9], [0.5, 0.42, 0.6])
         >>> print cp["Density"]
         """
-        YTSelectionContainer2D.__init__(self, 4, fields, **kwargs)
+        YTSelectionContainer2D.__init__(self, 4, pf, field_parameters)
         self._set_center(center)
         self.set_field_parameter('center',center)
         # Let's set up our plane equation
@@ -340,20 +328,11 @@
         self.set_field_parameter('cp_x_vec',self._x_vec)
         self.set_field_parameter('cp_y_vec',self._y_vec)
         self.set_field_parameter('cp_z_vec',self._norm_vec)
-        if node_name is not False:
-            if node_name is True: self._deserialize()
-            else: self._deserialize(node_name)
 
     @property
     def normal(self):
         return self._norm_vec
 
-    def _gen_node_name(self):
-        cen_name = ("%s" % (self.center,)).replace(" ","_")[1:-1]
-        L_name = ("%s" % self._norm_vec).replace(" ","_")[1:-1]
-        return "%s/c%s_L%s" % \
-            (self._top_node, cen_name, L_name)
-
     def to_frb(self, width, resolution):
         r"""This function returns an ObliqueFixedResolutionBuffer generated
         from this object.
@@ -399,6 +378,7 @@
         bounds = (-width/2.0, width/2.0, -width/2.0, width/2.0)
         frb = ObliqueFixedResolutionBuffer(self, bounds, resolution)
         return frb
+
     def to_frb(self, width, resolution, height=None):
         r"""This function returns an ObliqueFixedResolutionBuffer generated
         from this object.
@@ -502,8 +482,8 @@
     _top_node = "/FixedResCuttingPlanes"
     _type_name = "fixed_res_cutting"
     _con_args = ('normal', 'center', 'width', 'dims')
-    def __init__(self, normal, center, width, dims, fields = None,
-                 node_name = None, **kwargs):
+    def __init__(self, normal, center, width, dims, pf = None,
+                 node_name = None, field_parameters = None):
         """
         The fixed resolution Cutting Plane slices at an oblique angle,
         where we use the *normal* vector at the *center* to define the
@@ -513,7 +493,7 @@
         #
         # Taken from Cutting Plane
         #
-        YTSelectionContainer2D.__init__(self, 4, fields, **kwargs)
+        YTSelectionContainer2D.__init__(self, 4, pf, field_parameters)
         self._set_center(center)
         self.width = width
         self.dims = dims
@@ -641,17 +621,14 @@
                       na.outer(_co[1,:,:], self._y_vec)
         self._pixelmask = na.ones(self.dims*self.dims, dtype='int8')
 
-    def get_data(self, fields = None):
+    def get_data(self, fields):
         """
         Iterates over the list of fields and generates/reads them all.
         """
         self._get_list_of_grids()
         if not self.has_key('pdx'):
             self._generate_coords()
-        if fields == None:
-            fields_to_get = self.fields[:]
-        else:
-            fields_to_get = ensure_list(fields)
+        fields_to_get = ensure_list(fields)
         temp_data = {}
         _size = self.dims * self.dims
         for field in fields_to_get:
@@ -659,8 +636,6 @@
             if field not in self.hierarchy.field_list:
                 if self._generate_field(field):
                     continue # A "True" return means we did it
-            if not self._vc_data.has_key(field):
-                self._vc_data[field] = {}
             self[field] = na.zeros(_size, dtype='float64')
             for grid in self._get_grids():
                 self._get_data_from_grid(grid, field)
@@ -916,7 +891,7 @@
     """
     _type_name = "sphere"
     _con_args = ('center', 'radius')
-    def __init__(self, center, radius, fields = None, pf = None, **kwargs):
+    def __init__(self, center, radius, pf = None, field_parameters = None):
         """A sphere f points defined by a *center* and a *radius*.
 
         Parameters
@@ -932,7 +907,7 @@
         >>> c = [0.5,0.5,0.5]
         >>> sphere = pf.h.sphere(c,1.*pf['kpc'])
         """
-        YTSelectionContainer3D.__init__(self, center, fields, pf, **kwargs)
+        super(YTSphereBase, self).__init__(center, pf, field_parameters)
         # Unpack the radius, if necessary
         radius = fix_length(radius, self.pf)
         if radius < self.hierarchy.get_smallest_dx():

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