# HG changeset patch # User Matthew Turk # Date 1283369147 25200 # Branch yt # Node ID e4784f55e29ee06c13280d9adb02c36481d3bbad # Parent 7d396548900696d93a2481c40fdf07a6ce510e6d Updating FLASH code to work again diff -r 7d396548900696d93a2481c40fdf07a6ce510e6d -r e4784f55e29ee06c13280d9adb02c36481d3bbad 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 . """ +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 7d396548900696d93a2481c40fdf07a6ce510e6d -r e4784f55e29ee06c13280d9adb02c36481d3bbad 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 . """ +import h5py + from yt.utilities.io_handler import \ BaseIOHandler diff -r 7d396548900696d93a2481c40fdf07a6ce510e6d -r e4784f55e29ee06c13280d9adb02c36481d3bbad 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