[yt-svn] commit/cookbook: brittonsmith: Moving simple recipes to the docs.

Bitbucket commits-noreply at bitbucket.org
Thu May 24 22:37:59 PDT 2012


1 new commit in cookbook:


https://bitbucket.org/yt_analysis/cookbook/changeset/ac0619a863b2/
changeset:   ac0619a863b2
user:        brittonsmith
date:        2012-05-25 07:36:37
summary:     Moving simple recipes to the docs.
affected #:  7 files

diff -r 1aa9256d85121f6a09ccf6f0b885a86b55d45c17 -r ac0619a863b2150dc5dadacebd3cbed6388471df recipes/simple_pdf.py
--- a/recipes/simple_pdf.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-If you would like to create a phase plot such that the mass
-distribution represents the fraction of the total mass rather than
-absolute mass, you must include the "fractional" keyword.
-"""
-from yt.mods import * # set up our namespace
-
-fn = "RedshiftOutput0005" # parameter file to load
-
-pf = load(fn) # load data
-pc = PlotCollection(pf) # defaults to center at most dense point
-pc.add_phase_sphere(10.0, "mpc", # how many of which unit at pc.center
-   ["Density", "Temperature", "CellMassMsun"], # our fields: x, y, color
-   weight=None, # don't take the average value in a cell, just sum them up
-   fractional=True)  #return fractional mass values rather than absolute
-pc.save(fn) # save all plots


diff -r 1aa9256d85121f6a09ccf6f0b885a86b55d45c17 -r ac0619a863b2150dc5dadacebd3cbed6388471df recipes/simple_phase.py
--- a/recipes/simple_phase.py
+++ /dev/null
@@ -1,14 +0,0 @@
-"""
-This is a simple recipe to show how to open a dataset and then plot a phase
-plot showing mass distribution in the rho-T plane.
-"""
-from yt.mods import * # set up our namespace
-
-fn = "RedshiftOutput0005" # parameter file to load
-
-pf = load(fn) # load data
-pc = PlotCollection(pf) # defaults to center at most dense point
-pc.add_phase_sphere(10.0, "mpc", # how many of which unit at pc.center
-    ["Density", "Temperature", "CellMassMsun"], # our fields: x, y, color
-    weight=None) # don't take the average value in a cell, just sum them up
-pc.save(fn) # save all plots


diff -r 1aa9256d85121f6a09ccf6f0b885a86b55d45c17 -r ac0619a863b2150dc5dadacebd3cbed6388471df recipes/simple_profile.py
--- a/recipes/simple_profile.py
+++ /dev/null
@@ -1,14 +0,0 @@
-"""
-This is a simple recipe to show how to open a dataset and then plot a 
-profile showing mass-weighted average Temperature as a function of Density
-inside a sphere.
-"""
-from yt.mods import * # set up our namespace
-
-fn = "RedshiftOutput0005" # parameter file to load
-
-pf = load(fn) # load data
-pc = PlotCollection(pf) # defaults to center at most dense point
-pc.add_profile_sphere(10.0, "mpc", # how many of which unit at pc.center
-    ["Density", "Temperature"], weight="CellMassMsun") # x, y, weight
-pc.save(fn) # save all plots


diff -r 1aa9256d85121f6a09ccf6f0b885a86b55d45c17 -r ac0619a863b2150dc5dadacebd3cbed6388471df recipes/simple_projection.py
--- a/recipes/simple_projection.py
+++ /dev/null
@@ -1,17 +0,0 @@
-"""
-This is a simple recipe to show how to open a dataset and then take a
-weighted-average projection through it, centered at its most dense point. 
-This will only project along grid axes (i.e. x,y,z).  In order to do 
-project along arbitrary projection angles, see the entry for Offaxis Projections. For more information see :ref:`methods-projections`.
-"""
-from yt.mods import * # set up our namespace
-
-fn = "RedshiftOutput0005" # parameter file to load
-
-pf = load(fn) # load data
-pc = PlotCollection(pf) # defaults to center at most dense point
-pc.add_projection("Density", "x", weight_field="Density") # 0 = x-axis
-pc.add_projection("Density", "y", weight_field="Density") # 1 = y-axis
-pc.add_projection("Density", "z", weight_field="Density") # 2 = z-axis
-pc.set_width(1.5, 'mpc') # change width of all plots in pc
-pc.save(fn) # save all plots


diff -r 1aa9256d85121f6a09ccf6f0b885a86b55d45c17 -r ac0619a863b2150dc5dadacebd3cbed6388471df recipes/simple_radial_profile.py
--- a/recipes/simple_radial_profile.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-This is a simple recipe to show how to open a dataset and then plot a radial
-profile showing mass-weighted average Density inside a sphere.  For more
-information, see :ref:`methods-profiles`.
-"""
-from yt.mods import * # set up our namespace
-
-fn = "RedshiftOutput0005" # parameter file to load
-
-pf = load(fn) # load data
-pc = PlotCollection(pf) # defaults to center at most dense point
-pc.add_profile_sphere(10.0, "mpc", # how many of which unit at pc.center
-    ["RadiusMpc", "Density"], weight="CellMassMsun", # x, y, weight
-     x_bounds = (1e-3, 10.0))  # cut out zero-radius and tiny-radius cells
-    # But ... weight defaults to CellMassMsun, so we're being redundant here!
-pc.save(fn) # save all plots


