There is a nice example of the use of EnzoCosmology in yt/extensions/EnzoSimulation.py.  One thing to look out for is that I think the hubble constant that EnzoCosmology accepts is 100 * the hubble constant used in enzo itself.  Check that routine to be sure.

While I'm on the subject, EnzoSimulation.py deserves some mention of it's own.  EnzoSimulation serves as a super-class for performing the same operation over multiple data dumps in the same simulation.  To instantiate it, you simply supple the simulation parameter file, with optional keyword args for inital time, initial redshift, final time, and final redshift.  It then reads in parameters from the par file and calculates and time-sorts all of the redshift and time dumps between initial time/redshift and final time/redshift.  You are then provided with an attribute, allOutputs, which is an ordered list of all data dumps between the time specifications.  This makes it extremely simple to then loop over all those data dumps and perform whatever operation you want.  The easiest way to do this is to make a sub class of EnzoSimulation that inherits it's attributes and methods, and then has a single routine for looping over the data dumps and doing whatever you want.  For an example of this, see yt/extensions/SimulationHaloProfiler.py, which can be used for running the halo profiler over multiple data dumps in a single call.  Enjoy!

Britton

On Wed, Jun 17, 2009 at 8:07 PM, Britton Smith <brittonsmith@gmail.com> wrote:
Hi Stephen,

A while ago I implemented a couple things that I think are just what you need.  The module, yt.lagos.EnzoCosmology, features conversions from redshift to time after big bang and vice-versa.  To use it, you just need to instantiate an EnzoCosmology object with keyword args for the cosmological parameters.  Then you have access to the ComputeRedshiftFromTime and ComputeTimeFromRedshift methods as well as the TimeUnits attribute, which gives you the conversion from code units into seconds (I think).  All of these routines were essentially ripped straight from enzo and ported into python.

For more general cosmological calculations, there is yt.lagos.Cosmology, which works the exact same way, but has methods for, comoving radial distance, luminosity distance, etc.  It uses a series approximation for the integration, so the results cannot be trusted for extremely high redshifts, like 1000 or so.

Britton


On Wed, Jun 17, 2009 at 6:32 PM, Stephen Skory <stephenskory@yahoo.com> wrote:



> Is there a built-in way to convert times in yt? Specifically, convert the code
> 'creation_time' to physical time?

Or even better 'creation_time' -> redshift...

Thanks!

 _______________________________________________________
sskory@physics.ucsd.edu           o__  Stephen Skory
http://physics.ucsd.edu/~sskory/ _.>/ _Graduate Student
________________________________(_)_\(_)_______________
_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org