[yt-svn] commit/yt-doc: 5 new changesets
Bitbucket
commits-noreply at bitbucket.org
Mon Dec 12 14:08:50 PST 2011
5 new commits in yt-doc:
https://bitbucket.org/yt_analysis/yt-doc/changeset/28f1a14cfd52/
changeset: 28f1a14cfd52
user: samskillman
date: 2011-12-12 19:23:27
summary: Modifying the .inc files for the volume rendering cookbooks.
affected #: 2 files
diff -r 313cdf7061478eea76cc8fc225a385cc540242cb -r 28f1a14cfd52291ef2a68e352ff4854e58b65367 source/cookbook/camera_movement.inc
--- /dev/null
+++ b/source/cookbook/camera_movement.inc
@@ -0,0 +1,62 @@
+.. _cookbook-camera_movement:
+
+Camera movement
+---------------
+
+This recipe shows how to use the movement functions hanging off of the Camera
+object. See :ref:`volume_rendering` for more information.
+
+Additionally, for the purposes of the recipe, we have simplified the image
+considerably.
+
+The latest version of this recipe can be downloaded here: http://hg.yt-project.org/cookbook/raw/tip/recipes/camera_movement.py .
+
+.. code-block:: python
+
+ from yt.mods import * # set up our namespace
+
+ # Follow the simple_volume_rendering cookbook for the first part of this.
+ fn = "RedshiftOutput0005" # parameter file to load
+ pf = load(fn) # load data
+ dd = pf.h.all_data()
+ mi, ma = dd.quantities["Extrema"]("Density")[0]
+
+ # Set up transfer function
+ tf = ColorTransferFunction((na.log10(mi), na.log10(ma)))
+ tf.add_layers(6, w=0.05)
+
+ # Set up camera paramters
+ c = [0.5, 0.5, 0.5] # Center
+ L = [1, 1, 1] # Normal Vector
+ W = 1.0 # Width
+ Nvec = 512 # Pixels on a side
+
+ # Specify a north vector, which helps with rotations.
+ north_vector = [0.,0.,1.]
+
+ # Find the maximum density location, store it in max_c
+ v,max_c = pf.h.find_max('Density')
+
+ # Initialize the Camera
+ cam = pf.h.camera(c, L, W, (Nvec,Nvec), tf, north_vector=north_vector)
+ frame = 0
+
+ # Do a rotation
+ for i, snapshot in enumerate(cam.rotation(na.pi, 30)):
+ write_bitmap(snapshot, 'camera_movement_%04i.png' % frame)
+ frame += 1
+
+ # Move to the maximum density location
+ for i, snapshot in enumerate(cam.move_to(max_c, 10)):
+ write_bitmap(snapshot, 'camera_movement_%04i.png' % frame)
+ frame += 1
+
+ # Zoom in
+ for i, snapshot in enumerate(cam.zoomin(10.0, 10)):
+ write_bitmap(snapshot, 'camera_movement_%04i.png' % frame)
+ frame += 1
+
+
+
+
+
diff -r 313cdf7061478eea76cc8fc225a385cc540242cb -r 28f1a14cfd52291ef2a68e352ff4854e58b65367 source/cookbook/simple_volume_rendering.inc
--- a/source/cookbook/simple_volume_rendering.inc
+++ b/source/cookbook/simple_volume_rendering.inc
@@ -17,7 +17,7 @@
.. code-block:: python
from yt.mods import * # set up our namespace
-
+
fn = "RedshiftOutput0005" # parameter file to load
pf = load(fn) # load data
@@ -60,14 +60,18 @@
# 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.
- vp = pf.h.volume_rendering(L, W, c, Nvec, tf, whole_box=True)
+ cam = pf.h.camera(L, W, c, Nvec, tf)
- # Now we tell the volume rendering object to cast the rays
- vp.ray_cast()
+ # Now we tell the camera object to take a snapshot, casting the rays
+ image = cam.snapshot()
- # And now, we call our direct image saver.
- write_bitmap(vp.image, "%s_volume_rendered.png" % pf)
+ # 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)
+
.. rubric:: Sample Output
https://bitbucket.org/yt_analysis/yt-doc/changeset/1a1c60cfb409/
changeset: 1a1c60cfb409
user: samskillman
date: 2011-12-12 19:45:33
summary: Actually add the camera_movement to the index, and pick up the more descriptive comments for it.
affected #: 2 files
diff -r 28f1a14cfd52291ef2a68e352ff4854e58b65367 -r 1a1c60cfb409d6a643599c5e70daec241c2658d1 source/cookbook/camera_movement.inc
--- a/source/cookbook/camera_movement.inc
+++ b/source/cookbook/camera_movement.inc
@@ -41,17 +41,17 @@
cam = pf.h.camera(c, L, W, (Nvec,Nvec), tf, north_vector=north_vector)
frame = 0
- # Do a rotation
+ # Do a rotation over 30 frames
for i, snapshot in enumerate(cam.rotation(na.pi, 30)):
write_bitmap(snapshot, 'camera_movement_%04i.png' % frame)
frame += 1
- # Move to the maximum density location
+ # Move to the maximum density location over 10 frames
for i, snapshot in enumerate(cam.move_to(max_c, 10)):
write_bitmap(snapshot, 'camera_movement_%04i.png' % frame)
frame += 1
- # Zoom in
+ # Zoom in by a factor of 10 over 10 frames
for i, snapshot in enumerate(cam.zoomin(10.0, 10)):
write_bitmap(snapshot, 'camera_movement_%04i.png' % frame)
frame += 1
diff -r 28f1a14cfd52291ef2a68e352ff4854e58b65367 -r 1a1c60cfb409d6a643599c5e70daec241c2658d1 source/cookbook/index.rst
--- a/source/cookbook/index.rst
+++ b/source/cookbook/index.rst
@@ -52,4 +52,5 @@
.. include:: light_cone_halo_mask.inc
.. include:: make_light_ray.inc
.. include:: simple_volume_rendering.inc
+.. include:: camera_movement.inc
.. include:: offaxis_projection.inc
https://bitbucket.org/yt_analysis/yt-doc/changeset/a99843889d3f/
changeset: a99843889d3f
user: samskillman
date: 2011-12-12 21:34:49
summary: Re-working the volume rendering docs to get rid of the "simple" interface and emphasize the camera interface. Also add a note about camera movement which points to the new cookbook.
affected #: 2 files
diff -r 1a1c60cfb409d6a643599c5e70daec241c2658d1 -r a99843889d3f6cf0f3542c7f18557287ee951519 source/reference/api/extension_types.rst
--- a/source/reference/api/extension_types.rst
+++ b/source/reference/api/extension_types.rst
@@ -56,7 +56,6 @@
~yt.visualization.volume_rendering.transfer_functions.ProjectionTransferFunction
~yt.visualization.volume_rendering.camera.StereoPairCamera
~yt.visualization.volume_rendering.transfer_functions.TransferFunction
- ~yt.visualization.volume_rendering.software_sampler.VolumeRendering
.. _image_writer:
diff -r 1a1c60cfb409d6a643599c5e70daec241c2658d1 -r a99843889d3f6cf0f3542c7f18557287ee951519 source/visualizing/volume_rendering.rst
--- a/source/visualizing/volume_rendering.rst
+++ b/source/visualizing/volume_rendering.rst
@@ -65,6 +65,88 @@
.. image:: _images/vr_sample.jpg
:width: 512
+.. _the_camera_interface:
+
+The Camera Interface
+--------------------
+
+.. versionadded:: 1.7
+
+A camera object has also been created, to allow for more programmatic
+descriptions of the viewpoint and image plane, and to allow for moving the
+camera object through the volume and creating multiple images. There are
+several camera objects available, but the most commonly used is the standard,
+orthographic projection camera.
+
+The primary interface here is through the creation of an instance of
+:class:`~yt.visualization.volume_rendering.camera.Camera`, which represents a
+viewpoint into a volume. The camera optionally accepts a volume, which can be
+either an instance of
+:class:`~yt.visualization.volume_rendering.grid_partitioner.HomogenizedVolume`
+or an instance of :class:`~yt.utilities.amr_kdtree.amr_kdtree.AMRKDTree` that
+has already been initialized. If one is not supplied, the camera will generate
+one itself. This can also be specified if you wish to save bricks between
+repeated calls, thus saving considerable amounts of time.
+
+The camera interface allows the user to move the camera about the domain, as
+well as providing interfaces for zooming in and out. Furthermore, ``yt`` now
+includes a steroscopic camera
+(:class:`~yt.visualization.volume_rendering.camera.StereoPairCamera`).
+
+Much like most data objects, the
+:class:`~yt.visualization.volume_rendering.camera.Camera` object hangs off of
+the hierarchy file, and can be instantiated in that manner.
+
+.. warning:: The keyword *no_ghost* has been set to True by default
+ for speed considerations. However, because this turns off ghost
+ zones, there may be artifacts at grid boundaries. If a higher quality
+ rendering is required, use *no_ghost = False*.
+
+Here's a fully functional script that demonstrates how to use the camera
+interface.
+
+.. code-block:: python
+
+ from yt.mods import *
+
+ pf = load("DD1701/DD1701")
+
+ dd = pf.h.all_data()
+ mi, ma = na.log10(dd.quantities["Extrema"]("Density")[0])
+ mi -= 0.1 ; ma += 0.1 # To allow a bit of room at the edges
+
+ tf = ColorTransferFunction((mi, ma))
+ tf.add_layers(8, w=0.01)
+ c = (pf.domain_right_edge + pf.domain_left_edge)/2.0
+ L = na.array([1.0, 1.0, 1.0])
+ W = 0.5 / pf["unitary"]
+
+ N = 512
+
+ cam = pf.h.camera(c, L, W, N, tf)
+ fn = "%s_image.png" % pf
+
+ cam.snapshot(fn)
+
+For another example, see the cookbook :ref:`cookbook-simple_volume_rendering`.
+
+The :class:`~yt.visualization.volume_rendering.camera.StereoPairCamera` object
+has a single primary method,
+:meth:`~yt.visualization.volume_rendering.camera.StereoPairCamera.split`, that
+will return two cameras, a left and a right.
+
+.. _camera_movement:
+
+Camera Movement
+---------------
+
+There are multiple ways to manipulate the camera viewpoint to create a series of
+renderings. For an example, see this cookbook:
+:ref:`cookbook-camera_movement`. For a current list of
+motion helper functions, see the docstrings associated with
+:class:`~yt.visualization.volume_rendering.camera.Camera`.
+
+
.. _transfer_functions:
Transfer Functions
@@ -130,105 +212,6 @@
:class:`~yt.visualization.volume_rendering.transfer_functions.MultiVariateTransferFunction`
object. This allows for a set of weightings, linkages and so on.
-The Simple Volume Rendering Interface
--------------------------------------
-
-.. warning:: The simple volume rendering interface is not recommended except
- for very simple tasks!
-
-The simplest interface to volume rendering is exposed in the recipe
-:ref:`cookbook-simple_volume_rendering`. Essentially, this mechanism will
-partition and homogenize the necessary region, ray cast, and return to the user
-an image. This is suitable for situations such as time-series volume
-rendering, or a single-shot volume rendering. However, if you want to make
-multiple images from the same output, or do more complicated things like
-stereoscopic volume rendering, it is recommended to use the camera interface as
-discussed in :ref:`volume_rendering_camera`.
-
-.. note:: The process of creating bricks to ray cast is called 'homogenizing'
- but this doesn't mean the data loses resolution. It just means that the
- resultant bricks produced both uniquely- and fully-tile the domain in
- question and contain the finest data available. It's a mechanism for
- splitting up grid patches is all!
-
-The full API for generating volume renderings with this mechanism can be found
-in the documentation for
-:class:`~yt.visualization.volume_rendering.software_sampler.VolumeRendering`,
-but it is typically accessed as ``volume_rendering`` that hangs off the
-hierarchy object:
-
-.. code-block:: python
-
- vp = pf.h.volume_rendering(L, W, c, Nvec, tf, whole_box=True)
-
-.. _volume_rendering_camera:
-
-The Camera Interface
---------------------
-
-.. versionadded:: 1.7
-
-A camera object has also been created, to allow for more programmatic
-descriptions of the viewpoint and image plane, and to allow for moving the
-camera object through the volume and creating multiple images. There are
-several camera objects available, but the most commonly used is the standard,
-orthographic projection camera.
-
-The primary interface here is through the creation of an instance of
-:class:`~yt.visualization.volume_rendering.camera.Camera`, which represents a
-viewpoint into a volume. The camera optionally accepts a volume, which can be
-either an instance of
-:class:`~yt.visualization.volume_rendering.grid_partitioner.HomogenizedVolume`
-or an instance of :class:`~yt.utilities.amr_kdtree.amr_kdtree.AMRKDTree` that
-has already been initialized. If one is not supplied, the camera will generate
-one itself. This can also be specified if you wish to save bricks between
-repeated calls, thus saving considerable amounts of time.
-
-The camera interface allows the user to move the camera about the domain, as
-well as providing interfaces for zooming in and out. Furthermore, ``yt`` now
-includes a steroscopic camera
-(:class:`~yt.visualization.volume_rendering.camera.StereoPairCamera`).
-
-Much like most data objects, the
-:class:`~yt.visualization.volume_rendering.camera.Camera` object hangs off of
-the hierarchy file, and can be instantiated in that manner.
-
-.. warning:: The keyword *no_ghost* has been set to True by default
- for speed considerations. However, because this turns off ghost
- zones, there may be artifacts at grid boundaries. If a higher quality
- rendering is required, use *no_ghost = False*.
-
-Here's a fully functional script that demonstrates how to use the camera
-interface.
-
-.. code-block:: python
-
- from yt.mods import *
-
- pf = load("DD1701/DD1701")
-
- dd = pf.h.all_data()
- mi, ma = na.log10(dd.quantities["Extrema"]("Density")[0])
- mi -= 0.1 ; ma += 0.1 # To allow a bit of room at the edges
-
- tf = vr.ColorTransferFunction((mi, ma))
- tf.add_layers(8, w=0.01)
- c = (pf.domain_right_edge + pf.domain_left_edge)/2.0
- L = na.array([1.0, 1.0, 1.0])
- W = 0.5 / pf["unitary"]
-
- N = 512
-
- cam = pf.h.camera(c, L, W, N, tf)
- fn = "%s_image.png" % pf
-
- cam.snapshot(fn)
-
-The :class:`~yt.visualization.volume_rendering.camera.StereoPairCamera` object
-has a single primary method,
-:meth:`~yt.visualization.volume_rendering.camera.StereoPairCamera.split`, that
-will return two cameras, a left and a right.
-
.. _healpix_volume_rendering:
HEALPix Volume Rendering
@@ -301,3 +284,10 @@
As it stands, this is still a bit do-it-yourself. Improvements and suggestions
would be welcomed!
+
+
+The Simple Volume Rendering Interface
+-------------------------------------
+.. warning:: This has been removed in yt-2.3. Please use :ref:`the_camera_interface`.
+
+
https://bitbucket.org/yt_analysis/yt-doc/changeset/4d27f1a4cd7d/
changeset: 4d27f1a4cd7d
user: samskillman
date: 2011-12-12 22:14:53
summary: Merging with and touching up the sunrise export docs.
affected #: 3 files
Diff too large to display.
https://bitbucket.org/yt_analysis/yt-doc/changeset/808e74fa05e1/
changeset: 808e74fa05e1
user: samskillman
date: 2011-12-12 22:59:35
summary: Merging.
affected #: 38 files
Diff too large to display.
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