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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Sep 14 11:34:46 PDT 2015


21 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/b283cadca216/
Changeset:   b283cadca216
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 21:33:00+00:00
Summary:     Removing unused domain context code
Affected #:  2 files

diff -r ad96b8c8f330750d9457710381e859419bb89a5b -r b283cadca2169dbad94288a663f201d912334a66 yt/fields/astro_simulations.py
--- a/yt/fields/astro_simulations.py
+++ /dev/null
@@ -1,59 +0,0 @@
-"""
-Fields we expect to find in astrophysical simulations.
-
-
-
-"""
-
-#-----------------------------------------------------------------------------
-# Copyright (c) 2013, yt Development Team.
-#
-# Distributed under the terms of the Modified BSD License.
-#
-# The full license is in the file COPYING.txt, distributed with this software.
-#-----------------------------------------------------------------------------
-
-import numpy as np
-from .domain_context import DomainContext
-
-# Here's how this all works:
-#
-#   1. We have a mapping here that defines fields we might expect to find in an
-#      astrophysical simulation to units (not necessarily definitive) that we
-#      may want to use them in.
-#   2. Simulations and frontends will register aliases from fields (which can
-#      utilize units) to the fields enumerated here.
-#   3. This plugin can call additional plugins on the registry.
-
-class AstroSimulation(DomainContext):
-
-    # This is an immutable of immutables.  Note that we do not specify the
-    # fluid type here, although in most cases we expect it to be "gas".
-    _known_fluid_fields = (
-        ("density",                            "g/cm**3"           ),
-        ("number_density",                     "1/cm**3"           ),
-        ("pressure",                           "dyne / cm**2"      ),
-        ("thermal_energy",                     "erg / g"           ),
-        ("temperature",                        "K"                 ),
-        ("velocity_x",                         "cm / s"            ),
-        ("velocity_y",                         "cm / s"            ),
-        ("velocity_z",                         "cm / s"            ),
-        ("magnetic_field_x",                   "gauss"             ),
-        ("magnetic_field_y",                   "gauss"             ),
-        ("magnetic_field_z",                   "gauss"             ),
-        ("radiation_acceleration_x",           "cm / s**2"         ),
-        ("radiation_acceleration_y",           "cm / s**2"         ),
-        ("radiation_acceleration_z",           "cm / s**2"         ),
-    )
-
-    # This set of fields can be applied to any particle type.
-    _known_particle_fields = (
-        ("particle_position_x",                "cm"                ),
-        ("particle_position_y",                "cm"                ),
-        ("particle_position_z",                "cm"                ),
-        ("particle_velocity_x",                "cm / s"            ),
-        ("particle_velocity_y",                "cm / s"            ),
-        ("particle_velocity_z",                "cm / s"            ),
-        ("particle_mass",                      "g"                 ),
-        ("particle_index",                     ""                  ),
-    )

diff -r ad96b8c8f330750d9457710381e859419bb89a5b -r b283cadca2169dbad94288a663f201d912334a66 yt/fields/domain_context.py
--- a/yt/fields/domain_context.py
+++ /dev/null
@@ -1,32 +0,0 @@
-"""
-Domain context base class
-
-Currently we largely apply this to the fields that get loaded.  Presumably
-different analysis operations could be the subject of this type of examination
-as well.
-"""
-
-#-----------------------------------------------------------------------------
-# Copyright (c) 2013, yt Development Team.
-#
-# Distributed under the terms of the Modified BSD License.
-#
-# The full license is in the file COPYING.txt, distributed with this software.
-#-----------------------------------------------------------------------------
-
-import numpy as np
-
-domain_context_registry = {}
-
-class DomainContext(object):
-    class __metaclass__(type):
-        def __init__(cls, name, b, d):
-            type.__init__(cls, name, b, d)
-            domain_context_registry[name] = cls
-
-    _known_fluid_fields     =  ()
-    _known_particle_fields  =  ()
-
-    def __init__(self, ds):
-        self.ds = ds
-


https://bitbucket.org/yt_analysis/yt/commits/73268cd764cd/
Changeset:   73268cd764cd
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 21:35:18+00:00
Summary:     Linting angular_momentum fields
Affected #:  1 file

diff -r b283cadca2169dbad94288a663f201d912334a66 -r 73268cd764cdfe6579b03175419d48e45c9c93e4 yt/fields/angular_momentum.py
--- a/yt/fields/angular_momentum.py
+++ b/yt/fields/angular_momentum.py
@@ -15,12 +15,7 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import types
 import numpy as np
-import inspect
-import copy
-
-from yt.units.yt_array import YTArray
 
 from .derived_field import \
     ValidateParameter
@@ -29,8 +24,8 @@
     register_field_plugin
 
 from .vector_operations import \
-     create_magnitude_field
-    
+    create_magnitude_field
+
 from yt.utilities.lib.geometry_utils import \
     obtain_rvec, obtain_rv_vec
 
@@ -78,7 +73,7 @@
 
     create_magnitude_field(registry, "specific_angular_momentum",
                            "cm**2 / s", ftype=ftype)
