[Yt-svn] yt-commit r582 - trunk/examples

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Fri Jun 20 09:15:03 PDT 2008


Author: mturk
Date: Fri Jun 20 09:15:02 2008
New Revision: 582
URL: http://yt.spacepope.org/changeset/582

Log:
Moving into SVN from the wiki page.                                  
                                                                     
(Probably lots of these really brief commits for the next few days.  They are
easy to do while I, for instance, parse gigs and gigs of fortran-output ascii
data in the background.)



Added:
   trunk/examples/cookbook_mass_sum.py

Added: trunk/examples/cookbook_mass_sum.py
==============================================================================
--- (empty file)
+++ trunk/examples/cookbook_mass_sum.py	Fri Jun 20 09:15:02 2008
@@ -0,0 +1,12 @@
+from yt.mods import *
+
+pf = get_pf() # last argument on the command line gets turned into an EnzoStaticOutput
+
+sp = pf.h.sphere([0.5,0.5,0.5], 1.0) # Everything, no pre-loading of fields
+baryon_mass = sp["CellMassMsun"].sum()
+dm_mass = sp["ParticleMassMsun"][sp["particle_type"] == 1].sum()
+star_mass = sp["ParticleMassMsun"][sp["particle_type"] == 2].sum()
+
+print "Total mass in grids in %s is %0.5e (gas = %0.5e / dm = %0.5e / star = %0.5e)" % \
+            (pf, baryon_mass + dm_mass + star_mass, baryon_mass, dm_mass, star_mass)
+



More information about the yt-svn mailing list