[Yt-svn] yt-commit r1177 - trunk/yt/extensions/lightcone
britton at wrangler.dreamhost.com
britton at wrangler.dreamhost.com
Sat Feb 21 15:31:21 PST 2009
Author: britton
Date: Sat Feb 21 15:31:20 2009
New Revision: 1177
URL: http://yt.spacepope.org/changeset/1177
Log:
Added support for writing halo map to LightCone.GetHaloMask.
Modified:
trunk/yt/extensions/lightcone/HaloMask.py
trunk/yt/extensions/lightcone/LightCone.py
Modified: trunk/yt/extensions/lightcone/HaloMask.py
==============================================================================
--- trunk/yt/extensions/lightcone/HaloMask.py (original)
+++ trunk/yt/extensions/lightcone/HaloMask.py Sat Feb 21 15:31:20 2009
@@ -24,6 +24,7 @@
"""
from yt.extensions.HaloProfiler import *
+from yt.logger import lagosLogger as mylog
import yt.lagos as lagos
import copy
import numpy as na
@@ -48,6 +49,7 @@
# Write out cube of masks from each slice.
if cube_file is not None:
+ mylog.info("Saving halo mask cube to %s." % cube_file)
output = h5.openFile(cube_file,'a')
output.createArray("/",'haloMaskCube',na.array(lightConeMask))
output.close()
@@ -55,6 +57,7 @@
# Write out final mask.
if mask_file is not None:
# Final mask is simply the product of the mask from each slice.
+ mylog.info("Saving halo mask to %s." % mask_file)
finalMask = na.ones(shape=(pixels,pixels))
for mask in lightConeMask:
finalMask *= mask
@@ -78,6 +81,7 @@
haloMap.extend(_MakeSliceHaloMap(slice,hp.virialQuantities))
# Write out file.
+ mylog.info("Saving halo map to %s." % map_file)
f = open(map_file,'w')
f.write("#z x y M [Msun] R [Mpc] R [image]\n")
for halo in haloMap:
Modified: trunk/yt/extensions/lightcone/LightCone.py
==============================================================================
--- trunk/yt/extensions/lightcone/LightCone.py (original)
+++ trunk/yt/extensions/lightcone/LightCone.py Sat Feb 21 15:31:20 2009
@@ -227,9 +227,13 @@
del co
@rootonly
- def GetHaloMask(self,HaloMaskParameterFile,mask_file=None,**kwargs):
+ def GetHaloMask(self,HaloMaskParameterFile,mask_file=None,map_file=None,**kwargs):
"Gets a halo mask from a file or makes a new one."
+ # Get halo map if map_file given.
+ if (map_file is not None):
+ MakeLightConeHaloMap(self,HaloMaskParameterFile,map_file=map_file,**kwargs)
+
# Check if file already exists.
if (mask_file is not None) and os.path.exists(mask_file):
input = h5.openFile(mask_file,'r')
More information about the yt-svn
mailing list