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.<br>
<br>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!<br>
<br>Britton<br><br><div class="gmail_quote">On Wed, Jun 17, 2009 at 8:07 PM, Britton Smith <span dir="ltr"><<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Stephen,<br><br>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.<br>

<br>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.<br>
<font color="#888888">
<br>Britton</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">On Wed, Jun 17, 2009 at 6:32 PM, Stephen Skory <span dir="ltr"><<a href="mailto:stephenskory@yahoo.com" target="_blank">stephenskory@yahoo.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><br>
<br>
<br>
> Is there a built-in way to convert times in yt? Specifically, convert the code<br>
> 'creation_time' to physical time?<br>
<br>
</div>Or even better 'creation_time' -> redshift...<br>
<div><div></div><div><br>
Thanks!<br>
<br>
 _______________________________________________________<br>
<a href="mailto:sskory@physics.ucsd.edu" target="_blank">sskory@physics.ucsd.edu</a>           o__  Stephen Skory<br>
<a href="http://physics.ucsd.edu/%7Esskory/" target="_blank">http://physics.ucsd.edu/~sskory/</a> _.>/ _Graduate Student<br>
________________________________(_)_\(_)_______________<br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>