[Yt-svn] yt-commit r1193 - trunk/yt/extensions/lightcone

britton at wrangler.dreamhost.com britton at wrangler.dreamhost.com
Thu Feb 26 09:58:08 PST 2009


Author: britton
Date: Thu Feb 26 09:58:07 2009
New Revision: 1193
URL: http://yt.spacepope.org/changeset/1193

Log:
The hdf5 output file now includes an attribute on the dataset with a list of 
the redshifts of the slices in the light cone.


Modified:
   trunk/yt/extensions/lightcone/LightCone.py

Modified: trunk/yt/extensions/lightcone/LightCone.py
==============================================================================
--- trunk/yt/extensions/lightcone/LightCone.py	(original)
+++ trunk/yt/extensions/lightcone/LightCone.py	Thu Feb 26 09:58:07 2009
@@ -660,6 +660,9 @@
     def _SaveLightConeStack(self,field=None,weight_field=None,filename=None):
         "Save the light cone projection stack as a 3d array in and hdf5 file."
 
+        # Make list of redshifts to include as a dataset attribute.
+        redshiftList = [slice['redshift'] for slice in self.lightConeSolution]
+
         field_node = "%s_%s" % (field,weight_field)
         weight_field_node = "weight_field_%s" % weight_field
 
@@ -687,7 +690,8 @@
         else:
             mylog.info("Saving %s to %s." % (field_node, filename))
             self.projectionStack = na.array(self.projectionStack)
-            output.createArray("/",field_node,self.projectionStack)
+            field_dataset = output.createArray("/",field_node,self.projectionStack)
+            field_dataset._v_attrs.redshifts = redshiftList
 
         if (len(self.projectionWeightFieldStack) > 0):
             try:
@@ -700,7 +704,8 @@
             else:
                 mylog.info("Saving %s to %s." % (weight_field_node, filename))
                 self.projectionWeightFieldStack = na.array(self.projectionWeightFieldStack)
-                output.createArray("/",weight_field_node,self.projectionWeightFieldStack)
+                weight_field_dataset = output.createArray("/",weight_field_node,self.projectionWeightFieldStack)
+                weight_field_dataset._v_attrs.redshifts = redshiftList
 
         output.close()
 



More information about the yt-svn mailing list