[Yt-svn] yt: Updating FLASH code to work again

hg at spacepope.org hg at spacepope.org
Wed Sep 1 12:25:51 PDT 2010


hg Repository: yt
details:   yt/rev/e4784f55e29e
changeset: 3362:e4784f55e29e
user:      Matthew Turk <matthewturk at gmail.com>
date:
Wed Sep 01 12:25:47 2010 -0700
description:
Updating FLASH code to work again

diffstat:

 yt/frontends/flash/data_structures.py |  17 ++++++++++++-----
 yt/frontends/flash/io.py              |   2 ++
 yt/frontends/orion/data_structures.py |   4 ++--
 3 files changed, 16 insertions(+), 7 deletions(-)

diffs (83 lines):

diff -r 7d3965489006 -r e4784f55e29e yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py	Wed Sep 01 07:24:25 2010 -0700
+++ b/yt/frontends/flash/data_structures.py	Wed Sep 01 12:25:47 2010 -0700
@@ -23,6 +23,11 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
+import h5py
+import stat
+import numpy as na
+import weakref
+
 from yt.funcs import *
 from yt.data_objects.grid_patch import \
     AMRGridPatch
@@ -30,8 +35,11 @@
     AMRHierarchy
 from yt.data_objects.static_output import \
     StaticOutput
+from yt.utilities.definitions import mpc_conversion
 
-from .fields import FLASHFieldContainer
+from .fields import \
+    FLASHFieldContainer, \
+    add_field
 
 class FLASHGrid(AMRGridPatch):
     _id_offset = 1
@@ -179,12 +187,11 @@
         self.conversion_factors = defaultdict(lambda: 1.0)
         self.time_units['1'] = 1
         self.units['1'] = 1.0
-        self.units['unitary'] = 1.0 / (self["DomainRightEdge"] - self["DomainLeftEdge"]).max()
+        self.units['unitary'] = 1.0 / \
+            (self.domain_right_edge - self.domain_left_edge).max()
         seconds = 1 #self["Time"]
         self.time_units['years'] = seconds / (365*3600*24.0)
         self.time_units['days']  = seconds / (3600*24.0)
-        for key in yt2orionFieldsDict:
-            self.conversion_factors[key] = 1.0
 
     def _setup_nounits_units(self):
         z = 0
@@ -209,7 +216,7 @@
 
     def _parse_parameter_file(self):
         self.unique_identifier = \
-            int(os.stat(self.parameter_filename)[ST_CTIME])
+            int(os.stat(self.parameter_filename)[stat.ST_CTIME])
         self._handle = h5py.File(self.parameter_filename, "r")
         self.domain_left_edge = na.array(
             [self._find_parameter("real", "%smin" % ax) for ax in 'xyz'])
diff -r 7d3965489006 -r e4784f55e29e yt/frontends/flash/io.py
--- a/yt/frontends/flash/io.py	Wed Sep 01 07:24:25 2010 -0700
+++ b/yt/frontends/flash/io.py	Wed Sep 01 12:25:47 2010 -0700
@@ -23,6 +23,8 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
+import h5py
+
 from yt.utilities.io_handler import \
     BaseIOHandler
 
diff -r 7d3965489006 -r e4784f55e29e yt/frontends/orion/data_structures.py
--- a/yt/frontends/orion/data_structures.py	Wed Sep 01 07:24:25 2010 -0700
+++ b/yt/frontends/orion/data_structures.py	Wed Sep 01 12:25:47 2010 -0700
@@ -46,13 +46,13 @@
 from yt.utilities.definitions import \
     mpc_conversion
 
-from definitions import \
+from .definitions import \
     orion2enzoDict, \
     parameterDict, \
     yt2orionFieldsDict, \
     orion_FAB_header_pattern
 
-from fields import \
+from .fields import \
     OrionFieldContainer, \
     add_field
 



More information about the yt-svn mailing list