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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Nov 22 13:26:36 PST 2013


9 new commits in yt-doc:

https://bitbucket.org/yt_analysis/yt-doc/commits/68c1428a892b/
Changeset:   68c1428a892b
User:        chummels
Date:        2013-11-22 21:39:07
Summary:     Adding section to examining docs on how to use covering grids to inspect data.
Affected #:  1 file

diff -r 22ed952097eae7a815469260e97f7d25cfd85767 -r 68c1428a892be0d91497f1eebcb464089ecd7aa1 source/examining/low_level_inspection.rst
--- a/source/examining/low_level_inspection.rst
+++ b/source/examining/low_level_inspection.rst
@@ -115,3 +115,95 @@
 
 Note that this doesn't just return the canonical output, but also all of the
 parent grids that overlap with that point.
+
+
+Examining Data in a Fixed Resolution Array
+----------------------------~~~~~~~~~~~~~~
+
+If you have a dataset, either AMR or single resolution, and you want to just
+stick it into a fixed resolution numpy array for later examination, then you
+want to use a :ref:`Covering Grid <available-objects>`.  You must specify the 
+maximum level at which to sample the data, a left edge of the data where you 
+will start, and the resolution at which you want to sample.
+
+For example, let's use the :ref:`sample dataset <getting-sample-data>` 
+``Enzo_64``.  This dataset is at a resolution of 64^3 with 5 levels of AMR,
+so if we want a 64^3 array covering the entire volume and sampling just the 
+lowest level data, we run:
+
+.. code-block:: python
+
+   from yt.mods import *
+   pf = load('Enzo_64/DD0043/data0043')
+   all_data_level_0 = pf.h.covering_grid(level=0, left_edge=[0,0.0,0.0], 
+                                         dims=[64, 64, 64])
+
+Note that we can also get the same result and rely on the dataset to know 
+its own underlying dimensions:
+
+.. code-block:: python
+
+   all_data_level_0 = pf.h.covering_grid(level=0, left_edge=[0,0.0,0.0], 
+                                         dims=pf.domain_dimensions)
+
+We can now access our underlying data at the lowest level by specifying what
+:ref:`field <field-list>` we want to examine:
+
+.. code-block:: python
+   print all_data_level_0['Density'].shape
+   (64, 64, 64)
+
+   print all_data_level_0['Density']
+    
+   array([[[  1.92588925e-31,   1.74647692e-31,   2.54787518e-31, ...,
+  
+   print all_data_level_0['Temperature'].shape
+   (64, 64, 64)
+
+If you create a covering grid that spans two child grids of a single parent 
+grid, it will fill those zones covered by a zone of a child grid with the 
+data from that child grid. Where it is covered only by the parent grid, the 
+cells from the parent grid will be duplicated (appropriately) to fill the 
+covering grid.
+
+Let's say we now want to look at that entire data volume and sample it at the 
+a higher resolution (i.e. level 2).  As stated above, we'll be oversampling
+under-refined regions, but that's OK.  We must also increase the resolution 
+of our output array by a factor of 2^2 in each direction to hold this new 
+larger dataset:
+
+.. code-block:: python
+
+   all_data_level_2 = pf.h.covering_grid(level=2, left_edge=[0,0.0,0.0], 
+                                         dims=pf.domain_dimensions * 2**2)
+
+And let's see what's the density in the central location:
+
+.. code-block:: python
+
+   print all_data_level_2['Density'].shape
+   (256, 256, 256)
+
+   print all_data_level_2['Density'][128, 128, 128]
+   1.7747457571203124e-31
+
+There are two different types of covering grids: unsmoothed and smoothed. 
+Smoothed grids will be filled through a cascading interpolation process; 
+they will be filled at level 0, interpolated to level 1, filled at level 1, 
+interpolated to level 2, filled at level 2, etc. This will help to reduce 
+edge effects. Unsmoothed covering grids will not be interpolated, but rather 
+values will be duplicated multiple times.
+
+To sample our dataset from above with a smoothed covering grid in order 
+to reduce edge effects, it is a nearly identical process:
+
+.. code-block:: python
+
+   all_data_level_2_s = pf.h.smoothed_covering_grid(2, [0.0, 0.0, 0.0], 
+                                                    pf.domain_dimensions * 2**2)
+
+   print all_data_level_2_s['Density'].shape
+   (256, 256, 256)
+
+   print all_data_level_2_s['Density'][128, 128, 128]
+   1.763744852165591e-31


https://bitbucket.org/yt_analysis/yt-doc/commits/39fa95987393/
Changeset:   39fa95987393
User:        chummels
Date:        2013-11-22 21:40:54
Summary:     Adding sphinx tags to examining section.
Affected #:  1 file

diff -r 68c1428a892be0d91497f1eebcb464089ecd7aa1 -r 39fa9598739382ff1d91e1b7c7fbacc08829428e source/examining/low_level_inspection.rst
--- a/source/examining/low_level_inspection.rst
+++ b/source/examining/low_level_inspection.rst
@@ -1,3 +1,5 @@
+.. _low-level-data-inspection:
+
 Low-Level Data Inspection
 =========================
 
@@ -13,6 +15,8 @@
 For a more basic introduction, see :ref:`bootcamp` and more specifically
 :ref:`data_inspection`.
 
+.. _examining-grid-hierarchies:
+
 Examining Grid Hierarchies
 --------------------------
 
@@ -64,6 +68,8 @@
    g2 = g.Children[1].Children[0]
    print g2.LeftEdge
 
+.. _examining-grid-data:
+
 Examining Grid Data
 -------------------
 
@@ -92,6 +98,8 @@
 
 This field will be the raw data found in the file.
 
+.. _finding-data-at-fixed-points:
+
 Finding Data at Fixed Points
 ----------------------------
 
@@ -116,6 +124,7 @@
 Note that this doesn't just return the canonical output, but also all of the
 parent grids that overlap with that point.
 
+.. _examining-data-in-a-fixed-resolution-array:
 
 Examining Data in a Fixed Resolution Array
 ----------------------------~~~~~~~~~~~~~~


https://bitbucket.org/yt_analysis/yt-doc/commits/a98cabf73fa8/
Changeset:   a98cabf73fa8
User:        chummels
Date:        2013-11-22 21:47:23
Summary:     adding section to examining docs introducing FRB and linking to full FRB section in manual plotting interface docs.
Affected #:  1 file

diff -r 39fa9598739382ff1d91e1b7c7fbacc08829428e -r a98cabf73fa8a5fe4b15c659f7f8dec9d4adf315 source/examining/low_level_inspection.rst
--- a/source/examining/low_level_inspection.rst
+++ b/source/examining/low_level_inspection.rst
@@ -127,7 +127,7 @@
 .. _examining-data-in-a-fixed-resolution-array:
 
 Examining Data in a Fixed Resolution Array
-----------------------------~~~~~~~~~~~~~~
+------------------------------------------
 
 If you have a dataset, either AMR or single resolution, and you want to just
 stick it into a fixed resolution numpy array for later examination, then you
@@ -216,3 +216,19 @@
 
    print all_data_level_2_s['Density'][128, 128, 128]
    1.763744852165591e-31
+
+.. _examining-image-data-in-a-fixed-resolution-array:
+
+Examining Image Data in a Fixed Resolution Array
+------------------------------------------------
+
+In the same way that one can sample a multi-resolution 3D dataset by placing
+it into a fixed resolution 3D array as a 
+:ref:`Covering Grid <examining-data-in-a-fixed-resolution-array>`, one can 
+also access the raw image data that is returned from various yt functions 
+directly as a fixed resolution array.  This provides a means for bypassing the 
+yt method for generating plots, and allows the user the freedom to use 
+whatever interface they wish for displaying and saving their image data.  
+The object for doing this is the aptly titled Fixed Resolution Buffer, and 
+there is a full explanation for how to use it 
+:ref:`here <slice-projections-and-other-images-the-fixed-resolution-buffer>`.


https://bitbucket.org/yt_analysis/yt-doc/commits/96f09a0b7938/
Changeset:   96f09a0b7938
User:        chummels
Date:        2013-11-22 21:54:41
Summary:     Fixing broken link in low-level data examination.
Affected #:  1 file

diff -r a98cabf73fa8a5fe4b15c659f7f8dec9d4adf315 -r 96f09a0b7938b7cc8b61fc82d07c6e25b4eb3bff source/examining/low_level_inspection.rst
--- a/source/examining/low_level_inspection.rst
+++ b/source/examining/low_level_inspection.rst
@@ -231,4 +231,4 @@
 whatever interface they wish for displaying and saving their image data.  
 The object for doing this is the aptly titled Fixed Resolution Buffer, and 
 there is a full explanation for how to use it 
-:ref:`here <slice-projections-and-other-images-the-fixed-resolution-buffer>`.
+:ref:`here <fixed-resolution-buffers>`.


https://bitbucket.org/yt_analysis/yt-doc/commits/e9bf5d2d2a78/
Changeset:   e9bf5d2d2a78
User:        chummels
Date:        2013-11-22 21:55:58
Summary:     Changing subtitle to be more descriptive of covering grid.
Affected #:  1 file

diff -r 96f09a0b7938b7cc8b61fc82d07c6e25b4eb3bff -r e9bf5d2d2a781ce8fee625accba98aaf63a05d32 source/examining/low_level_inspection.rst
--- a/source/examining/low_level_inspection.rst
+++ b/source/examining/low_level_inspection.rst
@@ -124,10 +124,10 @@
 Note that this doesn't just return the canonical output, but also all of the
 parent grids that overlap with that point.
 
-.. _examining-data-in-a-fixed-resolution-array:
+.. _examining-grid-data-in-a-fixed-resolution-array:
 
-Examining Data in a Fixed Resolution Array
-------------------------------------------
+Examining Grid Data in a Fixed Resolution Array
+-----------------------------------------------
 
 If you have a dataset, either AMR or single resolution, and you want to just
 stick it into a fixed resolution numpy array for later examination, then you
@@ -224,7 +224,7 @@
 
 In the same way that one can sample a multi-resolution 3D dataset by placing
 it into a fixed resolution 3D array as a 
-:ref:`Covering Grid <examining-data-in-a-fixed-resolution-array>`, one can 
+:ref:`Covering Grid <examining-grid-data-in-a-fixed-resolution-array>`, one can 
 also access the raw image data that is returned from various yt functions 
 directly as a fixed resolution array.  This provides a means for bypassing the 
 yt method for generating plots, and allows the user the freedom to use 


https://bitbucket.org/yt_analysis/yt-doc/commits/93c4c6829793/
Changeset:   93c4c6829793
User:        chummels
Date:        2013-11-22 21:56:55
Summary:     Merged yt_analysis/yt-doc into default
Affected #:  2 files

diff -r e9bf5d2d2a781ce8fee625accba98aaf63a05d32 -r 93c4c6829793bd0eb9110414c7af8aca12a3e10d source/examining/Loading_Generic_Array_Data.ipynb
--- a/source/examining/Loading_Generic_Array_Data.ipynb
+++ b/source/examining/Loading_Generic_Array_Data.ipynb
@@ -271,6 +271,108 @@
      "level": 3,
      "metadata": {},
      "source": [
+      "Volume Rendering Loaded Data"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Volume rendering requires defining a `TransferFunction` to map data to color and opacity and a `camera` to create a viewport and render the image."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Find the min and max of the field\n",
+      "mi, ma = pf.h.all_data().quantities[\"Extrema\"]('Temperature')[0]\n",
+      "#Reduce the dynamic range\n",
+      "mi += 1.5e7\n",
+      "ma -= 0.81e7"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Create a Transfer Function that goes from the minimum to the maximum of the data:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "tf = ColorTransferFunction((mi, ma), grey_opacity=False)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Define the properties and size of the `camera` viewport:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "# Choose a vector representing the viewing direction.\n",
+      "L = [0.5, 0.5, 0.5]\n",
+      "# Define the center of the camera to be the domain center\n",
+      "c = pf.domain_center\n",
+      "# Define the width of the image\n",
+      "W = 1.5*pf.domain_width\n",
+      "# Define the number of pixels to render\n",
+      "Npixels = 512 "
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Create a `camera` object and "
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "cam = pf.h.camera(c, L, W, Npixels, tf, fields=['Temperature'],\n",
+      "                  north_vector=[0,0,1], steady_north=True, \n",
+      "                  sub_samples=5, no_ghost=False,log_fields=False)\n",
+      "\n",
+      "cam.transfer_function.map_to_colormap(mi,ma, \n",
+      "                                      scale=15.0, colormap='algae')"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "cam.show()"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "heading",
+     "level": 3,
+     "metadata": {},
+     "source": [
       "FITS image data"
      ]
     },

diff -r e9bf5d2d2a781ce8fee625accba98aaf63a05d32 -r 93c4c6829793bd0eb9110414c7af8aca12a3e10d source/visualizing/volume_rendering.rst
--- a/source/visualizing/volume_rendering.rst
+++ b/source/visualizing/volume_rendering.rst
@@ -256,10 +256,10 @@
 
 .. _transfer-function-helper:
 
-TransferFunctionHelpler
------------------------
+TransferFunctionHelper
+----------------------
 
-.. notebook:: TransferFunctionHelpler_Tutorial.ipynb
+.. notebook:: TransferFunctionHelper_Tutorial.ipynb
 
 .. _healpix_volume_rendering:
 


https://bitbucket.org/yt_analysis/yt-doc/commits/b3f928d031cf/
Changeset:   b3f928d031cf
User:        chummels
Date:        2013-11-22 22:18:43
Summary:     Fixing sphinx error.
Affected #:  1 file

diff -r e9bf5d2d2a781ce8fee625accba98aaf63a05d32 -r b3f928d031cf9d99317a1aee85c6ee051d0c5c96 source/examining/low_level_inspection.rst
--- a/source/examining/low_level_inspection.rst
+++ b/source/examining/low_level_inspection.rst
@@ -159,6 +159,7 @@
 :ref:`field <field-list>` we want to examine:
 
 .. code-block:: python
+
    print all_data_level_0['Density'].shape
    (64, 64, 64)
 


https://bitbucket.org/yt_analysis/yt-doc/commits/62499b35280b/
Changeset:   62499b35280b
User:        chummels
Date:        2013-11-22 22:19:14
Summary:     Merging.
Affected #:  2 files

diff -r b3f928d031cf9d99317a1aee85c6ee051d0c5c96 -r 62499b35280bf517006308094385fa7f7a946c85 source/examining/Loading_Generic_Array_Data.ipynb
--- a/source/examining/Loading_Generic_Array_Data.ipynb
+++ b/source/examining/Loading_Generic_Array_Data.ipynb
@@ -271,6 +271,108 @@
      "level": 3,
      "metadata": {},
      "source": [
+      "Volume Rendering Loaded Data"
+     ]
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Volume rendering requires defining a `TransferFunction` to map data to color and opacity and a `camera` to create a viewport and render the image."
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "#Find the min and max of the field\n",
+      "mi, ma = pf.h.all_data().quantities[\"Extrema\"]('Temperature')[0]\n",
+      "#Reduce the dynamic range\n",
+      "mi += 1.5e7\n",
+      "ma -= 0.81e7"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Create a Transfer Function that goes from the minimum to the maximum of the data:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "tf = ColorTransferFunction((mi, ma), grey_opacity=False)"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Define the properties and size of the `camera` viewport:"
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "# Choose a vector representing the viewing direction.\n",
+      "L = [0.5, 0.5, 0.5]\n",
+      "# Define the center of the camera to be the domain center\n",
+      "c = pf.domain_center\n",
+      "# Define the width of the image\n",
+      "W = 1.5*pf.domain_width\n",
+      "# Define the number of pixels to render\n",
+      "Npixels = 512 "
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Create a `camera` object and "
+     ]
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "cam = pf.h.camera(c, L, W, Npixels, tf, fields=['Temperature'],\n",
+      "                  north_vector=[0,0,1], steady_north=True, \n",
+      "                  sub_samples=5, no_ghost=False,log_fields=False)\n",
+      "\n",
+      "cam.transfer_function.map_to_colormap(mi,ma, \n",
+      "                                      scale=15.0, colormap='algae')"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "code",
+     "collapsed": false,
+     "input": [
+      "cam.show()"
+     ],
+     "language": "python",
+     "metadata": {},
+     "outputs": []
+    },
+    {
+     "cell_type": "heading",
+     "level": 3,
+     "metadata": {},
+     "source": [
       "FITS image data"
      ]
     },

diff -r b3f928d031cf9d99317a1aee85c6ee051d0c5c96 -r 62499b35280bf517006308094385fa7f7a946c85 source/visualizing/volume_rendering.rst
--- a/source/visualizing/volume_rendering.rst
+++ b/source/visualizing/volume_rendering.rst
@@ -256,10 +256,10 @@
 
 .. _transfer-function-helper:
 
-TransferFunctionHelpler
------------------------
+TransferFunctionHelper
+----------------------
 
-.. notebook:: TransferFunctionHelpler_Tutorial.ipynb
+.. notebook:: TransferFunctionHelper_Tutorial.ipynb
 
 .. _healpix_volume_rendering:
 


https://bitbucket.org/yt_analysis/yt-doc/commits/c3a9cac0a7d9/
Changeset:   c3a9cac0a7d9
User:        chummels
Date:        2013-11-22 22:25:35
Summary:     Merging.
Affected #:  0 files

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