[Yt-svn] yt-commit r1479 - trunk/yt/extensions
britton at wrangler.dreamhost.com
britton at wrangler.dreamhost.com
Wed Oct 7 22:43:05 PDT 2009
Author: britton
Date: Wed Oct 7 22:43:04 2009
New Revision: 1479
URL: http://yt.enzotools.org/changeset/1479
Log:
Added initial_redshift and final_redshift keywords to _create_cosmology_splice
method to use redshift limits other than the absolute limits of the object.
Modified:
trunk/yt/extensions/EnzoSimulation.py
Modified: trunk/yt/extensions/EnzoSimulation.py
==============================================================================
--- trunk/yt/extensions/EnzoSimulation.py (original)
+++ trunk/yt/extensions/EnzoSimulation.py Wed Oct 7 22:43:04 2009
@@ -207,9 +207,12 @@
self.enzoParameters['DataDumpDir'] = "DD"
self.enzoParameters['ComovingCoordinates'] = 0
- def _create_cosmology_splice(self, minimal=True, deltaz_min=0.0):
+ def _create_cosmology_splice(self, minimal=True, deltaz_min=0.0, initial_redshift=None, final_redshift=None):
"Create list of datasets to be used for LightCones or LightRays."
+ if initial_redshift is None: initial_redshift = self.InitialRedshift
+ if final_redshift is None: final_redshift = self.FinalRedshift
+
# Calculate maximum delta z for each data dump.
self._calculate_deltaz_max()
@@ -222,11 +225,11 @@
if minimal:
z_Tolerance = 1e-4
- z = self.InitialRedshift
+ z = initial_redshift
# fill redshift space with datasets
- while ((z > self.FinalRedshift) and
- (na.fabs(z - self.FinalRedshift) > z_Tolerance)):
+ while ((z > final_redshift) and
+ (na.fabs(z - final_redshift) > z_Tolerance)):
# Sort data outputs by proximity to current redsfhit.
self.allOutputs.sort(key=lambda obj:na.fabs(z - obj['redshift']))
# For first data dump, choose closest to desired redshift.
@@ -254,20 +257,20 @@
# Make light ray using maximum number of datasets (minimum spacing).
else:
# Sort data outputs by proximity to current redsfhit.
- self.allOutputs.sort(key=lambda obj:na.fabs(self.InitialRedshift - obj['redshift']))
+ self.allOutputs.sort(key=lambda obj:na.fabs(initial_redshift - obj['redshift']))
# For first data dump, choose closest to desired redshift.
cosmology_splice.append(self.allOutputs[0])
nextOutput = cosmology_splice[-1]['next']
while (nextOutput is not None):
- if (nextOutput['redshift'] <= self.FinalRedshift):
+ if (nextOutput['redshift'] <= final_redshift):
break
if ((cosmology_splice[-1]['redshift'] - nextOutput['redshift']) > cosmology_splice[-1]['deltazMin']):
cosmology_splice.append(nextOutput)
nextOutput = nextOutput['next']
mylog.info("create_cosmology_splice: Used %d data dumps to get from z = %f to %f." %
- (len(cosmology_splice),self.InitialRedshift,self.FinalRedshift))
+ (len(cosmology_splice),initial_redshift,final_redshift))
return cosmology_splice
More information about the yt-svn
mailing list