-    
+
     def _angular_momentum_x(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_x"]
@@ -105,4 +100,3 @@
 
     create_magnitude_field(registry, "angular_momentum",
                            "g * cm**2 / s", ftype=ftype)
-                           


https://bitbucket.org/yt_analysis/yt/commits/9cc5149047a9/
Changeset:   9cc5149047a9
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 21:35:27+00:00
Summary:     Linting astro_fields
Affected #:  1 file

diff -r 73268cd764cdfe6579b03175419d48e45c9c93e4 -r 9cc5149047a9f4a03390e8b4591b684af5c474e7 yt/fields/astro_fields.py
--- a/yt/fields/astro_fields.py
+++ b/yt/fields/astro_fields.py
@@ -16,8 +16,7 @@
 import numpy as np
 
 from .derived_field import \
-    ValidateParameter, \
-    ValidateSpatial
+    ValidateParameter
 from .field_exceptions import \
     NeedsParameter
 from .field_plugin_registry import \
@@ -30,7 +29,7 @@
     clight, \
     kboltz, \
     G
-    
+
 @register_field_plugin
 def setup_astro_fields(registry, ftype = "gas", slice_info = None):
     # slice_info would be the left, the right, and the factor.
@@ -45,7 +44,7 @@
         div_fac = 2.0
     else:
         sl_left, sl_right, div_fac = slice_info
-    
+
     def _dynamical_time(field, data):
         """
         sqrt(3 pi / (16 G rho))
@@ -71,7 +70,7 @@
 
     def _chandra_emissivity(field, data):
         logT0 = np.log10(data[ftype, "temperature"].to_ndarray().astype(np.float64)) - 7
-        # we get rid of the units here since this is a fit and not an 
+        # we get rid of the units here since this is a fit and not an
         # analytical expression
         return data.ds.arr(data[ftype, "number_density"].to_ndarray().astype(np.float64)**2
                            * (10**(- 0.0103 * logT0**8 + 0.0417 * logT0**7
@@ -91,7 +90,7 @@
     registry.add_field((ftype, "chandra_emissivity"),
                        function=_chandra_emissivity,
                        units="") # add correct units here
-    
+
     def _xray_emissivity(field, data):
         # old scaling coefficient was 2.168e60
         return data.ds.arr(data[ftype, "density"].to_ndarray().astype(np.float64)**2
@@ -110,7 +109,7 @@
     registry.add_field((ftype,"mazzotta_weighting"),
                        function=_mazzotta_weighting,
                        units="keV**-0.25*cm**-6")
-    
+
     def _sz_kinetic(field, data):
         scale = 0.88 * sigma_thompson / mh / clight
         vel_axis = data.get_field_parameter("axis")


https://bitbucket.org/yt_analysis/yt/commits/bf9f30a987af/
Changeset:   bf9f30a987af
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 21:35:38+00:00
Summary:     Linting cosmology_fields
Affected #:  1 file

diff -r 9cc5149047a9f4a03390e8b4591b684af5c474e7 -r bf9f30a987aff1cb0ecb89c72a29d613757304ad yt/fields/cosmology_fields.py
--- a/yt/fields/cosmology_fields.py
+++ b/yt/fields/cosmology_fields.py
@@ -14,21 +14,17 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
+from .derived_field import \
+    ValidateParameter
+from .field_exceptions import \
+    NeedsConfiguration, \
+    NeedsParameter
+from .field_plugin_registry import \
+    register_field_plugin
 
-from .derived_field import \
-     ValidateParameter
-from .field_exceptions import \
-     NeedsConfiguration, \
-     NeedsParameter
-from .field_plugin_registry import \
-     register_field_plugin
+from yt.utilities.physical_constants import \
+    speed_of_light_cgs
 
-from yt.utilities.cosmology import \
-     Cosmology
-from yt.utilities.physical_constants import \
-     speed_of_light_cgs
-    
 @register_field_plugin
 def setup_cosmology_fields(registry, ftype = "gas", slice_info = None):
     # slice_info would be the left, the right, and the factor.
@@ -49,7 +45,7 @@
           data[ftype, "dark_matter_density"]
 
     registry.add_field((ftype, "matter_density"),
-                       function=_matter_density, 
+                       function=_matter_density,
                        units="g/cm**3")
 
     def _matter_mass(field, data):
@@ -67,7 +63,7 @@
         co = data.ds.cosmology
         return data[ftype, "matter_density"] / \
           co.critical_density(data.ds.current_redshift)
-    
+
     registry.add_field((ftype, "overdensity"),
                        function=_overdensity,
                        units="")
@@ -116,7 +112,7 @@
                        function=_virial_radius_fraction,
                        validators=[ValidateParameter("virial_radius")],
                        units="")
-    
+
     # Weak lensing convergence.
     # Eqn 4 of Metzler, White, & Loken (2001, ApJ, 547, 560).
     # This needs to be checked for accuracy.
@@ -127,7 +123,7 @@
         co = data.ds.cosmology
         observer_redshift = data.get_field_parameter('observer_redshift')
         source_redshift = data.get_field_parameter('source_redshift')
-        
+
         # observer to lens
         dl = co.angular_diameter_distance(observer_redshift, data.ds.current_redshift)
         # observer to source
@@ -135,11 +131,11 @@
         # lens to source
         dls = co.angular_diameter_distance(data.ds.current_redshift, source_redshift)
 
-        # removed the factor of 1 / a to account for the fact that we are projecting 
+        # removed the factor of 1 / a to account for the fact that we are projecting
         # with a proper distance.
         return (1.5 * (co.hubble_constant / speed_of_light_cgs)**2 * (dl * dls / ds) * \
           data[ftype, "matter_overdensity"]).in_units("1/cm")
-       
+
     registry.add_field((ftype, "weak_lensing_convergence"),
                        function=_weak_lensing_convergence,
                        units="1/cm",


https://bitbucket.org/yt_analysis/yt/commits/73e9eab3dbfc/
Changeset:   73e9eab3dbfc
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 21:36:15+00:00
Summary:     Linting field_exceptions.py
Affected #:  1 file

diff -r bf9f30a987aff1cb0ecb89c72a29d613757304ad -r 73e9eab3dbfce7d7e9590255b4c0d1a37a7bad3c yt/fields/field_exceptions.py
--- a/yt/fields/field_exceptions.py
+++ b/yt/fields/field_exceptions.py
@@ -13,7 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
 
 class ValidationException(Exception):
     pass


https://bitbucket.org/yt_analysis/yt/commits/42ab952d6aef/
Changeset:   42ab952d6aef
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 21:40:30+00:00
Summary:     Linting field_functions
Affected #:  1 file

diff -r 73e9eab3dbfce7d7e9590255b4c0d1a37a7bad3c -r 42ab952d6aefd38df939c79e912dd7a94cce5950 yt/fields/field_functions.py
--- a/yt/fields/field_functions.py
+++ b/yt/fields/field_functions.py
@@ -32,7 +32,7 @@
         # it from a cm**2 array.
         np.subtract(data["%s%s" % (field_prefix, ax)].in_units("cm"),
                     center[i], r)
-        if data.ds.periodicity[i] == True:
+        if data.ds.periodicity[i] is True:
             np.abs(r, r)
             np.subtract(r, DW[i], rdw)
             np.abs(rdw, rdw)


https://bitbucket.org/yt_analysis/yt/commits/364056d2aa43/
Changeset:   364056d2aa43
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 21:41:55+00:00
Summary:     Linting derived_field
Affected #:  1 file

diff -r 42ab952d6aefd38df939c79e912dd7a94cce5950 -r 364056d2aa43debbd8d6ee370991f33d31dcad23 yt/fields/derived_field.py
--- a/yt/fields/derived_field.py
+++ b/yt/fields/derived_field.py
@@ -16,10 +16,7 @@
 
 from yt.funcs import \
     ensure_list
-from yt.units.yt_array import \
-    YTArray
 from .field_exceptions import \
-    ValidationException, \
     NeedsGridType, \
     NeedsOriginalGrid, \
     NeedsDataField, \
@@ -30,15 +27,9 @@
     FieldDetector
 from yt.units.unit_object import \
     Unit
+from yt.utilities.exceptions import \
+    YTFieldNotFound
 
-def derived_field(**kwargs):
-    def inner_decorator(function):
-        if 'name' not in kwargs:
-            kwargs['name'] = function.__name__
-        kwargs['function'] = function
-        add_field(**kwargs)
-        return function
-    return inner_decorator
 
 def TranslationFunc(field_name):
     def _TranslationFunc(field, data):
@@ -48,7 +39,7 @@
 
 def NullFunc(field, data):
     raise YTFieldNotFound(field.name)
- 
+
 class DerivedField(object):
     """
     This is the base class used to describe a cell-by-cell derived field.
@@ -178,7 +169,7 @@
 
     def __call__(self, data):
         """ Return the value of the field in a given *data* object. """
-        ii = self.check_available(data)
+        self.check_available(data)
         original_fields = data.keys() # Copy
         if self._function is NullFunc:
             raise RuntimeError(


https://bitbucket.org/yt_analysis/yt/commits/f79b21697a37/
Changeset:   f79b21697a37
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 21:43:21+00:00
Summary:     Linting field_plugin_registry
Affected #:  1 file

diff -r 364056d2aa43debbd8d6ee370991f33d31dcad23 -r f79b21697a373dbb3e0013364e0337f0b316216f yt/fields/field_plugin_registry.py
--- a/yt/fields/field_plugin_registry.py
+++ b/yt/fields/field_plugin_registry.py
@@ -13,8 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
-
 field_plugins = {}
 
 def register_field_plugin(func):


https://bitbucket.org/yt_analysis/yt/commits/8cff6c189b16/
Changeset:   8cff6c189b16
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 21:45:08+00:00
Summary:     Linting fluid_fields.py
Affected #:  1 file

diff -r f79b21697a373dbb3e0013364e0337f0b316216f -r 8cff6c189b16e95c56a263d93a50dd9fa88b824c yt/fields/fluid_fields.py
--- a/yt/fields/fluid_fields.py
+++ b/yt/fields/fluid_fields.py
@@ -15,20 +15,16 @@
 
 import numpy as np
 
-from yt.funcs import \
-    just_one
-
 from .derived_field import \
-    ValidateParameter, \
     ValidateSpatial
 
 from .field_plugin_registry import \
     register_field_plugin
 
 from .vector_operations import \
-     create_averaged_field, \
-     create_magnitude_field, \
-     create_vector_fields
+    create_averaged_field, \
+    create_magnitude_field, \
+    create_vector_fields
 
 from yt.utilities.physical_constants import \
     mh, \
@@ -37,20 +33,6 @@
 from yt.utilities.physical_ratios import \
     metallicity_sun
 
-from yt.units.yt_array import \
-    YTArray
-
-from yt.utilities.math_utils import \
-    get_sph_r_component, \
-    get_sph_theta_component, \
-    get_sph_phi_component, \
-    get_cyl_r_component, \
-    get_cyl_z_component, \
-    get_cyl_theta_component, \
-    get_cyl_r, get_cyl_theta, \
-    get_cyl_z, get_sph_r, \
-    get_sph_theta, get_sph_phi, \
-    periodic_dist, euclidean_dist
 
 @register_field_plugin
 def setup_fluid_fields(registry, ftype = "gas", slice_info = None):


https://bitbucket.org/yt_analysis/yt/commits/97e6ed8ca6a0/
Changeset:   97e6ed8ca6a0
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 22:01:59+00:00
Summary:     Linting field_detector

This removes a branch of code that includes the use an undefined variable. Since
this code works, I've concluded that the code branch is dead and removed it. This
may need to be backed out if it subtly changes behavior.
Affected #:  1 file

diff -r 8cff6c189b16e95c56a263d93a50dd9fa88b824c -r 97e6ed8ca6a0973a72ed7c6859052de5e6d09a77 yt/fields/field_detector.py
--- a/yt/fields/field_detector.py
+++ b/yt/fields/field_detector.py
@@ -15,16 +15,9 @@
 
 import numpy as np
 from collections import defaultdict
-from yt.units.unit_object import Unit
 from yt.units.yt_array import YTArray
 from .field_exceptions import \
-    ValidationException, \
-    NeedsGridType, \
-    NeedsOriginalGrid, \
-    NeedsDataField, \
-    NeedsProperty, \
-    NeedsParameter, \
-    FieldUnitsError
+    NeedsGridType
 
 class FieldDetector(defaultdict):
     Level = 1
@@ -87,27 +80,18 @@
         return arr.reshape(self.ActiveDimensions, order="C")
 
     def __missing__(self, item):
-        if hasattr(self.ds, "field_info"):
-            if not isinstance(item, tuple):
-                field = ("unknown", item)
-                finfo = self.ds._get_field_info(*field)
-                #mylog.debug("Guessing field %s is %s", item, finfo.name)
-            else:
-                field = item
-            finfo = self.ds._get_field_info(*field)
-            # For those cases where we are guessing the field type, we will
-            # need to re-update -- otherwise, our item will always not have the
-            # field type.  This can lead to, for instance, "unknown" particle
-            # types not getting correctly identified.
-            # Note that the *only* way this works is if we also fix our field
-            # dependencies during checking.  Bug #627 talks about this.
-            item = self.ds._last_freq
+        if not isinstance(item, tuple):
+            field = ("unknown", item)
         else:
-            FI = getattr(self.ds, "field_info", FieldInfo)
-            if item in FI:
-                finfo = FI[item]
-            else:
-                finfo = None
+            field = item
+        finfo = self.ds._get_field_info(*field)
+        # For those cases where we are guessing the field type, we will
+        # need to re-update -- otherwise, our item will always not have the
+        # field type.  This can lead to, for instance, "unknown" particle
+        # types not getting correctly identified.
+        # Note that the *only* way this works is if we also fix our field
+        # dependencies during checking.  Bug #627 talks about this.
+        item = self.ds._last_freq
         if finfo is not None and finfo._function.__name__ != 'NullFunc':
             try:
                 vv = finfo(self)
@@ -171,10 +155,7 @@
 
     def _read_data(self, field_name):
         self.requested.append(field_name)
-        if hasattr(self.ds, "field_info"):
-            finfo = self.ds._get_field_info(*field_name)
-        else:
-            finfo = FieldInfo[field_name]
+        finfo = self.ds._get_field_info(*field_name)
         if finfo.particle_type:
             self.requested.append(field_name)
             return np.ones(self.NumberOfParticles)


https://bitbucket.org/yt_analysis/yt/commits/ce03c95c2e85/
Changeset:   ce03c95c2e85
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 22:03:34+00:00
Summary:     Linting interpolated_fields
Affected #:  1 file

diff -r 97e6ed8ca6a0973a72ed7c6859052de5e6d09a77 -r ce03c95c2e8586f3b9883bb6c4309776a440362e yt/fields/interpolated_fields.py
--- a/yt/fields/interpolated_fields.py
+++ b/yt/fields/interpolated_fields.py
@@ -13,8 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
-
 from yt.fields.local_fields import add_field
 
 from yt.utilities.linear_interpolators import \


https://bitbucket.org/yt_analysis/yt/commits/654443eab662/
Changeset:   654443eab662
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 22:03:41+00:00
Summary:     Linting local_fields
Affected #:  1 file

diff -r ce03c95c2e8586f3b9883bb6c4309776a440362e -r 654443eab6620f68bc570d4ce0da616227420a67 yt/fields/local_fields.py
--- a/yt/fields/local_fields.py
+++ b/yt/fields/local_fields.py
@@ -13,8 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
-
 from yt.utilities.logger import \
     ytLogger as mylog
 


https://bitbucket.org/yt_analysis/yt/commits/04a7ff9a20a1/
Changeset:   04a7ff9a20a1
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 22:04:36+00:00
Summary:     Linting my_plugin_fields
Affected #:  1 file

diff -r 654443eab6620f68bc570d4ce0da616227420a67 -r 04a7ff9a20a18bb3f7a920e9da6464bb98a61ef8 yt/fields/my_plugin_fields.py
--- a/yt/fields/my_plugin_fields.py
+++ b/yt/fields/my_plugin_fields.py
@@ -13,8 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
-
 from .field_plugin_registry import \
     register_field_plugin
 


https://bitbucket.org/yt_analysis/yt/commits/5237c6a610f6/
Changeset:   5237c6a610f6
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 22:05:15+00:00
Summary:     Linting setup.py
Affected #:  1 file

diff -r 04a7ff9a20a18bb3f7a920e9da6464bb98a61ef8 -r 5237c6a610f6d968a3246851d5798e0ad35d7a06 yt/fields/setup.py
--- a/yt/fields/setup.py
+++ b/yt/fields/setup.py
@@ -1,8 +1,4 @@
 #!/usr/bin/env python
-import setuptools
-import os
-import sys
-import os.path
 
 
 def configuration(parent_package='', top_path=None):


https://bitbucket.org/yt_analysis/yt/commits/08b71cda7466/
Changeset:   08b71cda7466
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 22:06:11+00:00
Summary:     Linting magnetic_field.py
Affected #:  1 file

diff -r 5237c6a610f6d968a3246851d5798e0ad35d7a06 -r 08b71cda7466a177edef0a8d96f42ecf5578df40 yt/fields/magnetic_field.py
--- a/yt/fields/magnetic_field.py
+++ b/yt/fields/magnetic_field.py
@@ -15,11 +15,6 @@
 
 import numpy as np
 
-from yt.units.yt_array import YTArray
-from yt.utilities.lib.misc_utilities import \
-    obtain_rvec, obtain_rv_vec
-from yt.utilities.math_utils import resize_vector
-from yt.utilities.cosmology import Cosmology
 from yt.fields.derived_field import \
     ValidateParameter
 
@@ -27,16 +22,8 @@
     register_field_plugin
 
 from yt.utilities.math_utils import \
-    get_sph_r_component, \
     get_sph_theta_component, \
-    get_sph_phi_component, \
-    get_cyl_r_component, \
-    get_cyl_z_component, \
-    get_cyl_theta_component, \
-    get_cyl_r, get_cyl_theta, \
-    get_cyl_z, get_sph_r, \
-    get_sph_theta, get_sph_phi, \
-    periodic_dist, euclidean_dist
+    get_sph_phi_component
 
 @register_field_plugin
 def setup_magnetic_field_fields(registry, ftype = "gas", slice_info = None):


https://bitbucket.org/yt_analysis/yt/commits/30a2b32b32d6/
Changeset:   30a2b32b32d6
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 22:07:25+00:00
Summary:     Linting fluid_vector_fields
Affected #:  1 file

diff -r 08b71cda7466a177edef0a8d96f42ecf5578df40 -r 30a2b32b32d6aad3ccf65ec7541e2c9974e1f052 yt/fields/fluid_vector_fields.py
--- a/yt/fields/fluid_vector_fields.py
+++ b/yt/fields/fluid_vector_fields.py
@@ -16,10 +16,7 @@
 import numpy as np
 
 from yt.fields.derived_field import \
-    ValidateGridType, \
-    ValidateParameter, \
-    ValidateSpatial, \
-    NeedsParameter
+    ValidateSpatial
 
 from .field_plugin_registry import \
     register_field_plugin
@@ -28,8 +25,8 @@
     just_one
 
 from .vector_operations import \
-     create_magnitude_field, \
-     create_squared_field
+    create_magnitude_field, \
+    create_squared_field
 
 @register_field_plugin
 def setup_fluid_vector_fields(registry, ftype = "gas", slice_info = None):


https://bitbucket.org/yt_analysis/yt/commits/4f9ebaa60a84/
Changeset:   4f9ebaa60a84
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 22:07:33+00:00
Summary:     Linting species_fields
Affected #:  1 file

diff -r 30a2b32b32d6aad3ccf65ec7541e2c9974e1f052 -r 4f9ebaa60a84080e5e35fe773e9182977e72d91b yt/fields/species_fields.py
--- a/yt/fields/species_fields.py
+++ b/yt/fields/species_fields.py
@@ -17,12 +17,10 @@
 import re
 
 from yt.utilities.physical_constants import \
-    mh, \
-    mass_sun_cgs, \
     amu_cgs
 from yt.utilities.physical_ratios import \
     primordial_H_mass_fraction
-from yt.funcs import *
+
 from yt.utilities.chemical_formulas import \
     ChemicalFormula
 from .field_plugin_registry import \


https://bitbucket.org/yt_analysis/yt/commits/d1392f535556/
Changeset:   d1392f535556
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 22:10:49+00:00
Summary:     Linting particle_fields.py
Affected #:  1 file

diff -r 4f9ebaa60a84080e5e35fe773e9182977e72d91b -r d1392f5355562097a008a101d8adeccdb9a4ad5a yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -16,8 +16,6 @@
 
 import numpy as np
 
-from yt.funcs import *
-from yt.units.yt_array import YTArray
 from yt.fields.derived_field import \
     ValidateParameter, \
     ValidateSpatial
@@ -125,7 +123,7 @@
     def particle_density(field, data):
         pos = data[ptype, coord_name].convert_to_units("code_length")
         mass = data[ptype, mass_name].convert_to_units("code_mass")
-        d = data.deposit(pos, [data[ptype, mass_name]], method = "sum")
+        d = data.deposit(pos, [mass], method = "sum")
         d = data.ds.arr(d, "code_mass")
         d /= data["index", "cell_volume"]
         return d
@@ -827,7 +825,7 @@
         field_name = (ptype, "smoothed_density")
     else:
         field_name = (ptype, "%s_smoothed_density" % (kernel_name))
-    field_units = registry[ptype, mass_name].units
+
     def _nth_neighbor(field, data):
         pos = data[ptype, coord_name]
         pos.convert_to_units("code_length")


https://bitbucket.org/yt_analysis/yt/commits/1c0abdd1aa2d/
Changeset:   1c0abdd1aa2d
Branch:      yt
User:        ngoldbaum
Date:        2015-09-11 22:24:27+00:00
Summary:     Flaking test_fields
Affected #:  1 file

diff -r d1392f5355562097a008a101d8adeccdb9a4ad5a -r 1c0abdd1aa2d7c33bc7f9dfea18589998ae9a0a3 yt/fields/tests/test_fields.py
--- a/yt/fields/tests/test_fields.py
+++ b/yt/fields/tests/test_fields.py
@@ -1,13 +1,20 @@
-from yt.testing import *
 import numpy as np
+
+from yt.testing import \
+    fake_random_ds, \
+    assert_equal, \
+    assert_array_almost_equal_nulp, \
+    assert_array_equal, \
+    assert_raises
 from yt.utilities.cosmology import \
-     Cosmology
-from yt.utilities.definitions import \
-    mpc_conversion, sec_conversion
+    Cosmology
 from yt.frontends.stream.fields import \
     StreamFieldInfo
 from yt.units.yt_array import \
-     YTArray, YTQuantity
+    YTArray, YTQuantity
+from yt.utilities.exceptions import \
+    YTFieldUnitError, \
+    YTFieldUnitParseError
 
 def setup():
     global base_ds
@@ -88,19 +95,6 @@
         return field
     return field[1]
 
-def _expand_field(field):
-    if isinstance(field, tuple):
-        return field
-    if field in KnownStreamFields:
-        fi = KnownStreamFields[field]
-        if fi.particle_type:
-            return ("all", field)
-        else:
-            return ("gas", field)
-    # Otherwise, we just guess.
-    if "particle" in field:
-        return ("all", field)
-    return ("gas", field)
 
 class TestFieldAccess(object):
     description = None


https://bitbucket.org/yt_analysis/yt/commits/efb607c72fa5/
Changeset:   efb607c72fa5
Branch:      yt
User:        ngoldbaum
Date:        2015-09-12 02:57:46+00:00
Summary:     Backing out b283cad
Affected #:  2 files

diff -r 1c0abdd1aa2d7c33bc7f9dfea18589998ae9a0a3 -r efb607c72fa58bf124f60dd18df531db68fd39e1 yt/fields/astro_simulations.py
--- /dev/null
+++ b/yt/fields/astro_simulations.py
@@ -0,0 +1,58 @@
+"""
+Fields we expect to find in astrophysical simulations.
+
+
+
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+from .domain_context import DomainContext
+
+# Here's how this all works:
+#
+#   1. We have a mapping here that defines fields we might expect to find in an
+#      astrophysical simulation to units (not necessarily definitive) that we
+#      may want to use them in.
+#   2. Simulations and frontends will register aliases from fields (which can
+#      utilize units) to the fields enumerated here.
+#   3. This plugin can call additional plugins on the registry.
+
+class AstroSimulation(DomainContext):
+
+    # This is an immutable of immutables.  Note that we do not specify the
+    # fluid type here, although in most cases we expect it to be "gas".
+    _known_fluid_fields = (
+        ("density",                            "g/cm**3"           ),
+        ("number_density",                     "1/cm**3"           ),
+        ("pressure",                           "dyne / cm**2"      ),
+        ("thermal_energy",                     "erg / g"           ),
+        ("temperature",                        "K"                 ),
+        ("velocity_x",                         "cm / s"            ),
+        ("velocity_y",                         "cm / s"            ),
+        ("velocity_z",                         "cm / s"            ),
+        ("magnetic_field_x",                   "gauss"             ),
+        ("magnetic_field_y",                   "gauss"             ),
+        ("magnetic_field_z",                   "gauss"             ),
+        ("radiation_acceleration_x",           "cm / s**2"         ),
+        ("radiation_acceleration_y",           "cm / s**2"         ),
+        ("radiation_acceleration_z",           "cm / s**2"         ),
+    )
+
+    # This set of fields can be applied to any particle type.
+    _known_particle_fields = (
+        ("particle_position_x",                "cm"                ),
+        ("particle_position_y",                "cm"                ),
+        ("particle_position_z",                "cm"                ),
+        ("particle_velocity_x",                "cm / s"            ),
+        ("particle_velocity_y",                "cm / s"            ),
+        ("particle_velocity_z",                "cm / s"            ),
+        ("particle_mass",                      "g"                 ),
+        ("particle_index",                     ""                  ),
+    )

diff -r 1c0abdd1aa2d7c33bc7f9dfea18589998ae9a0a3 -r efb607c72fa58bf124f60dd18df531db68fd39e1 yt/fields/domain_context.py
--- /dev/null
+++ b/yt/fields/domain_context.py
@@ -0,0 +1,30 @@
+"""
+Domain context base class
+
+Currently we largely apply this to the fields that get loaded.  Presumably
+different analysis operations could be the subject of this type of examination
+as well.
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+domain_context_registry = {}
+
+class DomainContext(object):
+    class __metaclass__(type):
+        def __init__(cls, name, b, d):
+            type.__init__(cls, name, b, d)
+            domain_context_registry[name] = cls
+
+    _known_fluid_fields     =  ()
+    _known_particle_fields  =  ()
+
+    def __init__(self, ds):
+        self.ds = ds
+


https://bitbucket.org/yt_analysis/yt/commits/4c33cffa7ba9/
Changeset:   4c33cffa7ba9
Branch:      yt
User:        xarthisius
Date:        2015-09-14 18:34:33+00:00
Summary:     Merged in ngoldbaum/yt (pull request #1745)

Linting yt.fields
Affected #:  20 files

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/angular_momentum.py
--- a/yt/fields/angular_momentum.py
+++ b/yt/fields/angular_momentum.py
@@ -15,12 +15,7 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import types
 import numpy as np
-import inspect
-import copy
-
-from yt.units.yt_array import YTArray
 
 from .derived_field import \
     ValidateParameter
@@ -29,8 +24,8 @@
     register_field_plugin
 
 from .vector_operations import \
-     create_magnitude_field
-    
+    create_magnitude_field
+
 from yt.utilities.lib.geometry_utils import \
     obtain_rvec, obtain_rv_vec
 
@@ -78,7 +73,7 @@
 
     create_magnitude_field(registry, "specific_angular_momentum",
                            "cm**2 / s", ftype=ftype)
-    
+
     def _angular_momentum_x(field, data):
         return data[ftype, "cell_mass"] \
              * data[ftype, "specific_angular_momentum_x"]
@@ -105,4 +100,3 @@
 
     create_magnitude_field(registry, "angular_momentum",
                            "g * cm**2 / s", ftype=ftype)
-                           

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/astro_fields.py
--- a/yt/fields/astro_fields.py
+++ b/yt/fields/astro_fields.py
@@ -16,8 +16,7 @@
 import numpy as np
 
 from .derived_field import \
-    ValidateParameter, \
-    ValidateSpatial
+    ValidateParameter
 from .field_exceptions import \
     NeedsParameter
 from .field_plugin_registry import \
@@ -30,7 +29,7 @@
     clight, \
     kboltz, \
     G
-    
+
 @register_field_plugin
 def setup_astro_fields(registry, ftype = "gas", slice_info = None):
     # slice_info would be the left, the right, and the factor.
@@ -45,7 +44,7 @@
         div_fac = 2.0
     else:
         sl_left, sl_right, div_fac = slice_info
-    
+
     def _dynamical_time(field, data):
         """
         sqrt(3 pi / (16 G rho))
@@ -71,7 +70,7 @@
 
     def _chandra_emissivity(field, data):
         logT0 = np.log10(data[ftype, "temperature"].to_ndarray().astype(np.float64)) - 7
-        # we get rid of the units here since this is a fit and not an 
+        # we get rid of the units here since this is a fit and not an
         # analytical expression
         return data.ds.arr(data[ftype, "number_density"].to_ndarray().astype(np.float64)**2
                            * (10**(- 0.0103 * logT0**8 + 0.0417 * logT0**7
@@ -91,7 +90,7 @@
     registry.add_field((ftype, "chandra_emissivity"),
                        function=_chandra_emissivity,
                        units="") # add correct units here
-    
+
     def _xray_emissivity(field, data):
         # old scaling coefficient was 2.168e60
         return data.ds.arr(data[ftype, "density"].to_ndarray().astype(np.float64)**2
@@ -110,7 +109,7 @@
     registry.add_field((ftype,"mazzotta_weighting"),
                        function=_mazzotta_weighting,
                        units="keV**-0.25*cm**-6")
-    
+
     def _sz_kinetic(field, data):
         scale = 0.88 * sigma_thompson / mh / clight
         vel_axis = data.get_field_parameter("axis")

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/astro_simulations.py
--- a/yt/fields/astro_simulations.py
+++ b/yt/fields/astro_simulations.py
@@ -13,7 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
 from .domain_context import DomainContext
 
 # Here's how this all works:

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/cosmology_fields.py
--- a/yt/fields/cosmology_fields.py
+++ b/yt/fields/cosmology_fields.py
@@ -14,21 +14,17 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
+from .derived_field import \
+    ValidateParameter
+from .field_exceptions import \
+    NeedsConfiguration, \
+    NeedsParameter
+from .field_plugin_registry import \
+    register_field_plugin
 
-from .derived_field import \
-     ValidateParameter
-from .field_exceptions import \
-     NeedsConfiguration, \
-     NeedsParameter
-from .field_plugin_registry import \
-     register_field_plugin
+from yt.utilities.physical_constants import \
+    speed_of_light_cgs
 
-from yt.utilities.cosmology import \
-     Cosmology
-from yt.utilities.physical_constants import \
-     speed_of_light_cgs
-    
 @register_field_plugin
 def setup_cosmology_fields(registry, ftype = "gas", slice_info = None):
     # slice_info would be the left, the right, and the factor.
@@ -49,7 +45,7 @@
           data[ftype, "dark_matter_density"]
 
     registry.add_field((ftype, "matter_density"),
-                       function=_matter_density, 
+                       function=_matter_density,
                        units="g/cm**3")
 
     def _matter_mass(field, data):
@@ -67,7 +63,7 @@
         co = data.ds.cosmology
         return data[ftype, "matter_density"] / \
           co.critical_density(data.ds.current_redshift)
-    
+
     registry.add_field((ftype, "overdensity"),
                        function=_overdensity,
                        units="")
@@ -116,7 +112,7 @@
                        function=_virial_radius_fraction,
                        validators=[ValidateParameter("virial_radius")],
                        units="")
-    
+
     # Weak lensing convergence.
     # Eqn 4 of Metzler, White, & Loken (2001, ApJ, 547, 560).
     # This needs to be checked for accuracy.
@@ -127,7 +123,7 @@
         co = data.ds.cosmology
         observer_redshift = data.get_field_parameter('observer_redshift')
         source_redshift = data.get_field_parameter('source_redshift')
-        
+
         # observer to lens
         dl = co.angular_diameter_distance(observer_redshift, data.ds.current_redshift)
         # observer to source
@@ -135,11 +131,11 @@
         # lens to source
         dls = co.angular_diameter_distance(data.ds.current_redshift, source_redshift)
 
-        # removed the factor of 1 / a to account for the fact that we are projecting 
+        # removed the factor of 1 / a to account for the fact that we are projecting
         # with a proper distance.
         return (1.5 * (co.hubble_constant / speed_of_light_cgs)**2 * (dl * dls / ds) * \
           data[ftype, "matter_overdensity"]).in_units("1/cm")
-       
+
     registry.add_field((ftype, "weak_lensing_convergence"),
                        function=_weak_lensing_convergence,
                        units="1/cm",

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/derived_field.py
--- a/yt/fields/derived_field.py
+++ b/yt/fields/derived_field.py
@@ -16,10 +16,7 @@
 
 from yt.funcs import \
     ensure_list
-from yt.units.yt_array import \
-    YTArray
 from .field_exceptions import \
-    ValidationException, \
     NeedsGridType, \
     NeedsOriginalGrid, \
     NeedsDataField, \
@@ -30,15 +27,9 @@
     FieldDetector
 from yt.units.unit_object import \
     Unit
+from yt.utilities.exceptions import \
+    YTFieldNotFound
 
-def derived_field(**kwargs):
-    def inner_decorator(function):
-        if 'name' not in kwargs:
-            kwargs['name'] = function.__name__
-        kwargs['function'] = function
-        add_field(**kwargs)
-        return function
-    return inner_decorator
 
 def TranslationFunc(field_name):
     def _TranslationFunc(field, data):
@@ -48,7 +39,7 @@
 
 def NullFunc(field, data):
     raise YTFieldNotFound(field.name)
- 
+
 class DerivedField(object):
     """
     This is the base class used to describe a cell-by-cell derived field.
@@ -178,7 +169,7 @@
 
     def __call__(self, data):
         """ Return the value of the field in a given *data* object. """
-        ii = self.check_available(data)
+        self.check_available(data)
         original_fields = data.keys() # Copy
         if self._function is NullFunc:
             raise RuntimeError(

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/domain_context.py
--- a/yt/fields/domain_context.py
+++ b/yt/fields/domain_context.py
@@ -14,8 +14,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
-
 domain_context_registry = {}
 
 class DomainContext(object):

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/field_detector.py
--- a/yt/fields/field_detector.py
+++ b/yt/fields/field_detector.py
@@ -15,16 +15,9 @@
 
 import numpy as np
 from collections import defaultdict
-from yt.units.unit_object import Unit
 from yt.units.yt_array import YTArray
 from .field_exceptions import \
-    ValidationException, \
-    NeedsGridType, \
-    NeedsOriginalGrid, \
-    NeedsDataField, \
-    NeedsProperty, \
-    NeedsParameter, \
-    FieldUnitsError
+    NeedsGridType
 
 class FieldDetector(defaultdict):
     Level = 1
@@ -87,27 +80,18 @@
         return arr.reshape(self.ActiveDimensions, order="C")
 
     def __missing__(self, item):
-        if hasattr(self.ds, "field_info"):
-            if not isinstance(item, tuple):
-                field = ("unknown", item)
-                finfo = self.ds._get_field_info(*field)
-                #mylog.debug("Guessing field %s is %s", item, finfo.name)
-            else:
-                field = item
-            finfo = self.ds._get_field_info(*field)
-            # For those cases where we are guessing the field type, we will
-            # need to re-update -- otherwise, our item will always not have the
-            # field type.  This can lead to, for instance, "unknown" particle
-            # types not getting correctly identified.
-            # Note that the *only* way this works is if we also fix our field
-            # dependencies during checking.  Bug #627 talks about this.
-            item = self.ds._last_freq
+        if not isinstance(item, tuple):
+            field = ("unknown", item)
         else:
-            FI = getattr(self.ds, "field_info", FieldInfo)
-            if item in FI:
-                finfo = FI[item]
-            else:
-                finfo = None
+            field = item
+        finfo = self.ds._get_field_info(*field)
+        # For those cases where we are guessing the field type, we will
+        # need to re-update -- otherwise, our item will always not have the
+        # field type.  This can lead to, for instance, "unknown" particle
+        # types not getting correctly identified.
+        # Note that the *only* way this works is if we also fix our field
+        # dependencies during checking.  Bug #627 talks about this.
+        item = self.ds._last_freq
         if finfo is not None and finfo._function.__name__ != 'NullFunc':
             try:
                 vv = finfo(self)
@@ -171,10 +155,7 @@
 
     def _read_data(self, field_name):
         self.requested.append(field_name)
-        if hasattr(self.ds, "field_info"):
-            finfo = self.ds._get_field_info(*field_name)
-        else:
-            finfo = FieldInfo[field_name]
+        finfo = self.ds._get_field_info(*field_name)
         if finfo.particle_type:
             self.requested.append(field_name)
             return np.ones(self.NumberOfParticles)

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/field_exceptions.py
--- a/yt/fields/field_exceptions.py
+++ b/yt/fields/field_exceptions.py
@@ -13,7 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
 
 class ValidationException(Exception):
     pass

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/field_functions.py
--- a/yt/fields/field_functions.py
+++ b/yt/fields/field_functions.py
@@ -32,7 +32,7 @@
         # it from a cm**2 array.
         np.subtract(data["%s%s" % (field_prefix, ax)].in_units("cm"),
                     center[i], r)
-        if data.ds.periodicity[i] == True:
+        if data.ds.periodicity[i] is True:
             np.abs(r, r)
             np.subtract(r, DW[i], rdw)
             np.abs(rdw, rdw)

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/field_plugin_registry.py
--- a/yt/fields/field_plugin_registry.py
+++ b/yt/fields/field_plugin_registry.py
@@ -13,8 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
-
 field_plugins = {}
 
 def register_field_plugin(func):

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/fluid_fields.py
--- a/yt/fields/fluid_fields.py
+++ b/yt/fields/fluid_fields.py
@@ -15,20 +15,16 @@
 
 import numpy as np
 
-from yt.funcs import \
-    just_one
-
 from .derived_field import \
-    ValidateParameter, \
     ValidateSpatial
 
 from .field_plugin_registry import \
     register_field_plugin
 
 from .vector_operations import \
-     create_averaged_field, \
-     create_magnitude_field, \
-     create_vector_fields
+    create_averaged_field, \
+    create_magnitude_field, \
+    create_vector_fields
 
 from yt.utilities.physical_constants import \
     mh, \
@@ -37,20 +33,6 @@
 from yt.utilities.physical_ratios import \
     metallicity_sun
 
-from yt.units.yt_array import \
-    YTArray
-
-from yt.utilities.math_utils import \
-    get_sph_r_component, \
-    get_sph_theta_component, \
-    get_sph_phi_component, \
-    get_cyl_r_component, \
-    get_cyl_z_component, \
-    get_cyl_theta_component, \
-    get_cyl_r, get_cyl_theta, \
-    get_cyl_z, get_sph_r, \
-    get_sph_theta, get_sph_phi, \
-    periodic_dist, euclidean_dist
 
 @register_field_plugin
 def setup_fluid_fields(registry, ftype = "gas", slice_info = None):

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/fluid_vector_fields.py
--- a/yt/fields/fluid_vector_fields.py
+++ b/yt/fields/fluid_vector_fields.py
@@ -16,10 +16,7 @@
 import numpy as np
 
 from yt.fields.derived_field import \
-    ValidateGridType, \
-    ValidateParameter, \
-    ValidateSpatial, \
-    NeedsParameter
+    ValidateSpatial
 
 from .field_plugin_registry import \
     register_field_plugin
@@ -28,8 +25,8 @@
     just_one
 
 from .vector_operations import \
-     create_magnitude_field, \
-     create_squared_field
+    create_magnitude_field, \
+    create_squared_field
 
 @register_field_plugin
 def setup_fluid_vector_fields(registry, ftype = "gas", slice_info = None):

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/interpolated_fields.py
--- a/yt/fields/interpolated_fields.py
+++ b/yt/fields/interpolated_fields.py
@@ -13,8 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
-
 from yt.fields.local_fields import add_field
 
 from yt.utilities.linear_interpolators import \

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/local_fields.py
--- a/yt/fields/local_fields.py
+++ b/yt/fields/local_fields.py
@@ -13,8 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
-
 from yt.utilities.logger import \
     ytLogger as mylog
 

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/magnetic_field.py
--- a/yt/fields/magnetic_field.py
+++ b/yt/fields/magnetic_field.py
@@ -15,11 +15,6 @@
 
 import numpy as np
 
-from yt.units.yt_array import YTArray
-from yt.utilities.lib.misc_utilities import \
-    obtain_rvec, obtain_rv_vec
-from yt.utilities.math_utils import resize_vector
-from yt.utilities.cosmology import Cosmology
 from yt.fields.derived_field import \
     ValidateParameter
 
@@ -27,16 +22,8 @@
     register_field_plugin
 
 from yt.utilities.math_utils import \
-    get_sph_r_component, \
     get_sph_theta_component, \
-    get_sph_phi_component, \
-    get_cyl_r_component, \
-    get_cyl_z_component, \
-    get_cyl_theta_component, \
-    get_cyl_r, get_cyl_theta, \
-    get_cyl_z, get_sph_r, \
-    get_sph_theta, get_sph_phi, \
-    periodic_dist, euclidean_dist
+    get_sph_phi_component
 
 @register_field_plugin
 def setup_magnetic_field_fields(registry, ftype = "gas", slice_info = None):

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/my_plugin_fields.py
--- a/yt/fields/my_plugin_fields.py
+++ b/yt/fields/my_plugin_fields.py
@@ -13,8 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import numpy as np
-
 from .field_plugin_registry import \
     register_field_plugin
 

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/particle_fields.py
--- a/yt/fields/particle_fields.py
+++ b/yt/fields/particle_fields.py
@@ -16,8 +16,6 @@
 
 import numpy as np
 
-from yt.funcs import *
-from yt.units.yt_array import YTArray
 from yt.fields.derived_field import \
     ValidateParameter, \
     ValidateSpatial
@@ -125,7 +123,7 @@
     def particle_density(field, data):
         pos = data[ptype, coord_name].convert_to_units("code_length")
         mass = data[ptype, mass_name].convert_to_units("code_mass")
-        d = data.deposit(pos, [data[ptype, mass_name]], method = "sum")
+        d = data.deposit(pos, [mass], method = "sum")
         d = data.ds.arr(d, "code_mass")
         d /= data["index", "cell_volume"]
         return d
@@ -827,7 +825,7 @@
         field_name = (ptype, "smoothed_density")
     else:
         field_name = (ptype, "%s_smoothed_density" % (kernel_name))
-    field_units = registry[ptype, mass_name].units
+
     def _nth_neighbor(field, data):
         pos = data[ptype, coord_name]
         pos.convert_to_units("code_length")

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/setup.py
--- a/yt/fields/setup.py
+++ b/yt/fields/setup.py
@@ -1,8 +1,4 @@
 #!/usr/bin/env python
-import setuptools
-import os
-import sys
-import os.path
 
 
 def configuration(parent_package='', top_path=None):

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/species_fields.py
--- a/yt/fields/species_fields.py
+++ b/yt/fields/species_fields.py
@@ -17,12 +17,10 @@
 import re
 
 from yt.utilities.physical_constants import \
-    mh, \
-    mass_sun_cgs, \
     amu_cgs
 from yt.utilities.physical_ratios import \
     primordial_H_mass_fraction
-from yt.funcs import *
+
 from yt.utilities.chemical_formulas import \
     ChemicalFormula
 from .field_plugin_registry import \

diff -r 1e1fc6fb63d4dd5fc7183a3900902a0c0638ae9a -r 4c33cffa7ba96675a2cacaecf95a20eb15067413 yt/fields/tests/test_fields.py
--- a/yt/fields/tests/test_fields.py
+++ b/yt/fields/tests/test_fields.py
@@ -1,13 +1,20 @@
-from yt.testing import *
 import numpy as np
+
+from yt.testing import \
+    fake_random_ds, \
+    assert_equal, \
+    assert_array_almost_equal_nulp, \
+    assert_array_equal, \
+    assert_raises
 from yt.utilities.cosmology import \
-     Cosmology
-from yt.utilities.definitions import \
-    mpc_conversion, sec_conversion
+    Cosmology
 from yt.frontends.stream.fields import \
     StreamFieldInfo
 from yt.units.yt_array import \
-     YTArray, YTQuantity
+    YTArray, YTQuantity
+from yt.utilities.exceptions import \
+    YTFieldUnitError, \
+    YTFieldUnitParseError
 
 def setup():
     global base_ds
@@ -88,19 +95,6 @@
         return field
     return field[1]
 
-def _expand_field(field):
-    if isinstance(field, tuple):
-        return field
-    if field in KnownStreamFields:
-        fi = KnownStreamFields[field]
-        if fi.particle_type:
-            return ("all", field)
-        else:
-            return ("gas", field)
-    # Otherwise, we just guess.
-    if "particle" in field:
-        return ("all", field)
-    return ("gas", field)
 
 class TestFieldAccess(object):
     description = None

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