[Yt-svn] yt-commit r1071 - trunk/yt/extensions/lightcone
britton at wrangler.dreamhost.com
britton at wrangler.dreamhost.com
Mon Jan 5 14:40:00 PST 2009
Author: britton
Date: Mon Jan 5 14:39:59 2009
New Revision: 1071
URL: http://yt.spacepope.org/changeset/1071
Log:
Fixed bug in light cone generator where line of sight field cuts from all
previous slices were being compounded on top of one another. This led to
light cone images with progressively less information in them until the code
died from a projection with no elements. This only affected projections done
after the switch was made from using periodic regions to field cuts to do the
cutting along the line of sight. Additionally, because of the way the
field_cuts array was being passed around in the light cone generator, this bug
only showed up for light cones that had additional user-specified field cuts.
Finally, the ProjectLightCone routine now accepted a keyword, 'node,' where
the user can specify a naming keyword to be used along with other information
for serializing the projection object. This will allow the light cone
generator to tell the difference between two identical random realizations with
different field cuts. The argument given with the node keyword should be a
string.
Modified:
trunk/yt/extensions/lightcone/LightCone.py
trunk/yt/extensions/lightcone/LightConeProjection.py
Modified: trunk/yt/extensions/lightcone/LightCone.py
==============================================================================
--- trunk/yt/extensions/lightcone/LightCone.py (original)
+++ trunk/yt/extensions/lightcone/LightCone.py Mon Jan 5 14:39:59 2009
@@ -209,7 +209,7 @@
self.haloMask *= mask
del haloMaskCube
- def ProjectLightCone(self,field,weight_field=None,apply_halo_mask=False,save_stack=True,save_slice_images=False,**kwargs):
+ def ProjectLightCone(self,field,weight_field=None,apply_halo_mask=False,node=None,save_stack=True,save_slice_images=False,**kwargs):
"Create projections for light cone, then add them together."
# Clear projection stack.
@@ -227,7 +227,7 @@
output['object'] = lagos.EnzoStaticOutput(output['filename'])
frb = LightConeProjection(output,field,self.pixels,weight_field=weight_field,
save_image=save_slice_images,
- name=name,**kwargs)
+ name=name,node=node,**kwargs)
if ytcfg.getint("yt","__parallel_rank") == 0:
if (weight_field is not None):
# Data come back normalized by the weight field.
Modified: trunk/yt/extensions/lightcone/LightConeProjection.py
==============================================================================
--- trunk/yt/extensions/lightcone/LightConeProjection.py (original)
+++ trunk/yt/extensions/lightcone/LightConeProjection.py Mon Jan 5 14:39:59 2009
@@ -36,7 +36,7 @@
#### the direction in question wherever DepthBoxFraction or WidthBoxFraction appears.
#### To be fixed before turning 30. - Britton
-def LightConeProjection(lightConeSlice,field,pixels,weight_field=None,save_image=False,name="",field_cuts=None,**kwargs):
+def LightConeProjection(lightConeSlice,field,pixels,weight_field=None,save_image=False,name="",node=None,field_cuts=None,**kwargs):
"Create a single projection to be added into the light cone stack."
# Use some projection parameters to seed random number generator to make unique node name.
@@ -48,9 +48,10 @@
# ProjectionCenter[ProjectionAxis]
# DepthBoxFraction
- node_name = "LightCone_%d_%f_%f" % (lightConeSlice['ProjectionAxis'],
- lightConeSlice['ProjectionCenter'][lightConeSlice['ProjectionAxis']],
- lightConeSlice['DepthBoxFraction'])
+ # Name node with user specified keyword if given with 'node' keyword.
+ node_name = "LightCone_%s_%d_%f_%f" % (node,lightConeSlice['ProjectionAxis'],
+ lightConeSlice['ProjectionCenter'][lightConeSlice['ProjectionAxis']],
+ lightConeSlice['DepthBoxFraction'])
mylog.info("Making projection at z = %f from %s." % (lightConeSlice['redshift'],lightConeSlice['filename']))
@@ -79,11 +80,13 @@
cut_mask = "(grid[\"%s\"] + 0.5*grid[\"d%s\"] >= %f) & (grid[\"%s\"] - 0.5*grid[\"%s\"] <= %f)" % (axis,axis,depthLeft,axis,axis,depthRight)
if field_cuts is None:
- field_cuts = []
- field_cuts.append(cut_mask)
+ these_field_cuts = []
+ else:
+ these_field_cuts = copy.deepcopy(field_cuts)
+ these_field_cuts.append(cut_mask)
# Make projection.
- pc.add_projection(field,lightConeSlice['ProjectionAxis'],weight_field=weight_field,field_cuts=field_cuts,use_colorbar=True,
+ pc.add_projection(field,lightConeSlice['ProjectionAxis'],weight_field=weight_field,field_cuts=these_field_cuts,use_colorbar=True,
node_name=node_name,**kwargs)
# 2. The Tile Problem
More information about the yt-svn
mailing list