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

britton at wrangler.dreamhost.com britton at wrangler.dreamhost.com
Thu Nov 6 13:29:51 PST 2008


Author: britton
Date: Thu Nov  6 13:29:51 2008
New Revision: 904
URL: http://yt.spacepope.org/changeset/904

Log:
Changed way in which resolution of hdf5 output is calculated.  Now, the max 
level to which the projection is to be made is given.  Optionally, the word 
'max' can be thrown and the code will use the max refinement level in the 
simulation.


Modified:
   trunk/yt/extensions/HaloProfiler.py

Modified: trunk/yt/extensions/HaloProfiler.py
==============================================================================
--- trunk/yt/extensions/HaloProfiler.py	(original)
+++ trunk/yt/extensions/HaloProfiler.py	Thu Nov  6 13:29:51 2008
@@ -103,6 +103,16 @@
         # Get virial quantities.
         self._LoadVirialData()
 
+        # Set resolution for fixed resolution output.
+        if save_cube:
+            if (str(self.haloProfilerParameters['ProjectAtLevel']).find('max') >= 0):
+                proj_level = self.pf.h.maxLevel
+            else:
+                proj_level = int(self.haloProfilerParameters['ProjectAtLevel'])
+            proj_dx = self.pf.units['mpc'] / self.pf.parameters['TopGridDimensions'][0] / \
+                (self.pf.parameters['RefineBy']**proj_level)
+            projectionResolution = int(self.haloProfilerParameters['ProjectionWidth'] / proj_dx)
+
         outputDir = "%s/%s" % (self.pf.fullpath,self.haloProfilerParameters['ProjectionOutputDir'])
 
         if (os.path.exists(outputDir)):
@@ -179,8 +189,7 @@
                     # Create fixed resolution buffer for each projection and write them out.
                     for e,field in enumerate(self.projectionFields.keys()):
                         frb = raven.FixedResolutionBuffer(pc.plots[e].data,(proj_left[0],proj_left[1],proj_right[0],proj_right[1]),
-                                                          (self.haloProfilerParameters['ProjectionResolution'],
-                                                           self.haloProfilerParameters['ProjectionResolution']),
+                                                          (projectionResolution,projectionResolution),
                                                           antialias=True)
                         output.createArray("/",field,frb[field])
                     output.close()
@@ -401,7 +410,7 @@
         self.haloProfilerParameters['HopOutputFile'] = "HopAnalysis.out"
         self.haloProfilerParameters['VirialQuantitiesOutputFile'] = "VirialQuantities.out"
         self.haloProfilerParameters['ProjectionWidth'] = 4.0 # Mpc
-        self.haloProfilerParameters['ProjectionResolution'] = 800
+        self.haloProfilerParameters['ProjectAtLevel'] = 'max'
 
 haloProfilerParameterDict = {"ProfileOutputDir": str,
                              "VirialQuantitiesOutputFile": str,
@@ -413,7 +422,7 @@
                              "ProjectionOutputDir": str,
                              "ProjectionWidth": float,
                              "Projection": str,
-                             "ProjectionResolution": int}
+                             "ProjectAtLevel": str}
 
 def ShiftProjections(pf,pc,oldCenter,newCenter,axis):
     """



More information about the yt-svn mailing list