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

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Sun Jun 22 13:16:08 PDT 2008


Author: mturk
Date: Sun Jun 22 13:16:07 2008
New Revision: 604
URL: http://yt.spacepope.org/changeset/604

Log:
Added some examples I forgot to add in the last commit.



Added:
   trunk/examples/cookbook_make_timeseries.py
   trunk/examples/cookbook_make_zoomin.py
   trunk/examples/cookbook_making_1d_profiles.py
   trunk/examples/cookbook_making_2d_profiles.py

Added: trunk/examples/cookbook_make_timeseries.py
==============================================================================
--- (empty file)
+++ trunk/examples/cookbook_make_timeseries.py	Sun Jun 22 13:16:07 2008
@@ -0,0 +1,20 @@
+from yt.mods import *
+
+min_output_number = 0
+max_output_number = 30
+skip = 1
+
+rho_min = 1e-30
+rho_max = 1e-20
+
+frame_template = "frames/frame_%04i.png"
+basename_template = "galaxy%04i.dir/galaxy%04i"
+
+for i in range(min_output_number, max_output_number+1, skip):
+    basename = basename_template % (i,i)
+    pf = lagos.EnzoStaticOutput(basename)
+    pc = raven.PlotCollection(pf, center=[0.5,0.5,0.5])
+    pc.add_projection("Density",0)
+    pc.set_zlim(rho_min, rho_max)
+    # Override the name
+    pc.save(frame_template % (i), force=True)

Added: trunk/examples/cookbook_make_zoomin.py
==============================================================================
--- (empty file)
+++ trunk/examples/cookbook_make_zoomin.py	Sun Jun 22 13:16:07 2008
@@ -0,0 +1,18 @@
+from yt.mods import *
+
+pf = get_pf() # Last argument on command line turned into an output file
+
+n_frames = 200
+min_dx = 250
+frame_template = "frames/frame_%05i"
+
+pc = raven.PlotCollection(pf)
+
+for i in range(3):
+    pl = pc.add_slice("Density",i)
+    pl.add_callback(raven.UnitBoundaryCallback('pc'))
+
+for i,v in enumerate(na.logspace(0,
+             na.log10(pf.h.get_smallest_dx()*min_dx), n_frames)):
+    pc.set_width(v,'1')
+    fn=pc.save(frame_template % (i))

Added: trunk/examples/cookbook_making_1d_profiles.py
==============================================================================
--- (empty file)
+++ trunk/examples/cookbook_making_1d_profiles.py	Sun Jun 22 13:16:07 2008
@@ -0,0 +1,21 @@
+from yt.mods import *
+
+pf = get_pf() # Last argument on command line turned into an output file
+
+v,c = pf.h.find_max("Density")
+
+# Get a sphere 0.1 of a parsec in radius
+sphere = pf.h.sphere(c, .10/a['pc'])
+
+# 32 times the smallest dx converted into cm
+# Note that sphere["Radius"].min() can be zero!
+
+r_min = pf.h.get_smallest_dx() * 32 * pf["cm"] 
+r_max = sphere["Radius"].max()
+x_bins_1d = 64
+
+prof1d = lagos.BinnedProfile1D(sphere, x_bins_1d, "Radius", r_min, r_max, lazy_reader=True)
+prof1d.add_fields("CellMassMsun", accumulation=True, weight=None)
+prof1d.add_fields("NumberDensity")
+prof1d.add_fields("Temperature")
+prof1d.add_fields("H2I_Fraction")

Added: trunk/examples/cookbook_making_2d_profiles.py
==============================================================================
--- (empty file)
+++ trunk/examples/cookbook_making_2d_profiles.py	Sun Jun 22 13:16:07 2008
@@ -0,0 +1,25 @@
+from yt.mods import *
+
+pf = get_pf() # Last argument on command line turned into an output file
+
+v,c = pf.h.find_max("Density")
+
+sphere = pf.h.sphere(c,.10/a['pc'])
+
+x_bins = 128
+y_bins = 128
+
+n_min = sphere["NumberDensity"].min()
+n_max = sphere["NumberDensity"].max()
+
+T_min = sphere["Temperature"].min()
+T_max = sphere["Temperature"].max()
+
+
+prof2d = lagos.BinnedProfile2D(sphere,
+                         x_bins, "NumberDensity", n_min, n_max, True,
+                         y_bins, "Temperature", T_min, T_max, True,
+                         lazy_reader=True)
+
+prof2d.add_fields("Temperature")
+prof2d.add_fields("CellMassMsun", weight=None)



More information about the yt-svn mailing list