[Yt-svn] yt-commit r1341 - trunk/yt/extensions

britton at wrangler.dreamhost.com britton at wrangler.dreamhost.com
Tue Jun 16 15:59:56 PDT 2009


Author: britton
Date: Tue Jun 16 15:59:56 2009
New Revision: 1341
URL: http://yt.spacepope.org/changeset/1341

Log:
Fixed various bugs not allowing EnzoSimulation class to be used with non-
cosmological simulations.


Modified:
   trunk/yt/extensions/EnzoSimulation.py

Modified: trunk/yt/extensions/EnzoSimulation.py
==============================================================================
--- trunk/yt/extensions/EnzoSimulation.py	(original)
+++ trunk/yt/extensions/EnzoSimulation.py	Tue Jun 16 15:59:56 2009
@@ -1,6 +1,9 @@
 import yt.lagos as lagos
+from yt.logger import lagosLogger as mylog
 import numpy as na
 
+dt_Tolerance = 1e-3
+
 class EnzoSimulation(object):
     """
     Super class for performing the same operation over all data dumps in 
@@ -86,10 +89,9 @@
                 final_time = ec.ComputeTimeFromRedshift(self.FinalRedshift) / ec.TimeUnits
 
         index = 0
-        t_Tolerance = 1e-3
         current_time = initial_time
-        while ((current_time <= final_time) and 
-               (na.fabs(current_time - final_time) > t_Tolerance)):
+        while (current_time <= final_time) or \
+                (abs(final_time - current_time) / final_time) < dt_Tolerance:
             filename = "%s/%s%04d/%s%04d" % (self.enzoParameters['GlobalDir'],
                                              self.enzoParameters['DataDumpDir'],index,
                                              self.enzoParameters['DataDumpName'],index)
@@ -105,7 +107,7 @@
     def _CombineDataOutputs(self):
         "Combines redshift and time data into one sorted list."
         self.allOutputs = self.redshiftOutputs + self.timeOutputs
-        self.allOutputs.sort(reverse=True,key=lambda obj:obj['redshift'])
+        self.allOutputs.sort(key=lambda obj:obj['time'])
         start_index = None
         end_index = None
         for q in range(len(self.allOutputs)):
@@ -181,7 +183,7 @@
 
     def _SetParameterDefaults(self):
         "Set some default parameters to avoid problems if they are not in the parameter file."
-        self.enzoParameters['GlobalDir'] = ""
+        self.enzoParameters['GlobalDir'] = "."
         self.enzoParameters['RedshiftDumpName'] = "RD"
         self.enzoParameters['RedshiftDumpDir'] = "RD"
         self.enzoParameters['DataDumpName'] = "DD"



More information about the yt-svn mailing list