[yt-svn] commit/yt: 142 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Mar 13 06:56:17 PDT 2014


142 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/6c4e150214e8/
Changeset:   6c4e150214e8
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-06 23:17:30
Summary:     Adding units to field info container. Fixing up universal_fields to use plain unit symbols (no tex).
Affected #:  5 files

diff -r 1547e8bdcf7834ab673b6128553e3290d18b2200 -r 6c4e150214e8e8a5767db979ad3d85930fb5d079 yt/data_objects/field_info_container.py
--- a/yt/data_objects/field_info_container.py
+++ b/yt/data_objects/field_info_container.py
@@ -33,6 +33,7 @@
 import numpy as np
 
 from yt.funcs import *
+from yt.utilities.units import Unit
 
 class FieldInfoContainer(dict): # Resistance has utility
     """
@@ -196,7 +197,7 @@
                 lambda: np.ones((nd, nd, nd), dtype='float64')
                 + 1e-4*np.random.random((nd, nd, nd)))
         else:
-            defaultdict.__init__(self, 
+            defaultdict.__init__(self,
                 lambda: np.ones((nd * nd * nd), dtype='float64')
                 + 1e-4*np.random.random((nd * nd * nd)))
 
@@ -237,20 +238,27 @@
             return np.random.random(3) * 1e-2
         else:
             return 0.0
+
     _num_ghost_zones = 0
     id = 1
-    def has_field_parameter(self, param): return True
-    def convert(self, item): return 1
+
+    def has_field_parameter(self, param):
+        return True
+
+    def convert(self, item):
+        return 1
+
+
+class FieldUnitsError(Exception):
+    pass
 
 class DerivedField(object):
-    def __init__(self, name, function,
-                 convert_function = None,
-                 particle_convert_function = None,
-                 units = "", projected_units = "",
-                 take_log = True, validators = None,
-                 particle_type = False, vector_field=False,
-                 display_field = True, not_in_all=False,
-                 display_name = None, projection_conversion = "cm"):
+    def __init__(self, name, function, convert_function=None,
+                 particle_convert_function=None, units=None,
+                 projected_units=None, take_log=True, validators=None,
+                 particle_type=False, vector_field=False, display_field=True,
+                 not_in_all=False, display_name=None,
+                 projection_conversion="cm"):
         """
         This is the base class used to describe a cell-by-cell derived field.
 
@@ -270,26 +278,46 @@
         :param display_name: a name used in the plots
         :param projection_conversion: which unit should we multiply by in a
                                       projection?
+
         """
         self.name = name
+        self.take_log = take_log
+        self.display_name = display_name
+        self.not_in_all = not_in_all
+        self.display_field = display_field
+        self.particle_type = particle_type
+        self.vector_field = vector_field
+
         self._function = function
+        if not convert_function:
+            convert_function = lambda a: 1.0
+        self._convert_function = convert_function
+        self.particle_convert_function = particle_convert_function
+        self.projection_conversion = projection_conversion
+
         if validators:
             self.validators = ensure_list(validators)
         else:
             self.validators = []
-        self.take_log = take_log
-        self._units = units
-        self._projected_units = projected_units
-        if not convert_function:
-            convert_function = lambda a: 1.0
-        self._convert_function = convert_function
-        self._particle_convert_function = particle_convert_function
-        self.particle_type = particle_type
-        self.vector_field = vector_field
-        self.projection_conversion = projection_conversion
-        self.display_field = display_field
-        self.display_name = display_name
-        self.not_in_all = not_in_all
+
+        # handle units
+        if units is None:
+            self.units = Unit()
+        elif isinstance(units, str):
+            self.units = Unit(units)
+        elif isinstance(units, Unit):
+            self.units = units
+        else:
+            raise FieldUnitsException("Bad units type. Please provide a Unit object or a string.")
+
+        if projected_units is None:
+            self.projected_units = Unit
+        elif isinstance(projected_units, str):
+            self.projected_units = Unit(projected_units)
+        elif isinstance(projected_units, Unit):
+            self.projected_units = projected_units
+        else:
+            raise FieldUnitsException("Bad projected_units type. Please provide a Unit object or a string.")
 
     def check_available(self, data):
         """
@@ -312,16 +340,6 @@
             e[self.name]
         return e
 
-    def get_units(self):
-        """ Return a string describing the units. """
-        return self._units
-
-    def get_projected_units(self):
-        """
-        Return a string describing the units if the field has been projected.
-        """
-        return self._projected_units
-
     def __call__(self, data):
         """ Return the value of the field in a given *data* object. """
         ii = self.check_available(data)
@@ -344,11 +362,21 @@
         Return a data label for the given field, inluding units.
         """
         name = self.name
-        if self.display_name is not None: name = self.display_name
+        if self.display_name is not None:
+            name = self.display_name
+
+        # Start with the field name
         data_label = r"$\rm{%s}" % name
-        if projected: units = self.get_projected_units()
-        else: units = self.get_units()
-        if units != "": data_label += r"\/\/ (%s)" % (units)
+
+        # Grab the correct units
+        if projected:
+            units = self.projected_units
+        else:
+            units = self.units
+        # Add unit label
+        if not units.is_dimensionless:
+            data_label += r"\/\/ (%s)" % (units)
+
         data_label += r"$"
         return data_label
 

diff -r 1547e8bdcf7834ab673b6128553e3290d18b2200 -r 6c4e150214e8e8a5767db979ad3d85930fb5d079 yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -47,15 +47,15 @@
     NeedsParameter
 
 from yt.utilities.physical_constants import \
-     mh, \
-     me, \
-     sigma_thompson, \
-     clight, \
-     kboltz, \
-     G, \
-     rho_crit_now, \
-     speed_of_light_cgs, \
-     km_per_cm
+    mh, \
+    me, \
+    sigma_thompson, \
+    clight, \
+    kboltz, \
+    G, \
+    rho_crit_now, \
+    speed_of_light_cgs, \
+    km_per_cm
 
 from yt.utilities.math_utils import \
     get_sph_r_component, \
@@ -67,406 +67,372 @@
     get_cyl_r, get_cyl_theta, \
     get_cyl_z, get_sph_r, \
     get_sph_theta, get_sph_phi
-     
+
 # Note that, despite my newfound efforts to comply with PEP-8,
 # I violate it here in order to keep the name/func_name relationship
 
 def _dx(field, data):
-    return np.ones(data.ActiveDimensions, dtype='float64') * data.dds[0]
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[0]
+
 add_field('dx', function=_dx, display_field=False,
           validators=[ValidateSpatial(0)])
 
 def _dy(field, data):
-    return np.ones(data.ActiveDimensions, dtype='float64') * data.dds[1]
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[1]
+
 add_field('dy', function=_dy, display_field=False,
           validators=[ValidateSpatial(0)])
 
 def _dz(field, data):
-    return np.ones(data.ActiveDimensions, dtype='float64') * data.dds[2]
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[2]
+
 add_field('dz', function=_dz,
           display_field=False, validators=[ValidateSpatial(0)])
 
-def _coordX(field, data):
+def _coord_x(field, data):
     dim = data.ActiveDimensions[0]
-    return (np.ones(data.ActiveDimensions, dtype='float64')
-                   * np.arange(data.ActiveDimensions[0])[:,None,None]
-            +0.5) * data['dx'] + data.LeftEdge[0]
-add_field('x', function=_coordX, display_field=False,
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[0])[:, None, None] + 0.5 )
+             * data['dx'] + data.LeftEdge[0] )
+
+add_field('x', function=_coord_x, display_field=False,
           validators=[ValidateSpatial(0)])
 
-def _coordY(field, data):
+def _coord_y(field, data):
     dim = data.ActiveDimensions[1]
-    return (np.ones(data.ActiveDimensions, dtype='float64')
-                   * np.arange(data.ActiveDimensions[1])[None,:,None]
-            +0.5) * data['dy'] + data.LeftEdge[1]
-add_field('y', function=_coordY, display_field=False,
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[1])[None, :, None] + 0.5 )
+             * data['dy'] + data.LeftEdge[1] )
+
+add_field('y', function=_coord_y, display_field=False,
           validators=[ValidateSpatial(0)])
 
-def _coordZ(field, data):
+def _coord_z(field, data):
     dim = data.ActiveDimensions[2]
-    return (np.ones(data.ActiveDimensions, dtype='float64')
-                   * np.arange(data.ActiveDimensions[2])[None,None,:]
-            +0.5) * data['dz'] + data.LeftEdge[2]
-add_field('z', function=_coordZ, display_field=False,
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[2])[None, None, :] + 0.5 )
+             * data['dz'] + data.LeftEdge[2] )
+
+add_field('z', function=_coord_z, display_field=False,
           validators=[ValidateSpatial(0)])
 
-def _GridLevel(field, data):
-    return np.ones(data.ActiveDimensions)*(data.Level)
-add_field("GridLevel", function=_GridLevel,
-          validators=[ValidateGridType(),
-                      ValidateSpatial(0)])
+def _grid_level(field, data):
+    return np.ones(data.ActiveDimensions) * data.Level
 
-def _GridIndices(field, data):
-    return np.ones(data["Ones"].shape)*(data.id-data._id_offset)
-add_field("GridIndices", function=_GridIndices,
-          validators=[ValidateGridType(),
-                      ValidateSpatial(0)], take_log=False)
+add_field("grid_level", function=_grid_level,
+          validators=[ValidateGridType(), ValidateSpatial(0)])
 
-def _OnesOverDx(field, data):
-    return np.ones(data["Ones"].shape,
-                   dtype=data["Density"].dtype)/data['dx']
-add_field("OnesOverDx", function=_OnesOverDx,
+def _grid_indices(field, data):
+    return np.ones(data["ones"].shape) * (data.id - data._id_offset)
+
+add_field("grid_indices", function=_grid_indices, take_log=False,
+          validators=[ValidateGridType(), ValidateSpatial(0)])
+
+def _ones_over_dx(field, data):
+    return np.ones(data["ones"].shape, dtype=data["density"].dtype) / data['dx']
+
+add_field("ones_over_dx", function=_ones_over_dx, display_field=False)
+
+def _ones(field, data):
+    return np.ones(data.shape, dtype=np.float64)
+
+add_field("ones", function=_ones, projection_conversion="unitary",
           display_field=False)
+add_field("cells_per_bin", function=_ones, display_field=False)
 
-def _Ones(field, data):
-    return np.ones(data.shape, dtype='float64')
-add_field("Ones", function=_Ones,
-          projection_conversion="unitary",
-          display_field = False)
-add_field("CellsPerBin", function=_Ones, display_field = False)
+def _sound_speed(field, data):
+    if data.pf["eos_type"] == 1:
+        return ( np.ones(data["density"].shape, dtype=np.float64)
+                 * data.pf["eos_sound_speed"] )
+    return np.sqrt( data.pf["gamma"] * data["pressure"] / data["density"] )
 
-def _SoundSpeed(field, data):
-    if data.pf["EOSType"] == 1:
-        return np.ones(data["Density"].shape, dtype='float64') * \
-                data.pf["EOSSoundSpeed"]
-    return ( data.pf["Gamma"]*data["Pressure"] / \
-             data["Density"] )**(1.0/2.0)
-add_field("SoundSpeed", function=_SoundSpeed,
-          units=r"\rm{cm}/\rm{s}")
+add_field("sound_speed", function=_sound_speed, units="cm/s")
 
-def _RadialMachNumber(field, data):
-    """M{|v|/t_sound}"""
-    return np.abs(data["RadialVelocity"]) / data["SoundSpeed"]
-add_field("RadialMachNumber", function=_RadialMachNumber)
+def _radial_mach_number(field, data):
+    """ M{|v|/t_sound} """
+    return np.abs(data["radial_velocity"]) / data["sound_speed"]
 
-def _MachNumber(field, data):
-    """M{|v|/t_sound}"""
-    return data["VelocityMagnitude"] / data["SoundSpeed"]
-add_field("MachNumber", function=_MachNumber)
+add_field("radial_mach_number", function=_radial_mach_number)
 
-def _CourantTimeStep(field, data):
-    t1 = data['dx'] / (
-        data["SoundSpeed"] + \
-        abs(data["x-velocity"]))
-    t2 = data['dy'] / (
-        data["SoundSpeed"] + \
-        abs(data["y-velocity"]))
-    t3 = data['dz'] / (
-        data["SoundSpeed"] + \
-        abs(data["z-velocity"]))
-    return np.minimum(np.minimum(t1,t2),t3)
-def _convertCourantTimeStep(data):
-    # SoundSpeed and z-velocity are in cm/s, dx is in code
+def _mach_number(field, data):
+    """ M{|v|/t_sound} """
+    return data["velocity_magnitude"] / data["sound_speed"]
+
+add_field("mach_number", function=_mach_number)
+
+def _courant_time_step(field, data):
+    t1 = data["dx"] / (data["sound_speed"] + np.abs(data["velocity_x"]))
+    t2 = data["dy"] / (data["sound_speed"] + np.abs(data["velocity_y"]))
+    t3 = data["dz"] / (data["sound_speed"] + np.abs(data["velocity_z"]))
+    return np.minimum(np.minimum(t1, t2), t3)
+def _convert_courant_time_step(data):
+    # sound speed and z-velocity are in cm/s, dx is in code
     return data.convert("cm")
-add_field("CourantTimeStep", function=_CourantTimeStep,
-          convert_function=_convertCourantTimeStep,
-          units=r"$\rm{s}$")
 
-def _ParticleVelocityMagnitude(field, data):
-    """M{|v|}"""
+add_field("courant_time_step", function=_courant_time_step,
+          convert_function=_convert_courant_time_step, units="s")
+
+def _particle_velocity_magnitude(field, data):
+    """ M{|v|} """
     bulk_velocity = data.get_field_parameter("bulk_velocity")
-    if bulk_velocity == None:
+    if bulk_velocity is None:
         bulk_velocity = np.zeros(3)
-    return ( (data["particle_velocity_x"]-bulk_velocity[0])**2.0 + \
-             (data["particle_velocity_y"]-bulk_velocity[1])**2.0 + \
-             (data["particle_velocity_z"]-bulk_velocity[2])**2.0 )**(1.0/2.0)
-add_field("ParticleVelocityMagnitude", function=_ParticleVelocityMagnitude,
-          particle_type=True, 
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+    return np.sqrt( (data["particle_velocity_x"] - bulk_velocity[0])**2
+                    + (data["particle_velocity_y"] - bulk_velocity[1])**2
+                    + (data["particle_velocity_z"] - bulk_velocity[2])**2 )
 
-def _VelocityMagnitude(field, data):
-    """M{|v|}"""
+add_field("particle_velocity_magnitude", function=_particle_velocity_magnitude,
+          particle_type=True, take_log=False, units="cm/s")
+
+def _velocity_magnitude(field, data):
+    """ M{|v|} """
     velocities = obtain_rv_vec(data)
-    return np.sqrt(np.sum(velocities**2,axis=0))
-add_field("VelocityMagnitude", function=_VelocityMagnitude,
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+    return np.sqrt(np.sum(velocities**2, axis=0))
 
-def _TangentialOverVelocityMagnitude(field, data):
-    return np.abs(data["TangentialVelocity"])/np.abs(data["VelocityMagnitude"])
-add_field("TangentialOverVelocityMagnitude",
-          function=_TangentialOverVelocityMagnitude,
-          take_log=False)
+add_field("velocity_magnitude", function=_velocity_magnitude,
+          take_log=False, units="cm/s")
 
-def _Pressure(field, data):
-    """M{(Gamma-1.0)*rho*E}"""
-    return (data.pf["Gamma"] - 1.0) * \
-           data["Density"] * data["ThermalEnergy"]
-add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+def _tangential_over_velocity_magnitude(field, data):
+    # @todo: can velocity_magnitude be negative?
+    return np.abs(data["tangential_velocity"]) / np.abs(data["velocity_magnitude"])
 
-def _Entropy(field, data):
+add_field("tangential_over_velocity_magnitude",
+          function=_tangential_over_velocity_magnitude, take_log=False)
+
+def _pressure(field, data):
+    """ M{(Gamma-1.0)*rho*E} """
+    return (data.pf["gamma"] - 1.0) * data["density"] * data["thermal_energy"]
+
+add_field("pressure", function=_pressure, units="dyne/cm**2")
+
+def _entropy(field, data):
     if data.has_field_parameter("mu"):
-        mw = mh*data.get_field_parameter("mu")
-    else :
+        mw = mh * data.get_field_parameter("mu")
+    else:
         mw = mh
-    return kboltz * data["Temperature"] / \
-           ((data["Density"]/mw)**(data.pf["Gamma"] - 1.0))
-add_field("Entropy", units=r"\rm{ergs}\ \rm{cm}^{3\gamma-3}",
-          function=_Entropy)
+    return ( kboltz * data["temperature"]
+             / ((data["density"] / mw)**(data.pf["gamma"] - 1.0)) )
 
-
+add_field("entropy", units="erg/K", function=_entropy)
 
 ### spherical coordinates: r (radius)
-def _sph_r(field, data):
+def _spherical_r(field, data):
     center = data.get_field_parameter("center")
-      
     coords = obtain_rvec(data).transpose()
-
     return get_sph_r(vectors, center)
 
-def _Convert_sph_r_CGS(data):
+def _convert_spherical_r_cgs(data):
    return data.convert("cm")
 
-add_field("sph_r", function=_sph_r,
+add_field("spherical_r", function=_spherical_r,
          validators=[ValidateParameter("center")],
-         convert_function = _Convert_sph_r_CGS, units=r"\rm{cm}")
-
+         convert_function=_convert_spherical_r_cgs, units="cm")
 
 ### spherical coordinates: theta (angle with respect to normal)
-def _sph_theta(field, data):
+def _spherical_theta(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
     coords = obtain_rvec(data).transpose()
-
     return get_sph_theta(coords, normal)
 
-add_field("sph_theta", function=_sph_theta,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
-
+add_field("spherical_theta", function=_spherical_theta,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### spherical coordinates: phi (angle in the plane perpendicular to the normal)
-def _sph_phi(field, data):
+def _spherical_phi(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
     coords = obtain_rvec(data).transpose()
-
     return get_sph_phi(coords, normal)
 
-add_field("sph_phi", function=_sph_phi,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
+add_field("spherical_phi", function=_spherical_phi,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### cylindrical coordinates: R (radius in the cylinder's plane)
-def _cyl_R(field, data):
+def _cylindrical_r(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-      
     coords = obtain_rvec(data).transpose()
-
     return get_cyl_r(coords, normal)
 
-def _Convert_cyl_R_CGS(data):
+def _convert_cylindrical_r_cgs(data):
    return data.convert("cm")
 
-add_field("cyl_R", function=_cyl_R,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")],
-         convert_function = _Convert_cyl_R_CGS, units=r"\rm{cm}")
-add_field("cyl_RCode", function=_cyl_R,
-          validators=[ValidateParameter("center"),ValidateParameter("normal")],
-          units=r"Radius (code)")
-
+add_field("cylindrical_r", function=_cylindrical_r,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")],
+         convert_function=_convert_cylindrical_r_cgs, units="cm")
+add_field("cylindrical_r_code", function=_cylindrical_r,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### cylindrical coordinates: z (height above the cylinder's plane)
-def _cyl_z(field, data):
+def _cylindrical_z(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
     coords = obtain_rvec(data).transpose()
-
     return get_cyl_z(coords, normal)
 
-def _Convert_cyl_z_CGS(data):
+def _convert_cylindrical_z_cgs(data):
    return data.convert("cm")
 
-add_field("cyl_z", function=_cyl_z,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")],
-         convert_function = _Convert_cyl_z_CGS, units=r"\rm{cm}")
-
+add_field("cylindrical_z", function=_cylindrical_z,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
+          convert_function=_convert_cylindrical_z_cgs, units="cm")
 
 ### cylindrical coordinates: theta (angle in the cylinder's plane)
-def _cyl_theta(field, data):
+def _cylindrical_theta(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
     coords = obtain_rvec(data).transpose()
-
     return get_cyl_theta(coords, normal)
 
-add_field("cyl_theta", function=_cyl_theta,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
+add_field("cylindrical_theta", function=_cylindrical_theta,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### The old field DiskAngle is the same as the spherical coordinates'
 ### 'theta' angle. I'm keeping DiskAngle for backwards compatibility.
-def _DiskAngle(field, data):
-    return data['sph_theta']
+# @todo: remove in 3.0?
+def _disk_angle(field, data):
+    return data["spherical_theta"]
 
-add_field("DiskAngle", function=_DiskAngle,
-          take_log=False,
-          validators=[ValidateParameter("center"),
-                      ValidateParameter("normal")],
+add_field("disk_angle", function=_disk_angle, take_log=False,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
           display_field=False)
 
-
 ### The old field Height is the same as the cylindrical coordinates' z
 ### field. I'm keeping Height for backwards compatibility.
-def _Height(field, data):
-    return data['cyl_z']
+# @todo: remove in 3.0?
+def _height(field, data):
+    return data["cylindrical_z"]
 
-def _convertHeight(data):
+def _convert_height(data):
     return data.convert("cm")
-def _convertHeightAU(data):
+
+def _convert_height_au(data):
     return data.convert("au")
-add_field("Height", function=_Height,
-          convert_function=_convertHeight,
+
+add_field("height", function=_height, convert_function=_convert_height,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
+          units="cm", display_field=False)
+add_field("height_au", function=_height, convert_function=_convert_height_au,
           validators=[ValidateParameter("center"),
                       ValidateParameter("normal")],
-          units=r"cm", display_field=False)
-add_field("HeightAU", function=_Height,
-          convert_function=_convertHeightAU,
-          validators=[ValidateParameter("center"),
-                      ValidateParameter("normal")],
-          units=r"AU", display_field=False)
+          units="AU", display_field=False)
 
-def _cyl_RadialVelocity(field, data):
+def _cylindrical_radial_velocity(field, data):
     normal = data.get_field_parameter("normal")
     velocities = obtain_rv_vec(data).transpose()
-
-    theta = np.tile(data['cyl_theta'], (3, 1)).transpose()
-
+    theta = np.tile(data['cylindrical_theta'], (3, 1)).transpose()
     return get_cyl_r_component(velocities, theta, normal)
 
-def _cyl_RadialVelocityABS(field, data):
-    return np.abs(_cyl_RadialVelocity(field, data))
-def _Convert_cyl_RadialVelocityKMS(data):
+def _cylindrical_radial_velocity_absolute(field, data):
+    return np.abs(_cylindrical_radial_velocity(field, data))
+
+def _convert_cylindrical_radial_velocity_kms(data):
     return km_per_cm
-add_field("cyl_RadialVelocity", function=_cyl_RadialVelocity,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityABS", function=_cyl_RadialVelocityABS,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityKMS", function=_cyl_RadialVelocity,
-          convert_function=_Convert_cyl_RadialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityKMSABS", function=_cyl_RadialVelocityABS,
-          convert_function=_Convert_cyl_RadialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
 
-def _cyl_TangentialVelocity(field, data):
+add_field("cylindrical_radial_velocity", function=_cylindrical_radial_velocity,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_absolute",
+          function=_cylindrical_radial_velocity_absolute,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_kms",
+          function=_cylindrical_radial_velocity,
+          convert_function=_convert_cylindrical_radial_velocity_kms,
+          units="km/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_kms_absolute",
+          function=_cylindrical_radial_velocity_absolute,
+          convert_function=_convert_cylindrical_radial_velocity_kms,
+          units="km/s", validators=[ValidateParameter("normal")])
+
+def _cylindrical_tangential_velocity(field, data):
     normal = data.get_field_parameter("normal")
     velocities = obtain_rv_vec(data).transpose()
-    theta = np.tile(data['cyl_theta'], (3, 1)).transpose()
-
+    theta = np.tile(data["cylindrical_theta"], (3, 1)).transpose()
     return get_cyl_theta_component(velocities, theta, normal)
 
-def _cyl_TangentialVelocityABS(field, data):
-    return np.abs(_cyl_TangentialVelocity(field, data))
-def _Convert_cyl_TangentialVelocityKMS(data):
+def _cylindrical_tangential_velocity_absolute(field, data):
+    return np.abs(_cylindrical_tangential_velocity(field, data))
+
+def _convert_cylindrical_tangential_velocity_kms(data):
     return km_per_cm
-add_field("cyl_TangentialVelocity", function=_cyl_TangentialVelocity,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityABS", function=_cyl_TangentialVelocityABS,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityKMS", function=_cyl_TangentialVelocity,
-          convert_function=_Convert_cyl_TangentialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityKMSABS", function=_cyl_TangentialVelocityABS,
-          convert_function=_Convert_cyl_TangentialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
 
-def _DynamicalTime(field, data):
+add_field("cylindrical_tangential_velocity",
+          function=_cylindrical_tangential_velocity,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_tangential_velocity_absolute",
+          function=_cylindrical_tangential_velocity_absolute,
+          units="cm/s", validators=[ValidateParameter("normal")])
+
+def _dynamical_time(field, data):
     """
-    The formulation for the dynamical time is:
-    M{sqrt(3pi/(16*G*rho))} or M{sqrt(3pi/(16G))*rho^-(1/2)}
-    Note that we return in our natural units already
+    sqrt(3 pi / (16 G rho))
     """
-    return (3.0*np.pi/(16*G*data["Density"]))**(1./2.)
-add_field("DynamicalTime", function=_DynamicalTime,
-           units=r"\rm{s}")
+    return np.sqrt(3.0 * np.pi / (16.0 * G * data["density"]))
 
-def JeansMassMsun(field,data):
-    return (MJ_constant * 
-            ((data["Temperature"]/data["MeanMolecularWeight"])**(1.5)) *
-            (data["Density"]**(-0.5)))
-add_field("JeansMassMsun",function=JeansMassMsun,units=r"\rm{Msun}")
+add_field("dynamical_time", function=_dynamical_time, units="s")
 
-def _CellMass(field, data):
-    return data["Density"] * data["CellVolume"]
-def _convertCellMassMsun(data):
-    return 5.027854e-34 # g^-1
-add_field("CellMass", function=_CellMass, units=r"\rm{g}")
-add_field("CellMassMsun", units=r"M_{\odot}",
-          function=_CellMass,
-          convert_function=_convertCellMassMsun)
+def jeans_mass(field, data):
+    return ( MJ_constant
+             * ((data["temperature"] / data["mean_molecular_weight"])**(1.5))
+             * (data["density"]**(-0.5)) )
 
-def _CellMassCode(field, data):
-    return data["Density"] * data["CellVolumeCode"]
-def _convertCellMassCode(data):
-    return 1.0/data.convert("Density")
-add_field("CellMassCode", 
-          function=_CellMassCode,
-          convert_function=_convertCellMassCode)
+add_field("jeans_mass", function=jeans_mass, units="g")
 
-def _TotalMass(field,data):
-    return (data["Density"]+data["Dark_Matter_Density"]) * data["CellVolume"]
-add_field("TotalMass", function=_TotalMass, units=r"\rm{g}")
-add_field("TotalMassMsun", units=r"M_{\odot}",
-          function=_TotalMass,
-          convert_function=_convertCellMassMsun)
+def _cell_mass(field, data):
+    return data["density"] * data["cell_volume"]
 
-def _StarMass(field,data):
-    return data["star_density"] * data["CellVolume"]
-add_field("StarMassMsun", units=r"M_{\odot}",
-          function=_StarMass,
-          convert_function=_convertCellMassMsun)
+add_field("cell_mass", function=_cell_mass, units="g")
 
-def _Matter_Density(field,data):
-    return (data['Density'] + data['Dark_Matter_Density'])
-add_field("Matter_Density",function=_Matter_Density,units=r"\rm{g}/\rm{cm^3}")
+def _total_mass(field, data):
+    return (data["density"] + data["dark_matter_density"]) * data["cell_volume"]
 
-def _ComovingDensity(field, data):
-    ef = (1.0 + data.pf.current_redshift)**3.0
-    return data["Density"]/ef
-add_field("ComovingDensity", function=_ComovingDensity, units=r"\rm{g}/\rm{cm}^3")
+add_field("total_mass", function=_total_mass, units="g")
+
+def _star_mass(field, data):
+    return data["star_density"] * data["cell_volume"]
+
+add_field("star_mass", units="g", function=_star_mass)
+
+def _matter_density(field, data):
+    return (data["density"] + data["dark_matter_density"])
+
+add_field("matter_density", function=_matter_density, units="g/cm**3")
+
+def _comoving_density(field, data):
+    z = data.pf.current_redshift
+    return data["density"] / (1.0 + z)**3
+
+add_field("comoving_density", function=_comoving_density, units="g/cm**3")
 
 # This is rho_total / rho_cr(z).
-def _Convert_Overdensity(data):
-    return 1 / (rho_crit_now * data.pf.hubble_constant**2 * 
+def _convert_overdensity(data):
+    return 1 / (rho_crit_now * data.pf.hubble_constant**2 *
                 (1+data.pf.current_redshift)**3)
-add_field("Overdensity",function=_Matter_Density,
-          convert_function=_Convert_Overdensity, units=r"")
+add_field("Overdensity",function=_matter_density,
+          convert_function=_convert_overdensity, units="")
 
-# This is (rho_total - <rho_total>) / <rho_total>.
-def _DensityPerturbation(field, data):
-    rho_bar = rho_crit_now * data.pf.omega_matter * \
-        data.pf.hubble_constant**2 * \
-        (1.0 + data.pf.current_redshift)**3
-    return ((data['Matter_Density'] - rho_bar) / rho_bar)
-add_field("DensityPerturbation",function=_DensityPerturbation,units=r"")
+# This is rho_matter / <rho_matter> - 1.0
+def _overdensity(field, data):
+    omega_m = data.pf.omega_matter
+    h = data.pf.hubble_constant
+    z = data.pf.current_redshift
+    rho_m = rho_crit_now * h**2 * omega_m * (1.0 + z)**3
+    return data["matter_density"] / rho_m - 1.0
 
-# This is rho_b / <rho_b>.
-def _Baryon_Overdensity(field, data):
+add_field("overdensity", function=_overdensity)
+
+# This is rho_baryon / <rho_baryon> - 1.0.
+def _baryon_overdensity(field, data):
+    # @todo: should we provide this field if the dataset doesn't have omega_b?
     if data.pf.has_key('omega_baryon_now'):
         omega_baryon_now = data.pf['omega_baryon_now']
     else:
         omega_baryon_now = 0.0441
-    return data['Density'] / (omega_baryon_now * rho_crit_now * 
-                              (data.pf['CosmologyHubbleConstantNow']**2) * 
-                              ((1+data.pf['CosmologyCurrentRedshift'])**3))
-add_field("Baryon_Overdensity", function=_Baryon_Overdensity, 
-          units=r"")
+
+    return data["density"] / (omega_baryon_now * rho_crit_now *
+                              (data.pf["CosmologyHubbleConstantNow"]**2) *
+                              ((1.0 + data.pf["CosmologyCurrentRedshift"])**3))
+add_field("baryon_overdensity", function=_baryon_overdensity)
 
 # Weak lensing convergence.
 # Eqn 4 of Metzler, White, & Loken (2001, ApJ, 547, 560).
@@ -484,110 +450,110 @@
     # lens to source
     DLS = data.pf.parameters['cosmology_calculator'].AngularDiameterDistance(
         data.pf.current_redshift, data.pf.parameters['lensing_source_redshift'])
-    return (((DL * DLS) / DS) * (1.5e14 * data.pf.omega_matter * 
+    return (((DL * DLS) / DS) * (1.5e14 * data.pf.omega_matter *
                                 (data.pf.hubble_constant / speed_of_light_cgs)**2 *
                                 (1 + data.pf.current_redshift)))
-add_field("WeakLensingConvergence", function=_DensityPerturbation, 
-          convert_function=_convertConvergence, 
+add_field("WeakLensingConvergence", function=_overdensity,
+          convert_function=_convertConvergence,
           projection_conversion='mpccm')
 
-def _CellVolume(field, data):
-    if data['dx'].size == 1:
+def _cell_volume(field, data):
+    if data["dx"].size == 1:
         try:
-            return data['dx']*data['dy']*data['dx']*\
-                np.ones(data.ActiveDimensions, dtype='float64')
+            return ( data["dx"] * data["dy"] * data["dx"]
+                     * np.ones(data.ActiveDimensions, dtype=np.float64) )
         except AttributeError:
-            return data['dx']*data['dy']*data['dx']
-    return data["dx"]*data["dy"]*data["dz"]
-def _ConvertCellVolumeMpc(data):
-    return data.convert("mpc")**3.0
-def _ConvertCellVolumeCGS(data):
-    return data.convert("cm")**3.0
-add_field("CellVolumeCode", units=r"\rm{BoxVolume}^3",
-          function=_CellVolume)
-add_field("CellVolumeMpc", units=r"\rm{Mpc}^3",
-          function=_CellVolume,
-          convert_function=_ConvertCellVolumeMpc)
-add_field("CellVolume", units=r"\rm{cm}^3",
-          function=_CellVolume,
-          convert_function=_ConvertCellVolumeCGS)
+            return data["dx"] * data["dy"] * data["dx"]
+    return data["dx"] * data["dy"] * data["dz"]
 
-def _ChandraEmissivity(field, data):
-    logT0 = np.log10(data["Temperature"]) - 7
-    return ((data["NumberDensity"].astype('float64')**2.0) \
-            *(10**(-0.0103*logT0**8 \
-                   +0.0417*logT0**7 \
-                   -0.0636*logT0**6 \
-                   +0.1149*logT0**5 \
-                   -0.3151*logT0**4 \
-                   +0.6655*logT0**3 \
-                   -1.1256*logT0**2 \
-                   +1.0026*logT0**1 \
-                   -0.6984*logT0) \
-              +data["Metallicity"]*10**(0.0305*logT0**11 \
-                                        -0.0045*logT0**10 \
-                                        -0.3620*logT0**9 \
-                                        +0.0513*logT0**8 \
-                                        +1.6669*logT0**7 \
-                                        -0.3854*logT0**6 \
-                                        -3.3604*logT0**5 \
-                                        +0.4728*logT0**4 \
-                                        +4.5774*logT0**3 \
-                                        -2.3661*logT0**2 \
-                                        -1.6667*logT0**1 \
-                                        -0.2193*logT0)))
-def _convertChandraEmissivity(data):
-    return 1.0 #1.0e-23*0.76**2
-add_field("ChandraEmissivity", function=_ChandraEmissivity,
-          convert_function=_convertChandraEmissivity,
+add_field("cell_volume", units="cm**3", function=_cell_volume)
+
+def _chandra_emissivity(field, data):
+    logT0 = np.log10(data["temperature"]) - 7
+    return ( data["number_density"].astype(np.float64)**2
+             * ( 10**(-0.0103 * logT0**8
+                      +0.0417 * logT0**7
+                      -0.0636 * logT0**6
+                      +0.1149 * logT0**5
+                      -0.3151 * logT0**4
+                      +0.6655 * logT0**3
+                      -1.1256 * logT0**2
+                      +1.0026 * logT0**1
+                      -0.6984 * logT0)
+                 + data["metallicity"] * 10**(0.0305 * logT0**11
+                                              -0.0045 * logT0**10
+                                              -0.3620 * logT0**9
+                                              +0.0513 * logT0**8
+                                              +1.6669 * logT0**7
+                                              -0.3854 * logT0**6
+                                              -3.3604 * logT0**5
+                                              +0.4728 * logT0**4
+                                              +4.5774 * logT0**3
+                                              -2.3661 * logT0**2
+                                              -1.6667 * logT0**1
+                                              -0.2193 * logT0) ) )
+
+def _convert_chandra_emissivity(data):
+    return 1.0  # 1.0e-23*0.76**2
+
+add_field("chandra_emissivity", function=_chandra_emissivity,
+          convert_function=_convert_chandra_emissivity,
           projection_conversion="1")
 
-def _XRayEmissivity(field, data):
-    return ((data["Density"].astype('float64')**2.0) \
-            *data["Temperature"]**0.5)
-def _convertXRayEmissivity(data):
+def _xray_emissivity(field, data):
+    return ( data["density"].astype(np.float64)**2
+             * data["temperature"]**0.5 )
+
+def _convert_xray_emissivity(data):
     return 2.168e60
-add_field("XRayEmissivity", function=_XRayEmissivity,
-          convert_function=_convertXRayEmissivity,
+
+add_field("xray_emissivity", function=_xray_emissivity,
+          convert_function=_convert_xray_emissivity,
           projection_conversion="1")
 
-def _SZKinetic(field, data):
-    vel_axis = data.get_field_parameter('axis')
+def _sz_kinetic(field, data):
+    vel_axis = data.get_field_parameter("axis")
     if vel_axis > 2:
-        raise NeedsParameter(['axis'])
-    vel = data["%s-velocity" % ({0:'x',1:'y',2:'z'}[vel_axis])]
-    return (vel*data["Density"])
-def _convertSZKinetic(data):
-    return 0.88*((sigma_thompson/mh)/clight)
-add_field("SZKinetic", function=_SZKinetic,
-          convert_function=_convertSZKinetic,
-          validators=[ValidateParameter('axis')])
+        raise NeedsParameter(["axis"])
+    vel = data["velocity_%s" % ({0: "x", 1: "y", 2: "z"}[vel_axis])]
+    return (vel * data["density"])
 
-def _SZY(field, data):
-    return (data["Density"]*data["Temperature"])
-def _convertSZY(data):
-    conv = (0.88/mh) * (kboltz)/(me * clight*clight) * sigma_thompson
+def _convert_sz_kinetic(data):
+    return 0.88 * sigma_thompson / mh / clight
+
+add_field("sz_kinetic", function=_sz_kinetic,
+          convert_function=_convert_sz_kinetic,
+          validators=[ValidateParameter("axis")])
+
+def _szy(field, data):
+    return data["density"] * data["temperature"]
+
+def _convert_szy(data):
+    conv = 0.88 / mh * kboltz / (me * clight*clight) * sigma_thompson
     return conv
-add_field("SZY", function=_SZY, convert_function=_convertSZY)
 
-def _AveragedDensity(field, data):
-    nx, ny, nz = data["Density"].shape
-    new_field = np.zeros((nx-2,ny-2,nz-2), dtype='float64')
-    weight_field = np.zeros((nx-2,ny-2,nz-2), dtype='float64')
-    i_i, j_i, k_i = np.mgrid[0:3,0:3,0:3]
-    for i,j,k in zip(i_i.ravel(),j_i.ravel(),k_i.ravel()):
-        sl = [slice(i,nx-(2-i)),slice(j,ny-(2-j)),slice(k,nz-(2-k))]
-        new_field += data["Density"][sl] * data["CellMass"][sl]
-        weight_field += data["CellMass"][sl]
+add_field("szy", function=_szy, convert_function=_convert_szy)
+
+def _averaged_density(field, data):
+    nx, ny, nz = data["density"].shape
+    new_field = np.zeros((nx-2, ny-2, nz-2), dtype=np.float64)
+    weight_field = np.zeros((nx-2, ny-2, nz-2), dtype=np.float64)
+    i_i, j_i, k_i = np.mgrid[0:3, 0:3, 0:3]
+
+    for i, j, k in zip(i_i.ravel(), j_i.ravel(), k_i.ravel()):
+        sl = [slice(i, nx-(2-i)), slice(j, ny-(2-j)), slice(k, nz-(2-k))]
+        new_field += data["density"][sl] * data["cell_mass"][sl]
+        weight_field += data["cell_mass"][sl]
+
     # Now some fancy footwork
-    new_field2 = np.zeros((nx,ny,nz))
-    new_field2[1:-1,1:-1,1:-1] = new_field/weight_field
+    new_field2 = np.zeros((nx, ny, nz))
+    new_field2[1:-1, 1:-1, 1:-1] = new_field / weight_field
     return new_field2
-add_field("AveragedDensity",
-          function=_AveragedDensity,
-          validators=[ValidateSpatial(1, ["Density"])])
 
-def _DivV(field, data):
+add_field("averaged_density", function=_averaged_density,
+          validators=[ValidateSpatial(1, ["density"])])
+
+def _div_v(field, data):
     # We need to set up stencils
     if data.pf["HydroMethod"] == 2:
         sl_left = slice(None,-2,None)
@@ -597,81 +563,82 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    ds = div_fac * data['dx'].flat[0]
+    ds = div_fac * data["dx"].flat[0]
     f  = data["x-velocity"][sl_right,1:-1,1:-1]/ds
     f -= data["x-velocity"][sl_left ,1:-1,1:-1]/ds
     if data.pf.dimensionality > 1:
-        ds = div_fac * data['dy'].flat[0]
+        ds = div_fac * data["dy"].flat[0]
         f += data["y-velocity"][1:-1,sl_right,1:-1]/ds
         f -= data["y-velocity"][1:-1,sl_left ,1:-1]/ds
     if data.pf.dimensionality > 2:
-        ds = div_fac * data['dz'].flat[0]
+        ds = div_fac * data["dz"].flat[0]
         f += data["z-velocity"][1:-1,1:-1,sl_right]/ds
         f -= data["z-velocity"][1:-1,1:-1,sl_left ]/ds
-    new_field = np.zeros(data["x-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["x-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = f
     return new_field
-def _convertDivV(data):
+
+def _convert_div_v(data):
     return data.convert("cm")**-1.0
-add_field("DivV", function=_DivV,
-            validators=[ValidateSpatial(1,
-            ["x-velocity","y-velocity","z-velocity"])],
-          units=r"\rm{s}^{-1}", take_log=False,
-          convert_function=_convertDivV)
 
-def _AbsDivV(field, data):
-    return np.abs(data['DivV'])
-add_field("AbsDivV", function=_AbsDivV,
-          units=r"\rm{s}^{-1}")
+add_field("div_v", function=_div_v,
+          validators=[ValidateSpatial(1, ["velocity_x", "velocity_y",
+                                          "velocity_z"])],
+          units="1/s", take_log=False, convert_function=_convert_div_v)
 
-def _Contours(field, data):
-    return -np.ones_like(data["Ones"])
-add_field("Contours", validators=[ValidateSpatial(0)], take_log=False,
-          display_field=False, function=_Contours)
-add_field("tempContours", function=_Contours,
+def _absolute_div_v(field, data):
+    return np.abs(data["div_v"])
+
+add_field("absolute_div_v", function=_absolute_div_v, units="1/s")
+
+def _contours(field, data):
+    return -np.ones_like(data["ones"])
+
+add_field("contours", validators=[ValidateSpatial(0)], take_log=False,
+          display_field=False, function=_contours)
+add_field("temp_contours", function=_contours,
           validators=[ValidateSpatial(0), ValidateGridType()],
           take_log=False, display_field=False)
 
 def obtain_velocities(data):
     return obtain_rv_vec(data)
 
-def _convertSpecificAngularMomentum(data):
-    return data.convert("cm")
-def _convertSpecificAngularMomentumKMSMPC(data):
-    return data.convert("mpc")/1e5
-
-def _SpecificAngularMomentumX(field, data):
+def _specific_angular_momentum_x(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return yv*rv[2,:] - zv*rv[1,:]
-def _SpecificAngularMomentumY(field, data):
+    return yv * rv[2, :] - zv * rv[1, :]
+
+def _specific_angular_momentum_y(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return -(xv*rv[2,:] - zv*rv[0,:])
-def _SpecificAngularMomentumZ(field, data):
+    return - (xv * rv[2, :] - zv * rv[0, :])
+
+def _specific_angular_momentum_z(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return xv*rv[1,:] - yv*rv[0,:]
-for ax in 'XYZ':
-    n = "SpecificAngularMomentum%s" % ax
-    add_field(n, function=eval("_%s" % n),
-              convert_function=_convertSpecificAngularMomentum,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+    return xv * rv[1, :] - yv * rv[0, :]
 
-def _AngularMomentumX(field, data):
+add_field("specific_angular_momentum_x", function=_specific_angular_momentum_x,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+add_field("specific_angular_momentum_y", function=_specific_angular_momentum_y,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+add_field("specific_angular_momentum_z", function=_specific_angular_momentum_z,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+
+def _angular_momentum_x(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumX"]
-add_field("AngularMomentumX", function=_AngularMomentumX,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumX", function=_angular_momentum_x,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
-def _AngularMomentumY(field, data):
+def _angular_momentum_y(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumY"]
-add_field("AngularMomentumY", function=_AngularMomentumY,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumY", function=_angular_momentum_y,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
-def _AngularMomentumZ(field, data):
+def _angular_momentum_z(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumZ"]
-add_field("AngularMomentumZ", function=_AngularMomentumZ,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumZ", function=_angular_momentum_z,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
 
 def _ParticleSpecificAngularMomentum(field, data):
@@ -681,17 +648,17 @@
     """
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     xv = data["particle_velocity_x"] - bv[0]
     yv = data["particle_velocity_y"] - bv[1]
     zv = data["particle_velocity_z"] - bv[2]
     center = data.get_field_parameter('center')
     coords = np.array([data['particle_position_x'],
                        data['particle_position_y'],
-                       data['particle_position_z']], dtype='float64')
+                       data['particle_position_z']], dtype=np.float64)
     new_shape = tuple([3] + [1]*(len(coords.shape)-1))
     r_vec = coords - np.reshape(center,new_shape)
-    v_vec = np.array([xv,yv,zv], dtype='float64')
+    v_vec = np.array([xv,yv,zv], dtype=np.float64)
     return np.cross(r_vec, v_vec, axis=0)
 #add_field("ParticleSpecificAngularMomentum",
 #          function=_ParticleSpecificAngularMomentum, particle_type=True,
@@ -707,7 +674,7 @@
 def _ParticleSpecificAngularMomentumX(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     y = data["particle_position_y"] - center[1]
     z = data["particle_position_z"] - center[2]
@@ -717,7 +684,7 @@
 def _ParticleSpecificAngularMomentumY(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     x = data["particle_position_x"] - center[0]
     z = data["particle_position_z"] - center[2]
@@ -727,7 +694,7 @@
 def _ParticleSpecificAngularMomentumZ(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     x = data["particle_position_x"] - center[0]
     y = data["particle_position_y"] - center[1]
@@ -737,11 +704,10 @@
 for ax in 'XYZ':
     n = "ParticleSpecificAngularMomentum%s" % ax
     add_field(n, function=eval("_%s" % n), particle_type=True,
-              convert_function=_convertSpecificAngularMomentum,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+              units="cm**2/s", validators=[ValidateParameter("center")])
     add_field(n + "KMSMPC", function=eval("_%s" % n), particle_type=True,
               convert_function=_convertSpecificAngularMomentumKMSMPC,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+              units="cm**2/s", validators=[ValidateParameter("center")])
 
 def _ParticleAngularMomentum(field, data):
     return data["ParticleMass"] * data["ParticleSpecificAngularMomentum"]
@@ -758,24 +724,24 @@
 def _ParticleAngularMomentumX(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumX"]
 add_field("ParticleAngularMomentumX", function=_ParticleAngularMomentumX,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 def _ParticleAngularMomentumY(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumY"]
 add_field("ParticleAngularMomentumY", function=_ParticleAngularMomentumY,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 def _ParticleAngularMomentumZ(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumZ"]
 add_field("ParticleAngularMomentumZ", function=_ParticleAngularMomentumZ,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 
 
 def _ParticleRadius(field, data):
     center = data.get_field_parameter("center")
     DW = data.pf.domain_right_edge - data.pf.domain_left_edge
-    radius = np.zeros(data["particle_position_x"].shape, dtype='float64')
+    radius = np.zeros(data["particle_position_x"].shape, dtype=np.float64)
     for i, ax in enumerate('xyz'):
         r = np.abs(data["particle_position_%s" % ax] - center[i])
         radius += np.minimum(r, np.abs(DW[i]-r))**2.0
@@ -784,7 +750,7 @@
 def _Radius(field, data):
     center = data.get_field_parameter("center")
     DW = data.pf.domain_right_edge - data.pf.domain_left_edge
-    radius = np.zeros(data["x"].shape, dtype='float64')
+    radius = np.zeros(data["x"].shape, dtype=np.float64)
     for i, ax in enumerate('xyz'):
         r = np.abs(data[ax] - center[i])
         radius += np.minimum(r, np.abs(DW[i]-r))**2.0
@@ -794,22 +760,22 @@
     return data.convert("cm")
 add_field("ParticleRadius", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusCGS, units=r"\rm{cm}",
+          convert_function = _ConvertRadiusCGS, units="cm",
           particle_type = True,
           display_name = "Particle Radius")
 add_field("Radius", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusCGS, units=r"\rm{cm}")
+          convert_function = _ConvertRadiusCGS, units="cm")
 
 def _ConvertRadiusMpc(data):
     return data.convert("mpc")
 add_field("RadiusMpc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusMpc, units=r"\rm{Mpc}",
+          convert_function = _ConvertRadiusMpc, units="Mpc",
           display_name = "Radius")
 add_field("ParticleRadiusMpc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusMpc, units=r"\rm{Mpc}",
+          convert_function = _ConvertRadiusMpc, units="Mpc",
           particle_type=True,
           display_name = "Particle Radius")
 
@@ -817,48 +783,48 @@
     return data.convert("kpc")
 add_field("ParticleRadiuskpc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}",
+          convert_function = _ConvertRadiuskpc, units="kpc",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuskpc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}",
+          convert_function = _ConvertRadiuskpc, units="kpc",
           display_name = "Radius")
 
 def _ConvertRadiuskpch(data):
     return data.convert("kpch")
 add_field("ParticleRadiuskpch", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpch, units=r"\rm{kpc}/\rm{h}",
+          convert_function = _ConvertRadiuskpch, units="kpc/h",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuskpch", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}/\rm{h}",
+          convert_function = _ConvertRadiuskpc, units="kpc/h",
           display_name = "Radius")
 
 def _ConvertRadiuspc(data):
     return data.convert("pc")
 add_field("ParticleRadiuspc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuspc, units=r"\rm{pc}",
+          convert_function = _ConvertRadiuspc, units="pc",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuspc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuspc, units=r"\rm{pc}",
+          convert_function = _ConvertRadiuspc, units="pc",
           display_name="Radius")
 
 def _ConvertRadiusAU(data):
     return data.convert("au")
 add_field("ParticleRadiusAU", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusAU, units=r"\rm{AU}",
+          convert_function = _ConvertRadiusAU, units="AU",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("RadiusAU", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusAU, units=r"\rm{AU}",
+          convert_function = _ConvertRadiusAU, units="AU",
           display_name = "Radius")
 
 add_field("ParticleRadiusCode", function=_ParticleRadius,
@@ -871,7 +837,7 @@
 
 def _RadialVelocity(field, data):
     normal = data.get_field_parameter("normal")
-    velocities = obtain_rv_vec(data).transpose()    
+    velocities = obtain_rv_vec(data).transpose()
     theta = np.tile(data['sph_theta'], (3, 1)).transpose()
     phi   = np.tile(data['sph_phi'], (3, 1)).transpose()
 
@@ -882,20 +848,20 @@
 def _ConvertRadialVelocityKMS(data):
     return km_per_cm
 add_field("RadialVelocity", function=_RadialVelocity,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 add_field("RadialVelocityABS", function=_RadialVelocityABS,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 add_field("RadialVelocityKMS", function=_RadialVelocity,
-          convert_function=_ConvertRadialVelocityKMS, units=r"\rm{km}/\rm{s}")
+          convert_function=_ConvertRadialVelocityKMS, units="km/s")
 add_field("RadialVelocityKMSABS", function=_RadialVelocityABS,
-          convert_function=_ConvertRadialVelocityKMS, units=r"\rm{km}/\rm{s}")
+          convert_function=_ConvertRadialVelocityKMS, units="km/s")
 
 def _TangentialVelocity(field, data):
     return np.sqrt(data["VelocityMagnitude"]**2.0
                  - data["RadialVelocity"]**2.0)
-add_field("TangentialVelocity", 
+add_field("TangentialVelocity",
           function=_TangentialVelocity,
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+          take_log=False, units="cm/s")
 
 def _CuttingPlaneVelocityX(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
@@ -906,10 +872,10 @@
     v_vec = np.array([data["%s-velocity" % ax] for ax in 'xyz']) \
                 - bulk_velocity[...,np.newaxis]
     return np.dot(x_vec, v_vec)
-add_field("CuttingPlaneVelocityX", 
+add_field("CuttingPlaneVelocityX",
           function=_CuttingPlaneVelocityX,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{km}/\rm{s}")
+                      for ax in 'xyz'], units="km/s")
 def _CuttingPlaneVelocityY(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
@@ -919,29 +885,29 @@
     v_vec = np.array([data["%s-velocity" % ax] for ax in 'xyz']) \
                 - bulk_velocity[...,np.newaxis]
     return np.dot(y_vec, v_vec)
-add_field("CuttingPlaneVelocityY", 
+add_field("CuttingPlaneVelocityY",
           function=_CuttingPlaneVelocityY,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{km}/\rm{s}")
+                      for ax in 'xyz'], units="km/s")
 
 def _CuttingPlaneBx(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
     b_vec = np.array([data["B%s" % ax] for ax in 'xyz'])
     return np.dot(x_vec, b_vec)
-add_field("CuttingPlaneBx", 
+add_field("CuttingPlaneBx",
           function=_CuttingPlaneBx,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{Gauss}")
+                      for ax in 'xyz'], units="gauss")
 def _CuttingPlaneBy(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
     b_vec = np.array([data["B%s" % ax] for ax in 'xyz'])
     return np.dot(y_vec, b_vec)
-add_field("CuttingPlaneBy", 
+add_field("CuttingPlaneBy",
           function=_CuttingPlaneBy,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{Gauss}")
+                      for ax in 'xyz'], units="gauss")
 
 def _MeanMolecularWeight(field,data):
     return (data["Density"] / (mh *data["NumberDensity"]))
@@ -955,7 +921,7 @@
             ((data["Temperature"]/data["MeanMolecularWeight"])**(1.5)) *
             (data["Density"]**(-0.5)))
 add_field("JeansMassMsun",function=_JeansMassMsun,
-          units=r"\rm{M_{\odot}}")
+          units="Msun")
 
 def _convertDensity(data):
     return data.convert("Density")
@@ -982,7 +948,7 @@
     """
     return (data["Bx"]**2 + data["By"]**2 + data["Bz"]**2)/(8*np.pi)
 add_field("MagneticEnergy",function=_MagneticEnergy,
-          units=r"\rm{ergs}\/\rm{cm}^{-3}",
+          units="erg / cm**3",
           display_name=r"\rm{Magnetic}\/\rm{Energy}")
 
 def _BMagnitude(field,data):
@@ -993,7 +959,7 @@
     return np.sqrt((data["Bx"]**2 + data["By"]**2 + data["Bz"]**2))
 add_field("BMagnitude",
           function=_BMagnitude,
-          display_name=r"|B|", units=r"\rm{Gauss}")
+          display_name=r"|B|", units="gauss")
 
 def _PlasmaBeta(field,data):
     """This assumes that your front end has provided Bx, By, Bz in
@@ -1010,7 +976,7 @@
 add_field("MagneticPressure",
           function=_MagneticPressure,
           display_name=r"\rm{Magnetic}\/\rm{Energy}",
-          units="\rm{ergs}\/\rm{cm}^{-3}")
+          units="erg / cm**3")
 
 def _BPoloidal(field,data):
     normal = data.get_field_parameter("normal")
@@ -1023,7 +989,7 @@
     return get_sph_theta_component(Bfields, theta, phi, normal)
 
 add_field("BPoloidal", function=_BPoloidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _BToroidal(field,data):
@@ -1036,7 +1002,7 @@
     return get_sph_phi_component(Bfields, phi, normal)
 
 add_field("BToroidal", function=_BToroidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _BRadial(field,data):
@@ -1050,7 +1016,7 @@
     return get_sph_r_component(Bfields, theta, phi, normal)
 
 add_field("BRadial", function=_BPoloidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _VorticitySquared(field, data):
@@ -1096,7 +1062,7 @@
 add_field("VorticitySquared", function=_VorticitySquared,
           validators=[ValidateSpatial(1,
               ["x-velocity","y-velocity","z-velocity"])],
-          units=r"\rm{s}^{-2}",
+          units="s**-2",
           convert_function=_convertVorticitySquared)
 
 def _gradPressureX(field, data):
@@ -1109,7 +1075,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dx'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][sl_right,1:-1,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][sl_left ,1:-1,1:-1]/ds
@@ -1124,7 +1090,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dy'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][1:-1,sl_right,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][1:-1,sl_left ,1:-1]/ds
@@ -1139,7 +1105,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dz'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][1:-1,1:-1,sl_right]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][1:-1,1:-1,sl_left ]/ds
@@ -1151,7 +1117,7 @@
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertgradPressure,
               validators=[ValidateSpatial(1, ["Pressure"])],
-              units=r"\rm{dyne}/\rm{cm}^{3}")
+              units="dyne/cm**3")
 
 def _gradPressureMagnitude(field, data):
     return np.sqrt(data["gradPressureX"]**2 +
@@ -1159,7 +1125,7 @@
                    data["gradPressureZ"]**2)
 add_field("gradPressureMagnitude", function=_gradPressureMagnitude,
           validators=[ValidateSpatial(1, ["Pressure"])],
-          units=r"\rm{dyne}/\rm{cm}^{3}")
+          units="dyne/cm**3")
 
 def _gradDensityX(field, data):
     # We need to set up stencils
@@ -1171,7 +1137,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dx'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][sl_right,1:-1,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][sl_left ,1:-1,1:-1]/ds
@@ -1186,7 +1152,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dy'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][1:-1,sl_right,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][1:-1,sl_left ,1:-1]/ds
@@ -1201,7 +1167,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dz'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][1:-1,1:-1,sl_right]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][1:-1,1:-1,sl_left ]/ds
@@ -1213,7 +1179,7 @@
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertgradDensity,
               validators=[ValidateSpatial(1, ["Density"])],
-              units=r"\rm{g}/\rm{cm}^{4}")
+              units="g/cm**4")
 
 def _gradDensityMagnitude(field, data):
     return np.sqrt(data["gradDensityX"]**2 +
@@ -1221,25 +1187,25 @@
                    data["gradDensityZ"]**2)
 add_field("gradDensityMagnitude", function=_gradDensityMagnitude,
           validators=[ValidateSpatial(1, ["Density"])],
-          units=r"\rm{g}/\rm{cm}^{4}")
+          units="g/cm**4")
 
 def _BaroclinicVorticityX(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureY"] * data["gradDensityZ"] -
             data["gradPressureZ"] * data["gradDensityY"]) / rho2
 def _BaroclinicVorticityY(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureZ"] * data["gradDensityX"] -
             data["gradPressureX"] * data["gradDensityZ"]) / rho2
 def _BaroclinicVorticityZ(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureX"] * data["gradDensityY"] -
             data["gradPressureY"] * data["gradDensityX"]) / rho2
 for ax in 'XYZ':
     n = "BaroclinicVorticity%s" % ax
     add_field(n, function=eval("_%s" % n),
           validators=[ValidateSpatial(1, ["Density", "Pressure"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _BaroclinicVorticityMagnitude(field, data):
     return np.sqrt(data["BaroclinicVorticityX"]**2 +
@@ -1248,7 +1214,7 @@
 add_field("BaroclinicVorticityMagnitude",
           function=_BaroclinicVorticityMagnitude,
           validators=[ValidateSpatial(1, ["Density", "Pressure"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityX(field, data):
     # We need to set up stencils
@@ -1260,7 +1226,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["z-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["z-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["z-velocity"][1:-1,sl_right,1:-1] -
                                  data["z-velocity"][1:-1,sl_left,1:-1]) \
                                  / (div_fac*data["dy"].flat[0])
@@ -1278,7 +1244,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["z-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["z-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["x-velocity"][1:-1,1:-1,sl_right] -
                                  data["x-velocity"][1:-1,1:-1,sl_left]) \
                                  / (div_fac*data["dz"].flat[0])
@@ -1296,7 +1262,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["x-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["x-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["y-velocity"][sl_right,1:-1,1:-1] -
                                  data["y-velocity"][sl_left,1:-1,1:-1]) \
                                  / (div_fac*data["dx"].flat[0])
@@ -1310,18 +1276,18 @@
     n = "Vorticity%s" % ax
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertVorticity,
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                           ["x-velocity", "y-velocity", "z-velocity"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 
 def _VorticityMagnitude(field, data):
     return np.sqrt(data["VorticityX"]**2 +
                    data["VorticityY"]**2 +
                    data["VorticityZ"]**2)
 add_field("VorticityMagnitude", function=_VorticityMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityStretchingX(field, data):
     return data["DivV"] * data["VorticityX"]
@@ -1337,11 +1303,11 @@
     return np.sqrt(data["VorticityStretchingX"]**2 +
                    data["VorticityStretchingY"]**2 +
                    data["VorticityStretchingZ"]**2)
-add_field("VorticityStretchingMagnitude", 
+add_field("VorticityStretchingMagnitude",
           function=_VorticityStretchingMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityGrowthX(field, data):
     return -data["VorticityStretchingX"] - data["BaroclinicVorticityX"]
@@ -1352,9 +1318,9 @@
 for ax in 'XYZ':
     n = "VorticityGrowth%s" % ax
     add_field(n, function=eval("_%s" % n),
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                           ["x-velocity", "y-velocity", "z-velocity"])],
-              units=r"\rm{s}^{-2}")
+              units="1/s")
 def _VorticityGrowthMagnitude(field, data):
     result = np.sqrt(data["VorticityGrowthX"]**2 +
                      data["VorticityGrowthY"]**2 +
@@ -1365,18 +1331,18 @@
     result = np.sign(dot) * result
     return result
 add_field("VorticityGrowthMagnitude", function=_VorticityGrowthMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}",
+          units="1/s",
           take_log=False)
 def _VorticityGrowthMagnitudeABS(field, data):
     return np.sqrt(data["VorticityGrowthX"]**2 +
                    data["VorticityGrowthY"]**2 +
                    data["VorticityGrowthZ"]**2)
 add_field("VorticityGrowthMagnitudeABS", function=_VorticityGrowthMagnitudeABS,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityGrowthTimescale(field, data):
     domegax_dt = data["VorticityX"] / data["VorticityGrowthX"]
@@ -1384,24 +1350,24 @@
     domegaz_dt = data["VorticityZ"] / data["VorticityGrowthZ"]
     return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt)
 add_field("VorticityGrowthTimescale", function=_VorticityGrowthTimescale,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}")
+          units="s")
 
 ########################################################################
 # With radiation pressure
 ########################################################################
 
 def _VorticityRadPressureX(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel2"] * data["gradDensityZ"] -
             data["RadAccel3"] * data["gradDensityY"]) / rho
 def _VorticityRadPressureY(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel3"] * data["gradDensityX"] -
             data["RadAccel1"] * data["gradDensityZ"]) / rho
 def _VorticityRadPressureZ(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel1"] * data["gradDensityY"] -
             data["RadAccel2"] * data["gradDensityX"]) / rho
 def _convertRadAccel(data):
@@ -1410,9 +1376,9 @@
     n = "VorticityRadPressure%s" % ax
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertRadAccel,
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                    ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 
 def _VorticityRadPressureMagnitude(field, data):
     return np.sqrt(data["VorticityRadPressureX"]**2 +
@@ -1420,9 +1386,9 @@
                    data["VorticityRadPressureZ"]**2)
 add_field("VorticityRadPressureMagnitude",
           function=_VorticityRadPressureMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityRPGrowthX(field, data):
     return -data["VorticityStretchingX"] - data["BaroclinicVorticityX"] \
@@ -1436,9 +1402,9 @@
 for ax in 'XYZ':
     n = "VorticityRPGrowth%s" % ax
     add_field(n, function=eval("_%s" % n),
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                        ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 def _VorticityRPGrowthMagnitude(field, data):
     result = np.sqrt(data["VorticityRPGrowthX"]**2 +
                      data["VorticityRPGrowthY"]**2 +
@@ -1449,19 +1415,19 @@
     result = np.sign(dot) * result
     return result
 add_field("VorticityRPGrowthMagnitude", function=_VorticityGrowthMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}",
+          units="1/s",
           take_log=False)
 def _VorticityRPGrowthMagnitudeABS(field, data):
     return np.sqrt(data["VorticityRPGrowthX"]**2 +
                    data["VorticityRPGrowthY"]**2 +
                    data["VorticityRPGrowthZ"]**2)
-add_field("VorticityRPGrowthMagnitudeABS", 
+add_field("VorticityRPGrowthMagnitudeABS",
           function=_VorticityRPGrowthMagnitudeABS,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityRPGrowthTimescale(field, data):
     domegax_dt = data["VorticityX"] / data["VorticityRPGrowthX"]
@@ -1469,6 +1435,6 @@
     domegaz_dt = data["VorticityZ"] / data["VorticityRPGrowthZ"]
     return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt**2)
 add_field("VorticityRPGrowthTimescale", function=_VorticityRPGrowthTimescale,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")

diff -r 1547e8bdcf7834ab673b6128553e3290d18b2200 -r 6c4e150214e8e8a5767db979ad3d85930fb5d079 yt/geometry/geometry_handler.py
--- a/yt/geometry/geometry_handler.py
+++ b/yt/geometry/geometry_handler.py
@@ -1,4 +1,4 @@
-""" 
+"""
 Geometry container base class.
 
 Author: Matthew Turk <matthewturk at gmail.com>
@@ -126,8 +126,8 @@
                 # will allow the same field detection mechanism to work for 1D, 2D
                 # and 3D fields.
                 self.pf.field_info.add_field(
-                        field, NullFunc, particle_type = particle_type,
-                        convert_function=cf, take_log=False, units=r"Unknown")
+                        field, NullFunc, particle_type=particle_type,
+                        convert_function=cf, take_log=False)
             else:
                 mylog.debug("Adding known field %s to list of fields", field)
                 self.parameter_file.field_info[field] = known_fields[field]

diff -r 1547e8bdcf7834ab673b6128553e3290d18b2200 -r 6c4e150214e8e8a5767db979ad3d85930fb5d079 yt/utilities/tests/test_units.py
--- a/yt/utilities/tests/test_units.py
+++ b/yt/utilities/tests/test_units.py
@@ -70,6 +70,13 @@
     assert u1.cgs_value == 1
     assert u1.dimensions == 1
 
+    u2 = Unit("")
+
+    assert u2.is_dimensionless
+    assert u2.expr == 1
+    assert u2.cgs_value == 1
+    assert u2.dimensions == 1
+
 #
 # Start init tests
 #

diff -r 1547e8bdcf7834ab673b6128553e3290d18b2200 -r 6c4e150214e8e8a5767db979ad3d85930fb5d079 yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -74,6 +74,9 @@
     "J": (1.0e7, energy),
     "Hz": (1.0, rate),
 
+    # dimensionless
+    "h": (1.0, 1.0),
+
     # times
     "min": (60.0, time),
     "hr":  (3600.0, time),
@@ -163,6 +166,10 @@
         """
         # if we have a string, parse into an expression
         if isinstance(unit_expr, str):
+            if not unit_expr:
+                # Bug catch...
+                # if unit_expr is an empty string, parse_expr fails hard...
+                unit_expr = "1"
             unit_expr = parse_expr(unit_expr)
 
         if not isinstance(unit_expr, Expr):
@@ -289,6 +296,9 @@
              self.dimensions.expand().as_coeff_exponent(temperature)[1])
         return Unit(cgs_units_string, 1, self.dimensions)
 
+    def get_conversion_factor(self, other_units):
+        return get_conversion_factor(self, other_units)
+
 
 def make_symbols_positive(expr):
     """


https://bitbucket.org/yt_analysis/yt/commits/9dc136e71639/
Changeset:   9dc136e71639
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-06 23:26:53
Summary:     Adding a very alpha YTArray.
Affected #:  1 file

diff -r 6c4e150214e8e8a5767db979ad3d85930fb5d079 -r 9dc136e71639739e2c0744c9208a32b8ea2352e0 yt/data_objects/yt_array.py
--- /dev/null
+++ b/yt/data_objects/yt_array.py
@@ -0,0 +1,61 @@
+"""
+YTArray class
+
+Authors: Casey W. Stark <caseywstark at gmail.com>
+Affiliation: UC Berkeley
+
+Homepage: http://yt-project.org/
+License:
+    Copyright (C) 2013 Casey W. Stark.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+
+import numpy as np
+
+from yt.utilities.units import Unit
+
+class UnitArray(np.ndarray):
+    """
+
+    """
+    def __new__(cls, input_array, units=None):
+        # Input array is an already formed ndarray instance
+        # We first cast to be our class type
+        obj = np.asarray(input_array).view(cls)
+
+        # Check units type
+        if units is None:
+            units = Unit()
+        if not isinstance(units, Unit):
+            units = Unit(units)
+
+        # Attach the units
+        obj.units = units
+
+        return obj
+
+    def __array_finalize__(self, obj):
+        # see InfoArray.__array_finalize__ for comments
+        if obj is None: return
+        self.units = getattr(obj, 'units', None)
+
+    def convert_to(self, new_units):
+        """
+
+        """
+        cf = self.units.get_conversion_factor(new_units)


https://bitbucket.org/yt_analysis/yt/commits/19ea28fbfa37/
Changeset:   19ea28fbfa37
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-06 23:42:18
Summary:     Pulled changes from main yt-3.0 and fixed conflicts in universal_fields.
Affected #:  6 files

diff -r 50e6460dade1bc6cdd62012f7427f5c079f2fbe3 -r 19ea28fbfa3792779869e37eb41100427a2cc03f yt/data_objects/field_info_container.py
--- a/yt/data_objects/field_info_container.py
+++ b/yt/data_objects/field_info_container.py
@@ -33,6 +33,7 @@
 import numpy as np
 
 from yt.funcs import *
+from yt.utilities.units import Unit
 
 class FieldInfoContainer(dict): # Resistance has utility
     """
@@ -259,7 +260,7 @@
                 lambda: np.ones((nd, nd, nd), dtype='float64')
                 + 1e-4*np.random.random((nd, nd, nd)))
         else:
-            defaultdict.__init__(self, 
+            defaultdict.__init__(self,
                 lambda: np.ones((nd * nd * nd), dtype='float64')
                 + 1e-4*np.random.random((nd * nd * nd)))
 
@@ -300,20 +301,27 @@
             return np.random.random(3) * 1e-2
         else:
             return 0.0
+
     _num_ghost_zones = 0
     id = 1
-    def has_field_parameter(self, param): return True
-    def convert(self, item): return 1
+
+    def has_field_parameter(self, param):
+        return True
+
+    def convert(self, item):
+        return 1
+
+
+class FieldUnitsError(Exception):
+    pass
 
 class DerivedField(object):
-    def __init__(self, name, function,
-                 convert_function = None,
-                 particle_convert_function = None,
-                 units = "", projected_units = "",
-                 take_log = True, validators = None,
-                 particle_type = False, vector_field=False,
-                 display_field = True, not_in_all=False,
-                 display_name = None, projection_conversion = "cm"):
+    def __init__(self, name, function, convert_function=None,
+                 particle_convert_function=None, units=None,
+                 projected_units=None, take_log=True, validators=None,
+                 particle_type=False, vector_field=False, display_field=True,
+                 not_in_all=False, display_name=None,
+                 projection_conversion="cm"):
         """
         This is the base class used to describe a cell-by-cell derived field.
 
@@ -333,26 +341,46 @@
         :param display_name: a name used in the plots
         :param projection_conversion: which unit should we multiply by in a
                                       projection?
+
         """
         self.name = name
+        self.take_log = take_log
+        self.display_name = display_name
+        self.not_in_all = not_in_all
+        self.display_field = display_field
+        self.particle_type = particle_type
+        self.vector_field = vector_field
+
         self._function = function
+        if not convert_function:
+            convert_function = lambda a: 1.0
+        self._convert_function = convert_function
+        self.particle_convert_function = particle_convert_function
+        self.projection_conversion = projection_conversion
+
         if validators:
             self.validators = ensure_list(validators)
         else:
             self.validators = []
-        self.take_log = take_log
-        self._units = units
-        self._projected_units = projected_units
-        if not convert_function:
-            convert_function = lambda a: 1.0
-        self._convert_function = convert_function
-        self._particle_convert_function = particle_convert_function
-        self.particle_type = particle_type
-        self.vector_field = vector_field
-        self.projection_conversion = projection_conversion
-        self.display_field = display_field
-        self.display_name = display_name
-        self.not_in_all = not_in_all
+
+        # handle units
+        if units is None:
+            self.units = Unit()
+        elif isinstance(units, str):
+            self.units = Unit(units)
+        elif isinstance(units, Unit):
+            self.units = units
+        else:
+            raise FieldUnitsException("Bad units type. Please provide a Unit object or a string.")
+
+        if projected_units is None:
+            self.projected_units = Unit
+        elif isinstance(projected_units, str):
+            self.projected_units = Unit(projected_units)
+        elif isinstance(projected_units, Unit):
+            self.projected_units = projected_units
+        else:
+            raise FieldUnitsException("Bad projected_units type. Please provide a Unit object or a string.")
 
     def _copy_def(self):
         dd = {}
@@ -392,16 +420,6 @@
             e[self.name]
         return e
 
-    def get_units(self):
-        """ Return a string describing the units. """
-        return self._units
-
-    def get_projected_units(self):
-        """
-        Return a string describing the units if the field has been projected.
-        """
-        return self._projected_units
-
     def __call__(self, data):
         """ Return the value of the field in a given *data* object. """
         ii = self.check_available(data)
@@ -425,11 +443,21 @@
         Return a data label for the given field, inluding units.
         """
         name = self.name
-        if self.display_name is not None: name = self.display_name
+        if self.display_name is not None:
+            name = self.display_name
+
+        # Start with the field name
         data_label = r"$\rm{%s}" % name
-        if projected: units = self.get_projected_units()
-        else: units = self.get_units()
-        if units != "": data_label += r"\/\/ (%s)" % (units)
+
+        # Grab the correct units
+        if projected:
+            units = self.projected_units
+        else:
+            units = self.units
+        # Add unit label
+        if not units.is_dimensionless:
+            data_label += r"\/\/ (%s)" % (units)
+
         data_label += r"$"
         return data_label
 

diff -r 50e6460dade1bc6cdd62012f7427f5c079f2fbe3 -r 19ea28fbfa3792779869e37eb41100427a2cc03f yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -47,15 +47,15 @@
     NeedsParameter
 
 from yt.utilities.physical_constants import \
-     mh, \
-     me, \
-     sigma_thompson, \
-     clight, \
-     kboltz, \
-     G, \
-     rho_crit_now, \
-     speed_of_light_cgs, \
-     km_per_cm
+    mh, \
+    me, \
+    sigma_thompson, \
+    clight, \
+    kboltz, \
+    G, \
+    rho_crit_now, \
+    speed_of_light_cgs, \
+    km_per_cm
 
 from yt.utilities.math_utils import \
     get_sph_r_component, \
@@ -68,371 +68,374 @@
     get_cyl_z, get_sph_r, \
     get_sph_theta, get_sph_phi, \
     periodic_dist, euclidean_dist
-     
-def _GridLevel(field, data):
-    return np.ones(data.ActiveDimensions)*(data.Level)
-add_field("GridLevel", function=_GridLevel,
-          validators=[ValidateGridType(),
-                      ValidateSpatial(0)])
 
-def _GridIndices(field, data):
-    return np.ones(data["Ones"].shape)*(data.id-data._id_offset)
-add_field("GridIndices", function=_GridIndices,
-          validators=[ValidateGridType(),
-                      ValidateSpatial(0)], take_log=False)
+# Note that, despite my newfound efforts to comply with PEP-8,
+# I violate it here in order to keep the name/func_name relationship
 
-def _OnesOverDx(field, data):
-    return np.ones(data["Ones"].shape,
-                   dtype=data["Density"].dtype)/data['dx']
-add_field("OnesOverDx", function=_OnesOverDx,
+def _dx(field, data):
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[0]
+
+add_field('dx', function=_dx, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _dy(field, data):
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[1]
+
+add_field('dy', function=_dy, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _dz(field, data):
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[2]
+
+add_field('dz', function=_dz,
+          display_field=False, validators=[ValidateSpatial(0)])
+
+def _coord_x(field, data):
+    dim = data.ActiveDimensions[0]
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[0])[:, None, None] + 0.5 )
+             * data['dx'] + data.LeftEdge[0] )
+
+add_field('x', function=_coord_x, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _coord_y(field, data):
+    dim = data.ActiveDimensions[1]
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[1])[None, :, None] + 0.5 )
+             * data['dy'] + data.LeftEdge[1] )
+
+add_field('y', function=_coord_y, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _coord_z(field, data):
+    dim = data.ActiveDimensions[2]
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[2])[None, None, :] + 0.5 )
+             * data['dz'] + data.LeftEdge[2] )
+
+add_field('z', function=_coord_z, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _grid_level(field, data):
+    return np.ones(data.ActiveDimensions) * data.Level
+
+add_field("grid_level", function=_grid_level,
+          validators=[ValidateGridType(), ValidateSpatial(0)])
+
+def _grid_indices(field, data):
+    return np.ones(data["ones"].shape) * (data.id - data._id_offset)
+
+add_field("grid_indices", function=_grid_indices, take_log=False,
+          validators=[ValidateGridType(), ValidateSpatial(0)])
+
+def _ones_over_dx(field, data):
+    return np.ones(data["ones"].shape, dtype=data["density"].dtype) / data['dx']
+
+add_field("ones_over_dx", function=_ones_over_dx, display_field=False)
+
+def _ones(field, data):
+    return np.ones(data.shape, dtype=np.float64)
+
+add_field("ones", function=_ones, projection_conversion="unitary",
           display_field=False)
+add_field("cells_per_bin", function=_ones, display_field=False)
 
-def _Zeros(field, data):
-    return np.zeros(data.ActiveDimensions, dtype='float64')
-add_field("Zeros", function=_Zeros,
-          validators=[ValidateSpatial(0)],
-          projection_conversion="unitary",
-          display_field = False)
 
-def _Ones(field, data):
-    return np.ones(data.shape, dtype='float64')
-add_field("Ones", function=_Ones,
-          projection_conversion="unitary",
-          display_field = False)
-add_field("CellsPerBin", function=_Ones, display_field = False)
+def _sound_speed(field, data):
+    if data.pf["eos_type"] == 1:
+        return ( np.ones(data["density"].shape, dtype=np.float64)
+                 * data.pf["eos_sound_speed"] )
+    return np.sqrt( data.pf["gamma"] * data["pressure"] / data["density"] )
 
-def _SoundSpeed(field, data):
-    if data.pf["EOSType"] == 1:
-        return np.ones(data["Density"].shape, dtype='float64') * \
-                data.pf["EOSSoundSpeed"]
-    return ( data.pf["Gamma"]*data["Pressure"] / \
-             data["Density"] )**(1.0/2.0)
-add_field("SoundSpeed", function=_SoundSpeed,
-          units=r"\rm{cm}/\rm{s}")
+add_field("sound_speed", function=_sound_speed, units="cm/s")
 
-def _RadialMachNumber(field, data):
-    """M{|v|/t_sound}"""
-    return np.abs(data["RadialVelocity"]) / data["SoundSpeed"]
-add_field("RadialMachNumber", function=_RadialMachNumber)
+def _radial_mach_number(field, data):
+    """ M{|v|/t_sound} """
+    return np.abs(data["radial_velocity"]) / data["sound_speed"]
 
-def _MachNumber(field, data):
-    """M{|v|/t_sound}"""
-    return data["VelocityMagnitude"] / data["SoundSpeed"]
-add_field("MachNumber", function=_MachNumber)
+add_field("radial_mach_number", function=_radial_mach_number)
 
-def _CourantTimeStep(field, data):
-    t1 = data['dx'] / (
-        data["SoundSpeed"] + \
-        abs(data["x-velocity"]))
-    t2 = data['dy'] / (
-        data["SoundSpeed"] + \
-        abs(data["y-velocity"]))
-    t3 = data['dz'] / (
-        data["SoundSpeed"] + \
-        abs(data["z-velocity"]))
-    return np.minimum(np.minimum(t1,t2),t3)
-def _convertCourantTimeStep(data):
-    # SoundSpeed and z-velocity are in cm/s, dx is in code
+def _mach_number(field, data):
+    """ M{|v|/t_sound} """
+    return data["velocity_magnitude"] / data["sound_speed"]
+
+add_field("mach_number", function=_mach_number)
+
+def _courant_time_step(field, data):
+    t1 = data["dx"] / (data["sound_speed"] + np.abs(data["velocity_x"]))
+    t2 = data["dy"] / (data["sound_speed"] + np.abs(data["velocity_y"]))
+    t3 = data["dz"] / (data["sound_speed"] + np.abs(data["velocity_z"]))
+    return np.minimum(np.minimum(t1, t2), t3)
+def _convert_courant_time_step(data):
+    # sound speed and z-velocity are in cm/s, dx is in code
     return data.convert("cm")
-add_field("CourantTimeStep", function=_CourantTimeStep,
-          convert_function=_convertCourantTimeStep,
-          units=r"$\rm{s}$")
 
-def _ParticleVelocityMagnitude(field, data):
-    """M{|v|}"""
+add_field("courant_time_step", function=_courant_time_step,
+          convert_function=_convert_courant_time_step, units="s")
+
+def _particle_velocity_magnitude(field, data):
+    """ M{|v|} """
     bulk_velocity = data.get_field_parameter("bulk_velocity")
-    if bulk_velocity == None:
+    if bulk_velocity is None:
         bulk_velocity = np.zeros(3)
-    return ( (data["particle_velocity_x"]-bulk_velocity[0])**2.0 + \
-             (data["particle_velocity_y"]-bulk_velocity[1])**2.0 + \
-             (data["particle_velocity_z"]-bulk_velocity[2])**2.0 )**(1.0/2.0)
-add_field("ParticleVelocityMagnitude", function=_ParticleVelocityMagnitude,
-          particle_type=True, 
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+    return np.sqrt( (data["particle_velocity_x"] - bulk_velocity[0])**2
+                    + (data["particle_velocity_y"] - bulk_velocity[1])**2
+                    + (data["particle_velocity_z"] - bulk_velocity[2])**2 )
 
-def _VelocityMagnitude(field, data):
-    """M{|v|}"""
+add_field("particle_velocity_magnitude", function=_particle_velocity_magnitude,
+          particle_type=True, take_log=False, units="cm/s")
+
+def _velocity_magnitude(field, data):
+    """ M{|v|} """
     velocities = obtain_rv_vec(data)
-    return np.sqrt(np.sum(velocities**2,axis=0))
-add_field("VelocityMagnitude", function=_VelocityMagnitude,
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+    return np.sqrt(np.sum(velocities**2, axis=0))
 
-def _TangentialOverVelocityMagnitude(field, data):
-    return np.abs(data["TangentialVelocity"])/np.abs(data["VelocityMagnitude"])
-add_field("TangentialOverVelocityMagnitude",
-          function=_TangentialOverVelocityMagnitude,
-          take_log=False)
+add_field("velocity_magnitude", function=_velocity_magnitude,
+          take_log=False, units="cm/s")
 
-def _Pressure(field, data):
-    """M{(Gamma-1.0)*rho*E}"""
-    return (data.pf["Gamma"] - 1.0) * \
-           data["Density"] * data["ThermalEnergy"]
-add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+def _tangential_over_velocity_magnitude(field, data):
+    # @todo: can velocity_magnitude be negative?
+    return np.abs(data["tangential_velocity"]) / np.abs(data["velocity_magnitude"])
 
-def _Entropy(field, data):
+add_field("tangential_over_velocity_magnitude",
+          function=_tangential_over_velocity_magnitude, take_log=False)
+
+def _pressure(field, data):
+    """ M{(Gamma-1.0)*rho*E} """
+    return (data.pf["gamma"] - 1.0) * data["density"] * data["thermal_energy"]
+
+add_field("pressure", function=_pressure, units="dyne/cm**2")
+
+def _entropy(field, data):
     if data.has_field_parameter("mu"):
-        mw = mh*data.get_field_parameter("mu")
-    else :
+        mw = mh * data.get_field_parameter("mu")
+    else:
         mw = mh
-    return kboltz * data["Temperature"] / \
-           ((data["Density"]/mw)**(data.pf["Gamma"] - 1.0))
-add_field("Entropy", units=r"\rm{ergs}\ \rm{cm}^{3\gamma-3}",
-          function=_Entropy)
+    return ( kboltz * data["temperature"]
+             / ((data["density"] / mw)**(data.pf["gamma"] - 1.0)) )
 
-
+add_field("entropy", units="erg/K", function=_entropy)
 
 ### spherical coordinates: r (radius)
-def _sph_r(field, data):
+def _spherical_r(field, data):
     center = data.get_field_parameter("center")
-      
-    coords = obtain_rvec(data)
+    coords = obtain_rvec(data).transpose()
+    return get_sph_r(vectors, center)
 
-    return get_sph_r(coords)
-
-def _Convert_sph_r_CGS(data):
+def _convert_spherical_r_cgs(data):
    return data.convert("cm")
 
-add_field("sph_r", function=_sph_r,
+add_field("spherical_r", function=_spherical_r,
          validators=[ValidateParameter("center")],
-         convert_function = _Convert_sph_r_CGS, units=r"\rm{cm}")
-
+         convert_function=_convert_spherical_r_cgs, units="cm")
 
 ### spherical coordinates: theta (angle with respect to normal)
-def _sph_theta(field, data):
+def _spherical_theta(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_sph_theta(coords, normal)
 
-add_field("sph_theta", function=_sph_theta,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
-
+add_field("spherical_theta", function=_spherical_theta,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### spherical coordinates: phi (angle in the plane perpendicular to the normal)
-def _sph_phi(field, data):
+def _spherical_phi(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_sph_phi(coords, normal)
 
-add_field("sph_phi", function=_sph_phi,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
+add_field("spherical_phi", function=_spherical_phi,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### cylindrical coordinates: R (radius in the cylinder's plane)
-def _cyl_R(field, data):
+def _cylindrical_r(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-      
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_cyl_r(coords, normal)
 
-def _Convert_cyl_R_CGS(data):
+def _convert_cylindrical_r_cgs(data):
    return data.convert("cm")
 
-add_field("cyl_R", function=_cyl_R,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")],
-         convert_function = _Convert_cyl_R_CGS, units=r"\rm{cm}")
-add_field("cyl_RCode", function=_cyl_R,
-          validators=[ValidateParameter("center"),ValidateParameter("normal")],
-          units=r"Radius (code)")
-
+add_field("cylindrical_r", function=_cylindrical_r,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")],
+         convert_function=_convert_cylindrical_r_cgs, units="cm")
+add_field("cylindrical_r_code", function=_cylindrical_r,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### cylindrical coordinates: z (height above the cylinder's plane)
-def _cyl_z(field, data):
+def _cylindrical_z(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_cyl_z(coords, normal)
 
-def _Convert_cyl_z_CGS(data):
+def _convert_cylindrical_z_cgs(data):
    return data.convert("cm")
 
-add_field("cyl_z", function=_cyl_z,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")],
-         convert_function = _Convert_cyl_z_CGS, units=r"\rm{cm}")
-
+add_field("cylindrical_z", function=_cylindrical_z,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
+          convert_function=_convert_cylindrical_z_cgs, units="cm")
 
 ### cylindrical coordinates: theta (angle in the cylinder's plane)
-def _cyl_theta(field, data):
+def _cylindrical_theta(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_cyl_theta(coords, normal)
 
-add_field("cyl_theta", function=_cyl_theta,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
+add_field("cylindrical_theta", function=_cylindrical_theta,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### The old field DiskAngle is the same as the spherical coordinates'
 ### 'theta' angle. I'm keeping DiskAngle for backwards compatibility.
-def _DiskAngle(field, data):
-    return data['sph_theta']
+# @todo: remove in 3.0?
+def _disk_angle(field, data):
+    return data["spherical_theta"]
 
-add_field("DiskAngle", function=_DiskAngle,
-          take_log=False,
-          validators=[ValidateParameter("center"),
-                      ValidateParameter("normal")],
+add_field("disk_angle", function=_disk_angle, take_log=False,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
           display_field=False)
 
-
 ### The old field Height is the same as the cylindrical coordinates' z
 ### field. I'm keeping Height for backwards compatibility.
-def _Height(field, data):
-    return data['cyl_z']
+# @todo: remove in 3.0?
+def _height(field, data):
+    return data["cylindrical_z"]
 
-def _convertHeight(data):
+def _convert_height(data):
     return data.convert("cm")
-def _convertHeightAU(data):
+
+def _convert_height_au(data):
     return data.convert("au")
-add_field("Height", function=_Height,
-          convert_function=_convertHeight,
+
+add_field("height", function=_height, convert_function=_convert_height,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
+          units="cm", display_field=False)
+add_field("height_au", function=_height, convert_function=_convert_height_au,
           validators=[ValidateParameter("center"),
                       ValidateParameter("normal")],
-          units=r"cm", display_field=False)
-add_field("HeightAU", function=_Height,
-          convert_function=_convertHeightAU,
-          validators=[ValidateParameter("center"),
-                      ValidateParameter("normal")],
-          units=r"AU", display_field=False)
+          units="AU", display_field=False)
 
-def _cyl_RadialVelocity(field, data):
+def _cylindrical_radial_velocity(field, data):
     normal = data.get_field_parameter("normal")
-    velocities = obtain_rv_vec(data)
-
-    theta = data['cyl_theta']
-
+    velocities = obtain_rv_vec(data).transpose()
+    theta = np.tile(data['cylindrical_theta'], (3, 1)).transpose()
     return get_cyl_r_component(velocities, theta, normal)
 
-def _cyl_RadialVelocityABS(field, data):
-    return np.abs(_cyl_RadialVelocity(field, data))
-def _Convert_cyl_RadialVelocityKMS(data):
+def _cylindrical_radial_velocity_absolute(field, data):
+    return np.abs(_cylindrical_radial_velocity(field, data))
+
+def _convert_cylindrical_radial_velocity_kms(data):
     return km_per_cm
-add_field("cyl_RadialVelocity", function=_cyl_RadialVelocity,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityABS", function=_cyl_RadialVelocityABS,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityKMS", function=_cyl_RadialVelocity,
-          convert_function=_Convert_cyl_RadialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityKMSABS", function=_cyl_RadialVelocityABS,
-          convert_function=_Convert_cyl_RadialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
 
-def _cyl_TangentialVelocity(field, data):
+add_field("cylindrical_radial_velocity", function=_cylindrical_radial_velocity,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_absolute",
+          function=_cylindrical_radial_velocity_absolute,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_kms",
+          function=_cylindrical_radial_velocity,
+          convert_function=_convert_cylindrical_radial_velocity_kms,
+          units="km/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_kms_absolute",
+          function=_cylindrical_radial_velocity_absolute,
+          convert_function=_convert_cylindrical_radial_velocity_kms,
+          units="km/s", validators=[ValidateParameter("normal")])
+
+def _cylindrical_tangential_velocity(field, data):
     normal = data.get_field_parameter("normal")
-    velocities = obtain_rv_vec(data)
-    theta = data['cyl_theta']
-
+    velocities = obtain_rv_vec(data).transpose()
+    theta = np.tile(data["cylindrical_theta"], (3, 1)).transpose()
     return get_cyl_theta_component(velocities, theta, normal)
 
-def _cyl_TangentialVelocityABS(field, data):
-    return np.abs(_cyl_TangentialVelocity(field, data))
-def _Convert_cyl_TangentialVelocityKMS(data):
+def _cylindrical_tangential_velocity_absolute(field, data):
+    return np.abs(_cylindrical_tangential_velocity(field, data))
+
+def _convert_cylindrical_tangential_velocity_kms(data):
     return km_per_cm
-add_field("cyl_TangentialVelocity", function=_cyl_TangentialVelocity,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityABS", function=_cyl_TangentialVelocityABS,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityKMS", function=_cyl_TangentialVelocity,
-          convert_function=_Convert_cyl_TangentialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityKMSABS", function=_cyl_TangentialVelocityABS,
-          convert_function=_Convert_cyl_TangentialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
 
-def _DynamicalTime(field, data):
+add_field("cylindrical_tangential_velocity",
+          function=_cylindrical_tangential_velocity,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_tangential_velocity_absolute",
+          function=_cylindrical_tangential_velocity_absolute,
+          units="cm/s", validators=[ValidateParameter("normal")])
+
+def _dynamical_time(field, data):
     """
-    The formulation for the dynamical time is:
-    M{sqrt(3pi/(16*G*rho))} or M{sqrt(3pi/(16G))*rho^-(1/2)}
-    Note that we return in our natural units already
+    sqrt(3 pi / (16 G rho))
     """
-    return (3.0*np.pi/(16*G*data["Density"]))**(1./2.)
-add_field("DynamicalTime", function=_DynamicalTime,
-           units=r"\rm{s}")
+    return np.sqrt(3.0 * np.pi / (16.0 * G * data["density"]))
 
-def JeansMassMsun(field,data):
-    return (MJ_constant * 
-            ((data["Temperature"]/data["MeanMolecularWeight"])**(1.5)) *
-            (data["Density"]**(-0.5)))
-add_field("JeansMassMsun",function=JeansMassMsun,units=r"\rm{Msun}")
+add_field("dynamical_time", function=_dynamical_time, units="s")
 
-def _CellMass(field, data):
-    return data["Density"] * data["CellVolume"]
-def _convertCellMassMsun(data):
-    return 5.027854e-34 # g^-1
-add_field("CellMass", function=_CellMass, units=r"\rm{g}")
-add_field("CellMassMsun", units=r"M_{\odot}",
-          function=_CellMass,
-          convert_function=_convertCellMassMsun)
+def jeans_mass(field, data):
+    return ( MJ_constant
+             * ((data["temperature"] / data["mean_molecular_weight"])**(1.5))
+             * (data["density"]**(-0.5)) )
 
-def _CellMassCode(field, data):
-    return data["Density"] * data["CellVolumeCode"]
-def _convertCellMassCode(data):
-    return 1.0/data.convert("Density")
-add_field("CellMassCode", 
-          function=_CellMassCode,
-          convert_function=_convertCellMassCode)
+add_field("jeans_mass", function=jeans_mass, units="g")
 
-def _TotalMass(field,data):
-    return (data["Density"]+data["Dark_Matter_Density"]) * data["CellVolume"]
-add_field("TotalMass", function=_TotalMass, units=r"\rm{g}")
-add_field("TotalMassMsun", units=r"M_{\odot}",
-          function=_TotalMass,
-          convert_function=_convertCellMassMsun)
+def _cell_mass(field, data):
+    return data["density"] * data["cell_volume"]
 
-def _StarMass(field,data):
-    return data["star_density"] * data["CellVolume"]
-add_field("StarMassMsun", units=r"M_{\odot}",
-          function=_StarMass,
-          convert_function=_convertCellMassMsun)
+add_field("cell_mass", function=_cell_mass, units="g")
 
-def _Matter_Density(field,data):
-    return (data['Density'] + data['Dark_Matter_Density'])
-add_field("Matter_Density",function=_Matter_Density,units=r"\rm{g}/\rm{cm^3}")
+def _total_mass(field, data):
+    return (data["density"] + data["dark_matter_density"]) * data["cell_volume"]
 
-def _ComovingDensity(field, data):
-    ef = (1.0 + data.pf.current_redshift)**3.0
-    return data["Density"]/ef
-add_field("ComovingDensity", function=_ComovingDensity, units=r"\rm{g}/\rm{cm}^3")
+add_field("total_mass", function=_total_mass, units="g")
+
+def _star_mass(field, data):
+    return data["star_density"] * data["cell_volume"]
+
+add_field("star_mass", units="g", function=_star_mass)
+
+def _matter_density(field, data):
+    return (data["density"] + data["dark_matter_density"])
+
+add_field("matter_density", function=_matter_density, units="g/cm**3")
+
+def _comoving_density(field, data):
+    z = data.pf.current_redshift
+    return data["density"] / (1.0 + z)**3
+
+add_field("comoving_density", function=_comoving_density, units="g/cm**3")
 
 # This is rho_total / rho_cr(z).
-def _Convert_Overdensity(data):
-    return 1.0 / (rho_crit_now * data.pf.hubble_constant**2 * 
+def _convert_overdensity(data):
+    return 1 / (rho_crit_now * data.pf.hubble_constant**2 *
                 (1+data.pf.current_redshift)**3)
-add_field("Overdensity",function=_Matter_Density,
-          convert_function=_Convert_Overdensity, units=r"")
+add_field("Overdensity",function=_matter_density,
+          convert_function=_convert_overdensity, units="")
 
-# This is (rho_total - <rho_total>) / <rho_total>.
-def _DensityPerturbation(field, data):
-    rho_bar = rho_crit_now * data.pf.omega_matter * \
-        data.pf.hubble_constant**2 * \
-        (1.0 + data.pf.current_redshift)**3
-    return ((data['Matter_Density'] - rho_bar) / rho_bar)
-add_field("DensityPerturbation",function=_DensityPerturbation,units=r"")
+# This is rho_matter / <rho_matter> - 1.0
+def _overdensity(field, data):
+    omega_m = data.pf.omega_matter
+    h = data.pf.hubble_constant
+    z = data.pf.current_redshift
+    rho_m = rho_crit_now * h**2 * omega_m * (1.0 + z)**3
+    return data["matter_density"] / rho_m - 1.0
 
-# This is rho_b / <rho_b>.
-def _Baryon_Overdensity(field, data):
+add_field("overdensity", function=_overdensity)
+
+# This is rho_baryon / <rho_baryon> - 1.0.
+def _baryon_overdensity(field, data):
+    # @todo: should we provide this field if the dataset doesn't have omega_b?
     if data.pf.has_key('omega_baryon_now'):
         omega_baryon_now = data.pf['omega_baryon_now']
     else:
         omega_baryon_now = 0.0441
-    return data['Density'] / (omega_baryon_now * rho_crit_now * 
-                              (data.pf.hubble_constant**2) * 
-                              ((1+data.pf.current_redshift)**3))
-add_field("Baryon_Overdensity", function=_Baryon_Overdensity, 
-          units=r"")
+
+    return data["density"] / (omega_baryon_now * rho_crit_now *
+                              (data.pf["CosmologyHubbleConstantNow"]**2) *
+                              ((1.0 + data.pf["CosmologyCurrentRedshift"])**3))
+
+add_field("baryon_overdensity", function=_baryon_overdensity)
 
 # Weak lensing convergence.
 # Eqn 4 of Metzler, White, & Loken (2001, ApJ, 547, 560).
@@ -450,110 +453,110 @@
     # lens to source
     DLS = data.pf.parameters['cosmology_calculator'].AngularDiameterDistance(
         data.pf.current_redshift, data.pf.parameters['lensing_source_redshift'])
-    return (((DL * DLS) / DS) * (1.5e14 * data.pf.omega_matter * 
+    return (((DL * DLS) / DS) * (1.5e14 * data.pf.omega_matter *
                                 (data.pf.hubble_constant / speed_of_light_cgs)**2 *
                                 (1 + data.pf.current_redshift)))
-add_field("WeakLensingConvergence", function=_DensityPerturbation, 
-          convert_function=_convertConvergence, 
+add_field("WeakLensingConvergence", function=_overdensity,
+          convert_function=_convertConvergence,
           projection_conversion='mpccm')
 
-def _CellVolume(field, data):
-    if data['dx'].size == 1:
+def _cell_volume(field, data):
+    if data["dx"].size == 1:
         try:
-            return data['dx'] * data['dy'] * data['dz'] * \
-                np.ones(data.ActiveDimensions, dtype='float64')
+            return ( data["dx"] * data["dy"] * data["dx"]
+                     * np.ones(data.ActiveDimensions, dtype=np.float64) )
         except AttributeError:
-            return data['dx'] * data['dy'] * data['dz']
+            return data["dx"] * data["dy"] * data["dx"]
     return data["dx"] * data["dy"] * data["dz"]
-def _ConvertCellVolumeMpc(data):
-    return data.convert("mpc")**3.0
-def _ConvertCellVolumeCGS(data):
-    return data.convert("cm")**3.0
-add_field("CellVolumeCode", units=r"\rm{BoxVolume}^3",
-          function=_CellVolume)
-add_field("CellVolumeMpc", units=r"\rm{Mpc}^3",
-          function=_CellVolume,
-          convert_function=_ConvertCellVolumeMpc)
-add_field("CellVolume", units=r"\rm{cm}^3",
-          function=_CellVolume,
-          convert_function=_ConvertCellVolumeCGS)
 
-def _ChandraEmissivity(field, data):
-    logT0 = np.log10(data["Temperature"]) - 7
-    return ((data["NumberDensity"].astype('float64')**2.0) \
-            *(10**(-0.0103*logT0**8 \
-                   +0.0417*logT0**7 \
-                   -0.0636*logT0**6 \
-                   +0.1149*logT0**5 \
-                   -0.3151*logT0**4 \
-                   +0.6655*logT0**3 \
-                   -1.1256*logT0**2 \
-                   +1.0026*logT0**1 \
-                   -0.6984*logT0) \
-              +data["Metallicity"]*10**(0.0305*logT0**11 \
-                                        -0.0045*logT0**10 \
-                                        -0.3620*logT0**9 \
-                                        +0.0513*logT0**8 \
-                                        +1.6669*logT0**7 \
-                                        -0.3854*logT0**6 \
-                                        -3.3604*logT0**5 \
-                                        +0.4728*logT0**4 \
-                                        +4.5774*logT0**3 \
-                                        -2.3661*logT0**2 \
-                                        -1.6667*logT0**1 \
-                                        -0.2193*logT0)))
-def _convertChandraEmissivity(data):
-    return 1.0 #1.0e-23*0.76**2
-add_field("ChandraEmissivity", function=_ChandraEmissivity,
-          convert_function=_convertChandraEmissivity,
+add_field("cell_volume", units="cm**3", function=_cell_volume)
+
+def _chandra_emissivity(field, data):
+    logT0 = np.log10(data["temperature"]) - 7
+    return ( data["number_density"].astype(np.float64)**2
+             * ( 10**(-0.0103 * logT0**8
+                      +0.0417 * logT0**7
+                      -0.0636 * logT0**6
+                      +0.1149 * logT0**5
+                      -0.3151 * logT0**4
+                      +0.6655 * logT0**3
+                      -1.1256 * logT0**2
+                      +1.0026 * logT0**1
+                      -0.6984 * logT0)
+                 + data["metallicity"] * 10**(0.0305 * logT0**11
+                                              -0.0045 * logT0**10
+                                              -0.3620 * logT0**9
+                                              +0.0513 * logT0**8
+                                              +1.6669 * logT0**7
+                                              -0.3854 * logT0**6
+                                              -3.3604 * logT0**5
+                                              +0.4728 * logT0**4
+                                              +4.5774 * logT0**3
+                                              -2.3661 * logT0**2
+                                              -1.6667 * logT0**1
+                                              -0.2193 * logT0) ) )
+
+def _convert_chandra_emissivity(data):
+    return 1.0  # 1.0e-23*0.76**2
+
+add_field("chandra_emissivity", function=_chandra_emissivity,
+          convert_function=_convert_chandra_emissivity,
           projection_conversion="1")
 
-def _XRayEmissivity(field, data):
-    return ((data["Density"].astype('float64')**2.0) \
-            *data["Temperature"]**0.5)
-def _convertXRayEmissivity(data):
+def _xray_emissivity(field, data):
+    return ( data["density"].astype(np.float64)**2
+             * data["temperature"]**0.5 )
+
+def _convert_xray_emissivity(data):
     return 2.168e60
-add_field("XRayEmissivity", function=_XRayEmissivity,
-          convert_function=_convertXRayEmissivity,
+
+add_field("xray_emissivity", function=_xray_emissivity,
+          convert_function=_convert_xray_emissivity,
           projection_conversion="1")
 
-def _SZKinetic(field, data):
-    vel_axis = data.get_field_parameter('axis')
+def _sz_kinetic(field, data):
+    vel_axis = data.get_field_parameter("axis")
     if vel_axis > 2:
-        raise NeedsParameter(['axis'])
-    vel = data["%s-velocity" % ({0:'x',1:'y',2:'z'}[vel_axis])]
-    return (vel*data["Density"])
-def _convertSZKinetic(data):
-    return 0.88*((sigma_thompson/mh)/clight)
-add_field("SZKinetic", function=_SZKinetic,
-          convert_function=_convertSZKinetic,
-          validators=[ValidateParameter('axis')])
+        raise NeedsParameter(["axis"])
+    vel = data["velocity_%s" % ({0: "x", 1: "y", 2: "z"}[vel_axis])]
+    return (vel * data["density"])
 
-def _SZY(field, data):
-    return (data["Density"]*data["Temperature"])
-def _convertSZY(data):
-    conv = (0.88/mh) * (kboltz)/(me * clight*clight) * sigma_thompson
+def _convert_sz_kinetic(data):
+    return 0.88 * sigma_thompson / mh / clight
+
+add_field("sz_kinetic", function=_sz_kinetic,
+          convert_function=_convert_sz_kinetic,
+          validators=[ValidateParameter("axis")])
+
+def _szy(field, data):
+    return data["density"] * data["temperature"]
+
+def _convert_szy(data):
+    conv = 0.88 / mh * kboltz / (me * clight*clight) * sigma_thompson
     return conv
-add_field("SZY", function=_SZY, convert_function=_convertSZY)
 
-def _AveragedDensity(field, data):
-    nx, ny, nz = data["Density"].shape
-    new_field = np.zeros((nx-2,ny-2,nz-2), dtype='float64')
-    weight_field = np.zeros((nx-2,ny-2,nz-2), dtype='float64')
-    i_i, j_i, k_i = np.mgrid[0:3,0:3,0:3]
-    for i,j,k in zip(i_i.ravel(),j_i.ravel(),k_i.ravel()):
-        sl = [slice(i,nx-(2-i)),slice(j,ny-(2-j)),slice(k,nz-(2-k))]
-        new_field += data["Density"][sl] * data["CellMass"][sl]
-        weight_field += data["CellMass"][sl]
+add_field("szy", function=_szy, convert_function=_convert_szy)
+
+def _averaged_density(field, data):
+    nx, ny, nz = data["density"].shape
+    new_field = np.zeros((nx-2, ny-2, nz-2), dtype=np.float64)
+    weight_field = np.zeros((nx-2, ny-2, nz-2), dtype=np.float64)
+    i_i, j_i, k_i = np.mgrid[0:3, 0:3, 0:3]
+
+    for i, j, k in zip(i_i.ravel(), j_i.ravel(), k_i.ravel()):
+        sl = [slice(i, nx-(2-i)), slice(j, ny-(2-j)), slice(k, nz-(2-k))]
+        new_field += data["density"][sl] * data["cell_mass"][sl]
+        weight_field += data["cell_mass"][sl]
+
     # Now some fancy footwork
-    new_field2 = np.zeros((nx,ny,nz))
-    new_field2[1:-1,1:-1,1:-1] = new_field/weight_field
+    new_field2 = np.zeros((nx, ny, nz))
+    new_field2[1:-1, 1:-1, 1:-1] = new_field / weight_field
     return new_field2
-add_field("AveragedDensity",
-          function=_AveragedDensity,
-          validators=[ValidateSpatial(1, ["Density"])])
 
-def _DivV(field, data):
+add_field("averaged_density", function=_averaged_density,
+          validators=[ValidateSpatial(1, ["density"])])
+
+def _div_v(field, data):
     # We need to set up stencils
     if data.pf["HydroMethod"] == 2:
         sl_left = slice(None,-2,None)
@@ -563,81 +566,82 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    ds = div_fac * data['dx'].flat[0]
+    ds = div_fac * data["dx"].flat[0]
     f  = data["x-velocity"][sl_right,1:-1,1:-1]/ds
     f -= data["x-velocity"][sl_left ,1:-1,1:-1]/ds
     if data.pf.dimensionality > 1:
-        ds = div_fac * data['dy'].flat[0]
+        ds = div_fac * data["dy"].flat[0]
         f += data["y-velocity"][1:-1,sl_right,1:-1]/ds
         f -= data["y-velocity"][1:-1,sl_left ,1:-1]/ds
     if data.pf.dimensionality > 2:
-        ds = div_fac * data['dz'].flat[0]
+        ds = div_fac * data["dz"].flat[0]
         f += data["z-velocity"][1:-1,1:-1,sl_right]/ds
         f -= data["z-velocity"][1:-1,1:-1,sl_left ]/ds
-    new_field = np.zeros(data["x-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["x-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = f
     return new_field
-def _convertDivV(data):
+
+def _convert_div_v(data):
     return data.convert("cm")**-1.0
-add_field("DivV", function=_DivV,
-            validators=[ValidateSpatial(1,
-            ["x-velocity","y-velocity","z-velocity"])],
-          units=r"\rm{s}^{-1}", take_log=False,
-          convert_function=_convertDivV)
 
-def _AbsDivV(field, data):
-    return np.abs(data['DivV'])
-add_field("AbsDivV", function=_AbsDivV,
-          units=r"\rm{s}^{-1}")
+add_field("div_v", function=_div_v,
+          validators=[ValidateSpatial(1, ["velocity_x", "velocity_y",
+                                          "velocity_z"])],
+          units="1/s", take_log=False, convert_function=_convert_div_v)
 
-def _Contours(field, data):
-    return -np.ones_like(data["Ones"])
-add_field("Contours", validators=[ValidateSpatial(0)], take_log=False,
-          display_field=False, function=_Contours)
-add_field("tempContours", function=_Contours,
+def _absolute_div_v(field, data):
+    return np.abs(data["div_v"])
+
+add_field("absolute_div_v", function=_absolute_div_v, units="1/s")
+
+def _contours(field, data):
+    return -np.ones_like(data["ones"])
+
+add_field("contours", validators=[ValidateSpatial(0)], take_log=False,
+          display_field=False, function=_contours)
+add_field("temp_contours", function=_contours,
           validators=[ValidateSpatial(0), ValidateGridType()],
           take_log=False, display_field=False)
 
 def obtain_velocities(data):
     return obtain_rv_vec(data)
 
-def _convertSpecificAngularMomentum(data):
-    return data.convert("cm")
-def _convertSpecificAngularMomentumKMSMPC(data):
-    return data.convert("mpc")/1e5
-
-def _SpecificAngularMomentumX(field, data):
+def _specific_angular_momentum_x(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return yv*rv[2,:] - zv*rv[1,:]
-def _SpecificAngularMomentumY(field, data):
+    return yv * rv[2, :] - zv * rv[1, :]
+
+def _specific_angular_momentum_y(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return -(xv*rv[2,:] - zv*rv[0,:])
-def _SpecificAngularMomentumZ(field, data):
+    return - (xv * rv[2, :] - zv * rv[0, :])
+
+def _specific_angular_momentum_z(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return xv*rv[1,:] - yv*rv[0,:]
-for ax in 'XYZ':
-    n = "SpecificAngularMomentum%s" % ax
-    add_field(n, function=eval("_%s" % n),
-              convert_function=_convertSpecificAngularMomentum,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+    return xv * rv[1, :] - yv * rv[0, :]
 
-def _AngularMomentumX(field, data):
+add_field("specific_angular_momentum_x", function=_specific_angular_momentum_x,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+add_field("specific_angular_momentum_y", function=_specific_angular_momentum_y,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+add_field("specific_angular_momentum_z", function=_specific_angular_momentum_z,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+
+def _angular_momentum_x(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumX"]
-add_field("AngularMomentumX", function=_AngularMomentumX,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumX", function=_angular_momentum_x,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
-def _AngularMomentumY(field, data):
+def _angular_momentum_y(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumY"]
-add_field("AngularMomentumY", function=_AngularMomentumY,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumY", function=_angular_momentum_y,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
-def _AngularMomentumZ(field, data):
+def _angular_momentum_z(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumZ"]
-add_field("AngularMomentumZ", function=_AngularMomentumZ,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumZ", function=_angular_momentum_z,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
 
 def _ParticleSpecificAngularMomentum(field, data):
@@ -647,17 +651,17 @@
     """
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     xv = data["particle_velocity_x"] - bv[0]
     yv = data["particle_velocity_y"] - bv[1]
     zv = data["particle_velocity_z"] - bv[2]
     center = data.get_field_parameter('center')
     coords = np.array([data['particle_position_x'],
                        data['particle_position_y'],
-                       data['particle_position_z']], dtype='float64')
+                       data['particle_position_z']], dtype=np.float64)
     new_shape = tuple([3] + [1]*(len(coords.shape)-1))
     r_vec = coords - np.reshape(center,new_shape)
-    v_vec = np.array([xv,yv,zv], dtype='float64')
+    v_vec = np.array([xv,yv,zv], dtype=np.float64)
     return np.cross(r_vec, v_vec, axis=0)
 #add_field("ParticleSpecificAngularMomentum",
 #          function=_ParticleSpecificAngularMomentum, particle_type=True,
@@ -673,7 +677,7 @@
 def _ParticleSpecificAngularMomentumX(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     y = data["particle_position_y"] - center[1]
     z = data["particle_position_z"] - center[2]
@@ -683,7 +687,7 @@
 def _ParticleSpecificAngularMomentumY(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     x = data["particle_position_x"] - center[0]
     z = data["particle_position_z"] - center[2]
@@ -693,7 +697,7 @@
 def _ParticleSpecificAngularMomentumZ(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     x = data["particle_position_x"] - center[0]
     y = data["particle_position_y"] - center[1]
@@ -703,11 +707,10 @@
 for ax in 'XYZ':
     n = "ParticleSpecificAngularMomentum%s" % ax
     add_field(n, function=eval("_%s" % n), particle_type=True,
-              convert_function=_convertSpecificAngularMomentum,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+              units="cm**2/s", validators=[ValidateParameter("center")])
     add_field(n + "KMSMPC", function=eval("_%s" % n), particle_type=True,
               convert_function=_convertSpecificAngularMomentumKMSMPC,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+              units="cm**2/s", validators=[ValidateParameter("center")])
 
 def _ParticleAngularMomentum(field, data):
     return data["ParticleMass"] * data["ParticleSpecificAngularMomentum"]
@@ -724,17 +727,17 @@
 def _ParticleAngularMomentumX(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumX"]
 add_field("ParticleAngularMomentumX", function=_ParticleAngularMomentumX,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 def _ParticleAngularMomentumY(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumY"]
 add_field("ParticleAngularMomentumY", function=_ParticleAngularMomentumY,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 def _ParticleAngularMomentumZ(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumZ"]
 add_field("ParticleAngularMomentumZ", function=_ParticleAngularMomentumZ,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 
 def get_radius(positions, data):
@@ -758,22 +761,22 @@
     return data.convert("cm")
 add_field("ParticleRadius", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusCGS, units=r"\rm{cm}",
+          convert_function = _ConvertRadiusCGS, units="cm",
           particle_type = True,
           display_name = "Particle Radius")
 add_field("Radius", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusCGS, units=r"\rm{cm}")
+          convert_function = _ConvertRadiusCGS, units="cm")
 
 def _ConvertRadiusMpc(data):
     return data.convert("mpc")
 add_field("RadiusMpc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusMpc, units=r"\rm{Mpc}",
+          convert_function = _ConvertRadiusMpc, units="Mpc",
           display_name = "Radius")
 add_field("ParticleRadiusMpc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusMpc, units=r"\rm{Mpc}",
+          convert_function = _ConvertRadiusMpc, units="Mpc",
           particle_type=True,
           display_name = "Particle Radius")
 
@@ -781,48 +784,48 @@
     return data.convert("kpc")
 add_field("ParticleRadiuskpc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}",
+          convert_function = _ConvertRadiuskpc, units="kpc",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuskpc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}",
+          convert_function = _ConvertRadiuskpc, units="kpc",
           display_name = "Radius")
 
 def _ConvertRadiuskpch(data):
     return data.convert("kpch")
 add_field("ParticleRadiuskpch", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpch, units=r"\rm{kpc}/\rm{h}",
+          convert_function = _ConvertRadiuskpch, units="kpc/h",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuskpch", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}/\rm{h}",
+          convert_function = _ConvertRadiuskpc, units="kpc/h",
           display_name = "Radius")
 
 def _ConvertRadiuspc(data):
     return data.convert("pc")
 add_field("ParticleRadiuspc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuspc, units=r"\rm{pc}",
+          convert_function = _ConvertRadiuspc, units="pc",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuspc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuspc, units=r"\rm{pc}",
+          convert_function = _ConvertRadiuspc, units="pc",
           display_name="Radius")
 
 def _ConvertRadiusAU(data):
     return data.convert("au")
 add_field("ParticleRadiusAU", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusAU, units=r"\rm{AU}",
+          convert_function = _ConvertRadiusAU, units="AU",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("RadiusAU", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusAU, units=r"\rm{AU}",
+          convert_function = _ConvertRadiusAU, units="AU",
           display_name = "Radius")
 
 add_field("ParticleRadiusCode", function=_ParticleRadius,
@@ -835,9 +838,9 @@
 
 def _RadialVelocity(field, data):
     normal = data.get_field_parameter("normal")
-    velocities = obtain_rv_vec(data)    
-    theta = data['sph_theta']
-    phi   = data['sph_phi']
+    velocities = obtain_rv_vec(data).transpose()
+    theta = np.tile(data['sph_theta'], (3, 1)).transpose()
+    phi   = np.tile(data['sph_phi'], (3, 1)).transpose()
 
     return get_sph_r_component(velocities, theta, phi, normal)
 
@@ -846,20 +849,20 @@
 def _ConvertRadialVelocityKMS(data):
     return km_per_cm
 add_field("RadialVelocity", function=_RadialVelocity,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 add_field("RadialVelocityABS", function=_RadialVelocityABS,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 add_field("RadialVelocityKMS", function=_RadialVelocity,
-          convert_function=_ConvertRadialVelocityKMS, units=r"\rm{km}/\rm{s}")
+          convert_function=_ConvertRadialVelocityKMS, units="km/s")
 add_field("RadialVelocityKMSABS", function=_RadialVelocityABS,
-          convert_function=_ConvertRadialVelocityKMS, units=r"\rm{km}/\rm{s}")
+          convert_function=_ConvertRadialVelocityKMS, units="km/s")
 
 def _TangentialVelocity(field, data):
     return np.sqrt(data["VelocityMagnitude"]**2.0
                  - data["RadialVelocity"]**2.0)
-add_field("TangentialVelocity", 
+add_field("TangentialVelocity",
           function=_TangentialVelocity,
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+          take_log=False, units="cm/s")
 
 def _CuttingPlaneVelocityX(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
@@ -870,10 +873,10 @@
     v_vec = np.array([data["%s-velocity" % ax] for ax in 'xyz']) \
                 - bulk_velocity[...,np.newaxis]
     return np.dot(x_vec, v_vec)
-add_field("CuttingPlaneVelocityX", 
+add_field("CuttingPlaneVelocityX",
           function=_CuttingPlaneVelocityX,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{km}/\rm{s}")
+                      for ax in 'xyz'], units="km/s")
 def _CuttingPlaneVelocityY(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
@@ -883,29 +886,29 @@
     v_vec = np.array([data["%s-velocity" % ax] for ax in 'xyz']) \
                 - bulk_velocity[...,np.newaxis]
     return np.dot(y_vec, v_vec)
-add_field("CuttingPlaneVelocityY", 
+add_field("CuttingPlaneVelocityY",
           function=_CuttingPlaneVelocityY,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{km}/\rm{s}")
+                      for ax in 'xyz'], units="km/s")
 
 def _CuttingPlaneBx(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
     b_vec = np.array([data["B%s" % ax] for ax in 'xyz'])
     return np.dot(x_vec, b_vec)
-add_field("CuttingPlaneBx", 
+add_field("CuttingPlaneBx",
           function=_CuttingPlaneBx,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{Gauss}")
+                      for ax in 'xyz'], units="gauss")
 def _CuttingPlaneBy(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
     b_vec = np.array([data["B%s" % ax] for ax in 'xyz'])
     return np.dot(y_vec, b_vec)
-add_field("CuttingPlaneBy", 
+add_field("CuttingPlaneBy",
           function=_CuttingPlaneBy,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{Gauss}")
+                      for ax in 'xyz'], units="gauss")
 
 def _MeanMolecularWeight(field,data):
     return (data["Density"] / (mh *data["NumberDensity"]))
@@ -919,7 +922,7 @@
             ((data["Temperature"]/data["MeanMolecularWeight"])**(1.5)) *
             (data["Density"]**(-0.5)))
 add_field("JeansMassMsun",function=_JeansMassMsun,
-          units=r"\rm{M_{\odot}}")
+          units="Msun")
 
 def _convertDensity(data):
     return data.convert("Density")
@@ -946,7 +949,7 @@
     """
     return (data["Bx"]**2 + data["By"]**2 + data["Bz"]**2)/(8*np.pi)
 add_field("MagneticEnergy",function=_MagneticEnergy,
-          units=r"\rm{ergs}\/\rm{cm}^{-3}",
+          units="erg / cm**3",
           display_name=r"\rm{Magnetic}\/\rm{Energy}")
 
 def _BMagnitude(field,data):
@@ -957,7 +960,7 @@
     return np.sqrt((data["Bx"]**2 + data["By"]**2 + data["Bz"]**2))
 add_field("BMagnitude",
           function=_BMagnitude,
-          display_name=r"|B|", units=r"\rm{Gauss}")
+          display_name=r"|B|", units="gauss")
 
 def _PlasmaBeta(field,data):
     """This assumes that your front end has provided Bx, By, Bz in
@@ -974,7 +977,7 @@
 add_field("MagneticPressure",
           function=_MagneticPressure,
           display_name=r"\rm{Magnetic}\/\rm{Energy}",
-          units="\rm{ergs}\/\rm{cm}^{-3}")
+          units="erg / cm**3")
 
 def _BPoloidal(field,data):
     normal = data.get_field_parameter("normal")
@@ -987,7 +990,7 @@
     return get_sph_theta_component(Bfields, theta, phi, normal)
 
 add_field("BPoloidal", function=_BPoloidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _BToroidal(field,data):
@@ -1000,7 +1003,7 @@
     return get_sph_phi_component(Bfields, phi, normal)
 
 add_field("BToroidal", function=_BToroidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _BRadial(field,data):
@@ -1014,7 +1017,7 @@
     return get_sph_r_component(Bfields, theta, phi, normal)
 
 add_field("BRadial", function=_BPoloidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _VorticitySquared(field, data):
@@ -1060,7 +1063,7 @@
 add_field("VorticitySquared", function=_VorticitySquared,
           validators=[ValidateSpatial(1,
               ["x-velocity","y-velocity","z-velocity"])],
-          units=r"\rm{s}^{-2}",
+          units="s**-2",
           convert_function=_convertVorticitySquared)
 
 def _gradPressureX(field, data):
@@ -1073,7 +1076,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dx'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][sl_right,1:-1,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][sl_left ,1:-1,1:-1]/ds
@@ -1088,7 +1091,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dy'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][1:-1,sl_right,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][1:-1,sl_left ,1:-1]/ds
@@ -1103,7 +1106,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dz'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][1:-1,1:-1,sl_right]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][1:-1,1:-1,sl_left ]/ds
@@ -1115,7 +1118,7 @@
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertgradPressure,
               validators=[ValidateSpatial(1, ["Pressure"])],
-              units=r"\rm{dyne}/\rm{cm}^{3}")
+              units="dyne/cm**3")
 
 def _gradPressureMagnitude(field, data):
     return np.sqrt(data["gradPressureX"]**2 +
@@ -1123,7 +1126,7 @@
                    data["gradPressureZ"]**2)
 add_field("gradPressureMagnitude", function=_gradPressureMagnitude,
           validators=[ValidateSpatial(1, ["Pressure"])],
-          units=r"\rm{dyne}/\rm{cm}^{3}")
+          units="dyne/cm**3")
 
 def _gradDensityX(field, data):
     # We need to set up stencils
@@ -1135,7 +1138,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dx'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][sl_right,1:-1,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][sl_left ,1:-1,1:-1]/ds
@@ -1150,7 +1153,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dy'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][1:-1,sl_right,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][1:-1,sl_left ,1:-1]/ds
@@ -1165,7 +1168,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dz'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][1:-1,1:-1,sl_right]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][1:-1,1:-1,sl_left ]/ds
@@ -1177,7 +1180,7 @@
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertgradDensity,
               validators=[ValidateSpatial(1, ["Density"])],
-              units=r"\rm{g}/\rm{cm}^{4}")
+              units="g/cm**4")
 
 def _gradDensityMagnitude(field, data):
     return np.sqrt(data["gradDensityX"]**2 +
@@ -1185,25 +1188,25 @@
                    data["gradDensityZ"]**2)
 add_field("gradDensityMagnitude", function=_gradDensityMagnitude,
           validators=[ValidateSpatial(1, ["Density"])],
-          units=r"\rm{g}/\rm{cm}^{4}")
+          units="g/cm**4")
 
 def _BaroclinicVorticityX(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureY"] * data["gradDensityZ"] -
             data["gradPressureZ"] * data["gradDensityY"]) / rho2
 def _BaroclinicVorticityY(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureZ"] * data["gradDensityX"] -
             data["gradPressureX"] * data["gradDensityZ"]) / rho2
 def _BaroclinicVorticityZ(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureX"] * data["gradDensityY"] -
             data["gradPressureY"] * data["gradDensityX"]) / rho2
 for ax in 'XYZ':
     n = "BaroclinicVorticity%s" % ax
     add_field(n, function=eval("_%s" % n),
           validators=[ValidateSpatial(1, ["Density", "Pressure"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _BaroclinicVorticityMagnitude(field, data):
     return np.sqrt(data["BaroclinicVorticityX"]**2 +
@@ -1212,7 +1215,7 @@
 add_field("BaroclinicVorticityMagnitude",
           function=_BaroclinicVorticityMagnitude,
           validators=[ValidateSpatial(1, ["Density", "Pressure"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityX(field, data):
     # We need to set up stencils
@@ -1224,7 +1227,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["z-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["z-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["z-velocity"][1:-1,sl_right,1:-1] -
                                  data["z-velocity"][1:-1,sl_left,1:-1]) \
                                  / (div_fac*data["dy"].flat[0])
@@ -1242,7 +1245,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["z-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["z-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["x-velocity"][1:-1,1:-1,sl_right] -
                                  data["x-velocity"][1:-1,1:-1,sl_left]) \
                                  / (div_fac*data["dz"].flat[0])
@@ -1260,7 +1263,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["x-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["x-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["y-velocity"][sl_right,1:-1,1:-1] -
                                  data["y-velocity"][sl_left,1:-1,1:-1]) \
                                  / (div_fac*data["dx"].flat[0])
@@ -1274,18 +1277,18 @@
     n = "Vorticity%s" % ax
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertVorticity,
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                           ["x-velocity", "y-velocity", "z-velocity"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 
 def _VorticityMagnitude(field, data):
     return np.sqrt(data["VorticityX"]**2 +
                    data["VorticityY"]**2 +
                    data["VorticityZ"]**2)
 add_field("VorticityMagnitude", function=_VorticityMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityStretchingX(field, data):
     return data["DivV"] * data["VorticityX"]
@@ -1301,11 +1304,11 @@
     return np.sqrt(data["VorticityStretchingX"]**2 +
                    data["VorticityStretchingY"]**2 +
                    data["VorticityStretchingZ"]**2)
-add_field("VorticityStretchingMagnitude", 
+add_field("VorticityStretchingMagnitude",
           function=_VorticityStretchingMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityGrowthX(field, data):
     return -data["VorticityStretchingX"] - data["BaroclinicVorticityX"]
@@ -1316,9 +1319,9 @@
 for ax in 'XYZ':
     n = "VorticityGrowth%s" % ax
     add_field(n, function=eval("_%s" % n),
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                           ["x-velocity", "y-velocity", "z-velocity"])],
-              units=r"\rm{s}^{-2}")
+              units="1/s")
 def _VorticityGrowthMagnitude(field, data):
     result = np.sqrt(data["VorticityGrowthX"]**2 +
                      data["VorticityGrowthY"]**2 +
@@ -1329,18 +1332,18 @@
     result = np.sign(dot) * result
     return result
 add_field("VorticityGrowthMagnitude", function=_VorticityGrowthMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}",
+          units="1/s",
           take_log=False)
 def _VorticityGrowthMagnitudeABS(field, data):
     return np.sqrt(data["VorticityGrowthX"]**2 +
                    data["VorticityGrowthY"]**2 +
                    data["VorticityGrowthZ"]**2)
 add_field("VorticityGrowthMagnitudeABS", function=_VorticityGrowthMagnitudeABS,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityGrowthTimescale(field, data):
     domegax_dt = data["VorticityX"] / data["VorticityGrowthX"]
@@ -1348,24 +1351,24 @@
     domegaz_dt = data["VorticityZ"] / data["VorticityGrowthZ"]
     return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt)
 add_field("VorticityGrowthTimescale", function=_VorticityGrowthTimescale,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}")
+          units="s")
 
 ########################################################################
 # With radiation pressure
 ########################################################################
 
 def _VorticityRadPressureX(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel2"] * data["gradDensityZ"] -
             data["RadAccel3"] * data["gradDensityY"]) / rho
 def _VorticityRadPressureY(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel3"] * data["gradDensityX"] -
             data["RadAccel1"] * data["gradDensityZ"]) / rho
 def _VorticityRadPressureZ(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel1"] * data["gradDensityY"] -
             data["RadAccel2"] * data["gradDensityX"]) / rho
 def _convertRadAccel(data):
@@ -1374,9 +1377,9 @@
     n = "VorticityRadPressure%s" % ax
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertRadAccel,
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                    ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 
 def _VorticityRadPressureMagnitude(field, data):
     return np.sqrt(data["VorticityRadPressureX"]**2 +
@@ -1384,9 +1387,9 @@
                    data["VorticityRadPressureZ"]**2)
 add_field("VorticityRadPressureMagnitude",
           function=_VorticityRadPressureMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityRPGrowthX(field, data):
     return -data["VorticityStretchingX"] - data["BaroclinicVorticityX"] \
@@ -1400,9 +1403,9 @@
 for ax in 'XYZ':
     n = "VorticityRPGrowth%s" % ax
     add_field(n, function=eval("_%s" % n),
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                        ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 def _VorticityRPGrowthMagnitude(field, data):
     result = np.sqrt(data["VorticityRPGrowthX"]**2 +
                      data["VorticityRPGrowthY"]**2 +
@@ -1413,19 +1416,19 @@
     result = np.sign(dot) * result
     return result
 add_field("VorticityRPGrowthMagnitude", function=_VorticityGrowthMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}",
+          units="1/s",
           take_log=False)
 def _VorticityRPGrowthMagnitudeABS(field, data):
     return np.sqrt(data["VorticityRPGrowthX"]**2 +
                    data["VorticityRPGrowthY"]**2 +
                    data["VorticityRPGrowthZ"]**2)
-add_field("VorticityRPGrowthMagnitudeABS", 
+add_field("VorticityRPGrowthMagnitudeABS",
           function=_VorticityRPGrowthMagnitudeABS,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityRPGrowthTimescale(field, data):
     domegax_dt = data["VorticityX"] / data["VorticityRPGrowthX"]
@@ -1433,6 +1436,6 @@
     domegaz_dt = data["VorticityZ"] / data["VorticityRPGrowthZ"]
     return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt**2)
 add_field("VorticityRPGrowthTimescale", function=_VorticityRPGrowthTimescale,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")

diff -r 50e6460dade1bc6cdd62012f7427f5c079f2fbe3 -r 19ea28fbfa3792779869e37eb41100427a2cc03f yt/data_objects/yt_array.py
--- /dev/null
+++ b/yt/data_objects/yt_array.py
@@ -0,0 +1,61 @@
+"""
+YTArray class
+
+Authors: Casey W. Stark <caseywstark at gmail.com>
+Affiliation: UC Berkeley
+
+Homepage: http://yt-project.org/
+License:
+    Copyright (C) 2013 Casey W. Stark.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+
+import numpy as np
+
+from yt.utilities.units import Unit
+
+class UnitArray(np.ndarray):
+    """
+
+    """
+    def __new__(cls, input_array, units=None):
+        # Input array is an already formed ndarray instance
+        # We first cast to be our class type
+        obj = np.asarray(input_array).view(cls)
+
+        # Check units type
+        if units is None:
+            units = Unit()
+        if not isinstance(units, Unit):
+            units = Unit(units)
+
+        # Attach the units
+        obj.units = units
+
+        return obj
+
+    def __array_finalize__(self, obj):
+        # see InfoArray.__array_finalize__ for comments
+        if obj is None: return
+        self.units = getattr(obj, 'units', None)
+
+    def convert_to(self, new_units):
+        """
+
+        """
+        cf = self.units.get_conversion_factor(new_units)

diff -r 50e6460dade1bc6cdd62012f7427f5c079f2fbe3 -r 19ea28fbfa3792779869e37eb41100427a2cc03f yt/geometry/geometry_handler.py
--- a/yt/geometry/geometry_handler.py
+++ b/yt/geometry/geometry_handler.py
@@ -1,4 +1,4 @@
-""" 
+"""
 Geometry container base class.
 
 Author: Matthew Turk <matthewturk at gmail.com>
@@ -132,8 +132,8 @@
                 # will allow the same field detection mechanism to work for 1D, 2D
                 # and 3D fields.
                 self.pf.field_info.add_field(
-                        field, NullFunc, particle_type = particle_type,
-                        convert_function=cf, take_log=False, units=r"Unknown")
+                        field, NullFunc, particle_type=particle_type,
+                        convert_function=cf, take_log=False)
             else:
                 mylog.debug("Adding known field %s to list of fields", field)
                 self.parameter_file.field_info[field] = known_fields[field]

diff -r 50e6460dade1bc6cdd62012f7427f5c079f2fbe3 -r 19ea28fbfa3792779869e37eb41100427a2cc03f yt/utilities/tests/test_units.py
--- a/yt/utilities/tests/test_units.py
+++ b/yt/utilities/tests/test_units.py
@@ -70,6 +70,13 @@
     assert u1.cgs_value == 1
     assert u1.dimensions == 1
 
+    u2 = Unit("")
+
+    assert u2.is_dimensionless
+    assert u2.expr == 1
+    assert u2.cgs_value == 1
+    assert u2.dimensions == 1
+
 #
 # Start init tests
 #

diff -r 50e6460dade1bc6cdd62012f7427f5c079f2fbe3 -r 19ea28fbfa3792779869e37eb41100427a2cc03f yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -74,6 +74,9 @@
     "J": (1.0e7, energy),
     "Hz": (1.0, rate),
 
+    # dimensionless
+    "h": (1.0, 1.0),
+
     # times
     "min": (60.0, time),
     "hr":  (3600.0, time),
@@ -163,6 +166,10 @@
         """
         # if we have a string, parse into an expression
         if isinstance(unit_expr, str):
+            if not unit_expr:
+                # Bug catch...
+                # if unit_expr is an empty string, parse_expr fails hard...
+                unit_expr = "1"
             unit_expr = parse_expr(unit_expr)
 
         if not isinstance(unit_expr, Expr):
@@ -289,6 +296,9 @@
              self.dimensions.expand().as_coeff_exponent(temperature)[1])
         return Unit(cgs_units_string, 1, self.dimensions)
 
+    def get_conversion_factor(self, other_units):
+        return get_conversion_factor(self, other_units)
+
 
 def make_symbols_positive(expr):
     """


https://bitbucket.org/yt_analysis/yt/commits/107f60b9717e/
Changeset:   107f60b9717e
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-07 00:38:51
Summary:     Merging from Casey's work
Affected #:  6 files

diff -r 6658890fa0fa5ee183ddc20d0098f151f0d531f8 -r 107f60b9717eff4cfafb1f97587ea29621af894e yt/data_objects/field_info_container.py
--- a/yt/data_objects/field_info_container.py
+++ b/yt/data_objects/field_info_container.py
@@ -33,6 +33,7 @@
 import numpy as np
 
 from yt.funcs import *
+from yt.utilities.units import Unit
 
 class FieldInfoContainer(dict): # Resistance has utility
     """
@@ -259,7 +260,7 @@
                 lambda: np.ones((nd, nd, nd), dtype='float64')
                 + 1e-4*np.random.random((nd, nd, nd)))
         else:
-            defaultdict.__init__(self, 
+            defaultdict.__init__(self,
                 lambda: np.ones((nd * nd * nd), dtype='float64')
                 + 1e-4*np.random.random((nd * nd * nd)))
 
@@ -300,20 +301,27 @@
             return np.random.random(3) * 1e-2
         else:
             return 0.0
+
     _num_ghost_zones = 0
     id = 1
-    def has_field_parameter(self, param): return True
-    def convert(self, item): return 1
+
+    def has_field_parameter(self, param):
+        return True
+
+    def convert(self, item):
+        return 1
+
+
+class FieldUnitsError(Exception):
+    pass
 
 class DerivedField(object):
-    def __init__(self, name, function,
-                 convert_function = None,
-                 particle_convert_function = None,
-                 units = "", projected_units = "",
-                 take_log = True, validators = None,
-                 particle_type = False, vector_field=False,
-                 display_field = True, not_in_all=False,
-                 display_name = None, projection_conversion = "cm"):
+    def __init__(self, name, function, convert_function=None,
+                 particle_convert_function=None, units=None,
+                 projected_units=None, take_log=True, validators=None,
+                 particle_type=False, vector_field=False, display_field=True,
+                 not_in_all=False, display_name=None,
+                 projection_conversion="cm"):
         """
         This is the base class used to describe a cell-by-cell derived field.
 
@@ -333,26 +341,46 @@
         :param display_name: a name used in the plots
         :param projection_conversion: which unit should we multiply by in a
                                       projection?
+
         """
         self.name = name
+        self.take_log = take_log
+        self.display_name = display_name
+        self.not_in_all = not_in_all
+        self.display_field = display_field
+        self.particle_type = particle_type
+        self.vector_field = vector_field
+
         self._function = function
+        if not convert_function:
+            convert_function = lambda a: 1.0
+        self._convert_function = convert_function
+        self.particle_convert_function = particle_convert_function
+        self.projection_conversion = projection_conversion
+
         if validators:
             self.validators = ensure_list(validators)
         else:
             self.validators = []
-        self.take_log = take_log
-        self._units = units
-        self._projected_units = projected_units
-        if not convert_function:
-            convert_function = lambda a: 1.0
-        self._convert_function = convert_function
-        self._particle_convert_function = particle_convert_function
-        self.particle_type = particle_type
-        self.vector_field = vector_field
-        self.projection_conversion = projection_conversion
-        self.display_field = display_field
-        self.display_name = display_name
-        self.not_in_all = not_in_all
+
+        # handle units
+        if units is None:
+            self.units = Unit()
+        elif isinstance(units, str):
+            self.units = Unit(units)
+        elif isinstance(units, Unit):
+            self.units = units
+        else:
+            raise FieldUnitsException("Bad units type. Please provide a Unit object or a string.")
+
+        if projected_units is None:
+            self.projected_units = Unit
+        elif isinstance(projected_units, str):
+            self.projected_units = Unit(projected_units)
+        elif isinstance(projected_units, Unit):
+            self.projected_units = projected_units
+        else:
+            raise FieldUnitsException("Bad projected_units type. Please provide a Unit object or a string.")
 
     def _copy_def(self):
         dd = {}
@@ -392,16 +420,6 @@
             e[self.name]
         return e
 
-    def get_units(self):
-        """ Return a string describing the units. """
-        return self._units
-
-    def get_projected_units(self):
-        """
-        Return a string describing the units if the field has been projected.
-        """
-        return self._projected_units
-
     def __call__(self, data):
         """ Return the value of the field in a given *data* object. """
         ii = self.check_available(data)
@@ -425,11 +443,21 @@
         Return a data label for the given field, inluding units.
         """
         name = self.name
-        if self.display_name is not None: name = self.display_name
+        if self.display_name is not None:
+            name = self.display_name
+
+        # Start with the field name
         data_label = r"$\rm{%s}" % name
-        if projected: units = self.get_projected_units()
-        else: units = self.get_units()
-        if units != "": data_label += r"\/\/ (%s)" % (units)
+
+        # Grab the correct units
+        if projected:
+            units = self.projected_units
+        else:
+            units = self.units
+        # Add unit label
+        if not units.is_dimensionless:
+            data_label += r"\/\/ (%s)" % (units)
+
         data_label += r"$"
         return data_label
 

diff -r 6658890fa0fa5ee183ddc20d0098f151f0d531f8 -r 107f60b9717eff4cfafb1f97587ea29621af894e yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -47,15 +47,15 @@
     NeedsParameter
 
 from yt.utilities.physical_constants import \
-     mh, \
-     me, \
-     sigma_thompson, \
-     clight, \
-     kboltz, \
-     G, \
-     rho_crit_now, \
-     speed_of_light_cgs, \
-     km_per_cm
+    mh, \
+    me, \
+    sigma_thompson, \
+    clight, \
+    kboltz, \
+    G, \
+    rho_crit_now, \
+    speed_of_light_cgs, \
+    km_per_cm
 
 from yt.utilities.math_utils import \
     get_sph_r_component, \
@@ -68,371 +68,374 @@
     get_cyl_z, get_sph_r, \
     get_sph_theta, get_sph_phi, \
     periodic_dist, euclidean_dist
-     
-def _GridLevel(field, data):
-    return np.ones(data.ActiveDimensions)*(data.Level)
-add_field("GridLevel", function=_GridLevel,
-          validators=[ValidateGridType(),
-                      ValidateSpatial(0)])
 
-def _GridIndices(field, data):
-    return np.ones(data["Ones"].shape)*(data.id-data._id_offset)
-add_field("GridIndices", function=_GridIndices,
-          validators=[ValidateGridType(),
-                      ValidateSpatial(0)], take_log=False)
+# Note that, despite my newfound efforts to comply with PEP-8,
+# I violate it here in order to keep the name/func_name relationship
 
-def _OnesOverDx(field, data):
-    return np.ones(data["Ones"].shape,
-                   dtype=data["Density"].dtype)/data['dx']
-add_field("OnesOverDx", function=_OnesOverDx,
+def _dx(field, data):
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[0]
+
+add_field('dx', function=_dx, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _dy(field, data):
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[1]
+
+add_field('dy', function=_dy, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _dz(field, data):
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[2]
+
+add_field('dz', function=_dz,
+          display_field=False, validators=[ValidateSpatial(0)])
+
+def _coord_x(field, data):
+    dim = data.ActiveDimensions[0]
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[0])[:, None, None] + 0.5 )
+             * data['dx'] + data.LeftEdge[0] )
+
+add_field('x', function=_coord_x, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _coord_y(field, data):
+    dim = data.ActiveDimensions[1]
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[1])[None, :, None] + 0.5 )
+             * data['dy'] + data.LeftEdge[1] )
+
+add_field('y', function=_coord_y, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _coord_z(field, data):
+    dim = data.ActiveDimensions[2]
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[2])[None, None, :] + 0.5 )
+             * data['dz'] + data.LeftEdge[2] )
+
+add_field('z', function=_coord_z, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _grid_level(field, data):
+    return np.ones(data.ActiveDimensions) * data.Level
+
+add_field("grid_level", function=_grid_level,
+          validators=[ValidateGridType(), ValidateSpatial(0)])
+
+def _grid_indices(field, data):
+    return np.ones(data["ones"].shape) * (data.id - data._id_offset)
+
+add_field("grid_indices", function=_grid_indices, take_log=False,
+          validators=[ValidateGridType(), ValidateSpatial(0)])
+
+def _ones_over_dx(field, data):
+    return np.ones(data["ones"].shape, dtype=data["density"].dtype) / data['dx']
+
+add_field("ones_over_dx", function=_ones_over_dx, display_field=False)
+
+def _ones(field, data):
+    return np.ones(data.shape, dtype=np.float64)
+
+add_field("ones", function=_ones, projection_conversion="unitary",
           display_field=False)
+add_field("cells_per_bin", function=_ones, display_field=False)
 
-def _Zeros(field, data):
-    return np.zeros(data.ActiveDimensions, dtype='float64')
-add_field("Zeros", function=_Zeros,
-          validators=[ValidateSpatial(0)],
-          projection_conversion="unitary",
-          display_field = False)
 
-def _Ones(field, data):
-    return np.ones(data.shape, dtype='float64')
-add_field("Ones", function=_Ones,
-          projection_conversion="unitary",
-          display_field = False)
-add_field("CellsPerBin", function=_Ones, display_field = False)
+def _sound_speed(field, data):
+    if data.pf["eos_type"] == 1:
+        return ( np.ones(data["density"].shape, dtype=np.float64)
+                 * data.pf["eos_sound_speed"] )
+    return np.sqrt( data.pf["gamma"] * data["pressure"] / data["density"] )
 
-def _SoundSpeed(field, data):
-    if data.pf["EOSType"] == 1:
-        return np.ones(data["Density"].shape, dtype='float64') * \
-                data.pf["EOSSoundSpeed"]
-    return ( data.pf["Gamma"]*data["Pressure"] / \
-             data["Density"] )**(1.0/2.0)
-add_field("SoundSpeed", function=_SoundSpeed,
-          units=r"\rm{cm}/\rm{s}")
+add_field("sound_speed", function=_sound_speed, units="cm/s")
 
-def _RadialMachNumber(field, data):
-    """M{|v|/t_sound}"""
-    return np.abs(data["RadialVelocity"]) / data["SoundSpeed"]
-add_field("RadialMachNumber", function=_RadialMachNumber)
+def _radial_mach_number(field, data):
+    """ M{|v|/t_sound} """
+    return np.abs(data["radial_velocity"]) / data["sound_speed"]
 
-def _MachNumber(field, data):
-    """M{|v|/t_sound}"""
-    return data["VelocityMagnitude"] / data["SoundSpeed"]
-add_field("MachNumber", function=_MachNumber)
+add_field("radial_mach_number", function=_radial_mach_number)
 
-def _CourantTimeStep(field, data):
-    t1 = data['dx'] / (
-        data["SoundSpeed"] + \
-        abs(data["x-velocity"]))
-    t2 = data['dy'] / (
-        data["SoundSpeed"] + \
-        abs(data["y-velocity"]))
-    t3 = data['dz'] / (
-        data["SoundSpeed"] + \
-        abs(data["z-velocity"]))
-    return np.minimum(np.minimum(t1,t2),t3)
-def _convertCourantTimeStep(data):
-    # SoundSpeed and z-velocity are in cm/s, dx is in code
+def _mach_number(field, data):
+    """ M{|v|/t_sound} """
+    return data["velocity_magnitude"] / data["sound_speed"]
+
+add_field("mach_number", function=_mach_number)
+
+def _courant_time_step(field, data):
+    t1 = data["dx"] / (data["sound_speed"] + np.abs(data["velocity_x"]))
+    t2 = data["dy"] / (data["sound_speed"] + np.abs(data["velocity_y"]))
+    t3 = data["dz"] / (data["sound_speed"] + np.abs(data["velocity_z"]))
+    return np.minimum(np.minimum(t1, t2), t3)
+def _convert_courant_time_step(data):
+    # sound speed and z-velocity are in cm/s, dx is in code
     return data.convert("cm")
-add_field("CourantTimeStep", function=_CourantTimeStep,
-          convert_function=_convertCourantTimeStep,
-          units=r"$\rm{s}$")
 
-def _ParticleVelocityMagnitude(field, data):
-    """M{|v|}"""
+add_field("courant_time_step", function=_courant_time_step,
+          convert_function=_convert_courant_time_step, units="s")
+
+def _particle_velocity_magnitude(field, data):
+    """ M{|v|} """
     bulk_velocity = data.get_field_parameter("bulk_velocity")
-    if bulk_velocity == None:
+    if bulk_velocity is None:
         bulk_velocity = np.zeros(3)
-    return ( (data["particle_velocity_x"]-bulk_velocity[0])**2.0 + \
-             (data["particle_velocity_y"]-bulk_velocity[1])**2.0 + \
-             (data["particle_velocity_z"]-bulk_velocity[2])**2.0 )**(1.0/2.0)
-add_field("ParticleVelocityMagnitude", function=_ParticleVelocityMagnitude,
-          particle_type=True, 
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+    return np.sqrt( (data["particle_velocity_x"] - bulk_velocity[0])**2
+                    + (data["particle_velocity_y"] - bulk_velocity[1])**2
+                    + (data["particle_velocity_z"] - bulk_velocity[2])**2 )
 
-def _VelocityMagnitude(field, data):
-    """M{|v|}"""
+add_field("particle_velocity_magnitude", function=_particle_velocity_magnitude,
+          particle_type=True, take_log=False, units="cm/s")
+
+def _velocity_magnitude(field, data):
+    """ M{|v|} """
     velocities = obtain_rv_vec(data)
-    return np.sqrt(np.sum(velocities**2,axis=0))
-add_field("VelocityMagnitude", function=_VelocityMagnitude,
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+    return np.sqrt(np.sum(velocities**2, axis=0))
 
-def _TangentialOverVelocityMagnitude(field, data):
-    return np.abs(data["TangentialVelocity"])/np.abs(data["VelocityMagnitude"])
-add_field("TangentialOverVelocityMagnitude",
-          function=_TangentialOverVelocityMagnitude,
-          take_log=False)
+add_field("velocity_magnitude", function=_velocity_magnitude,
+          take_log=False, units="cm/s")
 
-def _Pressure(field, data):
-    """M{(Gamma-1.0)*rho*E}"""
-    return (data.pf["Gamma"] - 1.0) * \
-           data["Density"] * data["ThermalEnergy"]
-add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+def _tangential_over_velocity_magnitude(field, data):
+    # @todo: can velocity_magnitude be negative?
+    return np.abs(data["tangential_velocity"]) / np.abs(data["velocity_magnitude"])
 
-def _Entropy(field, data):
+add_field("tangential_over_velocity_magnitude",
+          function=_tangential_over_velocity_magnitude, take_log=False)
+
+def _pressure(field, data):
+    """ M{(Gamma-1.0)*rho*E} """
+    return (data.pf["gamma"] - 1.0) * data["density"] * data["thermal_energy"]
+
+add_field("pressure", function=_pressure, units="dyne/cm**2")
+
+def _entropy(field, data):
     if data.has_field_parameter("mu"):
-        mw = mh*data.get_field_parameter("mu")
-    else :
+        mw = mh * data.get_field_parameter("mu")
+    else:
         mw = mh
-    return kboltz * data["Temperature"] / \
-           ((data["Density"]/mw)**(data.pf["Gamma"] - 1.0))
-add_field("Entropy", units=r"\rm{ergs}\ \rm{cm}^{3\gamma-3}",
-          function=_Entropy)
+    return ( kboltz * data["temperature"]
+             / ((data["density"] / mw)**(data.pf["gamma"] - 1.0)) )
 
-
+add_field("entropy", units="erg/K", function=_entropy)
 
 ### spherical coordinates: r (radius)
-def _sph_r(field, data):
+def _spherical_r(field, data):
     center = data.get_field_parameter("center")
-      
-    coords = obtain_rvec(data)
+    coords = obtain_rvec(data).transpose()
+    return get_sph_r(vectors, center)
 
-    return get_sph_r(coords)
-
-def _Convert_sph_r_CGS(data):
+def _convert_spherical_r_cgs(data):
    return data.convert("cm")
 
-add_field("sph_r", function=_sph_r,
+add_field("spherical_r", function=_spherical_r,
          validators=[ValidateParameter("center")],
-         convert_function = _Convert_sph_r_CGS, units=r"\rm{cm}")
-
+         convert_function=_convert_spherical_r_cgs, units="cm")
 
 ### spherical coordinates: theta (angle with respect to normal)
-def _sph_theta(field, data):
+def _spherical_theta(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_sph_theta(coords, normal)
 
-add_field("sph_theta", function=_sph_theta,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
-
+add_field("spherical_theta", function=_spherical_theta,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### spherical coordinates: phi (angle in the plane perpendicular to the normal)
-def _sph_phi(field, data):
+def _spherical_phi(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_sph_phi(coords, normal)
 
-add_field("sph_phi", function=_sph_phi,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
+add_field("spherical_phi", function=_spherical_phi,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### cylindrical coordinates: R (radius in the cylinder's plane)
-def _cyl_R(field, data):
+def _cylindrical_r(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-      
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_cyl_r(coords, normal)
 
-def _Convert_cyl_R_CGS(data):
+def _convert_cylindrical_r_cgs(data):
    return data.convert("cm")
 
-add_field("cyl_R", function=_cyl_R,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")],
-         convert_function = _Convert_cyl_R_CGS, units=r"\rm{cm}")
-add_field("cyl_RCode", function=_cyl_R,
-          validators=[ValidateParameter("center"),ValidateParameter("normal")],
-          units=r"Radius (code)")
-
+add_field("cylindrical_r", function=_cylindrical_r,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")],
+         convert_function=_convert_cylindrical_r_cgs, units="cm")
+add_field("cylindrical_r_code", function=_cylindrical_r,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### cylindrical coordinates: z (height above the cylinder's plane)
-def _cyl_z(field, data):
+def _cylindrical_z(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_cyl_z(coords, normal)
 
-def _Convert_cyl_z_CGS(data):
+def _convert_cylindrical_z_cgs(data):
    return data.convert("cm")
 
-add_field("cyl_z", function=_cyl_z,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")],
-         convert_function = _Convert_cyl_z_CGS, units=r"\rm{cm}")
-
+add_field("cylindrical_z", function=_cylindrical_z,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
+          convert_function=_convert_cylindrical_z_cgs, units="cm")
 
 ### cylindrical coordinates: theta (angle in the cylinder's plane)
-def _cyl_theta(field, data):
+def _cylindrical_theta(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_cyl_theta(coords, normal)
 
-add_field("cyl_theta", function=_cyl_theta,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
+add_field("cylindrical_theta", function=_cylindrical_theta,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### The old field DiskAngle is the same as the spherical coordinates'
 ### 'theta' angle. I'm keeping DiskAngle for backwards compatibility.
-def _DiskAngle(field, data):
-    return data['sph_theta']
+# @todo: remove in 3.0?
+def _disk_angle(field, data):
+    return data["spherical_theta"]
 
-add_field("DiskAngle", function=_DiskAngle,
-          take_log=False,
-          validators=[ValidateParameter("center"),
-                      ValidateParameter("normal")],
+add_field("disk_angle", function=_disk_angle, take_log=False,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
           display_field=False)
 
-
 ### The old field Height is the same as the cylindrical coordinates' z
 ### field. I'm keeping Height for backwards compatibility.
-def _Height(field, data):
-    return data['cyl_z']
+# @todo: remove in 3.0?
+def _height(field, data):
+    return data["cylindrical_z"]
 
-def _convertHeight(data):
+def _convert_height(data):
     return data.convert("cm")
-def _convertHeightAU(data):
+
+def _convert_height_au(data):
     return data.convert("au")
-add_field("Height", function=_Height,
-          convert_function=_convertHeight,
+
+add_field("height", function=_height, convert_function=_convert_height,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
+          units="cm", display_field=False)
+add_field("height_au", function=_height, convert_function=_convert_height_au,
           validators=[ValidateParameter("center"),
                       ValidateParameter("normal")],
-          units=r"cm", display_field=False)
-add_field("HeightAU", function=_Height,
-          convert_function=_convertHeightAU,
-          validators=[ValidateParameter("center"),
-                      ValidateParameter("normal")],
-          units=r"AU", display_field=False)
+          units="AU", display_field=False)
 
-def _cyl_RadialVelocity(field, data):
+def _cylindrical_radial_velocity(field, data):
     normal = data.get_field_parameter("normal")
-    velocities = obtain_rv_vec(data)
-
-    theta = data['cyl_theta']
-
+    velocities = obtain_rv_vec(data).transpose()
+    theta = np.tile(data['cylindrical_theta'], (3, 1)).transpose()
     return get_cyl_r_component(velocities, theta, normal)
 
-def _cyl_RadialVelocityABS(field, data):
-    return np.abs(_cyl_RadialVelocity(field, data))
-def _Convert_cyl_RadialVelocityKMS(data):
+def _cylindrical_radial_velocity_absolute(field, data):
+    return np.abs(_cylindrical_radial_velocity(field, data))
+
+def _convert_cylindrical_radial_velocity_kms(data):
     return km_per_cm
-add_field("cyl_RadialVelocity", function=_cyl_RadialVelocity,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityABS", function=_cyl_RadialVelocityABS,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityKMS", function=_cyl_RadialVelocity,
-          convert_function=_Convert_cyl_RadialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityKMSABS", function=_cyl_RadialVelocityABS,
-          convert_function=_Convert_cyl_RadialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
 
-def _cyl_TangentialVelocity(field, data):
+add_field("cylindrical_radial_velocity", function=_cylindrical_radial_velocity,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_absolute",
+          function=_cylindrical_radial_velocity_absolute,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_kms",
+          function=_cylindrical_radial_velocity,
+          convert_function=_convert_cylindrical_radial_velocity_kms,
+          units="km/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_kms_absolute",
+          function=_cylindrical_radial_velocity_absolute,
+          convert_function=_convert_cylindrical_radial_velocity_kms,
+          units="km/s", validators=[ValidateParameter("normal")])
+
+def _cylindrical_tangential_velocity(field, data):
     normal = data.get_field_parameter("normal")
-    velocities = obtain_rv_vec(data)
-    theta = data['cyl_theta']
-
+    velocities = obtain_rv_vec(data).transpose()
+    theta = np.tile(data["cylindrical_theta"], (3, 1)).transpose()
     return get_cyl_theta_component(velocities, theta, normal)
 
-def _cyl_TangentialVelocityABS(field, data):
-    return np.abs(_cyl_TangentialVelocity(field, data))
-def _Convert_cyl_TangentialVelocityKMS(data):
+def _cylindrical_tangential_velocity_absolute(field, data):
+    return np.abs(_cylindrical_tangential_velocity(field, data))
+
+def _convert_cylindrical_tangential_velocity_kms(data):
     return km_per_cm
-add_field("cyl_TangentialVelocity", function=_cyl_TangentialVelocity,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityABS", function=_cyl_TangentialVelocityABS,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityKMS", function=_cyl_TangentialVelocity,
-          convert_function=_Convert_cyl_TangentialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityKMSABS", function=_cyl_TangentialVelocityABS,
-          convert_function=_Convert_cyl_TangentialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
 
-def _DynamicalTime(field, data):
+add_field("cylindrical_tangential_velocity",
+          function=_cylindrical_tangential_velocity,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_tangential_velocity_absolute",
+          function=_cylindrical_tangential_velocity_absolute,
+          units="cm/s", validators=[ValidateParameter("normal")])
+
+def _dynamical_time(field, data):
     """
-    The formulation for the dynamical time is:
-    M{sqrt(3pi/(16*G*rho))} or M{sqrt(3pi/(16G))*rho^-(1/2)}
-    Note that we return in our natural units already
+    sqrt(3 pi / (16 G rho))
     """
-    return (3.0*np.pi/(16*G*data["Density"]))**(1./2.)
-add_field("DynamicalTime", function=_DynamicalTime,
-           units=r"\rm{s}")
+    return np.sqrt(3.0 * np.pi / (16.0 * G * data["density"]))
 
-def JeansMassMsun(field,data):
-    return (MJ_constant * 
-            ((data["Temperature"]/data["MeanMolecularWeight"])**(1.5)) *
-            (data["Density"]**(-0.5)))
-add_field("JeansMassMsun",function=JeansMassMsun,units=r"\rm{Msun}")
+add_field("dynamical_time", function=_dynamical_time, units="s")
 
-def _CellMass(field, data):
-    return data["Density"] * data["CellVolume"]
-def _convertCellMassMsun(data):
-    return 5.027854e-34 # g^-1
-add_field("CellMass", function=_CellMass, units=r"\rm{g}")
-add_field("CellMassMsun", units=r"M_{\odot}",
-          function=_CellMass,
-          convert_function=_convertCellMassMsun)
+def jeans_mass(field, data):
+    return ( MJ_constant
+             * ((data["temperature"] / data["mean_molecular_weight"])**(1.5))
+             * (data["density"]**(-0.5)) )
 
-def _CellMassCode(field, data):
-    return data["Density"] * data["CellVolumeCode"]
-def _convertCellMassCode(data):
-    return 1.0/data.convert("Density")
-add_field("CellMassCode", 
-          function=_CellMassCode,
-          convert_function=_convertCellMassCode)
+add_field("jeans_mass", function=jeans_mass, units="g")
 
-def _TotalMass(field,data):
-    return (data["Density"]+data["Dark_Matter_Density"]) * data["CellVolume"]
-add_field("TotalMass", function=_TotalMass, units=r"\rm{g}")
-add_field("TotalMassMsun", units=r"M_{\odot}",
-          function=_TotalMass,
-          convert_function=_convertCellMassMsun)
+def _cell_mass(field, data):
+    return data["density"] * data["cell_volume"]
 
-def _StarMass(field,data):
-    return data["star_density"] * data["CellVolume"]
-add_field("StarMassMsun", units=r"M_{\odot}",
-          function=_StarMass,
-          convert_function=_convertCellMassMsun)
+add_field("cell_mass", function=_cell_mass, units="g")
 
-def _Matter_Density(field,data):
-    return (data['Density'] + data['Dark_Matter_Density'])
-add_field("Matter_Density",function=_Matter_Density,units=r"\rm{g}/\rm{cm^3}")
+def _total_mass(field, data):
+    return (data["density"] + data["dark_matter_density"]) * data["cell_volume"]
 
-def _ComovingDensity(field, data):
-    ef = (1.0 + data.pf.current_redshift)**3.0
-    return data["Density"]/ef
-add_field("ComovingDensity", function=_ComovingDensity, units=r"\rm{g}/\rm{cm}^3")
+add_field("total_mass", function=_total_mass, units="g")
+
+def _star_mass(field, data):
+    return data["star_density"] * data["cell_volume"]
+
+add_field("star_mass", units="g", function=_star_mass)
+
+def _matter_density(field, data):
+    return (data["density"] + data["dark_matter_density"])
+
+add_field("matter_density", function=_matter_density, units="g/cm**3")
+
+def _comoving_density(field, data):
+    z = data.pf.current_redshift
+    return data["density"] / (1.0 + z)**3
+
+add_field("comoving_density", function=_comoving_density, units="g/cm**3")
 
 # This is rho_total / rho_cr(z).
-def _Convert_Overdensity(data):
-    return 1.0 / (rho_crit_now * data.pf.hubble_constant**2 * 
+def _convert_overdensity(data):
+    return 1 / (rho_crit_now * data.pf.hubble_constant**2 *
                 (1+data.pf.current_redshift)**3)
-add_field("Overdensity",function=_Matter_Density,
-          convert_function=_Convert_Overdensity, units=r"")
+add_field("Overdensity",function=_matter_density,
+          convert_function=_convert_overdensity, units="")
 
-# This is (rho_total - <rho_total>) / <rho_total>.
-def _DensityPerturbation(field, data):
-    rho_bar = rho_crit_now * data.pf.omega_matter * \
-        data.pf.hubble_constant**2 * \
-        (1.0 + data.pf.current_redshift)**3
-    return ((data['Matter_Density'] - rho_bar) / rho_bar)
-add_field("DensityPerturbation",function=_DensityPerturbation,units=r"")
+# This is rho_matter / <rho_matter> - 1.0
+def _overdensity(field, data):
+    omega_m = data.pf.omega_matter
+    h = data.pf.hubble_constant
+    z = data.pf.current_redshift
+    rho_m = rho_crit_now * h**2 * omega_m * (1.0 + z)**3
+    return data["matter_density"] / rho_m - 1.0
 
-# This is rho_b / <rho_b>.
-def _Baryon_Overdensity(field, data):
+add_field("overdensity", function=_overdensity)
+
+# This is rho_baryon / <rho_baryon> - 1.0.
+def _baryon_overdensity(field, data):
+    # @todo: should we provide this field if the dataset doesn't have omega_b?
     if data.pf.has_key('omega_baryon_now'):
         omega_baryon_now = data.pf['omega_baryon_now']
     else:
         omega_baryon_now = 0.0441
-    return data['Density'] / (omega_baryon_now * rho_crit_now * 
-                              (data.pf.hubble_constant**2) * 
-                              ((1+data.pf.current_redshift)**3))
-add_field("Baryon_Overdensity", function=_Baryon_Overdensity, 
-          units=r"")
+
+    return data["density"] / (omega_baryon_now * rho_crit_now *
+                              (data.pf["CosmologyHubbleConstantNow"]**2) *
+                              ((1.0 + data.pf["CosmologyCurrentRedshift"])**3))
+
+add_field("baryon_overdensity", function=_baryon_overdensity)
 
 # Weak lensing convergence.
 # Eqn 4 of Metzler, White, & Loken (2001, ApJ, 547, 560).
@@ -450,110 +453,110 @@
     # lens to source
     DLS = data.pf.parameters['cosmology_calculator'].AngularDiameterDistance(
         data.pf.current_redshift, data.pf.parameters['lensing_source_redshift'])
-    return (((DL * DLS) / DS) * (1.5e14 * data.pf.omega_matter * 
+    return (((DL * DLS) / DS) * (1.5e14 * data.pf.omega_matter *
                                 (data.pf.hubble_constant / speed_of_light_cgs)**2 *
                                 (1 + data.pf.current_redshift)))
-add_field("WeakLensingConvergence", function=_DensityPerturbation, 
-          convert_function=_convertConvergence, 
+add_field("WeakLensingConvergence", function=_overdensity,
+          convert_function=_convertConvergence,
           projection_conversion='mpccm')
 
-def _CellVolume(field, data):
-    if data['dx'].size == 1:
+def _cell_volume(field, data):
+    if data["dx"].size == 1:
         try:
-            return data['dx'] * data['dy'] * data['dz'] * \
-                np.ones(data.ActiveDimensions, dtype='float64')
+            return ( data["dx"] * data["dy"] * data["dx"]
+                     * np.ones(data.ActiveDimensions, dtype=np.float64) )
         except AttributeError:
-            return data['dx'] * data['dy'] * data['dz']
+            return data["dx"] * data["dy"] * data["dx"]
     return data["dx"] * data["dy"] * data["dz"]
-def _ConvertCellVolumeMpc(data):
-    return data.convert("mpc")**3.0
-def _ConvertCellVolumeCGS(data):
-    return data.convert("cm")**3.0
-add_field("CellVolumeCode", units=r"\rm{BoxVolume}^3",
-          function=_CellVolume)
-add_field("CellVolumeMpc", units=r"\rm{Mpc}^3",
-          function=_CellVolume,
-          convert_function=_ConvertCellVolumeMpc)
-add_field("CellVolume", units=r"\rm{cm}^3",
-          function=_CellVolume,
-          convert_function=_ConvertCellVolumeCGS)
 
-def _ChandraEmissivity(field, data):
-    logT0 = np.log10(data["Temperature"]) - 7
-    return ((data["NumberDensity"].astype('float64')**2.0) \
-            *(10**(-0.0103*logT0**8 \
-                   +0.0417*logT0**7 \
-                   -0.0636*logT0**6 \
-                   +0.1149*logT0**5 \
-                   -0.3151*logT0**4 \
-                   +0.6655*logT0**3 \
-                   -1.1256*logT0**2 \
-                   +1.0026*logT0**1 \
-                   -0.6984*logT0) \
-              +data["Metallicity"]*10**(0.0305*logT0**11 \
-                                        -0.0045*logT0**10 \
-                                        -0.3620*logT0**9 \
-                                        +0.0513*logT0**8 \
-                                        +1.6669*logT0**7 \
-                                        -0.3854*logT0**6 \
-                                        -3.3604*logT0**5 \
-                                        +0.4728*logT0**4 \
-                                        +4.5774*logT0**3 \
-                                        -2.3661*logT0**2 \
-                                        -1.6667*logT0**1 \
-                                        -0.2193*logT0)))
-def _convertChandraEmissivity(data):
-    return 1.0 #1.0e-23*0.76**2
-add_field("ChandraEmissivity", function=_ChandraEmissivity,
-          convert_function=_convertChandraEmissivity,
+add_field("cell_volume", units="cm**3", function=_cell_volume)
+
+def _chandra_emissivity(field, data):
+    logT0 = np.log10(data["temperature"]) - 7
+    return ( data["number_density"].astype(np.float64)**2
+             * ( 10**(-0.0103 * logT0**8
+                      +0.0417 * logT0**7
+                      -0.0636 * logT0**6
+                      +0.1149 * logT0**5
+                      -0.3151 * logT0**4
+                      +0.6655 * logT0**3
+                      -1.1256 * logT0**2
+                      +1.0026 * logT0**1
+                      -0.6984 * logT0)
+                 + data["metallicity"] * 10**(0.0305 * logT0**11
+                                              -0.0045 * logT0**10
+                                              -0.3620 * logT0**9
+                                              +0.0513 * logT0**8
+                                              +1.6669 * logT0**7
+                                              -0.3854 * logT0**6
+                                              -3.3604 * logT0**5
+                                              +0.4728 * logT0**4
+                                              +4.5774 * logT0**3
+                                              -2.3661 * logT0**2
+                                              -1.6667 * logT0**1
+                                              -0.2193 * logT0) ) )
+
+def _convert_chandra_emissivity(data):
+    return 1.0  # 1.0e-23*0.76**2
+
+add_field("chandra_emissivity", function=_chandra_emissivity,
+          convert_function=_convert_chandra_emissivity,
           projection_conversion="1")
 
-def _XRayEmissivity(field, data):
-    return ((data["Density"].astype('float64')**2.0) \
-            *data["Temperature"]**0.5)
-def _convertXRayEmissivity(data):
+def _xray_emissivity(field, data):
+    return ( data["density"].astype(np.float64)**2
+             * data["temperature"]**0.5 )
+
+def _convert_xray_emissivity(data):
     return 2.168e60
-add_field("XRayEmissivity", function=_XRayEmissivity,
-          convert_function=_convertXRayEmissivity,
+
+add_field("xray_emissivity", function=_xray_emissivity,
+          convert_function=_convert_xray_emissivity,
           projection_conversion="1")
 
-def _SZKinetic(field, data):
-    vel_axis = data.get_field_parameter('axis')
+def _sz_kinetic(field, data):
+    vel_axis = data.get_field_parameter("axis")
     if vel_axis > 2:
-        raise NeedsParameter(['axis'])
-    vel = data["%s-velocity" % ({0:'x',1:'y',2:'z'}[vel_axis])]
-    return (vel*data["Density"])
-def _convertSZKinetic(data):
-    return 0.88*((sigma_thompson/mh)/clight)
-add_field("SZKinetic", function=_SZKinetic,
-          convert_function=_convertSZKinetic,
-          validators=[ValidateParameter('axis')])
+        raise NeedsParameter(["axis"])
+    vel = data["velocity_%s" % ({0: "x", 1: "y", 2: "z"}[vel_axis])]
+    return (vel * data["density"])
 
-def _SZY(field, data):
-    return (data["Density"]*data["Temperature"])
-def _convertSZY(data):
-    conv = (0.88/mh) * (kboltz)/(me * clight*clight) * sigma_thompson
+def _convert_sz_kinetic(data):
+    return 0.88 * sigma_thompson / mh / clight
+
+add_field("sz_kinetic", function=_sz_kinetic,
+          convert_function=_convert_sz_kinetic,
+          validators=[ValidateParameter("axis")])
+
+def _szy(field, data):
+    return data["density"] * data["temperature"]
+
+def _convert_szy(data):
+    conv = 0.88 / mh * kboltz / (me * clight*clight) * sigma_thompson
     return conv
-add_field("SZY", function=_SZY, convert_function=_convertSZY)
 
-def _AveragedDensity(field, data):
-    nx, ny, nz = data["Density"].shape
-    new_field = np.zeros((nx-2,ny-2,nz-2), dtype='float64')
-    weight_field = np.zeros((nx-2,ny-2,nz-2), dtype='float64')
-    i_i, j_i, k_i = np.mgrid[0:3,0:3,0:3]
-    for i,j,k in zip(i_i.ravel(),j_i.ravel(),k_i.ravel()):
-        sl = [slice(i,nx-(2-i)),slice(j,ny-(2-j)),slice(k,nz-(2-k))]
-        new_field += data["Density"][sl] * data["CellMass"][sl]
-        weight_field += data["CellMass"][sl]
+add_field("szy", function=_szy, convert_function=_convert_szy)
+
+def _averaged_density(field, data):
+    nx, ny, nz = data["density"].shape
+    new_field = np.zeros((nx-2, ny-2, nz-2), dtype=np.float64)
+    weight_field = np.zeros((nx-2, ny-2, nz-2), dtype=np.float64)
+    i_i, j_i, k_i = np.mgrid[0:3, 0:3, 0:3]
+
+    for i, j, k in zip(i_i.ravel(), j_i.ravel(), k_i.ravel()):
+        sl = [slice(i, nx-(2-i)), slice(j, ny-(2-j)), slice(k, nz-(2-k))]
+        new_field += data["density"][sl] * data["cell_mass"][sl]
+        weight_field += data["cell_mass"][sl]
+
     # Now some fancy footwork
-    new_field2 = np.zeros((nx,ny,nz))
-    new_field2[1:-1,1:-1,1:-1] = new_field/weight_field
+    new_field2 = np.zeros((nx, ny, nz))
+    new_field2[1:-1, 1:-1, 1:-1] = new_field / weight_field
     return new_field2
-add_field("AveragedDensity",
-          function=_AveragedDensity,
-          validators=[ValidateSpatial(1, ["Density"])])
 
-def _DivV(field, data):
+add_field("averaged_density", function=_averaged_density,
+          validators=[ValidateSpatial(1, ["density"])])
+
+def _div_v(field, data):
     # We need to set up stencils
     if data.pf["HydroMethod"] == 2:
         sl_left = slice(None,-2,None)
@@ -563,81 +566,82 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    ds = div_fac * data['dx'].flat[0]
+    ds = div_fac * data["dx"].flat[0]
     f  = data["x-velocity"][sl_right,1:-1,1:-1]/ds
     f -= data["x-velocity"][sl_left ,1:-1,1:-1]/ds
     if data.pf.dimensionality > 1:
-        ds = div_fac * data['dy'].flat[0]
+        ds = div_fac * data["dy"].flat[0]
         f += data["y-velocity"][1:-1,sl_right,1:-1]/ds
         f -= data["y-velocity"][1:-1,sl_left ,1:-1]/ds
     if data.pf.dimensionality > 2:
-        ds = div_fac * data['dz'].flat[0]
+        ds = div_fac * data["dz"].flat[0]
         f += data["z-velocity"][1:-1,1:-1,sl_right]/ds
         f -= data["z-velocity"][1:-1,1:-1,sl_left ]/ds
-    new_field = np.zeros(data["x-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["x-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = f
     return new_field
-def _convertDivV(data):
+
+def _convert_div_v(data):
     return data.convert("cm")**-1.0
-add_field("DivV", function=_DivV,
-            validators=[ValidateSpatial(1,
-            ["x-velocity","y-velocity","z-velocity"])],
-          units=r"\rm{s}^{-1}", take_log=False,
-          convert_function=_convertDivV)
 
-def _AbsDivV(field, data):
-    return np.abs(data['DivV'])
-add_field("AbsDivV", function=_AbsDivV,
-          units=r"\rm{s}^{-1}")
+add_field("div_v", function=_div_v,
+          validators=[ValidateSpatial(1, ["velocity_x", "velocity_y",
+                                          "velocity_z"])],
+          units="1/s", take_log=False, convert_function=_convert_div_v)
 
-def _Contours(field, data):
-    return -np.ones_like(data["Ones"])
-add_field("Contours", validators=[ValidateSpatial(0)], take_log=False,
-          display_field=False, function=_Contours)
-add_field("tempContours", function=_Contours,
+def _absolute_div_v(field, data):
+    return np.abs(data["div_v"])
+
+add_field("absolute_div_v", function=_absolute_div_v, units="1/s")
+
+def _contours(field, data):
+    return -np.ones_like(data["ones"])
+
+add_field("contours", validators=[ValidateSpatial(0)], take_log=False,
+          display_field=False, function=_contours)
+add_field("temp_contours", function=_contours,
           validators=[ValidateSpatial(0), ValidateGridType()],
           take_log=False, display_field=False)
 
 def obtain_velocities(data):
     return obtain_rv_vec(data)
 
-def _convertSpecificAngularMomentum(data):
-    return data.convert("cm")
-def _convertSpecificAngularMomentumKMSMPC(data):
-    return data.convert("mpc")/1e5
-
-def _SpecificAngularMomentumX(field, data):
+def _specific_angular_momentum_x(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return yv*rv[2,:] - zv*rv[1,:]
-def _SpecificAngularMomentumY(field, data):
+    return yv * rv[2, :] - zv * rv[1, :]
+
+def _specific_angular_momentum_y(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return -(xv*rv[2,:] - zv*rv[0,:])
-def _SpecificAngularMomentumZ(field, data):
+    return - (xv * rv[2, :] - zv * rv[0, :])
+
+def _specific_angular_momentum_z(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return xv*rv[1,:] - yv*rv[0,:]
-for ax in 'XYZ':
-    n = "SpecificAngularMomentum%s" % ax
-    add_field(n, function=eval("_%s" % n),
-              convert_function=_convertSpecificAngularMomentum,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+    return xv * rv[1, :] - yv * rv[0, :]
 
-def _AngularMomentumX(field, data):
+add_field("specific_angular_momentum_x", function=_specific_angular_momentum_x,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+add_field("specific_angular_momentum_y", function=_specific_angular_momentum_y,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+add_field("specific_angular_momentum_z", function=_specific_angular_momentum_z,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+
+def _angular_momentum_x(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumX"]
-add_field("AngularMomentumX", function=_AngularMomentumX,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumX", function=_angular_momentum_x,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
-def _AngularMomentumY(field, data):
+def _angular_momentum_y(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumY"]
-add_field("AngularMomentumY", function=_AngularMomentumY,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumY", function=_angular_momentum_y,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
-def _AngularMomentumZ(field, data):
+def _angular_momentum_z(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumZ"]
-add_field("AngularMomentumZ", function=_AngularMomentumZ,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumZ", function=_angular_momentum_z,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
 
 def _ParticleSpecificAngularMomentum(field, data):
@@ -647,17 +651,17 @@
     """
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     xv = data["particle_velocity_x"] - bv[0]
     yv = data["particle_velocity_y"] - bv[1]
     zv = data["particle_velocity_z"] - bv[2]
     center = data.get_field_parameter('center')
     coords = np.array([data['particle_position_x'],
                        data['particle_position_y'],
-                       data['particle_position_z']], dtype='float64')
+                       data['particle_position_z']], dtype=np.float64)
     new_shape = tuple([3] + [1]*(len(coords.shape)-1))
     r_vec = coords - np.reshape(center,new_shape)
-    v_vec = np.array([xv,yv,zv], dtype='float64')
+    v_vec = np.array([xv,yv,zv], dtype=np.float64)
     return np.cross(r_vec, v_vec, axis=0)
 #add_field("ParticleSpecificAngularMomentum",
 #          function=_ParticleSpecificAngularMomentum, particle_type=True,
@@ -673,7 +677,7 @@
 def _ParticleSpecificAngularMomentumX(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     y = data["particle_position_y"] - center[1]
     z = data["particle_position_z"] - center[2]
@@ -683,7 +687,7 @@
 def _ParticleSpecificAngularMomentumY(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     x = data["particle_position_x"] - center[0]
     z = data["particle_position_z"] - center[2]
@@ -693,7 +697,7 @@
 def _ParticleSpecificAngularMomentumZ(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     x = data["particle_position_x"] - center[0]
     y = data["particle_position_y"] - center[1]
@@ -703,11 +707,10 @@
 for ax in 'XYZ':
     n = "ParticleSpecificAngularMomentum%s" % ax
     add_field(n, function=eval("_%s" % n), particle_type=True,
-              convert_function=_convertSpecificAngularMomentum,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+              units="cm**2/s", validators=[ValidateParameter("center")])
     add_field(n + "KMSMPC", function=eval("_%s" % n), particle_type=True,
               convert_function=_convertSpecificAngularMomentumKMSMPC,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+              units="cm**2/s", validators=[ValidateParameter("center")])
 
 def _ParticleAngularMomentum(field, data):
     return data["ParticleMass"] * data["ParticleSpecificAngularMomentum"]
@@ -724,17 +727,17 @@
 def _ParticleAngularMomentumX(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumX"]
 add_field("ParticleAngularMomentumX", function=_ParticleAngularMomentumX,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 def _ParticleAngularMomentumY(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumY"]
 add_field("ParticleAngularMomentumY", function=_ParticleAngularMomentumY,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 def _ParticleAngularMomentumZ(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumZ"]
 add_field("ParticleAngularMomentumZ", function=_ParticleAngularMomentumZ,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 
 def get_radius(positions, data):
@@ -758,22 +761,22 @@
     return data.convert("cm")
 add_field("ParticleRadius", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusCGS, units=r"\rm{cm}",
+          convert_function = _ConvertRadiusCGS, units="cm",
           particle_type = True,
           display_name = "Particle Radius")
 add_field("Radius", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusCGS, units=r"\rm{cm}")
+          convert_function = _ConvertRadiusCGS, units="cm")
 
 def _ConvertRadiusMpc(data):
     return data.convert("mpc")
 add_field("RadiusMpc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusMpc, units=r"\rm{Mpc}",
+          convert_function = _ConvertRadiusMpc, units="Mpc",
           display_name = "Radius")
 add_field("ParticleRadiusMpc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusMpc, units=r"\rm{Mpc}",
+          convert_function = _ConvertRadiusMpc, units="Mpc",
           particle_type=True,
           display_name = "Particle Radius")
 
@@ -781,48 +784,48 @@
     return data.convert("kpc")
 add_field("ParticleRadiuskpc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}",
+          convert_function = _ConvertRadiuskpc, units="kpc",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuskpc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}",
+          convert_function = _ConvertRadiuskpc, units="kpc",
           display_name = "Radius")
 
 def _ConvertRadiuskpch(data):
     return data.convert("kpch")
 add_field("ParticleRadiuskpch", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpch, units=r"\rm{kpc}/\rm{h}",
+          convert_function = _ConvertRadiuskpch, units="kpc/h",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuskpch", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}/\rm{h}",
+          convert_function = _ConvertRadiuskpc, units="kpc/h",
           display_name = "Radius")
 
 def _ConvertRadiuspc(data):
     return data.convert("pc")
 add_field("ParticleRadiuspc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuspc, units=r"\rm{pc}",
+          convert_function = _ConvertRadiuspc, units="pc",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuspc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuspc, units=r"\rm{pc}",
+          convert_function = _ConvertRadiuspc, units="pc",
           display_name="Radius")
 
 def _ConvertRadiusAU(data):
     return data.convert("au")
 add_field("ParticleRadiusAU", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusAU, units=r"\rm{AU}",
+          convert_function = _ConvertRadiusAU, units="AU",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("RadiusAU", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusAU, units=r"\rm{AU}",
+          convert_function = _ConvertRadiusAU, units="AU",
           display_name = "Radius")
 
 add_field("ParticleRadiusCode", function=_ParticleRadius,
@@ -835,9 +838,9 @@
 
 def _RadialVelocity(field, data):
     normal = data.get_field_parameter("normal")
-    velocities = obtain_rv_vec(data)    
-    theta = data['sph_theta']
-    phi   = data['sph_phi']
+    velocities = obtain_rv_vec(data).transpose()
+    theta = np.tile(data['sph_theta'], (3, 1)).transpose()
+    phi   = np.tile(data['sph_phi'], (3, 1)).transpose()
 
     return get_sph_r_component(velocities, theta, phi, normal)
 
@@ -846,20 +849,20 @@
 def _ConvertRadialVelocityKMS(data):
     return km_per_cm
 add_field("RadialVelocity", function=_RadialVelocity,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 add_field("RadialVelocityABS", function=_RadialVelocityABS,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 add_field("RadialVelocityKMS", function=_RadialVelocity,
-          convert_function=_ConvertRadialVelocityKMS, units=r"\rm{km}/\rm{s}")
+          convert_function=_ConvertRadialVelocityKMS, units="km/s")
 add_field("RadialVelocityKMSABS", function=_RadialVelocityABS,
-          convert_function=_ConvertRadialVelocityKMS, units=r"\rm{km}/\rm{s}")
+          convert_function=_ConvertRadialVelocityKMS, units="km/s")
 
 def _TangentialVelocity(field, data):
     return np.sqrt(data["VelocityMagnitude"]**2.0
                  - data["RadialVelocity"]**2.0)
-add_field("TangentialVelocity", 
+add_field("TangentialVelocity",
           function=_TangentialVelocity,
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+          take_log=False, units="cm/s")
 
 def _CuttingPlaneVelocityX(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
@@ -870,10 +873,10 @@
     v_vec = np.array([data["%s-velocity" % ax] for ax in 'xyz']) \
                 - bulk_velocity[...,np.newaxis]
     return np.dot(x_vec, v_vec)
-add_field("CuttingPlaneVelocityX", 
+add_field("CuttingPlaneVelocityX",
           function=_CuttingPlaneVelocityX,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{km}/\rm{s}")
+                      for ax in 'xyz'], units="km/s")
 def _CuttingPlaneVelocityY(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
@@ -883,29 +886,29 @@
     v_vec = np.array([data["%s-velocity" % ax] for ax in 'xyz']) \
                 - bulk_velocity[...,np.newaxis]
     return np.dot(y_vec, v_vec)
-add_field("CuttingPlaneVelocityY", 
+add_field("CuttingPlaneVelocityY",
           function=_CuttingPlaneVelocityY,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{km}/\rm{s}")
+                      for ax in 'xyz'], units="km/s")
 
 def _CuttingPlaneBx(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
     b_vec = np.array([data["B%s" % ax] for ax in 'xyz'])
     return np.dot(x_vec, b_vec)
-add_field("CuttingPlaneBx", 
+add_field("CuttingPlaneBx",
           function=_CuttingPlaneBx,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{Gauss}")
+                      for ax in 'xyz'], units="gauss")
 def _CuttingPlaneBy(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
     b_vec = np.array([data["B%s" % ax] for ax in 'xyz'])
     return np.dot(y_vec, b_vec)
-add_field("CuttingPlaneBy", 
+add_field("CuttingPlaneBy",
           function=_CuttingPlaneBy,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{Gauss}")
+                      for ax in 'xyz'], units="gauss")
 
 def _MeanMolecularWeight(field,data):
     return (data["Density"] / (mh *data["NumberDensity"]))
@@ -919,7 +922,7 @@
             ((data["Temperature"]/data["MeanMolecularWeight"])**(1.5)) *
             (data["Density"]**(-0.5)))
 add_field("JeansMassMsun",function=_JeansMassMsun,
-          units=r"\rm{M_{\odot}}")
+          units="Msun")
 
 def _convertDensity(data):
     return data.convert("Density")
@@ -946,7 +949,7 @@
     """
     return (data["Bx"]**2 + data["By"]**2 + data["Bz"]**2)/(8*np.pi)
 add_field("MagneticEnergy",function=_MagneticEnergy,
-          units=r"\rm{ergs}\/\rm{cm}^{-3}",
+          units="erg / cm**3",
           display_name=r"\rm{Magnetic}\/\rm{Energy}")
 
 def _BMagnitude(field,data):
@@ -957,7 +960,7 @@
     return np.sqrt((data["Bx"]**2 + data["By"]**2 + data["Bz"]**2))
 add_field("BMagnitude",
           function=_BMagnitude,
-          display_name=r"|B|", units=r"\rm{Gauss}")
+          display_name=r"|B|", units="gauss")
 
 def _PlasmaBeta(field,data):
     """This assumes that your front end has provided Bx, By, Bz in
@@ -974,7 +977,7 @@
 add_field("MagneticPressure",
           function=_MagneticPressure,
           display_name=r"\rm{Magnetic}\/\rm{Energy}",
-          units="\rm{ergs}\/\rm{cm}^{-3}")
+          units="erg / cm**3")
 
 def _BPoloidal(field,data):
     normal = data.get_field_parameter("normal")
@@ -987,7 +990,7 @@
     return get_sph_theta_component(Bfields, theta, phi, normal)
 
 add_field("BPoloidal", function=_BPoloidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _BToroidal(field,data):
@@ -1000,7 +1003,7 @@
     return get_sph_phi_component(Bfields, phi, normal)
 
 add_field("BToroidal", function=_BToroidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _BRadial(field,data):
@@ -1014,7 +1017,7 @@
     return get_sph_r_component(Bfields, theta, phi, normal)
 
 add_field("BRadial", function=_BPoloidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _VorticitySquared(field, data):
@@ -1060,7 +1063,7 @@
 add_field("VorticitySquared", function=_VorticitySquared,
           validators=[ValidateSpatial(1,
               ["x-velocity","y-velocity","z-velocity"])],
-          units=r"\rm{s}^{-2}",
+          units="s**-2",
           convert_function=_convertVorticitySquared)
 
 def _gradPressureX(field, data):
@@ -1073,7 +1076,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dx'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][sl_right,1:-1,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][sl_left ,1:-1,1:-1]/ds
@@ -1088,7 +1091,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dy'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][1:-1,sl_right,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][1:-1,sl_left ,1:-1]/ds
@@ -1103,7 +1106,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dz'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][1:-1,1:-1,sl_right]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][1:-1,1:-1,sl_left ]/ds
@@ -1115,7 +1118,7 @@
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertgradPressure,
               validators=[ValidateSpatial(1, ["Pressure"])],
-              units=r"\rm{dyne}/\rm{cm}^{3}")
+              units="dyne/cm**3")
 
 def _gradPressureMagnitude(field, data):
     return np.sqrt(data["gradPressureX"]**2 +
@@ -1123,7 +1126,7 @@
                    data["gradPressureZ"]**2)
 add_field("gradPressureMagnitude", function=_gradPressureMagnitude,
           validators=[ValidateSpatial(1, ["Pressure"])],
-          units=r"\rm{dyne}/\rm{cm}^{3}")
+          units="dyne/cm**3")
 
 def _gradDensityX(field, data):
     # We need to set up stencils
@@ -1135,7 +1138,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dx'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][sl_right,1:-1,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][sl_left ,1:-1,1:-1]/ds
@@ -1150,7 +1153,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dy'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][1:-1,sl_right,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][1:-1,sl_left ,1:-1]/ds
@@ -1165,7 +1168,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dz'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][1:-1,1:-1,sl_right]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][1:-1,1:-1,sl_left ]/ds
@@ -1177,7 +1180,7 @@
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertgradDensity,
               validators=[ValidateSpatial(1, ["Density"])],
-              units=r"\rm{g}/\rm{cm}^{4}")
+              units="g/cm**4")
 
 def _gradDensityMagnitude(field, data):
     return np.sqrt(data["gradDensityX"]**2 +
@@ -1185,25 +1188,25 @@
                    data["gradDensityZ"]**2)
 add_field("gradDensityMagnitude", function=_gradDensityMagnitude,
           validators=[ValidateSpatial(1, ["Density"])],
-          units=r"\rm{g}/\rm{cm}^{4}")
+          units="g/cm**4")
 
 def _BaroclinicVorticityX(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureY"] * data["gradDensityZ"] -
             data["gradPressureZ"] * data["gradDensityY"]) / rho2
 def _BaroclinicVorticityY(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureZ"] * data["gradDensityX"] -
             data["gradPressureX"] * data["gradDensityZ"]) / rho2
 def _BaroclinicVorticityZ(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureX"] * data["gradDensityY"] -
             data["gradPressureY"] * data["gradDensityX"]) / rho2
 for ax in 'XYZ':
     n = "BaroclinicVorticity%s" % ax
     add_field(n, function=eval("_%s" % n),
           validators=[ValidateSpatial(1, ["Density", "Pressure"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _BaroclinicVorticityMagnitude(field, data):
     return np.sqrt(data["BaroclinicVorticityX"]**2 +
@@ -1212,7 +1215,7 @@
 add_field("BaroclinicVorticityMagnitude",
           function=_BaroclinicVorticityMagnitude,
           validators=[ValidateSpatial(1, ["Density", "Pressure"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityX(field, data):
     # We need to set up stencils
@@ -1224,7 +1227,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["z-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["z-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["z-velocity"][1:-1,sl_right,1:-1] -
                                  data["z-velocity"][1:-1,sl_left,1:-1]) \
                                  / (div_fac*data["dy"].flat[0])
@@ -1242,7 +1245,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["z-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["z-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["x-velocity"][1:-1,1:-1,sl_right] -
                                  data["x-velocity"][1:-1,1:-1,sl_left]) \
                                  / (div_fac*data["dz"].flat[0])
@@ -1260,7 +1263,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["x-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["x-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["y-velocity"][sl_right,1:-1,1:-1] -
                                  data["y-velocity"][sl_left,1:-1,1:-1]) \
                                  / (div_fac*data["dx"].flat[0])
@@ -1274,18 +1277,18 @@
     n = "Vorticity%s" % ax
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertVorticity,
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                           ["x-velocity", "y-velocity", "z-velocity"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 
 def _VorticityMagnitude(field, data):
     return np.sqrt(data["VorticityX"]**2 +
                    data["VorticityY"]**2 +
                    data["VorticityZ"]**2)
 add_field("VorticityMagnitude", function=_VorticityMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityStretchingX(field, data):
     return data["DivV"] * data["VorticityX"]
@@ -1301,11 +1304,11 @@
     return np.sqrt(data["VorticityStretchingX"]**2 +
                    data["VorticityStretchingY"]**2 +
                    data["VorticityStretchingZ"]**2)
-add_field("VorticityStretchingMagnitude", 
+add_field("VorticityStretchingMagnitude",
           function=_VorticityStretchingMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityGrowthX(field, data):
     return -data["VorticityStretchingX"] - data["BaroclinicVorticityX"]
@@ -1316,9 +1319,9 @@
 for ax in 'XYZ':
     n = "VorticityGrowth%s" % ax
     add_field(n, function=eval("_%s" % n),
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                           ["x-velocity", "y-velocity", "z-velocity"])],
-              units=r"\rm{s}^{-2}")
+              units="1/s")
 def _VorticityGrowthMagnitude(field, data):
     result = np.sqrt(data["VorticityGrowthX"]**2 +
                      data["VorticityGrowthY"]**2 +
@@ -1329,18 +1332,18 @@
     result = np.sign(dot) * result
     return result
 add_field("VorticityGrowthMagnitude", function=_VorticityGrowthMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}",
+          units="1/s",
           take_log=False)
 def _VorticityGrowthMagnitudeABS(field, data):
     return np.sqrt(data["VorticityGrowthX"]**2 +
                    data["VorticityGrowthY"]**2 +
                    data["VorticityGrowthZ"]**2)
 add_field("VorticityGrowthMagnitudeABS", function=_VorticityGrowthMagnitudeABS,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityGrowthTimescale(field, data):
     domegax_dt = data["VorticityX"] / data["VorticityGrowthX"]
@@ -1348,24 +1351,24 @@
     domegaz_dt = data["VorticityZ"] / data["VorticityGrowthZ"]
     return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt)
 add_field("VorticityGrowthTimescale", function=_VorticityGrowthTimescale,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}")
+          units="s")
 
 ########################################################################
 # With radiation pressure
 ########################################################################
 
 def _VorticityRadPressureX(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel2"] * data["gradDensityZ"] -
             data["RadAccel3"] * data["gradDensityY"]) / rho
 def _VorticityRadPressureY(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel3"] * data["gradDensityX"] -
             data["RadAccel1"] * data["gradDensityZ"]) / rho
 def _VorticityRadPressureZ(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel1"] * data["gradDensityY"] -
             data["RadAccel2"] * data["gradDensityX"]) / rho
 def _convertRadAccel(data):
@@ -1374,9 +1377,9 @@
     n = "VorticityRadPressure%s" % ax
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertRadAccel,
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                    ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 
 def _VorticityRadPressureMagnitude(field, data):
     return np.sqrt(data["VorticityRadPressureX"]**2 +
@@ -1384,9 +1387,9 @@
                    data["VorticityRadPressureZ"]**2)
 add_field("VorticityRadPressureMagnitude",
           function=_VorticityRadPressureMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityRPGrowthX(field, data):
     return -data["VorticityStretchingX"] - data["BaroclinicVorticityX"] \
@@ -1400,9 +1403,9 @@
 for ax in 'XYZ':
     n = "VorticityRPGrowth%s" % ax
     add_field(n, function=eval("_%s" % n),
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                        ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 def _VorticityRPGrowthMagnitude(field, data):
     result = np.sqrt(data["VorticityRPGrowthX"]**2 +
                      data["VorticityRPGrowthY"]**2 +
@@ -1413,19 +1416,19 @@
     result = np.sign(dot) * result
     return result
 add_field("VorticityRPGrowthMagnitude", function=_VorticityGrowthMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}",
+          units="1/s",
           take_log=False)
 def _VorticityRPGrowthMagnitudeABS(field, data):
     return np.sqrt(data["VorticityRPGrowthX"]**2 +
                    data["VorticityRPGrowthY"]**2 +
                    data["VorticityRPGrowthZ"]**2)
-add_field("VorticityRPGrowthMagnitudeABS", 
+add_field("VorticityRPGrowthMagnitudeABS",
           function=_VorticityRPGrowthMagnitudeABS,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityRPGrowthTimescale(field, data):
     domegax_dt = data["VorticityX"] / data["VorticityRPGrowthX"]
@@ -1433,6 +1436,6 @@
     domegaz_dt = data["VorticityZ"] / data["VorticityRPGrowthZ"]
     return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt**2)
 add_field("VorticityRPGrowthTimescale", function=_VorticityRPGrowthTimescale,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")

diff -r 6658890fa0fa5ee183ddc20d0098f151f0d531f8 -r 107f60b9717eff4cfafb1f97587ea29621af894e yt/data_objects/yt_array.py
--- /dev/null
+++ b/yt/data_objects/yt_array.py
@@ -0,0 +1,61 @@
+"""
+YTArray class
+
+Authors: Casey W. Stark <caseywstark at gmail.com>
+Affiliation: UC Berkeley
+
+Homepage: http://yt-project.org/
+License:
+    Copyright (C) 2013 Casey W. Stark.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+
+import numpy as np
+
+from yt.utilities.units import Unit
+
+class UnitArray(np.ndarray):
+    """
+
+    """
+    def __new__(cls, input_array, units=None):
+        # Input array is an already formed ndarray instance
+        # We first cast to be our class type
+        obj = np.asarray(input_array).view(cls)
+
+        # Check units type
+        if units is None:
+            units = Unit()
+        if not isinstance(units, Unit):
+            units = Unit(units)
+
+        # Attach the units
+        obj.units = units
+
+        return obj
+
+    def __array_finalize__(self, obj):
+        # see InfoArray.__array_finalize__ for comments
+        if obj is None: return
+        self.units = getattr(obj, 'units', None)
+
+    def convert_to(self, new_units):
+        """
+
+        """
+        cf = self.units.get_conversion_factor(new_units)

diff -r 6658890fa0fa5ee183ddc20d0098f151f0d531f8 -r 107f60b9717eff4cfafb1f97587ea29621af894e yt/geometry/geometry_handler.py
--- a/yt/geometry/geometry_handler.py
+++ b/yt/geometry/geometry_handler.py
@@ -1,4 +1,4 @@
-""" 
+"""
 Geometry container base class.
 
 Author: Matthew Turk <matthewturk at gmail.com>
@@ -132,8 +132,8 @@
                 # will allow the same field detection mechanism to work for 1D, 2D
                 # and 3D fields.
                 self.pf.field_info.add_field(
-                        field, NullFunc, particle_type = particle_type,
-                        convert_function=cf, take_log=False, units=r"Unknown")
+                        field, NullFunc, particle_type=particle_type,
+                        convert_function=cf, take_log=False)
             else:
                 mylog.debug("Adding known field %s to list of fields", field)
                 self.parameter_file.field_info[field] = known_fields[field]

diff -r 6658890fa0fa5ee183ddc20d0098f151f0d531f8 -r 107f60b9717eff4cfafb1f97587ea29621af894e yt/utilities/tests/test_units.py
--- a/yt/utilities/tests/test_units.py
+++ b/yt/utilities/tests/test_units.py
@@ -70,6 +70,13 @@
     assert u1.cgs_value == 1
     assert u1.dimensions == 1
 
+    u2 = Unit("")
+
+    assert u2.is_dimensionless
+    assert u2.expr == 1
+    assert u2.cgs_value == 1
+    assert u2.dimensions == 1
+
 #
 # Start init tests
 #

diff -r 6658890fa0fa5ee183ddc20d0098f151f0d531f8 -r 107f60b9717eff4cfafb1f97587ea29621af894e yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -74,6 +74,9 @@
     "J": (1.0e7, energy),
     "Hz": (1.0, rate),
 
+    # dimensionless
+    "h": (1.0, 1.0),
+
     # times
     "min": (60.0, time),
     "hr":  (3600.0, time),
@@ -163,6 +166,10 @@
         """
         # if we have a string, parse into an expression
         if isinstance(unit_expr, str):
+            if not unit_expr:
+                # Bug catch...
+                # if unit_expr is an empty string, parse_expr fails hard...
+                unit_expr = "1"
             unit_expr = parse_expr(unit_expr)
 
         if not isinstance(unit_expr, Expr):
@@ -289,6 +296,9 @@
              self.dimensions.expand().as_coeff_exponent(temperature)[1])
         return Unit(cgs_units_string, 1, self.dimensions)
 
+    def get_conversion_factor(self, other_units):
+        return get_conversion_factor(self, other_units)
+
 
 def make_symbols_positive(expr):
     """


https://bitbucket.org/yt_analysis/yt/commits/0dd19a20a480/
Changeset:   0dd19a20a480
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-07 01:07:34
Summary:     Fixing gdf and ramses units
Affected #:  2 files

diff -r 107f60b9717eff4cfafb1f97587ea29621af894e -r 0dd19a20a4809a375051e5e2ff2172df69c56e46 yt/frontends/gdf/fields.py
--- a/yt/frontends/gdf/fields.py
+++ b/yt/frontends/gdf/fields.py
@@ -55,33 +55,31 @@
 KnownGDFFields = FieldInfoContainer()
 add_gdf_field = KnownGDFFields.add_field
 
-add_gdf_field("density", function=NullFunc, take_log=True,
-          units=r"\rm{g}/\rm{cm}^3",
-          projected_units =r"\rm{g}/\rm{cm}^2")
+add_gdf_field("density", function=NullFunc, take_log=True, units="g/cm**3")
 
 add_gdf_field("specific_energy", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg / g")
 
 add_gdf_field("pressure", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg/g")
 
 add_gdf_field("velocity_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 for f,v in log_translation_dict.items():
     add_field(f, TranslationFunc(v), take_log=True)

diff -r 107f60b9717eff4cfafb1f97587ea29621af894e -r 0dd19a20a4809a375051e5e2ff2172df69c56e46 yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -69,15 +69,14 @@
 
 def _convertDensity(data):
     return data.convert("Density")
-KnownRAMSESFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
-KnownRAMSESFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownRAMSESFields["Density"]._units = "g / cm**3"
 KnownRAMSESFields["Density"]._convert_function=_convertDensity
 
 def _convertVelocity(data):
     return data.convert("x-velocity")
 for ax in ['x','y','z']:
     f = KnownRAMSESFields["%s-velocity" % ax]
-    f._units = r"\rm{cm}/\rm{s}"
+    f._units = "cm / s"
     f._convert_function = _convertVelocity
     f.take_log = False
 


https://bitbucket.org/yt_analysis/yt/commits/55b4e370c520/
Changeset:   55b4e370c520
Branch:      yt-3.0
User:        alrosen
Date:        2013-03-07 01:15:49
Summary:     Changed units in frontends for: orion/fields.py and sph/fields.py (note there was no neccesary changes for sph).
Affected #:  3 files

diff -r 107f60b9717eff4cfafb1f97587ea29621af894e -r 55b4e370c52040cb78dadf4b6f59b57d9900f4ac yt/frontends/orion/fields.py
--- a/yt/frontends/orion/fields.py
+++ b/yt/frontends/orion/fields.py
@@ -48,24 +48,23 @@
 
 add_orion_field("density", function=NullFunc, take_log=True,
                 validators = [ValidateDataField("density")],
-                units=r"\rm{g}/\rm{cm}^3")
-KnownOrionFields["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+                units="g/cm**3")
 
 add_orion_field("eden", function=NullFunc, take_log=True,
                 validators = [ValidateDataField("eden")],
-                units=r"\rm{erg}/\rm{cm}^3")
+                units="erg/cm**3")
 
 add_orion_field("xmom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("xmom")],
-                units=r"\rm{g}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
 add_orion_field("ymom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("ymom")],
-                units=r"\rm{gm}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
 add_orion_field("zmom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("zmom")],
-                units=r"\rm{g}/\rm{cm^2\ s}")
+                units="g/cm**2/s}")
 
 translation_dict = {"x-velocity": "xvel",
                     "y-velocity": "yvel",
@@ -93,7 +92,7 @@
     """
     return data["xmom"]/data["density"]
 add_orion_field("x-velocity",function=_xVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _yVelocity(field,data):
     """generate y-velocity from y-momentum and density
@@ -104,7 +103,7 @@
     #except KeyError:
     return data["ymom"]/data["density"]
 add_orion_field("y-velocity",function=_yVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _zVelocity(field,data):
     """generate z-velocity from z-momentum and density
@@ -112,7 +111,7 @@
     """
     return data["zmom"]/data["density"]
 add_orion_field("z-velocity",function=_zVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _ThermalEnergy(field, data):
     """generate thermal (gas energy). Dual Energy Formalism was
@@ -127,7 +126,7 @@
         + data["y-velocity"]**2.0
         + data["z-velocity"]**2.0 )
 add_field("ThermalEnergy", function=_ThermalEnergy,
-                units=r"\rm{ergs}/\rm{cm^3}")
+                units=r"ergs/cm**3")
 
 def _Pressure(field,data):
     """M{(Gamma-1.0)*e, where e is thermal energy density
@@ -138,7 +137,7 @@
 
 def _Temperature(field,data):
     return (data.pf["Gamma"]-1.0)*data.pf["mu"]*mh*data["ThermalEnergy"]/(kboltz*data["Density"])
-add_field("Temperature",function=_Temperature,units=r"\rm{Kelvin}",take_log=False)
+add_field("Temperature",function=_Temperature,units="K",take_log=False)
 
 # particle fields
 

diff -r 107f60b9717eff4cfafb1f97587ea29621af894e -r 55b4e370c52040cb78dadf4b6f59b57d9900f4ac yt/geometry/setup.py
--- a/yt/geometry/setup.py
+++ b/yt/geometry/setup.py
@@ -16,8 +16,8 @@
                          "yt/geometry/selection_routines.pxd"])
     config.add_extension("selection_routines", 
                 ["yt/geometry/selection_routines.pyx"],
-                extra_compile_args=['-fopenmp'],
-                extra_link_args=['-fopenmp'],
+                #extra_compile_args=['-fopenmp'],
+                #extra_link_args=['-fopenmp'],
                 include_dirs=["yt/utilities/lib/"],
                 libraries=["m"],
                 depends=["yt/utilities/lib/fp_utils.pxd",

diff -r 107f60b9717eff4cfafb1f97587ea29621af894e -r 55b4e370c52040cb78dadf4b6f59b57d9900f4ac yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -129,9 +129,7 @@
                 depends=["yt/utilities/lib/freetype_includes.h"])
     config.add_extension("geometry_utils", 
                 ["yt/utilities/lib/geometry_utils.pyx"],
-               extra_compile_args=['-fopenmp'],
-               extra_link_args=['-fopenmp'],
-                libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
+                 libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
     config.add_extension("Interpolators", 
                 ["yt/utilities/lib/Interpolators.pyx"],
                 libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
@@ -197,8 +195,6 @@
                  glob.glob("yt/utilities/lib/healpix_*.c"), 
                include_dirs=["yt/utilities/lib/"],
                libraries=["m"], 
-               extra_compile_args=['-fopenmp'],
-               extra_link_args=['-fopenmp'],
                depends = ["yt/utilities/lib/VolumeIntegrator.pyx",
                           "yt/utilities/lib/fp_utils.pxd",
                           "yt/utilities/lib/kdtree.h",


https://bitbucket.org/yt_analysis/yt/commits/82fbb89b6561/
Changeset:   82fbb89b6561
Branch:      yt-3.0
User:        alrosen
Date:        2013-03-07 01:19:50
Summary:     Merging branch.
Affected #:  2 files

diff -r 55b4e370c52040cb78dadf4b6f59b57d9900f4ac -r 82fbb89b656110fe9e62fee74e9247ae4988c157 yt/frontends/gdf/fields.py
--- a/yt/frontends/gdf/fields.py
+++ b/yt/frontends/gdf/fields.py
@@ -55,33 +55,31 @@
 KnownGDFFields = FieldInfoContainer()
 add_gdf_field = KnownGDFFields.add_field
 
-add_gdf_field("density", function=NullFunc, take_log=True,
-          units=r"\rm{g}/\rm{cm}^3",
-          projected_units =r"\rm{g}/\rm{cm}^2")
+add_gdf_field("density", function=NullFunc, take_log=True, units="g/cm**3")
 
 add_gdf_field("specific_energy", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg / g")
 
 add_gdf_field("pressure", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg/g")
 
 add_gdf_field("velocity_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 for f,v in log_translation_dict.items():
     add_field(f, TranslationFunc(v), take_log=True)

diff -r 55b4e370c52040cb78dadf4b6f59b57d9900f4ac -r 82fbb89b656110fe9e62fee74e9247ae4988c157 yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -69,15 +69,14 @@
 
 def _convertDensity(data):
     return data.convert("Density")
-KnownRAMSESFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
-KnownRAMSESFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownRAMSESFields["Density"]._units = "g / cm**3"
 KnownRAMSESFields["Density"]._convert_function=_convertDensity
 
 def _convertVelocity(data):
     return data.convert("x-velocity")
 for ax in ['x','y','z']:
     f = KnownRAMSESFields["%s-velocity" % ax]
-    f._units = r"\rm{cm}/\rm{s}"
+    f._units = "cm / s"
     f._convert_function = _convertVelocity
     f.take_log = False
 


https://bitbucket.org/yt_analysis/yt/commits/a0c6c70b232b/
Changeset:   a0c6c70b232b
Branch:      yt-3.0
User:        Andrew Myers
Date:        2013-03-07 01:17:56
Summary:     changing unit argument in the Chombo and Castro frontends
Affected #:  2 files

diff -r 107f60b9717eff4cfafb1f97587ea29621af894e -r a0c6c70b232b7f0fae36aa8fbc83944c4dd12ee0 yt/frontends/castro/fields.py
--- a/yt/frontends/castro/fields.py
+++ b/yt/frontends/castro/fields.py
@@ -59,26 +59,23 @@
 
 # Start adding fields
 add_castro_field("density", function=NullFunc, take_log=True,
-                 units=r"\rm{g}/\rm{cm}^3")
-
-# fix projected units
-KnownCastroFields["density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+                 units="g/cm**3")
 
 add_castro_field("eden", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("eden")],
-                 units=r"\rm{erg}/\rm{cm}^3")
+                 units="erg/cm**3")
 
 add_castro_field("xmom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("xmom")],
-                 units=r"\rm{g}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 add_castro_field("ymom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("ymom")],
-                 units=r"\rm{gm}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 add_castro_field("zmom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("zmom")],
-                 units=r"\rm{g}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 # Now populate derived fields
 for mine, theirs in translation_dict.items():
@@ -92,21 +89,21 @@
     return data["xmom"] / data["density"]
 
 add_field("x-velocity", function=_xVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _yVelocity(field, data):
     """ Generate y-velocity from y-momentum and density. """
     return data["ymom"] / data["density"]
 
 add_field("y-velocity", function=_yVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _zVelocity(field, data):
     """ Generate z-velocity from z-momentum and density. """
     return data["zmom"] / data["density"]
 
 add_field("z-velocity", function=_zVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _ThermalEnergy(field, data):
     """
@@ -124,7 +121,7 @@
         + data["z-velocity"]**2.0 )
 
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units=r"\rm{ergs}/\rm{cm^3}")
+          units="ergs/cm**3")
 
 def _Pressure(field, data):
     """
@@ -135,13 +132,13 @@
     """
     return (data.pf["Gamma"] - 1.0) * data["ThermalEnergy"]
 
-add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+add_field("Pressure", function=_Pressure, units="dyne/cm**2")
 
 def _Temperature(field, data):
     return ((data.pf["Gamma"] - 1.0) * data.pf["mu"] * mh *
             data["ThermalEnergy"] / (kboltz * data["Density"]))
 
-add_field("Temperature", function=_Temperature, units=r"\rm{Kelvin}",
+add_field("Temperature", function=_Temperature, units="K",
           take_log=False)
 
 def _convertParticleMassMsun(data):

diff -r 107f60b9717eff4cfafb1f97587ea29621af894e -r a0c6c70b232b7f0fae36aa8fbc83944c4dd12ee0 yt/frontends/chombo/fields.py
--- a/yt/frontends/chombo/fields.py
+++ b/yt/frontends/chombo/fields.py
@@ -43,49 +43,39 @@
 
 add_chombo_field("density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("density")],
-                 units=r"\rm{g}/\rm{cm}^3")
-
-KnownChomboFields["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+                 units="g/cm**3")
 
 add_chombo_field("X-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("X-Momentum")],
-                 units=r"",display_name=r"M_x")
-KnownChomboFields["X-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_x")
 
 add_chombo_field("Y-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Y-Momentum")],
-                 units=r"",display_name=r"M_y")
-KnownChomboFields["Y-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_y")
 
 add_chombo_field("Z-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Z-Momentum")],
-                 units=r"",display_name=r"M_z")
-KnownChomboFields["Z-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_z")
 
 add_chombo_field("X-magnfield", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("X-Magnfield")],
-                 units=r"",display_name=r"B_x")
-KnownChomboFields["X-magnfield"]._projected_units=r""
+                 units="gauss",display_name=r"B_x")
 
 add_chombo_field("Y-magnfield", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Y-Magnfield")],
-                 units=r"",display_name=r"B_y")
-KnownChomboFields["Y-magnfield"]._projected_units=r""
+                 units="gauss",display_name=r"B_y")
 
 add_chombo_field("Z-magnfield", function=NullFunc, take_log=False,
                   validators = [ValidateDataField("Z-Magnfield")],
-                  units=r"",display_name=r"B_z")
-KnownChomboFields["Z-magnfield"]._projected_units=r""
+                  units="gauss",display_name=r"B_z")
 
 add_chombo_field("energy-density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("energy-density")],
-                 units=r"\rm{erg}/\rm{cm}^3")
-KnownChomboFields["energy-density"]._projected_units =r""
+                 units="erg/cm**3")
 
 add_chombo_field("radiation-energy-density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("radiation-energy-density")],
-                 units=r"\rm{erg}/\rm{cm}^3")
-KnownChomboFields["radiation-energy-density"]._projected_units =r""
+                 units="erg/cm**3")
 
 def _Density(field,data):
     """A duplicate of the density field. This is needed because when you try 
@@ -96,36 +86,35 @@
     """
     return data["density"]
 add_field("Density",function=_Density, take_log=True,
-          units=r'\rm{g}/\rm{cm^3}')
+          units='g/cm**3')
 
 def _Bx(field,data):
     return data["X-magnfield"]
 add_field("Bx", function=_Bx, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_x")
+          units="gauss", display_name=r"B_x")
 
 def _By(field,data):
     return data["Y-magnfield"]
 add_field("By", function=_By, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_y")
+          units="gauss", display_name=r"B_y")
 
 def _Bz(field,data):
     return data["Z-magnfield"]
 add_field("Bz", function=_Bz, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_z")
+          units="gauss", display_name=r"B_z")
 
 def _MagneticEnergy(field,data):
     return (data["X-magnfield"]**2 +
             data["Y-magnfield"]**2 +
             data["Z-magnfield"]**2)/2.
 add_field("MagneticEnergy", function=_MagneticEnergy, take_log=True,
-          units=r"", display_name=r"B^2 / 8 \pi")
-ChomboFieldInfo["MagneticEnergy"]._projected_units=r""
+          units=r"erg/cm**3", display_name=r"B^2 / 8 \pi")
 
 def _xVelocity(field, data):
     """ Generate x-velocity from x-momentum and density. """
     return data["X-momentum"]/data["density"]
 add_field("x-velocity",function=_xVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _yVelocity(field,data):
     """ Generate y-velocity from y-momentum and density. """
@@ -134,13 +123,13 @@
     #except KeyError:
     return data["Y-momentum"]/data["density"]
 add_field("y-velocity",function=_yVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _zVelocity(field,data):
     """ Generate z-velocity from z-momentum and density. """
     return data["Z-momentum"]/data["density"]
 add_field("z-velocity",function=_zVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def particle_func(p_field, dtype='float64'):
     def _Particles(field, data):


https://bitbucket.org/yt_analysis/yt/commits/ad58631aeea8/
Changeset:   ad58631aeea8
Branch:      yt-3.0
User:        Andrew Myers
Date:        2013-03-07 01:21:06
Summary:     merging in Matts changes
Affected #:  2 files

diff -r a0c6c70b232b7f0fae36aa8fbc83944c4dd12ee0 -r ad58631aeea891beb0bd77e6472df0d5232e5f01 yt/frontends/gdf/fields.py
--- a/yt/frontends/gdf/fields.py
+++ b/yt/frontends/gdf/fields.py
@@ -55,33 +55,31 @@
 KnownGDFFields = FieldInfoContainer()
 add_gdf_field = KnownGDFFields.add_field
 
-add_gdf_field("density", function=NullFunc, take_log=True,
-          units=r"\rm{g}/\rm{cm}^3",
-          projected_units =r"\rm{g}/\rm{cm}^2")
+add_gdf_field("density", function=NullFunc, take_log=True, units="g/cm**3")
 
 add_gdf_field("specific_energy", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg / g")
 
 add_gdf_field("pressure", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg/g")
 
 add_gdf_field("velocity_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 for f,v in log_translation_dict.items():
     add_field(f, TranslationFunc(v), take_log=True)

diff -r a0c6c70b232b7f0fae36aa8fbc83944c4dd12ee0 -r ad58631aeea891beb0bd77e6472df0d5232e5f01 yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -69,15 +69,14 @@
 
 def _convertDensity(data):
     return data.convert("Density")
-KnownRAMSESFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
-KnownRAMSESFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownRAMSESFields["Density"]._units = "g / cm**3"
 KnownRAMSESFields["Density"]._convert_function=_convertDensity
 
 def _convertVelocity(data):
     return data.convert("x-velocity")
 for ax in ['x','y','z']:
     f = KnownRAMSESFields["%s-velocity" % ax]
-    f._units = r"\rm{cm}/\rm{s}"
+    f._units = "cm / s"
     f._convert_function = _convertVelocity
     f.take_log = False
 


https://bitbucket.org/yt_analysis/yt/commits/549e92a399da/
Changeset:   549e92a399da
Branch:      yt-3.0
User:        Andrew Myers
Date:        2013-03-07 01:21:58
Summary:     merging
Affected #:  3 files

diff -r ad58631aeea891beb0bd77e6472df0d5232e5f01 -r 549e92a399da26ea60bff33565fd75d20ce0d709 yt/frontends/orion/fields.py
--- a/yt/frontends/orion/fields.py
+++ b/yt/frontends/orion/fields.py
@@ -48,24 +48,23 @@
 
 add_orion_field("density", function=NullFunc, take_log=True,
                 validators = [ValidateDataField("density")],
-                units=r"\rm{g}/\rm{cm}^3")
-KnownOrionFields["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+                units="g/cm**3")
 
 add_orion_field("eden", function=NullFunc, take_log=True,
                 validators = [ValidateDataField("eden")],
-                units=r"\rm{erg}/\rm{cm}^3")
+                units="erg/cm**3")
 
 add_orion_field("xmom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("xmom")],
-                units=r"\rm{g}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
 add_orion_field("ymom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("ymom")],
-                units=r"\rm{gm}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
 add_orion_field("zmom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("zmom")],
-                units=r"\rm{g}/\rm{cm^2\ s}")
+                units="g/cm**2/s}")
 
 translation_dict = {"x-velocity": "xvel",
                     "y-velocity": "yvel",
@@ -93,7 +92,7 @@
     """
     return data["xmom"]/data["density"]
 add_orion_field("x-velocity",function=_xVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _yVelocity(field,data):
     """generate y-velocity from y-momentum and density
@@ -104,7 +103,7 @@
     #except KeyError:
     return data["ymom"]/data["density"]
 add_orion_field("y-velocity",function=_yVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _zVelocity(field,data):
     """generate z-velocity from z-momentum and density
@@ -112,7 +111,7 @@
     """
     return data["zmom"]/data["density"]
 add_orion_field("z-velocity",function=_zVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _ThermalEnergy(field, data):
     """generate thermal (gas energy). Dual Energy Formalism was
@@ -127,7 +126,7 @@
         + data["y-velocity"]**2.0
         + data["z-velocity"]**2.0 )
 add_field("ThermalEnergy", function=_ThermalEnergy,
-                units=r"\rm{ergs}/\rm{cm^3}")
+                units=r"ergs/cm**3")
 
 def _Pressure(field,data):
     """M{(Gamma-1.0)*e, where e is thermal energy density
@@ -138,7 +137,7 @@
 
 def _Temperature(field,data):
     return (data.pf["Gamma"]-1.0)*data.pf["mu"]*mh*data["ThermalEnergy"]/(kboltz*data["Density"])
-add_field("Temperature",function=_Temperature,units=r"\rm{Kelvin}",take_log=False)
+add_field("Temperature",function=_Temperature,units="K",take_log=False)
 
 # particle fields
 

diff -r ad58631aeea891beb0bd77e6472df0d5232e5f01 -r 549e92a399da26ea60bff33565fd75d20ce0d709 yt/geometry/setup.py
--- a/yt/geometry/setup.py
+++ b/yt/geometry/setup.py
@@ -16,8 +16,8 @@
                          "yt/geometry/selection_routines.pxd"])
     config.add_extension("selection_routines", 
                 ["yt/geometry/selection_routines.pyx"],
-                extra_compile_args=['-fopenmp'],
-                extra_link_args=['-fopenmp'],
+                #extra_compile_args=['-fopenmp'],
+                #extra_link_args=['-fopenmp'],
                 include_dirs=["yt/utilities/lib/"],
                 libraries=["m"],
                 depends=["yt/utilities/lib/fp_utils.pxd",

diff -r ad58631aeea891beb0bd77e6472df0d5232e5f01 -r 549e92a399da26ea60bff33565fd75d20ce0d709 yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -129,9 +129,7 @@
                 depends=["yt/utilities/lib/freetype_includes.h"])
     config.add_extension("geometry_utils", 
                 ["yt/utilities/lib/geometry_utils.pyx"],
-               extra_compile_args=['-fopenmp'],
-               extra_link_args=['-fopenmp'],
-                libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
+                 libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
     config.add_extension("Interpolators", 
                 ["yt/utilities/lib/Interpolators.pyx"],
                 libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
@@ -197,8 +195,6 @@
                  glob.glob("yt/utilities/lib/healpix_*.c"), 
                include_dirs=["yt/utilities/lib/"],
                libraries=["m"], 
-               extra_compile_args=['-fopenmp'],
-               extra_link_args=['-fopenmp'],
                depends = ["yt/utilities/lib/VolumeIntegrator.pyx",
                           "yt/utilities/lib/fp_utils.pxd",
                           "yt/utilities/lib/kdtree.h",


https://bitbucket.org/yt_analysis/yt/commits/187058b2719d/
Changeset:   187058b2719d
Branch:      yt-3.0
User:        alrosen
Date:        2013-03-07 01:43:36
Summary:     Altered units in art frontend fields.py.
Affected #:  1 file

diff -r 82fbb89b656110fe9e62fee74e9247ae4988c157 -r 187058b2719d263e9272d37e88ac198b8d62c3ae yt/frontends/art/fields.py
--- a/yt/frontends/art/fields.py
+++ b/yt/frontends/art/fields.py
@@ -89,30 +89,26 @@
 
 def _convertDensity(data):
     return data.convert("Density")
-KnownARTFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["Density"]._units = "g/cm**3"
 KnownARTFields["Density"]._convert_function=_convertDensity
 
 def _convertTotalEnergy(data):
     return data.convert("GasEnergy")
-KnownARTFields["TotalEnergy"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["TotalEnergy"]._projected_units = r"\rm{K}"
+KnownARTFields["TotalEnergy"]._units = "g/cm**3"
 KnownARTFields["TotalEnergy"]._convert_function=_convertTotalEnergy
 
 def _convertXMomentumDensity(data):
     tr  = data.convert("Mass")*data.convert("Velocity")
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
-KnownARTFields["XMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["XMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["XMomentumDensity"]._units = "g/s/cm**3"
 KnownARTFields["XMomentumDensity"]._convert_function=_convertXMomentumDensity
 
 def _convertYMomentumDensity(data):
     tr  = data.convert("Mass")*data.convert("Velocity")
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
-KnownARTFields["YMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["YMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["YMomentumDensity"]._units = "g/s/cm**3"
 KnownARTFields["YMomentumDensity"]._convert_function=_convertYMomentumDensity
 
 def _convertZMomentumDensity(data):
@@ -120,49 +116,41 @@
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
 KnownARTFields["ZMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["ZMomentumDensity"]._projected_units = r"\rm{K}"
 KnownARTFields["ZMomentumDensity"]._convert_function=_convertZMomentumDensity
 
 def _convertPressure(data):
     return data.convert("Pressure")
-KnownARTFields["Pressure"]._units = r"\rm{g}/\rm{cm}/\rm{s}^2"
-KnownARTFields["Pressure"]._projected_units = r"\rm{g}/\rm{s}^2"
+KnownARTFields["Pressure"]._units = "g/cm/s**2"
 KnownARTFields["Pressure"]._convert_function=_convertPressure
 
 def _convertGamma(data):
     return 1.0
-KnownARTFields["Gamma"]._units = r""
-KnownARTFields["Gamma"]._projected_units = r""
+KnownARTFields["Gamma"]._units = ""
 KnownARTFields["Gamma"]._convert_function=_convertGamma
 
 def _convertGasEnergy(data):
     return data.convert("GasEnergy")
-KnownARTFields["GasEnergy"]._units = r"\rm{ergs}/\rm{g}"
-KnownARTFields["GasEnergy"]._projected_units = r""
+KnownARTFields["GasEnergy"]._units = "erg/g"
 KnownARTFields["GasEnergy"]._convert_function=_convertGasEnergy
 
 def _convertMetalDensitySNII(data):
     return data.convert('Density')
-KnownARTFields["MetalDensitySNII"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["MetalDensitySNII"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["MetalDensitySNII"]._units = "g/cm**3"
 KnownARTFields["MetalDensitySNII"]._convert_function=_convertMetalDensitySNII
 
 def _convertMetalDensitySNIa(data):
     return data.convert('Density')
-KnownARTFields["MetalDensitySNIa"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["MetalDensitySNIa"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["MetalDensitySNIa"]._units = "g/cm**3"
 KnownARTFields["MetalDensitySNIa"]._convert_function=_convertMetalDensitySNIa
 
 def _convertPotentialNew(data):
     return data.convert("Potential")
-KnownARTFields["PotentialNew"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["PotentialNew"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["PotentialNew"]._units = "g/cm**3"
 KnownARTFields["PotentialNew"]._convert_function=_convertPotentialNew
 
 def _convertPotentialOld(data):
     return data.convert("Potential")
-KnownARTFields["PotentialOld"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["PotentialOld"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["PotentialOld"]._units = "g/cm**3"
 KnownARTFields["PotentialOld"]._convert_function=_convertPotentialOld
 
 ####### Derived fields
@@ -185,38 +173,33 @@
     #x = data.pf.conversion_factors["Temperature"]
     x = 1.0
     return x
-add_field("Temperature", function=_temperature, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Temperature"]._units = r"\mathrm{K}"
-ARTFieldInfo["Temperature"]._projected_units = r"\mathrm{K}"
+add_field("Temperature", function=_temperature, units = "K",take_log=True)
+ARTFieldInfo["Temperature"]._units = "K"
 #ARTFieldInfo["Temperature"]._convert_function=_converttemperature
 
 def _metallicity_snII(field, data):
     tr  = data["MetalDensitySNII"] / data["Density"]
     return tr
-add_field("Metallicity_SNII", function=_metallicity_snII, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity_SNII"]._units = r""
-ARTFieldInfo["Metallicity_SNII"]._projected_units = r""
+add_field("Metallicity_SNII", function=_metallicity_snII, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity_SNII"]._units = "Zsun"
 
 def _metallicity_snIa(field, data):
     tr  = data["MetalDensitySNIa"] / data["Density"]
     return tr
-add_field("Metallicity_SNIa", function=_metallicity_snIa, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity_SNIa"]._units = r""
-ARTFieldInfo["Metallicity_SNIa"]._projected_units = r""
+add_field("Metallicity_SNIa", function=_metallicity_snIa, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity_SNIa"]._units = "Zsun"
 
 def _metallicity(field, data):
     tr  = data["Metal_Density"] / data["Density"]
     return tr
-add_field("Metallicity", function=_metallicity, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity"]._units = r""
-ARTFieldInfo["Metallicity"]._projected_units = r""
+add_field("Metallicity", function=_metallicity, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity"]._units = "Zsun"
 
 def _x_velocity(field,data):
     tr  = data["XMomentumDensity"]/data["Density"]
     return tr
-add_field("x-velocity", function=_x_velocity, units = r"\mathrm{cm/s}",take_log=False)
-ARTFieldInfo["x-velocity"]._units = r"\rm{cm}/\rm{s}"
-ARTFieldInfo["x-velocity"]._projected_units = r"\rm{cm}/\rm{s}"
+add_field("x-velocity", function=_x_velocity, units = "cm/s",take_log=False)
+ARTFieldInfo["x-velocity"]._units = "cm/s"
 
 def _y_velocity(field,data):
     tr  = data["YMomentumDensity"]/data["Density"]
@@ -228,38 +211,36 @@
 def _z_velocity(field,data):
     tr  = data["ZMomentumDensity"]/data["Density"]
     return tr
-add_field("z-velocity", function=_z_velocity, units = r"\mathrm{cm/s}",take_log=False)
-ARTFieldInfo["z-velocity"]._units = r"\rm{cm}/\rm{s}"
-ARTFieldInfo["z-velocity"]._projected_units = r"\rm{cm}/\rm{s}"
+add_field("z-velocity", function=_z_velocity, units = "cm/s",take_log=False)
+ARTFieldInfo["z-velocity"]._units = "cm/s"
 
 def _metal_density(field, data):
     tr  = data["MetalDensitySNIa"]
     tr += data["MetalDensitySNII"]
     return tr
-add_field("Metal_Density", function=_metal_density, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metal_Density"]._units = r""
-ARTFieldInfo["Metal_Density"]._projected_units = r""
+add_field("Metal_Density", function=_metal_density, units = "Zsun",take_log=True)
+ARTFieldInfo["Metal_Density"]._units = "Zsun"
 
 
 #Particle fields
 
 def ParticleMass(field,data):
     return data['particle_mass']
-add_field("ParticleMass",function=ParticleMass,units=r"\rm{g}",particle_type=True)
+add_field("ParticleMass",function=ParticleMass,units="g",particle_type=True)
 
 
 #Derived particle fields
 
 def ParticleMassMsun(field,data):
     return data['particle_mass']*data.pf['Msun']
-add_field("ParticleMassMsun",function=ParticleMassMsun,units=r"\rm{g}",particle_type=True)
+add_field("ParticleMassMsun",function=ParticleMassMsun,units="g",particle_type=True)
 
 def _creation_time(field,data):
     pa = data["particle_age"]
     tr = np.zeros(pa.shape,dtype='float')-1.0
     tr[pa>0] = pa[pa>0]
     return tr
-add_field("creation_time",function=_creation_time,units=r"\rm{s}",particle_type=True)
+add_field("creation_time",function=_creation_time,units="s",particle_type=True)
 
 def mass_dm(field, data):
     tr = np.ones(data.ActiveDimensions, dtype='float32')
@@ -274,7 +255,7 @@
     else:
         return tr*1e-9
 
-add_field("particle_cell_mass_dm", function=mass_dm, units = r"\mathrm{M_{sun}}",
+add_field("particle_cell_mass_dm", function=mass_dm, units = "Msun",
         validators=[ValidateSpatial(0)],        
         take_log=False,
         projection_conversion="1")
@@ -303,3 +284,4 @@
 
 add_field("star_density", function=_simple_density,
           validators=[ValidateSpatial(0)], convert_function=_convertDensity)
+


https://bitbucket.org/yt_analysis/yt/commits/8ab156b24a4d/
Changeset:   8ab156b24a4d
Branch:      yt-3.0
User:        alrosen
Date:        2013-03-07 01:45:57
Summary:     Changed units in art fields.
Affected #:  2 files

diff -r 187058b2719d263e9272d37e88ac198b8d62c3ae -r 8ab156b24a4d5000a3a54ec2ff3f4869cf30dd8d yt/frontends/castro/fields.py
--- a/yt/frontends/castro/fields.py
+++ b/yt/frontends/castro/fields.py
@@ -59,26 +59,23 @@
 
 # Start adding fields
 add_castro_field("density", function=NullFunc, take_log=True,
-                 units=r"\rm{g}/\rm{cm}^3")
-
-# fix projected units
-KnownCastroFields["density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+                 units="g/cm**3")
 
 add_castro_field("eden", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("eden")],
-                 units=r"\rm{erg}/\rm{cm}^3")
+                 units="erg/cm**3")
 
 add_castro_field("xmom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("xmom")],
-                 units=r"\rm{g}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 add_castro_field("ymom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("ymom")],
-                 units=r"\rm{gm}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 add_castro_field("zmom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("zmom")],
-                 units=r"\rm{g}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 # Now populate derived fields
 for mine, theirs in translation_dict.items():
@@ -92,21 +89,21 @@
     return data["xmom"] / data["density"]
 
 add_field("x-velocity", function=_xVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _yVelocity(field, data):
     """ Generate y-velocity from y-momentum and density. """
     return data["ymom"] / data["density"]
 
 add_field("y-velocity", function=_yVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _zVelocity(field, data):
     """ Generate z-velocity from z-momentum and density. """
     return data["zmom"] / data["density"]
 
 add_field("z-velocity", function=_zVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _ThermalEnergy(field, data):
     """
@@ -124,7 +121,7 @@
         + data["z-velocity"]**2.0 )
 
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units=r"\rm{ergs}/\rm{cm^3}")
+          units="ergs/cm**3")
 
 def _Pressure(field, data):
     """
@@ -135,13 +132,13 @@
     """
     return (data.pf["Gamma"] - 1.0) * data["ThermalEnergy"]
 
-add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+add_field("Pressure", function=_Pressure, units="dyne/cm**2")
 
 def _Temperature(field, data):
     return ((data.pf["Gamma"] - 1.0) * data.pf["mu"] * mh *
             data["ThermalEnergy"] / (kboltz * data["Density"]))
 
-add_field("Temperature", function=_Temperature, units=r"\rm{Kelvin}",
+add_field("Temperature", function=_Temperature, units="K",
           take_log=False)
 
 def _convertParticleMassMsun(data):

diff -r 187058b2719d263e9272d37e88ac198b8d62c3ae -r 8ab156b24a4d5000a3a54ec2ff3f4869cf30dd8d yt/frontends/chombo/fields.py
--- a/yt/frontends/chombo/fields.py
+++ b/yt/frontends/chombo/fields.py
@@ -43,49 +43,39 @@
 
 add_chombo_field("density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("density")],
-                 units=r"\rm{g}/\rm{cm}^3")
-
-KnownChomboFields["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+                 units="g/cm**3")
 
 add_chombo_field("X-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("X-Momentum")],
-                 units=r"",display_name=r"M_x")
-KnownChomboFields["X-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_x")
 
 add_chombo_field("Y-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Y-Momentum")],
-                 units=r"",display_name=r"M_y")
-KnownChomboFields["Y-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_y")
 
 add_chombo_field("Z-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Z-Momentum")],
-                 units=r"",display_name=r"M_z")
-KnownChomboFields["Z-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_z")
 
 add_chombo_field("X-magnfield", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("X-Magnfield")],
-                 units=r"",display_name=r"B_x")
-KnownChomboFields["X-magnfield"]._projected_units=r""
+                 units="gauss",display_name=r"B_x")
 
 add_chombo_field("Y-magnfield", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Y-Magnfield")],
-                 units=r"",display_name=r"B_y")
-KnownChomboFields["Y-magnfield"]._projected_units=r""
+                 units="gauss",display_name=r"B_y")
 
 add_chombo_field("Z-magnfield", function=NullFunc, take_log=False,
                   validators = [ValidateDataField("Z-Magnfield")],
-                  units=r"",display_name=r"B_z")
-KnownChomboFields["Z-magnfield"]._projected_units=r""
+                  units="gauss",display_name=r"B_z")
 
 add_chombo_field("energy-density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("energy-density")],
-                 units=r"\rm{erg}/\rm{cm}^3")
-KnownChomboFields["energy-density"]._projected_units =r""
+                 units="erg/cm**3")
 
 add_chombo_field("radiation-energy-density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("radiation-energy-density")],
-                 units=r"\rm{erg}/\rm{cm}^3")
-KnownChomboFields["radiation-energy-density"]._projected_units =r""
+                 units="erg/cm**3")
 
 def _Density(field,data):
     """A duplicate of the density field. This is needed because when you try 
@@ -96,36 +86,35 @@
     """
     return data["density"]
 add_field("Density",function=_Density, take_log=True,
-          units=r'\rm{g}/\rm{cm^3}')
+          units='g/cm**3')
 
 def _Bx(field,data):
     return data["X-magnfield"]
 add_field("Bx", function=_Bx, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_x")
+          units="gauss", display_name=r"B_x")
 
 def _By(field,data):
     return data["Y-magnfield"]
 add_field("By", function=_By, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_y")
+          units="gauss", display_name=r"B_y")
 
 def _Bz(field,data):
     return data["Z-magnfield"]
 add_field("Bz", function=_Bz, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_z")
+          units="gauss", display_name=r"B_z")
 
 def _MagneticEnergy(field,data):
     return (data["X-magnfield"]**2 +
             data["Y-magnfield"]**2 +
             data["Z-magnfield"]**2)/2.
 add_field("MagneticEnergy", function=_MagneticEnergy, take_log=True,
-          units=r"", display_name=r"B^2 / 8 \pi")
-ChomboFieldInfo["MagneticEnergy"]._projected_units=r""
+          units=r"erg/cm**3", display_name=r"B^2 / 8 \pi")
 
 def _xVelocity(field, data):
     """ Generate x-velocity from x-momentum and density. """
     return data["X-momentum"]/data["density"]
 add_field("x-velocity",function=_xVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _yVelocity(field,data):
     """ Generate y-velocity from y-momentum and density. """
@@ -134,13 +123,13 @@
     #except KeyError:
     return data["Y-momentum"]/data["density"]
 add_field("y-velocity",function=_yVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _zVelocity(field,data):
     """ Generate z-velocity from z-momentum and density. """
     return data["Z-momentum"]/data["density"]
 add_field("z-velocity",function=_zVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def particle_func(p_field, dtype='float64'):
     def _Particles(field, data):


https://bitbucket.org/yt_analysis/yt/commits/280a525e534f/
Changeset:   280a525e534f
Branch:      yt-3.0
User:        brittonsmith
Date:        2013-03-07 01:46:14
Summary:     Fixing units strings in Enzo frontend.
Affected #:  1 file

diff -r 19ea28fbfa3792779869e37eb41100427a2cc03f -r 280a525e534f7fcf4df36c3a92be102c59f158bc yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -94,11 +94,11 @@
              function=_SpeciesComovingDensity,
              validators=ValidateDataField("%s_Density" % species),
              display_name="Comoving\/%s\/Density" % species)
-    add_field("%s_Mass" % species, units=r"\rm{g}", 
+    add_field("%s_Mass" % species, units="g", 
               function=_SpeciesMass, 
               validators=ValidateDataField("%s_Density" % species),
               display_name="%s\/Mass" % species)
-    add_field("%s_MassMsun" % species, units=r"M_{\odot}", 
+    add_field("%s_MassMsun" % species, units="Msun", 
               function=_SpeciesMass, 
               convert_function=_convertCellMassMsun,
               validators=ValidateDataField("%s_Density" % species),
@@ -113,7 +113,7 @@
     return data["Metal_Fraction"]
 def _ConvertMetallicity(data):
     return 49.0196 # 1 / 0.0204
-add_field("Metallicity", units=r"Z_{\rm{\odot}}",
+add_field("Metallicity", units="Zsun",
           function=_Metallicity,
           convert_function=_ConvertMetallicity,
           validators=ValidateDataField("Metal_Density"),
@@ -121,13 +121,13 @@
 
 def _Metallicity3(field, data):
     return data["SN_Colour"]/data["Density"]
-add_field("Metallicity3", units=r"Z_{\rm{\odot}}",
+add_field("Metallicity3", units="Zsun",
           function=_Metallicity3,
           convert_function=_ConvertMetallicity,
           validators=ValidateDataField("SN_Colour"),
           projection_conversion="1")
 
-add_enzo_field("Cooling_Time", units=r"\rm{s}",
+add_enzo_field("Cooling_Time", units="s",
                function=NullFunc,
                validators=ValidateDataField("Cooling_Time"),
                projection_conversion="1")
@@ -144,14 +144,14 @@
                  + data["y-velocity"]**2.0
                  + data["z-velocity"]**2.0 )
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units=r"\rm{ergs}/\rm{g}")
+          units="erg / g")
 
 def _KineticEnergy(field, data):
     return 0.5*data["Density"] * ( data["x-velocity"]**2.0
                                    + data["y-velocity"]**2.0
                                    + data["z-velocity"]**2.0 )
 add_field("KineticEnergy",function=_KineticEnergy,
-          units = r"\rm{ergs}/\rm{cm^3}")
+          units="erg / cm**3")
 # This next section is the energy field section
 # Note that we have aliases that manually unconvert themselves.
 # This is because numerous code branches use Gas_Energy or GasEnergy
@@ -164,35 +164,35 @@
     return data.convert("x-velocity")**2.0
 
 add_enzo_field("GasEnergy", function=NullFunc,
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 add_enzo_field("Gas_Energy", function=NullFunc,
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _Gas_Energy(field, data):
     return data["GasEnergy"] / _convertEnergy(data)
 add_field("Gas_Energy", function=_Gas_Energy,
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 # We set up fields for both TotalEnergy and Total_Energy in the known fields
 # lists.  Note that this does not mean these will be the used definitions.
 add_enzo_field("TotalEnergy", function=NullFunc,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 add_enzo_field("Total_Energy", function=NullFunc,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _Total_Energy(field, data):
     return data["TotalEnergy"] / _convertEnergy(data)
 add_field("Total_Energy", function=_Total_Energy,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _TotalEnergy(field, data):
     return data["Total_Energy"] / _convertEnergy(data)
 add_field("TotalEnergy", function=_TotalEnergy,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _NumberDensity(field, data):
     # We can assume that we at least have Density
@@ -222,7 +222,7 @@
         fieldData += data["DII_Density"] / 2.0
         fieldData += data["HDI_Density"] / 3.0
     return fieldData
-add_field("NumberDensity", units=r"\rm{cm}^{-3}",
+add_field("NumberDensity", units="cm**-3",
           function=_NumberDensity,
           convert_function=_ConvertNumberDensity)
 
@@ -242,7 +242,7 @@
     if data.pf.parameters["MultiSpecies"] > 2:
         field_data += data["HDI_Density"] / 2.0
     return field_data
-add_field("H_NumberDensity", units=r"\rm{cm}^{-3}",
+add_field("H_NumberDensity", units="cm**-3",
           function=_H_NumberDensity,
           convert_function=_ConvertNumberDensity)
 
@@ -269,7 +269,7 @@
     dn = field.replace("_","\/")
     add_enzo_field(field, function=NullFunc, take_log=True,
               display_name = dn,
-              validators=[ValidateDataField(field)], units=r"Unknown")
+              validators=[ValidateDataField(field)], units="")
 KnownEnzoFields["x-velocity"].projection_conversion='1'
 KnownEnzoFields["y-velocity"].projection_conversion='1'
 KnownEnzoFields["z-velocity"].projection_conversion='1'
@@ -279,7 +279,7 @@
 for field in ['Bx','By','Bz']:
     f = KnownEnzoFields[field]
     f._convert_function=_convertBfield
-    f._units=r"\rm{Gauss}"
+    f._units = "gauss"
     f.take_log=False
 
 def _convertRadiation(data):
@@ -287,11 +287,11 @@
 for field in ["HI_kph", "HeI_kph", "HeII_kph", "H2I_kdiss"]:
     f = KnownEnzoFields[field]
     f._convert_function = _convertRadiation
-    f._units=r"\rm{s}^{-1}"
+    f._units = "s**-1"
     f.take_log=True
 
 KnownEnzoFields["PhotoGamma"]._convert_function = _convertRadiation
-KnownEnzoFields["PhotoGamma"]._units = r"\rm{eV} \rm{s}^{-1}"
+KnownEnzoFields["PhotoGamma"]._units = "eV / s"
 KnownEnzoFields["PhotoGamma"].take_log = True
 
 def _convertRadiationAccel(data):
@@ -299,7 +299,7 @@
 for dim in range(1,4):
     f = KnownEnzoFields["RadAccel%d" % dim]
     f._convert_function = _convertRadiationAccel
-    f._units=r"\rm{cm}\/\rm{s}^{-2}"
+    f._units = "cm / s**2"
     f.take_log=False
 def _RadiationAccelerationMagnitude(field, data):
     return ( data["RadAccel1"]**2 + data["RadAccel2"]**2 +
@@ -307,7 +307,7 @@
 add_field("RadiationAcceleration", 
           function=_RadiationAccelerationMagnitude,
           validators=ValidateDataField(["RadAccel1", "RadAccel2", "RadAccel3"]),
-          display_name="Radiation\/Acceleration", units=r"\rm{cm} \rm{s}^{-2}")
+          display_name="Radiation\/Acceleration", units="cm / s**2")
 
 # Now we override
 
@@ -315,8 +315,7 @@
     return data.convert("Density")
 for field in ["Density"] + [ "%s_Density" % sp for sp in _speciesList ] + \
         ["SN_Colour"]:
-    KnownEnzoFields[field]._units = r"\rm{g}/\rm{cm}^3"
-    KnownEnzoFields[field]._projected_units = r"\rm{g}/\rm{cm}^2"
+    KnownEnzoFields[field]._units = "g / cm**3"
     KnownEnzoFields[field]._convert_function=_convertDensity
 
 add_enzo_field("Dark_Matter_Density", function=NullFunc,
@@ -330,22 +329,22 @@
     return data['Dark_Matter_Density'] * data["CellVolume"]
 add_field("Dark_Matter_Mass", function=_Dark_Matter_Mass,
           validators=ValidateDataField("Dark_Matter_Density"),
-          display_name="Dark\/Matter\/Mass", units=r"\rm{g}")
+          display_name="Dark\/Matter\/Mass", units="g")
 add_field("Dark_Matter_MassMsun", function=_Dark_Matter_Mass,
           convert_function=_convertCellMassMsun,
           validators=ValidateDataField("Dark_Matter_Density"),
-          display_name="Dark\/Matter\/Mass", units=r"M_{\odot}")
+          display_name="Dark\/Matter\/Mass", units="Msun")
 
-KnownEnzoFields["Temperature"]._units = r"\rm{K}"
-KnownEnzoFields["Temperature"].units = r"K"
-KnownEnzoFields["Dust_Temperature"]._units = r"\rm{K}"
-KnownEnzoFields["Dust_Temperature"].units = r"K"
+KnownEnzoFields["Temperature"]._units = "K"
+KnownEnzoFields["Temperature"].units = "K"
+KnownEnzoFields["Dust_Temperature"]._units = "K"
+KnownEnzoFields["Dust_Temperature"].units = "K"
 
 def _convertVelocity(data):
     return data.convert("x-velocity")
 for ax in ['x','y','z']:
     f = KnownEnzoFields["%s-velocity" % ax]
-    f._units = r"\rm{cm}/\rm{s}"
+    f._units = "cm / s"
     f._convert_function = _convertVelocity
     f.take_log = False
 
@@ -471,7 +470,7 @@
 
 def _StarMetallicity(field, data):
     return data['star_metallicity_fraction']
-add_field('StarMetallicity', units=r"Z_{\rm{\odot}}",
+add_field('StarMetallicity', units="Zsun",
           function=_StarMetallicity,
           convert_function=_ConvertMetallicity,
           projection_conversion="1")
@@ -480,14 +479,14 @@
     return data['star_creation_time']
 def _ConvertEnzoTimeYears(data):
     return data.pf.time_units['years']
-add_field('StarCreationTimeYears', units=r"\rm{yr}",
+add_field('StarCreationTimeYears', units="yr",
           function=_StarCreationTime,
           convert_function=_ConvertEnzoTimeYears,
           projection_conversion="1")
 
 def _StarDynamicalTime(field, data):
     return data['star_dynamical_time']
-add_field('StarDynamicalTimeYears', units=r"\rm{yr}",
+add_field('StarDynamicalTimeYears', units="yr",
           function=_StarDynamicalTime,
           convert_function=_ConvertEnzoTimeYears,
           projection_conversion="1")
@@ -499,7 +498,7 @@
         data.pf.current_time - \
         data['StarCreationTimeYears'][with_stars]
     return star_age
-add_field('StarAgeYears', units=r"\rm{yr}",
+add_field('StarAgeYears', units="yr",
           function=_StarAge,
           projection_conversion="1")
 
@@ -514,7 +513,7 @@
     """
     return np.sqrt(data['Bx']**2 + data['By']**2 + data['Bz']**2)
 
-add_field("Bmag", function=_Bmag,display_name=r"$|B|$",units=r"\rm{Gauss}")
+add_field("Bmag", function=_Bmag,display_name=r"$|B|$",units="gauss")
 
 # Particle functions
 
@@ -598,12 +597,12 @@
     return data.convert("mpc")**2.0
 def _ConvertCellAreaCGS(data):
     return data.convert("cm")**2.0
-add_enzo_2d_field("CellAreaCode", units=r"\rm{BoxArea}^2",
+add_enzo_2d_field("CellAreaCode", units="",
           function=_CellArea)
-add_enzo_2d_field("CellAreaMpc", units=r"\rm{Mpc}^2",
+add_enzo_2d_field("CellAreaMpc", units="Mpc**2",
           function=_CellArea,
           convert_function=_ConvertCellAreaMpc)
-add_enzo_2d_field("CellArea", units=r"\rm{cm}^2",
+add_enzo_2d_field("CellArea", units="cm**2",
           function=_CellArea,
           convert_function=_ConvertCellAreaCGS)
 
@@ -629,12 +628,12 @@
     return data.convert("mpc")
 def _ConvertCellLengthCGS(data):
     return data.convert("cm")
-add_enzo_1d_field("CellLengthCode", units=r"\rm{BoxArea}^2",
+add_enzo_1d_field("CellLengthCode", units="",
           function=_CellLength)
-add_enzo_1d_field("CellLengthMpc", units=r"\rm{Mpc}^2",
+add_enzo_1d_field("CellLengthMpc", units="Mpc",
           function=_CellLength,
           convert_function=_ConvertCellLengthMpc)
-add_enzo_1d_field("CellLength", units=r"\rm{cm}^2",
+add_enzo_1d_field("CellLength", units="cm",
           function=_CellLength,
           convert_function=_ConvertCellLengthCGS)
 


https://bitbucket.org/yt_analysis/yt/commits/f5a88cdfeaf9/
Changeset:   f5a88cdfeaf9
Branch:      yt-3.0
User:        brittonsmith
Date:        2013-03-07 01:47:51
Summary:     Merged.
Affected #:  9 files

diff -r 280a525e534f7fcf4df36c3a92be102c59f158bc -r f5a88cdfeaf95bb3b9fceca392a310406108509d scripts/iyt
--- a/scripts/iyt
+++ b/scripts/iyt
@@ -2,7 +2,7 @@
 import os, re
 from distutils import version
 from yt.mods import *
-from yt.data_objects.data_containers import AMRData
+from yt.data_objects.data_containers import YTDataContainer
 namespace = locals().copy()
 namespace.pop("__builtins__", None)
 
@@ -116,7 +116,7 @@
         except:
             raise IPython.ipapi.TryNext 
         
-    if isinstance(obj, (AMRData, ) ):
+    if isinstance(obj, (YTDataContainer, ) ):
         #print "COMPLETING ON THIS THING"
         all_fields = [f for f in sorted(
                 obj.pf.h.field_list + obj.pf.h.derived_field_list)]

diff -r 280a525e534f7fcf4df36c3a92be102c59f158bc -r f5a88cdfeaf95bb3b9fceca392a310406108509d yt/frontends/art/fields.py
--- a/yt/frontends/art/fields.py
+++ b/yt/frontends/art/fields.py
@@ -89,30 +89,26 @@
 
 def _convertDensity(data):
     return data.convert("Density")
-KnownARTFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["Density"]._units = "g/cm**3"
 KnownARTFields["Density"]._convert_function=_convertDensity
 
 def _convertTotalEnergy(data):
     return data.convert("GasEnergy")
-KnownARTFields["TotalEnergy"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["TotalEnergy"]._projected_units = r"\rm{K}"
+KnownARTFields["TotalEnergy"]._units = "g/cm**3"
 KnownARTFields["TotalEnergy"]._convert_function=_convertTotalEnergy
 
 def _convertXMomentumDensity(data):
     tr  = data.convert("Mass")*data.convert("Velocity")
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
-KnownARTFields["XMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["XMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["XMomentumDensity"]._units = "g/s/cm**3"
 KnownARTFields["XMomentumDensity"]._convert_function=_convertXMomentumDensity
 
 def _convertYMomentumDensity(data):
     tr  = data.convert("Mass")*data.convert("Velocity")
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
-KnownARTFields["YMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["YMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["YMomentumDensity"]._units = "g/s/cm**3"
 KnownARTFields["YMomentumDensity"]._convert_function=_convertYMomentumDensity
 
 def _convertZMomentumDensity(data):
@@ -120,49 +116,41 @@
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
 KnownARTFields["ZMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["ZMomentumDensity"]._projected_units = r"\rm{K}"
 KnownARTFields["ZMomentumDensity"]._convert_function=_convertZMomentumDensity
 
 def _convertPressure(data):
     return data.convert("Pressure")
-KnownARTFields["Pressure"]._units = r"\rm{g}/\rm{cm}/\rm{s}^2"
-KnownARTFields["Pressure"]._projected_units = r"\rm{g}/\rm{s}^2"
+KnownARTFields["Pressure"]._units = "g/cm/s**2"
 KnownARTFields["Pressure"]._convert_function=_convertPressure
 
 def _convertGamma(data):
     return 1.0
-KnownARTFields["Gamma"]._units = r""
-KnownARTFields["Gamma"]._projected_units = r""
+KnownARTFields["Gamma"]._units = ""
 KnownARTFields["Gamma"]._convert_function=_convertGamma
 
 def _convertGasEnergy(data):
     return data.convert("GasEnergy")
-KnownARTFields["GasEnergy"]._units = r"\rm{ergs}/\rm{g}"
-KnownARTFields["GasEnergy"]._projected_units = r""
+KnownARTFields["GasEnergy"]._units = "erg/g"
 KnownARTFields["GasEnergy"]._convert_function=_convertGasEnergy
 
 def _convertMetalDensitySNII(data):
     return data.convert('Density')
-KnownARTFields["MetalDensitySNII"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["MetalDensitySNII"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["MetalDensitySNII"]._units = "g/cm**3"
 KnownARTFields["MetalDensitySNII"]._convert_function=_convertMetalDensitySNII
 
 def _convertMetalDensitySNIa(data):
     return data.convert('Density')
-KnownARTFields["MetalDensitySNIa"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["MetalDensitySNIa"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["MetalDensitySNIa"]._units = "g/cm**3"
 KnownARTFields["MetalDensitySNIa"]._convert_function=_convertMetalDensitySNIa
 
 def _convertPotentialNew(data):
     return data.convert("Potential")
-KnownARTFields["PotentialNew"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["PotentialNew"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["PotentialNew"]._units = "g/cm**3"
 KnownARTFields["PotentialNew"]._convert_function=_convertPotentialNew
 
 def _convertPotentialOld(data):
     return data.convert("Potential")
-KnownARTFields["PotentialOld"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["PotentialOld"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["PotentialOld"]._units = "g/cm**3"
 KnownARTFields["PotentialOld"]._convert_function=_convertPotentialOld
 
 ####### Derived fields
@@ -185,38 +173,33 @@
     #x = data.pf.conversion_factors["Temperature"]
     x = 1.0
     return x
-add_field("Temperature", function=_temperature, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Temperature"]._units = r"\mathrm{K}"
-ARTFieldInfo["Temperature"]._projected_units = r"\mathrm{K}"
+add_field("Temperature", function=_temperature, units = "K",take_log=True)
+ARTFieldInfo["Temperature"]._units = "K"
 #ARTFieldInfo["Temperature"]._convert_function=_converttemperature
 
 def _metallicity_snII(field, data):
     tr  = data["MetalDensitySNII"] / data["Density"]
     return tr
-add_field("Metallicity_SNII", function=_metallicity_snII, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity_SNII"]._units = r""
-ARTFieldInfo["Metallicity_SNII"]._projected_units = r""
+add_field("Metallicity_SNII", function=_metallicity_snII, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity_SNII"]._units = "Zsun"
 
 def _metallicity_snIa(field, data):
     tr  = data["MetalDensitySNIa"] / data["Density"]
     return tr
-add_field("Metallicity_SNIa", function=_metallicity_snIa, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity_SNIa"]._units = r""
-ARTFieldInfo["Metallicity_SNIa"]._projected_units = r""
+add_field("Metallicity_SNIa", function=_metallicity_snIa, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity_SNIa"]._units = "Zsun"
 
 def _metallicity(field, data):
     tr  = data["Metal_Density"] / data["Density"]
     return tr
-add_field("Metallicity", function=_metallicity, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity"]._units = r""
-ARTFieldInfo["Metallicity"]._projected_units = r""
+add_field("Metallicity", function=_metallicity, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity"]._units = "Zsun"
 
 def _x_velocity(field,data):
     tr  = data["XMomentumDensity"]/data["Density"]
     return tr
-add_field("x-velocity", function=_x_velocity, units = r"\mathrm{cm/s}",take_log=False)
-ARTFieldInfo["x-velocity"]._units = r"\rm{cm}/\rm{s}"
-ARTFieldInfo["x-velocity"]._projected_units = r"\rm{cm}/\rm{s}"
+add_field("x-velocity", function=_x_velocity, units = "cm/s",take_log=False)
+ARTFieldInfo["x-velocity"]._units = "cm/s"
 
 def _y_velocity(field,data):
     tr  = data["YMomentumDensity"]/data["Density"]
@@ -228,38 +211,36 @@
 def _z_velocity(field,data):
     tr  = data["ZMomentumDensity"]/data["Density"]
     return tr
-add_field("z-velocity", function=_z_velocity, units = r"\mathrm{cm/s}",take_log=False)
-ARTFieldInfo["z-velocity"]._units = r"\rm{cm}/\rm{s}"
-ARTFieldInfo["z-velocity"]._projected_units = r"\rm{cm}/\rm{s}"
+add_field("z-velocity", function=_z_velocity, units = "cm/s",take_log=False)
+ARTFieldInfo["z-velocity"]._units = "cm/s"
 
 def _metal_density(field, data):
     tr  = data["MetalDensitySNIa"]
     tr += data["MetalDensitySNII"]
     return tr
-add_field("Metal_Density", function=_metal_density, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metal_Density"]._units = r""
-ARTFieldInfo["Metal_Density"]._projected_units = r""
+add_field("Metal_Density", function=_metal_density, units = "Zsun",take_log=True)
+ARTFieldInfo["Metal_Density"]._units = "Zsun"
 
 
 #Particle fields
 
 def ParticleMass(field,data):
     return data['particle_mass']
-add_field("ParticleMass",function=ParticleMass,units=r"\rm{g}",particle_type=True)
+add_field("ParticleMass",function=ParticleMass,units="g",particle_type=True)
 
 
 #Derived particle fields
 
 def ParticleMassMsun(field,data):
     return data['particle_mass']*data.pf['Msun']
-add_field("ParticleMassMsun",function=ParticleMassMsun,units=r"\rm{g}",particle_type=True)
+add_field("ParticleMassMsun",function=ParticleMassMsun,units="g",particle_type=True)
 
 def _creation_time(field,data):
     pa = data["particle_age"]
     tr = np.zeros(pa.shape,dtype='float')-1.0
     tr[pa>0] = pa[pa>0]
     return tr
-add_field("creation_time",function=_creation_time,units=r"\rm{s}",particle_type=True)
+add_field("creation_time",function=_creation_time,units="s",particle_type=True)
 
 def mass_dm(field, data):
     tr = np.ones(data.ActiveDimensions, dtype='float32')
@@ -274,7 +255,7 @@
     else:
         return tr*1e-9
 
-add_field("particle_cell_mass_dm", function=mass_dm, units = r"\mathrm{M_{sun}}",
+add_field("particle_cell_mass_dm", function=mass_dm, units = "Msun",
         validators=[ValidateSpatial(0)],        
         take_log=False,
         projection_conversion="1")
@@ -303,3 +284,4 @@
 
 add_field("star_density", function=_simple_density,
           validators=[ValidateSpatial(0)], convert_function=_convertDensity)
+

diff -r 280a525e534f7fcf4df36c3a92be102c59f158bc -r f5a88cdfeaf95bb3b9fceca392a310406108509d yt/frontends/castro/fields.py
--- a/yt/frontends/castro/fields.py
+++ b/yt/frontends/castro/fields.py
@@ -59,26 +59,23 @@
 
 # Start adding fields
 add_castro_field("density", function=NullFunc, take_log=True,
-                 units=r"\rm{g}/\rm{cm}^3")
-
-# fix projected units
-KnownCastroFields["density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+                 units="g/cm**3")
 
 add_castro_field("eden", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("eden")],
-                 units=r"\rm{erg}/\rm{cm}^3")
+                 units="erg/cm**3")
 
 add_castro_field("xmom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("xmom")],
-                 units=r"\rm{g}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 add_castro_field("ymom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("ymom")],
-                 units=r"\rm{gm}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 add_castro_field("zmom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("zmom")],
-                 units=r"\rm{g}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 # Now populate derived fields
 for mine, theirs in translation_dict.items():
@@ -92,21 +89,21 @@
     return data["xmom"] / data["density"]
 
 add_field("x-velocity", function=_xVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _yVelocity(field, data):
     """ Generate y-velocity from y-momentum and density. """
     return data["ymom"] / data["density"]
 
 add_field("y-velocity", function=_yVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _zVelocity(field, data):
     """ Generate z-velocity from z-momentum and density. """
     return data["zmom"] / data["density"]
 
 add_field("z-velocity", function=_zVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _ThermalEnergy(field, data):
     """
@@ -124,7 +121,7 @@
         + data["z-velocity"]**2.0 )
 
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units=r"\rm{ergs}/\rm{cm^3}")
+          units="ergs/cm**3")
 
 def _Pressure(field, data):
     """
@@ -135,13 +132,13 @@
     """
     return (data.pf["Gamma"] - 1.0) * data["ThermalEnergy"]
 
-add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+add_field("Pressure", function=_Pressure, units="dyne/cm**2")
 
 def _Temperature(field, data):
     return ((data.pf["Gamma"] - 1.0) * data.pf["mu"] * mh *
             data["ThermalEnergy"] / (kboltz * data["Density"]))
 
-add_field("Temperature", function=_Temperature, units=r"\rm{Kelvin}",
+add_field("Temperature", function=_Temperature, units="K",
           take_log=False)
 
 def _convertParticleMassMsun(data):

diff -r 280a525e534f7fcf4df36c3a92be102c59f158bc -r f5a88cdfeaf95bb3b9fceca392a310406108509d yt/frontends/chombo/fields.py
--- a/yt/frontends/chombo/fields.py
+++ b/yt/frontends/chombo/fields.py
@@ -43,49 +43,39 @@
 
 add_chombo_field("density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("density")],
-                 units=r"\rm{g}/\rm{cm}^3")
-
-KnownChomboFields["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+                 units="g/cm**3")
 
 add_chombo_field("X-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("X-Momentum")],
-                 units=r"",display_name=r"M_x")
-KnownChomboFields["X-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_x")
 
 add_chombo_field("Y-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Y-Momentum")],
-                 units=r"",display_name=r"M_y")
-KnownChomboFields["Y-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_y")
 
 add_chombo_field("Z-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Z-Momentum")],
-                 units=r"",display_name=r"M_z")
-KnownChomboFields["Z-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_z")
 
 add_chombo_field("X-magnfield", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("X-Magnfield")],
-                 units=r"",display_name=r"B_x")
-KnownChomboFields["X-magnfield"]._projected_units=r""
+                 units="gauss",display_name=r"B_x")
 
 add_chombo_field("Y-magnfield", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Y-Magnfield")],
-                 units=r"",display_name=r"B_y")
-KnownChomboFields["Y-magnfield"]._projected_units=r""
+                 units="gauss",display_name=r"B_y")
 
 add_chombo_field("Z-magnfield", function=NullFunc, take_log=False,
                   validators = [ValidateDataField("Z-Magnfield")],
-                  units=r"",display_name=r"B_z")
-KnownChomboFields["Z-magnfield"]._projected_units=r""
+                  units="gauss",display_name=r"B_z")
 
 add_chombo_field("energy-density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("energy-density")],
-                 units=r"\rm{erg}/\rm{cm}^3")
-KnownChomboFields["energy-density"]._projected_units =r""
+                 units="erg/cm**3")
 
 add_chombo_field("radiation-energy-density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("radiation-energy-density")],
-                 units=r"\rm{erg}/\rm{cm}^3")
-KnownChomboFields["radiation-energy-density"]._projected_units =r""
+                 units="erg/cm**3")
 
 def _Density(field,data):
     """A duplicate of the density field. This is needed because when you try 
@@ -96,36 +86,35 @@
     """
     return data["density"]
 add_field("Density",function=_Density, take_log=True,
-          units=r'\rm{g}/\rm{cm^3}')
+          units='g/cm**3')
 
 def _Bx(field,data):
     return data["X-magnfield"]
 add_field("Bx", function=_Bx, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_x")
+          units="gauss", display_name=r"B_x")
 
 def _By(field,data):
     return data["Y-magnfield"]
 add_field("By", function=_By, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_y")
+          units="gauss", display_name=r"B_y")
 
 def _Bz(field,data):
     return data["Z-magnfield"]
 add_field("Bz", function=_Bz, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_z")
+          units="gauss", display_name=r"B_z")
 
 def _MagneticEnergy(field,data):
     return (data["X-magnfield"]**2 +
             data["Y-magnfield"]**2 +
             data["Z-magnfield"]**2)/2.
 add_field("MagneticEnergy", function=_MagneticEnergy, take_log=True,
-          units=r"", display_name=r"B^2 / 8 \pi")
-ChomboFieldInfo["MagneticEnergy"]._projected_units=r""
+          units=r"erg/cm**3", display_name=r"B^2 / 8 \pi")
 
 def _xVelocity(field, data):
     """ Generate x-velocity from x-momentum and density. """
     return data["X-momentum"]/data["density"]
 add_field("x-velocity",function=_xVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _yVelocity(field,data):
     """ Generate y-velocity from y-momentum and density. """
@@ -134,13 +123,13 @@
     #except KeyError:
     return data["Y-momentum"]/data["density"]
 add_field("y-velocity",function=_yVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _zVelocity(field,data):
     """ Generate z-velocity from z-momentum and density. """
     return data["Z-momentum"]/data["density"]
 add_field("z-velocity",function=_zVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def particle_func(p_field, dtype='float64'):
     def _Particles(field, data):

diff -r 280a525e534f7fcf4df36c3a92be102c59f158bc -r f5a88cdfeaf95bb3b9fceca392a310406108509d yt/frontends/gdf/fields.py
--- a/yt/frontends/gdf/fields.py
+++ b/yt/frontends/gdf/fields.py
@@ -55,33 +55,31 @@
 KnownGDFFields = FieldInfoContainer()
 add_gdf_field = KnownGDFFields.add_field
 
-add_gdf_field("density", function=NullFunc, take_log=True,
-          units=r"\rm{g}/\rm{cm}^3",
-          projected_units =r"\rm{g}/\rm{cm}^2")
+add_gdf_field("density", function=NullFunc, take_log=True, units="g/cm**3")
 
 add_gdf_field("specific_energy", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg / g")
 
 add_gdf_field("pressure", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg/g")
 
 add_gdf_field("velocity_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 for f,v in log_translation_dict.items():
     add_field(f, TranslationFunc(v), take_log=True)

diff -r 280a525e534f7fcf4df36c3a92be102c59f158bc -r f5a88cdfeaf95bb3b9fceca392a310406108509d yt/frontends/orion/fields.py
--- a/yt/frontends/orion/fields.py
+++ b/yt/frontends/orion/fields.py
@@ -48,24 +48,23 @@
 
 add_orion_field("density", function=NullFunc, take_log=True,
                 validators = [ValidateDataField("density")],
-                units=r"\rm{g}/\rm{cm}^3")
-KnownOrionFields["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+                units="g/cm**3")
 
 add_orion_field("eden", function=NullFunc, take_log=True,
                 validators = [ValidateDataField("eden")],
-                units=r"\rm{erg}/\rm{cm}^3")
+                units="erg/cm**3")
 
 add_orion_field("xmom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("xmom")],
-                units=r"\rm{g}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
 add_orion_field("ymom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("ymom")],
-                units=r"\rm{gm}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
 add_orion_field("zmom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("zmom")],
-                units=r"\rm{g}/\rm{cm^2\ s}")
+                units="g/cm**2/s}")
 
 translation_dict = {"x-velocity": "xvel",
                     "y-velocity": "yvel",
@@ -93,7 +92,7 @@
     """
     return data["xmom"]/data["density"]
 add_orion_field("x-velocity",function=_xVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _yVelocity(field,data):
     """generate y-velocity from y-momentum and density
@@ -104,7 +103,7 @@
     #except KeyError:
     return data["ymom"]/data["density"]
 add_orion_field("y-velocity",function=_yVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _zVelocity(field,data):
     """generate z-velocity from z-momentum and density
@@ -112,7 +111,7 @@
     """
     return data["zmom"]/data["density"]
 add_orion_field("z-velocity",function=_zVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _ThermalEnergy(field, data):
     """generate thermal (gas energy). Dual Energy Formalism was
@@ -127,7 +126,7 @@
         + data["y-velocity"]**2.0
         + data["z-velocity"]**2.0 )
 add_field("ThermalEnergy", function=_ThermalEnergy,
-                units=r"\rm{ergs}/\rm{cm^3}")
+                units=r"ergs/cm**3")
 
 def _Pressure(field,data):
     """M{(Gamma-1.0)*e, where e is thermal energy density
@@ -138,7 +137,7 @@
 
 def _Temperature(field,data):
     return (data.pf["Gamma"]-1.0)*data.pf["mu"]*mh*data["ThermalEnergy"]/(kboltz*data["Density"])
-add_field("Temperature",function=_Temperature,units=r"\rm{Kelvin}",take_log=False)
+add_field("Temperature",function=_Temperature,units="K",take_log=False)
 
 # particle fields
 

diff -r 280a525e534f7fcf4df36c3a92be102c59f158bc -r f5a88cdfeaf95bb3b9fceca392a310406108509d yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -69,15 +69,14 @@
 
 def _convertDensity(data):
     return data.convert("Density")
-KnownRAMSESFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
-KnownRAMSESFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownRAMSESFields["Density"]._units = "g / cm**3"
 KnownRAMSESFields["Density"]._convert_function=_convertDensity
 
 def _convertVelocity(data):
     return data.convert("x-velocity")
 for ax in ['x','y','z']:
     f = KnownRAMSESFields["%s-velocity" % ax]
-    f._units = r"\rm{cm}/\rm{s}"
+    f._units = "cm / s"
     f._convert_function = _convertVelocity
     f.take_log = False
 

diff -r 280a525e534f7fcf4df36c3a92be102c59f158bc -r f5a88cdfeaf95bb3b9fceca392a310406108509d yt/geometry/setup.py
--- a/yt/geometry/setup.py
+++ b/yt/geometry/setup.py
@@ -16,8 +16,8 @@
                          "yt/geometry/selection_routines.pxd"])
     config.add_extension("selection_routines", 
                 ["yt/geometry/selection_routines.pyx"],
-                extra_compile_args=['-fopenmp'],
-                extra_link_args=['-fopenmp'],
+                #extra_compile_args=['-fopenmp'],
+                #extra_link_args=['-fopenmp'],
                 include_dirs=["yt/utilities/lib/"],
                 libraries=["m"],
                 depends=["yt/utilities/lib/fp_utils.pxd",

diff -r 280a525e534f7fcf4df36c3a92be102c59f158bc -r f5a88cdfeaf95bb3b9fceca392a310406108509d yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -129,9 +129,7 @@
                 depends=["yt/utilities/lib/freetype_includes.h"])
     config.add_extension("geometry_utils", 
                 ["yt/utilities/lib/geometry_utils.pyx"],
-               extra_compile_args=['-fopenmp'],
-               extra_link_args=['-fopenmp'],
-                libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
+                 libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
     config.add_extension("Interpolators", 
                 ["yt/utilities/lib/Interpolators.pyx"],
                 libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
@@ -197,8 +195,6 @@
                  glob.glob("yt/utilities/lib/healpix_*.c"), 
                include_dirs=["yt/utilities/lib/"],
                libraries=["m"], 
-               extra_compile_args=['-fopenmp'],
-               extra_link_args=['-fopenmp'],
                depends = ["yt/utilities/lib/VolumeIntegrator.pyx",
                           "yt/utilities/lib/fp_utils.pxd",
                           "yt/utilities/lib/kdtree.h",


https://bitbucket.org/yt_analysis/yt/commits/65fd4d10e701/
Changeset:   65fd4d10e701
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 01:47:01
Summary:     Updating maestro frontend to symbolic units. Some extra cleanup.
Affected #:  1 file

diff -r 19ea28fbfa3792779869e37eb41100427a2cc03f -r 65fd4d10e701cbf533b528e447ea26c04e877f8f yt/frontends/maestro/fields.py
--- a/yt/frontends/maestro/fields.py
+++ b/yt/frontends/maestro/fields.py
@@ -44,20 +44,20 @@
 
 add_field("density", function=lambda a,b: None, take_log=True,
           validators = [ValidateDataField("density")],
-          units=r"\rm{g}/\rm{cm}^3")
-MaestroFieldInfo["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+          units="g/cm**3")
 
-translation_dict = {"x-velocity": "x_vel",
-                    "y-velocity": "y_vel",
-                    "z-velocity": "z_vel",
-                    "Density": "density",
-                    "Temperature": "tfromp"
-                   }
+translation_dict = {
+    "x-velocity": "x_vel",
+    "y-velocity": "y_vel",
+    "z-velocity": "z_vel",
+    "Density":    "density",
+    "Temperature": "tfromp"
+}
 
 def _generate_translation(mine, theirs):
     add_field(theirs, function=lambda a, b: b[mine], take_log=True)
 
-for f,v in translation_dict.items():
+for f, v in translation_dict.items():
     if v not in MaestroFieldInfo:
         add_field(v, function=lambda a,b: None, take_log=False,
                   validators = [ValidateDataField(v)])


https://bitbucket.org/yt_analysis/yt/commits/c69f0b1ea25b/
Changeset:   c69f0b1ea25b
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 01:47:23
Summary:     Updating nyx frontend to symbolic units. Some extra cleanup.
Affected #:  1 file

diff -r 65fd4d10e701cbf533b528e447ea26c04e877f8f -r c69f0b1ea25b2dc846c91d2a101b346b3b05f3b5 yt/frontends/nyx/fields.py
--- a/yt/frontends/nyx/fields.py
+++ b/yt/frontends/nyx/fields.py
@@ -39,18 +39,21 @@
 add_field = NyxFieldInfo.add_field
 
 KnownNyxFields = FieldInfoContainer()
-add_nyx_field = KnownNyxFields.add_field 
+add_nyx_field = KnownNyxFields.add_field
+
+#
+# Constants
+#
+
+# BEWARE hardcoded, uniform gamma value
+nyx_gamma = 5.0 / 3.0
 
 # Density
 add_nyx_field("density", function=lambda a, b: None, take_log=True,
-          validators=[ValidateDataField("density")],
-          units=r"\rm{g} / \rm{cm}^3",
-          projected_units =r"\rm{g} / \rm{cm}^2")
-KnownNyxFields["density"]._projected_units =r"\rm{g} / \rm{cm}^2"
+              validators=[ValidateDataField("density")], units="g/cm**3")
 
 add_field("Density", function=TranslationFunc("density"), take_log=True,
-          units=r"\rm{g} / \rm{cm}^3",
-          projected_units =r"\rm{g} / \rm{cm}^2")
+          units="g/cm**3")
 
 # Particle mass in units of $ M_{\odot}
 def _convertParticleMassMsun(data):
@@ -60,53 +63,42 @@
 add_field("ParticleMassMsun", function=_particle_mass_m_sun,
           validators=[ValidateSpatial(0), ValidateDataField("particle_mass")],
           particle_type=True, convert_function=_convertParticleMassMsun,
-          take_log=True, units=r"\rm{M_{\odot}}")
-          
-add_nyx_field("Dark_Matter_Density", function=TranslationFunc("particle_mass_density"),
-          take_log=True,
-          units=r"\rm{g} / \rm{cm}^3",particle_type=True,
-          projected_units =r"\rm{g} / \rm{cm}^2")
+          take_log=True, units="Msun")
 
+add_nyx_field("Dark_Matter_Density",
+              function=TranslationFunc("particle_mass_density"),
+              take_log=True, particle_type=True, units="g/cm**3")
 
-# Energy Density
-# @todo: ``energy_density``
-add_nyx_field("total_energy", function=lambda a, b: None, take_log=True,
-          validators=[ValidateDataField("total_energy")],
-          units=r"\rm{M_{\odot}} (\rm{km} / \rm{s})^2")
 
-# Momentum in each dimension.
-# @todo: ``momentum_x``
-add_nyx_field("x-momentum", function=lambda a, b: None, take_log=False,
-          validators=[ValidateDataField("x-momentum")],
-          units=r"\rm{M_{\odot}} \rm{km} / \rm{s}")
-add_nyx_field("y-momentum", function=lambda a, b: None, take_log=False,
-          validators=[ValidateDataField("y-momentum")],
-          units=r"\rm{M_{\odot}} \rm{km} / \rm{s}")
-add_nyx_field("z-momentum", function=lambda a, b: None, take_log=False,
-          validators=[ValidateDataField("z-momentum")],
-          units=r"\rm{M_{\odot}} \rm{km} / \rm{s}")
+add_nyx_field("energy_density", function=lambda a, b: None, take_log=True,
+              validators=[ValidateDataField("total_energy")],
+              units="Msun * (km / s)**2")
+
+add_nyx_field("momentum_x", function=lambda a, b: None, take_log=False,
+              validators=[ValidateDataField("x-momentum")], units="Msun*km/s")
+add_nyx_field("momentum_y", function=lambda a, b: None, take_log=False,
+              validators=[ValidateDataField("y-momentum")], units="Msun*km/s")
+add_nyx_field("momentum_z", function=lambda a, b: None, take_log=False,
+              validators=[ValidateDataField("z-momentum")], units="Msun*km/s")
 
 ### Now derived fields
 
 # Velocity fields in each dimension
 # @todo: ``velocity_x``
-def _x_velocity(field, data):
+def _velocity_x(field, data):
     """ Generate x-velocity from x-momentum and density. """
-    return data["x-momentum"] / data["density"]
-add_field("x-velocity", function=_x_velocity, take_log=False,
-          units=r"\rm{km} / \rm{s}")
+    return data["momentum_x"] / data["density"]
+add_field("velocity_x", function=_velocity_x, take_log=False, units="km/s")
 
-def _y_velocity(field, data):
+def _velocity_y(field, data):
     """ Generate y-velocity from y-momentum and density. """
-    return data["y-momentum"] / data["density"]
-add_field("y-velocity", function=_y_velocity, take_log=False,
-          units=r"\rm{km} / \rm{s}")
+    return data["momentum_y"] / data["density"]
+add_field("velocity_y", function=_velocity_y, take_log=False, units="km/s")
 
-def _z_velocity(field, data):
+def _velocity_z(field, data):
     """ Generate z-velocity from z-momentum and density. """
-    return data["z-momentum"] / data["density"]
-add_field("z-velocity", function=_z_velocity, take_log=False,
-          units=r"\rm{km} / \rm{s}")
+    return data["momentum_z"] / data["density"]
+add_field("velocity_z", function=_velocity_z, take_log=False, units="km/s")
 
 # The gas **thermal** energy.
 # @todo: should be called ``gas_energy`` whether it is data or derived
@@ -120,12 +112,11 @@
     #if data.pf["DualEnergyFormalism"]:
     #    return data["Gas_Energy"]
     #else:
-    return data["Total_Energy"] - 0.5 * data["density"] * (
-                                          data["x-velocity"]**2.0
-                                        + data["y-velocity"]**2.0
-                                        + data["z-velocity"]**2.0 )
-add_field("ThermalEnergy", function=_thermal_energy,
-          units=r"\rm{M_{\odot}} (\rm{km} / \rm{s})^2")
+    return ( data["total_energy"]
+             - 0.5 * data["density"] * (   data["velocity_x"]**2.0
+                                         + data["velocity_y"]**2.0
+                                         + data["velocity_z"]**2.0 ) )
+add_field("thermal_energy", function=_thermal_energy, units="Msun*(km/s)**2")
 
 # Gas pressure
 # @todo: eventually figure out a way to detect when using radiation and change
@@ -140,14 +131,13 @@
     when radiation is accounted for.
 
     """
-    return (data.pf["Gamma"] - 1.0) * data["ThermalEnergy"]
-add_field("Pressure", function=_pressure,
-          units=r"\rm{M_{\odot}} (\rm{km} / \rm{s})^2 / \rm{Mpc}^3")
+    return (nyx_gamma - 1.0) * data["ThermalEnergy"]
+
+add_field("pressure", function=_pressure, units="Msun*(km/s)**2/Mpc**3")
 
 # Gas temperature
 def _temperature(field, data):
-    return ((data.pf["Gamma"] - 1.0) * data.pf["mu"] * mh *
-            data["ThermalEnergy"] / (kboltz * data["Density"]))
-add_field("Temperature", function=_temperature, take_log=False,
-          units=r"\rm{Kelvin}")
+    return (gamma - 1.0) * data.pf["mu"] * mh *
+            data["thermal_energy"] / (kboltz * data["density"]))
+add_field("temperature", function=_temperature, take_log=False, units="K")
 


https://bitbucket.org/yt_analysis/yt/commits/4bb126b87f7c/
Changeset:   4bb126b87f7c
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 01:48:43
Summary:     Merging.
Affected #:  1 file

diff -r c69f0b1ea25b2dc846c91d2a101b346b3b05f3b5 -r 4bb126b87f7c5c57be15ea33cb215fb120188c9b yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -24,25 +24,36 @@
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 """
 
+import copy
 
 import numpy as np
 
 from yt.utilities.units import Unit
 
-class UnitArray(np.ndarray):
+class UnitOperationError(Exception):
+    pass
+
+class YTArray(np.ndarray):
     """
 
     """
-    def __new__(cls, input_array, units=None):
+    def __new__(cls, input_array, input_units=None):
         # Input array is an already formed ndarray instance
         # We first cast to be our class type
         obj = np.asarray(input_array).view(cls)
 
         # Check units type
-        if units is None:
+        if input_units is None:
+            # Nothing provided. Make dimensionless...
             units = Unit()
-        if not isinstance(units, Unit):
-            units = Unit(units)
+        else if isinstance(input_units, Unit):
+            # input_units is already a Unit, but let's be safe and make a copy.
+            units = copy.copy(input_units)
+        else:
+            # units kwarg set, but it's not a Unit object.
+            # don't handle all the cases here, let the Unit class handle if
+            # it's a str.
+            units = Unit(input_units)
 
         # Attach the units
         obj.units = units
@@ -50,12 +61,405 @@
         return obj
 
     def __array_finalize__(self, obj):
-        # see InfoArray.__array_finalize__ for comments
-        if obj is None: return
-        self.units = getattr(obj, 'units', None)
-
-    def convert_to(self, new_units):
         """
 
         """
-        cf = self.units.get_conversion_factor(new_units)
+        if obj is None:
+            return
+        self.units = getattr(obj, 'units', None)
+
+    #
+    # Start unit conversion methods
+    #
+
+    def _unit_repr_check_same(self, units):
+        """
+        Takes a Unit object, or string of known unit symbol, and check that it
+        is compatible with this quantity. Returns Unit object.
+
+        """
+        if not isinstance(units, Unit):
+            units = Unit(units)
+
+        if not self.units.same_dimensions_as(units):
+            raise Exception("Cannot convert to units with different dimensionality. Current unit is %s, argument is %s" % (self.units.dimensions, units))
+
+        return units
+
+    def convert_to(self, units):
+        """
+        Convert the data and units to given unit. This overwrites the ``data``
+        and ``units`` attributes, making no copies, and returns None.
+
+        Parameters
+        ----------
+        units : Unit object or string
+            The units you want the data in.
+
+        """
+        new_units = self._unit_repr_check_same(units)
+        conversion_factor = get_conversion_factor(self.units, new_units)
+        self.data *= conversion_factor
+        self.units = new_units
+
+        return self
+
+    def convert_to_cgs(self):
+        """
+        Convert the data and units to the equivalent cgs units. This overwrites
+        the ``data`` and ``units`` attributes, making no copies, and returns
+        None.
+
+        """
+        return self.convert_to(self.units.get_cgs_equivalent())
+
+    def get_in(self, units):
+        """
+        Creates a new Quantity with the data in the supplied units, and returns
+        it. Does not modify this object.
+
+        Parameters
+        ----------
+        units : Unit object or string
+            The units you want to get a new quantity in.
+
+        Returns
+        -------
+        Quantity object with converted data and supplied units.
+
+        """
+        new_units = self._unit_repr_check_same(units)
+        conversion_factor = get_conversion_factor(self.units, new_units)
+
+        return Quantity(self.data * conversion_factor, new_units)
+
+    def get_in_cgs(self):
+        """
+        Creates a new Quantity with the data in the equivalent cgs units, and
+        returns it. Does not modify this object.
+
+        Returns
+        -------
+        Quantity object with data converted to cgs and cgs units.
+
+        """
+        return self.get_in(self.units.get_cgs_equivalent())
+
+    def get_data_in(self, units):
+        """
+        Returns the data, converted to the supplied units.
+
+        Parameters
+        ----------
+        units : Unit object or string
+            The units you want the data in.
+
+        Returns
+        -------
+        ``data`` attribute, multiplied by the conversion factor to the supplied
+        units.
+
+        """
+        new_units = self._unit_repr_check_same(units)
+
+        # don't operate on data if given the same units
+        if self.units == new_units:
+            return self.data
+
+        conversion_factor = get_conversion_factor(self.units, new_units)
+
+        return self.data * conversion_factor
+
+    def get_data_in_cgs(self):
+        """
+        Returns the data, multiplied by the conversion factor to cgs.
+
+        """
+        return self.get_data_in(self.units.get_cgs_equivalent())
+
+    #
+    # End unit conversion methods
+    #
+
+    #
+    # Start operation methods
+    #
+
+    def __add__(self, right_object):
+        """
+        Add this ytarray to the object on the right of the `+` operator. Must
+        check for the correct (same dimension) units.
+
+        """
+        if isinstance(right_object, YTArray):
+            # make sure it's a quantity before we check units attribute
+            if not self.units.has_same_dimensions_as(right_object.units):
+                raise UnitOperationError("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (self.units, right_object.units))
+        else:
+            # the only way this works is with a float so...
+            if not self.units.is_dimensionless:
+                raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (self, right_object))
+
+            # case of dimensionless self + float
+            return Quantity(self.data + right_object, self.units)
+
+        # `get_data_in` will not apply the conversion if the units are the same
+        return Quantity(self.data + right_object.get_data_in(self.units),
+                        self.units)
+
+    def __radd__(self, left_object):
+        """
+        Add this quantity to the object on the left of the `+` operator. Must
+        check for the correct (same dimension) units. If the quantities have
+        different units, we always use the units on the left.
+
+        """
+        if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
+            if not self.units.same_dimensions_as(left_object.units):
+                raise Exception("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (left_object.units, self.units))
+        else:  # the only way this works is with a float so...
+            if not self.units.is_dimensionless:
+                raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (left_object, self))
+
+            # case of dimensionless float + self
+            return Quantity(left_object + self.data, self.units)
+
+        # `get_data_in` will not apply the conversion if the units are the same
+        return Quantity((left_object.data
+                         + self.get_data_in(left_object.units)),
+                        left_object.units)
+
+    def __sub__(self, right_object):
+        """
+        Subtract the object on the right of the `-` from this quantity. Must
+        check for the correct (same dimension) units. If the quantities have
+        different units, we always use the units on the left.
+
+        """
+        if isinstance(right_object, Quantity):  # make sure it's a quantity before we check units attribute
+            if not self.units.same_dimensions_as(right_object.units):
+                raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (self.units, right_object.units))
+        else:  # the only way this works is with a float so...
+            if not self.units.is_dimensionless:
+                raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (self, right_object))
+
+            # case of dimensionless self + float
+            return Quantity(self.data - right_object, self.units)
+
+        # `get_data_in` will not apply the conversion if the units are the same
+        return Quantity(self.data - right_object.get_data_in(self.units),
+                        self.units)
+
+    def __rsub__(self, left_object):
+        """
+        Subtract this quantity from the object on the left of the `-` operator.
+        Must check for the correct (same dimension) units. If the quantities
+        have different units, we always use the units on the left.
+
+        """
+        if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
+            if not self.units.same_dimensions_as(left_object.units):
+                raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (left_object.units, self.units))
+        else:  # the only way this works is with a float so...
+            if not self.units.is_dimensionless:
+                raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (left_object, self))
+
+            # case of dimensionless float + self
+            return Quantity(left_object - self.data, self.units)
+
+        # `get_data_in` will not apply the conversion if the units are the same
+        return Quantity((left_object.data
+                         - self.get_data_in(left_object.units)),
+                        left_object.units)
+
+    def __neg__(self):
+        """ Negate the data. """
+        return Quantity(-self.data, self.units)
+
+    def __mul__(self, right_object):
+        """
+        Multiply this quantity by the object on the right of the `*` operator.
+        The unit objects handle being multiplied by each other.
+
+        """
+        if isinstance(right_object, Quantity):
+            return Quantity(self.data * right_object.data,
+                            self.units * right_object.units)
+
+        # `right_object` is not a Quantity object, so try to use it as
+        # dimensionless data.
+        return Quantity(self.data * right_object, self.units)
+
+    def __rmul__(self, left_object):
+        """
+        Multiply this quantity by the object on the left of the `*` operator.
+        The unit objects handle being multiplied by each other.
+
+        """
+        if isinstance(left_object, Quantity):
+            return Quantity(left_object.data * self.data,
+                            left_object.units * self.units)
+
+        # `left_object` is not a Quantity object, so try to use it as
+        # dimensionless data.
+        return Quantity(left_object * self.data, self.units)
+
+    def __div__(self, right_object):
+        """
+        Divide this quantity by the object on the right of the `/` operator. The
+        unit objects handle being divided by each other.
+
+        """
+        if isinstance(right_object, Quantity):
+            return Quantity(self.data / right_object.data,
+                            self.units / right_object.units)
+
+        # `right_object` is not a Quantity object, so try to use it as
+        # dimensionless data.
+        return Quantity(self.data / right_object, self.units)
+
+    def __rdiv__(self, left_object):
+        """
+        Divide the object on the left of the `/` operator by this quantity. The
+        unit objects handle being divided by each other.
+
+        """
+        if isinstance(left_object, Quantity):
+            return Quantity(left_object.data / self.data,
+                            left_object.units / self.units)
+
+        # `left_object` is not a Quantity object, so try to use it as
+        # dimensionless data.
+        return Quantity(left_object / self.data, self.units**(-1))
+
+    def __pow__(self, power):
+        """
+        Raise this quantity to some power.
+
+        Parameters
+        ----------
+        power : float or dimensionless Quantity object
+            The pow value.
+
+        """
+        if isinstance(power, Quantity):
+            if power.units.is_dimensionless:
+                return Quantity(self.data**power.data, self.units**power.data)
+            else:
+                raise Exception("The power argument must be dimensionless. (%s)**(%s) is ill-defined." % (self, power))
+
+        return Quantity(self.data**power, self.units**power)
+
+    def __abs__(self):
+        """ Return a Quantity with the abs of the data. """
+        return Quantity(abs(self.data), self.units)
+
+    def sqrt(self):
+        """
+        Return sqrt of this Quantity. This is just a wrapper of Quantity.__pow__
+        for numpy.sqrt.
+
+        """
+        return self**(1.0/2)
+
+    def exp(self):
+        """
+        Return exp of this Quantity. Ensures that Quantity is dimensionless,
+        like __pow__.
+
+        """
+        if not self.units.is_dimensionless:
+            raise Exception("The argument of an exponential must be dimensionless. exp(%s) is ill-defined." % self)
+
+        try:
+            from numpy import exp
+        except ImportError:
+            raise Exception("This method requires the numpy package. Please install it before calling exp(Quantity)")
+
+        return exp(self.data)
+
+    ### comparison operators
+    # @todo: outsource to a single method with an op argument.
+    def __lt__(self, right_object):
+        """ Test if this is less than the object on the right. """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s < %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data < right_object.get_data_in(self.units):
+            return True
+        return False
+
+    def __le__(self, right_object):
+        """ Test if this is less than or equal to the object on the right. """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s <= %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data <= right_object.get_data_in(self.units):
+            return True
+        return False
+
+    def __eq__(self, right_object):
+        """ Test if this is equal to the object on the right. """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s == %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data == right_object.get_data_in(self.units):
+            return True
+        return False
+
+    def __ne__(self, right_object):
+        """ Test if this is not equal to the object on the right. """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s != %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data != right_object.get_data_in(self.units):
+            return True
+        return False
+
+    def __ge__(self, right_object):
+        """
+        Test if this is greater than or equal to the object on the right.
+
+        """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s >= %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data >= right_object.get_data_in(self.units):
+            return True
+        return False
+
+    def __gt__(self, right_object):
+        """ Test if this is greater than the object on the right. """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s > %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data > right_object.get_data_in(self.units):
+            return True
+        return False
+
+
+


https://bitbucket.org/yt_analysis/yt/commits/d3edeb0707bc/
Changeset:   d3edeb0707bc
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 01:51:18
Summary:     Merging
Affected #:  9 files

diff -r 4bb126b87f7c5c57be15ea33cb215fb120188c9b -r d3edeb0707bca050eeefd1af7cbcc71d781dd98e scripts/iyt
--- a/scripts/iyt
+++ b/scripts/iyt
@@ -2,7 +2,7 @@
 import os, re
 from distutils import version
 from yt.mods import *
-from yt.data_objects.data_containers import AMRData
+from yt.data_objects.data_containers import YTDataContainer
 namespace = locals().copy()
 namespace.pop("__builtins__", None)
 
@@ -116,7 +116,7 @@
         except:
             raise IPython.ipapi.TryNext 
         
-    if isinstance(obj, (AMRData, ) ):
+    if isinstance(obj, (YTDataContainer, ) ):
         #print "COMPLETING ON THIS THING"
         all_fields = [f for f in sorted(
                 obj.pf.h.field_list + obj.pf.h.derived_field_list)]

diff -r 4bb126b87f7c5c57be15ea33cb215fb120188c9b -r d3edeb0707bca050eeefd1af7cbcc71d781dd98e yt/frontends/art/fields.py
--- a/yt/frontends/art/fields.py
+++ b/yt/frontends/art/fields.py
@@ -89,30 +89,26 @@
 
 def _convertDensity(data):
     return data.convert("Density")
-KnownARTFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["Density"]._units = "g/cm**3"
 KnownARTFields["Density"]._convert_function=_convertDensity
 
 def _convertTotalEnergy(data):
     return data.convert("GasEnergy")
-KnownARTFields["TotalEnergy"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["TotalEnergy"]._projected_units = r"\rm{K}"
+KnownARTFields["TotalEnergy"]._units = "g/cm**3"
 KnownARTFields["TotalEnergy"]._convert_function=_convertTotalEnergy
 
 def _convertXMomentumDensity(data):
     tr  = data.convert("Mass")*data.convert("Velocity")
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
-KnownARTFields["XMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["XMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["XMomentumDensity"]._units = "g/s/cm**3"
 KnownARTFields["XMomentumDensity"]._convert_function=_convertXMomentumDensity
 
 def _convertYMomentumDensity(data):
     tr  = data.convert("Mass")*data.convert("Velocity")
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
-KnownARTFields["YMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["YMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["YMomentumDensity"]._units = "g/s/cm**3"
 KnownARTFields["YMomentumDensity"]._convert_function=_convertYMomentumDensity
 
 def _convertZMomentumDensity(data):
@@ -120,49 +116,41 @@
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
 KnownARTFields["ZMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["ZMomentumDensity"]._projected_units = r"\rm{K}"
 KnownARTFields["ZMomentumDensity"]._convert_function=_convertZMomentumDensity
 
 def _convertPressure(data):
     return data.convert("Pressure")
-KnownARTFields["Pressure"]._units = r"\rm{g}/\rm{cm}/\rm{s}^2"
-KnownARTFields["Pressure"]._projected_units = r"\rm{g}/\rm{s}^2"
+KnownARTFields["Pressure"]._units = "g/cm/s**2"
 KnownARTFields["Pressure"]._convert_function=_convertPressure
 
 def _convertGamma(data):
     return 1.0
-KnownARTFields["Gamma"]._units = r""
-KnownARTFields["Gamma"]._projected_units = r""
+KnownARTFields["Gamma"]._units = ""
 KnownARTFields["Gamma"]._convert_function=_convertGamma
 
 def _convertGasEnergy(data):
     return data.convert("GasEnergy")
-KnownARTFields["GasEnergy"]._units = r"\rm{ergs}/\rm{g}"
-KnownARTFields["GasEnergy"]._projected_units = r""
+KnownARTFields["GasEnergy"]._units = "erg/g"
 KnownARTFields["GasEnergy"]._convert_function=_convertGasEnergy
 
 def _convertMetalDensitySNII(data):
     return data.convert('Density')
-KnownARTFields["MetalDensitySNII"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["MetalDensitySNII"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["MetalDensitySNII"]._units = "g/cm**3"
 KnownARTFields["MetalDensitySNII"]._convert_function=_convertMetalDensitySNII
 
 def _convertMetalDensitySNIa(data):
     return data.convert('Density')
-KnownARTFields["MetalDensitySNIa"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["MetalDensitySNIa"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["MetalDensitySNIa"]._units = "g/cm**3"
 KnownARTFields["MetalDensitySNIa"]._convert_function=_convertMetalDensitySNIa
 
 def _convertPotentialNew(data):
     return data.convert("Potential")
-KnownARTFields["PotentialNew"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["PotentialNew"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["PotentialNew"]._units = "g/cm**3"
 KnownARTFields["PotentialNew"]._convert_function=_convertPotentialNew
 
 def _convertPotentialOld(data):
     return data.convert("Potential")
-KnownARTFields["PotentialOld"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["PotentialOld"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["PotentialOld"]._units = "g/cm**3"
 KnownARTFields["PotentialOld"]._convert_function=_convertPotentialOld
 
 ####### Derived fields
@@ -185,38 +173,33 @@
     #x = data.pf.conversion_factors["Temperature"]
     x = 1.0
     return x
-add_field("Temperature", function=_temperature, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Temperature"]._units = r"\mathrm{K}"
-ARTFieldInfo["Temperature"]._projected_units = r"\mathrm{K}"
+add_field("Temperature", function=_temperature, units = "K",take_log=True)
+ARTFieldInfo["Temperature"]._units = "K"
 #ARTFieldInfo["Temperature"]._convert_function=_converttemperature
 
 def _metallicity_snII(field, data):
     tr  = data["MetalDensitySNII"] / data["Density"]
     return tr
-add_field("Metallicity_SNII", function=_metallicity_snII, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity_SNII"]._units = r""
-ARTFieldInfo["Metallicity_SNII"]._projected_units = r""
+add_field("Metallicity_SNII", function=_metallicity_snII, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity_SNII"]._units = "Zsun"
 
 def _metallicity_snIa(field, data):
     tr  = data["MetalDensitySNIa"] / data["Density"]
     return tr
-add_field("Metallicity_SNIa", function=_metallicity_snIa, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity_SNIa"]._units = r""
-ARTFieldInfo["Metallicity_SNIa"]._projected_units = r""
+add_field("Metallicity_SNIa", function=_metallicity_snIa, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity_SNIa"]._units = "Zsun"
 
 def _metallicity(field, data):
     tr  = data["Metal_Density"] / data["Density"]
     return tr
-add_field("Metallicity", function=_metallicity, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity"]._units = r""
-ARTFieldInfo["Metallicity"]._projected_units = r""
+add_field("Metallicity", function=_metallicity, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity"]._units = "Zsun"
 
 def _x_velocity(field,data):
     tr  = data["XMomentumDensity"]/data["Density"]
     return tr
-add_field("x-velocity", function=_x_velocity, units = r"\mathrm{cm/s}",take_log=False)
-ARTFieldInfo["x-velocity"]._units = r"\rm{cm}/\rm{s}"
-ARTFieldInfo["x-velocity"]._projected_units = r"\rm{cm}/\rm{s}"
+add_field("x-velocity", function=_x_velocity, units = "cm/s",take_log=False)
+ARTFieldInfo["x-velocity"]._units = "cm/s"
 
 def _y_velocity(field,data):
     tr  = data["YMomentumDensity"]/data["Density"]
@@ -228,38 +211,36 @@
 def _z_velocity(field,data):
     tr  = data["ZMomentumDensity"]/data["Density"]
     return tr
-add_field("z-velocity", function=_z_velocity, units = r"\mathrm{cm/s}",take_log=False)
-ARTFieldInfo["z-velocity"]._units = r"\rm{cm}/\rm{s}"
-ARTFieldInfo["z-velocity"]._projected_units = r"\rm{cm}/\rm{s}"
+add_field("z-velocity", function=_z_velocity, units = "cm/s",take_log=False)
+ARTFieldInfo["z-velocity"]._units = "cm/s"
 
 def _metal_density(field, data):
     tr  = data["MetalDensitySNIa"]
     tr += data["MetalDensitySNII"]
     return tr
-add_field("Metal_Density", function=_metal_density, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metal_Density"]._units = r""
-ARTFieldInfo["Metal_Density"]._projected_units = r""
+add_field("Metal_Density", function=_metal_density, units = "Zsun",take_log=True)
+ARTFieldInfo["Metal_Density"]._units = "Zsun"
 
 
 #Particle fields
 
 def ParticleMass(field,data):
     return data['particle_mass']
-add_field("ParticleMass",function=ParticleMass,units=r"\rm{g}",particle_type=True)
+add_field("ParticleMass",function=ParticleMass,units="g",particle_type=True)
 
 
 #Derived particle fields
 
 def ParticleMassMsun(field,data):
     return data['particle_mass']*data.pf['Msun']
-add_field("ParticleMassMsun",function=ParticleMassMsun,units=r"\rm{g}",particle_type=True)
+add_field("ParticleMassMsun",function=ParticleMassMsun,units="g",particle_type=True)
 
 def _creation_time(field,data):
     pa = data["particle_age"]
     tr = np.zeros(pa.shape,dtype='float')-1.0
     tr[pa>0] = pa[pa>0]
     return tr
-add_field("creation_time",function=_creation_time,units=r"\rm{s}",particle_type=True)
+add_field("creation_time",function=_creation_time,units="s",particle_type=True)
 
 def mass_dm(field, data):
     tr = np.ones(data.ActiveDimensions, dtype='float32')
@@ -274,7 +255,7 @@
     else:
         return tr*1e-9
 
-add_field("particle_cell_mass_dm", function=mass_dm, units = r"\mathrm{M_{sun}}",
+add_field("particle_cell_mass_dm", function=mass_dm, units = "Msun",
         validators=[ValidateSpatial(0)],        
         take_log=False,
         projection_conversion="1")
@@ -303,3 +284,4 @@
 
 add_field("star_density", function=_simple_density,
           validators=[ValidateSpatial(0)], convert_function=_convertDensity)
+

diff -r 4bb126b87f7c5c57be15ea33cb215fb120188c9b -r d3edeb0707bca050eeefd1af7cbcc71d781dd98e yt/frontends/castro/fields.py
--- a/yt/frontends/castro/fields.py
+++ b/yt/frontends/castro/fields.py
@@ -59,26 +59,23 @@
 
 # Start adding fields
 add_castro_field("density", function=NullFunc, take_log=True,
-                 units=r"\rm{g}/\rm{cm}^3")
-
-# fix projected units
-KnownCastroFields["density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+                 units="g/cm**3")
 
 add_castro_field("eden", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("eden")],
-                 units=r"\rm{erg}/\rm{cm}^3")
+                 units="erg/cm**3")
 
 add_castro_field("xmom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("xmom")],
-                 units=r"\rm{g}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 add_castro_field("ymom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("ymom")],
-                 units=r"\rm{gm}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 add_castro_field("zmom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("zmom")],
-                 units=r"\rm{g}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 # Now populate derived fields
 for mine, theirs in translation_dict.items():
@@ -92,21 +89,21 @@
     return data["xmom"] / data["density"]
 
 add_field("x-velocity", function=_xVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _yVelocity(field, data):
     """ Generate y-velocity from y-momentum and density. """
     return data["ymom"] / data["density"]
 
 add_field("y-velocity", function=_yVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _zVelocity(field, data):
     """ Generate z-velocity from z-momentum and density. """
     return data["zmom"] / data["density"]
 
 add_field("z-velocity", function=_zVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _ThermalEnergy(field, data):
     """
@@ -124,7 +121,7 @@
         + data["z-velocity"]**2.0 )
 
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units=r"\rm{ergs}/\rm{cm^3}")
+          units="ergs/cm**3")
 
 def _Pressure(field, data):
     """
@@ -135,13 +132,13 @@
     """
     return (data.pf["Gamma"] - 1.0) * data["ThermalEnergy"]
 
-add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+add_field("Pressure", function=_Pressure, units="dyne/cm**2")
 
 def _Temperature(field, data):
     return ((data.pf["Gamma"] - 1.0) * data.pf["mu"] * mh *
             data["ThermalEnergy"] / (kboltz * data["Density"]))
 
-add_field("Temperature", function=_Temperature, units=r"\rm{Kelvin}",
+add_field("Temperature", function=_Temperature, units="K",
           take_log=False)
 
 def _convertParticleMassMsun(data):

diff -r 4bb126b87f7c5c57be15ea33cb215fb120188c9b -r d3edeb0707bca050eeefd1af7cbcc71d781dd98e yt/frontends/chombo/fields.py
--- a/yt/frontends/chombo/fields.py
+++ b/yt/frontends/chombo/fields.py
@@ -43,49 +43,39 @@
 
 add_chombo_field("density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("density")],
-                 units=r"\rm{g}/\rm{cm}^3")
-
-KnownChomboFields["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+                 units="g/cm**3")
 
 add_chombo_field("X-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("X-Momentum")],
-                 units=r"",display_name=r"M_x")
-KnownChomboFields["X-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_x")
 
 add_chombo_field("Y-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Y-Momentum")],
-                 units=r"",display_name=r"M_y")
-KnownChomboFields["Y-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_y")
 
 add_chombo_field("Z-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Z-Momentum")],
-                 units=r"",display_name=r"M_z")
-KnownChomboFields["Z-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_z")
 
 add_chombo_field("X-magnfield", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("X-Magnfield")],
-                 units=r"",display_name=r"B_x")
-KnownChomboFields["X-magnfield"]._projected_units=r""
+                 units="gauss",display_name=r"B_x")
 
 add_chombo_field("Y-magnfield", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Y-Magnfield")],
-                 units=r"",display_name=r"B_y")
-KnownChomboFields["Y-magnfield"]._projected_units=r""
+                 units="gauss",display_name=r"B_y")
 
 add_chombo_field("Z-magnfield", function=NullFunc, take_log=False,
                   validators = [ValidateDataField("Z-Magnfield")],
-                  units=r"",display_name=r"B_z")
-KnownChomboFields["Z-magnfield"]._projected_units=r""
+                  units="gauss",display_name=r"B_z")
 
 add_chombo_field("energy-density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("energy-density")],
-                 units=r"\rm{erg}/\rm{cm}^3")
-KnownChomboFields["energy-density"]._projected_units =r""
+                 units="erg/cm**3")
 
 add_chombo_field("radiation-energy-density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("radiation-energy-density")],
-                 units=r"\rm{erg}/\rm{cm}^3")
-KnownChomboFields["radiation-energy-density"]._projected_units =r""
+                 units="erg/cm**3")
 
 def _Density(field,data):
     """A duplicate of the density field. This is needed because when you try 
@@ -96,36 +86,35 @@
     """
     return data["density"]
 add_field("Density",function=_Density, take_log=True,
-          units=r'\rm{g}/\rm{cm^3}')
+          units='g/cm**3')
 
 def _Bx(field,data):
     return data["X-magnfield"]
 add_field("Bx", function=_Bx, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_x")
+          units="gauss", display_name=r"B_x")
 
 def _By(field,data):
     return data["Y-magnfield"]
 add_field("By", function=_By, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_y")
+          units="gauss", display_name=r"B_y")
 
 def _Bz(field,data):
     return data["Z-magnfield"]
 add_field("Bz", function=_Bz, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_z")
+          units="gauss", display_name=r"B_z")
 
 def _MagneticEnergy(field,data):
     return (data["X-magnfield"]**2 +
             data["Y-magnfield"]**2 +
             data["Z-magnfield"]**2)/2.
 add_field("MagneticEnergy", function=_MagneticEnergy, take_log=True,
-          units=r"", display_name=r"B^2 / 8 \pi")
-ChomboFieldInfo["MagneticEnergy"]._projected_units=r""
+          units=r"erg/cm**3", display_name=r"B^2 / 8 \pi")
 
 def _xVelocity(field, data):
     """ Generate x-velocity from x-momentum and density. """
     return data["X-momentum"]/data["density"]
 add_field("x-velocity",function=_xVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _yVelocity(field,data):
     """ Generate y-velocity from y-momentum and density. """
@@ -134,13 +123,13 @@
     #except KeyError:
     return data["Y-momentum"]/data["density"]
 add_field("y-velocity",function=_yVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _zVelocity(field,data):
     """ Generate z-velocity from z-momentum and density. """
     return data["Z-momentum"]/data["density"]
 add_field("z-velocity",function=_zVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def particle_func(p_field, dtype='float64'):
     def _Particles(field, data):

diff -r 4bb126b87f7c5c57be15ea33cb215fb120188c9b -r d3edeb0707bca050eeefd1af7cbcc71d781dd98e yt/frontends/gdf/fields.py
--- a/yt/frontends/gdf/fields.py
+++ b/yt/frontends/gdf/fields.py
@@ -55,33 +55,31 @@
 KnownGDFFields = FieldInfoContainer()
 add_gdf_field = KnownGDFFields.add_field
 
-add_gdf_field("density", function=NullFunc, take_log=True,
-          units=r"\rm{g}/\rm{cm}^3",
-          projected_units =r"\rm{g}/\rm{cm}^2")
+add_gdf_field("density", function=NullFunc, take_log=True, units="g/cm**3")
 
 add_gdf_field("specific_energy", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg / g")
 
 add_gdf_field("pressure", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg/g")
 
 add_gdf_field("velocity_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 for f,v in log_translation_dict.items():
     add_field(f, TranslationFunc(v), take_log=True)

diff -r 4bb126b87f7c5c57be15ea33cb215fb120188c9b -r d3edeb0707bca050eeefd1af7cbcc71d781dd98e yt/frontends/orion/fields.py
--- a/yt/frontends/orion/fields.py
+++ b/yt/frontends/orion/fields.py
@@ -48,24 +48,23 @@
 
 add_orion_field("density", function=NullFunc, take_log=True,
                 validators = [ValidateDataField("density")],
-                units=r"\rm{g}/\rm{cm}^3")
-KnownOrionFields["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+                units="g/cm**3")
 
 add_orion_field("eden", function=NullFunc, take_log=True,
                 validators = [ValidateDataField("eden")],
-                units=r"\rm{erg}/\rm{cm}^3")
+                units="erg/cm**3")
 
 add_orion_field("xmom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("xmom")],
-                units=r"\rm{g}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
 add_orion_field("ymom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("ymom")],
-                units=r"\rm{gm}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
 add_orion_field("zmom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("zmom")],
-                units=r"\rm{g}/\rm{cm^2\ s}")
+                units="g/cm**2/s}")
 
 translation_dict = {"x-velocity": "xvel",
                     "y-velocity": "yvel",
@@ -93,7 +92,7 @@
     """
     return data["xmom"]/data["density"]
 add_orion_field("x-velocity",function=_xVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _yVelocity(field,data):
     """generate y-velocity from y-momentum and density
@@ -104,7 +103,7 @@
     #except KeyError:
     return data["ymom"]/data["density"]
 add_orion_field("y-velocity",function=_yVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _zVelocity(field,data):
     """generate z-velocity from z-momentum and density
@@ -112,7 +111,7 @@
     """
     return data["zmom"]/data["density"]
 add_orion_field("z-velocity",function=_zVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+                units='cm/s')
 
 def _ThermalEnergy(field, data):
     """generate thermal (gas energy). Dual Energy Formalism was
@@ -127,7 +126,7 @@
         + data["y-velocity"]**2.0
         + data["z-velocity"]**2.0 )
 add_field("ThermalEnergy", function=_ThermalEnergy,
-                units=r"\rm{ergs}/\rm{cm^3}")
+                units=r"ergs/cm**3")
 
 def _Pressure(field,data):
     """M{(Gamma-1.0)*e, where e is thermal energy density
@@ -138,7 +137,7 @@
 
 def _Temperature(field,data):
     return (data.pf["Gamma"]-1.0)*data.pf["mu"]*mh*data["ThermalEnergy"]/(kboltz*data["Density"])
-add_field("Temperature",function=_Temperature,units=r"\rm{Kelvin}",take_log=False)
+add_field("Temperature",function=_Temperature,units="K",take_log=False)
 
 # particle fields
 

diff -r 4bb126b87f7c5c57be15ea33cb215fb120188c9b -r d3edeb0707bca050eeefd1af7cbcc71d781dd98e yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -69,15 +69,14 @@
 
 def _convertDensity(data):
     return data.convert("Density")
-KnownRAMSESFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
-KnownRAMSESFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownRAMSESFields["Density"]._units = "g / cm**3"
 KnownRAMSESFields["Density"]._convert_function=_convertDensity
 
 def _convertVelocity(data):
     return data.convert("x-velocity")
 for ax in ['x','y','z']:
     f = KnownRAMSESFields["%s-velocity" % ax]
-    f._units = r"\rm{cm}/\rm{s}"
+    f._units = "cm / s"
     f._convert_function = _convertVelocity
     f.take_log = False
 

diff -r 4bb126b87f7c5c57be15ea33cb215fb120188c9b -r d3edeb0707bca050eeefd1af7cbcc71d781dd98e yt/geometry/setup.py
--- a/yt/geometry/setup.py
+++ b/yt/geometry/setup.py
@@ -16,8 +16,8 @@
                          "yt/geometry/selection_routines.pxd"])
     config.add_extension("selection_routines", 
                 ["yt/geometry/selection_routines.pyx"],
-                extra_compile_args=['-fopenmp'],
-                extra_link_args=['-fopenmp'],
+                #extra_compile_args=['-fopenmp'],
+                #extra_link_args=['-fopenmp'],
                 include_dirs=["yt/utilities/lib/"],
                 libraries=["m"],
                 depends=["yt/utilities/lib/fp_utils.pxd",

diff -r 4bb126b87f7c5c57be15ea33cb215fb120188c9b -r d3edeb0707bca050eeefd1af7cbcc71d781dd98e yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -129,9 +129,7 @@
                 depends=["yt/utilities/lib/freetype_includes.h"])
     config.add_extension("geometry_utils", 
                 ["yt/utilities/lib/geometry_utils.pyx"],
-               extra_compile_args=['-fopenmp'],
-               extra_link_args=['-fopenmp'],
-                libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
+                 libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
     config.add_extension("Interpolators", 
                 ["yt/utilities/lib/Interpolators.pyx"],
                 libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
@@ -197,8 +195,6 @@
                  glob.glob("yt/utilities/lib/healpix_*.c"), 
                include_dirs=["yt/utilities/lib/"],
                libraries=["m"], 
-               extra_compile_args=['-fopenmp'],
-               extra_link_args=['-fopenmp'],
                depends = ["yt/utilities/lib/VolumeIntegrator.pyx",
                           "yt/utilities/lib/fp_utils.pxd",
                           "yt/utilities/lib/kdtree.h",


https://bitbucket.org/yt_analysis/yt/commits/505255ccee72/
Changeset:   505255ccee72
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 01:51:37
Summary:     Merging
Affected #:  1 file

diff -r d3edeb0707bca050eeefd1af7cbcc71d781dd98e -r 505255ccee72fc250ef3b3a01b27d6f25061b448 yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -94,11 +94,11 @@
              function=_SpeciesComovingDensity,
              validators=ValidateDataField("%s_Density" % species),
              display_name="Comoving\/%s\/Density" % species)
-    add_field("%s_Mass" % species, units=r"\rm{g}", 
+    add_field("%s_Mass" % species, units="g", 
               function=_SpeciesMass, 
               validators=ValidateDataField("%s_Density" % species),
               display_name="%s\/Mass" % species)
-    add_field("%s_MassMsun" % species, units=r"M_{\odot}", 
+    add_field("%s_MassMsun" % species, units="Msun", 
               function=_SpeciesMass, 
               convert_function=_convertCellMassMsun,
               validators=ValidateDataField("%s_Density" % species),
@@ -113,7 +113,7 @@
     return data["Metal_Fraction"]
 def _ConvertMetallicity(data):
     return 49.0196 # 1 / 0.0204
-add_field("Metallicity", units=r"Z_{\rm{\odot}}",
+add_field("Metallicity", units="Zsun",
           function=_Metallicity,
           convert_function=_ConvertMetallicity,
           validators=ValidateDataField("Metal_Density"),
@@ -121,13 +121,13 @@
 
 def _Metallicity3(field, data):
     return data["SN_Colour"]/data["Density"]
-add_field("Metallicity3", units=r"Z_{\rm{\odot}}",
+add_field("Metallicity3", units="Zsun",
           function=_Metallicity3,
           convert_function=_ConvertMetallicity,
           validators=ValidateDataField("SN_Colour"),
           projection_conversion="1")
 
-add_enzo_field("Cooling_Time", units=r"\rm{s}",
+add_enzo_field("Cooling_Time", units="s",
                function=NullFunc,
                validators=ValidateDataField("Cooling_Time"),
                projection_conversion="1")
@@ -144,14 +144,14 @@
                  + data["y-velocity"]**2.0
                  + data["z-velocity"]**2.0 )
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units=r"\rm{ergs}/\rm{g}")
+          units="erg / g")
 
 def _KineticEnergy(field, data):
     return 0.5*data["Density"] * ( data["x-velocity"]**2.0
                                    + data["y-velocity"]**2.0
                                    + data["z-velocity"]**2.0 )
 add_field("KineticEnergy",function=_KineticEnergy,
-          units = r"\rm{ergs}/\rm{cm^3}")
+          units="erg / cm**3")
 # This next section is the energy field section
 # Note that we have aliases that manually unconvert themselves.
 # This is because numerous code branches use Gas_Energy or GasEnergy
@@ -164,35 +164,35 @@
     return data.convert("x-velocity")**2.0
 
 add_enzo_field("GasEnergy", function=NullFunc,
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 add_enzo_field("Gas_Energy", function=NullFunc,
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _Gas_Energy(field, data):
     return data["GasEnergy"] / _convertEnergy(data)
 add_field("Gas_Energy", function=_Gas_Energy,
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 # We set up fields for both TotalEnergy and Total_Energy in the known fields
 # lists.  Note that this does not mean these will be the used definitions.
 add_enzo_field("TotalEnergy", function=NullFunc,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 add_enzo_field("Total_Energy", function=NullFunc,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _Total_Energy(field, data):
     return data["TotalEnergy"] / _convertEnergy(data)
 add_field("Total_Energy", function=_Total_Energy,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _TotalEnergy(field, data):
     return data["Total_Energy"] / _convertEnergy(data)
 add_field("TotalEnergy", function=_TotalEnergy,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _NumberDensity(field, data):
     # We can assume that we at least have Density
@@ -222,7 +222,7 @@
         fieldData += data["DII_Density"] / 2.0
         fieldData += data["HDI_Density"] / 3.0
     return fieldData
-add_field("NumberDensity", units=r"\rm{cm}^{-3}",
+add_field("NumberDensity", units="cm**-3",
           function=_NumberDensity,
           convert_function=_ConvertNumberDensity)
 
@@ -242,7 +242,7 @@
     if data.pf.parameters["MultiSpecies"] > 2:
         field_data += data["HDI_Density"] / 2.0
     return field_data
-add_field("H_NumberDensity", units=r"\rm{cm}^{-3}",
+add_field("H_NumberDensity", units="cm**-3",
           function=_H_NumberDensity,
           convert_function=_ConvertNumberDensity)
 
@@ -269,7 +269,7 @@
     dn = field.replace("_","\/")
     add_enzo_field(field, function=NullFunc, take_log=True,
               display_name = dn,
-              validators=[ValidateDataField(field)], units=r"Unknown")
+              validators=[ValidateDataField(field)], units="")
 KnownEnzoFields["x-velocity"].projection_conversion='1'
 KnownEnzoFields["y-velocity"].projection_conversion='1'
 KnownEnzoFields["z-velocity"].projection_conversion='1'
@@ -279,7 +279,7 @@
 for field in ['Bx','By','Bz']:
     f = KnownEnzoFields[field]
     f._convert_function=_convertBfield
-    f._units=r"\rm{Gauss}"
+    f._units = "gauss"
     f.take_log=False
 
 def _convertRadiation(data):
@@ -287,11 +287,11 @@
 for field in ["HI_kph", "HeI_kph", "HeII_kph", "H2I_kdiss"]:
     f = KnownEnzoFields[field]
     f._convert_function = _convertRadiation
-    f._units=r"\rm{s}^{-1}"
+    f._units = "s**-1"
     f.take_log=True
 
 KnownEnzoFields["PhotoGamma"]._convert_function = _convertRadiation
-KnownEnzoFields["PhotoGamma"]._units = r"\rm{eV} \rm{s}^{-1}"
+KnownEnzoFields["PhotoGamma"]._units = "eV / s"
 KnownEnzoFields["PhotoGamma"].take_log = True
 
 def _convertRadiationAccel(data):
@@ -299,7 +299,7 @@
 for dim in range(1,4):
     f = KnownEnzoFields["RadAccel%d" % dim]
     f._convert_function = _convertRadiationAccel
-    f._units=r"\rm{cm}\/\rm{s}^{-2}"
+    f._units = "cm / s**2"
     f.take_log=False
 def _RadiationAccelerationMagnitude(field, data):
     return ( data["RadAccel1"]**2 + data["RadAccel2"]**2 +
@@ -307,7 +307,7 @@
 add_field("RadiationAcceleration", 
           function=_RadiationAccelerationMagnitude,
           validators=ValidateDataField(["RadAccel1", "RadAccel2", "RadAccel3"]),
-          display_name="Radiation\/Acceleration", units=r"\rm{cm} \rm{s}^{-2}")
+          display_name="Radiation\/Acceleration", units="cm / s**2")
 
 # Now we override
 
@@ -315,8 +315,7 @@
     return data.convert("Density")
 for field in ["Density"] + [ "%s_Density" % sp for sp in _speciesList ] + \
         ["SN_Colour"]:
-    KnownEnzoFields[field]._units = r"\rm{g}/\rm{cm}^3"
-    KnownEnzoFields[field]._projected_units = r"\rm{g}/\rm{cm}^2"
+    KnownEnzoFields[field]._units = "g / cm**3"
     KnownEnzoFields[field]._convert_function=_convertDensity
 
 add_enzo_field("Dark_Matter_Density", function=NullFunc,
@@ -330,22 +329,22 @@
     return data['Dark_Matter_Density'] * data["CellVolume"]
 add_field("Dark_Matter_Mass", function=_Dark_Matter_Mass,
           validators=ValidateDataField("Dark_Matter_Density"),
-          display_name="Dark\/Matter\/Mass", units=r"\rm{g}")
+          display_name="Dark\/Matter\/Mass", units="g")
 add_field("Dark_Matter_MassMsun", function=_Dark_Matter_Mass,
           convert_function=_convertCellMassMsun,
           validators=ValidateDataField("Dark_Matter_Density"),
-          display_name="Dark\/Matter\/Mass", units=r"M_{\odot}")
+          display_name="Dark\/Matter\/Mass", units="Msun")
 
-KnownEnzoFields["Temperature"]._units = r"\rm{K}"
-KnownEnzoFields["Temperature"].units = r"K"
-KnownEnzoFields["Dust_Temperature"]._units = r"\rm{K}"
-KnownEnzoFields["Dust_Temperature"].units = r"K"
+KnownEnzoFields["Temperature"]._units = "K"
+KnownEnzoFields["Temperature"].units = "K"
+KnownEnzoFields["Dust_Temperature"]._units = "K"
+KnownEnzoFields["Dust_Temperature"].units = "K"
 
 def _convertVelocity(data):
     return data.convert("x-velocity")
 for ax in ['x','y','z']:
     f = KnownEnzoFields["%s-velocity" % ax]
-    f._units = r"\rm{cm}/\rm{s}"
+    f._units = "cm / s"
     f._convert_function = _convertVelocity
     f.take_log = False
 
@@ -471,7 +470,7 @@
 
 def _StarMetallicity(field, data):
     return data['star_metallicity_fraction']
-add_field('StarMetallicity', units=r"Z_{\rm{\odot}}",
+add_field('StarMetallicity', units="Zsun",
           function=_StarMetallicity,
           convert_function=_ConvertMetallicity,
           projection_conversion="1")
@@ -480,14 +479,14 @@
     return data['star_creation_time']
 def _ConvertEnzoTimeYears(data):
     return data.pf.time_units['years']
-add_field('StarCreationTimeYears', units=r"\rm{yr}",
+add_field('StarCreationTimeYears', units="yr",
           function=_StarCreationTime,
           convert_function=_ConvertEnzoTimeYears,
           projection_conversion="1")
 
 def _StarDynamicalTime(field, data):
     return data['star_dynamical_time']
-add_field('StarDynamicalTimeYears', units=r"\rm{yr}",
+add_field('StarDynamicalTimeYears', units="yr",
           function=_StarDynamicalTime,
           convert_function=_ConvertEnzoTimeYears,
           projection_conversion="1")
@@ -499,7 +498,7 @@
         data.pf.current_time - \
         data['StarCreationTimeYears'][with_stars]
     return star_age
-add_field('StarAgeYears', units=r"\rm{yr}",
+add_field('StarAgeYears', units="yr",
           function=_StarAge,
           projection_conversion="1")
 
@@ -514,7 +513,7 @@
     """
     return np.sqrt(data['Bx']**2 + data['By']**2 + data['Bz']**2)
 
-add_field("Bmag", function=_Bmag,display_name=r"$|B|$",units=r"\rm{Gauss}")
+add_field("Bmag", function=_Bmag,display_name=r"$|B|$",units="gauss")
 
 # Particle functions
 
@@ -598,12 +597,12 @@
     return data.convert("mpc")**2.0
 def _ConvertCellAreaCGS(data):
     return data.convert("cm")**2.0
-add_enzo_2d_field("CellAreaCode", units=r"\rm{BoxArea}^2",
+add_enzo_2d_field("CellAreaCode", units="",
           function=_CellArea)
-add_enzo_2d_field("CellAreaMpc", units=r"\rm{Mpc}^2",
+add_enzo_2d_field("CellAreaMpc", units="Mpc**2",
           function=_CellArea,
           convert_function=_ConvertCellAreaMpc)
-add_enzo_2d_field("CellArea", units=r"\rm{cm}^2",
+add_enzo_2d_field("CellArea", units="cm**2",
           function=_CellArea,
           convert_function=_ConvertCellAreaCGS)
 
@@ -629,12 +628,12 @@
     return data.convert("mpc")
 def _ConvertCellLengthCGS(data):
     return data.convert("cm")
-add_enzo_1d_field("CellLengthCode", units=r"\rm{BoxArea}^2",
+add_enzo_1d_field("CellLengthCode", units="",
           function=_CellLength)
-add_enzo_1d_field("CellLengthMpc", units=r"\rm{Mpc}^2",
+add_enzo_1d_field("CellLengthMpc", units="Mpc",
           function=_CellLength,
           convert_function=_ConvertCellLengthMpc)
-add_enzo_1d_field("CellLength", units=r"\rm{cm}^2",
+add_enzo_1d_field("CellLength", units="cm",
           function=_CellLength,
           convert_function=_ConvertCellLengthCGS)
 


https://bitbucket.org/yt_analysis/yt/commits/1f559bfdf56d/
Changeset:   1f559bfdf56d
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 01:07:07
Summary:     Adding some autogenerated c to hgignore.
Affected #:  1 file

diff -r 50e6460dade1bc6cdd62012f7427f5c079f2fbe3 -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 .hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -6,10 +6,14 @@
 png.cfg
 yt_updater.log
 yt/frontends/ramses/_ramses_reader.cpp
+yt/frontends/sph/smoothing_kernel.c
+yt/geometry/oct_container.c
+yt/geometry/selection_routines.c
 yt/utilities/amr_utils.c
 yt/utilities/kdtree/forthonf2c.h
 yt/utilities/libconfig_wrapper.c
 yt/utilities/spatial/ckdtree.c
+yt/utilities/lib/alt_ray_tracers.c
 yt/utilities/lib/CICDeposit.c
 yt/utilities/lib/ContourFinding.c
 yt/utilities/lib/DepthFirstOctree.c


https://bitbucket.org/yt_analysis/yt/commits/9849017245b0/
Changeset:   9849017245b0
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 01:07:15
Summary:     Making gamma an attribute.
Affected #:  17 files

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/data_objects/tests/test_fields.py
--- a/yt/data_objects/tests/test_fields.py
+++ b/yt/data_objects/tests/test_fields.py
@@ -26,11 +26,11 @@
 def realistic_pf(fields, nprocs):
     pf = fake_random_pf(16, fields = fields, nprocs = nprocs)
     pf.parameters["HydroMethod"] = "streaming"
-    pf.parameters["Gamma"] = 5.0/3.0
     pf.parameters["EOSType"] = 1.0
     pf.parameters["EOSSoundSpeed"] = 1.0
     pf.conversion_factors["Time"] = 1.0
     pf.conversion_factors.update( dict((f, 1.0) for f in fields) )
+    pf.gamma = 5.0/3.0
     pf.current_redshift = 0.0001
     pf.hubble_constant = 0.7
     for unit in mpc_conversion:

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -105,7 +105,7 @@
     if data.pf["EOSType"] == 1:
         return np.ones(data["Density"].shape, dtype='float64') * \
                 data.pf["EOSSoundSpeed"]
-    return ( data.pf["Gamma"]*data["Pressure"] / \
+    return ( data.pf.gamma*data["Pressure"] / \
              data["Density"] )**(1.0/2.0)
 add_field("SoundSpeed", function=_SoundSpeed,
           units=r"\rm{cm}/\rm{s}")
@@ -165,7 +165,7 @@
 
 def _Pressure(field, data):
     """M{(Gamma-1.0)*rho*E}"""
-    return (data.pf["Gamma"] - 1.0) * \
+    return (data.pf.gamma - 1.0) * \
            data["Density"] * data["ThermalEnergy"]
 add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
 
@@ -175,7 +175,7 @@
     else :
         mw = mh
     return kboltz * data["Temperature"] / \
-           ((data["Density"]/mw)**(data.pf["Gamma"] - 1.0))
+           ((data["Density"]/mw)**(data.pf.gamma - 1.0))
 add_field("Entropy", units=r"\rm{ergs}\ \rm{cm}^{3\gamma-3}",
           function=_Entropy)
 

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/art/data_structures.py
--- a/yt/frontends/art/data_structures.py
+++ b/yt/frontends/art/data_structures.py
@@ -668,6 +668,7 @@
         self.max_level = amr_header_vals['max_level']
         self.hubble_time  = 1.0/(self.hubble_constant*100/3.08568025e19)
         self.current_time = b2t(self.parameters['t']) * sec_per_Gyr
+        self.gamma = self.parameters["gamma"]
 
     @classmethod
     def _is_valid(self, *args, **kwargs):

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/athena/data_structures.py
--- a/yt/frontends/athena/data_structures.py
+++ b/yt/frontends/athena/data_structures.py
@@ -406,7 +406,10 @@
             self.periodicity = ensure_tuple(self.specified_parameters['periodicity'])
         else:
             self.periodicity = (True,)*self.dimensionality
-
+        if 'gamma' in self.specified_parameters:
+            self.gamma = float(self.specified_parameters['gamma'])
+        else:
+            self.gamma = 5./3.
         dname = self.parameter_filename
         gridlistread = glob.glob('id*/%s-id*%s' % (dname[4:-9],dname[-9:] ))
         self.nvtk = len(gridlistread)+1 

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/castro/data_structures.py
--- a/yt/frontends/castro/data_structures.py
+++ b/yt/frontends/castro/data_structures.py
@@ -583,7 +583,10 @@
             self._parse_fparameter_file()
             for param in self.fparameters:
                 if castro2enzoDict.has_key(param):
-                    self.parameters[castro2enzoDict[param]] = self.fparameters[param]
+                    if param == 'materials.gamma':
+                        self.gamma = self.fparameters[param]
+                    else:
+                        self.parameters[castro2enzoDict[param]] = self.fparameters[param]
 
         # Let's read the file
         self.unique_identifier = int(os.stat(self.parameter_filename)[ST_CTIME])

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/castro/fields.py
--- a/yt/frontends/castro/fields.py
+++ b/yt/frontends/castro/fields.py
@@ -133,12 +133,12 @@
     NB: this will need to be modified for radiation
 
     """
-    return (data.pf["Gamma"] - 1.0) * data["ThermalEnergy"]
+    return (data.pf.gamma - 1.0) * data["ThermalEnergy"]
 
 add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
 
 def _Temperature(field, data):
-    return ((data.pf["Gamma"] - 1.0) * data.pf["mu"] * mh *
+    return ((data.pf.gamma - 1.0) * data.pf["mu"] * mh *
             data["ThermalEnergy"] / (kboltz * data["Density"]))
 
 add_field("Temperature", function=_Temperature, units=r"\rm{Kelvin}",

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/chombo/data_structures.py
--- a/yt/frontends/chombo/data_structures.py
+++ b/yt/frontends/chombo/data_structures.py
@@ -297,7 +297,10 @@
                 paramName = pluto2enzoDict[param]
                 t = map(parameterDict[paramName], vals.split())
                 if len(t) == 1:
-                    self.parameters[paramName] = t[0]
+                    if paramName == "GAMMA":
+                        self.gamma = t[0]
+                    else:
+                        self.parameters[paramName] = t[0]
                 else:
                     if paramName == "RefineBy":
                         self.parameters[paramName] = t[0]

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -455,7 +455,7 @@
 
         # Try to determine Gamma
         try:
-            self.parameters["Gamma"] = self.parameters["gamma"]
+            self.gamma = self.parameters["gamma"]
         except:
             mylog.warning("Cannot find Gamma")
             pass

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -281,14 +281,14 @@
     except:
         pass
     try:
-        return data["Pressure"] / (data.pf["Gamma"] - 1.0) / data["Density"]
+        return data["Pressure"] / (data.pf.gamma - 1.0) / data["Density"]
     except:
         pass
     if data.has_field_parameter("mu") :
         mu = data.get_field_parameter("mu")
     else:
         mu = 0.6
-    return kboltz*data["Density"]*data["Temperature"]/(mu*mh) / (data.pf["Gamma"] - 1.0)
+    return kboltz*data["Density"]*data["Temperature"]/(mu*mh) / (data.pf.gamma - 1.0)
     
 add_field("ThermalEnergy", function=_ThermalEnergy,
           units=r"\rm{ergs}/\rm{g}")

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/gdf/data_structures.py
--- a/yt/frontends/gdf/data_structures.py
+++ b/yt/frontends/gdf/data_structures.py
@@ -239,6 +239,7 @@
         else:
             self.current_redshift = self.omega_lambda = self.omega_matter = \
                 self.hubble_constant = self.cosmological_simulation = 0.0
+        self.gamma = 5./3.
         self.parameters['Time'] = 1.0 # Hardcode time conversion for now.
         self.parameters["HydroMethod"] = 0 # Hardcode for now until field staggering is supported.
         self._handle.close()

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/nyx/data_structures.py
--- a/yt/frontends/nyx/data_structures.py
+++ b/yt/frontends/nyx/data_structures.py
@@ -607,6 +607,8 @@
                 self.use_particles = boxlib_bool_to_int(vals[0])
             elif param.startswith("nyx.lo_bc"):
                 self.periodicity = ensure_tuple([i == 0 for i in vals])
+            elif param.startswith("materials.gamma"):
+                self.gamma = float(vals)
 
         # aliases we need
         self.parameters["TopGridRank"] = len(self.parameters["TopGridDimensions"])

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/nyx/fields.py
--- a/yt/frontends/nyx/fields.py
+++ b/yt/frontends/nyx/fields.py
@@ -140,13 +140,13 @@
     when radiation is accounted for.
 
     """
-    return (data.pf["Gamma"] - 1.0) * data["ThermalEnergy"]
+    return (data.pf.gamma - 1.0) * data["ThermalEnergy"]
 add_field("Pressure", function=_pressure,
           units=r"\rm{M_{\odot}} (\rm{km} / \rm{s})^2 / \rm{Mpc}^3")
 
 # Gas temperature
 def _temperature(field, data):
-    return ((data.pf["Gamma"] - 1.0) * data.pf["mu"] * mh *
+    return ((data.pf.gamma - 1.0) * data.pf["mu"] * mh *
             data["ThermalEnergy"] / (kboltz * data["Density"]))
 add_field("Temperature", function=_temperature, take_log=False,
           units=r"\rm{Kelvin}")

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/orion/data_structures.py
--- a/yt/frontends/orion/data_structures.py
+++ b/yt/frontends/orion/data_structures.py
@@ -551,6 +551,8 @@
                     np.array([float(i) for i in vals.split()])
             elif param.startswith("Prob.lo_bc"):
                 self.periodicity = ensure_tuple([i == 0 for i in vals])
+            elif param.startswith("materials.gamma"):
+                self.gamma = float(vals)
 
         self.parameters["TopGridRank"] = len(self.parameters["TopGridDimensions"])
         self.dimensionality = self.parameters["TopGridRank"]

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/orion/fields.py
--- a/yt/frontends/orion/fields.py
+++ b/yt/frontends/orion/fields.py
@@ -133,11 +133,11 @@
     """M{(Gamma-1.0)*e, where e is thermal energy density
        NB: this will need to be modified for radiation
     """
-    return (data.pf["Gamma"] - 1.0)*data["ThermalEnergy"]
+    return (data.pf.gamma - 1.0)*data["ThermalEnergy"]
 add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
 
 def _Temperature(field,data):
-    return (data.pf["Gamma"]-1.0)*data.pf["mu"]*mh*data["ThermalEnergy"]/(kboltz*data["Density"])
+    return (data.pf.gamma-1.0)*data.pf["mu"]*mh*data["ThermalEnergy"]/(kboltz*data["Density"])
 add_field("Temperature",function=_Temperature,units=r"\rm{Kelvin}",take_log=False)
 
 # particle fields

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -437,6 +437,7 @@
         self.refine_by = 2
         self.parameters["HydroMethod"] = 'ramses'
         self.parameters["Time"] = 1. # default unit is 1...
+        self.parameters = 5./3.
 
         self.unique_identifier = \
             int(os.stat(self.parameter_filename)[stat.ST_CTIME])

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/sph/data_structures.py
--- a/yt/frontends/sph/data_structures.py
+++ b/yt/frontends/sph/data_structures.py
@@ -219,6 +219,7 @@
         self.omega_lambda = hvals["OmegaLambda"]
         self.omega_matter = hvals["Omega0"]
         self.hubble_constant = hvals["HubbleParam"]
+        self.gamma = 5./3.
         self.parameters = hvals
 
         prefix = self.parameter_filename.split(".", 1)[0]

diff -r 1f559bfdf56dbb3490255f9b0cfe9b992f455a71 -r 9849017245b0fe8e458c33cb538c7c5601aab116 yt/frontends/stream/data_structures.py
--- a/yt/frontends/stream/data_structures.py
+++ b/yt/frontends/stream/data_structures.py
@@ -278,6 +278,7 @@
         self.periodicity = self.stream_handler.periodicity
         self.domain_dimensions = self.stream_handler.domain_dimensions
         self.current_time = self.stream_handler.simulation_time
+        self.gamma = 5./3.
         if self.stream_handler.cosmology_simulation:
             self.cosmological_simulation = 1
             self.current_redshift = self.stream_handler.current_redshift


https://bitbucket.org/yt_analysis/yt/commits/bfeedf79c1a5/
Changeset:   bfeedf79c1a5
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 01:28:24
Summary:     Fixing the orion gamma field.
Affected #:  1 file

diff -r 9849017245b0fe8e458c33cb538c7c5601aab116 -r bfeedf79c1a508be0b16f7ef6c44c015e02603eb yt/frontends/orion/data_structures.py
--- a/yt/frontends/orion/data_structures.py
+++ b/yt/frontends/orion/data_structures.py
@@ -542,7 +542,6 @@
                         self.parameters[paramName] = t[0]
                     else:
                         self.parameters[paramName] = t
-                
             elif param.startswith("geometry.prob_hi"):
                 self.domain_right_edge = \
                     np.array([float(i) for i in vals.split()])
@@ -550,10 +549,9 @@
                 self.domain_left_edge = \
                     np.array([float(i) for i in vals.split()])
             elif param.startswith("Prob.lo_bc"):
-                self.periodicity = ensure_tuple([i == 0 for i in vals])
-            elif param.startswith("materials.gamma"):
-                self.gamma = float(vals)
-
+                self.periodicity = ensure_tuple([i == 0 for i in vals.split()])
+        
+        self.gamma = self.parameters["Gamma"]
         self.parameters["TopGridRank"] = len(self.parameters["TopGridDimensions"])
         self.dimensionality = self.parameters["TopGridRank"]
         self.domain_dimensions = np.array(self.parameters["TopGridDimensions"],dtype='int32')


https://bitbucket.org/yt_analysis/yt/commits/6798d5d215f9/
Changeset:   6798d5d215f9
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 01:29:53
Summary:     Fixing nyx as well.
Affected #:  1 file

diff -r bfeedf79c1a508be0b16f7ef6c44c015e02603eb -r 6798d5d215f942e6a138cb61e3a2f550b90e650e yt/frontends/nyx/data_structures.py
--- a/yt/frontends/nyx/data_structures.py
+++ b/yt/frontends/nyx/data_structures.py
@@ -607,10 +607,9 @@
                 self.use_particles = boxlib_bool_to_int(vals[0])
             elif param.startswith("nyx.lo_bc"):
                 self.periodicity = ensure_tuple([i == 0 for i in vals])
-            elif param.startswith("materials.gamma"):
-                self.gamma = float(vals)
-
+            
         # aliases we need
+        self.gamma = self.parameters["Gamma"]
         self.parameters["TopGridRank"] = len(self.parameters["TopGridDimensions"])
         self.dimensionality = self.parameters["TopGridRank"]
         self.domain_dimensions = self.parameters["TopGridDimensions"]


https://bitbucket.org/yt_analysis/yt/commits/f7b1cae5c1df/
Changeset:   f7b1cae5c1df
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 01:43:27
Summary:     Updating the units in the FLASH frontend.
Affected #:  1 file

diff -r 6798d5d215f942e6a138cb61e3a2f550b90e650e -r f7b1cae5c1df8d7f394de572a4dd0f7cdc8b37ba yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -100,8 +100,8 @@
         add_field(fn1.split("_")[0] + "_Density",
                   function=_get_density(fn1), take_log=True,
                   display_name="%s\/Density" % fn1.split("_")[0],
-                  units = r"\rm{g}/\rm{cm}^{3}",
-                  projected_units = r"\rm{g}/\rm{cm}^{2}",
+                  units = r"g/cm**3",
+                  projected_units = r"g/cm**2",
                   )
 
 def _get_convert(fname):
@@ -111,112 +111,112 @@
 
 add_flash_field("dens", function=NullFunc, take_log=True,
                 convert_function=_get_convert("dens"),
-                units=r"\rm{g}/\rm{cm}^{3}",
-                projected_units = r"\rm{g}/\rm{cm}^{2}"),
+                units="g/cm**3",
+                projected_units = "g/cm**2"),
 add_flash_field("velx", function=NullFunc, take_log=False,
                 convert_function=_get_convert("velx"),
-                units=r"\rm{cm}/\rm{s}")
+                units="cm/s")
 add_flash_field("vely", function=NullFunc, take_log=False,
                 convert_function=_get_convert("vely"),
-                units=r"\rm{cm}/\rm{s}")
+                units="cm/s")
 add_flash_field("velz", function=NullFunc, take_log=False,
                 convert_function=_get_convert("velz"),
-                units=r"\rm{cm}/\rm{s}")
+                units="cm/s")
 add_flash_field("ener", function=NullFunc, take_log=True,
                 convert_function=_get_convert("ener"),
-                units=r"\rm{erg}/\rm{g}")
+                units="erg/g")
 add_flash_field("eint", function=NullFunc, take_log=True,
                 convert_function=_get_convert("eint"),
-                units=r"\rm{erg}/\rm{g}")
+                units="erg/g")
 add_flash_field("particle_posx", function=NullFunc, take_log=False,
                 convert_function=_get_convert("particle_posx"),
-                units=r"\rm{cm}", particle_type=True)
+                units="cm", particle_type=True)
 add_flash_field("particle_posy", function=NullFunc, take_log=False,
                 convert_function=_get_convert("particle_posy"),
-                units=r"\rm{cm}", particle_type=True)
+                units="cm", particle_type=True)
 add_flash_field("particle_posz", function=NullFunc, take_log=False,
                 convert_function=_get_convert("particle_posz"),
-                units=r"\rm{cm}", particle_type=True)
+                units="cm", particle_type=True)
 add_flash_field("particle_velx", function=NullFunc, take_log=False,
                 convert_function=_get_convert("particle_velx"),
-                units=r"\rm{cm}/\rm{s}", particle_type=True)
+                units="cm/s", particle_type=True)
 add_flash_field("particle_vely", function=NullFunc, take_log=False,
                 convert_function=_get_convert("particle_vely"),
-                units=r"\rm{cm}/\rm{s}", particle_type=True)
+                units="cm/s", particle_type=True)
 add_flash_field("particle_velz", function=NullFunc, take_log=False,
                 convert_function=_get_convert("particle_velz"),
-                units=r"\rm{cm}/\rm{s}", particle_type=True)
+                units="cm/s", particle_type=True)
 add_flash_field("particle_tag", function=NullFunc, take_log=False,
                 convert_function=_get_convert("particle_tag"),
                 particle_type=True)
 add_flash_field("particle_mass", function=NullFunc, take_log=False,
                 convert_function=_get_convert("particle_mass"),
-                units=r"\rm{g}", particle_type=True)
+                units="g", particle_type=True)
 add_flash_field("temp", function=NullFunc, take_log=True,
                 convert_function=_get_convert("temp"),
-                units=r"\rm{K}")
+                units="K")
 add_flash_field("tion", function=NullFunc, take_log=True,
-                units=r"\rm{K}")
+                units="K")
 add_flash_field("tele", function=NullFunc, take_log=True,
                 convert_function=_get_convert("tele"),
-                units = r"\rm{K}")
+                units = "K")
 add_flash_field("trad", function=NullFunc, take_log=True,
-                units = r"\rm{K}")
+                units = "K")
 add_flash_field("pres", function=NullFunc, take_log=True,
                 convert_function=_get_convert("pres"),
-                units=r"\rm{erg}/\rm{cm}^{3}")
+                units="erg/cm**3")
 add_flash_field("pion", function=NullFunc, take_log=True,
                 display_name="Ion Pressure",
-                units=r"\rm{J}/\rm{cm}^3")
+                units="J/cm^3")
 add_flash_field("pele", function=NullFunc, take_log=True,
                 display_name="Electron Pressure, P_e",
-                units=r"\rm{J}/\rm{cm}^3")
+                units="J/cm^3")
 add_flash_field("prad", function=NullFunc, take_log=True,
                 display_name="Radiation Pressure",
-                units = r"\rm{J}/\rm{cm}^3")
+                units = "J/cm^3")
 add_flash_field("eion", function=NullFunc, take_log=True,
                 display_name="Ion Internal Energy",
-                units=r"\rm{J}")
+                units="J")
 add_flash_field("eele", function=NullFunc, take_log=True,
                 display_name="Electron Internal Energy",
-                units=r"\rm{J}")
+                units="J")
 add_flash_field("erad", function=NullFunc, take_log=True,
                 display_name="Radiation Internal Energy",
-                units=r"\rm{J}")
+                units="J")
 add_flash_field("pden", function=NullFunc, take_log=True,
                 convert_function=_get_convert("pden"),
-                units=r"\rm{g}/\rm{cm}^{3}")
+                units="g/cm**3")
 add_flash_field("depo", function=NullFunc, take_log=True,
-                units = r"\rm{ergs}/\rm{g}")
+                units = "ergs/g")
 add_flash_field("ye", function=NullFunc, take_log=True,
-                units = r"\rm{ergs}/\rm{g}")
+                units = "ergs/g")
 add_flash_field("magx", function=NullFunc, take_log=False,
                 convert_function=_get_convert("magx"),
-                units = r"\mathrm{Gau\ss}")
+                units = "gauss")
 add_flash_field("magy", function=NullFunc, take_log=False,
                 convert_function=_get_convert("magy"),
-                units = r"\mathrm{Gau\ss}")
+                units = "gauss")
 add_flash_field("magz", function=NullFunc, take_log=False,
                 convert_function=_get_convert("magz"),
-                units = r"\mathrm{Gau\ss}")
+                units = "gauss")
 add_flash_field("magp", function=NullFunc, take_log=True,
                 convert_function=_get_convert("magp"),
-                units = r"\rm{erg}/\rm{cm}^{3}")
+                units = "erg/cm**3")
 add_flash_field("divb", function=NullFunc, take_log=False,
                 convert_function=_get_convert("divb"),
-                units = r"\mathrm{Gau\ss}\/\rm{cm}")
+                units = "gauss*cm")
 add_flash_field("game", function=NullFunc, take_log=False,
                 convert_function=_get_convert("game"),
-                units=r"\rm{ratio\/of\/specific\/heats}")
+                display_name="\gamma_e\/\rm{(ratio\/of\/specific\/heats)}")
 add_flash_field("gamc", function=NullFunc, take_log=False,
                 convert_function=_get_convert("gamc"),
-                units=r"\rm{ratio\/of\/specific\/heats}")
+                display_name="\gamma_c\/\rm{(ratio\/of\/specific\/heats)}")
 add_flash_field("gpot", function=NullFunc, take_log=False,
                 convert_function=_get_convert("gpot"),
-                units=r"\rm{ergs}/\rm{g}")
+                units="ergs/g")
 add_flash_field("gpol", function=NullFunc, take_log=False,
                 convert_function=_get_convert("gpol"),
-                units = r"\rm{ergs}/\rm{g}")
+                units = "ergs/g")
 add_flash_field("flam", function=NullFunc, take_log=False,
                 convert_function=_get_convert("flam"))
 add_flash_field("absr", function=NullFunc, take_log=False,
@@ -291,7 +291,7 @@
     return kboltz*data["Density"]*data["Temperature"]/(mu*mh) / (data.pf.gamma - 1.0)
     
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units=r"\rm{ergs}/\rm{g}")
+          units="ergs/g")
 
 def _TotalEnergy(fields, data) :
     try:
@@ -308,13 +308,13 @@
     return etot
 
 add_field("TotalEnergy", function=_TotalEnergy,
-          units=r"\rm{ergs}/\rm{g}")
+          units="ergs/g")
 
 def _GasEnergy(fields, data) :
     return data["ThermalEnergy"]
 
 add_field("GasEnergy", function=_GasEnergy, 
-          units=r"\rm{ergs}/\rm{g}")
+          units="ergs/g")
 
 # See http://flash.uchicago.edu/pipermail/flash-users/2012-October/001180.html
 # along with the attachment to that e-mail for details
@@ -334,37 +334,37 @@
     factor = GetMagRescalingFactor(data.pf)
     return data['magx']*factor
 add_field("Bx", function=_Bx, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_x")
+          units="gauss", display_name=r"B_x")
 
 def _By(fields, data):
     factor = GetMagRescalingFactor(data.pf)
     return data['magy']*factor
 add_field("By", function=_By, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_y")
+          units="gauss", display_name=r"B_y")
 
 def _Bz(fields, data):
     factor = GetMagRescalingFactor(data.pf)
     return data['magz']*factor
 add_field("Bz", function=_Bz, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_z")
+          units="gauss", display_name=r"B_z")
 
 def _DivB(fields, data):
     factor = GetMagRescalingFactor(data.pf)
     return data['divb']*factor
 add_field("DivB", function=_DivB, take_log=False,
-          units=r"\rm{Gauss}\/\rm{cm}^{-1}")
+          units="gauss/cm")
 
 
 
 ## Derived FLASH Fields
 def _nele(field, data):
     return data['ye'] * data['dens'] * data['sumy'] * 6.022E23
-add_field('nele', function=_nele, take_log=True, units=r"\rm{cm}^{-3}")
-add_field('edens', function=_nele, take_log=True, units=r"\rm{cm}^{-3}")
+add_field('nele', function=_nele, take_log=True, units="cm**-3")
+add_field('edens', function=_nele, take_log=True, units="cm**-3")
 
 def _nion(field, data):
     return data['dens'] * data['sumy'] * 6.022E23
-add_field('nion', function=_nion, take_log=True, units=r"\rm{cm}^{-3}")
+add_field('nion', function=_nion, take_log=True, units="cm**-3")
 
 
 def _abar(field, data):
@@ -374,4 +374,4 @@
 
 def _velo(field, data):
     return (data['velx']**2 + data['vely']**2 + data['velz']**2)**0.5
-add_field ('velo', function=_velo, take_log=True, units=r"\rm{cm}/\rm{s}")
+add_field ('velo', function=_velo, take_log=True, units="cm/s")


https://bitbucket.org/yt_analysis/yt/commits/240de376ab7e/
Changeset:   240de376ab7e
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 01:49:04
Summary:     Fixing the units in the athena frontend.
Affected #:  1 file

diff -r f7b1cae5c1df8d7f394de572a4dd0f7cdc8b37ba -r 240de376ab7e4951e204b9c48f1ed9e65a37c78f yt/frontends/athena/fields.py
--- a/yt/frontends/athena/fields.py
+++ b/yt/frontends/athena/fields.py
@@ -55,30 +55,24 @@
 KnownAthenaFields = FieldInfoContainer()
 add_athena_field = KnownAthenaFields.add_field
 
-add_athena_field("density", function=NullFunc, take_log=False,
-          units=r"",
-          projected_units =r"")
+add_athena_field("density", function=NullFunc, take_log=False)
 
-add_athena_field("pressure", function=NullFunc, take_log=False,
-          units=r"")
+add_athena_field("pressure", function=NullFunc, take_log=False)
 
-add_athena_field("velocity_x", function=NullFunc, take_log=False,
-          units=r"")
+add_athena_field("velocity_x", function=NullFunc, take_log=False)
 
-add_athena_field("velocity_y", function=NullFunc, take_log=False,
-          units=r"")
+add_athena_field("velocity_y", function=NullFunc, take_log=False)
 
-add_athena_field("velocity_z", function=NullFunc, take_log=False,
-          units=r"")
+add_athena_field("velocity_z", function=NullFunc, take_log=False)
 
 add_athena_field("cell_centered_B_x", function=NullFunc, take_log=False,
-          units=r"", display_name=r"$\rm{cell\/centered\/B_x}$")
+                 display_name=r"$\rm{cell\/centered\/B_x}$")
 
 add_athena_field("cell_centered_B_y", function=NullFunc, take_log=False,
-          units=r"", display_name=r"$\rm{cell\/centered\/B_y}$")
+                 display_name=r"$\rm{cell\/centered\/B_y}$")
 
 add_athena_field("cell_centered_B_z", function=NullFunc, take_log=False,
-          units=r"", display_name=r"$\rm{cell\/centered\/B_z}$")
+                 display_name=r"$\rm{cell\/centered\/B_z}$")
 
 for f,v in log_translation_dict.items():
     add_field(f, TranslationFunc(v), take_log=True)
@@ -93,23 +87,23 @@
         mu = 0.6
     return mu*mh*data["Pressure"]/data["Density"]/kboltz
 add_field("Temperature", function=_Temperature, take_log=False,
-          units=r"\rm{K}")
+          units="K")
 
 def _Bx(fields, data):
     factor = np.sqrt(4.*np.pi)
     return data['cell_centered_B_x']*factor
 add_field("Bx", function=_Bx, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_x")
+          units="gauss", display_name=r"B_x")
 
 def _By(fields, data):
     factor = np.sqrt(4.*np.pi)
     return data['cell_centered_B_y']*factor
 add_field("By", function=_By, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_y")
+          units="gauss", display_name=r"B_y")
 
 def _Bz(fields, data):
     factor = np.sqrt(4.*np.pi)
     return data['cell_centered_B_z']*factor
 add_field("Bz", function=_Bz, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_z")
+          units="gauss", display_name=r"B_z")
 


https://bitbucket.org/yt_analysis/yt/commits/c3adce8e5ed0/
Changeset:   c3adce8e5ed0
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 01:51:55
Summary:     Adding gamma to enzo.
Affected #:  1 file

diff -r 240de376ab7e4951e204b9c48f1ed9e65a37c78f -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -837,6 +837,7 @@
             self.periodicity += (False, False)
 
         self.current_time = self.parameters["InitialTime"]
+        self.gamma = self.parameters["Gamma"]
         # To be enabled when we can break old pickles:
         #if "MetaDataSimulationUUID" in self.parameters:
         #    self.unique_identifier = self.parameters["MetaDataSimulationUUID"]


https://bitbucket.org/yt_analysis/yt/commits/58ab21c28e30/
Changeset:   58ab21c28e30
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 01:53:37
Summary:     Merging to tip.
Affected #:  18 files

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 scripts/iyt
--- a/scripts/iyt
+++ b/scripts/iyt
@@ -2,7 +2,7 @@
 import os, re
 from distutils import version
 from yt.mods import *
-from yt.data_objects.data_containers import AMRData
+from yt.data_objects.data_containers import YTDataContainer
 namespace = locals().copy()
 namespace.pop("__builtins__", None)
 
@@ -116,7 +116,7 @@
         except:
             raise IPython.ipapi.TryNext 
         
-    if isinstance(obj, (AMRData, ) ):
+    if isinstance(obj, (YTDataContainer, ) ):
         #print "COMPLETING ON THIS THING"
         all_fields = [f for f in sorted(
                 obj.pf.h.field_list + obj.pf.h.derived_field_list)]

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/data_objects/field_info_container.py
--- a/yt/data_objects/field_info_container.py
+++ b/yt/data_objects/field_info_container.py
@@ -33,6 +33,7 @@
 import numpy as np
 
 from yt.funcs import *
+from yt.utilities.units import Unit
 
 class FieldInfoContainer(dict): # Resistance has utility
     """
@@ -259,7 +260,7 @@
                 lambda: np.ones((nd, nd, nd), dtype='float64')
                 + 1e-4*np.random.random((nd, nd, nd)))
         else:
-            defaultdict.__init__(self, 
+            defaultdict.__init__(self,
                 lambda: np.ones((nd * nd * nd), dtype='float64')
                 + 1e-4*np.random.random((nd * nd * nd)))
 
@@ -300,20 +301,27 @@
             return np.random.random(3) * 1e-2
         else:
             return 0.0
+
     _num_ghost_zones = 0
     id = 1
-    def has_field_parameter(self, param): return True
-    def convert(self, item): return 1
+
+    def has_field_parameter(self, param):
+        return True
+
+    def convert(self, item):
+        return 1
+
+
+class FieldUnitsError(Exception):
+    pass
 
 class DerivedField(object):
-    def __init__(self, name, function,
-                 convert_function = None,
-                 particle_convert_function = None,
-                 units = "", projected_units = "",
-                 take_log = True, validators = None,
-                 particle_type = False, vector_field=False,
-                 display_field = True, not_in_all=False,
-                 display_name = None, projection_conversion = "cm"):
+    def __init__(self, name, function, convert_function=None,
+                 particle_convert_function=None, units=None,
+                 projected_units=None, take_log=True, validators=None,
+                 particle_type=False, vector_field=False, display_field=True,
+                 not_in_all=False, display_name=None,
+                 projection_conversion="cm"):
         """
         This is the base class used to describe a cell-by-cell derived field.
 
@@ -333,26 +341,46 @@
         :param display_name: a name used in the plots
         :param projection_conversion: which unit should we multiply by in a
                                       projection?
+
         """
         self.name = name
+        self.take_log = take_log
+        self.display_name = display_name
+        self.not_in_all = not_in_all
+        self.display_field = display_field
+        self.particle_type = particle_type
+        self.vector_field = vector_field
+
         self._function = function
+        if not convert_function:
+            convert_function = lambda a: 1.0
+        self._convert_function = convert_function
+        self.particle_convert_function = particle_convert_function
+        self.projection_conversion = projection_conversion
+
         if validators:
             self.validators = ensure_list(validators)
         else:
             self.validators = []
-        self.take_log = take_log
-        self._units = units
-        self._projected_units = projected_units
-        if not convert_function:
-            convert_function = lambda a: 1.0
-        self._convert_function = convert_function
-        self._particle_convert_function = particle_convert_function
-        self.particle_type = particle_type
-        self.vector_field = vector_field
-        self.projection_conversion = projection_conversion
-        self.display_field = display_field
-        self.display_name = display_name
-        self.not_in_all = not_in_all
+
+        # handle units
+        if units is None:
+            self.units = Unit()
+        elif isinstance(units, str):
+            self.units = Unit(units)
+        elif isinstance(units, Unit):
+            self.units = units
+        else:
+            raise FieldUnitsException("Bad units type. Please provide a Unit object or a string.")
+
+        if projected_units is None:
+            self.projected_units = Unit
+        elif isinstance(projected_units, str):
+            self.projected_units = Unit(projected_units)
+        elif isinstance(projected_units, Unit):
+            self.projected_units = projected_units
+        else:
+            raise FieldUnitsException("Bad projected_units type. Please provide a Unit object or a string.")
 
     def _copy_def(self):
         dd = {}
@@ -392,16 +420,6 @@
             e[self.name]
         return e
 
-    def get_units(self):
-        """ Return a string describing the units. """
-        return self._units
-
-    def get_projected_units(self):
-        """
-        Return a string describing the units if the field has been projected.
-        """
-        return self._projected_units
-
     def __call__(self, data):
         """ Return the value of the field in a given *data* object. """
         ii = self.check_available(data)
@@ -425,11 +443,21 @@
         Return a data label for the given field, inluding units.
         """
         name = self.name
-        if self.display_name is not None: name = self.display_name
+        if self.display_name is not None:
+            name = self.display_name
+
+        # Start with the field name
         data_label = r"$\rm{%s}" % name
-        if projected: units = self.get_projected_units()
-        else: units = self.get_units()
-        if units != "": data_label += r"\/\/ (%s)" % (units)
+
+        # Grab the correct units
+        if projected:
+            units = self.projected_units
+        else:
+            units = self.units
+        # Add unit label
+        if not units.is_dimensionless:
+            data_label += r"\/\/ (%s)" % (units)
+
         data_label += r"$"
         return data_label
 

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/data_objects/yt_array.py
--- /dev/null
+++ b/yt/data_objects/yt_array.py
@@ -0,0 +1,465 @@
+"""
+YTArray class
+
+Authors: Casey W. Stark <caseywstark at gmail.com>
+Affiliation: UC Berkeley
+
+Homepage: http://yt-project.org/
+License:
+    Copyright (C) 2013 Casey W. Stark.  All Rights Reserved.
+
+  This file is part of yt.
+
+  yt is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+"""
+
+import copy
+
+import numpy as np
+
+from yt.utilities.units import Unit
+
+class UnitOperationError(Exception):
+    pass
+
+class YTArray(np.ndarray):
+    """
+
+    """
+    def __new__(cls, input_array, input_units=None):
+        # Input array is an already formed ndarray instance
+        # We first cast to be our class type
+        obj = np.asarray(input_array).view(cls)
+
+        # Check units type
+        if input_units is None:
+            # Nothing provided. Make dimensionless...
+            units = Unit()
+        else if isinstance(input_units, Unit):
+            # input_units is already a Unit, but let's be safe and make a copy.
+            units = copy.copy(input_units)
+        else:
+            # units kwarg set, but it's not a Unit object.
+            # don't handle all the cases here, let the Unit class handle if
+            # it's a str.
+            units = Unit(input_units)
+
+        # Attach the units
+        obj.units = units
+
+        return obj
+
+    def __array_finalize__(self, obj):
+        """
+
+        """
+        if obj is None:
+            return
+        self.units = getattr(obj, 'units', None)
+
+    #
+    # Start unit conversion methods
+    #
+
+    def _unit_repr_check_same(self, units):
+        """
+        Takes a Unit object, or string of known unit symbol, and check that it
+        is compatible with this quantity. Returns Unit object.
+
+        """
+        if not isinstance(units, Unit):
+            units = Unit(units)
+
+        if not self.units.same_dimensions_as(units):
+            raise Exception("Cannot convert to units with different dimensionality. Current unit is %s, argument is %s" % (self.units.dimensions, units))
+
+        return units
+
+    def convert_to(self, units):
+        """
+        Convert the data and units to given unit. This overwrites the ``data``
+        and ``units`` attributes, making no copies, and returns None.
+
+        Parameters
+        ----------
+        units : Unit object or string
+            The units you want the data in.
+
+        """
+        new_units = self._unit_repr_check_same(units)
+        conversion_factor = get_conversion_factor(self.units, new_units)
+        self.data *= conversion_factor
+        self.units = new_units
+
+        return self
+
+    def convert_to_cgs(self):
+        """
+        Convert the data and units to the equivalent cgs units. This overwrites
+        the ``data`` and ``units`` attributes, making no copies, and returns
+        None.
+
+        """
+        return self.convert_to(self.units.get_cgs_equivalent())
+
+    def get_in(self, units):
+        """
+        Creates a new Quantity with the data in the supplied units, and returns
+        it. Does not modify this object.
+
+        Parameters
+        ----------
+        units : Unit object or string
+            The units you want to get a new quantity in.
+
+        Returns
+        -------
+        Quantity object with converted data and supplied units.
+
+        """
+        new_units = self._unit_repr_check_same(units)
+        conversion_factor = get_conversion_factor(self.units, new_units)
+
+        return Quantity(self.data * conversion_factor, new_units)
+
+    def get_in_cgs(self):
+        """
+        Creates a new Quantity with the data in the equivalent cgs units, and
+        returns it. Does not modify this object.
+
+        Returns
+        -------
+        Quantity object with data converted to cgs and cgs units.
+
+        """
+        return self.get_in(self.units.get_cgs_equivalent())
+
+    def get_data_in(self, units):
+        """
+        Returns the data, converted to the supplied units.
+
+        Parameters
+        ----------
+        units : Unit object or string
+            The units you want the data in.
+
+        Returns
+        -------
+        ``data`` attribute, multiplied by the conversion factor to the supplied
+        units.
+
+        """
+        new_units = self._unit_repr_check_same(units)
+
+        # don't operate on data if given the same units
+        if self.units == new_units:
+            return self.data
+
+        conversion_factor = get_conversion_factor(self.units, new_units)
+
+        return self.data * conversion_factor
+
+    def get_data_in_cgs(self):
+        """
+        Returns the data, multiplied by the conversion factor to cgs.
+
+        """
+        return self.get_data_in(self.units.get_cgs_equivalent())
+
+    #
+    # End unit conversion methods
+    #
+
+    #
+    # Start operation methods
+    #
+
+    def __add__(self, right_object):
+        """
+        Add this ytarray to the object on the right of the `+` operator. Must
+        check for the correct (same dimension) units.
+
+        """
+        if isinstance(right_object, YTArray):
+            # make sure it's a quantity before we check units attribute
+            if not self.units.has_same_dimensions_as(right_object.units):
+                raise UnitOperationError("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (self.units, right_object.units))
+        else:
+            # the only way this works is with a float so...
+            if not self.units.is_dimensionless:
+                raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (self, right_object))
+
+            # case of dimensionless self + float
+            return Quantity(self.data + right_object, self.units)
+
+        # `get_data_in` will not apply the conversion if the units are the same
+        return Quantity(self.data + right_object.get_data_in(self.units),
+                        self.units)
+
+    def __radd__(self, left_object):
+        """
+        Add this quantity to the object on the left of the `+` operator. Must
+        check for the correct (same dimension) units. If the quantities have
+        different units, we always use the units on the left.
+
+        """
+        if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
+            if not self.units.same_dimensions_as(left_object.units):
+                raise Exception("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (left_object.units, self.units))
+        else:  # the only way this works is with a float so...
+            if not self.units.is_dimensionless:
+                raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (left_object, self))
+
+            # case of dimensionless float + self
+            return Quantity(left_object + self.data, self.units)
+
+        # `get_data_in` will not apply the conversion if the units are the same
+        return Quantity((left_object.data
+                         + self.get_data_in(left_object.units)),
+                        left_object.units)
+
+    def __sub__(self, right_object):
+        """
+        Subtract the object on the right of the `-` from this quantity. Must
+        check for the correct (same dimension) units. If the quantities have
+        different units, we always use the units on the left.
+
+        """
+        if isinstance(right_object, Quantity):  # make sure it's a quantity before we check units attribute
+            if not self.units.same_dimensions_as(right_object.units):
+                raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (self.units, right_object.units))
+        else:  # the only way this works is with a float so...
+            if not self.units.is_dimensionless:
+                raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (self, right_object))
+
+            # case of dimensionless self + float
+            return Quantity(self.data - right_object, self.units)
+
+        # `get_data_in` will not apply the conversion if the units are the same
+        return Quantity(self.data - right_object.get_data_in(self.units),
+                        self.units)
+
+    def __rsub__(self, left_object):
+        """
+        Subtract this quantity from the object on the left of the `-` operator.
+        Must check for the correct (same dimension) units. If the quantities
+        have different units, we always use the units on the left.
+
+        """
+        if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
+            if not self.units.same_dimensions_as(left_object.units):
+                raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (left_object.units, self.units))
+        else:  # the only way this works is with a float so...
+            if not self.units.is_dimensionless:
+                raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (left_object, self))
+
+            # case of dimensionless float + self
+            return Quantity(left_object - self.data, self.units)
+
+        # `get_data_in` will not apply the conversion if the units are the same
+        return Quantity((left_object.data
+                         - self.get_data_in(left_object.units)),
+                        left_object.units)
+
+    def __neg__(self):
+        """ Negate the data. """
+        return Quantity(-self.data, self.units)
+
+    def __mul__(self, right_object):
+        """
+        Multiply this quantity by the object on the right of the `*` operator.
+        The unit objects handle being multiplied by each other.
+
+        """
+        if isinstance(right_object, Quantity):
+            return Quantity(self.data * right_object.data,
+                            self.units * right_object.units)
+
+        # `right_object` is not a Quantity object, so try to use it as
+        # dimensionless data.
+        return Quantity(self.data * right_object, self.units)
+
+    def __rmul__(self, left_object):
+        """
+        Multiply this quantity by the object on the left of the `*` operator.
+        The unit objects handle being multiplied by each other.
+
+        """
+        if isinstance(left_object, Quantity):
+            return Quantity(left_object.data * self.data,
+                            left_object.units * self.units)
+
+        # `left_object` is not a Quantity object, so try to use it as
+        # dimensionless data.
+        return Quantity(left_object * self.data, self.units)
+
+    def __div__(self, right_object):
+        """
+        Divide this quantity by the object on the right of the `/` operator. The
+        unit objects handle being divided by each other.
+
+        """
+        if isinstance(right_object, Quantity):
+            return Quantity(self.data / right_object.data,
+                            self.units / right_object.units)
+
+        # `right_object` is not a Quantity object, so try to use it as
+        # dimensionless data.
+        return Quantity(self.data / right_object, self.units)
+
+    def __rdiv__(self, left_object):
+        """
+        Divide the object on the left of the `/` operator by this quantity. The
+        unit objects handle being divided by each other.
+
+        """
+        if isinstance(left_object, Quantity):
+            return Quantity(left_object.data / self.data,
+                            left_object.units / self.units)
+
+        # `left_object` is not a Quantity object, so try to use it as
+        # dimensionless data.
+        return Quantity(left_object / self.data, self.units**(-1))
+
+    def __pow__(self, power):
+        """
+        Raise this quantity to some power.
+
+        Parameters
+        ----------
+        power : float or dimensionless Quantity object
+            The pow value.
+
+        """
+        if isinstance(power, Quantity):
+            if power.units.is_dimensionless:
+                return Quantity(self.data**power.data, self.units**power.data)
+            else:
+                raise Exception("The power argument must be dimensionless. (%s)**(%s) is ill-defined." % (self, power))
+
+        return Quantity(self.data**power, self.units**power)
+
+    def __abs__(self):
+        """ Return a Quantity with the abs of the data. """
+        return Quantity(abs(self.data), self.units)
+
+    def sqrt(self):
+        """
+        Return sqrt of this Quantity. This is just a wrapper of Quantity.__pow__
+        for numpy.sqrt.
+
+        """
+        return self**(1.0/2)
+
+    def exp(self):
+        """
+        Return exp of this Quantity. Ensures that Quantity is dimensionless,
+        like __pow__.
+
+        """
+        if not self.units.is_dimensionless:
+            raise Exception("The argument of an exponential must be dimensionless. exp(%s) is ill-defined." % self)
+
+        try:
+            from numpy import exp
+        except ImportError:
+            raise Exception("This method requires the numpy package. Please install it before calling exp(Quantity)")
+
+        return exp(self.data)
+
+    ### comparison operators
+    # @todo: outsource to a single method with an op argument.
+    def __lt__(self, right_object):
+        """ Test if this is less than the object on the right. """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s < %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data < right_object.get_data_in(self.units):
+            return True
+        return False
+
+    def __le__(self, right_object):
+        """ Test if this is less than or equal to the object on the right. """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s <= %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data <= right_object.get_data_in(self.units):
+            return True
+        return False
+
+    def __eq__(self, right_object):
+        """ Test if this is equal to the object on the right. """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s == %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data == right_object.get_data_in(self.units):
+            return True
+        return False
+
+    def __ne__(self, right_object):
+        """ Test if this is not equal to the object on the right. """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s != %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data != right_object.get_data_in(self.units):
+            return True
+        return False
+
+    def __ge__(self, right_object):
+        """
+        Test if this is greater than or equal to the object on the right.
+
+        """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s >= %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data >= right_object.get_data_in(self.units):
+            return True
+        return False
+
+    def __gt__(self, right_object):
+        """ Test if this is greater than the object on the right. """
+        # Check that the other is a Quantity.
+        if not isinstance(right_object, Quantity):
+            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s > %s is ill-defined." % (self, right_object))
+        # Check that the dimensions are the same.
+        if not self.units.same_dimensions_as(right_object.units):
+            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+
+        if self.data > right_object.get_data_in(self.units):
+            return True
+        return False
+
+
+

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/frontends/art/fields.py
--- a/yt/frontends/art/fields.py
+++ b/yt/frontends/art/fields.py
@@ -89,30 +89,26 @@
 
 def _convertDensity(data):
     return data.convert("Density")
-KnownARTFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["Density"]._units = "g/cm**3"
 KnownARTFields["Density"]._convert_function=_convertDensity
 
 def _convertTotalEnergy(data):
     return data.convert("GasEnergy")
-KnownARTFields["TotalEnergy"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["TotalEnergy"]._projected_units = r"\rm{K}"
+KnownARTFields["TotalEnergy"]._units = "g/cm**3"
 KnownARTFields["TotalEnergy"]._convert_function=_convertTotalEnergy
 
 def _convertXMomentumDensity(data):
     tr  = data.convert("Mass")*data.convert("Velocity")
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
-KnownARTFields["XMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["XMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["XMomentumDensity"]._units = "g/s/cm**3"
 KnownARTFields["XMomentumDensity"]._convert_function=_convertXMomentumDensity
 
 def _convertYMomentumDensity(data):
     tr  = data.convert("Mass")*data.convert("Velocity")
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
-KnownARTFields["YMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["YMomentumDensity"]._projected_units = r"\rm{K}"
+KnownARTFields["YMomentumDensity"]._units = "g/s/cm**3"
 KnownARTFields["YMomentumDensity"]._convert_function=_convertYMomentumDensity
 
 def _convertZMomentumDensity(data):
@@ -120,49 +116,41 @@
     tr *= (data.convert("Density")/data.convert("Mass"))
     return tr
 KnownARTFields["ZMomentumDensity"]._units = r"\rm{mg}/\rm{s}/\rm{cm}^3"
-KnownARTFields["ZMomentumDensity"]._projected_units = r"\rm{K}"
 KnownARTFields["ZMomentumDensity"]._convert_function=_convertZMomentumDensity
 
 def _convertPressure(data):
     return data.convert("Pressure")
-KnownARTFields["Pressure"]._units = r"\rm{g}/\rm{cm}/\rm{s}^2"
-KnownARTFields["Pressure"]._projected_units = r"\rm{g}/\rm{s}^2"
+KnownARTFields["Pressure"]._units = "g/cm/s**2"
 KnownARTFields["Pressure"]._convert_function=_convertPressure
 
 def _convertGamma(data):
     return 1.0
-KnownARTFields["Gamma"]._units = r""
-KnownARTFields["Gamma"]._projected_units = r""
+KnownARTFields["Gamma"]._units = ""
 KnownARTFields["Gamma"]._convert_function=_convertGamma
 
 def _convertGasEnergy(data):
     return data.convert("GasEnergy")
-KnownARTFields["GasEnergy"]._units = r"\rm{ergs}/\rm{g}"
-KnownARTFields["GasEnergy"]._projected_units = r""
+KnownARTFields["GasEnergy"]._units = "erg/g"
 KnownARTFields["GasEnergy"]._convert_function=_convertGasEnergy
 
 def _convertMetalDensitySNII(data):
     return data.convert('Density')
-KnownARTFields["MetalDensitySNII"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["MetalDensitySNII"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["MetalDensitySNII"]._units = "g/cm**3"
 KnownARTFields["MetalDensitySNII"]._convert_function=_convertMetalDensitySNII
 
 def _convertMetalDensitySNIa(data):
     return data.convert('Density')
-KnownARTFields["MetalDensitySNIa"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["MetalDensitySNIa"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["MetalDensitySNIa"]._units = "g/cm**3"
 KnownARTFields["MetalDensitySNIa"]._convert_function=_convertMetalDensitySNIa
 
 def _convertPotentialNew(data):
     return data.convert("Potential")
-KnownARTFields["PotentialNew"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["PotentialNew"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["PotentialNew"]._units = "g/cm**3"
 KnownARTFields["PotentialNew"]._convert_function=_convertPotentialNew
 
 def _convertPotentialOld(data):
     return data.convert("Potential")
-KnownARTFields["PotentialOld"]._units = r"\rm{g}/\rm{cm}^3"
-KnownARTFields["PotentialOld"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownARTFields["PotentialOld"]._units = "g/cm**3"
 KnownARTFields["PotentialOld"]._convert_function=_convertPotentialOld
 
 ####### Derived fields
@@ -185,38 +173,33 @@
     #x = data.pf.conversion_factors["Temperature"]
     x = 1.0
     return x
-add_field("Temperature", function=_temperature, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Temperature"]._units = r"\mathrm{K}"
-ARTFieldInfo["Temperature"]._projected_units = r"\mathrm{K}"
+add_field("Temperature", function=_temperature, units = "K",take_log=True)
+ARTFieldInfo["Temperature"]._units = "K"
 #ARTFieldInfo["Temperature"]._convert_function=_converttemperature
 
 def _metallicity_snII(field, data):
     tr  = data["MetalDensitySNII"] / data["Density"]
     return tr
-add_field("Metallicity_SNII", function=_metallicity_snII, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity_SNII"]._units = r""
-ARTFieldInfo["Metallicity_SNII"]._projected_units = r""
+add_field("Metallicity_SNII", function=_metallicity_snII, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity_SNII"]._units = "Zsun"
 
 def _metallicity_snIa(field, data):
     tr  = data["MetalDensitySNIa"] / data["Density"]
     return tr
-add_field("Metallicity_SNIa", function=_metallicity_snIa, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity_SNIa"]._units = r""
-ARTFieldInfo["Metallicity_SNIa"]._projected_units = r""
+add_field("Metallicity_SNIa", function=_metallicity_snIa, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity_SNIa"]._units = "Zsun"
 
 def _metallicity(field, data):
     tr  = data["Metal_Density"] / data["Density"]
     return tr
-add_field("Metallicity", function=_metallicity, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metallicity"]._units = r""
-ARTFieldInfo["Metallicity"]._projected_units = r""
+add_field("Metallicity", function=_metallicity, units = "Zsun",take_log=True)
+ARTFieldInfo["Metallicity"]._units = "Zsun"
 
 def _x_velocity(field,data):
     tr  = data["XMomentumDensity"]/data["Density"]
     return tr
-add_field("x-velocity", function=_x_velocity, units = r"\mathrm{cm/s}",take_log=False)
-ARTFieldInfo["x-velocity"]._units = r"\rm{cm}/\rm{s}"
-ARTFieldInfo["x-velocity"]._projected_units = r"\rm{cm}/\rm{s}"
+add_field("x-velocity", function=_x_velocity, units = "cm/s",take_log=False)
+ARTFieldInfo["x-velocity"]._units = "cm/s"
 
 def _y_velocity(field,data):
     tr  = data["YMomentumDensity"]/data["Density"]
@@ -228,38 +211,36 @@
 def _z_velocity(field,data):
     tr  = data["ZMomentumDensity"]/data["Density"]
     return tr
-add_field("z-velocity", function=_z_velocity, units = r"\mathrm{cm/s}",take_log=False)
-ARTFieldInfo["z-velocity"]._units = r"\rm{cm}/\rm{s}"
-ARTFieldInfo["z-velocity"]._projected_units = r"\rm{cm}/\rm{s}"
+add_field("z-velocity", function=_z_velocity, units = "cm/s",take_log=False)
+ARTFieldInfo["z-velocity"]._units = "cm/s"
 
 def _metal_density(field, data):
     tr  = data["MetalDensitySNIa"]
     tr += data["MetalDensitySNII"]
     return tr
-add_field("Metal_Density", function=_metal_density, units = r"\mathrm{K}",take_log=True)
-ARTFieldInfo["Metal_Density"]._units = r""
-ARTFieldInfo["Metal_Density"]._projected_units = r""
+add_field("Metal_Density", function=_metal_density, units = "Zsun",take_log=True)
+ARTFieldInfo["Metal_Density"]._units = "Zsun"
 
 
 #Particle fields
 
 def ParticleMass(field,data):
     return data['particle_mass']
-add_field("ParticleMass",function=ParticleMass,units=r"\rm{g}",particle_type=True)
+add_field("ParticleMass",function=ParticleMass,units="g",particle_type=True)
 
 
 #Derived particle fields
 
 def ParticleMassMsun(field,data):
     return data['particle_mass']*data.pf['Msun']
-add_field("ParticleMassMsun",function=ParticleMassMsun,units=r"\rm{g}",particle_type=True)
+add_field("ParticleMassMsun",function=ParticleMassMsun,units="g",particle_type=True)
 
 def _creation_time(field,data):
     pa = data["particle_age"]
     tr = np.zeros(pa.shape,dtype='float')-1.0
     tr[pa>0] = pa[pa>0]
     return tr
-add_field("creation_time",function=_creation_time,units=r"\rm{s}",particle_type=True)
+add_field("creation_time",function=_creation_time,units="s",particle_type=True)
 
 def mass_dm(field, data):
     tr = np.ones(data.ActiveDimensions, dtype='float32')
@@ -274,7 +255,7 @@
     else:
         return tr*1e-9
 
-add_field("particle_cell_mass_dm", function=mass_dm, units = r"\mathrm{M_{sun}}",
+add_field("particle_cell_mass_dm", function=mass_dm, units = "Msun",
         validators=[ValidateSpatial(0)],        
         take_log=False,
         projection_conversion="1")
@@ -303,3 +284,4 @@
 
 add_field("star_density", function=_simple_density,
           validators=[ValidateSpatial(0)], convert_function=_convertDensity)
+

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/frontends/castro/fields.py
--- a/yt/frontends/castro/fields.py
+++ b/yt/frontends/castro/fields.py
@@ -59,26 +59,23 @@
 
 # Start adding fields
 add_castro_field("density", function=NullFunc, take_log=True,
-                 units=r"\rm{g}/\rm{cm}^3")
-
-# fix projected units
-KnownCastroFields["density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+                 units="g/cm**3")
 
 add_castro_field("eden", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("eden")],
-                 units=r"\rm{erg}/\rm{cm}^3")
+                 units="erg/cm**3")
 
 add_castro_field("xmom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("xmom")],
-                 units=r"\rm{g}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 add_castro_field("ymom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("ymom")],
-                 units=r"\rm{gm}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 add_castro_field("zmom", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("zmom")],
-                 units=r"\rm{g}/\rm{cm^2\ s}")
+                 units="g/cm**2/s")
 
 # Now populate derived fields
 for mine, theirs in translation_dict.items():
@@ -92,21 +89,21 @@
     return data["xmom"] / data["density"]
 
 add_field("x-velocity", function=_xVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _yVelocity(field, data):
     """ Generate y-velocity from y-momentum and density. """
     return data["ymom"] / data["density"]
 
 add_field("y-velocity", function=_yVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _zVelocity(field, data):
     """ Generate z-velocity from z-momentum and density. """
     return data["zmom"] / data["density"]
 
 add_field("z-velocity", function=_zVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _ThermalEnergy(field, data):
     """
@@ -124,7 +121,7 @@
         + data["z-velocity"]**2.0 )
 
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units=r"\rm{ergs}/\rm{cm^3}")
+          units="ergs/cm**3")
 
 def _Pressure(field, data):
     """
@@ -135,13 +132,13 @@
     """
     return (data.pf.gamma - 1.0) * data["ThermalEnergy"]
 
-add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+add_field("Pressure", function=_Pressure, units="dyne/cm**2")
 
 def _Temperature(field, data):
     return ((data.pf.gamma - 1.0) * data.pf["mu"] * mh *
             data["ThermalEnergy"] / (kboltz * data["Density"]))
 
-add_field("Temperature", function=_Temperature, units=r"\rm{Kelvin}",
+add_field("Temperature", function=_Temperature, units="K",
           take_log=False)
 
 def _convertParticleMassMsun(data):

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/frontends/chombo/fields.py
--- a/yt/frontends/chombo/fields.py
+++ b/yt/frontends/chombo/fields.py
@@ -43,49 +43,39 @@
 
 add_chombo_field("density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("density")],
-                 units=r"\rm{g}/\rm{cm}^3")
-
-KnownChomboFields["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+                 units="g/cm**3")
 
 add_chombo_field("X-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("X-Momentum")],
-                 units=r"",display_name=r"M_x")
-KnownChomboFields["X-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_x")
 
 add_chombo_field("Y-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Y-Momentum")],
-                 units=r"",display_name=r"M_y")
-KnownChomboFields["Y-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_y")
 
 add_chombo_field("Z-momentum", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Z-Momentum")],
-                 units=r"",display_name=r"M_z")
-KnownChomboFields["Z-momentum"]._projected_units=r""
+                 units="g/cm**2/s",display_name=r"M_z")
 
 add_chombo_field("X-magnfield", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("X-Magnfield")],
-                 units=r"",display_name=r"B_x")
-KnownChomboFields["X-magnfield"]._projected_units=r""
+                 units="gauss",display_name=r"B_x")
 
 add_chombo_field("Y-magnfield", function=NullFunc, take_log=False,
                  validators = [ValidateDataField("Y-Magnfield")],
-                 units=r"",display_name=r"B_y")
-KnownChomboFields["Y-magnfield"]._projected_units=r""
+                 units="gauss",display_name=r"B_y")
 
 add_chombo_field("Z-magnfield", function=NullFunc, take_log=False,
                   validators = [ValidateDataField("Z-Magnfield")],
-                  units=r"",display_name=r"B_z")
-KnownChomboFields["Z-magnfield"]._projected_units=r""
+                  units="gauss",display_name=r"B_z")
 
 add_chombo_field("energy-density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("energy-density")],
-                 units=r"\rm{erg}/\rm{cm}^3")
-KnownChomboFields["energy-density"]._projected_units =r""
+                 units="erg/cm**3")
 
 add_chombo_field("radiation-energy-density", function=NullFunc, take_log=True,
                  validators = [ValidateDataField("radiation-energy-density")],
-                 units=r"\rm{erg}/\rm{cm}^3")
-KnownChomboFields["radiation-energy-density"]._projected_units =r""
+                 units="erg/cm**3")
 
 def _Density(field,data):
     """A duplicate of the density field. This is needed because when you try 
@@ -96,36 +86,35 @@
     """
     return data["density"]
 add_field("Density",function=_Density, take_log=True,
-          units=r'\rm{g}/\rm{cm^3}')
+          units='g/cm**3')
 
 def _Bx(field,data):
     return data["X-magnfield"]
 add_field("Bx", function=_Bx, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_x")
+          units="gauss", display_name=r"B_x")
 
 def _By(field,data):
     return data["Y-magnfield"]
 add_field("By", function=_By, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_y")
+          units="gauss", display_name=r"B_y")
 
 def _Bz(field,data):
     return data["Z-magnfield"]
 add_field("Bz", function=_Bz, take_log=False,
-          units=r"\rm{Gauss}", display_name=r"B_z")
+          units="gauss", display_name=r"B_z")
 
 def _MagneticEnergy(field,data):
     return (data["X-magnfield"]**2 +
             data["Y-magnfield"]**2 +
             data["Z-magnfield"]**2)/2.
 add_field("MagneticEnergy", function=_MagneticEnergy, take_log=True,
-          units=r"", display_name=r"B^2 / 8 \pi")
-ChomboFieldInfo["MagneticEnergy"]._projected_units=r""
+          units=r"erg/cm**3", display_name=r"B^2 / 8 \pi")
 
 def _xVelocity(field, data):
     """ Generate x-velocity from x-momentum and density. """
     return data["X-momentum"]/data["density"]
 add_field("x-velocity",function=_xVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _yVelocity(field,data):
     """ Generate y-velocity from y-momentum and density. """
@@ -134,13 +123,13 @@
     #except KeyError:
     return data["Y-momentum"]/data["density"]
 add_field("y-velocity",function=_yVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def _zVelocity(field,data):
     """ Generate z-velocity from z-momentum and density. """
     return data["Z-momentum"]/data["density"]
 add_field("z-velocity",function=_zVelocity, take_log=False,
-          units=r'\rm{cm}/\rm{s}')
+          units='cm/s')
 
 def particle_func(p_field, dtype='float64'):
     def _Particles(field, data):

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -94,11 +94,11 @@
              function=_SpeciesComovingDensity,
              validators=ValidateDataField("%s_Density" % species),
              display_name="Comoving\/%s\/Density" % species)
-    add_field("%s_Mass" % species, units=r"\rm{g}", 
+    add_field("%s_Mass" % species, units="g", 
               function=_SpeciesMass, 
               validators=ValidateDataField("%s_Density" % species),
               display_name="%s\/Mass" % species)
-    add_field("%s_MassMsun" % species, units=r"M_{\odot}", 
+    add_field("%s_MassMsun" % species, units="Msun", 
               function=_SpeciesMass, 
               convert_function=_convertCellMassMsun,
               validators=ValidateDataField("%s_Density" % species),
@@ -113,7 +113,7 @@
     return data["Metal_Fraction"]
 def _ConvertMetallicity(data):
     return 49.0196 # 1 / 0.0204
-add_field("Metallicity", units=r"Z_{\rm{\odot}}",
+add_field("Metallicity", units="Zsun",
           function=_Metallicity,
           convert_function=_ConvertMetallicity,
           validators=ValidateDataField("Metal_Density"),
@@ -121,13 +121,13 @@
 
 def _Metallicity3(field, data):
     return data["SN_Colour"]/data["Density"]
-add_field("Metallicity3", units=r"Z_{\rm{\odot}}",
+add_field("Metallicity3", units="Zsun",
           function=_Metallicity3,
           convert_function=_ConvertMetallicity,
           validators=ValidateDataField("SN_Colour"),
           projection_conversion="1")
 
-add_enzo_field("Cooling_Time", units=r"\rm{s}",
+add_enzo_field("Cooling_Time", units="s",
                function=NullFunc,
                validators=ValidateDataField("Cooling_Time"),
                projection_conversion="1")
@@ -144,14 +144,14 @@
                  + data["y-velocity"]**2.0
                  + data["z-velocity"]**2.0 )
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units=r"\rm{ergs}/\rm{g}")
+          units="erg / g")
 
 def _KineticEnergy(field, data):
     return 0.5*data["Density"] * ( data["x-velocity"]**2.0
                                    + data["y-velocity"]**2.0
                                    + data["z-velocity"]**2.0 )
 add_field("KineticEnergy",function=_KineticEnergy,
-          units = r"\rm{ergs}/\rm{cm^3}")
+          units="erg / cm**3")
 # This next section is the energy field section
 # Note that we have aliases that manually unconvert themselves.
 # This is because numerous code branches use Gas_Energy or GasEnergy
@@ -164,35 +164,35 @@
     return data.convert("x-velocity")**2.0
 
 add_enzo_field("GasEnergy", function=NullFunc,
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 add_enzo_field("Gas_Energy", function=NullFunc,
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _Gas_Energy(field, data):
     return data["GasEnergy"] / _convertEnergy(data)
 add_field("Gas_Energy", function=_Gas_Energy,
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 # We set up fields for both TotalEnergy and Total_Energy in the known fields
 # lists.  Note that this does not mean these will be the used definitions.
 add_enzo_field("TotalEnergy", function=NullFunc,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 add_enzo_field("Total_Energy", function=NullFunc,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _Total_Energy(field, data):
     return data["TotalEnergy"] / _convertEnergy(data)
 add_field("Total_Energy", function=_Total_Energy,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _TotalEnergy(field, data):
     return data["Total_Energy"] / _convertEnergy(data)
 add_field("TotalEnergy", function=_TotalEnergy,
           display_name = "$\rm{Total}\/\rm{Energy}$",
-          units=r"\rm{ergs}/\rm{g}", convert_function=_convertEnergy)
+          units="erg / g", convert_function=_convertEnergy)
 
 def _NumberDensity(field, data):
     # We can assume that we at least have Density
@@ -222,7 +222,7 @@
         fieldData += data["DII_Density"] / 2.0
         fieldData += data["HDI_Density"] / 3.0
     return fieldData
-add_field("NumberDensity", units=r"\rm{cm}^{-3}",
+add_field("NumberDensity", units="cm**-3",
           function=_NumberDensity,
           convert_function=_ConvertNumberDensity)
 
@@ -242,7 +242,7 @@
     if data.pf.parameters["MultiSpecies"] > 2:
         field_data += data["HDI_Density"] / 2.0
     return field_data
-add_field("H_NumberDensity", units=r"\rm{cm}^{-3}",
+add_field("H_NumberDensity", units="cm**-3",
           function=_H_NumberDensity,
           convert_function=_ConvertNumberDensity)
 
@@ -269,7 +269,7 @@
     dn = field.replace("_","\/")
     add_enzo_field(field, function=NullFunc, take_log=True,
               display_name = dn,
-              validators=[ValidateDataField(field)], units=r"Unknown")
+              validators=[ValidateDataField(field)], units="")
 KnownEnzoFields["x-velocity"].projection_conversion='1'
 KnownEnzoFields["y-velocity"].projection_conversion='1'
 KnownEnzoFields["z-velocity"].projection_conversion='1'
@@ -279,7 +279,7 @@
 for field in ['Bx','By','Bz']:
     f = KnownEnzoFields[field]
     f._convert_function=_convertBfield
-    f._units=r"\rm{Gauss}"
+    f._units = "gauss"
     f.take_log=False
 
 def _convertRadiation(data):
@@ -287,11 +287,11 @@
 for field in ["HI_kph", "HeI_kph", "HeII_kph", "H2I_kdiss"]:
     f = KnownEnzoFields[field]
     f._convert_function = _convertRadiation
-    f._units=r"\rm{s}^{-1}"
+    f._units = "s**-1"
     f.take_log=True
 
 KnownEnzoFields["PhotoGamma"]._convert_function = _convertRadiation
-KnownEnzoFields["PhotoGamma"]._units = r"\rm{eV} \rm{s}^{-1}"
+KnownEnzoFields["PhotoGamma"]._units = "eV / s"
 KnownEnzoFields["PhotoGamma"].take_log = True
 
 def _convertRadiationAccel(data):
@@ -299,7 +299,7 @@
 for dim in range(1,4):
     f = KnownEnzoFields["RadAccel%d" % dim]
     f._convert_function = _convertRadiationAccel
-    f._units=r"\rm{cm}\/\rm{s}^{-2}"
+    f._units = "cm / s**2"
     f.take_log=False
 def _RadiationAccelerationMagnitude(field, data):
     return ( data["RadAccel1"]**2 + data["RadAccel2"]**2 +
@@ -307,7 +307,7 @@
 add_field("RadiationAcceleration", 
           function=_RadiationAccelerationMagnitude,
           validators=ValidateDataField(["RadAccel1", "RadAccel2", "RadAccel3"]),
-          display_name="Radiation\/Acceleration", units=r"\rm{cm} \rm{s}^{-2}")
+          display_name="Radiation\/Acceleration", units="cm / s**2")
 
 # Now we override
 
@@ -315,8 +315,7 @@
     return data.convert("Density")
 for field in ["Density"] + [ "%s_Density" % sp for sp in _speciesList ] + \
         ["SN_Colour"]:
-    KnownEnzoFields[field]._units = r"\rm{g}/\rm{cm}^3"
-    KnownEnzoFields[field]._projected_units = r"\rm{g}/\rm{cm}^2"
+    KnownEnzoFields[field]._units = "g / cm**3"
     KnownEnzoFields[field]._convert_function=_convertDensity
 
 add_enzo_field("Dark_Matter_Density", function=NullFunc,
@@ -330,22 +329,22 @@
     return data['Dark_Matter_Density'] * data["CellVolume"]
 add_field("Dark_Matter_Mass", function=_Dark_Matter_Mass,
           validators=ValidateDataField("Dark_Matter_Density"),
-          display_name="Dark\/Matter\/Mass", units=r"\rm{g}")
+          display_name="Dark\/Matter\/Mass", units="g")
 add_field("Dark_Matter_MassMsun", function=_Dark_Matter_Mass,
           convert_function=_convertCellMassMsun,
           validators=ValidateDataField("Dark_Matter_Density"),
-          display_name="Dark\/Matter\/Mass", units=r"M_{\odot}")
+          display_name="Dark\/Matter\/Mass", units="Msun")
 
-KnownEnzoFields["Temperature"]._units = r"\rm{K}"
-KnownEnzoFields["Temperature"].units = r"K"
-KnownEnzoFields["Dust_Temperature"]._units = r"\rm{K}"
-KnownEnzoFields["Dust_Temperature"].units = r"K"
+KnownEnzoFields["Temperature"]._units = "K"
+KnownEnzoFields["Temperature"].units = "K"
+KnownEnzoFields["Dust_Temperature"]._units = "K"
+KnownEnzoFields["Dust_Temperature"].units = "K"
 
 def _convertVelocity(data):
     return data.convert("x-velocity")
 for ax in ['x','y','z']:
     f = KnownEnzoFields["%s-velocity" % ax]
-    f._units = r"\rm{cm}/\rm{s}"
+    f._units = "cm / s"
     f._convert_function = _convertVelocity
     f.take_log = False
 
@@ -471,7 +470,7 @@
 
 def _StarMetallicity(field, data):
     return data['star_metallicity_fraction']
-add_field('StarMetallicity', units=r"Z_{\rm{\odot}}",
+add_field('StarMetallicity', units="Zsun",
           function=_StarMetallicity,
           convert_function=_ConvertMetallicity,
           projection_conversion="1")
@@ -480,14 +479,14 @@
     return data['star_creation_time']
 def _ConvertEnzoTimeYears(data):
     return data.pf.time_units['years']
-add_field('StarCreationTimeYears', units=r"\rm{yr}",
+add_field('StarCreationTimeYears', units="yr",
           function=_StarCreationTime,
           convert_function=_ConvertEnzoTimeYears,
           projection_conversion="1")
 
 def _StarDynamicalTime(field, data):
     return data['star_dynamical_time']
-add_field('StarDynamicalTimeYears', units=r"\rm{yr}",
+add_field('StarDynamicalTimeYears', units="yr",
           function=_StarDynamicalTime,
           convert_function=_ConvertEnzoTimeYears,
           projection_conversion="1")
@@ -499,7 +498,7 @@
         data.pf.current_time - \
         data['StarCreationTimeYears'][with_stars]
     return star_age
-add_field('StarAgeYears', units=r"\rm{yr}",
+add_field('StarAgeYears', units="yr",
           function=_StarAge,
           projection_conversion="1")
 
@@ -514,7 +513,7 @@
     """
     return np.sqrt(data['Bx']**2 + data['By']**2 + data['Bz']**2)
 
-add_field("Bmag", function=_Bmag,display_name=r"$|B|$",units=r"\rm{Gauss}")
+add_field("Bmag", function=_Bmag,display_name=r"$|B|$",units="gauss")
 
 # Particle functions
 
@@ -598,12 +597,12 @@
     return data.convert("mpc")**2.0
 def _ConvertCellAreaCGS(data):
     return data.convert("cm")**2.0
-add_enzo_2d_field("CellAreaCode", units=r"\rm{BoxArea}^2",
+add_enzo_2d_field("CellAreaCode", units="",
           function=_CellArea)
-add_enzo_2d_field("CellAreaMpc", units=r"\rm{Mpc}^2",
+add_enzo_2d_field("CellAreaMpc", units="Mpc**2",
           function=_CellArea,
           convert_function=_ConvertCellAreaMpc)
-add_enzo_2d_field("CellArea", units=r"\rm{cm}^2",
+add_enzo_2d_field("CellArea", units="cm**2",
           function=_CellArea,
           convert_function=_ConvertCellAreaCGS)
 
@@ -629,12 +628,12 @@
     return data.convert("mpc")
 def _ConvertCellLengthCGS(data):
     return data.convert("cm")
-add_enzo_1d_field("CellLengthCode", units=r"\rm{BoxArea}^2",
+add_enzo_1d_field("CellLengthCode", units="",
           function=_CellLength)
-add_enzo_1d_field("CellLengthMpc", units=r"\rm{Mpc}^2",
+add_enzo_1d_field("CellLengthMpc", units="Mpc",
           function=_CellLength,
           convert_function=_ConvertCellLengthMpc)
-add_enzo_1d_field("CellLength", units=r"\rm{cm}^2",
+add_enzo_1d_field("CellLength", units="cm",
           function=_CellLength,
           convert_function=_ConvertCellLengthCGS)
 

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/frontends/gdf/fields.py
--- a/yt/frontends/gdf/fields.py
+++ b/yt/frontends/gdf/fields.py
@@ -55,33 +55,31 @@
 KnownGDFFields = FieldInfoContainer()
 add_gdf_field = KnownGDFFields.add_field
 
-add_gdf_field("density", function=NullFunc, take_log=True,
-          units=r"\rm{g}/\rm{cm}^3",
-          projected_units =r"\rm{g}/\rm{cm}^2")
+add_gdf_field("density", function=NullFunc, take_log=True, units="g/cm**3")
 
 add_gdf_field("specific_energy", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg / g")
 
 add_gdf_field("pressure", function=NullFunc, take_log=True,
-          units=r"\rm{erg}/\rm{g}")
+          units="erg/g")
 
 add_gdf_field("velocity_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 
 add_gdf_field("velocity_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_x", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_y", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 add_gdf_field("mag_field_z", function=NullFunc, take_log=False,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm / s")
 
 for f,v in log_translation_dict.items():
     add_field(f, TranslationFunc(v), take_log=True)

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/frontends/maestro/fields.py
--- a/yt/frontends/maestro/fields.py
+++ b/yt/frontends/maestro/fields.py
@@ -44,20 +44,20 @@
 
 add_field("density", function=lambda a,b: None, take_log=True,
           validators = [ValidateDataField("density")],
-          units=r"\rm{g}/\rm{cm}^3")
-MaestroFieldInfo["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+          units="g/cm**3")
 
-translation_dict = {"x-velocity": "x_vel",
-                    "y-velocity": "y_vel",
-                    "z-velocity": "z_vel",
-                    "Density": "density",
-                    "Temperature": "tfromp"
-                   }
+translation_dict = {
+    "x-velocity": "x_vel",
+    "y-velocity": "y_vel",
+    "z-velocity": "z_vel",
+    "Density":    "density",
+    "Temperature": "tfromp"
+}
 
 def _generate_translation(mine, theirs):
     add_field(theirs, function=lambda a, b: b[mine], take_log=True)
 
-for f,v in translation_dict.items():
+for f, v in translation_dict.items():
     if v not in MaestroFieldInfo:
         add_field(v, function=lambda a,b: None, take_log=False,
                   validators = [ValidateDataField(v)])

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -69,15 +69,14 @@
 
 def _convertDensity(data):
     return data.convert("Density")
-KnownRAMSESFields["Density"]._units = r"\rm{g}/\rm{cm}^3"
-KnownRAMSESFields["Density"]._projected_units = r"\rm{g}/\rm{cm}^2"
+KnownRAMSESFields["Density"]._units = "g / cm**3"
 KnownRAMSESFields["Density"]._convert_function=_convertDensity
 
 def _convertVelocity(data):
     return data.convert("x-velocity")
 for ax in ['x','y','z']:
     f = KnownRAMSESFields["%s-velocity" % ax]
-    f._units = r"\rm{cm}/\rm{s}"
+    f._units = "cm / s"
     f._convert_function = _convertVelocity
     f.take_log = False
 

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/geometry/geometry_handler.py
--- a/yt/geometry/geometry_handler.py
+++ b/yt/geometry/geometry_handler.py
@@ -1,4 +1,4 @@
-""" 
+"""
 Geometry container base class.
 
 Author: Matthew Turk <matthewturk at gmail.com>
@@ -132,8 +132,8 @@
                 # will allow the same field detection mechanism to work for 1D, 2D
                 # and 3D fields.
                 self.pf.field_info.add_field(
-                        field, NullFunc, particle_type = particle_type,
-                        convert_function=cf, take_log=False, units=r"Unknown")
+                        field, NullFunc, particle_type=particle_type,
+                        convert_function=cf, take_log=False)
             else:
                 mylog.debug("Adding known field %s to list of fields", field)
                 self.parameter_file.field_info[field] = known_fields[field]

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/geometry/setup.py
--- a/yt/geometry/setup.py
+++ b/yt/geometry/setup.py
@@ -16,8 +16,8 @@
                          "yt/geometry/selection_routines.pxd"])
     config.add_extension("selection_routines", 
                 ["yt/geometry/selection_routines.pyx"],
-                extra_compile_args=['-fopenmp'],
-                extra_link_args=['-fopenmp'],
+                #extra_compile_args=['-fopenmp'],
+                #extra_link_args=['-fopenmp'],
                 include_dirs=["yt/utilities/lib/"],
                 libraries=["m"],
                 depends=["yt/utilities/lib/fp_utils.pxd",

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/utilities/lib/setup.py
--- a/yt/utilities/lib/setup.py
+++ b/yt/utilities/lib/setup.py
@@ -129,9 +129,7 @@
                 depends=["yt/utilities/lib/freetype_includes.h"])
     config.add_extension("geometry_utils", 
                 ["yt/utilities/lib/geometry_utils.pyx"],
-               extra_compile_args=['-fopenmp'],
-               extra_link_args=['-fopenmp'],
-                libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
+                 libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
     config.add_extension("Interpolators", 
                 ["yt/utilities/lib/Interpolators.pyx"],
                 libraries=["m"], depends=["yt/utilities/lib/fp_utils.pxd"])
@@ -197,8 +195,6 @@
                  glob.glob("yt/utilities/lib/healpix_*.c"), 
                include_dirs=["yt/utilities/lib/"],
                libraries=["m"], 
-               extra_compile_args=['-fopenmp'],
-               extra_link_args=['-fopenmp'],
                depends = ["yt/utilities/lib/VolumeIntegrator.pyx",
                           "yt/utilities/lib/fp_utils.pxd",
                           "yt/utilities/lib/kdtree.h",

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/utilities/tests/test_units.py
--- a/yt/utilities/tests/test_units.py
+++ b/yt/utilities/tests/test_units.py
@@ -70,6 +70,13 @@
     assert u1.cgs_value == 1
     assert u1.dimensions == 1
 
+    u2 = Unit("")
+
+    assert u2.is_dimensionless
+    assert u2.expr == 1
+    assert u2.cgs_value == 1
+    assert u2.dimensions == 1
+
 #
 # Start init tests
 #

diff -r c3adce8e5ed03fc6ce2880eec7531fc36a36f9c5 -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -74,6 +74,9 @@
     "J": (1.0e7, energy),
     "Hz": (1.0, rate),
 
+    # dimensionless
+    "h": (1.0, 1.0),
+
     # times
     "min": (60.0, time),
     "hr":  (3600.0, time),
@@ -163,6 +166,10 @@
         """
         # if we have a string, parse into an expression
         if isinstance(unit_expr, str):
+            if not unit_expr:
+                # Bug catch...
+                # if unit_expr is an empty string, parse_expr fails hard...
+                unit_expr = "1"
             unit_expr = parse_expr(unit_expr)
 
         if not isinstance(unit_expr, Expr):
@@ -289,6 +296,9 @@
              self.dimensions.expand().as_coeff_exponent(temperature)[1])
         return Unit(cgs_units_string, 1, self.dimensions)
 
+    def get_conversion_factor(self, other_units):
+        return get_conversion_factor(self, other_units)
+
 
 def make_symbols_positive(expr):
     """


https://bitbucket.org/yt_analysis/yt/commits/58a5285e2443/
Changeset:   58a5285e2443
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 02:21:16
Summary:     Fixing universal_fields.py.
Affected #:  1 file

diff -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 -r 58a5285e244394903b05808d7a6e10f8e3bd84b8 yt/data_objects/universal_fields.py
--- a/yt/data_objects/universal_fields.py
+++ b/yt/data_objects/universal_fields.py
@@ -47,15 +47,15 @@
     NeedsParameter
 
 from yt.utilities.physical_constants import \
-     mh, \
-     me, \
-     sigma_thompson, \
-     clight, \
-     kboltz, \
-     G, \
-     rho_crit_now, \
-     speed_of_light_cgs, \
-     km_per_cm
+    mh, \
+    me, \
+    sigma_thompson, \
+    clight, \
+    kboltz, \
+    G, \
+    rho_crit_now, \
+    speed_of_light_cgs, \
+    km_per_cm
 
 from yt.utilities.math_utils import \
     get_sph_r_component, \
@@ -68,371 +68,374 @@
     get_cyl_z, get_sph_r, \
     get_sph_theta, get_sph_phi, \
     periodic_dist, euclidean_dist
-     
-def _GridLevel(field, data):
-    return np.ones(data.ActiveDimensions)*(data.Level)
-add_field("GridLevel", function=_GridLevel,
-          validators=[ValidateGridType(),
-                      ValidateSpatial(0)])
 
-def _GridIndices(field, data):
-    return np.ones(data["Ones"].shape)*(data.id-data._id_offset)
-add_field("GridIndices", function=_GridIndices,
-          validators=[ValidateGridType(),
-                      ValidateSpatial(0)], take_log=False)
+# Note that, despite my newfound efforts to comply with PEP-8,
+# I violate it here in order to keep the name/func_name relationship
 
-def _OnesOverDx(field, data):
-    return np.ones(data["Ones"].shape,
-                   dtype=data["Density"].dtype)/data['dx']
-add_field("OnesOverDx", function=_OnesOverDx,
+def _dx(field, data):
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[0]
+
+add_field('dx', function=_dx, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _dy(field, data):
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[1]
+
+add_field('dy', function=_dy, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _dz(field, data):
+    return np.ones(data.ActiveDimensions, dtype=np.float64) * data.dds[2]
+
+add_field('dz', function=_dz,
+          display_field=False, validators=[ValidateSpatial(0)])
+
+def _coord_x(field, data):
+    dim = data.ActiveDimensions[0]
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[0])[:, None, None] + 0.5 )
+             * data['dx'] + data.LeftEdge[0] )
+
+add_field('x', function=_coord_x, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _coord_y(field, data):
+    dim = data.ActiveDimensions[1]
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[1])[None, :, None] + 0.5 )
+             * data['dy'] + data.LeftEdge[1] )
+
+add_field('y', function=_coord_y, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _coord_z(field, data):
+    dim = data.ActiveDimensions[2]
+    return ( ( np.ones(data.ActiveDimensions, dtype=np.float64)
+               * np.arange(data.ActiveDimensions[2])[None, None, :] + 0.5 )
+             * data['dz'] + data.LeftEdge[2] )
+
+add_field('z', function=_coord_z, display_field=False,
+          validators=[ValidateSpatial(0)])
+
+def _grid_level(field, data):
+    return np.ones(data.ActiveDimensions) * data.Level
+
+add_field("grid_level", function=_grid_level,
+          validators=[ValidateGridType(), ValidateSpatial(0)])
+
+def _grid_indices(field, data):
+    return np.ones(data["ones"].shape) * (data.id - data._id_offset)
+
+add_field("grid_indices", function=_grid_indices, take_log=False,
+          validators=[ValidateGridType(), ValidateSpatial(0)])
+
+def _ones_over_dx(field, data):
+    return np.ones(data["ones"].shape, dtype=data["density"].dtype) / data['dx']
+
+add_field("ones_over_dx", function=_ones_over_dx, display_field=False)
+
+def _ones(field, data):
+    return np.ones(data.shape, dtype=np.float64)
+
+add_field("ones", function=_ones, projection_conversion="unitary",
           display_field=False)
+add_field("cells_per_bin", function=_ones, display_field=False)
 
-def _Zeros(field, data):
-    return np.zeros(data.ActiveDimensions, dtype='float64')
-add_field("Zeros", function=_Zeros,
-          validators=[ValidateSpatial(0)],
-          projection_conversion="unitary",
-          display_field = False)
 
-def _Ones(field, data):
-    return np.ones(data.shape, dtype='float64')
-add_field("Ones", function=_Ones,
-          projection_conversion="unitary",
-          display_field = False)
-add_field("CellsPerBin", function=_Ones, display_field = False)
+def _sound_speed(field, data):
+    if data.pf["eos_type"] == 1:
+        return ( np.ones(data["density"].shape, dtype=np.float64)
+                 * data.pf["eos_sound_speed"] )
+    return np.sqrt( data.pf.gamma * data["pressure"] / data["density"] )
 
-def _SoundSpeed(field, data):
-    if data.pf["EOSType"] == 1:
-        return np.ones(data["Density"].shape, dtype='float64') * \
-                data.pf["EOSSoundSpeed"]
-    return ( data.pf.gamma*data["Pressure"] / \
-             data["Density"] )**(1.0/2.0)
-add_field("SoundSpeed", function=_SoundSpeed,
-          units=r"\rm{cm}/\rm{s}")
+add_field("sound_speed", function=_sound_speed, units="cm/s")
 
-def _RadialMachNumber(field, data):
-    """M{|v|/t_sound}"""
-    return np.abs(data["RadialVelocity"]) / data["SoundSpeed"]
-add_field("RadialMachNumber", function=_RadialMachNumber)
+def _radial_mach_number(field, data):
+    """ M{|v|/t_sound} """
+    return np.abs(data["radial_velocity"]) / data["sound_speed"]
 
-def _MachNumber(field, data):
-    """M{|v|/t_sound}"""
-    return data["VelocityMagnitude"] / data["SoundSpeed"]
-add_field("MachNumber", function=_MachNumber)
+add_field("radial_mach_number", function=_radial_mach_number)
 
-def _CourantTimeStep(field, data):
-    t1 = data['dx'] / (
-        data["SoundSpeed"] + \
-        abs(data["x-velocity"]))
-    t2 = data['dy'] / (
-        data["SoundSpeed"] + \
-        abs(data["y-velocity"]))
-    t3 = data['dz'] / (
-        data["SoundSpeed"] + \
-        abs(data["z-velocity"]))
-    return np.minimum(np.minimum(t1,t2),t3)
-def _convertCourantTimeStep(data):
-    # SoundSpeed and z-velocity are in cm/s, dx is in code
+def _mach_number(field, data):
+    """ M{|v|/t_sound} """
+    return data["velocity_magnitude"] / data["sound_speed"]
+
+add_field("mach_number", function=_mach_number)
+
+def _courant_time_step(field, data):
+    t1 = data["dx"] / (data["sound_speed"] + np.abs(data["velocity_x"]))
+    t2 = data["dy"] / (data["sound_speed"] + np.abs(data["velocity_y"]))
+    t3 = data["dz"] / (data["sound_speed"] + np.abs(data["velocity_z"]))
+    return np.minimum(np.minimum(t1, t2), t3)
+def _convert_courant_time_step(data):
+    # sound speed and z-velocity are in cm/s, dx is in code
     return data.convert("cm")
-add_field("CourantTimeStep", function=_CourantTimeStep,
-          convert_function=_convertCourantTimeStep,
-          units=r"$\rm{s}$")
 
-def _ParticleVelocityMagnitude(field, data):
-    """M{|v|}"""
+add_field("courant_time_step", function=_courant_time_step,
+          convert_function=_convert_courant_time_step, units="s")
+
+def _particle_velocity_magnitude(field, data):
+    """ M{|v|} """
     bulk_velocity = data.get_field_parameter("bulk_velocity")
-    if bulk_velocity == None:
+    if bulk_velocity is None:
         bulk_velocity = np.zeros(3)
-    return ( (data["particle_velocity_x"]-bulk_velocity[0])**2.0 + \
-             (data["particle_velocity_y"]-bulk_velocity[1])**2.0 + \
-             (data["particle_velocity_z"]-bulk_velocity[2])**2.0 )**(1.0/2.0)
-add_field("ParticleVelocityMagnitude", function=_ParticleVelocityMagnitude,
-          particle_type=True, 
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+    return np.sqrt( (data["particle_velocity_x"] - bulk_velocity[0])**2
+                    + (data["particle_velocity_y"] - bulk_velocity[1])**2
+                    + (data["particle_velocity_z"] - bulk_velocity[2])**2 )
 
-def _VelocityMagnitude(field, data):
-    """M{|v|}"""
+add_field("particle_velocity_magnitude", function=_particle_velocity_magnitude,
+          particle_type=True, take_log=False, units="cm/s")
+
+def _velocity_magnitude(field, data):
+    """ M{|v|} """
     velocities = obtain_rv_vec(data)
-    return np.sqrt(np.sum(velocities**2,axis=0))
-add_field("VelocityMagnitude", function=_VelocityMagnitude,
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+    return np.sqrt(np.sum(velocities**2, axis=0))
 
-def _TangentialOverVelocityMagnitude(field, data):
-    return np.abs(data["TangentialVelocity"])/np.abs(data["VelocityMagnitude"])
-add_field("TangentialOverVelocityMagnitude",
-          function=_TangentialOverVelocityMagnitude,
-          take_log=False)
+add_field("velocity_magnitude", function=_velocity_magnitude,
+          take_log=False, units="cm/s")
 
-def _Pressure(field, data):
-    """M{(Gamma-1.0)*rho*E}"""
-    return (data.pf.gamma - 1.0) * \
-           data["Density"] * data["ThermalEnergy"]
-add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+def _tangential_over_velocity_magnitude(field, data):
+    # @todo: can velocity_magnitude be negative?
+    return np.abs(data["tangential_velocity"]) / np.abs(data["velocity_magnitude"])
 
-def _Entropy(field, data):
+add_field("tangential_over_velocity_magnitude",
+          function=_tangential_over_velocity_magnitude, take_log=False)
+
+def _pressure(field, data):
+    """ M{(Gamma-1.0)*rho*E} """
+    return (data.pf.gamma - 1.0) * data["density"] * data["thermal_energy"]
+
+add_field("pressure", function=_pressure, units="dyne/cm**2")
+
+def _entropy(field, data):
     if data.has_field_parameter("mu"):
-        mw = mh*data.get_field_parameter("mu")
-    else :
+        mw = mh * data.get_field_parameter("mu")
+    else:
         mw = mh
-    return kboltz * data["Temperature"] / \
-           ((data["Density"]/mw)**(data.pf.gamma - 1.0))
-add_field("Entropy", units=r"\rm{ergs}\ \rm{cm}^{3\gamma-3}",
-          function=_Entropy)
+    return ( kboltz * data["temperature"]
+             / ((data["density"] / mw)**(data.pf.gamma - 1.0)) )
 
-
+add_field("entropy", units="erg/K", function=_entropy)
 
 ### spherical coordinates: r (radius)
-def _sph_r(field, data):
+def _spherical_r(field, data):
     center = data.get_field_parameter("center")
-      
-    coords = obtain_rvec(data)
+    coords = obtain_rvec(data).transpose()
+    return get_sph_r(vectors, center)
 
-    return get_sph_r(coords)
-
-def _Convert_sph_r_CGS(data):
+def _convert_spherical_r_cgs(data):
    return data.convert("cm")
 
-add_field("sph_r", function=_sph_r,
+add_field("spherical_r", function=_spherical_r,
          validators=[ValidateParameter("center")],
-         convert_function = _Convert_sph_r_CGS, units=r"\rm{cm}")
-
+         convert_function=_convert_spherical_r_cgs, units="cm")
 
 ### spherical coordinates: theta (angle with respect to normal)
-def _sph_theta(field, data):
+def _spherical_theta(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_sph_theta(coords, normal)
 
-add_field("sph_theta", function=_sph_theta,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
-
+add_field("spherical_theta", function=_spherical_theta,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### spherical coordinates: phi (angle in the plane perpendicular to the normal)
-def _sph_phi(field, data):
+def _spherical_phi(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_sph_phi(coords, normal)
 
-add_field("sph_phi", function=_sph_phi,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
+add_field("spherical_phi", function=_spherical_phi,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### cylindrical coordinates: R (radius in the cylinder's plane)
-def _cyl_R(field, data):
+def _cylindrical_r(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-      
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_cyl_r(coords, normal)
 
-def _Convert_cyl_R_CGS(data):
+def _convert_cylindrical_r_cgs(data):
    return data.convert("cm")
 
-add_field("cyl_R", function=_cyl_R,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")],
-         convert_function = _Convert_cyl_R_CGS, units=r"\rm{cm}")
-add_field("cyl_RCode", function=_cyl_R,
-          validators=[ValidateParameter("center"),ValidateParameter("normal")],
-          units=r"Radius (code)")
-
+add_field("cylindrical_r", function=_cylindrical_r,
+         validators=[ValidateParameter("center"), ValidateParameter("normal")],
+         convert_function=_convert_cylindrical_r_cgs, units="cm")
+add_field("cylindrical_r_code", function=_cylindrical_r,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### cylindrical coordinates: z (height above the cylinder's plane)
-def _cyl_z(field, data):
+def _cylindrical_z(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_cyl_z(coords, normal)
 
-def _Convert_cyl_z_CGS(data):
+def _convert_cylindrical_z_cgs(data):
    return data.convert("cm")
 
-add_field("cyl_z", function=_cyl_z,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")],
-         convert_function = _Convert_cyl_z_CGS, units=r"\rm{cm}")
-
+add_field("cylindrical_z", function=_cylindrical_z,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
+          convert_function=_convert_cylindrical_z_cgs, units="cm")
 
 ### cylindrical coordinates: theta (angle in the cylinder's plane)
-def _cyl_theta(field, data):
+def _cylindrical_theta(field, data):
     center = data.get_field_parameter("center")
     normal = data.get_field_parameter("normal")
-    
-    coords = obtain_rvec(data)
-
+    coords = obtain_rvec(data).transpose()
     return get_cyl_theta(coords, normal)
 
-add_field("cyl_theta", function=_cyl_theta,
-         validators=[ValidateParameter("center"),ValidateParameter("normal")])
+add_field("cylindrical_theta", function=_cylindrical_theta,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")])
 
 ### The old field DiskAngle is the same as the spherical coordinates'
 ### 'theta' angle. I'm keeping DiskAngle for backwards compatibility.
-def _DiskAngle(field, data):
-    return data['sph_theta']
+# @todo: remove in 3.0?
+def _disk_angle(field, data):
+    return data["spherical_theta"]
 
-add_field("DiskAngle", function=_DiskAngle,
-          take_log=False,
-          validators=[ValidateParameter("center"),
-                      ValidateParameter("normal")],
+add_field("disk_angle", function=_disk_angle, take_log=False,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
           display_field=False)
 
-
 ### The old field Height is the same as the cylindrical coordinates' z
 ### field. I'm keeping Height for backwards compatibility.
-def _Height(field, data):
-    return data['cyl_z']
+# @todo: remove in 3.0?
+def _height(field, data):
+    return data["cylindrical_z"]
 
-def _convertHeight(data):
+def _convert_height(data):
     return data.convert("cm")
-def _convertHeightAU(data):
+
+def _convert_height_au(data):
     return data.convert("au")
-add_field("Height", function=_Height,
-          convert_function=_convertHeight,
+
+add_field("height", function=_height, convert_function=_convert_height,
+          validators=[ValidateParameter("center"), ValidateParameter("normal")],
+          units="cm", display_field=False)
+add_field("height_au", function=_height, convert_function=_convert_height_au,
           validators=[ValidateParameter("center"),
                       ValidateParameter("normal")],
-          units=r"cm", display_field=False)
-add_field("HeightAU", function=_Height,
-          convert_function=_convertHeightAU,
-          validators=[ValidateParameter("center"),
-                      ValidateParameter("normal")],
-          units=r"AU", display_field=False)
+          units="AU", display_field=False)
 
-def _cyl_RadialVelocity(field, data):
+def _cylindrical_radial_velocity(field, data):
     normal = data.get_field_parameter("normal")
-    velocities = obtain_rv_vec(data)
-
-    theta = data['cyl_theta']
-
+    velocities = obtain_rv_vec(data).transpose()
+    theta = np.tile(data['cylindrical_theta'], (3, 1)).transpose()
     return get_cyl_r_component(velocities, theta, normal)
 
-def _cyl_RadialVelocityABS(field, data):
-    return np.abs(_cyl_RadialVelocity(field, data))
-def _Convert_cyl_RadialVelocityKMS(data):
+def _cylindrical_radial_velocity_absolute(field, data):
+    return np.abs(_cylindrical_radial_velocity(field, data))
+
+def _convert_cylindrical_radial_velocity_kms(data):
     return km_per_cm
-add_field("cyl_RadialVelocity", function=_cyl_RadialVelocity,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityABS", function=_cyl_RadialVelocityABS,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityKMS", function=_cyl_RadialVelocity,
-          convert_function=_Convert_cyl_RadialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_RadialVelocityKMSABS", function=_cyl_RadialVelocityABS,
-          convert_function=_Convert_cyl_RadialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
 
-def _cyl_TangentialVelocity(field, data):
+add_field("cylindrical_radial_velocity", function=_cylindrical_radial_velocity,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_absolute",
+          function=_cylindrical_radial_velocity_absolute,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_kms",
+          function=_cylindrical_radial_velocity,
+          convert_function=_convert_cylindrical_radial_velocity_kms,
+          units="km/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_radial_velocity_kms_absolute",
+          function=_cylindrical_radial_velocity_absolute,
+          convert_function=_convert_cylindrical_radial_velocity_kms,
+          units="km/s", validators=[ValidateParameter("normal")])
+
+def _cylindrical_tangential_velocity(field, data):
     normal = data.get_field_parameter("normal")
-    velocities = obtain_rv_vec(data)
-    theta = data['cyl_theta']
-
+    velocities = obtain_rv_vec(data).transpose()
+    theta = np.tile(data["cylindrical_theta"], (3, 1)).transpose()
     return get_cyl_theta_component(velocities, theta, normal)
 
-def _cyl_TangentialVelocityABS(field, data):
-    return np.abs(_cyl_TangentialVelocity(field, data))
-def _Convert_cyl_TangentialVelocityKMS(data):
+def _cylindrical_tangential_velocity_absolute(field, data):
+    return np.abs(_cylindrical_tangential_velocity(field, data))
+
+def _convert_cylindrical_tangential_velocity_kms(data):
     return km_per_cm
-add_field("cyl_TangentialVelocity", function=_cyl_TangentialVelocity,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityABS", function=_cyl_TangentialVelocityABS,
-          units=r"\rm{cm}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityKMS", function=_cyl_TangentialVelocity,
-          convert_function=_Convert_cyl_TangentialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
-add_field("cyl_TangentialVelocityKMSABS", function=_cyl_TangentialVelocityABS,
-          convert_function=_Convert_cyl_TangentialVelocityKMS, units=r"\rm{km}/\rm{s}",
-          validators=[ValidateParameter("normal")])
 
-def _DynamicalTime(field, data):
+add_field("cylindrical_tangential_velocity",
+          function=_cylindrical_tangential_velocity,
+          units="cm/s", validators=[ValidateParameter("normal")])
+add_field("cylindrical_tangential_velocity_absolute",
+          function=_cylindrical_tangential_velocity_absolute,
+          units="cm/s", validators=[ValidateParameter("normal")])
+
+def _dynamical_time(field, data):
     """
-    The formulation for the dynamical time is:
-    M{sqrt(3pi/(16*G*rho))} or M{sqrt(3pi/(16G))*rho^-(1/2)}
-    Note that we return in our natural units already
+    sqrt(3 pi / (16 G rho))
     """
-    return (3.0*np.pi/(16*G*data["Density"]))**(1./2.)
-add_field("DynamicalTime", function=_DynamicalTime,
-           units=r"\rm{s}")
+    return np.sqrt(3.0 * np.pi / (16.0 * G * data["density"]))
 
-def JeansMassMsun(field,data):
-    return (MJ_constant * 
-            ((data["Temperature"]/data["MeanMolecularWeight"])**(1.5)) *
-            (data["Density"]**(-0.5)))
-add_field("JeansMassMsun",function=JeansMassMsun,units=r"\rm{Msun}")
+add_field("dynamical_time", function=_dynamical_time, units="s")
 
-def _CellMass(field, data):
-    return data["Density"] * data["CellVolume"]
-def _convertCellMassMsun(data):
-    return 5.027854e-34 # g^-1
-add_field("CellMass", function=_CellMass, units=r"\rm{g}")
-add_field("CellMassMsun", units=r"M_{\odot}",
-          function=_CellMass,
-          convert_function=_convertCellMassMsun)
+def jeans_mass(field, data):
+    return ( MJ_constant
+             * ((data["temperature"] / data["mean_molecular_weight"])**(1.5))
+             * (data["density"]**(-0.5)) )
 
-def _CellMassCode(field, data):
-    return data["Density"] * data["CellVolumeCode"]
-def _convertCellMassCode(data):
-    return 1.0/data.convert("Density")
-add_field("CellMassCode", 
-          function=_CellMassCode,
-          convert_function=_convertCellMassCode)
+add_field("jeans_mass", function=jeans_mass, units="g")
 
-def _TotalMass(field,data):
-    return (data["Density"]+data["Dark_Matter_Density"]) * data["CellVolume"]
-add_field("TotalMass", function=_TotalMass, units=r"\rm{g}")
-add_field("TotalMassMsun", units=r"M_{\odot}",
-          function=_TotalMass,
-          convert_function=_convertCellMassMsun)
+def _cell_mass(field, data):
+    return data["density"] * data["cell_volume"]
 
-def _StarMass(field,data):
-    return data["star_density"] * data["CellVolume"]
-add_field("StarMassMsun", units=r"M_{\odot}",
-          function=_StarMass,
-          convert_function=_convertCellMassMsun)
+add_field("cell_mass", function=_cell_mass, units="g")
 
-def _Matter_Density(field,data):
-    return (data['Density'] + data['Dark_Matter_Density'])
-add_field("Matter_Density",function=_Matter_Density,units=r"\rm{g}/\rm{cm^3}")
+def _total_mass(field, data):
+    return (data["density"] + data["dark_matter_density"]) * data["cell_volume"]
 
-def _ComovingDensity(field, data):
-    ef = (1.0 + data.pf.current_redshift)**3.0
-    return data["Density"]/ef
-add_field("ComovingDensity", function=_ComovingDensity, units=r"\rm{g}/\rm{cm}^3")
+add_field("total_mass", function=_total_mass, units="g")
+
+def _star_mass(field, data):
+    return data["star_density"] * data["cell_volume"]
+
+add_field("star_mass", units="g", function=_star_mass)
+
+def _matter_density(field, data):
+    return (data["density"] + data["dark_matter_density"])
+
+add_field("matter_density", function=_matter_density, units="g/cm**3")
+
+def _comoving_density(field, data):
+    z = data.pf.current_redshift
+    return data["density"] / (1.0 + z)**3
+
+add_field("comoving_density", function=_comoving_density, units="g/cm**3")
 
 # This is rho_total / rho_cr(z).
-def _Convert_Overdensity(data):
-    return 1.0 / (rho_crit_now * data.pf.hubble_constant**2 * 
+def _convert_overdensity(data):
+    return 1 / (rho_crit_now * data.pf.hubble_constant**2 *
                 (1+data.pf.current_redshift)**3)
-add_field("Overdensity",function=_Matter_Density,
-          convert_function=_Convert_Overdensity, units=r"")
+add_field("Overdensity",function=_matter_density,
+          convert_function=_convert_overdensity, units="")
 
-# This is (rho_total - <rho_total>) / <rho_total>.
-def _DensityPerturbation(field, data):
-    rho_bar = rho_crit_now * data.pf.omega_matter * \
-        data.pf.hubble_constant**2 * \
-        (1.0 + data.pf.current_redshift)**3
-    return ((data['Matter_Density'] - rho_bar) / rho_bar)
-add_field("DensityPerturbation",function=_DensityPerturbation,units=r"")
+# This is rho_matter / <rho_matter> - 1.0
+def _overdensity(field, data):
+    omega_m = data.pf.omega_matter
+    h = data.pf.hubble_constant
+    z = data.pf.current_redshift
+    rho_m = rho_crit_now * h**2 * omega_m * (1.0 + z)**3
+    return data["matter_density"] / rho_m - 1.0
 
-# This is rho_b / <rho_b>.
-def _Baryon_Overdensity(field, data):
+add_field("overdensity", function=_overdensity)
+
+# This is rho_baryon / <rho_baryon> - 1.0.
+def _baryon_overdensity(field, data):
+    # @todo: should we provide this field if the dataset doesn't have omega_b?
     if data.pf.has_key('omega_baryon_now'):
         omega_baryon_now = data.pf['omega_baryon_now']
     else:
         omega_baryon_now = 0.0441
-    return data['Density'] / (omega_baryon_now * rho_crit_now * 
-                              (data.pf.hubble_constant**2) * 
-                              ((1+data.pf.current_redshift)**3))
-add_field("Baryon_Overdensity", function=_Baryon_Overdensity, 
-          units=r"")
+
+    return data["density"] / (omega_baryon_now * rho_crit_now *
+                              (data.pf["CosmologyHubbleConstantNow"]**2) *
+                              ((1.0 + data.pf["CosmologyCurrentRedshift"])**3))
+
+add_field("baryon_overdensity", function=_baryon_overdensity)
 
 # Weak lensing convergence.
 # Eqn 4 of Metzler, White, & Loken (2001, ApJ, 547, 560).
@@ -450,110 +453,110 @@
     # lens to source
     DLS = data.pf.parameters['cosmology_calculator'].AngularDiameterDistance(
         data.pf.current_redshift, data.pf.parameters['lensing_source_redshift'])
-    return (((DL * DLS) / DS) * (1.5e14 * data.pf.omega_matter * 
+    return (((DL * DLS) / DS) * (1.5e14 * data.pf.omega_matter *
                                 (data.pf.hubble_constant / speed_of_light_cgs)**2 *
                                 (1 + data.pf.current_redshift)))
-add_field("WeakLensingConvergence", function=_DensityPerturbation, 
-          convert_function=_convertConvergence, 
+add_field("WeakLensingConvergence", function=_overdensity,
+          convert_function=_convertConvergence,
           projection_conversion='mpccm')
 
-def _CellVolume(field, data):
-    if data['dx'].size == 1:
+def _cell_volume(field, data):
+    if data["dx"].size == 1:
         try:
-            return data['dx'] * data['dy'] * data['dz'] * \
-                np.ones(data.ActiveDimensions, dtype='float64')
+            return ( data["dx"] * data["dy"] * data["dx"]
+                     * np.ones(data.ActiveDimensions, dtype=np.float64) )
         except AttributeError:
-            return data['dx'] * data['dy'] * data['dz']
+            return data["dx"] * data["dy"] * data["dx"]
     return data["dx"] * data["dy"] * data["dz"]
-def _ConvertCellVolumeMpc(data):
-    return data.convert("mpc")**3.0
-def _ConvertCellVolumeCGS(data):
-    return data.convert("cm")**3.0
-add_field("CellVolumeCode", units=r"\rm{BoxVolume}^3",
-          function=_CellVolume)
-add_field("CellVolumeMpc", units=r"\rm{Mpc}^3",
-          function=_CellVolume,
-          convert_function=_ConvertCellVolumeMpc)
-add_field("CellVolume", units=r"\rm{cm}^3",
-          function=_CellVolume,
-          convert_function=_ConvertCellVolumeCGS)
 
-def _ChandraEmissivity(field, data):
-    logT0 = np.log10(data["Temperature"]) - 7
-    return ((data["NumberDensity"].astype('float64')**2.0) \
-            *(10**(-0.0103*logT0**8 \
-                   +0.0417*logT0**7 \
-                   -0.0636*logT0**6 \
-                   +0.1149*logT0**5 \
-                   -0.3151*logT0**4 \
-                   +0.6655*logT0**3 \
-                   -1.1256*logT0**2 \
-                   +1.0026*logT0**1 \
-                   -0.6984*logT0) \
-              +data["Metallicity"]*10**(0.0305*logT0**11 \
-                                        -0.0045*logT0**10 \
-                                        -0.3620*logT0**9 \
-                                        +0.0513*logT0**8 \
-                                        +1.6669*logT0**7 \
-                                        -0.3854*logT0**6 \
-                                        -3.3604*logT0**5 \
-                                        +0.4728*logT0**4 \
-                                        +4.5774*logT0**3 \
-                                        -2.3661*logT0**2 \
-                                        -1.6667*logT0**1 \
-                                        -0.2193*logT0)))
-def _convertChandraEmissivity(data):
-    return 1.0 #1.0e-23*0.76**2
-add_field("ChandraEmissivity", function=_ChandraEmissivity,
-          convert_function=_convertChandraEmissivity,
+add_field("cell_volume", units="cm**3", function=_cell_volume)
+
+def _chandra_emissivity(field, data):
+    logT0 = np.log10(data["temperature"]) - 7
+    return ( data["number_density"].astype(np.float64)**2
+             * ( 10**(-0.0103 * logT0**8
+                      +0.0417 * logT0**7
+                      -0.0636 * logT0**6
+                      +0.1149 * logT0**5
+                      -0.3151 * logT0**4
+                      +0.6655 * logT0**3
+                      -1.1256 * logT0**2
+                      +1.0026 * logT0**1
+                      -0.6984 * logT0)
+                 + data["metallicity"] * 10**(0.0305 * logT0**11
+                                              -0.0045 * logT0**10
+                                              -0.3620 * logT0**9
+                                              +0.0513 * logT0**8
+                                              +1.6669 * logT0**7
+                                              -0.3854 * logT0**6
+                                              -3.3604 * logT0**5
+                                              +0.4728 * logT0**4
+                                              +4.5774 * logT0**3
+                                              -2.3661 * logT0**2
+                                              -1.6667 * logT0**1
+                                              -0.2193 * logT0) ) )
+
+def _convert_chandra_emissivity(data):
+    return 1.0  # 1.0e-23*0.76**2
+
+add_field("chandra_emissivity", function=_chandra_emissivity,
+          convert_function=_convert_chandra_emissivity,
           projection_conversion="1")
 
-def _XRayEmissivity(field, data):
-    return ((data["Density"].astype('float64')**2.0) \
-            *data["Temperature"]**0.5)
-def _convertXRayEmissivity(data):
+def _xray_emissivity(field, data):
+    return ( data["density"].astype(np.float64)**2
+             * data["temperature"]**0.5 )
+
+def _convert_xray_emissivity(data):
     return 2.168e60
-add_field("XRayEmissivity", function=_XRayEmissivity,
-          convert_function=_convertXRayEmissivity,
+
+add_field("xray_emissivity", function=_xray_emissivity,
+          convert_function=_convert_xray_emissivity,
           projection_conversion="1")
 
-def _SZKinetic(field, data):
-    vel_axis = data.get_field_parameter('axis')
+def _sz_kinetic(field, data):
+    vel_axis = data.get_field_parameter("axis")
     if vel_axis > 2:
-        raise NeedsParameter(['axis'])
-    vel = data["%s-velocity" % ({0:'x',1:'y',2:'z'}[vel_axis])]
-    return (vel*data["Density"])
-def _convertSZKinetic(data):
-    return 0.88*((sigma_thompson/mh)/clight)
-add_field("SZKinetic", function=_SZKinetic,
-          convert_function=_convertSZKinetic,
-          validators=[ValidateParameter('axis')])
+        raise NeedsParameter(["axis"])
+    vel = data["velocity_%s" % ({0: "x", 1: "y", 2: "z"}[vel_axis])]
+    return (vel * data["density"])
 
-def _SZY(field, data):
-    return (data["Density"]*data["Temperature"])
-def _convertSZY(data):
-    conv = (0.88/mh) * (kboltz)/(me * clight*clight) * sigma_thompson
+def _convert_sz_kinetic(data):
+    return 0.88 * sigma_thompson / mh / clight
+
+add_field("sz_kinetic", function=_sz_kinetic,
+          convert_function=_convert_sz_kinetic,
+          validators=[ValidateParameter("axis")])
+
+def _szy(field, data):
+    return data["density"] * data["temperature"]
+
+def _convert_szy(data):
+    conv = 0.88 / mh * kboltz / (me * clight*clight) * sigma_thompson
     return conv
-add_field("SZY", function=_SZY, convert_function=_convertSZY)
 
-def _AveragedDensity(field, data):
-    nx, ny, nz = data["Density"].shape
-    new_field = np.zeros((nx-2,ny-2,nz-2), dtype='float64')
-    weight_field = np.zeros((nx-2,ny-2,nz-2), dtype='float64')
-    i_i, j_i, k_i = np.mgrid[0:3,0:3,0:3]
-    for i,j,k in zip(i_i.ravel(),j_i.ravel(),k_i.ravel()):
-        sl = [slice(i,nx-(2-i)),slice(j,ny-(2-j)),slice(k,nz-(2-k))]
-        new_field += data["Density"][sl] * data["CellMass"][sl]
-        weight_field += data["CellMass"][sl]
+add_field("szy", function=_szy, convert_function=_convert_szy)
+
+def _averaged_density(field, data):
+    nx, ny, nz = data["density"].shape
+    new_field = np.zeros((nx-2, ny-2, nz-2), dtype=np.float64)
+    weight_field = np.zeros((nx-2, ny-2, nz-2), dtype=np.float64)
+    i_i, j_i, k_i = np.mgrid[0:3, 0:3, 0:3]
+
+    for i, j, k in zip(i_i.ravel(), j_i.ravel(), k_i.ravel()):
+        sl = [slice(i, nx-(2-i)), slice(j, ny-(2-j)), slice(k, nz-(2-k))]
+        new_field += data["density"][sl] * data["cell_mass"][sl]
+        weight_field += data["cell_mass"][sl]
+
     # Now some fancy footwork
-    new_field2 = np.zeros((nx,ny,nz))
-    new_field2[1:-1,1:-1,1:-1] = new_field/weight_field
+    new_field2 = np.zeros((nx, ny, nz))
+    new_field2[1:-1, 1:-1, 1:-1] = new_field / weight_field
     return new_field2
-add_field("AveragedDensity",
-          function=_AveragedDensity,
-          validators=[ValidateSpatial(1, ["Density"])])
 
-def _DivV(field, data):
+add_field("averaged_density", function=_averaged_density,
+          validators=[ValidateSpatial(1, ["density"])])
+
+def _div_v(field, data):
     # We need to set up stencils
     if data.pf["HydroMethod"] == 2:
         sl_left = slice(None,-2,None)
@@ -563,81 +566,82 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    ds = div_fac * data['dx'].flat[0]
+    ds = div_fac * data["dx"].flat[0]
     f  = data["x-velocity"][sl_right,1:-1,1:-1]/ds
     f -= data["x-velocity"][sl_left ,1:-1,1:-1]/ds
     if data.pf.dimensionality > 1:
-        ds = div_fac * data['dy'].flat[0]
+        ds = div_fac * data["dy"].flat[0]
         f += data["y-velocity"][1:-1,sl_right,1:-1]/ds
         f -= data["y-velocity"][1:-1,sl_left ,1:-1]/ds
     if data.pf.dimensionality > 2:
-        ds = div_fac * data['dz'].flat[0]
+        ds = div_fac * data["dz"].flat[0]
         f += data["z-velocity"][1:-1,1:-1,sl_right]/ds
         f -= data["z-velocity"][1:-1,1:-1,sl_left ]/ds
-    new_field = np.zeros(data["x-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["x-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = f
     return new_field
-def _convertDivV(data):
+
+def _convert_div_v(data):
     return data.convert("cm")**-1.0
-add_field("DivV", function=_DivV,
-            validators=[ValidateSpatial(1,
-            ["x-velocity","y-velocity","z-velocity"])],
-          units=r"\rm{s}^{-1}", take_log=False,
-          convert_function=_convertDivV)
 
-def _AbsDivV(field, data):
-    return np.abs(data['DivV'])
-add_field("AbsDivV", function=_AbsDivV,
-          units=r"\rm{s}^{-1}")
+add_field("div_v", function=_div_v,
+          validators=[ValidateSpatial(1, ["velocity_x", "velocity_y",
+                                          "velocity_z"])],
+          units="1/s", take_log=False, convert_function=_convert_div_v)
 
-def _Contours(field, data):
-    return -np.ones_like(data["Ones"])
-add_field("Contours", validators=[ValidateSpatial(0)], take_log=False,
-          display_field=False, function=_Contours)
-add_field("tempContours", function=_Contours,
+def _absolute_div_v(field, data):
+    return np.abs(data["div_v"])
+
+add_field("absolute_div_v", function=_absolute_div_v, units="1/s")
+
+def _contours(field, data):
+    return -np.ones_like(data["ones"])
+
+add_field("contours", validators=[ValidateSpatial(0)], take_log=False,
+          display_field=False, function=_contours)
+add_field("temp_contours", function=_contours,
           validators=[ValidateSpatial(0), ValidateGridType()],
           take_log=False, display_field=False)
 
 def obtain_velocities(data):
     return obtain_rv_vec(data)
 
-def _convertSpecificAngularMomentum(data):
-    return data.convert("cm")
-def _convertSpecificAngularMomentumKMSMPC(data):
-    return data.convert("mpc")/1e5
-
-def _SpecificAngularMomentumX(field, data):
+def _specific_angular_momentum_x(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return yv*rv[2,:] - zv*rv[1,:]
-def _SpecificAngularMomentumY(field, data):
+    return yv * rv[2, :] - zv * rv[1, :]
+
+def _specific_angular_momentum_y(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return -(xv*rv[2,:] - zv*rv[0,:])
-def _SpecificAngularMomentumZ(field, data):
+    return - (xv * rv[2, :] - zv * rv[0, :])
+
+def _specific_angular_momentum_z(field, data):
     xv, yv, zv = obtain_velocities(data)
     rv = obtain_rvec(data)
-    return xv*rv[1,:] - yv*rv[0,:]
-for ax in 'XYZ':
-    n = "SpecificAngularMomentum%s" % ax
-    add_field(n, function=eval("_%s" % n),
-              convert_function=_convertSpecificAngularMomentum,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+    return xv * rv[1, :] - yv * rv[0, :]
 
-def _AngularMomentumX(field, data):
+add_field("specific_angular_momentum_x", function=_specific_angular_momentum_x,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+add_field("specific_angular_momentum_y", function=_specific_angular_momentum_y,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+add_field("specific_angular_momentum_z", function=_specific_angular_momentum_z,
+          units="cm**2/s", validators=[ValidateParameter("center")])
+
+def _angular_momentum_x(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumX"]
-add_field("AngularMomentumX", function=_AngularMomentumX,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumX", function=_angular_momentum_x,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
-def _AngularMomentumY(field, data):
+def _angular_momentum_y(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumY"]
-add_field("AngularMomentumY", function=_AngularMomentumY,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumY", function=_angular_momentum_y,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
-def _AngularMomentumZ(field, data):
+def _angular_momentum_z(field, data):
     return data["CellMass"] * data["SpecificAngularMomentumZ"]
-add_field("AngularMomentumZ", function=_AngularMomentumZ,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=False,
+add_field("AngularMomentumZ", function=_angular_momentum_z,
+         units="g * cm**2 / s", vector_field=False,
          validators=[ValidateParameter('center')])
 
 def _ParticleSpecificAngularMomentum(field, data):
@@ -647,17 +651,17 @@
     """
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     xv = data["particle_velocity_x"] - bv[0]
     yv = data["particle_velocity_y"] - bv[1]
     zv = data["particle_velocity_z"] - bv[2]
     center = data.get_field_parameter('center')
     coords = np.array([data['particle_position_x'],
                        data['particle_position_y'],
-                       data['particle_position_z']], dtype='float64')
+                       data['particle_position_z']], dtype=np.float64)
     new_shape = tuple([3] + [1]*(len(coords.shape)-1))
     r_vec = coords - np.reshape(center,new_shape)
-    v_vec = np.array([xv,yv,zv], dtype='float64')
+    v_vec = np.array([xv,yv,zv], dtype=np.float64)
     return np.cross(r_vec, v_vec, axis=0)
 #add_field("ParticleSpecificAngularMomentum",
 #          function=_ParticleSpecificAngularMomentum, particle_type=True,
@@ -673,7 +677,7 @@
 def _ParticleSpecificAngularMomentumX(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     y = data["particle_position_y"] - center[1]
     z = data["particle_position_z"] - center[2]
@@ -683,7 +687,7 @@
 def _ParticleSpecificAngularMomentumY(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     x = data["particle_position_x"] - center[0]
     z = data["particle_position_z"] - center[2]
@@ -693,7 +697,7 @@
 def _ParticleSpecificAngularMomentumZ(field, data):
     if data.has_field_parameter("bulk_velocity"):
         bv = data.get_field_parameter("bulk_velocity")
-    else: bv = np.zeros(3, dtype='float64')
+    else: bv = np.zeros(3, dtype=np.float64)
     center = data.get_field_parameter('center')
     x = data["particle_position_x"] - center[0]
     y = data["particle_position_y"] - center[1]
@@ -703,11 +707,10 @@
 for ax in 'XYZ':
     n = "ParticleSpecificAngularMomentum%s" % ax
     add_field(n, function=eval("_%s" % n), particle_type=True,
-              convert_function=_convertSpecificAngularMomentum,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+              units="cm**2/s", validators=[ValidateParameter("center")])
     add_field(n + "KMSMPC", function=eval("_%s" % n), particle_type=True,
               convert_function=_convertSpecificAngularMomentumKMSMPC,
-              units=r"\rm{cm}^2/\rm{s}", validators=[ValidateParameter("center")])
+              units="cm**2/s", validators=[ValidateParameter("center")])
 
 def _ParticleAngularMomentum(field, data):
     return data["ParticleMass"] * data["ParticleSpecificAngularMomentum"]
@@ -724,17 +727,17 @@
 def _ParticleAngularMomentumX(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumX"]
 add_field("ParticleAngularMomentumX", function=_ParticleAngularMomentumX,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 def _ParticleAngularMomentumY(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumY"]
 add_field("ParticleAngularMomentumY", function=_ParticleAngularMomentumY,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 def _ParticleAngularMomentumZ(field, data):
     return data["CellMass"] * data["ParticleSpecificAngularMomentumZ"]
 add_field("ParticleAngularMomentumZ", function=_ParticleAngularMomentumZ,
-         units=r"\rm{g}\/\rm{cm}^2/\rm{s}", particle_type=True,
+         units="g*cm**2/s", particle_type=True,
          validators=[ValidateParameter('center')])
 
 def get_radius(positions, data):
@@ -758,22 +761,22 @@
     return data.convert("cm")
 add_field("ParticleRadius", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusCGS, units=r"\rm{cm}",
+          convert_function = _ConvertRadiusCGS, units="cm",
           particle_type = True,
           display_name = "Particle Radius")
 add_field("Radius", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusCGS, units=r"\rm{cm}")
+          convert_function = _ConvertRadiusCGS, units="cm")
 
 def _ConvertRadiusMpc(data):
     return data.convert("mpc")
 add_field("RadiusMpc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusMpc, units=r"\rm{Mpc}",
+          convert_function = _ConvertRadiusMpc, units="Mpc",
           display_name = "Radius")
 add_field("ParticleRadiusMpc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusMpc, units=r"\rm{Mpc}",
+          convert_function = _ConvertRadiusMpc, units="Mpc",
           particle_type=True,
           display_name = "Particle Radius")
 
@@ -781,48 +784,48 @@
     return data.convert("kpc")
 add_field("ParticleRadiuskpc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}",
+          convert_function = _ConvertRadiuskpc, units="kpc",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuskpc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}",
+          convert_function = _ConvertRadiuskpc, units="kpc",
           display_name = "Radius")
 
 def _ConvertRadiuskpch(data):
     return data.convert("kpch")
 add_field("ParticleRadiuskpch", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpch, units=r"\rm{kpc}/\rm{h}",
+          convert_function = _ConvertRadiuskpch, units="kpc/h",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuskpch", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuskpc, units=r"\rm{kpc}/\rm{h}",
+          convert_function = _ConvertRadiuskpc, units="kpc/h",
           display_name = "Radius")
 
 def _ConvertRadiuspc(data):
     return data.convert("pc")
 add_field("ParticleRadiuspc", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuspc, units=r"\rm{pc}",
+          convert_function = _ConvertRadiuspc, units="pc",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("Radiuspc", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiuspc, units=r"\rm{pc}",
+          convert_function = _ConvertRadiuspc, units="pc",
           display_name="Radius")
 
 def _ConvertRadiusAU(data):
     return data.convert("au")
 add_field("ParticleRadiusAU", function=_ParticleRadius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusAU, units=r"\rm{AU}",
+          convert_function = _ConvertRadiusAU, units="AU",
           particle_type=True,
           display_name = "Particle Radius")
 add_field("RadiusAU", function=_Radius,
           validators=[ValidateParameter("center")],
-          convert_function = _ConvertRadiusAU, units=r"\rm{AU}",
+          convert_function = _ConvertRadiusAU, units="AU",
           display_name = "Radius")
 
 add_field("ParticleRadiusCode", function=_ParticleRadius,
@@ -835,9 +838,9 @@
 
 def _RadialVelocity(field, data):
     normal = data.get_field_parameter("normal")
-    velocities = obtain_rv_vec(data)    
-    theta = data['sph_theta']
-    phi   = data['sph_phi']
+    velocities = obtain_rv_vec(data).transpose()
+    theta = np.tile(data['sph_theta'], (3, 1)).transpose()
+    phi   = np.tile(data['sph_phi'], (3, 1)).transpose()
 
     return get_sph_r_component(velocities, theta, phi, normal)
 
@@ -846,20 +849,20 @@
 def _ConvertRadialVelocityKMS(data):
     return km_per_cm
 add_field("RadialVelocity", function=_RadialVelocity,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 add_field("RadialVelocityABS", function=_RadialVelocityABS,
-          units=r"\rm{cm}/\rm{s}")
+          units="cm/s")
 add_field("RadialVelocityKMS", function=_RadialVelocity,
-          convert_function=_ConvertRadialVelocityKMS, units=r"\rm{km}/\rm{s}")
+          convert_function=_ConvertRadialVelocityKMS, units="km/s")
 add_field("RadialVelocityKMSABS", function=_RadialVelocityABS,
-          convert_function=_ConvertRadialVelocityKMS, units=r"\rm{km}/\rm{s}")
+          convert_function=_ConvertRadialVelocityKMS, units="km/s")
 
 def _TangentialVelocity(field, data):
     return np.sqrt(data["VelocityMagnitude"]**2.0
                  - data["RadialVelocity"]**2.0)
-add_field("TangentialVelocity", 
+add_field("TangentialVelocity",
           function=_TangentialVelocity,
-          take_log=False, units=r"\rm{cm}/\rm{s}")
+          take_log=False, units="cm/s")
 
 def _CuttingPlaneVelocityX(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
@@ -870,10 +873,10 @@
     v_vec = np.array([data["%s-velocity" % ax] for ax in 'xyz']) \
                 - bulk_velocity[...,np.newaxis]
     return np.dot(x_vec, v_vec)
-add_field("CuttingPlaneVelocityX", 
+add_field("CuttingPlaneVelocityX",
           function=_CuttingPlaneVelocityX,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{km}/\rm{s}")
+                      for ax in 'xyz'], units="km/s")
 def _CuttingPlaneVelocityY(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
@@ -883,29 +886,29 @@
     v_vec = np.array([data["%s-velocity" % ax] for ax in 'xyz']) \
                 - bulk_velocity[...,np.newaxis]
     return np.dot(y_vec, v_vec)
-add_field("CuttingPlaneVelocityY", 
+add_field("CuttingPlaneVelocityY",
           function=_CuttingPlaneVelocityY,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{km}/\rm{s}")
+                      for ax in 'xyz'], units="km/s")
 
 def _CuttingPlaneBx(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
     b_vec = np.array([data["B%s" % ax] for ax in 'xyz'])
     return np.dot(x_vec, b_vec)
-add_field("CuttingPlaneBx", 
+add_field("CuttingPlaneBx",
           function=_CuttingPlaneBx,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{Gauss}")
+                      for ax in 'xyz'], units="gauss")
 def _CuttingPlaneBy(field, data):
     x_vec, y_vec, z_vec = [data.get_field_parameter("cp_%s_vec" % (ax))
                            for ax in 'xyz']
     b_vec = np.array([data["B%s" % ax] for ax in 'xyz'])
     return np.dot(y_vec, b_vec)
-add_field("CuttingPlaneBy", 
+add_field("CuttingPlaneBy",
           function=_CuttingPlaneBy,
           validators=[ValidateParameter("cp_%s_vec" % ax)
-                      for ax in 'xyz'], units=r"\rm{Gauss}")
+                      for ax in 'xyz'], units="gauss")
 
 def _MeanMolecularWeight(field,data):
     return (data["Density"] / (mh *data["NumberDensity"]))
@@ -919,7 +922,7 @@
             ((data["Temperature"]/data["MeanMolecularWeight"])**(1.5)) *
             (data["Density"]**(-0.5)))
 add_field("JeansMassMsun",function=_JeansMassMsun,
-          units=r"\rm{M_{\odot}}")
+          units="Msun")
 
 def _convertDensity(data):
     return data.convert("Density")
@@ -946,7 +949,7 @@
     """
     return (data["Bx"]**2 + data["By"]**2 + data["Bz"]**2)/(8*np.pi)
 add_field("MagneticEnergy",function=_MagneticEnergy,
-          units=r"\rm{ergs}\/\rm{cm}^{-3}",
+          units="erg / cm**3",
           display_name=r"\rm{Magnetic}\/\rm{Energy}")
 
 def _BMagnitude(field,data):
@@ -957,7 +960,7 @@
     return np.sqrt((data["Bx"]**2 + data["By"]**2 + data["Bz"]**2))
 add_field("BMagnitude",
           function=_BMagnitude,
-          display_name=r"|B|", units=r"\rm{Gauss}")
+          display_name=r"|B|", units="gauss")
 
 def _PlasmaBeta(field,data):
     """This assumes that your front end has provided Bx, By, Bz in
@@ -974,7 +977,7 @@
 add_field("MagneticPressure",
           function=_MagneticPressure,
           display_name=r"\rm{Magnetic}\/\rm{Energy}",
-          units="\rm{ergs}\/\rm{cm}^{-3}")
+          units="erg / cm**3")
 
 def _BPoloidal(field,data):
     normal = data.get_field_parameter("normal")
@@ -987,7 +990,7 @@
     return get_sph_theta_component(Bfields, theta, phi, normal)
 
 add_field("BPoloidal", function=_BPoloidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _BToroidal(field,data):
@@ -1000,7 +1003,7 @@
     return get_sph_phi_component(Bfields, phi, normal)
 
 add_field("BToroidal", function=_BToroidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _BRadial(field,data):
@@ -1014,7 +1017,7 @@
     return get_sph_r_component(Bfields, theta, phi, normal)
 
 add_field("BRadial", function=_BPoloidal,
-          units=r"\rm{Gauss}",
+          units="gauss",
           validators=[ValidateParameter("normal")])
 
 def _VorticitySquared(field, data):
@@ -1060,7 +1063,7 @@
 add_field("VorticitySquared", function=_VorticitySquared,
           validators=[ValidateSpatial(1,
               ["x-velocity","y-velocity","z-velocity"])],
-          units=r"\rm{s}^{-2}",
+          units="s**-2",
           convert_function=_convertVorticitySquared)
 
 def _gradPressureX(field, data):
@@ -1073,7 +1076,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dx'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][sl_right,1:-1,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][sl_left ,1:-1,1:-1]/ds
@@ -1088,7 +1091,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dy'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][1:-1,sl_right,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][1:-1,sl_left ,1:-1]/ds
@@ -1103,7 +1106,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Pressure"].shape, dtype='float64')
+    new_field = np.zeros(data["Pressure"].shape, dtype=np.float64)
     ds = div_fac * data['dz'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Pressure"][1:-1,1:-1,sl_right]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Pressure"][1:-1,1:-1,sl_left ]/ds
@@ -1115,7 +1118,7 @@
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertgradPressure,
               validators=[ValidateSpatial(1, ["Pressure"])],
-              units=r"\rm{dyne}/\rm{cm}^{3}")
+              units="dyne/cm**3")
 
 def _gradPressureMagnitude(field, data):
     return np.sqrt(data["gradPressureX"]**2 +
@@ -1123,7 +1126,7 @@
                    data["gradPressureZ"]**2)
 add_field("gradPressureMagnitude", function=_gradPressureMagnitude,
           validators=[ValidateSpatial(1, ["Pressure"])],
-          units=r"\rm{dyne}/\rm{cm}^{3}")
+          units="dyne/cm**3")
 
 def _gradDensityX(field, data):
     # We need to set up stencils
@@ -1135,7 +1138,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dx'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][sl_right,1:-1,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][sl_left ,1:-1,1:-1]/ds
@@ -1150,7 +1153,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dy'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][1:-1,sl_right,1:-1]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][1:-1,sl_left ,1:-1]/ds
@@ -1165,7 +1168,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["Density"].shape, dtype='float64')
+    new_field = np.zeros(data["Density"].shape, dtype=np.float64)
     ds = div_fac * data['dz'].flat[0]
     new_field[1:-1,1:-1,1:-1]  = data["Density"][1:-1,1:-1,sl_right]/ds
     new_field[1:-1,1:-1,1:-1] -= data["Density"][1:-1,1:-1,sl_left ]/ds
@@ -1177,7 +1180,7 @@
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertgradDensity,
               validators=[ValidateSpatial(1, ["Density"])],
-              units=r"\rm{g}/\rm{cm}^{4}")
+              units="g/cm**4")
 
 def _gradDensityMagnitude(field, data):
     return np.sqrt(data["gradDensityX"]**2 +
@@ -1185,25 +1188,25 @@
                    data["gradDensityZ"]**2)
 add_field("gradDensityMagnitude", function=_gradDensityMagnitude,
           validators=[ValidateSpatial(1, ["Density"])],
-          units=r"\rm{g}/\rm{cm}^{4}")
+          units="g/cm**4")
 
 def _BaroclinicVorticityX(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureY"] * data["gradDensityZ"] -
             data["gradPressureZ"] * data["gradDensityY"]) / rho2
 def _BaroclinicVorticityY(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureZ"] * data["gradDensityX"] -
             data["gradPressureX"] * data["gradDensityZ"]) / rho2
 def _BaroclinicVorticityZ(field, data):
-    rho2 = data["Density"].astype('float64')**2
+    rho2 = data["Density"].astype(np.float64)**2
     return (data["gradPressureX"] * data["gradDensityY"] -
             data["gradPressureY"] * data["gradDensityX"]) / rho2
 for ax in 'XYZ':
     n = "BaroclinicVorticity%s" % ax
     add_field(n, function=eval("_%s" % n),
           validators=[ValidateSpatial(1, ["Density", "Pressure"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _BaroclinicVorticityMagnitude(field, data):
     return np.sqrt(data["BaroclinicVorticityX"]**2 +
@@ -1212,7 +1215,7 @@
 add_field("BaroclinicVorticityMagnitude",
           function=_BaroclinicVorticityMagnitude,
           validators=[ValidateSpatial(1, ["Density", "Pressure"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityX(field, data):
     # We need to set up stencils
@@ -1224,7 +1227,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["z-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["z-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["z-velocity"][1:-1,sl_right,1:-1] -
                                  data["z-velocity"][1:-1,sl_left,1:-1]) \
                                  / (div_fac*data["dy"].flat[0])
@@ -1242,7 +1245,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["z-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["z-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["x-velocity"][1:-1,1:-1,sl_right] -
                                  data["x-velocity"][1:-1,1:-1,sl_left]) \
                                  / (div_fac*data["dz"].flat[0])
@@ -1260,7 +1263,7 @@
         sl_left = slice(None,-2,None)
         sl_right = slice(2,None,None)
         div_fac = 2.0
-    new_field = np.zeros(data["x-velocity"].shape, dtype='float64')
+    new_field = np.zeros(data["x-velocity"].shape, dtype=np.float64)
     new_field[1:-1,1:-1,1:-1] = (data["y-velocity"][sl_right,1:-1,1:-1] -
                                  data["y-velocity"][sl_left,1:-1,1:-1]) \
                                  / (div_fac*data["dx"].flat[0])
@@ -1274,18 +1277,18 @@
     n = "Vorticity%s" % ax
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertVorticity,
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                           ["x-velocity", "y-velocity", "z-velocity"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 
 def _VorticityMagnitude(field, data):
     return np.sqrt(data["VorticityX"]**2 +
                    data["VorticityY"]**2 +
                    data["VorticityZ"]**2)
 add_field("VorticityMagnitude", function=_VorticityMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityStretchingX(field, data):
     return data["DivV"] * data["VorticityX"]
@@ -1301,11 +1304,11 @@
     return np.sqrt(data["VorticityStretchingX"]**2 +
                    data["VorticityStretchingY"]**2 +
                    data["VorticityStretchingZ"]**2)
-add_field("VorticityStretchingMagnitude", 
+add_field("VorticityStretchingMagnitude",
           function=_VorticityStretchingMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityGrowthX(field, data):
     return -data["VorticityStretchingX"] - data["BaroclinicVorticityX"]
@@ -1316,9 +1319,9 @@
 for ax in 'XYZ':
     n = "VorticityGrowth%s" % ax
     add_field(n, function=eval("_%s" % n),
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                           ["x-velocity", "y-velocity", "z-velocity"])],
-              units=r"\rm{s}^{-2}")
+              units="1/s")
 def _VorticityGrowthMagnitude(field, data):
     result = np.sqrt(data["VorticityGrowthX"]**2 +
                      data["VorticityGrowthY"]**2 +
@@ -1329,18 +1332,18 @@
     result = np.sign(dot) * result
     return result
 add_field("VorticityGrowthMagnitude", function=_VorticityGrowthMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}",
+          units="1/s",
           take_log=False)
 def _VorticityGrowthMagnitudeABS(field, data):
     return np.sqrt(data["VorticityGrowthX"]**2 +
                    data["VorticityGrowthY"]**2 +
                    data["VorticityGrowthZ"]**2)
 add_field("VorticityGrowthMagnitudeABS", function=_VorticityGrowthMagnitudeABS,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityGrowthTimescale(field, data):
     domegax_dt = data["VorticityX"] / data["VorticityGrowthX"]
@@ -1348,24 +1351,24 @@
     domegaz_dt = data["VorticityZ"] / data["VorticityGrowthZ"]
     return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt)
 add_field("VorticityGrowthTimescale", function=_VorticityGrowthTimescale,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["x-velocity", "y-velocity", "z-velocity"])],
-          units=r"\rm{s}")
+          units="s")
 
 ########################################################################
 # With radiation pressure
 ########################################################################
 
 def _VorticityRadPressureX(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel2"] * data["gradDensityZ"] -
             data["RadAccel3"] * data["gradDensityY"]) / rho
 def _VorticityRadPressureY(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel3"] * data["gradDensityX"] -
             data["RadAccel1"] * data["gradDensityZ"]) / rho
 def _VorticityRadPressureZ(field, data):
-    rho = data["Density"].astype('float64')
+    rho = data["Density"].astype(np.float64)
     return (data["RadAccel1"] * data["gradDensityY"] -
             data["RadAccel2"] * data["gradDensityX"]) / rho
 def _convertRadAccel(data):
@@ -1374,9 +1377,9 @@
     n = "VorticityRadPressure%s" % ax
     add_field(n, function=eval("_%s" % n),
               convert_function=_convertRadAccel,
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                    ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 
 def _VorticityRadPressureMagnitude(field, data):
     return np.sqrt(data["VorticityRadPressureX"]**2 +
@@ -1384,9 +1387,9 @@
                    data["VorticityRadPressureZ"]**2)
 add_field("VorticityRadPressureMagnitude",
           function=_VorticityRadPressureMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityRPGrowthX(field, data):
     return -data["VorticityStretchingX"] - data["BaroclinicVorticityX"] \
@@ -1400,9 +1403,9 @@
 for ax in 'XYZ':
     n = "VorticityRPGrowth%s" % ax
     add_field(n, function=eval("_%s" % n),
-              validators=[ValidateSpatial(1, 
+              validators=[ValidateSpatial(1,
                        ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-              units=r"\rm{s}^{-1}")
+              units="1/s")
 def _VorticityRPGrowthMagnitude(field, data):
     result = np.sqrt(data["VorticityRPGrowthX"]**2 +
                      data["VorticityRPGrowthY"]**2 +
@@ -1413,19 +1416,19 @@
     result = np.sign(dot) * result
     return result
 add_field("VorticityRPGrowthMagnitude", function=_VorticityGrowthMagnitude,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}",
+          units="1/s",
           take_log=False)
 def _VorticityRPGrowthMagnitudeABS(field, data):
     return np.sqrt(data["VorticityRPGrowthX"]**2 +
                    data["VorticityRPGrowthY"]**2 +
                    data["VorticityRPGrowthZ"]**2)
-add_field("VorticityRPGrowthMagnitudeABS", 
+add_field("VorticityRPGrowthMagnitudeABS",
           function=_VorticityRPGrowthMagnitudeABS,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")
 
 def _VorticityRPGrowthTimescale(field, data):
     domegax_dt = data["VorticityX"] / data["VorticityRPGrowthX"]
@@ -1433,6 +1436,6 @@
     domegaz_dt = data["VorticityZ"] / data["VorticityRPGrowthZ"]
     return np.sqrt(domegax_dt**2 + domegay_dt**2 + domegaz_dt**2)
 add_field("VorticityRPGrowthTimescale", function=_VorticityRPGrowthTimescale,
-          validators=[ValidateSpatial(1, 
+          validators=[ValidateSpatial(1,
                       ["Density", "RadAccel1", "RadAccel2", "RadAccel3"])],
-          units=r"\rm{s}^{-1}")
+          units="1/s")


https://bitbucket.org/yt_analysis/yt/commits/9eda5db72b40/
Changeset:   9eda5db72b40
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 02:35:19
Summary:     yt units: Adding dimensionless symbol, adding tex symbols to the LUT, alpha version of unit registry.
Affected #:  1 file

diff -r 58ab21c28e300fa9b2d0bac11e31ff310e1f07b1 -r 9eda5db72b40edde9cd3b1832d48f2e5d07823b2 yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -4,8 +4,9 @@
 Author: Casey W. Stark <caseywstark at gmail.com>
 Affiliation: UC Berkeley
 
+Homepage: http://yt-project.org/
 License:
-  Copyright (C) 2012 Casey W. Stark.  All Rights Reserved.
+  Copyright (C) 2012, 2013 Casey W. Stark.  All Rights Reserved.
 
   This file is part of yt.
 
@@ -38,6 +39,8 @@
 ### Misc. dimensions
 rate = 1 / time
 
+dimensionless = sympify(1)
+
 velocity     = length / time
 acceleration = length / time**2
 jerk         = length / time**3
@@ -54,40 +57,37 @@
 electric_field = charge / length**2
 magnetic_field = electric_field
 
-# Dictionary that holds information of known unit symbols.
-# The key is the symbol, the value is a tuple with the conversion factor to cgs,
-# and the dimensionality.
-unit_symbols_dict = {
+# The key is the symbol, the value is a tuple with the conversion factor to
+# cgs, the dimensionality, and
+default_unit_symbol_LUT = {
     # base
-    "g":  (1.0, mass),
-    #"cm": (1.0, length),  # duplicate with meter below...
-    "s":  (1.0, time),
-    "K":  (1.0, temperature),
+    "g":  (1.0, mass, r"\rm{g}"),
+    #"cm": (1.0, length, r"\rm{cm}"),  # duplicate with meter below...
+    "s":  (1.0, time, r"\rm{s}"),
+    "K":  (1.0, temperature, r"\rm{K}"),
 
     # other cgs
-    "dyne": (1.0, force),
-    "erg":  (1.0, energy),
-    "esu":  (1.0, charge),
+    "dyne": (1.0, force, r"\rm{dyne}"),
+    "erg":  (1.0, energy, r"\rm{erg}"),
+    "esu":  (1.0, charge, r"\rm{esu}"),
 
     # some SI
-    "m": (1.0e2, length),
-    "J": (1.0e7, energy),
-    "Hz": (1.0, rate),
-
-    # dimensionless
-    "h": (1.0, 1.0),
+    "m": (1.0e2, length, r"\rm{m}"),
+    "J": (1.0e7, energy, r"\rm{J}"),
+    "Hz": (1.0, rate, r"\rm{Hz}"),
 
     # times
-    "min": (60.0, time),
-    "hr":  (3600.0, time),
-    "day": (86400.0, time),
-    "yr":  (31536000.0, time),
+    "min": (60.0, time, r"\rm{min}"),
+    "hr":  (3600.0, time, r"\rm{hr}"),
+    "day": (86400.0, time, r"\rm{day}"),
+    "yr":  (31536000.0, time, r"\rm{yr}"),
 
     # Solar units
-    "Msun": (1.98892e33, mass),
-    "Rsun": (6.96e10, length),
-    "Lsun": (3.9e33, power),
-    "Tsun": (5870.0, temperature),
+    "Msun": (1.98892e33, mass, r"M_{\odot}"),
+    "Rsun": (6.96e10, length, r"R_{\odot}"),
+    "Lsun": (3.9e33, power, r"L_{\odot}"),
+    "Tsun": (5870.0, temperature, r"T_{\odot}"),
+    "Zsun": (1.0, dimensionless, r"Z_{\odot}"),
 
     # astro distances
     "AU": (1.49598e13, length),
@@ -127,6 +127,15 @@
 }
 
 
+class UnitSymbolRegistry:
+
+    def __init__(self, add_default_symbols=True):
+        self.lookup_dict = {}
+
+        if add_default_symbols:
+            self.lookup_dict.update(default_symbol_lookup_dict)
+
+
 class UnitParseError(Exception):
     pass
 class UnitOperationError(Exception):


https://bitbucket.org/yt_analysis/yt/commits/da898e9a31d7/
Changeset:   da898e9a31d7
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 02:39:46
Summary:     yt array: quick change to radd
Affected #:  1 file

diff -r 9eda5db72b40edde9cd3b1832d48f2e5d07823b2 -r da898e9a31d78b70a314baf3aef116ba8fc58901 yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -1,12 +1,12 @@
 """
-YTArray class
+YTArray class.
 
-Authors: Casey W. Stark <caseywstark at gmail.com>
+Author: Casey W. Stark <caseywstark at gmail.com>
 Affiliation: UC Berkeley
 
 Homepage: http://yt-project.org/
 License:
-    Copyright (C) 2013 Casey W. Stark.  All Rights Reserved.
+  Copyright (C) 2013 Casey W. Stark.  All Rights Reserved.
 
   This file is part of yt.
 
@@ -22,6 +22,7 @@
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 """
 
 import copy
@@ -209,12 +210,12 @@
 
     def __radd__(self, left_object):
         """
-        Add this quantity to the object on the left of the `+` operator. Must
-        check for the correct (same dimension) units. If the quantities have
-        different units, we always use the units on the left.
+        Add this ytarray to the object on the left of the `+` operator. Must
+        check for the correct (same dimension) units.
 
         """
-        if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
+        if isinstance(left_object, YTArray):
+            # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(left_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (left_object.units, self.units))
         else:  # the only way this works is with a float so...
@@ -460,6 +461,3 @@
         if self.data > right_object.get_data_in(self.units):
             return True
         return False
-
-
-


https://bitbucket.org/yt_analysis/yt/commits/39ea4baaf298/
Changeset:   39ea4baaf298
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 02:40:15
Summary:     Merging.
Affected #:  2 files

diff -r 58a5285e244394903b05808d7a6e10f8e3bd84b8 -r 39ea4baaf2983d0e0026f0e1ebf7b737f3b271e3 yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -1,12 +1,12 @@
 """
-YTArray class
+YTArray class.
 
-Authors: Casey W. Stark <caseywstark at gmail.com>
+Author: Casey W. Stark <caseywstark at gmail.com>
 Affiliation: UC Berkeley
 
 Homepage: http://yt-project.org/
 License:
-    Copyright (C) 2013 Casey W. Stark.  All Rights Reserved.
+  Copyright (C) 2013 Casey W. Stark.  All Rights Reserved.
 
   This file is part of yt.
 
@@ -22,6 +22,7 @@
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
 """
 
 import copy
@@ -209,12 +210,12 @@
 
     def __radd__(self, left_object):
         """
-        Add this quantity to the object on the left of the `+` operator. Must
-        check for the correct (same dimension) units. If the quantities have
-        different units, we always use the units on the left.
+        Add this ytarray to the object on the left of the `+` operator. Must
+        check for the correct (same dimension) units.
 
         """
-        if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
+        if isinstance(left_object, YTArray):
+            # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(left_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (left_object.units, self.units))
         else:  # the only way this works is with a float so...
@@ -460,6 +461,3 @@
         if self.data > right_object.get_data_in(self.units):
             return True
         return False
-
-
-

diff -r 58a5285e244394903b05808d7a6e10f8e3bd84b8 -r 39ea4baaf2983d0e0026f0e1ebf7b737f3b271e3 yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -4,8 +4,9 @@
 Author: Casey W. Stark <caseywstark at gmail.com>
 Affiliation: UC Berkeley
 
+Homepage: http://yt-project.org/
 License:
-  Copyright (C) 2012 Casey W. Stark.  All Rights Reserved.
+  Copyright (C) 2012, 2013 Casey W. Stark.  All Rights Reserved.
 
   This file is part of yt.
 
@@ -38,6 +39,8 @@
 ### Misc. dimensions
 rate = 1 / time
 
+dimensionless = sympify(1)
+
 velocity     = length / time
 acceleration = length / time**2
 jerk         = length / time**3
@@ -54,40 +57,37 @@
 electric_field = charge / length**2
 magnetic_field = electric_field
 
-# Dictionary that holds information of known unit symbols.
-# The key is the symbol, the value is a tuple with the conversion factor to cgs,
-# and the dimensionality.
-unit_symbols_dict = {
+# The key is the symbol, the value is a tuple with the conversion factor to
+# cgs, the dimensionality, and
+default_unit_symbol_LUT = {
     # base
-    "g":  (1.0, mass),
-    #"cm": (1.0, length),  # duplicate with meter below...
-    "s":  (1.0, time),
-    "K":  (1.0, temperature),
+    "g":  (1.0, mass, r"\rm{g}"),
+    #"cm": (1.0, length, r"\rm{cm}"),  # duplicate with meter below...
+    "s":  (1.0, time, r"\rm{s}"),
+    "K":  (1.0, temperature, r"\rm{K}"),
 
     # other cgs
-    "dyne": (1.0, force),
-    "erg":  (1.0, energy),
-    "esu":  (1.0, charge),
+    "dyne": (1.0, force, r"\rm{dyne}"),
+    "erg":  (1.0, energy, r"\rm{erg}"),
+    "esu":  (1.0, charge, r"\rm{esu}"),
 
     # some SI
-    "m": (1.0e2, length),
-    "J": (1.0e7, energy),
-    "Hz": (1.0, rate),
-
-    # dimensionless
-    "h": (1.0, 1.0),
+    "m": (1.0e2, length, r"\rm{m}"),
+    "J": (1.0e7, energy, r"\rm{J}"),
+    "Hz": (1.0, rate, r"\rm{Hz}"),
 
     # times
-    "min": (60.0, time),
-    "hr":  (3600.0, time),
-    "day": (86400.0, time),
-    "yr":  (31536000.0, time),
+    "min": (60.0, time, r"\rm{min}"),
+    "hr":  (3600.0, time, r"\rm{hr}"),
+    "day": (86400.0, time, r"\rm{day}"),
+    "yr":  (31536000.0, time, r"\rm{yr}"),
 
     # Solar units
-    "Msun": (1.98892e33, mass),
-    "Rsun": (6.96e10, length),
-    "Lsun": (3.9e33, power),
-    "Tsun": (5870.0, temperature),
+    "Msun": (1.98892e33, mass, r"M_{\odot}"),
+    "Rsun": (6.96e10, length, r"R_{\odot}"),
+    "Lsun": (3.9e33, power, r"L_{\odot}"),
+    "Tsun": (5870.0, temperature, r"T_{\odot}"),
+    "Zsun": (1.0, dimensionless, r"Z_{\odot}"),
 
     # astro distances
     "AU": (1.49598e13, length),
@@ -127,6 +127,15 @@
 }
 
 
+class UnitSymbolRegistry:
+
+    def __init__(self, add_default_symbols=True):
+        self.lookup_dict = {}
+
+        if add_default_symbols:
+            self.lookup_dict.update(default_symbol_lookup_dict)
+
+
 class UnitParseError(Exception):
     pass
 class UnitOperationError(Exception):


https://bitbucket.org/yt_analysis/yt/commits/c459139e45f6/
Changeset:   c459139e45f6
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 02:53:10
Summary:     yt units: fixing unit symbol LUT rename.
Affected #:  1 file

diff -r 39ea4baaf2983d0e0026f0e1ebf7b737f3b271e3 -r c459139e45f6140ad966c24f3471482e5d7d3039 yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -90,18 +90,18 @@
     "Zsun": (1.0, dimensionless, r"Z_{\odot}"),
 
     # astro distances
-    "AU": (1.49598e13, length),
-    "ly": (9.46053e17, length),
-    "pc": (3.08568e18, length),
+    "AU": (1.49598e13, length, r"\rm{AU}"),
+    "ly": (9.46053e17, length, r"\rm{ly}"),
+    "pc": (3.08568e18, length, r"\rm{pc}"),
 
     # other astro
-    "H_0": (2.3e-18, rate),  # check cf
+    "H_0": (2.3e-18, rate, r"H_0"),  # check cf
 
     # other energy units
-    "eV": (1.6021766e-12, energy),
+    "eV": (1.6021766e-12, energy, r"\rm{eV}"),
 
     # electric stuff
-    "gauss": (1.0, magnetic_field),
+    "gauss": (1.0, magnetic_field, r"\rm{G}"),
 }
 
 # This dictionary formatting from magnitude package, credit to Juan Reyero.
@@ -136,8 +136,11 @@
             self.lookup_dict.update(default_symbol_lookup_dict)
 
 
+
+
 class UnitParseError(Exception):
     pass
+
 class UnitOperationError(Exception):
     pass
 
@@ -395,9 +398,9 @@
 def lookup_unit_symbol(symbol_str):
     """ Searches for the unit data typle corresponding to the given symbol. """
 
-    if symbol_str in unit_symbols_dict:
+    if symbol_str in default_unit_symbols_LUT:
         # lookup successful, return the tuple directly
-        return unit_symbols_dict[symbol_str]
+        return default_unit_symbols_LUT[symbol_str]
 
     # could still be a known symbol with a prefix
     possible_prefix = symbol_str[0]
@@ -405,9 +408,9 @@
         # the first character could be a prefix, check the rest of the symbol
         symbol_wo_prefix = symbol_str[1:]
 
-        if symbol_wo_prefix in unit_symbols_dict:
+        if symbol_wo_prefix in default_unit_symbols_LUT:
             # lookup successful, it's a symbol with a prefix
-            unit_data = unit_symbols_dict[symbol_wo_prefix]
+            unit_data = default_unit_symbols_LUT[symbol_wo_prefix]
             prefix_value = unit_prefixes[possible_prefix]
 
             # don't forget to account for the prefix value!


https://bitbucket.org/yt_analysis/yt/commits/1ea7b4eaf8d3/
Changeset:   1ea7b4eaf8d3
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 02:54:55
Summary:     yt units: default_unit_symbols_LUT -> default_unit_symbol_LUT typo
Affected #:  1 file

diff -r c459139e45f6140ad966c24f3471482e5d7d3039 -r 1ea7b4eaf8d39d09773f0c48b23cd1b9d96d30ce yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -398,9 +398,9 @@
 def lookup_unit_symbol(symbol_str):
     """ Searches for the unit data typle corresponding to the given symbol. """
 
-    if symbol_str in default_unit_symbols_LUT:
+    if symbol_str in default_unit_symbol_LUT:
         # lookup successful, return the tuple directly
-        return default_unit_symbols_LUT[symbol_str]
+        return default_unit_symbol_LUT[symbol_str]
 
     # could still be a known symbol with a prefix
     possible_prefix = symbol_str[0]
@@ -408,9 +408,9 @@
         # the first character could be a prefix, check the rest of the symbol
         symbol_wo_prefix = symbol_str[1:]
 
-        if symbol_wo_prefix in default_unit_symbols_LUT:
+        if symbol_wo_prefix in default_unit_symbol_LUT:
             # lookup successful, it's a symbol with a prefix
-            unit_data = default_unit_symbols_LUT[symbol_wo_prefix]
+            unit_data = default_unit_symbol_LUT[symbol_wo_prefix]
             prefix_value = unit_prefixes[possible_prefix]
 
             # don't forget to account for the prefix value!


https://bitbucket.org/yt_analysis/yt/commits/3420ba2e5964/
Changeset:   3420ba2e5964
Branch:      yt-3.0
User:        Andrew Myers
Date:        2013-03-07 02:56:16
Summary:     ergs -> erg
Affected #:  1 file

diff -r c459139e45f6140ad966c24f3471482e5d7d3039 -r 3420ba2e59649dec15e39913a86623dee3657118 yt/frontends/castro/fields.py
--- a/yt/frontends/castro/fields.py
+++ b/yt/frontends/castro/fields.py
@@ -121,7 +121,7 @@
         + data["z-velocity"]**2.0 )
 
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units="ergs/cm**3")
+          units="erg/cm**3")
 
 def _Pressure(field, data):
     """


https://bitbucket.org/yt_analysis/yt/commits/b44581df81be/
Changeset:   b44581df81be
Branch:      yt-3.0
User:        Andrew Myers
Date:        2013-03-07 02:56:36
Summary:     merge
Affected #:  1 file

diff -r 3420ba2e59649dec15e39913a86623dee3657118 -r b44581df81bed4b2267a82d8b22ce8351013772e yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -398,9 +398,9 @@
 def lookup_unit_symbol(symbol_str):
     """ Searches for the unit data typle corresponding to the given symbol. """
 
-    if symbol_str in default_unit_symbols_LUT:
+    if symbol_str in default_unit_symbol_LUT:
         # lookup successful, return the tuple directly
-        return default_unit_symbols_LUT[symbol_str]
+        return default_unit_symbol_LUT[symbol_str]
 
     # could still be a known symbol with a prefix
     possible_prefix = symbol_str[0]
@@ -408,9 +408,9 @@
         # the first character could be a prefix, check the rest of the symbol
         symbol_wo_prefix = symbol_str[1:]
 
-        if symbol_wo_prefix in default_unit_symbols_LUT:
+        if symbol_wo_prefix in default_unit_symbol_LUT:
             # lookup successful, it's a symbol with a prefix
-            unit_data = default_unit_symbols_LUT[symbol_wo_prefix]
+            unit_data = default_unit_symbol_LUT[symbol_wo_prefix]
             prefix_value = unit_prefixes[possible_prefix]
 
             # don't forget to account for the prefix value!


https://bitbucket.org/yt_analysis/yt/commits/c6b7e014906d/
Changeset:   c6b7e014906d
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 03:06:41
Summary:     units: removing latex symbols for now. Was holding us up…
Affected #:  1 file

diff -r 1ea7b4eaf8d39d09773f0c48b23cd1b9d96d30ce -r c6b7e014906d5558ec2d544b7d4cd9fd3bd755bd yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -61,47 +61,50 @@
 # cgs, the dimensionality, and
 default_unit_symbol_LUT = {
     # base
-    "g":  (1.0, mass, r"\rm{g}"),
+    "g":  (1.0, mass),
     #"cm": (1.0, length, r"\rm{cm}"),  # duplicate with meter below...
-    "s":  (1.0, time, r"\rm{s}"),
-    "K":  (1.0, temperature, r"\rm{K}"),
+    "s":  (1.0, time),
+    "K":  (1.0, temperature),
 
     # other cgs
-    "dyne": (1.0, force, r"\rm{dyne}"),
-    "erg":  (1.0, energy, r"\rm{erg}"),
-    "esu":  (1.0, charge, r"\rm{esu}"),
+    "dyne": (1.0, force),
+    "erg":  (1.0, energy),
+    "esu":  (1.0, charge),
 
     # some SI
-    "m": (1.0e2, length, r"\rm{m}"),
-    "J": (1.0e7, energy, r"\rm{J}"),
-    "Hz": (1.0, rate, r"\rm{Hz}"),
+    "m": (1.0e2, length),
+    "J": (1.0e7, energy),
+    "Hz": (1.0, rate),
+
+    # dimensionless stuff
+    "h": (1.0, dimensionless),
 
     # times
-    "min": (60.0, time, r"\rm{min}"),
-    "hr":  (3600.0, time, r"\rm{hr}"),
-    "day": (86400.0, time, r"\rm{day}"),
-    "yr":  (31536000.0, time, r"\rm{yr}"),
+    "min": (60.0, time),
+    "hr":  (3600.0, time),
+    "day": (86400.0, time),
+    "yr":  (31536000.0, time),
 
     # Solar units
-    "Msun": (1.98892e33, mass, r"M_{\odot}"),
-    "Rsun": (6.96e10, length, r"R_{\odot}"),
-    "Lsun": (3.9e33, power, r"L_{\odot}"),
-    "Tsun": (5870.0, temperature, r"T_{\odot}"),
-    "Zsun": (1.0, dimensionless, r"Z_{\odot}"),
+    "Msun": (1.98892e33, mass),
+    "Rsun": (6.96e10, length),
+    "Lsun": (3.9e33, power),
+    "Tsun": (5870.0, temperature),
+    "Zsun": (1.0, dimensionless),
 
     # astro distances
-    "AU": (1.49598e13, length, r"\rm{AU}"),
-    "ly": (9.46053e17, length, r"\rm{ly}"),
-    "pc": (3.08568e18, length, r"\rm{pc}"),
+    "AU": (1.49598e13, length),
+    "ly": (9.46053e17, length),
+    "pc": (3.08568e18, length),
 
     # other astro
-    "H_0": (2.3e-18, rate, r"H_0"),  # check cf
+    "H_0": (2.3e-18, rate),  # check cf
 
     # other energy units
-    "eV": (1.6021766e-12, energy, r"\rm{eV}"),
+    "eV": (1.6021766e-12, energy),
 
     # electric stuff
-    "gauss": (1.0, magnetic_field, r"\rm{G}"),
+    "gauss": (1.0, magnetic_field),
 }
 
 # This dictionary formatting from magnitude package, credit to Juan Reyero.


https://bitbucket.org/yt_analysis/yt/commits/7c7785f9bad6/
Changeset:   7c7785f9bad6
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 03:07:06
Summary:     castro frontend: units ergs -> erg.
Affected #:  1 file

diff -r c6b7e014906d5558ec2d544b7d4cd9fd3bd755bd -r 7c7785f9bad6268136e67eee6e4ede3a9087b777 yt/frontends/castro/fields.py
--- a/yt/frontends/castro/fields.py
+++ b/yt/frontends/castro/fields.py
@@ -121,12 +121,12 @@
         + data["z-velocity"]**2.0 )
 
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units="ergs/cm**3")
+          units="erg/cm**3")
 
 def _Pressure(field, data):
     """
     M{(Gamma-1.0)*e, where e is thermal energy density
-    
+
     NB: this will need to be modified for radiation
 
     """


https://bitbucket.org/yt_analysis/yt/commits/3cbe8d03909e/
Changeset:   3cbe8d03909e
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 03:07:32
Summary:     nyx frontend: starting to fix field units again.
Affected #:  1 file

diff -r 7c7785f9bad6268136e67eee6e4ede3a9087b777 -r 3cbe8d03909e81ae88ea386c0d3f1aa7420cd8d8 yt/frontends/nyx/fields.py
--- a/yt/frontends/nyx/fields.py
+++ b/yt/frontends/nyx/fields.py
@@ -39,12 +39,12 @@
 add_field = NyxFieldInfo.add_field
 
 KnownNyxFields = FieldInfoContainer()
-add_nyx_field = KnownNyxFields.add_field 
+add_nyx_field = KnownNyxFields.add_field
 
 # Density
 add_nyx_field("density", function=lambda a, b: None, take_log=True,
           validators=[ValidateDataField("density")],
-          units=r"\rm{g} / \rm{cm}^3",
+          units="g/cm**3",
           projected_units =r"\rm{g} / \rm{cm}^2")
 KnownNyxFields["density"]._projected_units =r"\rm{g} / \rm{cm}^2"
 
@@ -61,7 +61,7 @@
           validators=[ValidateSpatial(0), ValidateDataField("particle_mass")],
           particle_type=True, convert_function=_convertParticleMassMsun,
           take_log=True, units=r"\rm{M_{\odot}}")
-          
+
 add_nyx_field("Dark_Matter_Density", function=TranslationFunc("particle_mass_density"),
           take_log=True,
           units=r"\rm{g} / \rm{cm}^3",particle_type=True,


https://bitbucket.org/yt_analysis/yt/commits/bde440be8e5f/
Changeset:   bde440be8e5f
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 03:08:23
Summary:     Merging.
Affected #:  3 files

diff -r b44581df81bed4b2267a82d8b22ce8351013772e -r bde440be8e5f58177ea37ac89fa037af22f8e266 yt/frontends/castro/fields.py
--- a/yt/frontends/castro/fields.py
+++ b/yt/frontends/castro/fields.py
@@ -126,7 +126,7 @@
 def _Pressure(field, data):
     """
     M{(Gamma-1.0)*e, where e is thermal energy density
-    
+
     NB: this will need to be modified for radiation
 
     """

diff -r b44581df81bed4b2267a82d8b22ce8351013772e -r bde440be8e5f58177ea37ac89fa037af22f8e266 yt/frontends/nyx/fields.py
--- a/yt/frontends/nyx/fields.py
+++ b/yt/frontends/nyx/fields.py
@@ -39,12 +39,12 @@
 add_field = NyxFieldInfo.add_field
 
 KnownNyxFields = FieldInfoContainer()
-add_nyx_field = KnownNyxFields.add_field 
+add_nyx_field = KnownNyxFields.add_field
 
 # Density
 add_nyx_field("density", function=lambda a, b: None, take_log=True,
           validators=[ValidateDataField("density")],
-          units=r"\rm{g} / \rm{cm}^3",
+          units="g/cm**3",
           projected_units =r"\rm{g} / \rm{cm}^2")
 KnownNyxFields["density"]._projected_units =r"\rm{g} / \rm{cm}^2"
 
@@ -61,7 +61,7 @@
           validators=[ValidateSpatial(0), ValidateDataField("particle_mass")],
           particle_type=True, convert_function=_convertParticleMassMsun,
           take_log=True, units=r"\rm{M_{\odot}}")
-          
+
 add_nyx_field("Dark_Matter_Density", function=TranslationFunc("particle_mass_density"),
           take_log=True,
           units=r"\rm{g} / \rm{cm}^3",particle_type=True,

diff -r b44581df81bed4b2267a82d8b22ce8351013772e -r bde440be8e5f58177ea37ac89fa037af22f8e266 yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -61,47 +61,50 @@
 # cgs, the dimensionality, and
 default_unit_symbol_LUT = {
     # base
-    "g":  (1.0, mass, r"\rm{g}"),
+    "g":  (1.0, mass),
     #"cm": (1.0, length, r"\rm{cm}"),  # duplicate with meter below...
-    "s":  (1.0, time, r"\rm{s}"),
-    "K":  (1.0, temperature, r"\rm{K}"),
+    "s":  (1.0, time),
+    "K":  (1.0, temperature),
 
     # other cgs
-    "dyne": (1.0, force, r"\rm{dyne}"),
-    "erg":  (1.0, energy, r"\rm{erg}"),
-    "esu":  (1.0, charge, r"\rm{esu}"),
+    "dyne": (1.0, force),
+    "erg":  (1.0, energy),
+    "esu":  (1.0, charge),
 
     # some SI
-    "m": (1.0e2, length, r"\rm{m}"),
-    "J": (1.0e7, energy, r"\rm{J}"),
-    "Hz": (1.0, rate, r"\rm{Hz}"),
+    "m": (1.0e2, length),
+    "J": (1.0e7, energy),
+    "Hz": (1.0, rate),
+
+    # dimensionless stuff
+    "h": (1.0, dimensionless),
 
     # times
-    "min": (60.0, time, r"\rm{min}"),
-    "hr":  (3600.0, time, r"\rm{hr}"),
-    "day": (86400.0, time, r"\rm{day}"),
-    "yr":  (31536000.0, time, r"\rm{yr}"),
+    "min": (60.0, time),
+    "hr":  (3600.0, time),
+    "day": (86400.0, time),
+    "yr":  (31536000.0, time),
 
     # Solar units
-    "Msun": (1.98892e33, mass, r"M_{\odot}"),
-    "Rsun": (6.96e10, length, r"R_{\odot}"),
-    "Lsun": (3.9e33, power, r"L_{\odot}"),
-    "Tsun": (5870.0, temperature, r"T_{\odot}"),
-    "Zsun": (1.0, dimensionless, r"Z_{\odot}"),
+    "Msun": (1.98892e33, mass),
+    "Rsun": (6.96e10, length),
+    "Lsun": (3.9e33, power),
+    "Tsun": (5870.0, temperature),
+    "Zsun": (1.0, dimensionless),
 
     # astro distances
-    "AU": (1.49598e13, length, r"\rm{AU}"),
-    "ly": (9.46053e17, length, r"\rm{ly}"),
-    "pc": (3.08568e18, length, r"\rm{pc}"),
+    "AU": (1.49598e13, length),
+    "ly": (9.46053e17, length),
+    "pc": (3.08568e18, length),
 
     # other astro
-    "H_0": (2.3e-18, rate, r"H_0"),  # check cf
+    "H_0": (2.3e-18, rate),  # check cf
 
     # other energy units
-    "eV": (1.6021766e-12, energy, r"\rm{eV}"),
+    "eV": (1.6021766e-12, energy),
 
     # electric stuff
-    "gauss": (1.0, magnetic_field, r"\rm{G}"),
+    "gauss": (1.0, magnetic_field),
 }
 
 # This dictionary formatting from magnitude package, credit to Juan Reyero.


https://bitbucket.org/yt_analysis/yt/commits/3a35abb97e25/
Changeset:   3a35abb97e25
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 07:05:33
Summary:     nyx frontend: redoing field name and unit updates.
Affected #:  1 file

diff -r bde440be8e5f58177ea37ac89fa037af22f8e266 -r 3a35abb97e255fd55f5c5977074d2236d4c61dbf yt/frontends/nyx/fields.py
--- a/yt/frontends/nyx/fields.py
+++ b/yt/frontends/nyx/fields.py
@@ -41,16 +41,19 @@
 KnownNyxFields = FieldInfoContainer()
 add_nyx_field = KnownNyxFields.add_field
 
+#
+# Constants
+#
+
+# BEWARE hardcoded, uniform gamma value
+nyx_gamma = 5.0 / 3.0
+
 # Density
 add_nyx_field("density", function=lambda a, b: None, take_log=True,
-          validators=[ValidateDataField("density")],
-          units="g/cm**3",
-          projected_units =r"\rm{g} / \rm{cm}^2")
-KnownNyxFields["density"]._projected_units =r"\rm{g} / \rm{cm}^2"
+              validators=[ValidateDataField("density")], units="g/cm**3")
 
 add_field("Density", function=TranslationFunc("density"), take_log=True,
-          units=r"\rm{g} / \rm{cm}^3",
-          projected_units =r"\rm{g} / \rm{cm}^2")
+          units="g/cm**3")
 
 # Particle mass in units of $ M_{\odot}
 def _convertParticleMassMsun(data):
@@ -60,53 +63,42 @@
 add_field("ParticleMassMsun", function=_particle_mass_m_sun,
           validators=[ValidateSpatial(0), ValidateDataField("particle_mass")],
           particle_type=True, convert_function=_convertParticleMassMsun,
-          take_log=True, units=r"\rm{M_{\odot}}")
+          take_log=True, units="Msun")
 
-add_nyx_field("Dark_Matter_Density", function=TranslationFunc("particle_mass_density"),
-          take_log=True,
-          units=r"\rm{g} / \rm{cm}^3",particle_type=True,
-          projected_units =r"\rm{g} / \rm{cm}^2")
+add_nyx_field("Dark_Matter_Density",
+              function=TranslationFunc("particle_mass_density"),
+              take_log=True, particle_type=True, units="g/cm**3")
 
 
-# Energy Density
-# @todo: ``energy_density``
-add_nyx_field("total_energy", function=lambda a, b: None, take_log=True,
-          validators=[ValidateDataField("total_energy")],
-          units=r"\rm{M_{\odot}} (\rm{km} / \rm{s})^2")
+add_nyx_field("energy_density", function=lambda a, b: None, take_log=True,
+              validators=[ValidateDataField("total_energy")],
+              units="Msun * (km / s)**2")
 
-# Momentum in each dimension.
-# @todo: ``momentum_x``
-add_nyx_field("x-momentum", function=lambda a, b: None, take_log=False,
-          validators=[ValidateDataField("x-momentum")],
-          units=r"\rm{M_{\odot}} \rm{km} / \rm{s}")
-add_nyx_field("y-momentum", function=lambda a, b: None, take_log=False,
-          validators=[ValidateDataField("y-momentum")],
-          units=r"\rm{M_{\odot}} \rm{km} / \rm{s}")
-add_nyx_field("z-momentum", function=lambda a, b: None, take_log=False,
-          validators=[ValidateDataField("z-momentum")],
-          units=r"\rm{M_{\odot}} \rm{km} / \rm{s}")
+add_nyx_field("momentum_x", function=lambda a, b: None, take_log=False,
+              validators=[ValidateDataField("x-momentum")], units="Msun*km/s")
+add_nyx_field("momentum_y", function=lambda a, b: None, take_log=False,
+              validators=[ValidateDataField("y-momentum")], units="Msun*km/s")
+add_nyx_field("momentum_z", function=lambda a, b: None, take_log=False,
+              validators=[ValidateDataField("z-momentum")], units="Msun*km/s")
 
 ### Now derived fields
 
 # Velocity fields in each dimension
 # @todo: ``velocity_x``
-def _x_velocity(field, data):
+def _velocity_x(field, data):
     """ Generate x-velocity from x-momentum and density. """
-    return data["x-momentum"] / data["density"]
-add_field("x-velocity", function=_x_velocity, take_log=False,
-          units=r"\rm{km} / \rm{s}")
+    return data["momentum_x"] / data["density"]
+add_field("velocity_x", function=_velocity_x, take_log=False, units="km/s")
 
-def _y_velocity(field, data):
+def _velocity_y(field, data):
     """ Generate y-velocity from y-momentum and density. """
-    return data["y-momentum"] / data["density"]
-add_field("y-velocity", function=_y_velocity, take_log=False,
-          units=r"\rm{km} / \rm{s}")
+    return data["momentum_y"] / data["density"]
+add_field("velocity_y", function=_velocity_y, take_log=False, units="km/s")
 
-def _z_velocity(field, data):
+def _velocity_z(field, data):
     """ Generate z-velocity from z-momentum and density. """
-    return data["z-momentum"] / data["density"]
-add_field("z-velocity", function=_z_velocity, take_log=False,
-          units=r"\rm{km} / \rm{s}")
+    return data["momentum_z"] / data["density"]
+add_field("velocity_z", function=_velocity_z, take_log=False, units="km/s")
 
 # The gas **thermal** energy.
 # @todo: should be called ``gas_energy`` whether it is data or derived
@@ -120,12 +112,11 @@
     #if data.pf["DualEnergyFormalism"]:
     #    return data["Gas_Energy"]
     #else:
-    return data["Total_Energy"] - 0.5 * data["density"] * (
-                                          data["x-velocity"]**2.0
-                                        + data["y-velocity"]**2.0
-                                        + data["z-velocity"]**2.0 )
-add_field("ThermalEnergy", function=_thermal_energy,
-          units=r"\rm{M_{\odot}} (\rm{km} / \rm{s})^2")
+    return ( data["total_energy"]
+             - 0.5 * data["density"] * (   data["velocity_x"]**2.0
+                                         + data["velocity_y"]**2.0
+                                         + data["velocity_z"]**2.0 ) )
+add_field("thermal_energy", function=_thermal_energy, units="Msun*(km/s)**2")
 
 # Gas pressure
 # @todo: eventually figure out a way to detect when using radiation and change
@@ -140,14 +131,12 @@
     when radiation is accounted for.
 
     """
-    return (data.pf.gamma - 1.0) * data["ThermalEnergy"]
-add_field("Pressure", function=_pressure,
-          units=r"\rm{M_{\odot}} (\rm{km} / \rm{s})^2 / \rm{Mpc}^3")
+    return (nyx_gamma - 1.0) * data["ThermalEnergy"]
+
+add_field("pressure", function=_pressure, units="Msun*(km/s)**2/Mpc**3")
 
 # Gas temperature
 def _temperature(field, data):
-    return ((data.pf.gamma - 1.0) * data.pf["mu"] * mh *
-            data["ThermalEnergy"] / (kboltz * data["Density"]))
-add_field("Temperature", function=_temperature, take_log=False,
-          units=r"\rm{Kelvin}")
-
+    return (gamma - 1.0) * data.pf["mu"] * mh *
+            data["thermal_energy"] / (kboltz * data["density"]))
+add_field("temperature", function=_temperature, take_log=False, units="K")


https://bitbucket.org/yt_analysis/yt/commits/c238a8aed907/
Changeset:   c238a8aed907
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 07:25:19
Summary:     units: fixing flash frontend units.
Affected #:  1 file

diff -r 3a35abb97e255fd55f5c5977074d2236d4c61dbf -r c238a8aed907156a88760d58da8bc0282496221b yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -66,7 +66,7 @@
                     "z-velocity": "velz",
                     "Density": "dens",
                     "Temperature": "temp",
-                    "Pressure" : "pres", 
+                    "Pressure" : "pres",
                     "Grav_Potential" : "gpot",
                     "particle_position_x" : "particle_posx",
                     "particle_position_y" : "particle_posy",
@@ -167,13 +167,13 @@
                 units="erg/cm**3")
 add_flash_field("pion", function=NullFunc, take_log=True,
                 display_name="Ion Pressure",
-                units="J/cm^3")
+                units="J/cm**3")
 add_flash_field("pele", function=NullFunc, take_log=True,
                 display_name="Electron Pressure, P_e",
-                units="J/cm^3")
+                units="J/cm**3")
 add_flash_field("prad", function=NullFunc, take_log=True,
                 display_name="Radiation Pressure",
-                units = "J/cm^3")
+                units = "J/cm**3")
 add_flash_field("eion", function=NullFunc, take_log=True,
                 display_name="Ion Internal Energy",
                 units="J")
@@ -187,9 +187,9 @@
                 convert_function=_get_convert("pden"),
                 units="g/cm**3")
 add_flash_field("depo", function=NullFunc, take_log=True,
-                units = "ergs/g")
+                units = "erg/g")
 add_flash_field("ye", function=NullFunc, take_log=True,
-                units = "ergs/g")
+                units = "erg/g")
 add_flash_field("magx", function=NullFunc, take_log=False,
                 convert_function=_get_convert("magx"),
                 units = "gauss")
@@ -213,10 +213,10 @@
                 display_name="\gamma_c\/\rm{(ratio\/of\/specific\/heats)}")
 add_flash_field("gpot", function=NullFunc, take_log=False,
                 convert_function=_get_convert("gpot"),
-                units="ergs/g")
+                units="erg/g")
 add_flash_field("gpol", function=NullFunc, take_log=False,
                 convert_function=_get_convert("gpol"),
-                units = "ergs/g")
+                units = "erg/g")
 add_flash_field("flam", function=NullFunc, take_log=False,
                 convert_function=_get_convert("flam"))
 add_flash_field("absr", function=NullFunc, take_log=False,
@@ -257,13 +257,12 @@
     if f.endswith("_Fraction") :
         dname = "%s\/Fraction" % f.split("_")[0]
     else :
-        dname = f                    
+        dname = f
     ff = KnownFLASHFields[v]
     pfield = f.startswith("particle")
     add_field(f, TranslationFunc(v),
               take_log=KnownFLASHFields[v].take_log,
-              units = ff._units, display_name=dname,
-              projected_units = ff._projected_units,
+              units = ff.units, display_name=dname,
               particle_type = pfield)
 
 def _convertParticleMassMsun(data):
@@ -289,9 +288,9 @@
     else:
         mu = 0.6
     return kboltz*data["Density"]*data["Temperature"]/(mu*mh) / (data.pf.gamma - 1.0)
-    
+
 add_field("ThermalEnergy", function=_ThermalEnergy,
-          units="ergs/g")
+          units="erg/g")
 
 def _TotalEnergy(fields, data) :
     try:
@@ -308,13 +307,13 @@
     return etot
 
 add_field("TotalEnergy", function=_TotalEnergy,
-          units="ergs/g")
+          units="erg/g")
 
 def _GasEnergy(fields, data) :
     return data["ThermalEnergy"]
 
-add_field("GasEnergy", function=_GasEnergy, 
-          units="ergs/g")
+add_field("GasEnergy", function=_GasEnergy,
+          units="erg/g")
 
 # See http://flash.uchicago.edu/pipermail/flash-users/2012-October/001180.html
 # along with the attachment to that e-mail for details


https://bitbucket.org/yt_analysis/yt/commits/ecfa8038e979/
Changeset:   ecfa8038e979
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 07:25:50
Summary:     Fixing syntax error in nyx frontend.
Affected #:  1 file

diff -r c238a8aed907156a88760d58da8bc0282496221b -r ecfa8038e9797f0fc57e6fd3110bcf3cb2b1859f yt/frontends/nyx/fields.py
--- a/yt/frontends/nyx/fields.py
+++ b/yt/frontends/nyx/fields.py
@@ -137,6 +137,6 @@
 
 # Gas temperature
 def _temperature(field, data):
-    return (gamma - 1.0) * data.pf["mu"] * mh *
-            data["thermal_energy"] / (kboltz * data["density"]))
+    return ( (gamma - 1.0) * data.pf["mu"] * mh *
+             data["thermal_energy"] / (kboltz * data["density"]) )
 add_field("temperature", function=_temperature, take_log=False, units="K")


https://bitbucket.org/yt_analysis/yt/commits/a25700e9de8a/
Changeset:   a25700e9de8a
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 07:26:35
Summary:     orion frontend: updating for symbolic units.
Affected #:  1 file

diff -r ecfa8038e9797f0fc57e6fd3110bcf3cb2b1859f -r a25700e9de8ab2bded95f94c2b4490abdb3f18c3 yt/frontends/orion/fields.py
--- a/yt/frontends/orion/fields.py
+++ b/yt/frontends/orion/fields.py
@@ -48,97 +48,107 @@
 
 add_orion_field("density", function=NullFunc, take_log=True,
                 validators = [ValidateDataField("density")],
-                units=r"\rm{g}/\rm{cm}^3")
-KnownOrionFields["density"]._projected_units =r"\rm{g}/\rm{cm}^2"
+                units="g/cm**3")
 
 add_orion_field("eden", function=NullFunc, take_log=True,
                 validators = [ValidateDataField("eden")],
-                units=r"\rm{erg}/\rm{cm}^3")
+                units="erg/cm**3")
 
 add_orion_field("xmom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("xmom")],
-                units=r"\rm{g}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
 add_orion_field("ymom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("ymom")],
-                units=r"\rm{gm}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
 add_orion_field("zmom", function=NullFunc, take_log=False,
                 validators = [ValidateDataField("zmom")],
-                units=r"\rm{g}/\rm{cm^2\ s}")
+                units="g/cm**2/s")
 
-translation_dict = {"x-velocity": "xvel",
-                    "y-velocity": "yvel",
-                    "z-velocity": "zvel",
-                    "Density": "density",
-                    "TotalEnergy": "eden",
-                    "Temperature": "temperature",
-                    "x-momentum": "xmom",
-                    "y-momentum": "ymom",
-                    "z-momentum": "zmom"
-                   }
+translation_dict = {
+    "x-velocity": "xvel",
+    "y-velocity": "yvel",
+    "z-velocity": "zvel",
+    "Density": "density",
+    "TotalEnergy": "eden",
+    "Temperature": "temperature",
+    "x-momentum": "xmom",
+    "y-momentum": "ymom",
+    "z-momentum": "zmom"
+}
 
 for f,v in translation_dict.items():
     if v not in KnownOrionFields:
         add_orion_field(v, function=NullFunc, take_log=False,
-                  validators = [ValidateDataField(v)])
+                        validators=[ValidateDataField(v)])
     ff = KnownOrionFields[v]
     add_field(f, TranslationFunc(v),
               take_log=KnownOrionFields[v].take_log,
-              units = ff._units, display_name=f)
+              units=ff.units, display_name=f)
 
 def _xVelocity(field, data):
-    """generate x-velocity from x-momentum and density
-    
     """
-    return data["xmom"]/data["density"]
-add_orion_field("x-velocity",function=_xVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+    generate x-velocity from x-momentum and density
+
+    """
+    return data["xmom"] / data["density"]
+
+add_orion_field("x-velocity", function=_xVelocity, take_log=False,
+                units="cm/s")
 
 def _yVelocity(field,data):
-    """generate y-velocity from y-momentum and density
+    """
+    generate y-velocity from y-momentum and density
 
     """
     #try:
     #    return data["xvel"]
     #except KeyError:
-    return data["ymom"]/data["density"]
-add_orion_field("y-velocity",function=_yVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+    return data["ymom"] / data["density"]
+
+add_orion_field("y-velocity", function=_yVelocity, take_log=False,
+                units="cm/s")
 
 def _zVelocity(field,data):
-    """generate z-velocity from z-momentum and density
-    
     """
-    return data["zmom"]/data["density"]
-add_orion_field("z-velocity",function=_zVelocity, take_log=False,
-                units=r'\rm{cm}/\rm{s}')
+    generate z-velocity from z-momentum and density
+
+    """
+    return data["zmom"] / data["density"]
+
+add_orion_field("z-velocity", function=_zVelocity, take_log=False,
+                units="cm/s")
 
 def _ThermalEnergy(field, data):
-    """generate thermal (gas energy). Dual Energy Formalism was
-        implemented by Stella, but this isn't how it's called, so I'll
-        leave that commented out for now.
+    """
+    generate thermal (gas energy). Dual Energy Formalism was implemented by
+    Stella, but this isn't how it's called, so I'll leave that commented out
+    for now.
     """
     #if data.pf["DualEnergyFormalism"]:
     #    return data["GasEnergy"]
     #else:
-    return data["TotalEnergy"] - 0.5 * data["density"] * (
-        data["x-velocity"]**2.0
-        + data["y-velocity"]**2.0
-        + data["z-velocity"]**2.0 )
-add_field("ThermalEnergy", function=_ThermalEnergy,
-                units=r"\rm{ergs}/\rm{cm^3}")
+    return ( data["TotalEnergy"]
+             - 0.5 * data["density"] * (   data["x-velocity"]**2
+                                         + data["y-velocity"]**2
+                                         + data["z-velocity"]**2 ) )
+
+add_field("ThermalEnergy", function=_ThermalEnergy, units="erg/cm**3")
 
 def _Pressure(field,data):
     """M{(Gamma-1.0)*e, where e is thermal energy density
        NB: this will need to be modified for radiation
     """
-    return (data.pf.gamma - 1.0)*data["ThermalEnergy"]
-add_field("Pressure", function=_Pressure, units=r"\rm{dyne}/\rm{cm}^{2}")
+    return (data.pf["Gamma"] - 1.0)*data["ThermalEnergy"]
+
+add_field("Pressure", function=_Pressure, units="dyne/cm**2")
 
 def _Temperature(field,data):
-    return (data.pf.gamma-1.0)*data.pf["mu"]*mh*data["ThermalEnergy"]/(kboltz*data["Density"])
-add_field("Temperature",function=_Temperature,units=r"\rm{Kelvin}",take_log=False)
+    return ( (data.pf["Gamma"]-1.0) * data.pf["mu"] * mh *
+             data["ThermalEnergy"] / (kboltz * data["Density"]) )
+
+add_field("Temperature", function=_Temperature, units="K", take_log=False)
 
 # particle fields
 
@@ -152,7 +162,7 @@
 
     return _Particles
 
-_particle_field_list = ["mass", 
+_particle_field_list = ["mass",
                         "position_x",
                         "position_y",
                         "position_z",
@@ -172,5 +182,5 @@
 for pf in _particle_field_list:
     pfunc = particle_func("particle_%s" % (pf))
     add_field("particle_%s" % pf, function=pfunc,
-              validators = [ValidateSpatial(0)],
+              validators=[ValidateSpatial(0)],
               particle_type=True)


https://bitbucket.org/yt_analysis/yt/commits/405a2dce75b6/
Changeset:   405a2dce75b6
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 19:13:09
Summary:     Data object's __getitem__ now returns YTArray.  Defining __repr__ and __str__ for YTArray.
Affected #:  2 files

diff -r a25700e9de8ab2bded95f94c2b4490abdb3f18c3 -r 405a2dce75b61e29a2dea6ec723c7b205e3ecda4 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -38,6 +38,7 @@
 from yt.funcs import *
 
 from yt.data_objects.particle_io import particle_handler_registry
+from yt.data_objects.yt_array import YTArray
 from yt.utilities.lib import \
     march_cubes_grid, march_cubes_grid_flux
 from yt.utilities.definitions import  x_dict, y_dict
@@ -193,12 +194,14 @@
         """
         if key not in self.field_data:
             if key in self._container_fields:
-                self.field_data[key] = self._generate_container_field(key)
+                self.field_data[key] = \
+                    YTArray(self._generate_container_field(key), input_units='1')
                 return self.field_data[key]
             else:
                 self.get_data(key)
         f = self._determine_fields(key)[0]
-        return self.field_data[f]
+        fi = self.pf._get_field_info(*f)
+        return YTArray(self.field_data[f], input_units=fi._units)
 
     def __setitem__(self, key, val):
         """

diff -r a25700e9de8ab2bded95f94c2b4490abdb3f18c3 -r 405a2dce75b61e29a2dea6ec723c7b205e3ecda4 yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -47,9 +47,6 @@
         if input_units is None:
             # Nothing provided. Make dimensionless...
             units = Unit()
-        else if isinstance(input_units, Unit):
-            # input_units is already a Unit, but let's be safe and make a copy.
-            units = copy.copy(input_units)
         else:
             # units kwarg set, but it's not a Unit object.
             # don't handle all the cases here, let the Unit class handle if
@@ -69,6 +66,18 @@
             return
         self.units = getattr(obj, 'units', None)
 
+    def __repr__(self):
+        """
+
+        """
+        return super(YTArray, self).__repr__()+' '+self.units.__repr__()
+
+    def __str__(self):
+        """
+
+        """
+        return super(YTArray, self).__str__()+' '+self.units.__str__()
+
     #
     # Start unit conversion methods
     #


https://bitbucket.org/yt_analysis/yt/commits/225c88f96144/
Changeset:   225c88f96144
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 20:16:36
Summary:     Getting add and subtrack working for YTArray.
Affected #:  1 file

diff -r 405a2dce75b61e29a2dea6ec723c7b205e3ecda4 -r 225c88f96144adf3831d3a7714346e880ca9a1c3 yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -203,19 +203,16 @@
         """
         if isinstance(right_object, YTArray):
             # make sure it's a quantity before we check units attribute
-            if not self.units.has_same_dimensions_as(right_object.units):
+            if not self.units.same_dimensions_as(right_object.units):
                 raise UnitOperationError("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (self.units, right_object.units))
         else:
+            # case of dimensionless self + float
             # the only way this works is with a float so...
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (self, right_object))
 
-            # case of dimensionless self + float
-            return Quantity(self.data + right_object, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity(self.data + right_object.get_data_in(self.units),
-                        self.units)
+        return YTArray(super(YTArray, self).__add__(right_object), input_units = right_object.units)
 
     def __radd__(self, left_object):
         """
@@ -228,16 +225,12 @@
             if not self.units.same_dimensions_as(left_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (left_object.units, self.units))
         else:  # the only way this works is with a float so...
+            # case of dimensionless float + self
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (left_object, self))
 
-            # case of dimensionless float + self
-            return Quantity(left_object + self.data, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity((left_object.data
-                         + self.get_data_in(left_object.units)),
-                        left_object.units)
+        return YTArray(super(YTArray, self).__radd__(left_object), input_units = right_object.units)
 
     def __sub__(self, right_object):
         """
@@ -249,16 +242,15 @@
         if isinstance(right_object, Quantity):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(right_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (self.units, right_object.units))
-        else:  # the only way this works is with a float so...
+        else:  
+            # case of dimensionless self + float
+            # the only way this works is with a float so...
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (self, right_object))
 
-            # case of dimensionless self + float
-            return Quantity(self.data - right_object, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity(self.data - right_object.get_data_in(self.units),
-                        self.units)
+        return YTArray(super(YTArray, self).__sub__(right_object), input_units = right_object.units)
+        
 
     def __rsub__(self, left_object):
         """
@@ -270,21 +262,18 @@
         if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(left_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (left_object.units, self.units))
-        else:  # the only way this works is with a float so...
+        else:  
+            # case of dimensionless self + float
+            # the only way this works is with a float so...
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (left_object, self))
 
-            # case of dimensionless float + self
-            return Quantity(left_object - self.data, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity((left_object.data
-                         - self.get_data_in(left_object.units)),
-                        left_object.units)
+        return YTArray(super(YTArray, self).__rsub__(left_object), input_units = left_object.units)
 
     def __neg__(self):
         """ Negate the data. """
-        return Quantity(-self.data, self.units)
+        return YTArray(super(YTArray, self).__neg__(self), input_units = self.units)
 
     def __mul__(self, right_object):
         """


https://bitbucket.org/yt_analysis/yt/commits/eaa13c664dbb/
Changeset:   eaa13c664dbb
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 20:17:58
Summary:     units: fixing Unit construction with a unit object. Some cleanup. Starting to fill in UnitRegistry.
Affected #:  1 file

diff -r a25700e9de8ab2bded95f94c2b4490abdb3f18c3 -r eaa13c664dbbb4f728cafd82e1bc821dc78e2b7a yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -29,18 +29,38 @@
 from sympy import nsimplify, posify, sympify
 from sympy.parsing.sympy_parser import parse_expr
 
-# The base dimensions
+#
+# Exceptions
+#
+
+class SymbolNotFoundError(Exception):
+    pass
+
+class UnitParseError(Exception):
+    pass
+
+class UnitOperationError(Exception):
+    pass
+
+#
+# Base dimensions
+#
+
 mass = Symbol("(mass)", positive=True)
 length = Symbol("(length)", positive=True)
 time = Symbol("(time)", positive=True)
 temperature = Symbol("(temperature)", positive=True)
+
 base_dimensions = [mass, length, time, temperature]
 
-### Misc. dimensions
-rate = 1 / time
+#
+# Derived dimensions
+#
 
 dimensionless = sympify(1)
 
+rate = 1 / time
+
 velocity     = length / time
 acceleration = length / time**2
 jerk         = length / time**3
@@ -57,8 +77,13 @@
 electric_field = charge / length**2
 magnetic_field = electric_field
 
-# The key is the symbol, the value is a tuple with the conversion factor to
-# cgs, the dimensionality, and
+#
+# The default/basic unit symbol lookup table.
+#
+# Lookup a unit symbol with the symbol string, and provide a tuple with the
+# conversion factor to cgs and dimensionality.
+#
+
 default_unit_symbol_LUT = {
     # base
     "g":  (1.0, mass),
@@ -133,19 +158,38 @@
 class UnitSymbolRegistry:
 
     def __init__(self, add_default_symbols=True):
-        self.lookup_dict = {}
+        self.lut = {}
 
         if add_default_symbols:
-            self.lookup_dict.update(default_symbol_lookup_dict)
+            self.lut.update(default_unit_symbol_LUT)
 
+    def add(symbol, cgs_value, dimensions):
+        """
+        Add a symbol to this registry.
 
+        """
+        # Validate
+        if not isinstance(cgs_value, float):
+            raise UnitParseError("cgs_value must be a float, got a %s." % type(cgs_value))
 
+        validate_dimensions(dimensions)
 
-class UnitParseError(Exception):
-    pass
+        # Add to lut
+        self.lut.update( {symbol: (cgs_value, dimensions)} )
 
-class UnitOperationError(Exception):
-    pass
+    def remove(symbol):
+        """
+        Remove the entry for the unit matching `symbol`.
+
+        """
+        if symbol not in self.lut:
+            raise SymbolNotFoundError("Tried to remove the symbol '%s', but it does not exist in this registry." % symbol)
+
+        del self.lut[symbol]
+
+
+default_symbol_registry = UnitSymbolRegistry()
+
 
 
 class Unit(Expr):
@@ -179,16 +223,22 @@
             time, and temperature objects to various powers.
 
         """
-        # if we have a string, parse into an expression
-        if isinstance(unit_expr, str):
+        # Simplest case. If user passes a Unit object, just use the expr.
+        if isinstance(unit_expr, Unit):
+            # grab the unit object's sympy expression.
+            unit_expr = unit_expr.expr
+
+        # If we have a string, have sympy parse it into an Expr.
+        elif isinstance(unit_expr, str):
             if not unit_expr:
                 # Bug catch...
                 # if unit_expr is an empty string, parse_expr fails hard...
                 unit_expr = "1"
             unit_expr = parse_expr(unit_expr)
 
+        # Make sure we have an Expr at this point.
         if not isinstance(unit_expr, Expr):
-            raise UnitParseError("Unit representation must be a string or sympy Expr. %s is a %s." % (unit_expr, type(unit_expr)))
+            raise UnitParseError("Unit representation must be a string or sympy Expr. %s has type %s." % (unit_expr, type(unit_expr)))
         # done with argument checking...
 
         # sympify, make positive symbols, and nsimplify the expr
@@ -212,7 +262,7 @@
             except ValueError:
                 raise UnitParseError("Please provide a float for the cgs_value kwarg. I got '%s'." % cgs_value)
             # check that dimensions is valid
-            dimensions = verify_dimensions(dimensions)
+            dimensions = validate_dimensions(dimensions)
             # save the values
             this_cgs_value, this_dimensions = cgs_value, dimensions
 
@@ -334,7 +384,7 @@
 # @todo: simpler method that doesn't use recursion would be better...
 # We could check if dimensions.atoms are all numbers or symbols, but we should
 # check the functions also...
-def verify_dimensions(d):
+def validate_dimensions(d):
     """
     Make sure that `d` is a valid dimension expression. It must consist of only
     the base dimension symbols, to powers, multiplied together. If valid, return
@@ -352,12 +402,12 @@
 
     # validate args of a Pow or Mul separately
     elif isinstance(d, Pow):
-        return verify_dimensions(d.args[0])**verify_dimensions(d.args[1])
+        return validate_dimensions(d.args[0])**validate_dimensions(d.args[1])
 
     elif isinstance(d, Mul):
         total_mul = 1
         for arg in d.args:
-            total_mul *= verify_dimensions(arg)
+            total_mul *= validate_dimensions(arg)
         return total_mul
 
     # should never get here


https://bitbucket.org/yt_analysis/yt/commits/eaa24a2a8144/
Changeset:   eaa24a2a8144
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-07 20:18:54
Summary:     Merging.
Affected #:  2 files

diff -r eaa13c664dbbb4f728cafd82e1bc821dc78e2b7a -r eaa24a2a814427ff41e54ff0dbe694e52af46368 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -38,6 +38,7 @@
 from yt.funcs import *
 
 from yt.data_objects.particle_io import particle_handler_registry
+from yt.data_objects.yt_array import YTArray
 from yt.utilities.lib import \
     march_cubes_grid, march_cubes_grid_flux
 from yt.utilities.definitions import  x_dict, y_dict
@@ -193,12 +194,14 @@
         """
         if key not in self.field_data:
             if key in self._container_fields:
-                self.field_data[key] = self._generate_container_field(key)
+                self.field_data[key] = \
+                    YTArray(self._generate_container_field(key), input_units='1')
                 return self.field_data[key]
             else:
                 self.get_data(key)
         f = self._determine_fields(key)[0]
-        return self.field_data[f]
+        fi = self.pf._get_field_info(*f)
+        return YTArray(self.field_data[f], input_units=fi._units)
 
     def __setitem__(self, key, val):
         """

diff -r eaa13c664dbbb4f728cafd82e1bc821dc78e2b7a -r eaa24a2a814427ff41e54ff0dbe694e52af46368 yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -47,9 +47,6 @@
         if input_units is None:
             # Nothing provided. Make dimensionless...
             units = Unit()
-        else if isinstance(input_units, Unit):
-            # input_units is already a Unit, but let's be safe and make a copy.
-            units = copy.copy(input_units)
         else:
             # units kwarg set, but it's not a Unit object.
             # don't handle all the cases here, let the Unit class handle if
@@ -69,6 +66,18 @@
             return
         self.units = getattr(obj, 'units', None)
 
+    def __repr__(self):
+        """
+
+        """
+        return super(YTArray, self).__repr__()+' '+self.units.__repr__()
+
+    def __str__(self):
+        """
+
+        """
+        return super(YTArray, self).__str__()+' '+self.units.__str__()
+
     #
     # Start unit conversion methods
     #
@@ -194,19 +203,16 @@
         """
         if isinstance(right_object, YTArray):
             # make sure it's a quantity before we check units attribute
-            if not self.units.has_same_dimensions_as(right_object.units):
+            if not self.units.same_dimensions_as(right_object.units):
                 raise UnitOperationError("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (self.units, right_object.units))
         else:
+            # case of dimensionless self + float
             # the only way this works is with a float so...
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (self, right_object))
 
-            # case of dimensionless self + float
-            return Quantity(self.data + right_object, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity(self.data + right_object.get_data_in(self.units),
-                        self.units)
+        return YTArray(super(YTArray, self).__add__(right_object), input_units = right_object.units)
 
     def __radd__(self, left_object):
         """
@@ -219,16 +225,12 @@
             if not self.units.same_dimensions_as(left_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (left_object.units, self.units))
         else:  # the only way this works is with a float so...
+            # case of dimensionless float + self
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (left_object, self))
 
-            # case of dimensionless float + self
-            return Quantity(left_object + self.data, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity((left_object.data
-                         + self.get_data_in(left_object.units)),
-                        left_object.units)
+        return YTArray(super(YTArray, self).__radd__(left_object), input_units = right_object.units)
 
     def __sub__(self, right_object):
         """
@@ -240,16 +242,15 @@
         if isinstance(right_object, Quantity):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(right_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (self.units, right_object.units))
-        else:  # the only way this works is with a float so...
+        else:  
+            # case of dimensionless self + float
+            # the only way this works is with a float so...
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (self, right_object))
 
-            # case of dimensionless self + float
-            return Quantity(self.data - right_object, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity(self.data - right_object.get_data_in(self.units),
-                        self.units)
+        return YTArray(super(YTArray, self).__sub__(right_object), input_units = right_object.units)
+        
 
     def __rsub__(self, left_object):
         """
@@ -261,21 +262,18 @@
         if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(left_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (left_object.units, self.units))
-        else:  # the only way this works is with a float so...
+        else:  
+            # case of dimensionless self + float
+            # the only way this works is with a float so...
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (left_object, self))
 
-            # case of dimensionless float + self
-            return Quantity(left_object - self.data, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity((left_object.data
-                         - self.get_data_in(left_object.units)),
-                        left_object.units)
+        return YTArray(super(YTArray, self).__rsub__(left_object), input_units = left_object.units)
 
     def __neg__(self):
         """ Negate the data. """
-        return Quantity(-self.data, self.units)
+        return YTArray(super(YTArray, self).__neg__(self), input_units = self.units)
 
     def __mul__(self, right_object):
         """


https://bitbucket.org/yt_analysis/yt/commits/306de6c57855/
Changeset:   306de6c57855
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 20:21:50
Summary:     Fixing a bug in YTArray.__sub__
Affected #:  1 file

diff -r eaa24a2a814427ff41e54ff0dbe694e52af46368 -r 306de6c5785586bbd30e3712dad5ad5cdb84e49e yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -239,7 +239,7 @@
         different units, we always use the units on the left.
 
         """
-        if isinstance(right_object, Quantity):  # make sure it's a quantity before we check units attribute
+        if isinstance(right_object, YTArray):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(right_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (self.units, right_object.units))
         else:  


https://bitbucket.org/yt_analysis/yt/commits/a34c42574754/
Changeset:   a34c42574754
Branch:      yt-3.0
User:        brittonsmith
Date:        2013-03-07 20:28:02
Summary:     Fixing up __mul__ for YTArray.
Affected #:  1 file

diff -r 405a2dce75b61e29a2dea6ec723c7b205e3ecda4 -r a34c425747545b8c2695e232518ea95b5b2f4a42 yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -292,13 +292,15 @@
         The unit objects handle being multiplied by each other.
 
         """
-        if isinstance(right_object, Quantity):
-            return Quantity(self.data * right_object.data,
-                            self.units * right_object.units)
+        if isinstance(right_object, YTArray):
+            print "new units: ", (self.units * right_object.units)
+            return YTArray(super(YTArray, self).__mul__(right_object),
+                           input_units=(self.units * right_object.units))
 
         # `right_object` is not a Quantity object, so try to use it as
         # dimensionless data.
-        return Quantity(self.data * right_object, self.units)
+        return YTArray(super(YTArray, self).__mul__(right_object), 
+                       input_units=self.units)
 
     def __rmul__(self, left_object):
         """


https://bitbucket.org/yt_analysis/yt/commits/43f7e0f254dd/
Changeset:   43f7e0f254dd
Branch:      yt-3.0
User:        brittonsmith
Date:        2013-03-07 20:28:42
Summary:     Merged.
Affected #:  2 files

diff -r a34c425747545b8c2695e232518ea95b5b2f4a42 -r 43f7e0f254dd3fdebf7ed963fb048fea4d6d91ca yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -203,19 +203,16 @@
         """
         if isinstance(right_object, YTArray):
             # make sure it's a quantity before we check units attribute
-            if not self.units.has_same_dimensions_as(right_object.units):
+            if not self.units.same_dimensions_as(right_object.units):
                 raise UnitOperationError("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (self.units, right_object.units))
         else:
+            # case of dimensionless self + float
             # the only way this works is with a float so...
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (self, right_object))
 
-            # case of dimensionless self + float
-            return Quantity(self.data + right_object, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity(self.data + right_object.get_data_in(self.units),
-                        self.units)
+        return YTArray(super(YTArray, self).__add__(right_object), input_units = right_object.units)
 
     def __radd__(self, left_object):
         """
@@ -228,16 +225,12 @@
             if not self.units.same_dimensions_as(left_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (left_object.units, self.units))
         else:  # the only way this works is with a float so...
+            # case of dimensionless float + self
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (left_object, self))
 
-            # case of dimensionless float + self
-            return Quantity(left_object + self.data, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity((left_object.data
-                         + self.get_data_in(left_object.units)),
-                        left_object.units)
+        return YTArray(super(YTArray, self).__radd__(left_object), input_units = right_object.units)
 
     def __sub__(self, right_object):
         """
@@ -246,19 +239,18 @@
         different units, we always use the units on the left.
 
         """
-        if isinstance(right_object, Quantity):  # make sure it's a quantity before we check units attribute
+        if isinstance(right_object, YTArray):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(right_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (self.units, right_object.units))
-        else:  # the only way this works is with a float so...
+        else:  
+            # case of dimensionless self + float
+            # the only way this works is with a float so...
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (self, right_object))
 
-            # case of dimensionless self + float
-            return Quantity(self.data - right_object, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity(self.data - right_object.get_data_in(self.units),
-                        self.units)
+        return YTArray(super(YTArray, self).__sub__(right_object), input_units = right_object.units)
+        
 
     def __rsub__(self, left_object):
         """
@@ -270,21 +262,18 @@
         if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(left_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (left_object.units, self.units))
-        else:  # the only way this works is with a float so...
+        else:  
+            # case of dimensionless self + float
+            # the only way this works is with a float so...
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (left_object, self))
 
-            # case of dimensionless float + self
-            return Quantity(left_object - self.data, self.units)
-
         # `get_data_in` will not apply the conversion if the units are the same
-        return Quantity((left_object.data
-                         - self.get_data_in(left_object.units)),
-                        left_object.units)
+        return YTArray(super(YTArray, self).__rsub__(left_object), input_units = left_object.units)
 
     def __neg__(self):
         """ Negate the data. """
-        return Quantity(-self.data, self.units)
+        return YTArray(super(YTArray, self).__neg__(self), input_units = self.units)
 
     def __mul__(self, right_object):
         """

diff -r a34c425747545b8c2695e232518ea95b5b2f4a42 -r 43f7e0f254dd3fdebf7ed963fb048fea4d6d91ca yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -29,18 +29,38 @@
 from sympy import nsimplify, posify, sympify
 from sympy.parsing.sympy_parser import parse_expr
 
-# The base dimensions
+#
+# Exceptions
+#
+
+class SymbolNotFoundError(Exception):
+    pass
+
+class UnitParseError(Exception):
+    pass
+
+class UnitOperationError(Exception):
+    pass
+
+#
+# Base dimensions
+#
+
 mass = Symbol("(mass)", positive=True)
 length = Symbol("(length)", positive=True)
 time = Symbol("(time)", positive=True)
 temperature = Symbol("(temperature)", positive=True)
+
 base_dimensions = [mass, length, time, temperature]
 
-### Misc. dimensions
-rate = 1 / time
+#
+# Derived dimensions
+#
 
 dimensionless = sympify(1)
 
+rate = 1 / time
+
 velocity     = length / time
 acceleration = length / time**2
 jerk         = length / time**3
@@ -57,8 +77,13 @@
 electric_field = charge / length**2
 magnetic_field = electric_field
 
-# The key is the symbol, the value is a tuple with the conversion factor to
-# cgs, the dimensionality, and
+#
+# The default/basic unit symbol lookup table.
+#
+# Lookup a unit symbol with the symbol string, and provide a tuple with the
+# conversion factor to cgs and dimensionality.
+#
+
 default_unit_symbol_LUT = {
     # base
     "g":  (1.0, mass),
@@ -133,19 +158,38 @@
 class UnitSymbolRegistry:
 
     def __init__(self, add_default_symbols=True):
-        self.lookup_dict = {}
+        self.lut = {}
 
         if add_default_symbols:
-            self.lookup_dict.update(default_symbol_lookup_dict)
+            self.lut.update(default_unit_symbol_LUT)
 
+    def add(symbol, cgs_value, dimensions):
+        """
+        Add a symbol to this registry.
 
+        """
+        # Validate
+        if not isinstance(cgs_value, float):
+            raise UnitParseError("cgs_value must be a float, got a %s." % type(cgs_value))
 
+        validate_dimensions(dimensions)
 
-class UnitParseError(Exception):
-    pass
+        # Add to lut
+        self.lut.update( {symbol: (cgs_value, dimensions)} )
 
-class UnitOperationError(Exception):
-    pass
+    def remove(symbol):
+        """
+        Remove the entry for the unit matching `symbol`.
+
+        """
+        if symbol not in self.lut:
+            raise SymbolNotFoundError("Tried to remove the symbol '%s', but it does not exist in this registry." % symbol)
+
+        del self.lut[symbol]
+
+
+default_symbol_registry = UnitSymbolRegistry()
+
 
 
 class Unit(Expr):
@@ -179,16 +223,22 @@
             time, and temperature objects to various powers.
 
         """
-        # if we have a string, parse into an expression
-        if isinstance(unit_expr, str):
+        # Simplest case. If user passes a Unit object, just use the expr.
+        if isinstance(unit_expr, Unit):
+            # grab the unit object's sympy expression.
+            unit_expr = unit_expr.expr
+
+        # If we have a string, have sympy parse it into an Expr.
+        elif isinstance(unit_expr, str):
             if not unit_expr:
                 # Bug catch...
                 # if unit_expr is an empty string, parse_expr fails hard...
                 unit_expr = "1"
             unit_expr = parse_expr(unit_expr)
 
+        # Make sure we have an Expr at this point.
         if not isinstance(unit_expr, Expr):
-            raise UnitParseError("Unit representation must be a string or sympy Expr. %s is a %s." % (unit_expr, type(unit_expr)))
+            raise UnitParseError("Unit representation must be a string or sympy Expr. %s has type %s." % (unit_expr, type(unit_expr)))
         # done with argument checking...
 
         # sympify, make positive symbols, and nsimplify the expr
@@ -212,7 +262,7 @@
             except ValueError:
                 raise UnitParseError("Please provide a float for the cgs_value kwarg. I got '%s'." % cgs_value)
             # check that dimensions is valid
-            dimensions = verify_dimensions(dimensions)
+            dimensions = validate_dimensions(dimensions)
             # save the values
             this_cgs_value, this_dimensions = cgs_value, dimensions
 
@@ -334,7 +384,7 @@
 # @todo: simpler method that doesn't use recursion would be better...
 # We could check if dimensions.atoms are all numbers or symbols, but we should
 # check the functions also...
-def verify_dimensions(d):
+def validate_dimensions(d):
     """
     Make sure that `d` is a valid dimension expression. It must consist of only
     the base dimension symbols, to powers, multiplied together. If valid, return
@@ -352,12 +402,12 @@
 
     # validate args of a Pow or Mul separately
     elif isinstance(d, Pow):
-        return verify_dimensions(d.args[0])**verify_dimensions(d.args[1])
+        return validate_dimensions(d.args[0])**validate_dimensions(d.args[1])
 
     elif isinstance(d, Mul):
         total_mul = 1
         for arg in d.args:
-            total_mul *= verify_dimensions(arg)
+            total_mul *= validate_dimensions(arg)
         return total_mul
 
     # should never get here


https://bitbucket.org/yt_analysis/yt/commits/833c25124ea8/
Changeset:   833c25124ea8
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 20:30:44
Summary:     Removing an extraneous print statement in YTArray.__mul__
Affected #:  1 file

diff -r 43f7e0f254dd3fdebf7ed963fb048fea4d6d91ca -r 833c25124ea83604cbde713b8600ab8ab3162ee3 yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -282,7 +282,6 @@
 
         """
         if isinstance(right_object, YTArray):
-            print "new units: ", (self.units * right_object.units)
             return YTArray(super(YTArray, self).__mul__(right_object),
                            input_units=(self.units * right_object.units))
 


https://bitbucket.org/yt_analysis/yt/commits/181ac3edb9b6/
Changeset:   181ac3edb9b6
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-08 03:01:17
Summary:     units: Some renaming for cleanup. Filled out the registry class and hooked it into the Unit class and helper functions.
Affected #:  1 file

diff -r 833c25124ea83604cbde713b8600ab8ab3162ee3 -r 181ac3edb9b6f79b63c7683dbd2f19d72f3439a8 yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -29,6 +29,9 @@
 from sympy import nsimplify, posify, sympify
 from sympy.parsing.sympy_parser import parse_expr
 
+# Define a sympy one object.
+sympy_one = sympify(1)
+
 #
 # Exceptions
 #
@@ -84,7 +87,7 @@
 # conversion factor to cgs and dimensionality.
 #
 
-default_unit_symbol_LUT = {
+default_unit_symbol_lut = {
     # base
     "g":  (1.0, mass),
     #"cm": (1.0, length, r"\rm{cm}"),  # duplicate with meter below...
@@ -155,13 +158,13 @@
 }
 
 
-class UnitSymbolRegistry:
+class UnitRegistry:
 
     def __init__(self, add_default_symbols=True):
         self.lut = {}
 
         if add_default_symbols:
-            self.lut.update(default_unit_symbol_LUT)
+            self.lut.update(default_unit_symbol_lut)
 
     def add(symbol, cgs_value, dimensions):
         """
@@ -172,7 +175,7 @@
         if not isinstance(cgs_value, float):
             raise UnitParseError("cgs_value must be a float, got a %s." % type(cgs_value))
 
-        validate_dimensions(dimensions)
+        _validate_dimensions(dimensions)
 
         # Add to lut
         self.lut.update( {symbol: (cgs_value, dimensions)} )
@@ -188,46 +191,46 @@
         del self.lut[symbol]
 
 
-default_symbol_registry = UnitSymbolRegistry()
-
-
+default_unit_registry = UnitRegistry()
 
 class Unit(Expr):
     """
-    A symbolic unit, using sympy functionality. We only add "dimensions" so that
-    sympy understands relations between different units.
+    A symbolic unit, using sympy functionality. We only add "dimensions" so
+    that sympy understands relations between different units.
 
     """
 
+    # Set some assumptions for sympy.
     is_positive = True    # make sqrt(m**2) --> m
     is_commutative = True
     is_number = False
 
-    __slots__ = ["expr", "cgs_value", "dimensions", "is_atomic"]
+    # Extra attributes
+    __slots__ = ["expr", "is_atomic", "cgs_value", "dimensions", "registry"]
 
     def __new__(cls, unit_expr=sympify(1), cgs_value=None, dimensions=None,
-                **assumptions):
+                registry=None, **assumptions):
         """
-        Create a new unit. May be an atomic unit (like a gram) or a combination
-        of other units (like g / cm**3).
+        Create a new unit. May be an atomic unit (like a gram) or combinations
+        of atomic units (like g / cm**3).
 
         Parameters
         ----------
-        unit_expr : string or sympy.core.expr.Expr
-            The unit symbol expression.
+        unit_expr : Unit object, sympy.core.expr.Expr object, or str
+            The symbolic unit expression.
         cgs_value : float
-            This unit's value in cgs.
+            The unit's value in cgs.
         dimensions : sympy.core.expr.Expr
-            An expression representing the dimensionality of this unit. This
-            should be a product (sympy.core.mul.Mul object) of mass, length,
-            time, and temperature objects to various powers.
+            A sympy expression representing the dimensionality of this unit.
+            It must contain only mass, length, time, and temperature symbols.
+        registry : UnitRegistry object
+            The unit registry we use to interpret unit symbols.
 
         """
         # Simplest case. If user passes a Unit object, just use the expr.
         if isinstance(unit_expr, Unit):
             # grab the unit object's sympy expression.
             unit_expr = unit_expr.expr
-
         # If we have a string, have sympy parse it into an Expr.
         elif isinstance(unit_expr, str):
             if not unit_expr:
@@ -235,15 +238,19 @@
                 # if unit_expr is an empty string, parse_expr fails hard...
                 unit_expr = "1"
             unit_expr = parse_expr(unit_expr)
-
         # Make sure we have an Expr at this point.
         if not isinstance(unit_expr, Expr):
             raise UnitParseError("Unit representation must be a string or sympy Expr. %s has type %s." % (unit_expr, type(unit_expr)))
+
+        if registry is None:
+            # Caller did not set the registry, so use the default.
+            registry = default_unit_registry
+
         # done with argument checking...
 
         # sympify, make positive symbols, and nsimplify the expr
         unit_expr = sympify(unit_expr)
-        unit_expr = make_symbols_positive(unit_expr)
+        unit_expr = _make_symbols_positive(unit_expr)
         unit_expr = nsimplify(unit_expr)
 
         # see if the unit is atomic.
@@ -251,227 +258,143 @@
         if isinstance(unit_expr, Symbol):
             is_atomic = True
 
-        # Did the user supply cgs_value and dimensions?
-        if cgs_value and not dimensions or dimensions and not cgs_value:
-            raise Exception("If you provide cgs_vale or dimensions, you must provide both. cgs_value is %s, dimensions is %s." % (cgs_value, dimensions))
+        #
+        # check cgs_value and dimensions
+        #
 
-        if cgs_value and dimensions:
+        if cgs_value is not None and dimensions is not None:
             # check that cgs_value is a float or can be converted to one
             try:
                 cgs_value = float(cgs_value)
             except ValueError:
-                raise UnitParseError("Please provide a float for the cgs_value kwarg. I got '%s'." % cgs_value)
+                raise UnitParseError("Could not use cgs_value as a float. cgs_value is '%s' (type %s)." % (cgs_value, type(cgs_value)) )
+
             # check that dimensions is valid
-            dimensions = validate_dimensions(dimensions)
-            # save the values
-            this_cgs_value, this_dimensions = cgs_value, dimensions
+            _validate_dimensions( sympify(dimensions) )
+        else:
+            # lookup the unit symbols
+            cgs_value, dimensions = _get_unit_data_from_expr(unit_expr,
+                                                             registry.lut)
 
-        else:  # lookup the unit symbols
-            this_cgs_value, this_dimensions = \
-                get_unit_data_from_expr(unit_expr)
+        # Sympy trick to get dimensions powers as Rationals
+        dimensions = nsimplify(dimensions)
 
-        # Trick to get dimensions powers as Rationals
-        this_dimensions = nsimplify(this_dimensions)
-
-        # create obj with superclass construct
+        # Create obj with superclass construct.
         obj = Expr.__new__(cls, **assumptions)
 
-        # attach attributes to obj
+        # Attach attributes to obj.
         obj.expr = unit_expr
         obj.is_atomic = is_atomic
-        obj.cgs_value = this_cgs_value
-        obj.dimensions = this_dimensions
+        obj.cgs_value = cgs_value
+        obj.dimensions = dimensions
+        obj.registry = registry
 
-        # return `obj` so __init__ can handle it.
+        # Return `obj` so __init__ can handle it.
         return obj
 
-    ### some sympy conventions I guess
+    ### Some sympy conventions
     def __getnewargs__(self):
-        return (self.expr, self.is_atomic, self.cgs_value, self.dimensions)
+        return (self.expr, self.is_atomic, self.cgs_value, self.dimensions,
+                self.registry)
 
     def __hash__(self):
         return super(Unit, self).__hash__()
 
     def _hashable_content(self):
-        return (self.expr, self.is_atomic, self.cgs_value, self.dimensions)
+        return (self.expr, self.is_atomic, self.cgs_value, self.dimensions,
+                self.registry)
     ### end sympy conventions
 
     def __repr__(self):
-        if self.expr == 1:
+        if self.expr == sympy_one:
             return "(dimensionless)"
-        return str(self.expr)
+        # @todo: don't use dunder method?
+        return self.expr.__repr__()
 
     def __str__(self):
-        if self.expr == 1:
+        if self.expr == sympy_one:
             return "(dimensionless)"
-        return str(self.expr)
+        # @todo: don't use dunder method?
+        return self.expr.__str__()
 
     # for sympy.printing
     def _sympystr(self, *args):
         return str(self.expr)
 
-    ### override sympy operations
+    #
+    # Start unit operations
+    #
+
     def __mul__(self, u):
         """ Multiply Unit with u (Unit object). """
         if not isinstance(u, Unit):
-            raise UnitOperationError("Tried to multiply Unit object with '%s'. This behavior is undefined." % u)
+            raise UnitOperationError("Tried to multiply a Unit object with '%s' (type %s). This behavior is undefined." % (u, type(u)) )
 
-        return Unit(self.expr * u.expr, self.cgs_value * u.cgs_value,
-                    self.dimensions * u.dimensions)
+        return Unit(self.expr * u.expr,
+                    cgs_value=(self.cgs_value * u.cgs_value),
+                    dimensions=(self.dimensions * u.dimensions),
+                    registry=self.registry)
 
     def __div__(self, u):
         """ Divide Unit by u (Unit object). """
         if not isinstance(u, Unit):
-            raise UnitOperationError("Tried to divide Unit object by '%s'. This behavior is undefined." % u)
+            raise UnitOperationError("Tried to divide a Unit object by '%s' (type %s). This behavior is undefined." % (u, type(u)) )
 
-        return Unit(self.expr / u.expr, self.cgs_value / u.cgs_value,
-                    self.dimensions / u.dimensions)
+        return Unit(self.expr / u.expr,
+                    cgs_value=(self.cgs_value / u.cgs_value),
+                    dimensions=(self.dimensions / u.dimensions),
+                    registry=self.registry)
 
     def __pow__(self, p):
         """ Take Unit to power p (float). """
         try:
             p = sympify(p)
         except ValueError:
-            raise UnitOperationError("Tried to take Unit object to the power '%s'. I could not cast this to a float." % p)
+            raise UnitOperationError("Tried to take a Unit object to the power '%s' (type %s). Failed to cast it to a float." % (p, type(p)) )
 
-        return Unit(self.expr**p, self.cgs_value**p, self.dimensions**p)
-
-    ### Comparison operators
-    def same_dimensions_as(self, other_unit):
-        """ Test if dimensions are the same. """
-        return (self.dimensions / other_unit.dimensions) == 1
+        return Unit(self.expr**p, cgs_value=(self.cgs_value**p),
+                    dimensions=(self.dimensions**p), registry=self.registry)
 
     def __eq__(self, u):
         """ Test unit equality. """
         if not isinstance(u, Unit):
-            raise UnitOperationError("Tried to test equality between Unit object and '%s'. This behavior is undefined." % u)
+            raise UnitOperationError("Tried to test equality between a Unit object and '%s' (type %s). This behavior is undefined." % (u, type(u)) )
 
         return (self.cgs_value == u.cgs_value and self.dimensions == u.dimensions)
 
+    #
+    # End unit operations
+    #
+
+    def same_dimensions_as(self, other_unit):
+        """ Test if dimensions are the same. """
+        return (self.dimensions / other_unit.dimensions) == sympy_one
+
     @property
     def is_dimensionless(self):
-        return self.dimensions == 1
+        return self.dimensions == sympy_one
 
+    # @todo: might be a simpler/smarter sympy way to do this...
     def get_cgs_equivalent(self):
-        """ Create and return dimensionally-equivalent cgs units. """
+        """
+        Create and return dimensionally-equivalent cgs units.
+
+        """
         cgs_units_string = "g**(%s) * cm**(%s) * s**(%s) * K**(%s)" % \
             (self.dimensions.expand().as_coeff_exponent(mass)[1],
              self.dimensions.expand().as_coeff_exponent(length)[1],
              self.dimensions.expand().as_coeff_exponent(time)[1],
              self.dimensions.expand().as_coeff_exponent(temperature)[1])
-        return Unit(cgs_units_string, 1, self.dimensions)
+
+        return Unit(cgs_units_string, cgs_value=1.0,
+                    dimensions=self.dimensions, registry=self.registry)
 
     def get_conversion_factor(self, other_units):
         return get_conversion_factor(self, other_units)
 
-
-def make_symbols_positive(expr):
-    """
-    Grabs all symbols from expr, makes new positive symbols with the same names,
-    and substitutes them back into the expression.
-
-    """
-    expr_symbols = expr.atoms(Symbol)  # grab all symbols
-
-    # Replace one at a time
-    for s in expr_symbols:
-        # replace this symbol with a positive version
-        expr = expr.subs(s, Symbol(s.name, positive=True))
-
-    return expr
-
-
-# @todo: simpler method that doesn't use recursion would be better...
-# We could check if dimensions.atoms are all numbers or symbols, but we should
-# check the functions also...
-def validate_dimensions(d):
-    """
-    Make sure that `d` is a valid dimension expression. It must consist of only
-    the base dimension symbols, to powers, multiplied together. If valid, return
-    the simplified expression. If not, raise an Exception.
-
-    """
-    # in the case of a Number of Symbol, we can just return
-    if isinstance(d, Number):
-        return d
-    elif isinstance(d, Symbol):
-        if d in base_dimensions:
-            return d
-        else:
-            raise UnitParseError("dimensionality expression contains an unknown symbol '%s'." % d)
-
-    # validate args of a Pow or Mul separately
-    elif isinstance(d, Pow):
-        return validate_dimensions(d.args[0])**validate_dimensions(d.args[1])
-
-    elif isinstance(d, Mul):
-        total_mul = 1
-        for arg in d.args:
-            total_mul *= validate_dimensions(arg)
-        return total_mul
-
-    # should never get here
-    raise UnitParseError("Bad dimensionality expression '%s'." % d)
-
-
-def get_unit_data_from_expr(unit_expr):
-    """
-    Gets total cgs_value and dimensions from a valid unit expression.
-
-    """
-    # The simplest case first
-    if isinstance(unit_expr, Unit):
-        return (unit_expr.cgs_value, unit_expr.dimensions)
-
-    # Now for the sympy possibilities
-    if isinstance(unit_expr, Symbol):
-        return lookup_unit_symbol(str(unit_expr))
-
-    if isinstance(unit_expr, Number):
-        return (1, 1)
-
-    if isinstance(unit_expr, Pow):
-        unit_data = get_unit_data_from_expr(unit_expr.args[0])
-        power = unit_expr.args[1]
-        return (unit_data[0]**power, unit_data[1]**power)
-
-    if isinstance(unit_expr, Mul):
-        cgs_value = 1
-        dimensions = 1
-        for expr in unit_expr.args:
-            unit_data = get_unit_data_from_expr(expr)
-            cgs_value *= unit_data[0]
-            dimensions *= unit_data[1]
-
-        return (cgs_value, dimensions)
-
-    raise UnitParseError("Cannot parse for unit data from '%s'. Please supply an expression of only Unit, Symbol, Pow, and Mul objects." % str(unit_expr))
-
-
-def lookup_unit_symbol(symbol_str):
-    """ Searches for the unit data typle corresponding to the given symbol. """
-
-    if symbol_str in default_unit_symbol_LUT:
-        # lookup successful, return the tuple directly
-        return default_unit_symbol_LUT[symbol_str]
-
-    # could still be a known symbol with a prefix
-    possible_prefix = symbol_str[0]
-    if possible_prefix in unit_prefixes:
-        # the first character could be a prefix, check the rest of the symbol
-        symbol_wo_prefix = symbol_str[1:]
-
-        if symbol_wo_prefix in default_unit_symbol_LUT:
-            # lookup successful, it's a symbol with a prefix
-            unit_data = default_unit_symbol_LUT[symbol_wo_prefix]
-            prefix_value = unit_prefixes[possible_prefix]
-
-            # don't forget to account for the prefix value!
-            return (unit_data[0] * prefix_value, unit_data[1])
-
-    # no dice
-    raise UnitParseError("Could not find unit symbol '%s'. Please supply the dimensions and cgs value when creating this object." % symbol_str)
-
+#
+# Unit manipulation functions
+#
 
 def get_conversion_factor(old_units, new_units):
     """
@@ -492,10 +415,10 @@
         `old_units / new_units`
 
     """
-    # Make units out of strings if we need to.
-    if isinstance(old_units, str):
+    # if args are not Unit objects, construct them
+    if not isinstance(old_units, Unit):
         old_units = Unit(old_units)
-    if isinstance(new_units, str):
+    if not isinstance(new_units, Unit):
         new_units = Unit(new_units)
 
     if not old_units.same_dimensions_as(new_units):
@@ -521,3 +444,132 @@
 
     """
     return values * get_conversion_factor(old_units, new_units)
+
+
+#
+# Helper functions
+#
+
+def _make_symbols_positive(expr):
+    """
+    Grabs all symbols from expr, makes new positive symbols with the same names,
+    and substitutes them back into the expression.
+
+    """
+    expr_symbols = expr.atoms(Symbol)  # grab all symbols
+
+    # Replace one at a time
+    for s in expr_symbols:
+        # replace this symbol with a positive version
+        expr = expr.subs(s, Symbol(s.name, positive=True))
+
+    return expr
+
+# @todo: simpler method that doesn't use recursion would be better...
+# We could check if dimensions.atoms are all numbers or symbols, but we should
+# check the functions also...
+def _validate_dimensions(d):
+    """
+    Make sure that `d` is a valid dimension expression. It must consist of only
+    the base dimension symbols, to powers, multiplied together. If valid, return
+    the simplified expression. If not, raise an Exception.
+
+    """
+    # in the case of a Number of Symbol, we can just return
+    if isinstance(d, Number):
+        return d
+    elif isinstance(d, Symbol):
+        if d in base_dimensions:
+            return d
+        else:
+            raise UnitParseError("dimensionality expression contains an unknown symbol '%s'." % d)
+
+    # validate args of a Pow or Mul separately
+    elif isinstance(d, Pow):
+        return _validate_dimensions(d.args[0])**_validate_dimensions(d.args[1])
+
+    elif isinstance(d, Mul):
+        total_mul = 1
+        for arg in d.args:
+            total_mul *= _validate_dimensions(arg)
+        return total_mul
+
+    # should never get here
+    raise UnitParseError("Bad dimensionality expression '%s'." % d)
+
+
+def _get_unit_data_from_expr(unit_expr, unit_symbol_lut):
+    """
+    Grabs the total cgs_value and dimensions from a valid unit expression.
+
+    Parameters
+    ----------
+    unit_expr: Unit object, or sympy Expr object
+        The expression containing unit symbols.
+    unit_symbol_lut: dict
+        Provides the unit data for each valid unit symbol.
+
+    """
+    # The simplest case first
+    if isinstance(unit_expr, Unit):
+        return (unit_expr.cgs_value, unit_expr.dimensions)
+
+    # Now for the sympy possibilities
+    if isinstance(unit_expr, Symbol):
+        return _lookup_unit_symbol(str(unit_expr), unit_symbol_lut)
+
+    if isinstance(unit_expr, Number):
+        # not sure if this should be (1, 1)...
+        return (float(unit_expr), sympy_one)
+
+    if isinstance(unit_expr, Pow):
+        unit_data = _get_unit_data_from_expr(unit_expr.args[0], unit_symbol_lut)
+        power = unit_expr.args[1]
+        return (unit_data[0]**power, unit_data[1]**power)
+
+    if isinstance(unit_expr, Mul):
+        cgs_value = 1.0
+        dimensions = 1
+        for expr in unit_expr.args:
+            unit_data = _get_unit_data_from_expr(expr, unit_symbol_lut)
+            cgs_value *= unit_data[0]
+            dimensions *= unit_data[1]
+
+        return (cgs_value, dimensions)
+
+    raise UnitParseError("Cannot parse for unit data from '%s'. Please supply an expression of only Unit, Symbol, Pow, and Mul objects." % str(unit_expr))
+
+
+def _lookup_unit_symbol(symbol_str, unit_symbol_lut):
+    """
+    Searches for the unit data typle corresponding to the given symbol.
+
+    Parameters
+    ----------
+    symbol_str : str
+        The unit symbol to look up.
+    unit_symbol_lut : dict
+        Dictionary with symbols as keys and unit data tuples as values.
+
+    """
+
+    if symbol_str in unit_symbol_lut:
+        # lookup successful, return the tuple directly
+        return default_unit_symbol_lut[symbol_str]
+
+    # could still be a known symbol with a prefix
+    possible_prefix = symbol_str[0]
+    if possible_prefix in unit_prefixes:
+        # the first character could be a prefix, check the rest of the symbol
+        symbol_wo_prefix = symbol_str[1:]
+
+        if symbol_wo_prefix in unit_symbol_lut:
+            # lookup successful, it's a symbol with a prefix
+            unit_data = unit_symbol_lut[symbol_wo_prefix]
+            prefix_value = unit_prefixes[possible_prefix]
+
+            # don't forget to account for the prefix value!
+            return (unit_data[0] * prefix_value, unit_data[1])
+
+    # no dice
+    raise UnitParseError("Could not find unit symbol '%s' in the provided symbols. Please define this unit symbol." % symbol_str)


https://bitbucket.org/yt_analysis/yt/commits/c39a398ab074/
Changeset:   c39a398ab074
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-08 03:01:54
Summary:     units tests: Updating names to match units module.
Affected #:  1 file

diff -r 181ac3edb9b6f79b63c7683dbd2f19d72f3439a8 -r c39a398ab074bb747f5af820636c6e3851bc7ac8 yt/utilities/tests/test_units.py
--- a/yt/utilities/tests/test_units.py
+++ b/yt/utilities/tests/test_units.py
@@ -31,11 +31,11 @@
 # base dimensions
 from yt.utilities.units import mass, length, time, temperature
 # functions
-from yt.utilities.units import get_conversion_factor, make_symbols_positive
+from yt.utilities.units import get_conversion_factor
 # classes
 from yt.utilities.units import Unit, UnitParseError
 # objects
-from yt.utilities.units import unit_symbols_dict, unit_prefixes
+from yt.utilities.units import default_unit_symbol_lut, unit_prefixes
 
 
 def test_no_conflicting_symbols():
@@ -43,10 +43,10 @@
     Check unit symbol definitions for conflicts.
 
     """
-    full_set = set(unit_symbols_dict.keys())
+    full_set = set(default_unit_symbol_lut.keys())
 
     # go through all possible prefix combos
-    for symbol in unit_symbols_dict.keys():
+    for symbol in default_unit_symbol_lut.keys():
         for prefix in unit_prefixes.keys():
             new_symbol = "%s%s" % (prefix, symbol)
 


https://bitbucket.org/yt_analysis/yt/commits/f510a65d8d36/
Changeset:   f510a65d8d36
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-08 03:04:07
Summary:     data containers: modified get_data to grab the unit object from the pf unit registry.
Affected #:  1 file

diff -r c39a398ab074bb747f5af820636c6e3851bc7ac8 -r f510a65d8d36c86186a30e55b8a3ffa2e1c980a6 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -1,4 +1,4 @@
-""" 
+"""
 The base classes for selecting and returning data.
 
 Author: Matthew Turk <matthewturk at gmail.com>
@@ -62,7 +62,7 @@
             return np.zeros(shape, dtype='bool')
 
 def restore_field_information_state(func):
-    """ 
+    """
     A decorator that takes a function with the API of (self, grid, field)
     and ensures that after the function is called, the field_parameters will
     be returned to normal.
@@ -76,14 +76,14 @@
     return save_state
 
 class YTFieldData(dict):
-    """ 
+    """
     A Container object for field data, instead of just having it be a dict.
     """
     pass
-        
+
 
 class YTDataContainer(object):
-    """ 
+    """
     Generic YTDataContainer container.  By itself, will attempt to
     generate field, read fields (method defined by derived classes)
     and deal with passing back and forth field parameters.
@@ -101,7 +101,7 @@
                 data_object_registry[cls._type_name] = cls
 
     def __init__(self, pf, field_parameters):
-        """ 
+        """
         Typically this is never called directly, but only due to inheritance.
         It associates a :class:`~yt.data_objects.api.StaticOutput` with the class,
         sets its initial set of fields, and the remainder of the arguments
@@ -199,9 +199,16 @@
                 return self.field_data[key]
             else:
                 self.get_data(key)
+
         f = self._determine_fields(key)[0]
         fi = self.pf._get_field_info(*f)
-        return YTArray(self.field_data[f], input_units=fi._units)
+
+        # @todo: Might find a better way to grab the unit object.
+        # fi.units is the unit expression string. We depend on the registry
+        # hanging off the dataset to define this unit object.
+        unit_obj = self.pf.get_unit_from_registry(fi.units)
+
+        return YTArray(self.field_data[f], input_units=unit_obj)
 
     def __setitem__(self, key, val):
         """
@@ -457,7 +464,7 @@
             deps = [d for d in requested if d not in fields_to_get]
             fields_to_get += deps
         return fields_to_get
-    
+
     def get_data(self, fields=None):
         if self._current_chunk is None:
             self.hierarchy._identify_base_chunk(self)
@@ -555,7 +562,7 @@
 
 class YTSelectionContainer2D(YTSelectionContainer):
     _key_fields = ['px','py','pdx','pdy']
-    """ 
+    """
     Class to represent a set of :class:`YTDataContainer` that's 2-D in nature, and
     thus does not have as many actions as the 3-D data types.
     """
@@ -570,7 +577,7 @@
         super(YTSelectionContainer2D, self).__init__(
             pf, field_parameters)
         self.set_field_parameter("axis", axis)
-        
+
     def _convert_field_name(self, field):
         return field
 
@@ -584,7 +591,7 @@
         (bounds, center, units) = GetWindowParameters(axis, center, width, self.pf)
         if axes_unit is None and units != ('1', '1'):
             axes_unit = units
-        pw = PWViewerMPL(self, bounds, origin=origin, frb_generator=FixedResolutionBuffer, 
+        pw = PWViewerMPL(self, bounds, origin=origin, frb_generator=FixedResolutionBuffer,
                          plot_type=plot_type)
         pw.set_axes_unit(axes_unit)
         return pw
@@ -626,13 +633,13 @@
         >>> frb = proj.to_frb( (100.0, 'kpc'), 1024)
         >>> write_image(np.log10(frb["Density"]), 'density_100kpc.png')
         """
-        
+
         if (self.pf.geometry == "cylindrical" and self.axis == 1) or \
             (self.pf.geometry == "polar" and self.axis == 2):
             from yt.visualization.fixed_resolution import CylindricalFixedResolutionBuffer
             frb = CylindricalFixedResolutionBuffer(self, width, resolution)
             return frb
-        
+
         if center is None:
             center = self.get_field_parameter("center")
             if center is None:
@@ -680,9 +687,9 @@
     def cut_region(self, field_cuts):
         """
         Return an InLineExtractedRegion, where the grid cells are cut on the
-        fly with a set of field_cuts.  It is very useful for applying 
+        fly with a set of field_cuts.  It is very useful for applying
         conditions to the fields in your data object.
-        
+
         Examples
         --------
         To find the total mass of gas above 10^6 K in your volume:
@@ -716,7 +723,7 @@
         useful for calculating, for instance, total isocontour area, or
         visualizing in an external program (such as `MeshLab
         <http://meshlab.sf.net>`_.)
-        
+
         Parameters
         ----------
         field : string
@@ -830,7 +837,7 @@
 
         Additionally, the returned flux is defined as flux *into* the surface,
         not flux *out of* the surface.
-        
+
         Parameters
         ----------
         field : string
@@ -886,7 +893,7 @@
             ff = np.ones(vals.shape, dtype="float64")
         else:
             ff = grid.get_vertex_centered_data(fluxing_field)
-        xv, yv, zv = [grid.get_vertex_centered_data(f) for f in 
+        xv, yv, zv = [grid.get_vertex_centered_data(f) for f in
                      [field_x, field_y, field_z]]
         return march_cubes_grid_flux(value, vals, xv, yv, zv,
                     ff, mask, grid.LeftEdge, grid.dds)


https://bitbucket.org/yt_analysis/yt/commits/beaf968f0736/
Changeset:   beaf968f0736
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-08 03:06:23
Summary:     field info container: changed units and projected_units in derived field to be the unit strings, rather than the Unit objects.
Affected #:  1 file

diff -r f510a65d8d36c86186a30e55b8a3ffa2e1c980a6 -r beaf968f07361e5acc362978af6c9d88f40ce6bd yt/data_objects/field_info_container.py
--- a/yt/data_objects/field_info_container.py
+++ b/yt/data_objects/field_info_container.py
@@ -59,7 +59,7 @@
                 return function
             return create_function
         self[name] = DerivedField(name, function, **kwargs)
-        
+
     def add_grad(self, field, **kwargs):
         """
         Creates the partial derivative of a given field. This function will
@@ -68,31 +68,31 @@
         """
         sl = slice(2,None,None)
         sr = slice(None,-2,None)
-        
+
         def _gradx(f, data):
             grad = data[field][sl,1:-1,1:-1] - data[field][sr,1:-1,1:-1]
             grad /= 2.0*data["dx"].flat[0]
             g = np.zeros(data[field].shape, dtype='float64')
             g[1:-1,1:-1,1:-1] = grad
             return g
-            
+
         def _grady(f, data):
             grad = data[field][1:-1,sl,1:-1] - data[field][1:-1,sr,1:-1]
             grad /= 2.0*data["dy"].flat[0]
             g = np.zeros(data[field].shape, dtype='float64')
             g[1:-1,1:-1,1:-1] = grad
             return g
-            
+
         def _gradz(f, data):
             grad = data[field][1:-1,1:-1,sl] - data[field][1:-1,1:-1,sr]
             grad /= 2.0*data["dz"].flat[0]
             g = np.zeros(data[field].shape, dtype='float64')
             g[1:-1,1:-1,1:-1] = grad
             return g
-        
+
         d_kwargs = kwargs.copy()
         if "display_name" in kwargs: del d_kwargs["display_name"]
-        
+
         for ax in "xyz":
             if "display_name" in kwargs:
                 disp_name = r"%s\_%s" % (kwargs["display_name"], ax)
@@ -102,7 +102,7 @@
             self[name] = DerivedField(name, function=eval('_grad%s' % ax),
                          take_log=False, validators=[ValidateSpatial(1,[field])],
                          display_name = disp_name, **d_kwargs)
-        
+
         def _grad(f, data) :
             a = np.power(data["Grad_%s_x" % field],2)
             b = np.power(data["Grad_%s_y" % field],2)
@@ -113,8 +113,8 @@
         if "display_name" in kwargs:
             disp_name = kwargs["display_name"]
         else:
-            disp_name = r"\Vert\nabla %s\Vert" % (field)   
-        name = "Grad_%s" % field           
+            disp_name = r"\Vert\nabla %s\Vert" % (field)
+        name = "Grad_%s" % field
         self[name] = DerivedField(name, function=_grad, take_log=False,
                                   display_name = disp_name, **d_kwargs)
         mylog.info("Added new fields: Grad_%s_x, Grad_%s_y, Grad_%s_z, Grad_%s" \
@@ -365,30 +365,30 @@
 
         # handle units
         if units is None:
-            self.units = Unit()
+            self.units = ""
         elif isinstance(units, str):
-            self.units = Unit(units)
+            self.units = units
         elif isinstance(units, Unit):
-            self.units = units
+            self.units = str(units)
         else:
-            raise FieldUnitsException("Bad units type. Please provide a Unit object or a string.")
+            raise FieldUnitsError("Cannot handle units '%s' (type %s). Please provide a string or Unit object." % (units, type(units)) )
 
         if projected_units is None:
-            self.projected_units = Unit
+            self.projected_units = ""
         elif isinstance(projected_units, str):
-            self.projected_units = Unit(projected_units)
+            self.projected_units = projected_units
         elif isinstance(projected_units, Unit):
-            self.projected_units = projected_units
+            self.projected_units = str(projected_units)
         else:
-            raise FieldUnitsException("Bad projected_units type. Please provide a Unit object or a string.")
+            raise FieldUnitsError("Cannot handle projected_units '%s' (type %s). Please provide a string or Unit object." % (projected_units, type(projection_units)) )
 
     def _copy_def(self):
         dd = {}
         dd['name'] = self.name
         dd['convert_function'] = self._convert_function
         dd['particle_convert_function'] = self._particle_convert_function
-        dd['units'] = self._units
-        dd['projected_units'] = self._projected_units,
+        dd['units'] = self.units
+        dd['projected_units'] = self.projected_units,
         dd['take_log'] = self.take_log
         dd['validators'] = self.validators.copy()
         dd['particle_type'] = self.particle_type


https://bitbucket.org/yt_analysis/yt/commits/24f9d2716199/
Changeset:   24f9d2716199
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-08 03:07:00
Summary:     static_output: adding set_units and get_unit_from_registry methods.
Affected #:  1 file

diff -r beaf968f07361e5acc362978af6c9d88f40ce6bd -r 24f9d2716199dd8d8c859922e402827ec8e91e44 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -260,8 +260,34 @@
             return self._last_finfo
         raise YTFieldNotFound((ftype, fname), self)
 
+    def set_units(self):
+        """
+        Creates the unit registry for this dataset.
+
+        """
+        self.unit_registry = UnitRegistry()
+
+        if hasattr(self, "cosmological_simulation") \
+           and getattr(self, "cosmological_simulation"):
+            # this dataset is cosmological, so add cosmological units.
+            self.unit_registry.add("h", pf.hubble_constant, dimensionless)
+
+    def get_unit_from_registry(self, unit_str):
+        """
+        Creates a unit object matching the string expression, using this
+        dataset's unit registry.
+
+        Parameters
+        ----------
+        unit_str : str
+            string that we can parse for a sympy Expr.
+
+        """
+        new_unit = Unit(unit_str, registry=self.unit_registry)
+        return new_unit
+
+
 def _reconstruct_pf(*args, **kwargs):
     pfs = ParameterFileStore()
     pf = pfs.get_pf_hash(*args)
     return pf
-


https://bitbucket.org/yt_analysis/yt/commits/a5188b51b303/
Changeset:   a5188b51b303
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-08 03:07:56
Summary:     yt array: in init, adding check if input_units is a Unit object, so we don't spend extra time rebuilding it.
Affected #:  1 file

diff -r 24f9d2716199dd8d8c859922e402827ec8e91e44 -r a5188b51b303371368201bc8d31a2b145f4c45d5 yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -47,6 +47,8 @@
         if input_units is None:
             # Nothing provided. Make dimensionless...
             units = Unit()
+        elif isinstance(input_units, Unit):
+            units = input_units
         else:
             # units kwarg set, but it's not a Unit object.
             # don't handle all the cases here, let the Unit class handle if
@@ -242,7 +244,7 @@
         if isinstance(right_object, YTArray):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(right_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (self.units, right_object.units))
-        else:  
+        else:
             # case of dimensionless self + float
             # the only way this works is with a float so...
             if not self.units.is_dimensionless:
@@ -250,7 +252,7 @@
 
         # `get_data_in` will not apply the conversion if the units are the same
         return YTArray(super(YTArray, self).__sub__(right_object), input_units = right_object.units)
-        
+
 
     def __rsub__(self, left_object):
         """
@@ -262,7 +264,7 @@
         if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(left_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (left_object.units, self.units))
-        else:  
+        else:
             # case of dimensionless self + float
             # the only way this works is with a float so...
             if not self.units.is_dimensionless:
@@ -287,7 +289,7 @@
 
         # `right_object` is not a Quantity object, so try to use it as
         # dimensionless data.
-        return YTArray(super(YTArray, self).__mul__(right_object), 
+        return YTArray(super(YTArray, self).__mul__(right_object),
                        input_units=self.units)
 
     def __rmul__(self, left_object):


https://bitbucket.org/yt_analysis/yt/commits/33e7e23eb0fd/
Changeset:   33e7e23eb0fd
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 22:56:04
Summary:     More YTArray members.
Affected #:  1 file

diff -r 833c25124ea83604cbde713b8600ab8ab3162ee3 -r 33e7e23eb0fda52ca2477f06c76997bb6b97decf yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -296,13 +296,14 @@
         The unit objects handle being multiplied by each other.
 
         """
-        if isinstance(left_object, Quantity):
-            return Quantity(left_object.data * self.data,
-                            left_object.units * self.units)
+        if isinstance(left_object, YTArray):
+            return YTArray(super(YTArray, self).__rmul__(left_object),
+                           input_units=(self.units * left_object.units))
 
         # `left_object` is not a Quantity object, so try to use it as
         # dimensionless data.
-        return Quantity(left_object * self.data, self.units)
+        return YTArray(super(YTArray, self).__rmul__(left_object), 
+                       input_units=self.units)
 
     def __div__(self, right_object):
         """
@@ -310,13 +311,14 @@
         unit objects handle being divided by each other.
 
         """
-        if isinstance(right_object, Quantity):
-            return Quantity(self.data / right_object.data,
-                            self.units / right_object.units)
+        if isinstance(right_object, YTArray):
+            return YTArray(super(YTArray, self).__div__(right_object), 
+                           input_units = (self.units / right_object.units))
 
-        # `right_object` is not a Quantity object, so try to use it as
+        # `right_object` is not a  object, so try to use it as
         # dimensionless data.
-        return Quantity(self.data / right_object, self.units)
+        return YTArray(super(YTArray, self).__div__(right_object),
+                       input_units = self.units)
 
     def __rdiv__(self, left_object):
         """


https://bitbucket.org/yt_analysis/yt/commits/7fae6ac0ffe2/
Changeset:   7fae6ac0ffe2
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-07 23:03:24
Summary:     Merging with head I made for a PR.
Affected #:  1 file

diff -r 33e7e23eb0fda52ca2477f06c76997bb6b97decf -r 7fae6ac0ffe2aafc83192d90341e535e600b4c71 yt/visualization/plot_window.py
--- a/yt/visualization/plot_window.py
+++ b/yt/visualization/plot_window.py
@@ -1136,7 +1136,7 @@
             axes_unit = units
         if field_parameters is None: field_parameters = {}
         slc = pf.h.slice(axis, center[axis],
-            field_parameters = field_parameters)
+            field_parameters = field_parameters, center=center)
         slc.get_data(fields)
         PWViewerMPL.__init__(self, slc, bounds, origin=origin)
         self.set_axes_unit(axes_unit)


https://bitbucket.org/yt_analysis/yt/commits/7e7e5966187a/
Changeset:   7e7e5966187a
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-08 05:57:17
Summary:     Improving unitful mathematical operations on YTArrays.
Affected #:  2 files

diff -r 7fae6ac0ffe2aafc83192d90341e535e600b4c71 -r 7e7e5966187a3c1b9b309546ab33c5c78493d04d yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -29,16 +29,38 @@
 
 import numpy as np
 
-from yt.utilities.units import Unit
+from numpy import add, subtract, multiply, divide, \
+    negative, absolute, sqrt, square, power, reciprocal
+
+from yt.utilities.units import Unit, dimensionless
 
 class UnitOperationError(Exception):
     pass
 
+def sqrt_unit(unit):
+    return unit**0.5
+
+def multiply_units(unit1, unit2):
+    return unit1 * unit2
+
+def preserve_unit(unit1, unit2):
+    return unit1
+
+def power_unit(unit, power):
+    return unit**power
+
 class YTArray(np.ndarray):
     """
 
     """
+    _ufunc_registry = {sqrt: sqrt_unit, multiply: multiply_units,
+                       add: preserve_unit, subtract: preserve_unit,
+                       power: power_unit}
+
     def __new__(cls, input_array, input_units=None):
+        if isinstance(input_array, YTArray):
+            return input_array
+
         # Input array is an already formed ndarray instance
         # We first cast to be our class type
         obj = np.asarray(input_array).view(cls)
@@ -204,15 +226,18 @@
         if isinstance(right_object, YTArray):
             # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(right_object.units):
-                raise UnitOperationError("You cannot add these quantities because their dimensions do not match. `%s + %s` is ill-defined" % (self.units, right_object.units))
+                raise UnitOperationError("You cannot add these quantities because "
+                                         "their dimensions do not match. "
+                                         "`%s + %s` is ill-defined" % (self.units, right_object.units))
         else:
             # case of dimensionless self + float
             # the only way this works is with a float so...
             if not self.units.is_dimensionless:
-                raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (self, right_object))
+                raise Exception("You cannot add a pure number to a "
+                                "dimensional quantity. `%s + %s` is ill-defined." % (self, right_object))
 
         # `get_data_in` will not apply the conversion if the units are the same
-        return YTArray(super(YTArray, self).__add__(right_object), input_units = right_object.units)
+        return YTArray(super(YTArray, self).__add__(right_object))
 
     def __radd__(self, left_object):
         """
@@ -230,7 +255,7 @@
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s + %s` is ill-defined." % (left_object, self))
 
         # `get_data_in` will not apply the conversion if the units are the same
-        return YTArray(super(YTArray, self).__radd__(left_object), input_units = right_object.units)
+        return YTArray(super(YTArray, self).__radd__(left_object))
 
     def __sub__(self, right_object):
         """
@@ -249,7 +274,7 @@
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (self, right_object))
 
         # `get_data_in` will not apply the conversion if the units are the same
-        return YTArray(super(YTArray, self).__sub__(right_object), input_units = right_object.units)
+        return YTArray(super(YTArray, self).__sub__(right_object))
         
 
     def __rsub__(self, left_object):
@@ -269,11 +294,11 @@
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (left_object, self))
 
         # `get_data_in` will not apply the conversion if the units are the same
-        return YTArray(super(YTArray, self).__rsub__(left_object), input_units = left_object.units)
+        return YTArray(super(YTArray, self).__rsub__(left_object))
 
     def __neg__(self):
         """ Negate the data. """
-        return YTArray(super(YTArray, self).__neg__(self), input_units = self.units)
+        return YTArray(super(YTArray, self).__neg__(self))
 
     def __mul__(self, right_object):
         """
@@ -282,13 +307,11 @@
 
         """
         if isinstance(right_object, YTArray):
-            return YTArray(super(YTArray, self).__mul__(right_object),
-                           input_units=(self.units * right_object.units))
+            return YTArray(super(YTArray, self).__mul__(right_object))
 
         # `right_object` is not a Quantity object, so try to use it as
         # dimensionless data.
-        return YTArray(super(YTArray, self).__mul__(right_object), 
-                       input_units=self.units)
+        return YTArray(super(YTArray, self).__mul__(right_object))
 
     def __rmul__(self, left_object):
         """
@@ -297,13 +320,11 @@
 
         """
         if isinstance(left_object, YTArray):
-            return YTArray(super(YTArray, self).__rmul__(left_object),
-                           input_units=(self.units * left_object.units))
+            return YTArray(super(YTArray, self).__rmul__(left_object))
 
         # `left_object` is not a Quantity object, so try to use it as
         # dimensionless data.
-        return YTArray(super(YTArray, self).__rmul__(left_object), 
-                       input_units=self.units)
+        return YTArray(super(YTArray, self).__rmul__(left_object))
 
     def __div__(self, right_object):
         """
@@ -312,13 +333,11 @@
 
         """
         if isinstance(right_object, YTArray):
-            return YTArray(super(YTArray, self).__div__(right_object), 
-                           input_units = (self.units / right_object.units))
+            return YTArray(super(YTArray, self).__div__(right_object))
 
         # `right_object` is not a  object, so try to use it as
         # dimensionless data.
-        return YTArray(super(YTArray, self).__div__(right_object),
-                       input_units = self.units)
+        return YTArray(super(YTArray, self).__div__(right_object))
 
     def __rdiv__(self, left_object):
         """
@@ -326,13 +345,12 @@
         unit objects handle being divided by each other.
 
         """
-        if isinstance(left_object, Quantity):
-            return Quantity(left_object.data / self.data,
-                            left_object.units / self.units)
+        if isinstance(left_object, YTArray):
+            return YTArray(super(YTArray, self).__rdiv__(left_object))
 
         # `left_object` is not a Quantity object, so try to use it as
         # dimensionless data.
-        return Quantity(left_object / self.data, self.units**(-1))
+        return YTArray(super(YTArray, self).__rdiv__(left_object))
 
     def __pow__(self, power):
         """
@@ -344,25 +362,23 @@
             The pow value.
 
         """
-        if isinstance(power, Quantity):
-            if power.units.is_dimensionless:
-                return Quantity(self.data**power.data, self.units**power.data)
-            else:
+        if isinstance(power, YTArray):
+            if not power.units.is_dimensionless:
                 raise Exception("The power argument must be dimensionless. (%s)**(%s) is ill-defined." % (self, power))
 
-        return Quantity(self.data**power, self.units**power)
+        return YTArray(super(YTArray, self).__pow__(power))
 
     def __abs__(self):
         """ Return a Quantity with the abs of the data. """
-        return Quantity(abs(self.data), self.units)
-
+        return YTArray(super(YTArray, self).__abs__())
+                 
     def sqrt(self):
         """
         Return sqrt of this Quantity. This is just a wrapper of Quantity.__pow__
         for numpy.sqrt.
 
         """
-        return self**(1.0/2)
+        return YTArray(super(YTArray, self).sqrt(), input_units = self.units**0.5)
 
     def exp(self):
         """
@@ -373,92 +389,105 @@
         if not self.units.is_dimensionless:
             raise Exception("The argument of an exponential must be dimensionless. exp(%s) is ill-defined." % self)
 
-        try:
-            from numpy import exp
-        except ImportError:
-            raise Exception("This method requires the numpy package. Please install it before calling exp(Quantity)")
-
         return exp(self.data)
 
     ### comparison operators
     # @todo: outsource to a single method with an op argument.
     def __lt__(self, right_object):
         """ Test if this is less than the object on the right. """
-        # Check that the other is a Quantity.
-        if not isinstance(right_object, Quantity):
-            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s < %s is ill-defined." % (self, right_object))
-        # Check that the dimensions are the same.
-        if not self.units.same_dimensions_as(right_object.units):
-            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+        # Check that the other is a YTArray.
+        if isinstance(right_object, YTArray):
+            if not self.units.same_dimensions_as(right_object.units):
+                raise Exception("The less than operator for quantities "
+                                "with units %s and %s is not well defined." 
+                                % (self.units, right_object.units))
 
-        if self.data < right_object.get_data_in(self.units):
-            return True
-        return False
+            return super(YTArray, self).__lt__(right_object.get_data_in(self.units))
+        return super(YTArray, self).__lt__(right_object)
 
     def __le__(self, right_object):
         """ Test if this is less than or equal to the object on the right. """
-        # Check that the other is a Quantity.
-        if not isinstance(right_object, Quantity):
-            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s <= %s is ill-defined." % (self, right_object))
-        # Check that the dimensions are the same.
-        if not self.units.same_dimensions_as(right_object.units):
-            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+        # Check that the other is a YTArray.
+        if isinstance(right_object, Quantity):
+            if not self.units.same_dimensions_as(right_object.units):
+                raise Exception("The less than or equal operator for quantities "
+                                "with units %s and %s is not well defined." 
+                                % (self.units, right_object.units))
 
-        if self.data <= right_object.get_data_in(self.units):
-            return True
-        return False
+            return super(YTArray, self).__le__(right_object.get_data_in(self.units))
+        return super(YTArray, self).__lt__(right_object)
 
     def __eq__(self, right_object):
         """ Test if this is equal to the object on the right. """
-        # Check that the other is a Quantity.
-        if not isinstance(right_object, Quantity):
-            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s == %s is ill-defined." % (self, right_object))
-        # Check that the dimensions are the same.
-        if not self.units.same_dimensions_as(right_object.units):
-            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+        # Check that the other is a YTArray.
+        if isinstance(right_object, YTArray):
+            if not self.units.same_dimensions_as(right_object.units):
+                raise Exception("The equality operator for quantities with units" 
+                                "%s and %s is not well defined." 
+                                % (self.units, right_object.units))
 
-        if self.data == right_object.get_data_in(self.units):
-            return True
-        return False
+            return super(YTArray, self).__eq__(right_object.get_data_in(self.units))
+        return super(YTArray, self).__eq__(right_object)
 
     def __ne__(self, right_object):
         """ Test if this is not equal to the object on the right. """
-        # Check that the other is a Quantity.
-        if not isinstance(right_object, Quantity):
-            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s != %s is ill-defined." % (self, right_object))
-        # Check that the dimensions are the same.
-        if not self.units.same_dimensions_as(right_object.units):
-            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
-
-        if self.data != right_object.get_data_in(self.units):
-            return True
-        return False
+        # Check that the other is a YTArray.
+        if isinstance(right_object, YTArray):
+            if not self.units.same_dimensions_as(right_object.units):
+                raise Exception("The not equal operator for quantities "
+                                "with units %s and %s is not well defined." 
+                                % (self.units, right_object.units))
+            
+            return super(YTArray, self).__ne__(right_object.get_data_in(self.units))
+        return super(YTArray, self).__ne__(right_object)
 
     def __ge__(self, right_object):
         """
         Test if this is greater than or equal to the object on the right.
 
         """
-        # Check that the other is a Quantity.
-        if not isinstance(right_object, Quantity):
-            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s >= %s is ill-defined." % (self, right_object))
-        # Check that the dimensions are the same.
-        if not self.units.same_dimensions_as(right_object.units):
-            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+        # Check that the other is a YTArray.
+        if isinstance(right_object, YTArray):
+            if not self.units.same_dimensions_as(right_object.units):
+                raise Exception("The greater than or equal operator for quantities "
+                                "with units %s and %s is not well defined." 
+                                % (self.units, right_object.units))
 
-        if self.data >= right_object.get_data_in(self.units):
-            return True
-        return False
+            return super(YTArray, self).__ge__(right_object.get_data_in(self.units))
+        return super(YTArray, self).__ge__(right_objects)
 
     def __gt__(self, right_object):
         """ Test if this is greater than the object on the right. """
-        # Check that the other is a Quantity.
-        if not isinstance(right_object, Quantity):
-            raise Exception("You cannot compare a Quantity to a non-Quantity object. %s > %s is ill-defined." % (self, right_object))
-        # Check that the dimensions are the same.
-        if not self.units.same_dimensions_as(right_object.units):
-            raise Exception("You cannot compare quantities of units %s and %s." % (self.units, right_object.units))
+        # Check that the other is a YTArray.
+        if isinstance(right_object, YTArray):
+            if not self.units.same_dimensions_as(right_object.units):
+                raise Exception("The greater than operator for quantities "
+                                "with units %s and %s is not well defined." 
+                                % (self.units, right_object.units))
 
-        if self.data > right_object.get_data_in(self.units):
-            return True
-        return False
+            return super(YTArray, self).__gt__(right_object.get_data_in(self.units))
+        return super(YTArray, self).__gt__(right_object)
+
+    def __array_wrap__(self, out_arr, context=None):
+        if context is None:
+            pass
+        elif len(context[1]) == 1:
+            # unary operators
+            out_arr.units = self._ufunc_registry[context[0]](context[1][0].units)
+        elif len(context[1]) == 2:
+            # binary operators
+            try:
+                unit1 = context[1][0].units
+            except AttributeError:
+                unit1 = dimensionless
+            try:
+                unit2 = context[1][1].units
+            except AttributeError:
+                if context[0] is power:
+                    unit2 = context[1][1]
+                else:
+                    unit2 = dimensionless
+            out_arr.units = self._ufunc_registry[context[0]](unit1, unit2)
+        else:
+            raise RuntimeError("Only unary and binary operators are allowed.")
+        return out_arr

diff -r 7fae6ac0ffe2aafc83192d90341e535e600b4c71 -r 7e7e5966187a3c1b9b309546ab33c5c78493d04d yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -145,12 +145,16 @@
                  + data["z-velocity"]**2.0 )
 add_field("ThermalEnergy", function=_ThermalEnergy,
           units="erg / g")
+add_field("thermal_energy", function=_ThermalEnergy,
+          units="erg / g")
 
 def _KineticEnergy(field, data):
     return 0.5*data["Density"] * ( data["x-velocity"]**2.0
                                    + data["y-velocity"]**2.0
                                    + data["z-velocity"]**2.0 )
-add_field("KineticEnergy",function=_KineticEnergy,
+add_field("KineticEnergy", function=_KineticEnergy,
+          units="erg / cm**3")
+add_field("kinetic_energy", function=_KineticEnergy,
           units="erg / cm**3")
 # This next section is the energy field section
 # Note that we have aliases that manually unconvert themselves.
@@ -170,7 +174,7 @@
 
 def _Gas_Energy(field, data):
     return data["GasEnergy"] / _convertEnergy(data)
-add_field("Gas_Energy", function=_Gas_Energy,
+add_field("gas_energy", function=_Gas_Energy,
           units="erg / g", convert_function=_convertEnergy)
 
 # We set up fields for both TotalEnergy and Total_Energy in the known fields
@@ -182,15 +186,10 @@
           display_name = "$\rm{Total}\/\rm{Energy}$",
           units="erg / g", convert_function=_convertEnergy)
 
-def _Total_Energy(field, data):
-    return data["TotalEnergy"] / _convertEnergy(data)
-add_field("Total_Energy", function=_Total_Energy,
+add_field("TotalEnergy", function=_TotalEnergy,
           display_name = "$\rm{Total}\/\rm{Energy}$",
           units="erg / g", convert_function=_convertEnergy)
-
-def _TotalEnergy(field, data):
-    return data["Total_Energy"] / _convertEnergy(data)
-add_field("TotalEnergy", function=_TotalEnergy,
+add_field("total_energy", function=_TotalEnergy,
           display_name = "$\rm{Total}\/\rm{Energy}$",
           units="erg / g", convert_function=_convertEnergy)
 
@@ -308,9 +307,9 @@
           function=_RadiationAccelerationMagnitude,
           validators=ValidateDataField(["RadAccel1", "RadAccel2", "RadAccel3"]),
           display_name="Radiation\/Acceleration", units="cm / s**2")
-
+          
 # Now we override
-
+          
 def _convertDensity(data):
     return data.convert("Density")
 for field in ["Density"] + [ "%s_Density" % sp for sp in _speciesList ] + \
@@ -318,6 +317,12 @@
     KnownEnzoFields[field]._units = "g / cm**3"
     KnownEnzoFields[field]._convert_function=_convertDensity
 
+def _Density(field, data):
+    return data['Density']
+
+add_field("density", function=_Density, convert_function=_convertDensity
+          validators=[ValidateDataField("Density")], display_name="Density")
+
 add_enzo_field("Dark_Matter_Density", function=NullFunc,
           convert_function=_convertDensity,
           validators=[ValidateDataField("Dark_Matter_Density"),
@@ -336,9 +341,7 @@
           display_name="Dark\/Matter\/Mass", units="Msun")
 
 KnownEnzoFields["Temperature"]._units = "K"
-KnownEnzoFields["Temperature"].units = "K"
 KnownEnzoFields["Dust_Temperature"]._units = "K"
-KnownEnzoFields["Dust_Temperature"].units = "K"
 
 def _convertVelocity(data):
     return data.convert("x-velocity")


https://bitbucket.org/yt_analysis/yt/commits/196fcdf0e7d7/
Changeset:   196fcdf0e7d7
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-08 06:58:28
Summary:     Adding a couple more derived fields.  Adding unary assignment operators.
Affected #:  2 files

diff -r 7e7e5966187a3c1b9b309546ab33c5c78493d04d -r 196fcdf0e7d7c2b432e55a0c54b1d2dc5948e17d yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -49,13 +49,16 @@
 def power_unit(unit, power):
     return unit**power
 
+def divide_units(unit1, unit2):
+    return unit1/unit2
+
 class YTArray(np.ndarray):
     """
 
     """
     _ufunc_registry = {sqrt: sqrt_unit, multiply: multiply_units,
                        add: preserve_unit, subtract: preserve_unit,
-                       power: power_unit}
+                       power: power_unit, divide: divide_units}
 
     def __new__(cls, input_array, input_units=None):
         if isinstance(input_array, YTArray):
@@ -257,6 +260,10 @@
         # `get_data_in` will not apply the conversion if the units are the same
         return YTArray(super(YTArray, self).__radd__(left_object))
 
+    def __iadd__(self, other):
+        self = self + other
+        return self
+
     def __sub__(self, right_object):
         """
         Subtract the object on the right of the `-` from this quantity. Must
@@ -296,6 +303,10 @@
         # `get_data_in` will not apply the conversion if the units are the same
         return YTArray(super(YTArray, self).__rsub__(left_object))
 
+    def __isub__(self, other):
+        self = self - other
+        return self
+
     def __neg__(self):
         """ Negate the data. """
         return YTArray(super(YTArray, self).__neg__(self))
@@ -326,6 +337,10 @@
         # dimensionless data.
         return YTArray(super(YTArray, self).__rmul__(left_object))
 
+    def __imul__(self, other):
+        self = self * other
+        return self
+
     def __div__(self, right_object):
         """
         Divide this quantity by the object on the right of the `/` operator. The
@@ -352,6 +367,10 @@
         # dimensionless data.
         return YTArray(super(YTArray, self).__rdiv__(left_object))
 
+    def __idiv__(self, other):
+        self = self / other
+        return self
+
     def __pow__(self, power):
         """
         Raise this quantity to some power.
@@ -479,14 +498,14 @@
             try:
                 unit1 = context[1][0].units
             except AttributeError:
-                unit1 = dimensionless
+                unit1 = Unit()
             try:
                 unit2 = context[1][1].units
             except AttributeError:
                 if context[0] is power:
                     unit2 = context[1][1]
                 else:
-                    unit2 = dimensionless
+                    unit2 = Unit()
             out_arr.units = self._ufunc_registry[context[0]](unit1, unit2)
         else:
             raise RuntimeError("Only unary and binary operators are allowed.")

diff -r 7e7e5966187a3c1b9b309546ab33c5c78493d04d -r 196fcdf0e7d7c2b432e55a0c54b1d2dc5948e17d yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -173,7 +173,7 @@
           units="erg / g", convert_function=_convertEnergy)
 
 def _Gas_Energy(field, data):
-    return data["GasEnergy"] / _convertEnergy(data)
+    return data["GasEnergy"]
 add_field("gas_energy", function=_Gas_Energy,
           units="erg / g", convert_function=_convertEnergy)
 
@@ -186,10 +186,13 @@
           display_name = "$\rm{Total}\/\rm{Energy}$",
           units="erg / g", convert_function=_convertEnergy)
 
-add_field("TotalEnergy", function=_TotalEnergy,
+def _Total_Energy(field, data):
+    return data['TotalEnergy']
+
+add_field("TotalEnergy", function=_Total_Energy,
           display_name = "$\rm{Total}\/\rm{Energy}$",
           units="erg / g", convert_function=_convertEnergy)
-add_field("total_energy", function=_TotalEnergy,
+add_field("total_energy", function=_Total_Energy,
           display_name = "$\rm{Total}\/\rm{Energy}$",
           units="erg / g", convert_function=_convertEnergy)
 
@@ -318,10 +321,12 @@
     KnownEnzoFields[field]._convert_function=_convertDensity
 
 def _Density(field, data):
-    return data['Density']
+    return data["Density"]
 
-add_field("density", function=_Density, convert_function=_convertDensity
-          validators=[ValidateDataField("Density")], display_name="Density")
+add_field("density", function=_Density, validators=ValidateDataField(["Density"]),
+          units="g / cm**3")
+
+EnzoFieldInfo["density"]._units = "g / cm**3"
 
 add_enzo_field("Dark_Matter_Density", function=NullFunc,
           convert_function=_convertDensity,


https://bitbucket.org/yt_analysis/yt/commits/0f4d638e3920/
Changeset:   0f4d638e3920
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-08 07:03:49
Summary:     Merging to Casey's tip.
Affected #:  6 files

diff -r 196fcdf0e7d7c2b432e55a0c54b1d2dc5948e17d -r 0f4d638e3920629ecdaa120f1cd845d08e38136d yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -1,4 +1,4 @@
-""" 
+"""
 The base classes for selecting and returning data.
 
 Author: Matthew Turk <matthewturk at gmail.com>
@@ -62,7 +62,7 @@
             return np.zeros(shape, dtype='bool')
 
 def restore_field_information_state(func):
-    """ 
+    """
     A decorator that takes a function with the API of (self, grid, field)
     and ensures that after the function is called, the field_parameters will
     be returned to normal.
@@ -76,14 +76,14 @@
     return save_state
 
 class YTFieldData(dict):
-    """ 
+    """
     A Container object for field data, instead of just having it be a dict.
     """
     pass
-        
+
 
 class YTDataContainer(object):
-    """ 
+    """
     Generic YTDataContainer container.  By itself, will attempt to
     generate field, read fields (method defined by derived classes)
     and deal with passing back and forth field parameters.
@@ -101,7 +101,7 @@
                 data_object_registry[cls._type_name] = cls
 
     def __init__(self, pf, field_parameters):
-        """ 
+        """
         Typically this is never called directly, but only due to inheritance.
         It associates a :class:`~yt.data_objects.api.StaticOutput` with the class,
         sets its initial set of fields, and the remainder of the arguments
@@ -199,9 +199,16 @@
                 return self.field_data[key]
             else:
                 self.get_data(key)
+
         f = self._determine_fields(key)[0]
         fi = self.pf._get_field_info(*f)
-        return YTArray(self.field_data[f], input_units=fi._units)
+
+        # @todo: Might find a better way to grab the unit object.
+        # fi.units is the unit expression string. We depend on the registry
+        # hanging off the dataset to define this unit object.
+        unit_obj = self.pf.get_unit_from_registry(fi.units)
+
+        return YTArray(self.field_data[f], input_units=unit_obj)
 
     def __setitem__(self, key, val):
         """
@@ -457,7 +464,7 @@
             deps = [d for d in requested if d not in fields_to_get]
             fields_to_get += deps
         return fields_to_get
-    
+
     def get_data(self, fields=None):
         if self._current_chunk is None:
             self.hierarchy._identify_base_chunk(self)
@@ -555,7 +562,7 @@
 
 class YTSelectionContainer2D(YTSelectionContainer):
     _key_fields = ['px','py','pdx','pdy']
-    """ 
+    """
     Class to represent a set of :class:`YTDataContainer` that's 2-D in nature, and
     thus does not have as many actions as the 3-D data types.
     """
@@ -570,7 +577,7 @@
         super(YTSelectionContainer2D, self).__init__(
             pf, field_parameters)
         self.set_field_parameter("axis", axis)
-        
+
     def _convert_field_name(self, field):
         return field
 
@@ -584,7 +591,7 @@
         (bounds, center, units) = GetWindowParameters(axis, center, width, self.pf)
         if axes_unit is None and units != ('1', '1'):
             axes_unit = units
-        pw = PWViewerMPL(self, bounds, origin=origin, frb_generator=FixedResolutionBuffer, 
+        pw = PWViewerMPL(self, bounds, origin=origin, frb_generator=FixedResolutionBuffer,
                          plot_type=plot_type)
         pw.set_axes_unit(axes_unit)
         return pw
@@ -626,13 +633,13 @@
         >>> frb = proj.to_frb( (100.0, 'kpc'), 1024)
         >>> write_image(np.log10(frb["Density"]), 'density_100kpc.png')
         """
-        
+
         if (self.pf.geometry == "cylindrical" and self.axis == 1) or \
             (self.pf.geometry == "polar" and self.axis == 2):
             from yt.visualization.fixed_resolution import CylindricalFixedResolutionBuffer
             frb = CylindricalFixedResolutionBuffer(self, width, resolution)
             return frb
-        
+
         if center is None:
             center = self.get_field_parameter("center")
             if center is None:
@@ -680,9 +687,9 @@
     def cut_region(self, field_cuts):
         """
         Return an InLineExtractedRegion, where the grid cells are cut on the
-        fly with a set of field_cuts.  It is very useful for applying 
+        fly with a set of field_cuts.  It is very useful for applying
         conditions to the fields in your data object.
-        
+
         Examples
         --------
         To find the total mass of gas above 10^6 K in your volume:
@@ -716,7 +723,7 @@
         useful for calculating, for instance, total isocontour area, or
         visualizing in an external program (such as `MeshLab
         <http://meshlab.sf.net>`_.)
-        
+
         Parameters
         ----------
         field : string
@@ -830,7 +837,7 @@
 
         Additionally, the returned flux is defined as flux *into* the surface,
         not flux *out of* the surface.
-        
+
         Parameters
         ----------
         field : string
@@ -886,7 +893,7 @@
             ff = np.ones(vals.shape, dtype="float64")
         else:
             ff = grid.get_vertex_centered_data(fluxing_field)
-        xv, yv, zv = [grid.get_vertex_centered_data(f) for f in 
+        xv, yv, zv = [grid.get_vertex_centered_data(f) for f in
                      [field_x, field_y, field_z]]
         return march_cubes_grid_flux(value, vals, xv, yv, zv,
                     ff, mask, grid.LeftEdge, grid.dds)

diff -r 196fcdf0e7d7c2b432e55a0c54b1d2dc5948e17d -r 0f4d638e3920629ecdaa120f1cd845d08e38136d yt/data_objects/field_info_container.py
--- a/yt/data_objects/field_info_container.py
+++ b/yt/data_objects/field_info_container.py
@@ -59,7 +59,7 @@
                 return function
             return create_function
         self[name] = DerivedField(name, function, **kwargs)
-        
+
     def add_grad(self, field, **kwargs):
         """
         Creates the partial derivative of a given field. This function will
@@ -68,31 +68,31 @@
         """
         sl = slice(2,None,None)
         sr = slice(None,-2,None)
-        
+
         def _gradx(f, data):
             grad = data[field][sl,1:-1,1:-1] - data[field][sr,1:-1,1:-1]
             grad /= 2.0*data["dx"].flat[0]
             g = np.zeros(data[field].shape, dtype='float64')
             g[1:-1,1:-1,1:-1] = grad
             return g
-            
+
         def _grady(f, data):
             grad = data[field][1:-1,sl,1:-1] - data[field][1:-1,sr,1:-1]
             grad /= 2.0*data["dy"].flat[0]
             g = np.zeros(data[field].shape, dtype='float64')
             g[1:-1,1:-1,1:-1] = grad
             return g
-            
+
         def _gradz(f, data):
             grad = data[field][1:-1,1:-1,sl] - data[field][1:-1,1:-1,sr]
             grad /= 2.0*data["dz"].flat[0]
             g = np.zeros(data[field].shape, dtype='float64')
             g[1:-1,1:-1,1:-1] = grad
             return g
-        
+
         d_kwargs = kwargs.copy()
         if "display_name" in kwargs: del d_kwargs["display_name"]
-        
+
         for ax in "xyz":
             if "display_name" in kwargs:
                 disp_name = r"%s\_%s" % (kwargs["display_name"], ax)
@@ -102,7 +102,7 @@
             self[name] = DerivedField(name, function=eval('_grad%s' % ax),
                          take_log=False, validators=[ValidateSpatial(1,[field])],
                          display_name = disp_name, **d_kwargs)
-        
+
         def _grad(f, data) :
             a = np.power(data["Grad_%s_x" % field],2)
             b = np.power(data["Grad_%s_y" % field],2)
@@ -113,8 +113,8 @@
         if "display_name" in kwargs:
             disp_name = kwargs["display_name"]
         else:
-            disp_name = r"\Vert\nabla %s\Vert" % (field)   
-        name = "Grad_%s" % field           
+            disp_name = r"\Vert\nabla %s\Vert" % (field)
+        name = "Grad_%s" % field
         self[name] = DerivedField(name, function=_grad, take_log=False,
                                   display_name = disp_name, **d_kwargs)
         mylog.info("Added new fields: Grad_%s_x, Grad_%s_y, Grad_%s_z, Grad_%s" \
@@ -365,30 +365,30 @@
 
         # handle units
         if units is None:
-            self.units = Unit()
+            self.units = ""
         elif isinstance(units, str):
-            self.units = Unit(units)
+            self.units = units
         elif isinstance(units, Unit):
-            self.units = units
+            self.units = str(units)
         else:
-            raise FieldUnitsException("Bad units type. Please provide a Unit object or a string.")
+            raise FieldUnitsError("Cannot handle units '%s' (type %s). Please provide a string or Unit object." % (units, type(units)) )
 
         if projected_units is None:
-            self.projected_units = Unit
+            self.projected_units = ""
         elif isinstance(projected_units, str):
-            self.projected_units = Unit(projected_units)
+            self.projected_units = projected_units
         elif isinstance(projected_units, Unit):
-            self.projected_units = projected_units
+            self.projected_units = str(projected_units)
         else:
-            raise FieldUnitsException("Bad projected_units type. Please provide a Unit object or a string.")
+            raise FieldUnitsError("Cannot handle projected_units '%s' (type %s). Please provide a string or Unit object." % (projected_units, type(projection_units)) )
 
     def _copy_def(self):
         dd = {}
         dd['name'] = self.name
         dd['convert_function'] = self._convert_function
         dd['particle_convert_function'] = self._particle_convert_function
-        dd['units'] = self._units
-        dd['projected_units'] = self._projected_units,
+        dd['units'] = self.units
+        dd['projected_units'] = self.projected_units,
         dd['take_log'] = self.take_log
         dd['validators'] = self.validators.copy()
         dd['particle_type'] = self.particle_type

diff -r 196fcdf0e7d7c2b432e55a0c54b1d2dc5948e17d -r 0f4d638e3920629ecdaa120f1cd845d08e38136d yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -260,8 +260,34 @@
             return self._last_finfo
         raise YTFieldNotFound((ftype, fname), self)
 
+    def set_units(self):
+        """
+        Creates the unit registry for this dataset.
+
+        """
+        self.unit_registry = UnitRegistry()
+
+        if hasattr(self, "cosmological_simulation") \
+           and getattr(self, "cosmological_simulation"):
+            # this dataset is cosmological, so add cosmological units.
+            self.unit_registry.add("h", pf.hubble_constant, dimensionless)
+
+    def get_unit_from_registry(self, unit_str):
+        """
+        Creates a unit object matching the string expression, using this
+        dataset's unit registry.
+
+        Parameters
+        ----------
+        unit_str : str
+            string that we can parse for a sympy Expr.
+
+        """
+        new_unit = Unit(unit_str, registry=self.unit_registry)
+        return new_unit
+
+
 def _reconstruct_pf(*args, **kwargs):
     pfs = ParameterFileStore()
     pf = pfs.get_pf_hash(*args)
     return pf
-

diff -r 196fcdf0e7d7c2b432e55a0c54b1d2dc5948e17d -r 0f4d638e3920629ecdaa120f1cd845d08e38136d yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -72,6 +72,8 @@
         if input_units is None:
             # Nothing provided. Make dimensionless...
             units = Unit()
+        elif isinstance(input_units, Unit):
+            units = input_units
         else:
             # units kwarg set, but it's not a Unit object.
             # don't handle all the cases here, let the Unit class handle if
@@ -274,15 +276,20 @@
         if isinstance(right_object, YTArray):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(right_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (self.units, right_object.units))
-        else:  
+        else:
             # case of dimensionless self + float
             # the only way this works is with a float so...
             if not self.units.is_dimensionless:
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (self, right_object))
 
         # `get_data_in` will not apply the conversion if the units are the same
+<<<<<<< local
         return YTArray(super(YTArray, self).__sub__(right_object))
         
+=======
+        return YTArray(super(YTArray, self).__sub__(right_object), input_units = right_object.units)
+
+>>>>>>> other
 
     def __rsub__(self, left_object):
         """
@@ -294,7 +301,7 @@
         if isinstance(left_object, Quantity):  # make sure it's a quantity before we check units attribute
             if not self.units.same_dimensions_as(left_object.units):
                 raise Exception("You cannot add these quantities because their dimensions do not match. `%s - %s` is ill-defined" % (left_object.units, self.units))
-        else:  
+        else:
             # case of dimensionless self + float
             # the only way this works is with a float so...
             if not self.units.is_dimensionless:
@@ -322,7 +329,12 @@
 
         # `right_object` is not a Quantity object, so try to use it as
         # dimensionless data.
+<<<<<<< local
         return YTArray(super(YTArray, self).__mul__(right_object))
+=======
+        return YTArray(super(YTArray, self).__mul__(right_object),
+                       input_units=self.units)
+>>>>>>> other
 
     def __rmul__(self, left_object):
         """

diff -r 196fcdf0e7d7c2b432e55a0c54b1d2dc5948e17d -r 0f4d638e3920629ecdaa120f1cd845d08e38136d yt/utilities/tests/test_units.py
--- a/yt/utilities/tests/test_units.py
+++ b/yt/utilities/tests/test_units.py
@@ -31,11 +31,11 @@
 # base dimensions
 from yt.utilities.units import mass, length, time, temperature
 # functions
-from yt.utilities.units import get_conversion_factor, make_symbols_positive
+from yt.utilities.units import get_conversion_factor
 # classes
 from yt.utilities.units import Unit, UnitParseError
 # objects
-from yt.utilities.units import unit_symbols_dict, unit_prefixes
+from yt.utilities.units import default_unit_symbol_lut, unit_prefixes
 
 
 def test_no_conflicting_symbols():
@@ -43,10 +43,10 @@
     Check unit symbol definitions for conflicts.
 
     """
-    full_set = set(unit_symbols_dict.keys())
+    full_set = set(default_unit_symbol_lut.keys())
 
     # go through all possible prefix combos
-    for symbol in unit_symbols_dict.keys():
+    for symbol in default_unit_symbol_lut.keys():
         for prefix in unit_prefixes.keys():
             new_symbol = "%s%s" % (prefix, symbol)
 

diff -r 196fcdf0e7d7c2b432e55a0c54b1d2dc5948e17d -r 0f4d638e3920629ecdaa120f1cd845d08e38136d yt/utilities/units.py
--- a/yt/utilities/units.py
+++ b/yt/utilities/units.py
@@ -29,6 +29,9 @@
 from sympy import nsimplify, posify, sympify
 from sympy.parsing.sympy_parser import parse_expr
 
+# Define a sympy one object.
+sympy_one = sympify(1)
+
 #
 # Exceptions
 #
@@ -84,7 +87,7 @@
 # conversion factor to cgs and dimensionality.
 #
 
-default_unit_symbol_LUT = {
+default_unit_symbol_lut = {
     # base
     "g":  (1.0, mass),
     #"cm": (1.0, length, r"\rm{cm}"),  # duplicate with meter below...
@@ -155,13 +158,13 @@
 }
 
 
-class UnitSymbolRegistry:
+class UnitRegistry:
 
     def __init__(self, add_default_symbols=True):
         self.lut = {}
 
         if add_default_symbols:
-            self.lut.update(default_unit_symbol_LUT)
+            self.lut.update(default_unit_symbol_lut)
 
     def add(symbol, cgs_value, dimensions):
         """
@@ -172,7 +175,7 @@
         if not isinstance(cgs_value, float):
             raise UnitParseError("cgs_value must be a float, got a %s." % type(cgs_value))
 
-        validate_dimensions(dimensions)
+        _validate_dimensions(dimensions)
 
         # Add to lut
         self.lut.update( {symbol: (cgs_value, dimensions)} )
@@ -188,46 +191,46 @@
         del self.lut[symbol]
 
 
-default_symbol_registry = UnitSymbolRegistry()
-
-
+default_unit_registry = UnitRegistry()
 
 class Unit(Expr):
     """
-    A symbolic unit, using sympy functionality. We only add "dimensions" so that
-    sympy understands relations between different units.
+    A symbolic unit, using sympy functionality. We only add "dimensions" so
+    that sympy understands relations between different units.
 
     """
 
+    # Set some assumptions for sympy.
     is_positive = True    # make sqrt(m**2) --> m
     is_commutative = True
     is_number = False
 
-    __slots__ = ["expr", "cgs_value", "dimensions", "is_atomic"]
+    # Extra attributes
+    __slots__ = ["expr", "is_atomic", "cgs_value", "dimensions", "registry"]
 
     def __new__(cls, unit_expr=sympify(1), cgs_value=None, dimensions=None,
-                **assumptions):
+                registry=None, **assumptions):
         """
-        Create a new unit. May be an atomic unit (like a gram) or a combination
-        of other units (like g / cm**3).
+        Create a new unit. May be an atomic unit (like a gram) or combinations
+        of atomic units (like g / cm**3).
 
         Parameters
         ----------
-        unit_expr : string or sympy.core.expr.Expr
-            The unit symbol expression.
+        unit_expr : Unit object, sympy.core.expr.Expr object, or str
+            The symbolic unit expression.
         cgs_value : float
-            This unit's value in cgs.
+            The unit's value in cgs.
         dimensions : sympy.core.expr.Expr
-            An expression representing the dimensionality of this unit. This
-            should be a product (sympy.core.mul.Mul object) of mass, length,
-            time, and temperature objects to various powers.
+            A sympy expression representing the dimensionality of this unit.
+            It must contain only mass, length, time, and temperature symbols.
+        registry : UnitRegistry object
+            The unit registry we use to interpret unit symbols.
 
         """
         # Simplest case. If user passes a Unit object, just use the expr.
         if isinstance(unit_expr, Unit):
             # grab the unit object's sympy expression.
             unit_expr = unit_expr.expr
-
         # If we have a string, have sympy parse it into an Expr.
         elif isinstance(unit_expr, str):
             if not unit_expr:
@@ -235,15 +238,19 @@
                 # if unit_expr is an empty string, parse_expr fails hard...
                 unit_expr = "1"
             unit_expr = parse_expr(unit_expr)
-
         # Make sure we have an Expr at this point.
         if not isinstance(unit_expr, Expr):
             raise UnitParseError("Unit representation must be a string or sympy Expr. %s has type %s." % (unit_expr, type(unit_expr)))
+
+        if registry is None:
+            # Caller did not set the registry, so use the default.
+            registry = default_unit_registry
+
         # done with argument checking...
 
         # sympify, make positive symbols, and nsimplify the expr
         unit_expr = sympify(unit_expr)
-        unit_expr = make_symbols_positive(unit_expr)
+        unit_expr = _make_symbols_positive(unit_expr)
         unit_expr = nsimplify(unit_expr)
 
         # see if the unit is atomic.
@@ -251,227 +258,143 @@
         if isinstance(unit_expr, Symbol):
             is_atomic = True
 
-        # Did the user supply cgs_value and dimensions?
-        if cgs_value and not dimensions or dimensions and not cgs_value:
-            raise Exception("If you provide cgs_vale or dimensions, you must provide both. cgs_value is %s, dimensions is %s." % (cgs_value, dimensions))
+        #
+        # check cgs_value and dimensions
+        #
 
-        if cgs_value and dimensions:
+        if cgs_value is not None and dimensions is not None:
             # check that cgs_value is a float or can be converted to one
             try:
                 cgs_value = float(cgs_value)
             except ValueError:
-                raise UnitParseError("Please provide a float for the cgs_value kwarg. I got '%s'." % cgs_value)
+                raise UnitParseError("Could not use cgs_value as a float. cgs_value is '%s' (type %s)." % (cgs_value, type(cgs_value)) )
+
             # check that dimensions is valid
-            dimensions = validate_dimensions(dimensions)
-            # save the values
-            this_cgs_value, this_dimensions = cgs_value, dimensions
+            _validate_dimensions( sympify(dimensions) )
+        else:
+            # lookup the unit symbols
+            cgs_value, dimensions = _get_unit_data_from_expr(unit_expr,
+                                                             registry.lut)
 
-        else:  # lookup the unit symbols
-            this_cgs_value, this_dimensions = \
-                get_unit_data_from_expr(unit_expr)
+        # Sympy trick to get dimensions powers as Rationals
+        dimensions = nsimplify(dimensions)
 
-        # Trick to get dimensions powers as Rationals
-        this_dimensions = nsimplify(this_dimensions)
-
-        # create obj with superclass construct
+        # Create obj with superclass construct.
         obj = Expr.__new__(cls, **assumptions)
 
-        # attach attributes to obj
+        # Attach attributes to obj.
         obj.expr = unit_expr
         obj.is_atomic = is_atomic
-        obj.cgs_value = this_cgs_value
-        obj.dimensions = this_dimensions
+        obj.cgs_value = cgs_value
+        obj.dimensions = dimensions
+        obj.registry = registry
 
-        # return `obj` so __init__ can handle it.
+        # Return `obj` so __init__ can handle it.
         return obj
 
-    ### some sympy conventions I guess
+    ### Some sympy conventions
     def __getnewargs__(self):
-        return (self.expr, self.is_atomic, self.cgs_value, self.dimensions)
+        return (self.expr, self.is_atomic, self.cgs_value, self.dimensions,
+                self.registry)
 
     def __hash__(self):
         return super(Unit, self).__hash__()
 
     def _hashable_content(self):
-        return (self.expr, self.is_atomic, self.cgs_value, self.dimensions)
+        return (self.expr, self.is_atomic, self.cgs_value, self.dimensions,
+                self.registry)
     ### end sympy conventions
 
     def __repr__(self):
-        if self.expr == 1:
+        if self.expr == sympy_one:
             return "(dimensionless)"
-        return str(self.expr)
+        # @todo: don't use dunder method?
+        return self.expr.__repr__()
 
     def __str__(self):
-        if self.expr == 1:
+        if self.expr == sympy_one:
             return "(dimensionless)"
-        return str(self.expr)
+        # @todo: don't use dunder method?
+        return self.expr.__str__()
 
     # for sympy.printing
     def _sympystr(self, *args):
         return str(self.expr)
 
-    ### override sympy operations
+    #
+    # Start unit operations
+    #
+
     def __mul__(self, u):
         """ Multiply Unit with u (Unit object). """
         if not isinstance(u, Unit):
-            raise UnitOperationError("Tried to multiply Unit object with '%s'. This behavior is undefined." % u)
+            raise UnitOperationError("Tried to multiply a Unit object with '%s' (type %s). This behavior is undefined." % (u, type(u)) )
 
-        return Unit(self.expr * u.expr, self.cgs_value * u.cgs_value,
-                    self.dimensions * u.dimensions)
+        return Unit(self.expr * u.expr,
+                    cgs_value=(self.cgs_value * u.cgs_value),
+                    dimensions=(self.dimensions * u.dimensions),
+                    registry=self.registry)
 
     def __div__(self, u):
         """ Divide Unit by u (Unit object). """
         if not isinstance(u, Unit):
-            raise UnitOperationError("Tried to divide Unit object by '%s'. This behavior is undefined." % u)
+            raise UnitOperationError("Tried to divide a Unit object by '%s' (type %s). This behavior is undefined." % (u, type(u)) )
 
-        return Unit(self.expr / u.expr, self.cgs_value / u.cgs_value,
-                    self.dimensions / u.dimensions)
+        return Unit(self.expr / u.expr,
+                    cgs_value=(self.cgs_value / u.cgs_value),
+                    dimensions=(self.dimensions / u.dimensions),
+                    registry=self.registry)
 
     def __pow__(self, p):
         """ Take Unit to power p (float). """
         try:
             p = sympify(p)
         except ValueError:
-            raise UnitOperationError("Tried to take Unit object to the power '%s'. I could not cast this to a float." % p)
+            raise UnitOperationError("Tried to take a Unit object to the power '%s' (type %s). Failed to cast it to a float." % (p, type(p)) )
 
-        return Unit(self.expr**p, self.cgs_value**p, self.dimensions**p)
-
-    ### Comparison operators
-    def same_dimensions_as(self, other_unit):
-        """ Test if dimensions are the same. """
-        return (self.dimensions / other_unit.dimensions) == 1
+        return Unit(self.expr**p, cgs_value=(self.cgs_value**p),
+                    dimensions=(self.dimensions**p), registry=self.registry)
 
     def __eq__(self, u):
         """ Test unit equality. """
         if not isinstance(u, Unit):
-            raise UnitOperationError("Tried to test equality between Unit object and '%s'. This behavior is undefined." % u)
+            raise UnitOperationError("Tried to test equality between a Unit object and '%s' (type %s). This behavior is undefined." % (u, type(u)) )
 
         return (self.cgs_value == u.cgs_value and self.dimensions == u.dimensions)
 
+    #
+    # End unit operations
+    #
+
+    def same_dimensions_as(self, other_unit):
+        """ Test if dimensions are the same. """
+        return (self.dimensions / other_unit.dimensions) == sympy_one
+
     @property
     def is_dimensionless(self):
-        return self.dimensions == 1
+        return self.dimensions == sympy_one
 
+    # @todo: might be a simpler/smarter sympy way to do this...
     def get_cgs_equivalent(self):
-        """ Create and return dimensionally-equivalent cgs units. """
+        """
+        Create and return dimensionally-equivalent cgs units.
+
+        """
         cgs_units_string = "g**(%s) * cm**(%s) * s**(%s) * K**(%s)" % \
             (self.dimensions.expand().as_coeff_exponent(mass)[1],
              self.dimensions.expand().as_coeff_exponent(length)[1],
              self.dimensions.expand().as_coeff_exponent(time)[1],
              self.dimensions.expand().as_coeff_exponent(temperature)[1])
-        return Unit(cgs_units_string, 1, self.dimensions)
+
+        return Unit(cgs_units_string, cgs_value=1.0,
+                    dimensions=self.dimensions, registry=self.registry)
 
     def get_conversion_factor(self, other_units):
         return get_conversion_factor(self, other_units)
 
-
-def make_symbols_positive(expr):
-    """
-    Grabs all symbols from expr, makes new positive symbols with the same names,
-    and substitutes them back into the expression.
-
-    """
-    expr_symbols = expr.atoms(Symbol)  # grab all symbols
-
-    # Replace one at a time
-    for s in expr_symbols:
-        # replace this symbol with a positive version
-        expr = expr.subs(s, Symbol(s.name, positive=True))
-
-    return expr
-
-
-# @todo: simpler method that doesn't use recursion would be better...
-# We could check if dimensions.atoms are all numbers or symbols, but we should
-# check the functions also...
-def validate_dimensions(d):
-    """
-    Make sure that `d` is a valid dimension expression. It must consist of only
-    the base dimension symbols, to powers, multiplied together. If valid, return
-    the simplified expression. If not, raise an Exception.
-
-    """
-    # in the case of a Number of Symbol, we can just return
-    if isinstance(d, Number):
-        return d
-    elif isinstance(d, Symbol):
-        if d in base_dimensions:
-            return d
-        else:
-            raise UnitParseError("dimensionality expression contains an unknown symbol '%s'." % d)
-
-    # validate args of a Pow or Mul separately
-    elif isinstance(d, Pow):
-        return validate_dimensions(d.args[0])**validate_dimensions(d.args[1])
-
-    elif isinstance(d, Mul):
-        total_mul = 1
-        for arg in d.args:
-            total_mul *= validate_dimensions(arg)
-        return total_mul
-
-    # should never get here
-    raise UnitParseError("Bad dimensionality expression '%s'." % d)
-
-
-def get_unit_data_from_expr(unit_expr):
-    """
-    Gets total cgs_value and dimensions from a valid unit expression.
-
-    """
-    # The simplest case first
-    if isinstance(unit_expr, Unit):
-        return (unit_expr.cgs_value, unit_expr.dimensions)
-
-    # Now for the sympy possibilities
-    if isinstance(unit_expr, Symbol):
-        return lookup_unit_symbol(str(unit_expr))
-
-    if isinstance(unit_expr, Number):
-        return (1, 1)
-
-    if isinstance(unit_expr, Pow):
-        unit_data = get_unit_data_from_expr(unit_expr.args[0])
-        power = unit_expr.args[1]
-        return (unit_data[0]**power, unit_data[1]**power)
-
-    if isinstance(unit_expr, Mul):
-        cgs_value = 1
-        dimensions = 1
-        for expr in unit_expr.args:
-            unit_data = get_unit_data_from_expr(expr)
-            cgs_value *= unit_data[0]
-            dimensions *= unit_data[1]
-
-        return (cgs_value, dimensions)
-
-    raise UnitParseError("Cannot parse for unit data from '%s'. Please supply an expression of only Unit, Symbol, Pow, and Mul objects." % str(unit_expr))
-
-
-def lookup_unit_symbol(symbol_str):
-    """ Searches for the unit data typle corresponding to the given symbol. """
-
-    if symbol_str in default_unit_symbol_LUT:
-        # lookup successful, return the tuple directly
-        return default_unit_symbol_LUT[symbol_str]
-
-    # could still be a known symbol with a prefix
-    possible_prefix = symbol_str[0]
-    if possible_prefix in unit_prefixes:
-        # the first character could be a prefix, check the rest of the symbol
-        symbol_wo_prefix = symbol_str[1:]
-
-        if symbol_wo_prefix in default_unit_symbol_LUT:
-            # lookup successful, it's a symbol with a prefix
-            unit_data = default_unit_symbol_LUT[symbol_wo_prefix]
-            prefix_value = unit_prefixes[possible_prefix]
-
-            # don't forget to account for the prefix value!
-            return (unit_data[0] * prefix_value, unit_data[1])
-
-    # no dice
-    raise UnitParseError("Could not find unit symbol '%s'. Please supply the dimensions and cgs value when creating this object." % symbol_str)
-
+#
+# Unit manipulation functions
+#
 
 def get_conversion_factor(old_units, new_units):
     """
@@ -492,10 +415,10 @@
         `old_units / new_units`
 
     """
-    # Make units out of strings if we need to.
-    if isinstance(old_units, str):
+    # if args are not Unit objects, construct them
+    if not isinstance(old_units, Unit):
         old_units = Unit(old_units)
-    if isinstance(new_units, str):
+    if not isinstance(new_units, Unit):
         new_units = Unit(new_units)
 
     if not old_units.same_dimensions_as(new_units):
@@ -521,3 +444,132 @@
 
     """
     return values * get_conversion_factor(old_units, new_units)
+
+
+#
+# Helper functions
+#
+
+def _make_symbols_positive(expr):
+    """
+    Grabs all symbols from expr, makes new positive symbols with the same names,
+    and substitutes them back into the expression.
+
+    """
+    expr_symbols = expr.atoms(Symbol)  # grab all symbols
+
+    # Replace one at a time
+    for s in expr_symbols:
+        # replace this symbol with a positive version
+        expr = expr.subs(s, Symbol(s.name, positive=True))
+
+    return expr
+
+# @todo: simpler method that doesn't use recursion would be better...
+# We could check if dimensions.atoms are all numbers or symbols, but we should
+# check the functions also...
+def _validate_dimensions(d):
+    """
+    Make sure that `d` is a valid dimension expression. It must consist of only
+    the base dimension symbols, to powers, multiplied together. If valid, return
+    the simplified expression. If not, raise an Exception.
+
+    """
+    # in the case of a Number of Symbol, we can just return
+    if isinstance(d, Number):
+        return d
+    elif isinstance(d, Symbol):
+        if d in base_dimensions:
+            return d
+        else:
+            raise UnitParseError("dimensionality expression contains an unknown symbol '%s'." % d)
+
+    # validate args of a Pow or Mul separately
+    elif isinstance(d, Pow):
+        return _validate_dimensions(d.args[0])**_validate_dimensions(d.args[1])
+
+    elif isinstance(d, Mul):
+        total_mul = 1
+        for arg in d.args:
+            total_mul *= _validate_dimensions(arg)
+        return total_mul
+
+    # should never get here
+    raise UnitParseError("Bad dimensionality expression '%s'." % d)
+
+
+def _get_unit_data_from_expr(unit_expr, unit_symbol_lut):
+    """
+    Grabs the total cgs_value and dimensions from a valid unit expression.
+
+    Parameters
+    ----------
+    unit_expr: Unit object, or sympy Expr object
+        The expression containing unit symbols.
+    unit_symbol_lut: dict
+        Provides the unit data for each valid unit symbol.
+
+    """
+    # The simplest case first
+    if isinstance(unit_expr, Unit):
+        return (unit_expr.cgs_value, unit_expr.dimensions)
+
+    # Now for the sympy possibilities
+    if isinstance(unit_expr, Symbol):
+        return _lookup_unit_symbol(str(unit_expr), unit_symbol_lut)
+
+    if isinstance(unit_expr, Number):
+        # not sure if this should be (1, 1)...
+        return (float(unit_expr), sympy_one)
+
+    if isinstance(unit_expr, Pow):
+        unit_data = _get_unit_data_from_expr(unit_expr.args[0], unit_symbol_lut)
+        power = unit_expr.args[1]
+        return (unit_data[0]**power, unit_data[1]**power)
+
+    if isinstance(unit_expr, Mul):
+        cgs_value = 1.0
+        dimensions = 1
+        for expr in unit_expr.args:
+            unit_data = _get_unit_data_from_expr(expr, unit_symbol_lut)
+            cgs_value *= unit_data[0]
+            dimensions *= unit_data[1]
+
+        return (cgs_value, dimensions)
+
+    raise UnitParseError("Cannot parse for unit data from '%s'. Please supply an expression of only Unit, Symbol, Pow, and Mul objects." % str(unit_expr))
+
+
+def _lookup_unit_symbol(symbol_str, unit_symbol_lut):
+    """
+    Searches for the unit data typle corresponding to the given symbol.
+
+    Parameters
+    ----------
+    symbol_str : str
+        The unit symbol to look up.
+    unit_symbol_lut : dict
+        Dictionary with symbols as keys and unit data tuples as values.
+
+    """
+
+    if symbol_str in unit_symbol_lut:
+        # lookup successful, return the tuple directly
+        return default_unit_symbol_lut[symbol_str]
+
+    # could still be a known symbol with a prefix
+    possible_prefix = symbol_str[0]
+    if possible_prefix in unit_prefixes:
+        # the first character could be a prefix, check the rest of the symbol
+        symbol_wo_prefix = symbol_str[1:]
+
+        if symbol_wo_prefix in unit_symbol_lut:
+            # lookup successful, it's a symbol with a prefix
+            unit_data = unit_symbol_lut[symbol_wo_prefix]
+            prefix_value = unit_prefixes[possible_prefix]
+
+            # don't forget to account for the prefix value!
+            return (unit_data[0] * prefix_value, unit_data[1])
+
+    # no dice
+    raise UnitParseError("Could not find unit symbol '%s' in the provided symbols. Please define this unit symbol." % symbol_str)


https://bitbucket.org/yt_analysis/yt/commits/6fe401b43072/
Changeset:   6fe401b43072
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-08 07:04:26
Summary:     Removing merge conflicts.
Affected #:  1 file

diff -r 0f4d638e3920629ecdaa120f1cd845d08e38136d -r 6fe401b43072f77c79a7055b8a5b83b20a0fb9b2 yt/data_objects/yt_array.py
--- a/yt/data_objects/yt_array.py
+++ b/yt/data_objects/yt_array.py
@@ -283,14 +283,8 @@
                 raise Exception("You cannot add a pure number to a dimensional quantity. `%s - %s` is ill-defined." % (self, right_object))
 
         # `get_data_in` will not apply the conversion if the units are the same
-<<<<<<< local
         return YTArray(super(YTArray, self).__sub__(right_object))
         
-=======
-        return YTArray(super(YTArray, self).__sub__(right_object), input_units = right_object.units)
-
->>>>>>> other
-
     def __rsub__(self, left_object):
         """
         Subtract this quantity from the object on the left of the `-` operator.
@@ -329,12 +323,7 @@
 
         # `right_object` is not a Quantity object, so try to use it as
         # dimensionless data.
-<<<<<<< local
         return YTArray(super(YTArray, self).__mul__(right_object))
-=======
-        return YTArray(super(YTArray, self).__mul__(right_object),
-                       input_units=self.units)
->>>>>>> other
 
     def __rmul__(self, left_object):
         """


https://bitbucket.org/yt_analysis/yt/commits/b6c52437735b/
Changeset:   b6c52437735b
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-08 07:18:48
Summary:     Fixing the way units get set.  Casey may need to look at this.
Affected #:  3 files

diff -r 6fe401b43072f77c79a7055b8a5b83b20a0fb9b2 -r b6c52437735bf970cd678f6f03ca5fd06328c9d6 yt/data_objects/data_containers.py
--- a/yt/data_objects/data_containers.py
+++ b/yt/data_objects/data_containers.py
@@ -206,7 +206,7 @@
         # @todo: Might find a better way to grab the unit object.
         # fi.units is the unit expression string. We depend on the registry
         # hanging off the dataset to define this unit object.
-        unit_obj = self.pf.get_unit_from_registry(fi.units)
+        unit_obj = self.pf.get_unit_from_registry(fi._units)
 
         return YTArray(self.field_data[f], input_units=unit_obj)
 

diff -r 6fe401b43072f77c79a7055b8a5b83b20a0fb9b2 -r b6c52437735bf970cd678f6f03ca5fd06328c9d6 yt/data_objects/field_info_container.py
--- a/yt/data_objects/field_info_container.py
+++ b/yt/data_objects/field_info_container.py
@@ -373,6 +373,8 @@
         else:
             raise FieldUnitsError("Cannot handle units '%s' (type %s). Please provide a string or Unit object." % (units, type(units)) )
 
+        self._units = self.units
+
         if projected_units is None:
             self.projected_units = ""
         elif isinstance(projected_units, str):

diff -r 6fe401b43072f77c79a7055b8a5b83b20a0fb9b2 -r b6c52437735bf970cd678f6f03ca5fd06328c9d6 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -35,6 +35,7 @@
     ParameterFileStore, \
     NoParameterShelf, \
     output_type_registry
+from yt.utilities.units import Unit, UnitRegistry
 from yt.data_objects.field_info_container import \
     FieldInfoContainer, NullFunc
 from yt.utilities.minimal_representation import \
@@ -103,7 +104,7 @@
 
         self._parse_parameter_file()
         self._setup_coordinate_handler()
-        self._set_units()
+        self.set_units()
         self._set_derived_attrs()
 
         # Because we need an instantiated class to check the pf's existence in
@@ -272,6 +273,8 @@
             # this dataset is cosmological, so add cosmological units.
             self.unit_registry.add("h", pf.hubble_constant, dimensionless)
 
+        self._set_units()
+
     def get_unit_from_registry(self, unit_str):
         """
         Creates a unit object matching the string expression, using this


https://bitbucket.org/yt_analysis/yt/commits/a7badd69e922/
Changeset:   a7badd69e922
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-08 15:56:31
Summary:     Merging from the other yt-3.0 branch, including the mainline dev and unit test fixes.
Affected #:  143 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/ee8f03882294/
Changeset:   ee8f03882294
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-08 08:11:41
Summary:     Merging from yt-3.0 tip.
Affected #:  143 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/6723d4128536/
Changeset:   6723d4128536
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-08 08:14:17
Summary:     Fixing a bad merge.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/82eabdd25d01/
Changeset:   82eabdd25d01
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-08 08:19:24
Summary:     Fixing yet more merge conflicts.  Updating .hgignore.
Affected #:  3 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/00691f0191af/
Changeset:   00691f0191af
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-08 18:58:16
Summary:     Merged
Affected #:  5 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/283e89c7847f/
Changeset:   283e89c7847f
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-08 18:52:11
Summary:     units: dumb dumb (me) forgot to put self as first arg in UnitRegistry methods.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/5e43cde85a7e/
Changeset:   5e43cde85a7e
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-08 18:53:01
Summary:     static output: fixed adding hubble constant to cosmological dataset unit registries.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/afdb5e5267b2/
Changeset:   afdb5e5267b2
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-08 18:58:32
Summary:     Merge again
Affected #:  2 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/84ba97a0e880/
Changeset:   84ba97a0e880
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-08 19:40:41
Summary:     Converting all usages of "Ones" to "ones"
Affected #:  4 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/494c3dcc457c/
Changeset:   494c3dcc457c
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-08 19:41:21
Summary:     Converting "Zeros" to "zeros"
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/34b84abc166d/
Changeset:   34b84abc166d
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-08 19:57:58
Summary:     Fixing up the __getitem__ call in data_containers and also switched testing.py
to use "density" by default.  Changed some "CellMass" to "cell_mass".
Affected #:  4 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/b64a4a66d516/
Changeset:   b64a4a66d516
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-08 23:07:33
Summary:     yt array: Fixing many operations, including in place ops. Changed conversion method names to match our proposed API.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/e4a174622cf3/
Changeset:   e4a174622cf3
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-08 23:08:04
Summary:     Merging.
Affected #:  7 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/30954a6aa339/
Changeset:   30954a6aa339
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-03-08 23:22:10
Summary:     Fixing a bug in __getitem__
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/1fda928c8b06/
Changeset:   1fda928c8b06
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-09 00:03:31
Summary:     units: adding default symbols for msun and amu.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/b37c12c939ab/
Changeset:   b37c12c939ab
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-09 00:04:12
Summary:     Adding the quantities util module which defines the Quantity class.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/6b612f838099/
Changeset:   6b612f838099
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-09 00:18:28
Summary:     static output: Create derived field units attribute once we create the pf's unit registry.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/a927dc034357/
Changeset:   a927dc034357
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-09 00:22:01
Summary:     static output: fix order of calls inside __init__. Make sure field_info exists before set_units
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/fce1e6c9a016/
Changeset:   fce1e6c9a016
Branch:      yt-3.0
User:        caseywstark
Date:        2013-03-09 00:25:16
Summary:     static output: Something is still clobbering the derived field 'units' attribute. We can't find where yet, so we are temporarily renaming 'units'. WE'LL DO IT LIVE.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/6a79550ad564/
Changeset:   6a79550ad564
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-08 22:43:45
Summary:     Changing the data_objects tests to use "density" instead of "Density"
Affected #:  11 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/de9386a180c8/
Changeset:   de9386a180c8
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-10 06:40:05
Summary:     Merging from Casey's latest
Affected #:  5 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/a3d38ffe7329/
Changeset:   a3d38ffe7329
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-10 07:15:00
Summary:     Fixed up a number of failing tests by adding ufuncs.  These need review.
Affected #:  2 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/54c9a9edca8c/
Changeset:   54c9a9edca8c
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-10 07:42:09
Summary:     Adding special case for reduction ufuncs that reduce over the entire YTArray.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/e90789b565b8/
Changeset:   e90789b565b8
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-10 07:51:23
Summary:     Adding zeros field
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/9d37cfc8f07c/
Changeset:   9d37cfc8f07c
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-03-10 08:03:27
Summary:     Adding more YTArray ufuncs.  I believe this needs discussion.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/e28abd85ba00/
Changeset:   e28abd85ba00
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-09-18 22:49:58
Summary:     Removing unused functions and unsupported data objects.
Affected #:  2 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/7bcd13735301/
Changeset:   7bcd13735301
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-09-18 23:12:41
Summary:     Refactoring the AMRGridPatch object.

This removes a number of routines that are largely not needed anymore and which
served to create confusion.  I could find no uses of them in the code.

I've also switched one of the camera.py functions (which itself is currently
returning NotImplementedError) to use .blocks instead of a child_mask on a
grid.
Affected #:  3 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/2df9d41ae070/
Changeset:   2df9d41ae070
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-05-03 01:09:45
Summary:     Ensure the CGS conversion factor is always a float, not a sympy symbol.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/f445b4c13119/
Changeset:   f445b4c13119
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-05-03 19:58:34
Summary:     removing projected units.
Affected #:  11 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/1167b022927d/
Changeset:   1167b022927d
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-05-03 22:56:30
Summary:     Adding the ability to define fields in 'code' units.

Initially this has only been applied to cartesian fields.  This has the nice
property that it forces us to be explicit in field definitions.  If we get
something in code units from the frontend we must explicitly convert in the
field definition.  This could probably be streamlined further with a decorator
that in-place converts to CGS.
Affected #:  7 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/73c2db9fb6d4/
Changeset:   73c2db9fb6d4
Branch:      yt-3.0
User:        caseywstark
Date:        2013-05-06 20:30:56
Summary:     config.py: Adding the 'ignore_invalid_operation_errors' option. Pep8'ing
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/5be265ff0b77/
Changeset:   5be265ff0b77
Branch:      yt-3.0
User:        caseywstark
Date:        2013-05-06 20:34:17
Summary:     static_output: Add the note about comoving length units in the registry.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/a07e9a3f1a57/
Changeset:   a07e9a3f1a57
Branch:      yt-3.0
User:        caseywstark
Date:        2013-05-06 20:37:08
Summary:     framework: hotfix for python path/site issue.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/db40857f5acd/
Changeset:   db40857f5acd
Branch:      yt-3.0
User:        caseywstark
Date:        2013-05-06 20:41:42
Summary:     mods: propagating ytcfg_defaults name change.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/2185dbeb7472/
Changeset:   2185dbeb7472
Branch:      yt-3.0
User:        caseywstark
Date:        2013-05-06 20:45:34
Summary:     units and ytarray: rename unit operation error to match the ytep, remove the default symbol LUT in _lookup_unit_symbol. Remove old imports in ytarray that we no longer use.
Affected #:  2 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/1fb1d7bc1b0e/
Changeset:   1fb1d7bc1b0e
Branch:      yt-3.0
User:        caseywstark
Date:        2013-05-06 20:48:58
Summary:     Adding a start to the ytarray operation test cases. Very alpha.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/2834afc2d0ff/
Changeset:   2834afc2d0ff
Branch:      yt-3.0
User:        caseywstark
Date:        2013-05-06 20:50:41
Summary:     Merge
Affected #:  27 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/c1fecce502e2/
Changeset:   c1fecce502e2
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-06-26 02:55:34
Summary:     Merging the units work into the current BB yt-3.0 tip.

This loads IsolatedGalaxy but has not been tested.
Affected #:  58 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/3ab31e4abab0/
Changeset:   3ab31e4abab0
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-06-26 02:56:46
Summary:     Made a small mistake resolving the merge in .hgignore.  This fixes it.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/7e5f79cb0e55/
Changeset:   7e5f79cb0e55
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-06-28 17:44:57
Summary:     Working on getting tests to pass.  Some tests still fail.
Affected #:  3 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/4f4813284acb/
Changeset:   4f4813284acb
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-06-28 18:04:58
Summary:     Adding the ability to uncomment and debug a broken field.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/fa0f66af54db/
Changeset:   fa0f66af54db
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-06-28 21:00:49
Summary:     More bugfixes for fields.
Affected #:  3 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/486e74518190/
Changeset:   486e74518190
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-06-29 07:39:32
Summary:     Converting universal fields to fully use the new field name style.  Fixing some more bugs.
Affected #:  7 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/6ff016c18d51/
Changeset:   6ff016c18d51
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-06-29 16:31:34
Summary:     Fixing a number of typos.

Never commit and push late at night.
Affected #:  2 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/81ae7353b2f2/
Changeset:   81ae7353b2f2
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-06-29 17:21:54
Summary:     Intermediate checkin so matt can take a look.
Affected #:  2 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/05507cad7b22/
Changeset:   05507cad7b22
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-06-29 18:09:41
Summary:     This fixes a lot of field detection for units.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/113b347323b8/
Changeset:   113b347323b8
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-01 01:26:30
Summary:     Starting modifications of stream convenience functions.
Affected #:  6 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/95bb5a3083bc/
Changeset:   95bb5a3083bc
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-01 02:33:21
Summary:     Intermediate commit.  This is still a skeleton.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/b36c7e6bf61a/
Changeset:   b36c7e6bf61a
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-02 23:09:09
Summary:     Intermediate commit.  Simplifying the unit exceptions.  Finishig up the stream frontend conversion.
Affected #:  7 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/bc7b359ab5f9/
Changeset:   bc7b359ab5f9
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-03 07:32:57
Summary:     Intermediate commit.  Stripping _convert_function as it is now unecessary.
Need to fix unit issues in universal_fields.
Affected #:  3 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/09f3e79c99cf/
Changeset:   09f3e79c99cf
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-04 08:56:11
Summary:     More fixes for units.  This is getting almost sort of functional :)
Affected #:  9 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/3e38bb4ca79f/
Changeset:   3e38bb4ca79f
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-04 09:32:18
Summary:     Fixing some bugs in ufunc handling. Making the ufunc registry easier to edit.
Affected #:  3 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/4450c2f41fdc/
Changeset:   4450c2f41fdc
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-04 09:40:34
Summary:     Make ufunc error messages a bit more informative.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/08bda4273ad5/
Changeset:   08bda4273ad5
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-06 05:55:23
Summary:     Reorganizing a bit.  Still doesn't completely work but I think we're getting clsoe now.
Affected #:  3 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/e9b0031793f2/
Changeset:   e9b0031793f2
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-06 07:39:25
Summary:     It imports now!  Still some funkiness in how the stream frontend handles units.
Affected #:  7 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/8d6043c757b1/
Changeset:   8d6043c757b1
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-09 03:37:57
Summary:     More fixes for units and the stream frontend.  Now able to query fields supplied to load_uniform_grid().
Affected #:  5 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/ef136ec5fdf3/
Changeset:   ef136ec5fdf3
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-10 02:54:20
Summary:     Rationalizing the way code units are set.
Affected #:  6 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/9574aa989f0d/
Changeset:   9574aa989f0d
Branch:      yt-3.0
User:        ngoldbaum
Date:        2013-07-19 15:48:00
Summary:     More testing fixes.
Affected #:  11 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/933e42a8a931/
Changeset:   933e42a8a931
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-09-19 23:12:53
Summary:     Adding caching for units objects and units operations.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/84101fd5652a/
Changeset:   84101fd5652a
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-09-20 20:20:06
Summary:     YTStaticOutput -> Dataset
Affected #:  11 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/cca5070f344e/
Changeset:   cca5070f344e
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-09-20 20:30:04
Summary:     StaticOutput -> Dataset
Affected #:  70 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/ee4c925c9815/
Changeset:   ee4c925c9815
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-09-20 20:34:50
Summary:     TimeSeriesData -> Dataset
Affected #:  10 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/5876498abc37/
Changeset:   5876498abc37
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-09-20 21:07:47
Summary:     Merging.
Affected #:  22 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/3c967eec3f16/
Changeset:   3c967eec3f16
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-09-20 21:08:39
Summary:     Fixing MOAB
Affected #:  4 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/d2d98baf19fa/
Changeset:   d2d98baf19fa
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-09-23 14:27:44
Summary:     Renaming GeometryHandler to Index.
Affected #:  28 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/a61cd7d39fa8/
Changeset:   a61cd7d39fa8
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 15:22:34
Summary:     Merging from mainline.
Affected #:  63 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/b5e25dc7418b/
Changeset:   b5e25dc7418b
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 15:24:42
Summary:     A few more fixes.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/fc368433d8d9/
Changeset:   fc368433d8d9
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 17:25:26
Summary:     Changing numpy na => np.
Affected #:  2 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/3801b5baabd0/
Changeset:   3801b5baabd0
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 17:28:13
Summary:     Changing yt.mods to match YTEP-0019 better.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/cec33a265f49/
Changeset:   cec33a265f49
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 17:41:12
Summary:     Move the frontend container code to frontends.api.
Affected #:  2 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/7b238bfc0323/
Changeset:   7b238bfc0323
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 17:43:22
Summary:     Oops, messed up where various imports go.
Affected #:  2 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/aab950d78522/
Changeset:   aab950d78522
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 18:13:37
Summary:     Moving imports into yt/__init__.py and leaving startup_tasks.py only in
yt.mods.
Affected #:  6 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/3d330ca679a2/
Changeset:   3d330ca679a2
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 19:02:47
Summary:     Renaming data_style to dataset_type in preparation for Index reworking.
Affected #:  45 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/4ea53042ff44/
Changeset:   4ea53042ff44
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 19:05:38
Summary:     Nathan points out that run_nose belongs elsewhere.  This makes things easier, too!
Affected #:  3 files
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/6687ce34e01a/
Changeset:   6687ce34e01a
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 19:17:11
Summary:     Removing StoredBinnedProfile3D.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/f9f767039c62/
Changeset:   f9f767039c62
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 19:17:35
Summary:     Fixing VR tests.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/709a744eaa22/
Changeset:   709a744eaa22
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 19:17:52
Summary:     Slimming down the Index object, as it will be merged into Dataset.
Affected #:  1 file
Diff not available.

https://bitbucket.org/yt_analysis/yt/commits/e484f58a962a/
Changeset:   e484f58a962a
Branch:      yt-3.0
User:        MatthewTurk
Date:        2013-10-03 19:20:07
Summary:     Moving static_output to dataset.
Affected #:  28 files
Diff not available.

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