[yt-svn] commit/yt-doc: 2 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Nov 18 15:45:24 PST 2013


2 new commits in yt-doc:

https://bitbucket.org/yt_analysis/yt-doc/commits/8a080edfb53f/
Changeset:   8a080edfb53f
User:        brittonsmith
Date:        2013-11-12 11:16:48
Summary:     Updating thin slice projection recipe to use ProjectionPlot.
Affected #:  1 file

diff -r 952a47356bf40057938ba6580900e8a9ffa674c2 -r 8a080edfb53f0516a2071779227e3dad3b3e39f6 source/cookbook/thin_slice_projection.py
--- a/source/cookbook/thin_slice_projection.py
+++ b/source/cookbook/thin_slice_projection.py
@@ -3,21 +3,32 @@
 # Load the dataset.
 pf = load("Enzo_64/DD0030/data0030")
 
-# Create a plot collection for the dataset.
-# With no additional arguments, the center will be
-# the densest point in the box.
-pc = PlotCollection(pf)
+# Make a projection that is the full width of the domain, 
+# but only 10 Mpc in depth.  This is done by creating a 
+# region object with this exact geometry and providing it 
+# as a data_source for the projection.
 
-# Create a region that is a subset of the entire volume.
-center =       [0.3, 0.5, 0.5]
-left_corner =  [0.1, 0.0, 0.0]
-right_corner = [0.5, 1.0, 1.0]
+# Center on the domain center
+center = pf.domain_center
+
+# First make the left and right corner of the region based 
+# on the full domain.
+left_corner = pf.domain_left_edge
+right_corner = pf.domain_right_edge
+
+# Now adjust the size of the region along the line of sight (x axis).
+depth = 10.0 # in Mpc
+left_corner[0] = center[0] - 0.5 * depth / pf.units['mpc']
+left_corner[0] = center[0] + 0.5 * depth / pf.units['mpc']
+
+# Create the region
 region = pf.h.region(center, left_corner, right_corner)
 
 # Create a density projection and supply the region we have just created.
 # Only cells within the region will be included in the projection.
 # Try with another data container, like a sphere or disk.
-pc.add_projection("Density", "x", weight_field="Density", data_source=region)
+plot = ProjectionPlot(pf, "x", "Density", weight_field="Density", 
+                      data_source=region)
 
 # Save the image with the keyword.
-pc.save("Thin_Slice")
+plot.save("Thin_Slice")


https://bitbucket.org/yt_analysis/yt-doc/commits/3f08e9dfbb5d/
Changeset:   3f08e9dfbb5d
User:        ngoldbaum
Date:        2013-11-19 00:45:23
Summary:     Merged in brittonsmith/yt-doc (pull request #118)

Updating thin slice projection recipe to use ProjectionPlot.
Affected #:  1 file

diff -r b543866181e27eba86e9819c670b659eaf17f06f -r 3f08e9dfbb5d1c86c3e6952357575d52d5467300 source/cookbook/thin_slice_projection.py
--- a/source/cookbook/thin_slice_projection.py
+++ b/source/cookbook/thin_slice_projection.py
@@ -3,21 +3,32 @@
 # Load the dataset.
 pf = load("Enzo_64/DD0030/data0030")
 
-# Create a plot collection for the dataset.
-# With no additional arguments, the center will be
-# the densest point in the box.
-pc = PlotCollection(pf)
+# Make a projection that is the full width of the domain, 
+# but only 10 Mpc in depth.  This is done by creating a 
+# region object with this exact geometry and providing it 
+# as a data_source for the projection.
 
-# Create a region that is a subset of the entire volume.
-center =       [0.3, 0.5, 0.5]
-left_corner =  [0.1, 0.0, 0.0]
-right_corner = [0.5, 1.0, 1.0]
+# Center on the domain center
+center = pf.domain_center
+
+# First make the left and right corner of the region based 
+# on the full domain.
+left_corner = pf.domain_left_edge
+right_corner = pf.domain_right_edge
+
+# Now adjust the size of the region along the line of sight (x axis).
+depth = 10.0 # in Mpc
+left_corner[0] = center[0] - 0.5 * depth / pf.units['mpc']
+left_corner[0] = center[0] + 0.5 * depth / pf.units['mpc']
+
+# Create the region
 region = pf.h.region(center, left_corner, right_corner)
 
 # Create a density projection and supply the region we have just created.
 # Only cells within the region will be included in the projection.
 # Try with another data container, like a sphere or disk.
-pc.add_projection("Density", "x", weight_field="Density", data_source=region)
+plot = ProjectionPlot(pf, "x", "Density", weight_field="Density", 
+                      data_source=region)
 
 # Save the image with the keyword.
-pc.save("Thin_Slice")
+plot.save("Thin_Slice")

Repository URL: https://bitbucket.org/yt_analysis/yt-doc/

--

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