[yt-svn] commit/yt-doc: MatthewTurk: Two minor fixes, for the volume_rendering code block and merger tree recipe
Bitbucket
commits-noreply at bitbucket.org
Wed Feb 20 02:41:54 PST 2013
1 new commit in yt-doc:
https://bitbucket.org/yt_analysis/yt-doc/commits/9b09d20fa890/
changeset: 9b09d20fa890
user: MatthewTurk
date: 2013-02-20 11:41:34
summary: Two minor fixes, for the volume_rendering code block and merger tree recipe
affected #: 2 files
diff -r 3101a9bd7702c315478af2901c896d8a77f722e0 -r 9b09d20fa8904cd8dbc0e2655b137eaa4b8b9d8d source/cookbook/halo_merger_tree.py
--- a/source/cookbook/halo_merger_tree.py
+++ b/source/cookbook/halo_merger_tree.py
@@ -12,7 +12,7 @@
from yt.analysis_modules.halo_merger_tree.api import *
# Makes a TimeSeries object from all of whatever files you have
-ts = TimeSeriesData.from_filenames("DD????/DD????")
+ts = TimeSeriesData.from_filenames("enzo_tiny_cosmology/DD????/DD????")
# For each datadump in our timeseries, run the friends of friends
# halo finder on it (this has only been tested with FOF currently).
diff -r 3101a9bd7702c315478af2901c896d8a77f722e0 -r 9b09d20fa8904cd8dbc0e2655b137eaa4b8b9d8d source/visualizing/volume_rendering.rst
--- a/source/visualizing/volume_rendering.rst
+++ b/source/visualizing/volume_rendering.rst
@@ -39,45 +39,46 @@
Here is a working example for the IsolatedGalaxy dataset from the 2012 yt workshop.
.. code-block:: python
- from yt.mods import *
- pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
- # Choose a field
- field = 'Density'
- # Do you want the log of the field?
- use_log = True
+ from yt.mods import *
- # Find the bounds in log space of for your field
- dd = pf.h.all_data()
- mi, ma = dd.quantities["Extrema"](field)[0]
+ pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ # Choose a field
+ field = 'Density'
+ # Do you want the log of the field?
+ use_log = True
- if use_log:
- mi,ma = np.log10(mi), np.log10(ma)
+ # Find the bounds in log space of for your field
+ dd = pf.h.all_data()
+ mi, ma = dd.quantities["Extrema"](field)[0]
- # Instantiate the ColorTransferfunction.
- tf = ColorTransferFunction((mi, ma))
+ if use_log:
+ mi,ma = np.log10(mi), np.log10(ma)
- # Set up the camera parameters: center, looking direction, width, resolution
- c = (pf.domain_right_edge + pf.domain_left_edge)/2.0
- L = np.array([1.0, 1.0, 1.0])
- W = 0.3 / pf["unitary"]
- N = 256
+ # Instantiate the ColorTransferfunction.
+ tf = ColorTransferFunction((mi, ma))
- # Create a camera object
- cam = pf.h.camera(c, L, W, N, tf, fields = [field], log_fields = [use_log])
+ # Set up the camera parameters: center, looking direction, width, resolution
+ c = (pf.domain_right_edge + pf.domain_left_edge)/2.0
+ L = np.array([1.0, 1.0, 1.0])
+ W = 0.3 / pf["unitary"]
+ N = 256
- # Now let's add some isocontours, and take a snapshot, saving the image
- # to a file.
- tf.add_layers(10, 0.01, colormap = 'RdBu_r')
- im = cam.snapshot('test_rendering.png')
+ # Create a camera object
+ cam = pf.h.camera(c, L, W, N, tf, fields = [field], log_fields = [use_log])
- # To add the domain box to the image:
- nim = cam.draw_domain(im)
- nim.write_png('test_rendering_with_domain.png')
+ # Now let's add some isocontours, and take a snapshot, saving the image
+ # to a file.
+ tf.add_layers(10, 0.01, colormap = 'RdBu_r')
+ im = cam.snapshot('test_rendering.png')
- # To add the grid outlines to the image:
- nim = cam.draw_grids(im)
- nim.write_png('test_rendering_with_grids.png')
+ # To add the domain box to the image:
+ nim = cam.draw_domain(im)
+ nim.write_png('test_rendering_with_domain.png')
+
+ # To add the grid outlines to the image:
+ nim = cam.draw_grids(im)
+ nim.write_png('test_rendering_with_grids.png')
Method
------
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