[yt-svn] commit/yt: ngoldbaum: Merged in chummels/yt/yt-3.0 (pull request #958)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Jun 18 17:24:03 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/1d4b798712da/
Changeset:   1d4b798712da
Branch:      yt-3.0
User:        ngoldbaum
Date:        2014-06-19 02:23:47
Summary:     Merged in chummels/yt/yt-3.0 (pull request #958)

Updating 3.0 cookbook recipes (and some bug fixes)
Affected #:  65 files

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/aligned_cutting_plane.py
--- a/doc/source/cookbook/aligned_cutting_plane.py
+++ b/doc/source/cookbook/aligned_cutting_plane.py
@@ -1,18 +1,20 @@
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
 import yt
 
 # Load the dataset.
 ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
-# Create a 1 kpc radius sphere, centered on the maximum gas density.  Note
-# that this sphere is very small compared to the size of our final plot,
-# and it has a non-axially aligned L vector.
-sp = ds.sphere("m", (1.0, "kpc"))
+# Create a 15 kpc radius sphere, centered on the center of the sim volume
+sp = ds.sphere("center", (15.0, "kpc"))
 
 # Get the angular momentum vector for the sphere.
 L = sp.quantities.angular_momentum_vector()
 
 print "Angular momentum vector: {0}".format(L)
 
-# Create an OffAxisSlicePlot on the object with the L vector as its normal
-p = yt.OffAxisSlicePlot(ds, L, "density", sp.center, (15, "kpc"))
+# Create an OffAxisSlicePlot of density centered on the object with the L 
+# vector as its normal and a width of 25 kpc on a side
+p = yt.OffAxisSlicePlot(ds, L, "density", sp.center, (25, "kpc"))
 p.save()

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/amrkdtree_downsampling.py
--- a/doc/source/cookbook/amrkdtree_downsampling.py
+++ b/doc/source/cookbook/amrkdtree_downsampling.py
@@ -1,3 +1,6 @@
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED 
+
 # Using AMRKDTree Homogenized Volumes to examine large datasets
 # at lower resolution.
 
@@ -10,17 +13,17 @@
 import yt
 from yt.utilities.amr_kdtree.api import AMRKDTree
 
-# Load up a data and print out the maximum refinement level
+# Load up a dataset
 ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')
 
 kd = AMRKDTree(ds)
-# Print out the total volume of all the bricks
-print kd.count_volume()
-# Print out the number of cells
-print kd.count_cells()
+
+# Print out specifics of KD Tree
+print "Total volume of all bricks = %i" % kd.count_volume()
+print "Total number of cells = %i" % kd.count_cells()
 
 tf = yt.ColorTransferFunction((-30, -22))
-cam = ds.h.camera([0.5, 0.5, 0.5], [0.2, 0.3, 0.4], 0.10, 256,
+cam = ds.camera([0.5, 0.5, 0.5], [0.2, 0.3, 0.4], 0.10, 256,
                   tf, volume=kd)
 tf.add_layers(4, 0.01, col_bounds=[-27.5, -25.5], colormap='RdBu_r')
 cam.snapshot("v1.png", clip_ratio=6.0)

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/average_value.py
--- a/doc/source/cookbook/average_value.py
+++ b/doc/source/cookbook/average_value.py
@@ -5,9 +5,10 @@
 field = "temperature"  # The field to average
 weight = "cell_mass"  # The weight for the average
 
-dd = ds.h.all_data()  # This is a region describing the entire box,
-                      # but note it doesn't read anything in yet!
+ad = ds.all_data()  # This is a region describing the entire box,
+                    # but note it doesn't read anything in yet!
+
 # We now use our 'quantities' call to get the average quantity
-average_value = dd.quantities["WeightedAverageQuantity"](field, weight)
+average_value = ad.quantities.weighted_average_quantity(field, weight)
 
-print "Average %s (weighted by %s) is %0.5e" % (field, weight, average_value)
+print "Average %s (weighted by %s) is %0.3e %s" % (field, weight, average_value, average_value.units)

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/boolean_data_objects.py
--- a/doc/source/cookbook/boolean_data_objects.py
+++ b/doc/source/cookbook/boolean_data_objects.py
@@ -1,23 +1,32 @@
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
 import yt
 
 ds = yt.load("Enzo_64/DD0043/data0043")  # load data
-# Make a few data ojbects to start.
+# Make a few data ojbects to start. Two boxes and two spheres.
 re1 = ds.region([0.5, 0.5, 0.5], [0.4, 0.4, 0.4], [0.6, 0.6, 0.6])
 re2 = ds.region([0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [0.6, 0.6, 0.6])
 sp1 = ds.sphere([0.5, 0.5, 0.5], 0.05)
 sp2 = ds.sphere([0.1, 0.2, 0.3], 0.1)
+
 # The "AND" operator. This will make a region identical to re2.
 bool1 = ds.boolean([re1, "AND", re2])
 xp = bool1["particle_position_x"]
+
 # The "OR" operator. This will make a region identical to re1.
 bool2 = ds.boolean([re1, "OR", re2])
+
 # The "NOT" operator. This will make a region like re1, but with the corner
 # that re2 covers cut out.
 bool3 = ds.boolean([re1, "NOT", re2])
+
 # Disjoint regions can be combined with the "OR" operator.
 bool4 = ds.boolean([sp1, "OR", sp2])
+
 # Find oddly-shaped overlapping regions.
 bool5 = ds.boolean([re2, "AND", sp1])
+
 # Nested logic with parentheses.
 # This is re1 with the oddly-shaped region cut out.
 bool6 = ds.boolean([re1, "NOT", "(", re1, "AND", sp1, ")"])

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/camera_movement.py
--- a/doc/source/cookbook/camera_movement.py
+++ b/doc/source/cookbook/camera_movement.py
@@ -1,11 +1,13 @@
-import numpy as np
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
 
 import yt
+import numpy as np
 
 # Follow the simple_volume_rendering cookbook for the first part of this.
 ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")  # load data
-dd = ds.all_data()
-mi, ma = dd.quantities["Extrema"]("density")
+ad = ds.all_data()
+mi, ma = ad.quantities.extrema("density")
 
 # Set up transfer function
 tf = yt.ColorTransferFunction((np.log10(mi), np.log10(ma)))
@@ -40,4 +42,4 @@
 # Zoom in by a factor of 10 over 5 frames
 for i, snapshot in enumerate(cam.zoomin(10.0, 5, clip_ratio=8.0)):
     snapshot.write_png('camera_movement_%04i.png' % frame)
-    frame += 1
\ No newline at end of file
+    frame += 1

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/contours_on_slice.py
--- a/doc/source/cookbook/contours_on_slice.py
+++ b/doc/source/cookbook/contours_on_slice.py
@@ -1,13 +1,12 @@
 import yt
 
 # first add density contours on a density slice
-pf = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")  # load data
-p = yt.SlicePlot(pf, "x", "density")
+ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")  
+p = yt.SlicePlot(ds, "x", "density")
 p.annotate_contour("density")
 p.save()
 
-# then add temperature contours on the same densty slice
-pf = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")  # load data
-p = yt.SlicePlot(pf, "x", "density")
+# then add temperature contours on the same density slice
+p = yt.SlicePlot(ds, "x", "density")
 p.annotate_contour("temperature")
-p.save(str(pf)+'_T_contour')
+p.save(str(ds)+'_T_contour')

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/extract_fixed_resolution_data.py
--- a/doc/source/cookbook/extract_fixed_resolution_data.py
+++ b/doc/source/cookbook/extract_fixed_resolution_data.py
@@ -8,21 +8,26 @@
 level = 2
 dims = ds.domain_dimensions * ds.refine_by**level
 
-# Now, we construct an object that describes the data region and structure we
-# want
-cube = ds.covering_grid(2,  # The level we are willing to extract to; higher
-                            # levels than this will not contribute to the data!
+# We construct an object that describes the data region and structure we want
+# In this case, we want all data up to the maximum "level" of refinement 
+# across the entire simulation volume.  Higher levels than this will not 
+# contribute to our covering grid.
+cube = ds.covering_grid(level,  
                         left_edge=[0.0, 0.0, 0.0],
+                        dims=dims,
                         # And any fields to preload (this is optional!)
-                        dims=dims,
                         fields=["density"])
 
 # Now we open our output file using h5py
-# Note that we open with 'w' which will overwrite existing files!
+# Note that we open with 'w' (write), which will overwrite existing files!
 f = h5py.File("my_data.h5", "w")
 
-# We create a dataset at the root note, calling it density...
+# We create a dataset at the root, calling it "density"
 f.create_dataset("/density", data=cube["density"])
 
 # We close our file
 f.close()
+
+# If we want to then access this datacube in the h5 file, we can now...
+f = h5py.File("my_data.h5", "r")
+print f["density"].value

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/find_clumps.py
--- a/doc/source/cookbook/find_clumps.py
+++ b/doc/source/cookbook/find_clumps.py
@@ -1,3 +1,6 @@
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
 import numpy as np
 
 import yt

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/fit_spectrum.py
--- a/doc/source/cookbook/fit_spectrum.py
+++ b/doc/source/cookbook/fit_spectrum.py
@@ -1,22 +1,21 @@
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
 import yt
 from yt.analysis_modules.cosmological_observation.light_ray.api import LightRay
-from yt.analysis_modules.api import AbsorptionSpectrum
+from yt.analysis_modules.absorption_spectrum.api import AbsorptionSpectrum
 from yt.analysis_modules.absorption_spectrum.api import generate_total_fit
 
 # Define and add a field to simulate OVI based on a constant relationship to HI
-def _OVI_NumberDensity(field, data):
-    return data['HI_NumberDensity']
+# Do *NOT* use this for science, because this is not how OVI actually behaves;
+# it is just an example.
 
+ at yt.derived_field(name='OVI_number_density', units='cm**-3')
+def _OVI_number_density(field, data):
+    return data['HI_NumberDensity']*2.0
 
-def _convertOVI(data):
-    return 4.9E-4*.2
 
-yt.add_field('my_OVI_NumberDensity',
-             function=_OVI_NumberDensity,
-             convert_function=_convertOVI)
-
-
-# Define species andi associated parameters to add to continuum
+# Define species and associated parameters to add to continuum
 # Parameters used for both adding the transition to the spectrum
 # and for fitting
 # Note that for single species that produce multiple lines
@@ -37,7 +36,7 @@
                  'init_N': 1E14}
 
 OVI_parameters = {'name': 'OVI',
-                  'field': 'my_OVI_NumberDensity',
+                  'field': 'OVI_number_density',
                   'f': [.1325, .06580],
                   'Gamma': [4.148E8, 4.076E8],
                   'wavelength': [1031.9261, 1037.6167],

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/free_free_field.py
--- a/doc/source/cookbook/free_free_field.py
+++ b/doc/source/cookbook/free_free_field.py
@@ -1,3 +1,6 @@
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
 import numpy as np
 import yt
 # Need to grab the proton mass from the constants database

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/global_phase_plots.py
--- a/doc/source/cookbook/global_phase_plots.py
+++ b/doc/source/cookbook/global_phase_plots.py
@@ -4,10 +4,10 @@
 ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
 # This is an object that describes the entire box
-ad = ds.h.all_data()
+ad = ds.all_data()
 
-# We plot the average VelocityMagnitude (mass-weighted) in our object
-# as a function of Density and temperature
+# We plot the average velocity magnitude (mass-weighted) in our object
+# as a function of density and temperature
 plot = yt.PhasePlot(ad, "density", "temperature", "velocity_magnitude")
 
 # save the plot

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/halo_merger_tree.py
--- a/doc/source/cookbook/halo_merger_tree.py
+++ b/doc/source/cookbook/halo_merger_tree.py
@@ -1,3 +1,6 @@
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
 # This script demonstrates some of the halo merger tracking infrastructure,
 # for tracking halos across multiple datadumps in a time series.
 # Ultimately, it outputs an HDF5 file with the important quantities for the

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/halo_plotting.py
--- a/doc/source/cookbook/halo_plotting.py
+++ b/doc/source/cookbook/halo_plotting.py
@@ -1,16 +1,20 @@
-"""
-This is a mechanism for plotting circles representing identified particle halos
-on an image.  For more information, see :ref:`halo_finding`.
-"""
-from yt.mods import * # set up our namespace
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
 
-data_pf = load("Enzo_64/RD0006/RedshiftOutput0006")
+import yt
+from yt.analysis_modules.halo_analysis.halo_catalog import HaloCatalog
 
-halo_pf = load('rockstar_halos/halos_0.0.bin')
+# Load the dataset
+ds = yt.load("Enzo_64/RD0006/RedshiftOutput0006")
 
-hc - HaloCatalog(halos_pf = halo_pf)
+# Load the halo list from a rockstar output for this dataset
+halos = yt.load('rockstar_halos/halos_0.0.bin')
+
+# Create the halo catalog from this halo list
+hc = HaloCatalog(halos_pf = halos)
 hc.load()
 
-p = ProjectionPlot(pf, "x", "density")
+# Create a projection with the halos overplot on top
+p = yt.ProjectionPlot(ds, "x", "density")
 p.annotate_halos(hc)
 p.save()

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/halo_profiler.py
--- a/doc/source/cookbook/halo_profiler.py
+++ b/doc/source/cookbook/halo_profiler.py
@@ -1,3 +1,6 @@
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
 from yt.mods import *
 
 from yt.analysis_modules.halo_profiler.api import *

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/hse_field.py
--- a/doc/source/cookbook/hse_field.py
+++ b/doc/source/cookbook/hse_field.py
@@ -1,11 +1,14 @@
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
 import numpy as np
 import yt
 
 # Define the components of the gravitational acceleration vector field by
 # taking the gradient of the gravitational potential
 
-
-def _Grav_Accel_x(field, data):
+ at yt.derived_field(name='grav_accel_x', units='cm/s**2', take_log=False)
+def grav_accel_x(field, data):
 
     # We need to set up stencils
 
@@ -19,13 +22,14 @@
     gx -= data["gravitational_potential"][sl_left, 1:-1, 1:-1]/dx
 
     new_field = np.zeros(data["gravitational_potential"].shape,
-                         dtype='float64')
+                         dtype='float64')*gx.unit_array
     new_field[1:-1, 1:-1, 1:-1] = -gx
 
     return new_field
 
 
-def _Grav_Accel_y(field, data):
+ at yt.derived_field(name='grav_accel_y', units='cm/s**2', take_log=False)
+def grav_accel_y(field, data):
 
     # We need to set up stencils
 
@@ -39,13 +43,14 @@
     gy -= data["gravitational_potential"][1:-1, sl_left, 1:-1]/dy
 
     new_field = np.zeros(data["gravitational_potential"].shape,
-                         dtype='float64')
+                         dtype='float64')*gx.unit_array
     new_field[1:-1, 1:-1, 1:-1] = -gy
 
     return new_field
 
 
-def _Grav_Accel_z(field, data):
+ at yt.derived_field(name='grav_accel_z', units='cm/s**2', take_log=False)
+def grav_accel_z(field, data):
 
     # We need to set up stencils
 
@@ -59,7 +64,7 @@
     gz -= data["gravitational_potential"][1:-1, 1:-1, sl_left]/dz
 
     new_field = np.zeros(data["gravitational_potential"].shape,
-                         dtype='float64')
+                         dtype='float64')*gx.unit_array
     new_field[1:-1, 1:-1, 1:-1] = -gz
 
     return new_field
@@ -68,7 +73,8 @@
 # Define the components of the pressure gradient field
 
 
-def _Grad_Pressure_x(field, data):
+ at yt.derived_field(name='grad_pressure_x', units='g/(cm*s)**2', take_log=False)
+def grad_pressure_x(field, data):
 
     # We need to set up stencils
 
@@ -81,13 +87,14 @@
     px = data["pressure"][sl_right, 1:-1, 1:-1]/dx
     px -= data["pressure"][sl_left, 1:-1, 1:-1]/dx
 
-    new_field = np.zeros(data["pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["pressure"].shape, dtype='float64')*px.unit_array
     new_field[1:-1, 1:-1, 1:-1] = px
 
     return new_field
 
 
-def _Grad_Pressure_y(field, data):
+ at yt.derived_field(name='grad_pressure_y', units='g/(cm*s)**2', take_log=False)
+def grad_pressure_y(field, data):
 
     # We need to set up stencils
 
@@ -100,13 +107,14 @@
     py = data["pressure"][1:-1, sl_right, 1:-1]/dy
     py -= data["pressure"][1:-1, sl_left, 1:-1]/dy
 
-    new_field = np.zeros(data["pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["pressure"].shape, dtype='float64')*px.unit_array
     new_field[1:-1, 1:-1, 1:-1] = py
 
     return new_field
 
 
-def _Grad_Pressure_z(field, data):
+ at yt.derived_field(name='grad_pressure_z', units='g/(cm*s)**2', take_log=False)
+def grad_pressure_z(field, data):
 
     # We need to set up stencils
 
@@ -119,7 +127,7 @@
     pz = data["pressure"][1:-1, 1:-1, sl_right]/dz
     pz -= data["pressure"][1:-1, 1:-1, sl_left]/dz
 
-    new_field = np.zeros(data["pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["pressure"].shape, dtype='float64')*px.unit_array
     new_field[1:-1, 1:-1, 1:-1] = pz
 
     return new_field
@@ -127,8 +135,8 @@
 
 # Define the "degree of hydrostatic equilibrium" field
 
-
-def _HSE(field, data):
+ at yt.derived_field(name='HSE', units=None, take_log=False)
+def HSE(field, data):
 
     gx = data["density"]*data["Grav_Accel_x"]
     gy = data["density"]*data["Grav_Accel_y"]
@@ -138,31 +146,10 @@
     hy = data["Grad_Pressure_y"] - gy
     hz = data["Grad_Pressure_z"] - gz
 
-    h = np.sqrt((hx*hx+hy*hy+hz*hz)/(gx*gx+gy*gy+gz*gz))
+    h = np.sqrt((hx*hx+hy*hy+hz*hz)/(gx*gx+gy*gy+gz*gz))*gx.unit_array
 
     return h
 
-# Now add the fields to the database
-
-yt.add_field("Grav_Accel_x", function=_Grav_Accel_x, take_log=False,
-             validators=[yt.ValidateSpatial(1, ["gravitational_potential"])])
-
-yt.add_field("Grav_Accel_y", function=_Grav_Accel_y, take_log=False,
-             validators=[yt.ValidateSpatial(1, ["gravitational_potential"])])
-
-yt.add_field("Grav_Accel_z", function=_Grav_Accel_z, take_log=False,
-             validators=[yt.ValidateSpatial(1, ["gravitational_potential"])])
-
-yt.add_field("Grad_Pressure_x", function=_Grad_Pressure_x, take_log=False,
-             validators=[yt.ValidateSpatial(1, ["pressure"])])
-
-yt.add_field("Grad_Pressure_y", function=_Grad_Pressure_y, take_log=False,
-             validators=[yt.ValidateSpatial(1, ["pressure"])])
-
-yt.add_field("Grad_Pressure_z", function=_Grad_Pressure_z, take_log=False,
-             validators=[yt.ValidateSpatial(1, ["pressure"])])
-
-yt.add_field("HSE", function=_HSE, take_log=False)
 
 # Open two files, one at the beginning and the other at a later time when
 # there's a lot of sloshing going on.
@@ -173,8 +160,8 @@
 # Sphere objects centered at the cluster potential minimum with a radius
 # of 200 kpc
 
-sphere_i = dsi.h.sphere(dsi.domain_center, (200, "kpc"))
-sphere_f = dsf.h.sphere(dsf.domain_center, (200, "kpc"))
+sphere_i = dsi.sphere(dsi.domain_center, (200, "kpc"))
+sphere_f = dsf.sphere(dsf.domain_center, (200, "kpc"))
 
 # Average "degree of hydrostatic equilibrium" in these spheres
 
@@ -188,9 +175,9 @@
 # of the two files
 
 slc_i = yt.SlicePlot(dsi, 2, ["density", "HSE"], center=dsi.domain_center,
-                     width=(1.0, "mpc"))
+                     width=(1.0, "Mpc"))
 slc_f = yt.SlicePlot(dsf, 2, ["density", "HSE"], center=dsf.domain_center,
-                     width=(1.0, "mpc"))
+                     width=(1.0, "Mpc"))
 
 slc_i.save("initial")
 slc_f.save("final")

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/image_background_colors.py
--- a/doc/source/cookbook/image_background_colors.py
+++ b/doc/source/cookbook/image_background_colors.py
@@ -1,21 +1,24 @@
-from yt.mods import *
-
 # This shows how to save ImageArray objects, such as those returned from 
 # volume renderings, to pngs with varying backgrounds.
 
+import yt
+import numpy as np
+
 # Lets make a fake "rendering" that has 4 channels and looks like a linear
 # gradient from the bottom to top.
+
 im = np.zeros([64,128,4])
 for i in xrange(im.shape[0]):
     for k in xrange(im.shape[2]):
         im[i,:,k] = np.linspace(0.,10.*k, im.shape[1])
-im_arr = ImageArray(im)
+im_arr = yt.ImageArray(im)
 
 # in this case you would have gotten im_arr from something like:
 # im_arr = cam.snapshot() 
 
 # To save it with the default settings, we can just use write_png, where it 
 # rescales the image and uses a black background.
+
 im_arr.write_png('standard.png')
  
 # write_png accepts a background keyword argument that defaults to 'black'.
@@ -24,12 +27,8 @@
 # white (1.,1.,1.,1.)
 # None  (0.,0.,0.,0.) <-- Transparent!
 # any rgba list/array: [r,g,b,a], bounded by 0..1
+
 im_arr.write_png('black_bg.png', background='black')
 im_arr.write_png('white_bg.png', background='white')
 im_arr.write_png('green_bg.png', background=[0.,1.,0.,1.])
 im_arr.write_png('transparent_bg.png', background=None)
-
-
-
-
-

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/index.rst
--- a/doc/source/cookbook/index.rst
+++ b/doc/source/cookbook/index.rst
@@ -18,9 +18,6 @@
 `here <http://yt-project.org/data/>`_, where you will find links to download 
 individual datasets.
 
-If you want to take a look at more complex recipes, or submit your own,
-check out the `yt Hub <http://hub.yt-project.org>`_.
-
 .. note:: To contribute your own recipes, please follow the instructions 
     on how to contribute documentation code: :ref:`writing_documentation`.
 

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/light_cone_projection.py
--- a/doc/source/cookbook/light_cone_projection.py
+++ b/doc/source/cookbook/light_cone_projection.py
@@ -1,9 +1,13 @@
-from yt.mods import *
-from yt.analysis_modules.api import LightCone
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
+import yt
+from yt.analysis_modules.cosmological_observation.light_cone.light_cone import LightCone
 
 # Create a LightCone object extending from z = 0 to z = 0.1
 # with a 600 arcminute field of view and a resolution of
 # 60 arcseconds.
+
 # We have already set up the redshift dumps to be
 # used for this, so we will not use any of the time
 # data dumps.

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/light_cone_with_halo_mask.py
--- a/doc/source/cookbook/light_cone_with_halo_mask.py
+++ b/doc/source/cookbook/light_cone_with_halo_mask.py
@@ -1,7 +1,10 @@
-from yt.mods import *
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
 
-from yt.analysis_modules.api import LightCone
-from yt.analysis_modules.halo_profiler.api import *
+import yt
+
+from yt.analysis_modules.cosmological_observation.light_cone.light_cone import LightCone
+from yt.analysis_modules.halo_profiler.api import HaloProfiler
 
 # Instantiate a light cone object as usual.
 lc = LightCone('enzo_tiny_cosmology/32Mpc_32.enzo',

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/make_light_ray.py
--- a/doc/source/cookbook/make_light_ray.py
+++ b/doc/source/cookbook/make_light_ray.py
@@ -1,13 +1,16 @@
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
 import os
 import sys
-
-from yt.mods import *
-
-from yt.analysis_modules.halo_profiler.api import *
-from yt.analysis_modules.cosmological_observation.light_ray.api import \
+import yt
+from yt.analysis_modules.halo_profiler.api import HaloProfiler
+from yt.analysis_modules.cosmological_observation.light_ray.light_ray import \
      LightRay
 
-if not os.path.isdir("LR"): os.mkdir('LR')
+# Create a directory for the light rays
+if not os.path.isdir("LR"): 
+    os.mkdir('LR')
      
 # Create a LightRay object extending from z = 0 to z = 0.1
 # and use only the redshift dumps.

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/multi_plot_3x2_FRB.py
--- a/doc/source/cookbook/multi_plot_3x2_FRB.py
+++ b/doc/source/cookbook/multi_plot_3x2_FRB.py
@@ -1,12 +1,14 @@
-from yt.mods import * # set up our namespace
+import yt
+import numpy as np
+from yt.visualization.api import get_multi_plot
 import matplotlib.colorbar as cb
 from matplotlib.colors import LogNorm
 
 fn = "Enzo_64/RD0006/RedshiftOutput0006" # parameter file to load
 
-
-pf = load(fn) # load data
-v, c = pf.h.find_max("density")
+# load data and get center value and center location as maximum density location
+ds = yt.load(fn) 
+v, c = ds.find_max("density")
 
 # set up our Fixed Resolution Buffer parameters: a width, resolution, and center
 width = (1.0, 'unitary')
@@ -28,7 +30,7 @@
 # over the columns, which will become axes of slicing.
 plots = []
 for ax in range(3):
-    sli = pf.slice(ax, c[ax])
+    sli = ds.slice(ax, c[ax])
     frb = sli.to_frb(width, res)
     den_axis = axes[ax][0]
     temp_axis = axes[ax][1]
@@ -39,11 +41,16 @@
         ax.xaxis.set_visible(False)
         ax.yaxis.set_visible(False)
 
-    plots.append(den_axis.imshow(frb['density'], norm=LogNorm()))
+    # converting our fixed resolution buffers to NDarray so matplotlib can
+    # render them
+    dens = np.array(frb['density'])
+    temp = np.array(frb['temperature'])
+
+    plots.append(den_axis.imshow(dens, norm=LogNorm()))
     plots[-1].set_clim((5e-32, 1e-29))
     plots[-1].set_cmap("bds_highcontrast")
 
-    plots.append(temp_axis.imshow(frb['temperature'], norm=LogNorm()))
+    plots.append(temp_axis.imshow(temp, norm=LogNorm()))
     plots[-1].set_clim((1e3, 1e8))
     plots[-1].set_cmap("hot")
     
@@ -60,4 +67,4 @@
     cbar.set_label(t)
 
 # And now we're done!  
-fig.savefig("%s_3x2.png" % pf)
+fig.savefig("%s_3x2.png" % ds)

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/multi_plot_slice_and_proj.py
--- a/doc/source/cookbook/multi_plot_slice_and_proj.py
+++ b/doc/source/cookbook/multi_plot_slice_and_proj.py
@@ -1,4 +1,5 @@
-from yt.mods import * # set up our namespace
+import yt
+import numpy as np
 from yt.visualization.base_plot_types import get_multi_plot
 import matplotlib.colorbar as cb
 from matplotlib.colors import LogNorm
@@ -6,7 +7,7 @@
 fn = "GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150" # parameter file to load
 orient = 'horizontal'
 
-pf = load(fn) # load data
+ds = yt.load(fn) # load data
 
 # There's a lot in here:
 #   From this we get a containing figure, a list-of-lists of axes into which we
@@ -17,12 +18,11 @@
 #   bw is the base-width in inches, but 4 is about right for most cases.
 fig, axes, colorbars = get_multi_plot(3, 2, colorbar=orient, bw = 4)
 
-slc = pf.slice(2, 0.0, fields=["density","temperature","velocity_magnitude"], 
-                 center=pf.domain_center)
-proj = pf.proj("density", 2, weight_field="density", center=pf.domain_center)
+slc = yt.SlicePlot(ds, 'z', fields=["density","temperature","velocity_magnitude"])
+proj = yt.ProjectionPlot(ds, 'z', "density", weight_field="density")
 
-slc_frb = slc.to_frb((1.0, "mpc"), 512)
-proj_frb = proj.to_frb((1.0, "mpc"), 512)
+slc_frb = slc.data_source.to_frb((1.0, "Mpc"), 512)
+proj_frb = proj.data_source.to_frb((1.0, "Mpc"), 512)
 
 dens_axes = [axes[0][0], axes[1][0]]
 temp_axes = [axes[0][1], axes[1][1]]
@@ -37,12 +37,22 @@
     vax.xaxis.set_visible(False)
     vax.yaxis.set_visible(False)
 
-plots = [dens_axes[0].imshow(slc_frb["density"], origin='lower', norm=LogNorm()),
-         dens_axes[1].imshow(proj_frb["density"], origin='lower', norm=LogNorm()),
-         temp_axes[0].imshow(slc_frb["temperature"], origin='lower'),    
-         temp_axes[1].imshow(proj_frb["temperature"], origin='lower'),
-         vels_axes[0].imshow(slc_frb["velocity_magnitude"], origin='lower', norm=LogNorm()),
-         vels_axes[1].imshow(proj_frb["velocity_magnitude"], origin='lower', norm=LogNorm())]
+# Converting our Fixed Resolution Buffers to numpy arrays so that matplotlib
+# can render them
+
+slc_dens = np.array(slc_frb['density'])
+proj_dens = np.array(proj_frb['density'])
+slc_temp = np.array(slc_frb['temperature'])
+proj_temp = np.array(proj_frb['temperature'])
+slc_vel = np.array(slc_frb['velocity_magnitude'])
+proj_vel = np.array(proj_frb['velocity_magnitude'])
+
+plots = [dens_axes[0].imshow(slc_dens, origin='lower', norm=LogNorm()),
+         dens_axes[1].imshow(proj_dens, origin='lower', norm=LogNorm()),
+         temp_axes[0].imshow(slc_temp, origin='lower'),    
+         temp_axes[1].imshow(proj_temp, origin='lower'),
+         vels_axes[0].imshow(slc_vel, origin='lower', norm=LogNorm()),
+         vels_axes[1].imshow(proj_vel, origin='lower', norm=LogNorm())]
          
 plots[0].set_clim((1.0e-27,1.0e-25))
 plots[0].set_cmap("bds_highcontrast")
@@ -58,12 +68,12 @@
 plots[5].set_cmap("gist_rainbow")
 
 titles=[r'$\mathrm{Density}\ (\mathrm{g\ cm^{-3}})$', 
-        r'$\mathrm{temperature}\ (\mathrm{K})$',
-        r'$\mathrm{VelocityMagnitude}\ (\mathrm{cm\ s^{-1}})$']
+        r'$\mathrm{Temperature}\ (\mathrm{K})$',
+        r'$\mathrm{Velocity Magnitude}\ (\mathrm{cm\ s^{-1}})$']
 
 for p, cax, t in zip(plots[0:6:2], colorbars, titles):
     cbar = fig.colorbar(p, cax=cax, orientation=orient)
     cbar.set_label(t)
 
 # And now we're done! 
-fig.savefig("%s_3x2" % pf)
+fig.savefig("%s_3x2" % ds)

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/multi_width_image.py
--- a/doc/source/cookbook/multi_width_image.py
+++ b/doc/source/cookbook/multi_width_image.py
@@ -1,15 +1,16 @@
-from yt.mods import *
+import yt
 
 # Load the dataset.
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
 # Create a slice plot for the dataset.  With no additional arguments,
 # the width will be the size of the domain and the center will be the
 # center of the simulation box
-slc = SlicePlot(pf,2,'density')
+slc = yt.SlicePlot(ds, 'z', 'density')
 
-# Create a list of a couple of widths and units.
-widths = [(1, 'mpc'),
+# Create a list of a couple of widths and units. 
+# (N.B. Mpc (megaparsec) != mpc (milliparsec)
+widths = [(1, 'Mpc'),
           (15, 'kpc')]
 
 # Loop through the list of widths and units.
@@ -19,12 +20,12 @@
     slc.set_width(width, unit)
 
     # Write out the image with a unique name.
-    slc.save("%s_%010d_%s" % (pf, width, unit))
+    slc.save("%s_%010d_%s" % (ds, width, unit))
 
 zoomFactors = [2,4,5]
 
 # recreate the original slice
-slc = SlicePlot(pf,2,'density')
+slc = yt.SlicePlot(ds, 'z', 'density')
 
 for zoomFactor in zoomFactors:
 
@@ -32,4 +33,4 @@
     slc.zoom(zoomFactor)
 
     # Write out the image with a unique name.
-    slc.save("%s_%i" % (pf, zoomFactor))
+    slc.save("%s_%i" % (ds, zoomFactor))

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/multiplot_2x2.py
--- a/doc/source/cookbook/multiplot_2x2.py
+++ b/doc/source/cookbook/multiplot_2x2.py
@@ -1,9 +1,9 @@
-from yt.mods import *
+import yt
 import matplotlib.pyplot as plt
 from mpl_toolkits.axes_grid1 import AxesGrid
 
 fn = "IsolatedGalaxy/galaxy0030/galaxy0030"
-pf = load(fn) # load data
+ds = yt.load(fn) # load data
 
 fig = plt.figure()
 
@@ -22,11 +22,16 @@
                 cbar_size="3%",
                 cbar_pad="0%")
 
-fields = ['density', 'velocity_x', 'velocity_y', 'VelocityMagnitude']
+fields = ['density', 'velocity_x', 'velocity_y', 'velocity_magnitude']
 
 # Create the plot.  Since SlicePlot accepts a list of fields, we need only
 # do this once.
-p = SlicePlot(pf, 'z', fields)
+p = yt.SlicePlot(ds, 'z', fields)
+
+# Velocity is going to be both positive and negative, so let's make these
+# slices linear
+p.set_log('velocity_x', False)
+p.set_log('velocity_y', False)
 p.zoom(2)
 
 # For each plotted field, force the SlicePlot to redraw itself onto the AxesGrid

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/multiplot_2x2_coordaxes_slice.py
--- a/doc/source/cookbook/multiplot_2x2_coordaxes_slice.py
+++ b/doc/source/cookbook/multiplot_2x2_coordaxes_slice.py
@@ -1,9 +1,9 @@
-from yt.mods import *
+import yt
 import matplotlib.pyplot as plt
 from mpl_toolkits.axes_grid1 import AxesGrid
 
 fn = "IsolatedGalaxy/galaxy0030/galaxy0030"
-pf = load(fn) # load data
+ds = yt.load(fn) # load data
 
 fig = plt.figure()
 
@@ -27,7 +27,7 @@
 
 for i, (direction, field) in enumerate(zip(cuts, fields)):
     # Load the data and create a single plot
-    p = SlicePlot(pf, direction, field)
+    p = yt.SlicePlot(ds, direction, field)
     p.zoom(40)
 
     # This forces the ProjectionPlot to redraw itself on the AxesGrid axes.

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/multiplot_2x2_time_series.py
--- a/doc/source/cookbook/multiplot_2x2_time_series.py
+++ b/doc/source/cookbook/multiplot_2x2_time_series.py
@@ -1,4 +1,4 @@
-from yt.mods import *
+import yt
 import matplotlib.pyplot as plt
 from mpl_toolkits.axes_grid1 import AxesGrid
 
@@ -23,8 +23,8 @@
 
 for i, fn in enumerate(fns):
     # Load the data and create a single plot
-    pf = load(fn) # load data
-    p = ProjectionPlot(pf, 'z', 'density', width=(55, 'Mpccm'))
+    ds = yt.load(fn) # load data
+    p = yt.ProjectionPlot(ds, 'z', 'density', width=(55, 'Mpccm'))
 
     # Ensure the colorbar limits match for all plots
     p.set_zlim('density', 1e-4, 1e-2)

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/offaxis_projection.py
--- a/doc/source/cookbook/offaxis_projection.py
+++ b/doc/source/cookbook/offaxis_projection.py
@@ -1,7 +1,8 @@
-from yt.mods import *
+import yt
+import numpy as np
 
 # Load the dataset.
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
 # Choose a center for the render.
 c = [0.5, 0.5, 0.5]
@@ -25,10 +26,10 @@
 # Create the off axis projection.
 # Setting no_ghost to False speeds up the process, but makes a
 # slighly lower quality image.
-image = off_axis_projection(pf, c, L, W, Npixels, "density", no_ghost=False)
+image = yt.off_axis_projection(ds, c, L, W, Npixels, "density", no_ghost=False)
 
 # Write out the final image and give it a name
 # relating to what our dataset is called.
 # We save the log of the values so that the colors do not span
 # many orders of magnitude.  Try it without and see what happens.
-write_image(np.log10(image), "%s_offaxis_projection.png" % pf)
+yt.write_image(np.log10(image), "%s_offaxis_projection.png" % ds)

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/offaxis_projection_colorbar.py
--- a/doc/source/cookbook/offaxis_projection_colorbar.py
+++ b/doc/source/cookbook/offaxis_projection_colorbar.py
@@ -1,8 +1,9 @@
-from yt.mods import * # set up our namespace
+import yt
+import numpy as np
 
 fn = "IsolatedGalaxy/galaxy0030/galaxy0030" # parameter file to load
 
-pf = load(fn) # load data
+ds = yt.load(fn) # load data
 
 # Now we need a center of our volume to render.  Here we'll just use
 # 0.5,0.5,0.5, because volume renderings are not periodic.
@@ -31,9 +32,9 @@
 # Also note that we set the field which we want to project as "density", but
 # really we could use any arbitrary field like "temperature", "metallicity"
 # or whatever.
-image = off_axis_projection(pf, c, L, W, Npixels, "density", no_ghost=False)
+image = yt.off_axis_projection(ds, c, L, W, Npixels, "density", no_ghost=False)
 
 # Image is now an NxN array representing the intensities of the various pixels.
 # And now, we call our direct image saver.  We save the log of the result.
-write_projection(image, "offaxis_projection_colorbar.png", 
-                 colorbar_label="Column Density (cm$^{-2}$)")
+yt.write_projection(image, "offaxis_projection_colorbar.png", 
+                    colorbar_label="Column Density (cm$^{-2}$)")

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/opaque_rendering.py
--- a/doc/source/cookbook/opaque_rendering.py
+++ b/doc/source/cookbook/opaque_rendering.py
@@ -1,20 +1,15 @@
-## Opaque Volume Rendering
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
 
-# The new version of yt also features opaque rendering, using grey opacity.
-# For example, this makes blues opaque to red and green.  In this example we
-# will explore how the opacity model you choose changes the appearance of the
-# rendering.
+import yt
+import numpy as np
 
-# Here we start by loading up a dataset, in this case galaxy0030.
-
-from yt.mods import *
-
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
 # We start by building a transfer function, and initializing a camera.
 
-tf = ColorTransferFunction((-30, -22))
-cam = pf.h.camera([0.5, 0.5, 0.5], [0.2, 0.3, 0.4], 0.10, 256, tf)
+tf = yt.ColorTransferFunction((-30, -22))
+cam = ds.camera([0.5, 0.5, 0.5], [0.2, 0.3, 0.4], 0.10, 256, tf)
 
 # Now let's add some isocontours, and take a snapshot.
 
@@ -66,5 +61,3 @@
 
 # That looks pretty different, but the main thing is that you can see that the
 # inner contours are somewhat visible again.  
-
-

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/overplot_grids.py
--- a/doc/source/cookbook/overplot_grids.py
+++ b/doc/source/cookbook/overplot_grids.py
@@ -1,10 +1,10 @@
-from yt.mods import *
+import yt
 
 # Load the dataset.
-pf = load("Enzo_64/DD0043/data0043")
+ds = yt.load("Enzo_64/DD0043/data0043")
 
 # Make a density projection.
-p = ProjectionPlot(pf, "y", "density")
+p = yt.ProjectionPlot(ds, "y", "density")
 
 # Modify the projection
 # The argument specifies the region along the line of sight

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/overplot_particles.py
--- a/doc/source/cookbook/overplot_particles.py
+++ b/doc/source/cookbook/overplot_particles.py
@@ -1,10 +1,10 @@
-from yt.mods import *
+import yt
 
 # Load the dataset.
-pf = load("Enzo_64/DD0043/data0043")
+ds = yt.load("Enzo_64/DD0043/data0043")
 
 # Make a density projection.
-p = ProjectionPlot(pf, "y", "density")
+p = yt.ProjectionPlot(ds, "y", "density")
 
 # Modify the projection
 # The argument specifies the region along the line of sight

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/profile_with_variance.py
--- a/doc/source/cookbook/profile_with_variance.py
+++ b/doc/source/cookbook/profile_with_variance.py
@@ -1,30 +1,34 @@
-from matplotlib import pyplot
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
 
-from yt.mods import *
+import matplotlib.pyplot as plt
+import yt
 
 # Load the dataset.
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
-# Create a sphere of radius 1000 kpc centered on the max density.
-sphere = pf.sphere("max", (1000, "kpc"))
+# Create a sphere of radius 1 Mpc centered on the max density location.
+sp = ds.sphere("max", (1, "Mpc"))
 
 # Calculate and store the bulk velocity for the sphere.
-bulk_velocity = sphere.quantities['BulkVelocity']()
-sphere.set_field_parameter('bulk_velocity', bulk_velocity)
+bulk_velocity = sp.quantities['BulkVelocity']()
+sp.set_field_parameter('bulk_velocity', bulk_velocity)
 
 # Create a 1D profile object for profiles over radius
 # and add a velocity profile.
-profile = BinnedProfile1D(sphere, 100, "Radiuskpc", 0.1, 1000.)
-profile.add_fields('VelocityMagnitude')
+prof = yt.ProfilePlot(sp, 'radius', 'velocity_magnitude', 
+                      weight_field='cell_mass')
+prof.set_unit('radius', 'kpc')
+prof.set_xlim(0.1, 1000)
 
 # Plot the average velocity magnitude.
-pyplot.loglog(profile['Radiuskpc'], profile['VelocityMagnitude'],
-              label='mean')
+plt.loglog(prof['radius'], prof['velocity_magnitude'],
+              label='Mean')
 # Plot the variance of the velocity madnitude.
-pyplot.loglog(profile['Radiuskpc'], profile['VelocityMagnitude_std'],
-              label='std')
-pyplot.xlabel('r [kpc]')
-pyplot.ylabel('v [cm/s]')
-pyplot.legend()
+plt.loglog(prof['radius'], prof['velocity_magnitude_std'],
+              label='Standard Deviation')
+plt.xlabel('r [kpc]')
+plt.ylabel('v [cm/s]')
+plt.legend()
 
-pyplot.savefig('velocity_profiles.png')
+plt.savefig('velocity_profiles.png')

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/rad_velocity.py
--- a/doc/source/cookbook/rad_velocity.py
+++ b/doc/source/cookbook/rad_velocity.py
@@ -1,32 +1,38 @@
-from yt.mods import *
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
+import yt
 import matplotlib.pyplot as plt
 
-pf = load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
+ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
 
 # Get the first sphere
-
-sphere0 = pf.sphere(pf.domain_center, (500., "kpc"))
+sp0 = ds.sphere(ds.domain_center, (500., "kpc"))
 
 # Compute the bulk velocity from the cells in this sphere
+bulk_vel = sp0.quantities["BulkVelocity"]()
 
-bulk_vel = sphere0.quantities["BulkVelocity"]()
 
 # Get the second sphere
-
-sphere1 = pf.sphere(pf.domain_center, (500., "kpc"))
+sp1 = ds.sphere(ds.domain_center, (500., "kpc"))
 
 # Set the bulk velocity field parameter 
-sphere1.set_field_parameter("bulk_velocity", bulk_vel)
+sp1.set_field_parameter("bulk_velocity", bulk_vel)
 
 # Radial profile without correction
 
-rad_profile0 = BinnedProfile1D(sphere0, 100, "Radiuskpc", 0.0, 500., log_space=False)
-rad_profile0.add_fields("RadialVelocity")
+rp0 = yt.ProfilePlot(sp0, 'radius', 'radial_velocity')
+rp0.set_unit('radius', 'kpc')
+rp0.set_log('radius', False)
 
 # Radial profile with correction for bulk velocity
 
-rad_profile1 = BinnedProfile1D(sphere1, 100, "Radiuskpc", 0.0, 500., log_space=False)
-rad_profile1.add_fields("RadialVelocity")
+rp1 = yt.ProfilePlot(sp1, 'radius', 'radial_velocity')
+rp1.set_unit('radius', 'kpc')
+rp1.set_log('radius', False)
+
+#rp0.save('radial_velocity_profile_uncorrected.png')
+#rp1.save('radial_velocity_profile_corrected.png')
 
 # Make a plot using matplotlib
 
@@ -41,4 +47,4 @@
 ax.set_ylabel(r"$\mathrm{v_r\ (km/s)}$")
 ax.legend(["Without Correction", "With Correction"])
 
-fig.savefig("%s_profiles.png" % pf)
\ No newline at end of file
+fig.savefig("%s_profiles.png" % ds)

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/radial_profile_styles.py
--- a/doc/source/cookbook/radial_profile_styles.py
+++ b/doc/source/cookbook/radial_profile_styles.py
@@ -1,16 +1,22 @@
-from yt.mods import *
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
+import yt
 import matplotlib.pyplot as plt
 
-pf = load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
+ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
 
 # Get a sphere object
 
-sphere = pf.sphere(pf.domain_center, (500., "kpc"))
+sp = ds.sphere(ds.domain_center, (500., "kpc"))
 
 # Bin up the data from the sphere into a radial profile
 
-rad_profile = BinnedProfile1D(sphere, 100, "Radiuskpc", 0.0, 500., log_space=False)
-rad_profile.add_fields("density","temperature")
+#rp = BinnedProfile1D(sphere, 100, "Radiuskpc", 0.0, 500., log_space=False)
+#rp.add_fields("density","temperature")
+rp = yt.ProfilePlot(sp, 'radius', ['density', 'temperature'])
+rp.set_unit('radius', 'kpc')
+rp.set_log('radius', False)
 
 # Make plots using matplotlib
 
@@ -18,7 +24,7 @@
 ax = fig.add_subplot(111)
 
 # Plot the density as a log-log plot using the default settings
-dens_plot = ax.loglog(rad_profile["Radiuskpc"], rad_profile["density"])
+dens_plot = ax.loglog(rp["Radiuskpc"], rp["density"])
 
 # Here we set the labels of the plot axes
 
@@ -27,7 +33,7 @@
 
 # Save the default plot
 
-fig.savefig("density_profile_default.png" % pf)
+fig.savefig("density_profile_default.png" % ds)
 
 # The "dens_plot" object is a list of plot objects. In our case we only have one,
 # so we index the list by '0' to get it. 
@@ -51,10 +57,10 @@
 
 ax.lines = []
 
-# Since the rad_profile object also includes the standard deviation in each bin,
+# Since the radial profile object also includes the standard deviation in each bin,
 # we'll use these as errorbars. We have to make a new plot for this:
 
-dens_err_plot = ax.errorbar(rad_profile["Radiuskpc"], rad_profile["density"],
-                            yerr=rad_profile["Density_std"])
+dens_err_plot = ax.errorbar(pr["Radiuskpc"], rp["density"],
+                            yerr=rp["Density_std"])
                                                         
-fig.savefig("density_profile_with_errorbars.png")
\ No newline at end of file
+fig.savefig("density_profile_with_errorbars.png")

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/rendering_with_box_and_grids.py
--- a/doc/source/cookbook/rendering_with_box_and_grids.py
+++ b/doc/source/cookbook/rendering_with_box_and_grids.py
@@ -1,18 +1,22 @@
-from yt.mods import *
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
+import yt
+import numpy as np
 
 # Load the dataset.
-pf = load("Enzo_64/DD0043/data0043")
+ds = yt.load("Enzo_64/DD0043/data0043")
 
 # Create a data container (like a sphere or region) that
 # represents the entire domain.
-dd = pf.h.all_data()
+ad = ds.all_data()
 
 # Get the minimum and maximum densities.
-mi, ma = dd.quantities["Extrema"]("density")[0]
+mi, ma = ad.quantities.extrema("density")
 
 # Create a transfer function to map field values to colors.
 # We bump up our minimum to cut out some of the background fluid
-tf = ColorTransferFunction((np.log10(mi)+2.0, np.log10(ma)))
+tf = yt.ColorTransferFunction((np.log10(mi)+2.0, np.log10(ma)))
 
 # Add three guassians, evenly spaced between the min and
 # max specified above with widths of 0.02 and using the
@@ -37,25 +41,24 @@
 # Create a camera object.
 # This object creates the images and
 # can be moved and rotated.
-cam = pf.h.camera(c, L, W, Npixels, tf)
+cam = ds.camera(c, L, W, Npixels, tf)
 
 # Create a snapshot.
 # The return value of this function could also be accepted, modified (or saved
 # for later manipulation) and then put written out using write_bitmap.
 # clip_ratio applies a maximum to the function, which is set to that value
 # times the .std() of the array.
-im = cam.snapshot("%s_volume_rendered.png" % pf, clip_ratio=8.0)
+im = cam.snapshot("%s_volume_rendered.png" % ds, clip_ratio=8.0)
 
 # Add the domain edges, with an alpha blending of 0.3:
 nim = cam.draw_domain(im, alpha=0.3)
-nim.write_png('%s_vr_domain.png' % pf)
+nim.write_png('%s_vr_domain.png' % ds)
 
 # Add the grids, colored by the grid level with the algae colormap
 nim = cam.draw_grids(im, alpha=0.3, cmap='algae')
-nim.write_png('%s_vr_grids.png' % pf)
+nim.write_png('%s_vr_grids.png' % ds)
 
 # Here we can draw the coordinate vectors on top of the image by processing
 # it through the camera. Then save it out.
 cam.draw_coordinate_vectors(nim)
-nim.write_png("%s_vr_vectors.png" % pf)
-
+nim.write_png("%s_vr_vectors.png" % ds)

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/save_profiles.py
--- a/doc/source/cookbook/save_profiles.py
+++ b/doc/source/cookbook/save_profiles.py
@@ -1,28 +1,31 @@
-from yt.mods import *
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
+import yt
 import matplotlib.pyplot as plt
-import h5py
+import h5py as h5
 
-pf = load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
+ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
 
 # Get a sphere
 
-sp = pf.sphere(pf.domain_center, (500., "kpc"))
+sp = ds.sphere(ds.domain_center, (500., "kpc"))
 
 # Radial profile from the sphere
 
-rad_profile = BinnedProfile1D(sp, 100, "Radiuskpc", 0.0, 500., log_space=False)
-
-# Adding density and temperature fields to the profile
-
-rad_profile.add_fields(["density","temperature"])
+prof = yt.BinnedProfile1D(sp, 100, "Radiuskpc", 0.0, 500., log_space=False)
+prof = yt.ProfilePlot(sp, 'radius', ['density', 'temperature'], weight_field="cell_mass")
+prof.set_unit('radius', 'kpc')
+prof.set_log('radius', False)
+prof.set_xlim(0, 500)
 
 # Write profiles to ASCII file
 
-rad_profile.write_out("%s_profile.dat" % pf, bin_style="center")
+prof.write_out("%s_profile.dat" % ds, bin_style="center")
 
 # Write profiles to HDF5 file
 
-rad_profile.write_out_h5("%s_profile.h5" % pf, bin_style="center")
+prof.write_out_h5("%s_profile.h5" % ds, bin_style="center")
 
 # Now we will show how using NumPy, h5py, and Matplotlib the data in these
 # files may be plotted.
@@ -42,13 +45,13 @@
 ax.set_xlabel(r"$\mathrm{r\ (kpc)}$")
 ax.set_ylabel(r"$\mathrm{\rho\ (g\ cm^{-3})}$")
 ax.set_title("Density vs. Radius")
-fig1.savefig("%s_dens.png" % pf)
+fig1.savefig("%s_dens.png" % ds)
 
 # Plot temperature from HDF5 file
 
 # Get the file handle
 
-f = h5py.File("%s_profile.h5" % pf, "r")
+f = h5py.File("%s_profile.h5" % ds, "r")
 
 # Get the radius and temperature arrays from the file handle
 
@@ -66,4 +69,4 @@
 ax.set_xlabel(r"$\mathrm{r\ (kpc)}$")
 ax.set_ylabel(r"$\mathrm{T\ (K)}$")
 ax.set_title("temperature vs. Radius")
-fig2.savefig("%s_temp.png" % pf)
+fig2.savefig("%s_temp.png" % ds)

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/show_hide_axes_colorbar.py
--- a/doc/source/cookbook/show_hide_axes_colorbar.py
+++ b/doc/source/cookbook/show_hide_axes_colorbar.py
@@ -1,8 +1,8 @@
-from yt.mods import *
+import yt
 
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
-slc = SlicePlot(pf, "x", "density")
+slc = yt.SlicePlot(ds, "x", "density")
 
 slc.save("default_sliceplot.png")
 

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_contour_in_slice.py
--- a/doc/source/cookbook/simple_contour_in_slice.py
+++ b/doc/source/cookbook/simple_contour_in_slice.py
@@ -1,10 +1,10 @@
-from yt.mods import *
+import yt
 
 # Load the data file.
-pf = load("Sedov_3d/sedov_hdf5_chk_0002")
+ds = yt.load("Sedov_3d/sedov_hdf5_chk_0002")
 
 # Make a traditional slice plot.
-sp = SlicePlot(pf,"x","density")
+sp = yt.SlicePlot(ds, "x", "density")
 
 # Overlay the slice plot with thick red contours of density.
 sp.annotate_contour("density", ncont=3, clim=(1e-2,1e-1), label=True,

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_off_axis_projection.py
--- a/doc/source/cookbook/simple_off_axis_projection.py
+++ b/doc/source/cookbook/simple_off_axis_projection.py
@@ -1,12 +1,12 @@
-from yt.mods import *
+import yt
 
 # Load the dataset.
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
 # Create a 1 kpc radius sphere, centered on the max density.  Note that this
 # sphere is very small compared to the size of our final plot, and it has a
 # non-axially aligned L vector.
-sp = pf.sphere("center", (15.0, "kpc"))
+sp = ds.sphere("center", (15.0, "kpc"))
 
 # Get the angular momentum vector for the sphere.
 L = sp.quantities["AngularMomentumVector"]()
@@ -14,5 +14,5 @@
 print "Angular momentum vector: {0}".format(L)
 
 # Create an OffAxisSlicePlot on the object with the L vector as its normal
-p = OffAxisProjectionPlot(pf, L, "density", sp.center, (25, "kpc"))
+p = yt.OffAxisProjectionPlot(ds, L, "density", sp.center, (25, "kpc"))
 p.save()

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_pdf.py
--- a/doc/source/cookbook/simple_pdf.py
+++ b/doc/source/cookbook/simple_pdf.py
@@ -1,14 +1,14 @@
-from yt.mods import *
+import yt
 
 # Load the dataset.
-pf = load("GalaxyClusterMerger/fiducial_1to3_b0.273d_hdf5_plt_cnt_0175")
+ds = yt.load("GalaxyClusterMerger/fiducial_1to3_b0.273d_hdf5_plt_cnt_0175")
 
 # Create a data object that represents the whole box.
-ad = pf.h.all_data()
+ad = ds.h.all_data()
 
 # This is identical to the simple phase plot, except we supply 
 # the fractional=True keyword to divide the profile data by the sum. 
-plot = PhasePlot(ad, "density", "temperature", "cell_mass",
+plot = yt.PhasePlot(ad, "density", "temperature", "cell_mass",
                  weight_field=None, fractional=True)
 
 # Set a new title for the colorbar since it is now fractional.

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_phase.py
--- a/doc/source/cookbook/simple_phase.py
+++ b/doc/source/cookbook/simple_phase.py
@@ -1,18 +1,21 @@
-from yt.mods import *
+import yt
 
 # Load the dataset.
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
 # Create a sphere of radius 100 kpc in the center of the domain.
-my_sphere = pf.sphere("c", (100.0, "kpc"))
+my_sphere = ds.sphere("c", (100.0, "kpc"))
 
 # Create a PhasePlot object.
 # Setting weight to None will calculate a sum.
 # Setting weight to a field will calculate an average
 # weighted by that field.
-plot = PhasePlot(my_sphere, "density", "temperature", "cell_mass",
+plot = yt.PhasePlot(my_sphere, "density", "temperature", "cell_mass",
                  weight_field=None)
 
+# Set the units of mass to be in solar masses (not the default in cgs)
+plot.set_unit('cell_mass', 'Msun')
+
 # Save the image.
 # Optionally, give a string as an argument
 # to name files with a keyword.

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_plots.rst
--- a/doc/source/cookbook/simple_plots.rst
+++ b/doc/source/cookbook/simple_plots.rst
@@ -8,11 +8,26 @@
 Simple Slices
 ~~~~~~~~~~~~~
 
-This script shows the simplest way to make a slice from the scripting
-interface.
+This script shows the simplest way to make a slice through a dataset.
 
 .. yt_cookbook:: simple_slice.py
 
+Simple Projections
+~~~~~~~~~~~~~~~~~~
+
+This is the simplest way to make a projection through a dataset.
+
+.. yt_cookbook:: simple_projection.py
+
+Simple Phase Plots
+~~~~~~~~~~~~~~~~~~
+
+This demonstrates how to make a phase plot.  Phase plots can be thought of as
+two-dimensional histograms, where the value is either the weighted-average or
+the total accumulation in a cell.
+
+.. yt_cookbook:: simple_phase.py
+
 Simple Probability Distribution Functions
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -22,24 +37,23 @@
 
 .. yt_cookbook:: simple_pdf.py
 
-Simple Phase Plots
-~~~~~~~~~~~~~~~~~~
+Simple 1D Histograms (Profiles)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-This demonstrates how to make a phase plot.  Phase plots can be thought of as
-two-dimensional histograms, where the value is either the weighted-average or
-the total accumulation in a cell.
-
-.. yt_cookbook:: simple_phase.py
-
-Simple 1D Histograms
-~~~~~~~~~~~~~~~~~~~~
-
-This is a "profile," which is a 1D profile.  This can be thought of as either
+This is a "profile," which is a 1D histogram.  This can be thought of as either
 the total accumulation (when weight_field is set to ``None``) or the average 
 (when a weight_field is supplied.)
 
 .. yt_cookbook:: simple_profile.py
 
+Simple Radial Profiles
+~~~~~~~~~~~~~~~~~~~~~~
+
+This shows how to make a profile of a quantity with respect to the radius, in
+this case the radius in Mpc.
+
+.. yt_cookbook:: simple_radial_profile.py
+
 1D Profiles Over Time
 ~~~~~~~~~~~~~~~~~~~~~
 
@@ -48,21 +62,6 @@
 
 .. yt_cookbook:: time_series_profiles.py
 
-Simple Projections
-~~~~~~~~~~~~~~~~~~
-
-This is the simplest way to make a projection through a dataset.
-
-.. yt_cookbook:: simple_projection.py
-
-Simple Radial Profiles
-~~~~~~~~~~~~~~~~~~~~~~
-
-This shows how to make a profile of a quantity with respect to the radius, in
-this case the radius in Mpc.
-
-.. yt_cookbook:: simple_radial_profile.py
-
 .. _cookbook-profile-variance:
 
 Profiles with Variance Values
@@ -85,6 +84,32 @@
 
 .. yt_cookbook:: simple_slice_with_multiple_fields.py 
 
+Off-Axis Slicing
+~~~~~~~~~~~~~~~~
+
+A cutting plane allows you to slice at some angle that isn't aligned with the
+axes.
+
+.. yt_cookbook:: aligned_cutting_plane.py
+
+.. _cookbook-simple-off-axis-projection:
+
+Off-Axis Projection
+~~~~~~~~~~~~~~~~~~~
+
+Like cutting planes, off-axis projections can be created from any arbitrary 
+viewing angle.
+
+.. yt_cookbook:: simple_off_axis_projection.py
+
+Simple Volume Rendering
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Volume renderings are 3D projections rendering isocontours in any arbitrary
+field (e.g. density, temperature, pressure, etc.)
+
+.. yt_cookbook:: simple_volume_rendering.py
+
 Showing and Hiding Axes Labels and Colorbars
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -104,37 +129,11 @@
 
 .. yt_cookbook:: simple_slice_matplotlib_example.py 
 
-Off-Axis Slicing
-~~~~~~~~~~~~~~~~
-
-A cutting plane allows you to slice at some angle that isn't aligned with the
-axes.
-
-.. yt_cookbook:: aligned_cutting_plane.py
-
-.. _cookbook-simple-off-axis-projection:
-
-Off-Axis Projection
-~~~~~~~~~~~~~~~~~~~
-
-Here we see how to make a off axis projection through a dataset.
-
-.. yt_cookbook:: simple_off_axis_projection.py
-
 .. _cookbook-simple_volume_rendering:
 
-Simple Volume Rendering
-~~~~~~~~~~~~~~~~~~~~~~~
-
-Here we see how to make a very simple volume rendering, where each option is
-considered in turn.
-
-.. yt_cookbook:: simple_volume_rendering.py
-
 Image Background Colors
 ~~~~~~~~~~~~~~~~~~~~~~~
 
 Here we see how to take an image and save it using different background colors. 
 
 .. yt_cookbook:: image_background_colors.py
-

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_profile.py
--- a/doc/source/cookbook/simple_profile.py
+++ b/doc/source/cookbook/simple_profile.py
@@ -1,14 +1,17 @@
-from yt.mods import *
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
+import yt
 
 # Load the dataset.
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
 # Create a 1D profile within a sphere of radius 100 kpc
 # of the average temperature and average velocity_x 
 # vs. density, weighted by mass.
-sphere = pf.sphere("c", (100., "kpc"))
-plot = ProfilePlot(sphere, "density", ["temperature", "velocity_x"],
-                   weight_field="cell_mass")
+sphere = ds.sphere("c", (100., "kpc"))
+plot = yt.ProfilePlot(sphere, "density", ["temperature", "velocity_x"],
+                      weight_field="cell_mass")
 
 # Save the image.
 # Optionally, give a string as an argument

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_projection.py
--- a/doc/source/cookbook/simple_projection.py
+++ b/doc/source/cookbook/simple_projection.py
@@ -1,10 +1,10 @@
-from yt.mods import *
+import yt
 
 # Load the dataset.
-pf = load("GalaxyClusterMerger/fiducial_1to3_b0.273d_hdf5_plt_cnt_0175")
+ds = yt.load("GalaxyClusterMerger/fiducial_1to3_b0.273d_hdf5_plt_cnt_0175")
 
 # Create projections of the density-weighted mean density.
 
-ProjectionPlot(pf, "x", "density", weight_field = "density").save()
-ProjectionPlot(pf, "y", "density", weight_field = "density").save()
-ProjectionPlot(pf, "z", "density", weight_field = "density").save()
+yt.ProjectionPlot(ds, "x", "density", weight_field = "density").save()
+yt.ProjectionPlot(ds, "y", "density", weight_field = "density").save()
+yt.ProjectionPlot(ds, "z", "density", weight_field = "density").save()

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_radial_profile.py
--- a/doc/source/cookbook/simple_radial_profile.py
+++ b/doc/source/cookbook/simple_radial_profile.py
@@ -1,14 +1,17 @@
-from yt.mods import *
+import yt
 
 # Load the dataset.
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
 
 # Create a sphere of radius 100 kpc in the center of the box.
-my_sphere = pf.sphere("c", (100.0, "kpc"))
+my_sphere = ds.sphere("c", (100.0, "kpc"))
 
 # Create a profile of the average density vs. radius.
-plot = ProfilePlot(my_sphere, "Radiuskpc", "density",
-                   weight_field="cell_mass")
+plot = yt.ProfilePlot(my_sphere, "radius", "density",
+                      weight_field="cell_mass")
+
+# Change the units of the radius into kpc (and not the default in cgs)
+plot.set_unit('radius', 'kpc')
 
 # Save the image.
 # Optionally, give a string as an argument

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_slice.py
--- a/doc/source/cookbook/simple_slice.py
+++ b/doc/source/cookbook/simple_slice.py
@@ -1,9 +1,9 @@
-from yt.mods import *
+import yt
 
 # Load the dataset.
-pf = load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
+ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
 
 # Create density slices in all three axes.
-SlicePlot(pf, 'x', "density", width = (800.0, 'kpc')).save()
-SlicePlot(pf, 'y', "density", width = (800.0, 'kpc')).save()
-SlicePlot(pf, 'z', "density", width = (800.0, 'kpc')).save()
+yt.SlicePlot(ds, 'x', "density", width = (800.0, 'kpc')).save()
+yt.SlicePlot(ds, 'y', "density", width = (800.0, 'kpc')).save()
+yt.SlicePlot(ds, 'z', "density", width = (800.0, 'kpc')).save()

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_slice_matplotlib_example.py
--- a/doc/source/cookbook/simple_slice_matplotlib_example.py
+++ b/doc/source/cookbook/simple_slice_matplotlib_example.py
@@ -1,10 +1,11 @@
-from yt.mods import *
+import yt
+import numpy as np
 
 # Load the dataset.
-pf = load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
+ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
 
 # Create a slice object
-slc = SlicePlot(pf,'x','density',width=(800.0,'kpc'))
+slc = yt.SlicePlot(ds,'x','density',width=(800.0,'kpc'))
 
 # Get a reference to the matplotlib axes object for the plot
 ax = slc.plots['density'].axes
@@ -12,17 +13,23 @@
 # Let's adjust the x axis tick labels
 for label in ax.xaxis.get_ticklabels():
     label.set_color('red')
-    label.set_rotation(45)
     label.set_fontsize(16)
 
 # Get a reference to the matplotlib figure object for the plot
 fig = slc.plots['density'].figure
 
+# And create a mini-panel of a gaussian histogram inside the plot
 rect = (0.2,0.2,0.2,0.2)
 new_ax = fig.add_axes(rect)
 
 n, bins, patches = new_ax.hist(np.random.randn(1000)+20, 50,
-    facecolor='yellow', edgecolor='yellow')
-new_ax.set_xlabel('Dinosaurs per furlong')
+    facecolor='black', edgecolor='black')
+
+# Make sure its visible
+new_ax.tick_params(colors='white')
+
+# And label it
+la = new_ax.set_xlabel('Dinosaurs per furlong')
+la.set_color('white')
 
 slc.save()

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_slice_with_multiple_fields.py
--- a/doc/source/cookbook/simple_slice_with_multiple_fields.py
+++ b/doc/source/cookbook/simple_slice_with_multiple_fields.py
@@ -1,8 +1,11 @@
-from yt.mods import *
+### THIS RECIPE IS CURRENTLY BROKEN IN YT-3.0
+### DO NOT TRUST THIS RECIPE UNTIL THIS LINE IS REMOVED
+
+import yt
 
 # Load the dataset
-pf = load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
+ds = yt.load("GasSloshing/sloshing_nomag2_hdf5_plt_cnt_0150")
 
 # Create density slices of several fields along the x axis
-SlicePlot(pf, 'x', ['density','temperature','pressure','vorticity_squared'], 
-          width = (800.0, 'kpc')).save()
+yt.SlicePlot(ds, 'x', ['density','temperature','pressure','vorticity_squared'], 
+             width = (800.0, 'kpc')).save()

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simple_volume_rendering.py
--- a/doc/source/cookbook/simple_volume_rendering.py
+++ b/doc/source/cookbook/simple_volume_rendering.py
@@ -1,18 +1,19 @@
-from yt.mods import *
+import yt
+import numpy as np
 
 # Load the dataset.
-pf = load("Enzo_64/DD0043/data0043")
+ds = yt.load("Enzo_64/DD0043/data0043")
 
 # Create a data container (like a sphere or region) that
 # represents the entire domain.
-dd = pf.h.all_data()
+ad = ds.h.all_data()
 
 # Get the minimum and maximum densities.
-mi, ma = dd.quantities["Extrema"]("density")[0]
+mi, ma = ad.quantities.extrema("density")
 
 # Create a transfer function to map field values to colors.
 # We bump up our minimum to cut out some of the background fluid
-tf = ColorTransferFunction((np.log10(mi)+1, np.log10(ma)))
+tf = yt.ColorTransferFunction((np.log10(mi)+1, np.log10(ma)))
 
 # Add three guassians, evenly spaced between the min and
 # max specified above with widths of 0.02 and using the
@@ -37,11 +38,11 @@
 # Create a camera object.
 # This object creates the images and
 # can be moved and rotated.
-cam = pf.h.camera(c, L, W, Npixels, tf)
+cam = ds.camera(c, L, W, Npixels, tf)
 
 # Create a snapshot.
 # The return value of this function could also be accepted, modified (or saved
 # for later manipulation) and then put written out using write_bitmap.
 # clip_ratio applies a maximum to the function, which is set to that value
 # times the .std() of the array.
-cam.snapshot("%s_volume_rendered.png" % pf, clip_ratio=8.0)
+cam.snapshot("%s_volume_rendered.png" % ds, clip_ratio=8.0)

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/simulation_analysis.py
--- a/doc/source/cookbook/simulation_analysis.py
+++ b/doc/source/cookbook/simulation_analysis.py
@@ -1,20 +1,28 @@
-from yt.mods import *
+import yt
+import collections
 
 # Instantiate a time series object for an Enzo simulation..
-my_sim = simulation('enzo_tiny_cosmology/32Mpc_32.enzo', 'Enzo')
+sim = yt.simulation('enzo_tiny_cosmology/32Mpc_32.enzo', 'Enzo')
 
 # Get a time series for all data made by the simulation.
-my_sim.get_time_series()
+sim.get_time_series()
 
-# Calculate and store extrema for all datasets.
-all_storage = {}
-for my_storage, pf in my_sim.piter(storage=all_storage):
-    all_data = pf.h.all_data()
-    my_extrema = all_data.quantities['Extrema']('density')
+# Calculate and store extrema for all datasets along with redshift
+# in a data dictionary with entries as tuples
 
-    # Save to storage so we can get at it afterward.
-    my_storage.result = my_extrema
+# Note that by using sim.piter(), we are automatically 
+# forcing yt to do this in parallel
+data = {}
+for ds in sim.piter():
+    ad = ds.all_data()
+    extrema = ad.quantities.extrema('density')
+    data[ds.basename] = (extrema, ds.current_redshift)
+
+# Convert dictionary to ordered dictionary to get the right order
+od = collections.OrderedDict(sorted(data.items()))
 
 # Print out all the values we calculated.
-for my_result in all_storage.values():
-    print my_result
+print "Dataset      Redshift        Density Min      Density Max"
+print "---------------------------------------------------------"
+for k, v in od.iteritems(): 
+    print "%s       %05.3f          %5.3g g/cm^3   %5.3g g/cm^3" % (k, v[1], v[0][0], v[0][1])

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/streamlines.py
--- a/doc/source/cookbook/streamlines.py
+++ b/doc/source/cookbook/streamlines.py
@@ -1,22 +1,40 @@
-from yt.mods import *
+import yt
+import numpy as np
 from yt.visualization.api import Streamlines
+import matplotlib.pylab as pl
+from mpl_toolkits.mplot3d import Axes3D
 
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
-c = np.array([0.5]*3)
+# Load the dataset 
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+
+# Define c: the center of the box, N: the number of streamlines, 
+# scale: the spatial scale of the streamlines relative to the boxsize,
+# and then pos: the random positions of the streamlines.
+c = ds.arr([0.5]*3, 'code_length')
 N = 100
-scale = 1.0
+scale = ds.arr(1.0, 'code_length')
 pos_dx = np.random.random((N,3))*scale-scale/2.
 pos = c+pos_dx
 
-streamlines = Streamlines(pf,pos,'velocity_x', 'velocity_y', 'velocity_z', length=1.0) 
+# Create the streamlines from these positions with the velocity fields as the 
+# fields to be traced
+streamlines = Streamlines(ds, pos, 'velocity_x', 'velocity_y', 'velocity_z', length=1.0) 
 streamlines.integrate_through_volume()
 
-import matplotlib.pylab as pl
-from mpl_toolkits.mplot3d import Axes3D
-fig=pl.figure() 
+# Create a 3D matplotlib figure for visualizing the streamlines
+fig = pl.figure() 
 ax = Axes3D(fig)
+
+# Trace the streamlines through the volume of the 3D figure
 for stream in streamlines.streamlines:
-    stream = stream[np.all(stream != 0.0, axis=1)]
-    ax.plot3D(stream[:,0], stream[:,1], stream[:,2], alpha=0.1)
+    stream = stream[ np.all(stream != 0.0, axis=1)]
+
+    # Make the colors of each stream vary continuously from blue to red
+    # from low-x to high-x of the stream start position (each color is R, G, B)
+    color = (stream[0,0], 0, 1-stream[0,0])
+
+    # Plot the stream in 3D
+    ax.plot3D(stream[:,0], stream[:,1], stream[:,2], alpha=0.3, color=color)
+
+# Save the figure
 pl.savefig('streamlines.png')
-

diff -r 462244d11e3315d3098cc411cf7a9cd0b824764e -r 1d4b798712da4baa056d633ee73bd6b6b7e89cc1 doc/source/cookbook/streamlines_isocontour.py
--- a/doc/source/cookbook/streamlines_isocontour.py
+++ b/doc/source/cookbook/streamlines_isocontour.py
@@ -1,35 +1,63 @@
-from yt.mods import *
+import yt
+import numpy as np
 from yt.visualization.api import Streamlines
-
-pf = load("IsolatedGalaxy/galaxy0030/galaxy0030")
-c = np.array([0.5]*3)
-N = 30
-scale = 15.0/pf['kpc']
-pos_dx = np.random.random((N,3))*scale-scale/2.
-pos = c+pos_dx
-
-streamlines = Streamlines(pf,pos,'velocity_x', 'velocity_y', 'velocity_z', length=1.0) 
-streamlines.integrate_through_volume()
-
 import matplotlib.pylab as pl
 from mpl_toolkits.mplot3d import Axes3D
 from mpl_toolkits.mplot3d.art3d import Poly3DCollection
+
+# Load the dataset
+ds = yt.load("IsolatedGalaxy/galaxy0030/galaxy0030")
+
+# Define c: the center of the box, N: the number of streamlines,
+# scale: the spatial scale of the streamlines relative to the boxsize,
+# and then pos: the random positions of the streamlines.
+c = ds.arr([0.5]*3, 'code_length')
+N = 30
+scale = ds.quan(15, 'kpc').in_units('code_length')  # 15 kpc in code units
+pos_dx = np.random.random((N,3))*scale-scale/2.
+pos = c+pos_dx
+ 
+# Create the streamlines from these positions with the velocity fields as the
+# fields to be traced
+streamlines = Streamlines(ds, pos, 'velocity_x', 'velocity_y', 'velocity_z', length=1.0) 
+streamlines.integrate_through_volume()
+
+# Create a 3D matplotlib figure for visualizing the streamlines
 fig=pl.figure() 
 ax = Axes3D(fig)
+
+# Trace the streamlines through the volume of the 3D figure
 for stream in streamlines.streamlines:
     stream = stream[np.all(stream != 0.0, axis=1)]
-    ax.plot3D(stream[:,0], stream[:,1], stream[:,2], alpha=0.1)
 
+    # Make the colors of each stream vary continuously from blue to red
+    # from low-x to high-x of the stream start position (each color is R, G, B)
+    # can omit and just set streamline colors to a fixed color
+    x_start_pos = ds.arr(stream[0,0], 'code_length')
+    x_start_pos -= ds.arr(0.5, 'code_length')
+    x_start_pos /= scale 
+    x_start_pos += 0.5
+    color = np.array([x_start_pos, 0, 1-x_start_pos])
 
-sphere = pf.sphere("max", (1.0, "mpc"))
-surface = pf.surface(sphere, "density", 1e-24)
-colors = apply_colormap(np.log10(surface["temperature"]), cmap_name="hot")
+    # Plot the stream in 3D
+    ax.plot3D(stream[:,0], stream[:,1], stream[:,2], alpha=0.3, color=color)
 
+# Create a sphere object centered on the highest density point in the simulation
+# with radius = 1 Mpc
+sphere = ds.sphere("max", (1.0, "Mpc"))
+
+# Identify the isodensity surface in this sphere with density = 1e-24 g/cm^3
+surface = ds.surface(sphere, "density", 1e-24)
+
+# Color this isodensity surface according to the log of the temperature field
+colors = yt.apply_colormap(np.log10(surface["temperature"]), cmap_name="hot")
+
+# Render this surface 
 p3dc = Poly3DCollection(surface.triangles, linewidth=0.0)
-colors = colors[0,:,:]/255.
-colors[:,3] = 0.3
+colors = colors[0,:,:]/255.  # scale to [0,1]
+colors[:,3] = 0.3            # alpha = 0.3
 p3dc.set_facecolors(colors)
 ax.add_collection(p3dc)
 
+# Save the figure
 pl.savefig('streamlines_isocontour.png')
-

This diff is so big that we needed to truncate the remainder.

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

--

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