[Yt-svn] yt-commit r1415 - trunk/yt/lagos

britton at wrangler.dreamhost.com britton at wrangler.dreamhost.com
Fri Aug 28 14:34:00 PDT 2009


Author: britton
Date: Fri Aug 28 14:33:59 2009
New Revision: 1415
URL: http://yt.spacepope.org/changeset/1415

Log:
Fixed bug so that derived fields are now sorted correctly in AMROrthoRay.  
Thanks to Devin for his work on this.


Modified:
   trunk/yt/lagos/BaseDataTypes.py

Modified: trunk/yt/lagos/BaseDataTypes.py
==============================================================================
--- trunk/yt/lagos/BaseDataTypes.py	(original)
+++ trunk/yt/lagos/BaseDataTypes.py	Fri Aug 28 14:33:59 2009
@@ -368,6 +368,7 @@
         AMRData.__init__(self, pf, fields, **kwargs)
         self._grids = None
         self._sortkey = None
+        self._sorted = {}
 
     def _generate_field_in_grids(self, field, num_ghost_zones=0):
         for grid in self._grids:
@@ -415,7 +416,10 @@
                 continue
             if self._sortkey is None:
                 self._sortkey = na.argsort(self[self.sort_by])
-            self[field] = self[field][self._sortkey]
+            if (field in self.hierarchy.field_list or field == self.sort_by) and \
+                    not self._sorted.has_key(field):
+                self[field] = self[field][self._sortkey]
+                self._sorted[field] = True
 
 class AMROrthoRayBase(AMR1DData):
     _key_fields = ['x','y','z','dx','dy','dz']
@@ -474,7 +478,6 @@
         We accept a start point and an end point and then get all the data
         between those two.
         """
-        mylog.warning("This code is poorly tested.  It may give bad data!")
         AMR1DData.__init__(self, pf, fields, **kwargs)
         self.start_point = na.array(start_point, dtype='float64')
         self.end_point = na.array(end_point, dtype='float64')
@@ -1543,7 +1546,6 @@
         self.set_field_parameter("center",center)
         self.coords = None
         self._grids = None
-        self._sortkey = None
 
     def _generate_coords(self):
         mylog.info("Generating coords for %s grids", len(self._grids))



More information about the yt-svn mailing list