Commits

Matthew Turk committed 697e682

Adding narration to the Data Inspection notebook.

Comments (0)

Files changed (1)

Data Inspection.ipynb

   {
    "cells": [
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "# Starting Out and Loading Data\n",
+      "\n",
+      "We're going to get started by loading up yt.  This next command brings all of the libraries into memory and sets up our environment.  Note that in most scripts, you will want to import from ``yt.mods`` rather than ``yt.imods``.  But using ``yt.imods`` gets you some nice stuff for the IPython notebook, which we'll use below."
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Now that we've loaded yt, we can load up some data.  Let's load the `IsolatedGalaxy` dataset."
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "## Fields and Facts\n",
+      "\n",
+      "When you call the `load` function, yt tries to do very little -- this is designed to be a fast operation, just setting up some information about the simulation.  Now, the first time you access the \"hierarchy\" (shorthand is `.h`) it will read and load the mesh and then determine where data is placed in the physical domain and on disk.  Once it knows that, yt can tell you some statistics about the simulation:"
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "yt can also tell you the fields it found on disk:"
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "And, all of the fields it thinks it knows how to generate:"
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "yt can also transparently generate fields.  However, we encourage you to examine exactly what yt is doing when it generates those fields.  To see, you can ask for the source of a given field."
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "yt stores information about the domain of the simulation:"
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "yt can also convert this into various units:"
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
-      "print pf.domain_width * pf[\"kpc\"]"
+      "print pf.domain_width * pf[\"kpc\"]\n",
+      "print pf.domain_width * pf[\"au\"]\n",
+      "print pf.domain_width * pf[\"miles\"]"
      ],
      "language": "python",
      "metadata": {},
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "# Mesh Structure\n",
+      "\n",
+      "If you're using a simulation type that has grids (for instance, here we're using an Enzo simulation) you can examine the structure of the mesh.  For the most part, you probably won't have to use this unless you're debugging a simulation or examining in detail what is going on."
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "But, you may have to access information about individual grid objects!  Each grid object mediates accessing data from the disk and has a number of attributes that tell you about it.  The hierarchy (`pf.h` here) has an attribute `grids` which is all of the grid objects."
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Grids have dimensions, extents, level, and even a list of Child grids."
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "## Advanced Grid Inspection\n",
+      "\n",
+      "If we want to examine grids only at a given level, we can!  Not only that, but we can load data and take a look at various fields.\n",
+      "\n",
+      "*This section can be skipped!*"
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "# Examining Data in Regions\n",
+      "\n",
+      "yt provides data object selectors.  In subsequent notebooks we'll examine these in more detail, but we can select a sphere of data and perform a number of operations on it.  yt makes it easy to operate on fluid fields in an object in *bulk*, but you can also examine individual field values.\n",
+      "\n",
+      "This creates a sphere selector positioned at the most dense point in the simulation that has a radius of 10 kpc."
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "We can calculate a bunch of bulk quantities.  Here's that list, but there's a list in the docs, too!"
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "outputs": []
     },
     {
+     "cell_type": "markdown",
+     "metadata": {},
+     "source": [
+      "Let's look at the total mass.  This is how you call a given quantity.  yt calls these \"Derived Quantities\".  We'll talk about a few in a later notebook."
+     ]
+    },
+    {
      "cell_type": "code",
      "collapsed": false,
      "input": [
      "language": "python",
      "metadata": {},
      "outputs": []
-    },
-    {
-     "cell_type": "code",
-     "collapsed": false,
-     "input": [],
-     "language": "python",
-     "metadata": {},
-     "outputs": []
     }
    ],
    "metadata": {}