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

Bitbucket commits-noreply at bitbucket.org
Fri May 27 13:57:25 PDT 2011


2 new changesets in yt:

http://bitbucket.org/yt_analysis/yt/changeset/66a63c7b9db8/
changeset:   66a63c7b9db8
branches:    
user:        MatthewTurk
date:        2011-05-27 18:33:41
summary:     More fixes for the Stream handler.
affected #:  2 files (921 bytes)

--- a/yt/frontends/stream/data_structures.py	Fri May 27 11:16:09 2011 -0400
+++ b/yt/frontends/stream/data_structures.py	Fri May 27 12:33:41 2011 -0400
@@ -47,6 +47,7 @@
     """
 
     __slots__ = ['proc_num']
+    _id_offset = 0
     def __init__(self, id, hierarchy):
         """
         Returns an instance of StreamGrid with *id*, associated with *filename*
@@ -127,7 +128,23 @@
         self.num_grids = self.stream_handler.num_grids
 
     def _setup_unknown_fields(self):
-        pass
+        for field in self.field_list:
+            if field in self.parameter_file.field_info: continue
+            mylog.info("Adding %s to list of fields", field)
+            cf = None
+            if self.parameter_file.has_key(field):
+                def external_wrapper(f):
+                    def _convert_function(data):
+                        return data.convert(f)
+                    return _convert_function
+                cf = external_wrapper(field)
+            # Note that we call add_field on the field_info directly.  This
+            # will allow the same field detection mechanism to work for 1D, 2D
+            # and 3D fields.
+            self.pf.field_info.add_field(
+                    field, lambda a, b: None,
+                    convert_function=cf, take_log=False)
+            
 
     def _parse_hierarchy(self):
         self.grid_dimensions = self.stream_handler.dimensions
@@ -144,11 +161,11 @@
         # We enumerate, so it's 0-indexed id and 1-indexed pid
         self.filenames = ["-1"] * self.num_grids
         for id,pid in enumerate(reverse_tree):
-            self.grids.append(self.grid(id+1, self))
+            self.grids.append(self.grid(id, self))
             self.grids[-1].Level = self.grid_levels[id, 0]
             if pid > 0:
                 self.grids[-1]._parent_id = pid
-                self.grids[pid-1]._children_ids.append(self.grids[-1].id)
+                self.grids[pid]._children_ids.append(self.grids[-1].id)
         self.max_level = self.grid_levels.max()
         mylog.debug("Preparing grids")
         for i, grid in enumerate(self.grids):
@@ -167,7 +184,7 @@
         pass
 
     def _detect_fields(self):
-        self.field_list = set(self.stream_handler.get_fields())
+        self.field_list = list(set(self.stream_handler.get_fields()))
 
     def _setup_derived_fields(self):
         self.derived_field_list = []
@@ -211,6 +228,8 @@
         StaticOutput.__init__(self, "InMemoryParameterFile", self._data_style)
 
         self.field_info = self._fieldinfo_class()
+        self.units = {}
+        self.time_units = {}
 
     def _parse_parameter_file(self):
         self.basename = self.stream_handler.name


--- a/yt/frontends/stream/io.py	Fri May 27 11:16:09 2011 -0400
+++ b/yt/frontends/stream/io.py	Fri May 27 12:33:41 2011 -0400
@@ -49,17 +49,17 @@
         # If it's particles, we copy.
         if len(tr.shape) == 1: return tr.copy()
         # New in-place unit conversion breaks if we don't copy first
-        return tr.swapaxes(0,2)[self.my_slice].copy()
+        return tr
 
     def modify(self, field):
-        return field.swapaxes(0,2)
+        return field
 
     def _read_field_names(self, grid):
         return self.fields[grid.id].keys()
 
     def _read_data_slice(self, grid, field, axis, coord):
-        sl = [slice(3,-3), slice(3,-3), slice(3,-3)]
-        sl[axis] = slice(coord + 3, coord + 4)
+        sl = [slice(0,-0), slice(0,-0), slice(0,-0)]
+        sl[axis] = slice(coord, coord + 1)
         sl = tuple(reversed(sl))
         tr = self.fields[grid.id][field][sl].swapaxes(0,2)
         # In-place unit conversion requires we return a copy


http://bitbucket.org/yt_analysis/yt/changeset/6d4a5588a550/
changeset:   6d4a5588a550
branches:    
user:        MatthewTurk
date:        2011-05-27 22:55:32
summary:     Identified the bug; this allows one to construct a dataset in memory.  For an
example, see:

http://paste.enzotools.org/show/1672/
affected #:  1 file (1 byte)

--- a/yt/frontends/stream/data_structures.py	Fri May 27 12:33:41 2011 -0400
+++ b/yt/frontends/stream/data_structures.py	Fri May 27 16:55:32 2011 -0400
@@ -163,7 +163,7 @@
         for id,pid in enumerate(reverse_tree):
             self.grids.append(self.grid(id, self))
             self.grids[-1].Level = self.grid_levels[id, 0]
-            if pid > 0:
+            if pid >= 0:
                 self.grids[-1]._parent_id = pid
                 self.grids[pid]._children_ids.append(self.grids[-1].id)
         self.max_level = self.grid_levels.max()

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