diff -r 1aa9256d85121f6a09ccf6f0b885a86b55d45c17 -r ac0619a863b2150dc5dadacebd3cbed6388471df recipes/simple_slice.py
--- a/recipes/simple_slice.py
+++ /dev/null
@@ -1,16 +0,0 @@
-"""
-This is a simple recipe to show how to open a dataset and then plot a slice
-through it, centered at its most dense point.  For more information, see
-:ref:`methods-slices`.
-"""
-from yt.mods import * # set up our namespace
-
-fn = "RedshiftOutput0005" # parameter file to load
-
-pf = load(fn) # load data
-pc = PlotCollection(pf) # defaults to center at most dense point
-pc.add_slice("Density", "x") # 0 = x-axis
-pc.add_slice("Density", "y") # 1 = y-axis
-pc.add_slice("Density", "z") # 2 = z-axis
-pc.set_width(1.5, 'mpc') # change width of all plots in pc
-pc.save(fn) # save all plots


diff -r 1aa9256d85121f6a09ccf6f0b885a86b55d45c17 -r ac0619a863b2150dc5dadacebd3cbed6388471df recipes/simple_volume_rendering.py
--- a/recipes/simple_volume_rendering.py
+++ /dev/null
@@ -1,64 +0,0 @@
-"""
-This recipe shows how to volume render a dataset. 
-See :ref:`volume_rendering` for more information, as there is considerably more
-functionality than is demonstrated here.
-
-Additionally, for the purposes of the recipe, we have simplified the image
-considerably.
-"""
-from yt.mods import * # set up our namespace
-   
-fn = "RedshiftOutput0005" # parameter file to load
-
-pf = load(fn) # load data
-
-dd = pf.h.all_data()
-
-# Get the bounds of density
-mi, ma = dd.quantities["Extrema"]("Density")[0]
-
-# We supply the min/max we want the function to cover, in log.
-# For this dataset it's -31 and -27.
-tf = ColorTransferFunction((na.log10(mi), na.log10(ma)))
-
-# Now we add some Gaussians on.  Work is underway to transform this into a
-# graphical user interface, and the initial steps can be found in
-# transfer_function_widget.py .
-
-# We now just add a couple gaussians, sampled inside the colormap "gist_stern"
-# at equally-spaced locations in the transfer function.  We make them a bit
-# wider, too.
-tf.add_layers(6, w=0.02)
-
-# Now we need a center of our volume to render.  Here we'll just use
-# 0.5,0.5,0.5, because volume renderings are not periodic.
-c = [0.5, 0.5, 0.5]
-
-# Our image plane will be normal to some vector.  For things like collapsing
-# objects, you could set it the way you would a cutting plane -- but for this
-# dataset, we'll just choose an off-axis value at random.  This gets normalized
-# automatically.
-L = [0.5, 0.2, 0.7]
-
-# Our "width" is the width of the image plane as well as the depth -- so we set
-# it to be 1.0 so we get the whole domain.
-W = 1.0
-
-# Now we decide how big an image we want.  512x512 should be sufficient.
-Nvec = 512
-
-# Now we call the ray caster, which handles the rest.
-# Note that we feed whole_box, which means that it won't apply any cuts to the
-# considered grids.  This may be unnecessary for most appliations.
-cam = pf.h.camera(c, L, W, Nvec, tf)
-
-# Now we tell the camera object to take a snapshot, casting the rays
-image = cam.snapshot()
-
-# If we want to save the image when we take this snapshot, we can use the
-# keyword fn= :
-# image = cam.snapshot("%s_volume_rendering.png" % pf)
-
-# Othwerwise, we can then write out the image using our direct bitmap writer
-write_bitmap(image, "%s_volume_rendered.png" % pf)
-

Repository URL: https://bitbucket.org/yt_analysis/cookbook/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list