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

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Thu Aug 20 09:41:35 PDT 2015


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/4bfdb0ddccdb/
Changeset:   4bfdb0ddccdb
Branch:      yt
User:        chummels
Date:        2015-08-20 16:41:21+00:00
Summary:     Merged in ngoldbaum/yt (pull request #1691)

Codebase linting: analysis modules and flake8 rules
Affected #:  47 files

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 setup.cfg
--- a/setup.cfg
+++ b/setup.cfg
@@ -7,3 +7,9 @@
 where=yt
 exclude=answer_testing
 with-xunit=1
+
+[flake8]
+# if we include api.py files, we get tons of spurious "imported but unused" errors
+exclude = */api.py,*/__config__.py,yt/visualization/_mpl_imports.py
+max-line-length=999
+ignore = E111,E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E201,E202,E211,E221,E222,E228,E241,E301,E203,E225,E226,E231,E251,E261,E262,E265,E302,E303,E401,E502,E701,E703,W291,W293,W391
\ No newline at end of file

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/absorption_spectrum/absorption_line.py
--- a/yt/analysis_modules/absorption_spectrum/absorption_line.py
+++ b/yt/analysis_modules/absorption_spectrum/absorption_line.py
@@ -70,15 +70,6 @@
     x = np.asarray(u).astype(np.float64)
     y = np.asarray(a).astype(np.float64)
 
-    w = np.array([0.462243670,   0.286675505,   0.109017206, 
-                  0.0248105209,  0.00324377334, 0.000228338636, 
-                  7.80255648e-6, 1.08606937e-7, 4.39934099e-10, 
-                  2.22939365e-13])
-
-    t = np.array([0.245340708, 0.737473729, 1.23407622, 1.73853771, 
-                  2.25497400,  2.78880606,  3.34785457, 3.94476404, 
-                  4.60368245,  5.38748089])
-
     # Hummer's Chebyshev Coefficients
     c = ( 0.1999999999972224, -0.1840000000029998,   0.1558399999965025, 
          -0.1216640000043988,  0.0877081599940391,  -0.0585141248086907, 
@@ -195,7 +186,6 @@
     ## conversions
     nu1 = speed_of_light_cgs / lam1           # line freq in Hz
     nudop = v_doppler / speed_of_light_cgs * nu1   # doppler width in Hz
-    lamdop = v_doppler / speed_of_light_cgs * lam1 # doppler width in Ang
 
     ## create wavelength
     if lambda_bins is None:

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py
--- a/yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py
+++ b/yt/analysis_modules/absorption_spectrum/absorption_spectrum_fit.py
@@ -141,7 +141,7 @@
             if flag and species=='lya' and min(yDatBounded)<.1:
                newLinesP=_large_flag_fit(xBounded,yDatBounded,
                         yFitBounded,z,speciesDict,
-                        minSize,minError)
+                        fitLim,minError)
 
             if np.size(newLinesP)> 0:
 
@@ -226,7 +226,7 @@
     """
 
     #Setup initial line guesses
-    if initP==None: #Regular fit
+    if initP is None: #Regular fit
         initP = [0,0,0] 
         if min(yDat)<.01: #Large lines get larger initial guess 
             initP[0] = speciesDict['init_N']*10**2
@@ -252,7 +252,7 @@
     #Values to proceed through first run
     errSq,prevErrSq,prevLinesP=1,10*len(x),[]
 
-    if errBound == None:
+    if errBound is None:
         errBound = len(yDat)*(max(1-yDat)*1E-2)**2
     else:
         errBound = errBound*len(yDat)
@@ -548,7 +548,7 @@
             lb = _get_bounds(p[2],b,wl,x0,xRes)
             xb,yb=x[lb[0]:lb[1]],y[lb[0]:lb[1]]
 
-            if errBound == None:
+            if errBound is None:
                 errBound = 10*len(yb)*(max(1-yb)*1E-2)**2
             else:
                 errBound = 10*errBound*len(yb)

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/cosmological_observation/cosmology_splice.py
--- a/yt/analysis_modules/cosmological_observation/cosmology_splice.py
+++ b/yt/analysis_modules/cosmological_observation/cosmology_splice.py
@@ -14,10 +14,11 @@
 #-----------------------------------------------------------------------------
 
 import numpy as np
+import os
 
 from yt.convenience import \
     simulation
-from yt.funcs import *
+from yt.funcs import mylog
 from yt.utilities.cosmology import \
     Cosmology
 

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/cosmological_observation/light_cone/light_cone.py
--- a/yt/analysis_modules/cosmological_observation/light_cone/light_cone.py
+++ b/yt/analysis_modules/cosmological_observation/light_cone/light_cone.py
@@ -24,8 +24,6 @@
     CosmologySplice
 from yt.convenience import \
     load
-from yt.utilities.cosmology import \
-    Cosmology
 from yt.utilities.parallel_tools.parallel_analysis_interface import \
     parallel_objects, \
     parallel_root_only

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/cosmological_observation/light_cone/setup.py
--- a/yt/analysis_modules/cosmological_observation/light_cone/setup.py
+++ b/yt/analysis_modules/cosmological_observation/light_cone/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
--- a/yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
+++ b/yt/analysis_modules/cosmological_observation/light_ray/light_ray.py
@@ -13,7 +13,6 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-import copy
 import h5py
 import numpy as np
 

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/cosmological_observation/light_ray/setup.py
--- a/yt/analysis_modules/cosmological_observation/light_ray/setup.py
+++ b/yt/analysis_modules/cosmological_observation/light_ray/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/cosmological_observation/setup.py
--- a/yt/analysis_modules/cosmological_observation/setup.py
+++ b/yt/analysis_modules/cosmological_observation/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_analysis/enzofof_merger_tree.py
--- a/yt/analysis_modules/halo_analysis/enzofof_merger_tree.py
+++ b/yt/analysis_modules/halo_analysis/enzofof_merger_tree.py
@@ -35,13 +35,13 @@
 
 import numpy as np
 import h5py
-import time
-import pdb
+import glob
+import os
+
 from yt.extern.six.moves import cPickle
-import glob
+from yt.extern.pykdtree import KDTree
+from yt.funcs import mylog, get_pbar
 
-from yt.funcs import *
-from yt.extern.pykdtree import KDTree
 import yt.extern.pydot as pydot
 
 # We don't currently use this, but we may again find a use for it in the
@@ -180,7 +180,7 @@
 
     def calculate_parentage_fractions(self, other_catalog, radius = 0.10):
         parentage_fractions = {}
-        if self.halo_positions == None or other_catalog.halo_positions == None:
+        if self.halo_positions is None or other_catalog.halo_positions is None:
             return parentage_fractions
         mylog.debug("Ball-tree query with radius %0.3e", radius)
         all_nearest = self.halo_kdtree.query_ball_tree(
@@ -320,7 +320,7 @@
         for redshift in self.redshifts.values():
             if redshift <= zrange[0] and redshift >= zrange[1]:
                 # some reverse lookup magic--assumes unique cycle/z pairs
-                cycle = [key for key,value in mt.redshifts.items() \
+                cycle = [key for key,value in self.redshifts.items() \
                          if value == redshift][0]
                 del self.redshifts[cycle]
 
@@ -568,7 +568,7 @@
             automatically. See GraphViz (e.g. "dot -v")
             for a list of available output formats.
         """
-        if filename == None: 
+        if filename is None:
             filename = "%s/tree_halo%5.5d.gv" % \
                         (self.FOF_directory, self.halonum)
         # Create the pydot graph object.
@@ -598,7 +598,6 @@
                     #      (lvl, br.halo_id, next_lvl, c[0], color)
                     
                     #fp.write(line)
-                    last_level = (ii,lvl)
         for ii,lvl in enumerate(sorted_lvl):
             npart_max = 0
             for br in self.levels[lvl]:

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_analysis/halo_callbacks.py
--- a/yt/analysis_modules/halo_analysis/halo_callbacks.py
+++ b/yt/analysis_modules/halo_analysis/halo_callbacks.py
@@ -18,23 +18,22 @@
 import os
 
 from yt.analysis_modules.cosmological_observation.light_ray.light_ray import \
-     periodic_distance
+    periodic_distance
 from yt.data_objects.profiles import \
-     create_profile
+    create_profile
 from yt.units.yt_array import \
-     YTArray, YTQuantity
+    YTArray
 from yt.utilities.exceptions import \
-     YTSphereTooSmall
+    YTSphereTooSmall
 from yt.funcs import \
-     ensure_list, is_root
-from yt.utilities.exceptions import YTUnitConversionError
+    ensure_list
 from yt.utilities.logger import ytLogger as mylog
 from yt.utilities.operator_registry import \
-     OperatorRegistry
+    OperatorRegistry
 from yt.utilities.parallel_tools.parallel_analysis_interface import \
     parallel_root_only
 from yt.visualization.profile_plotter import \
-     PhasePlot
+    PhasePlot
 
 callback_registry = OperatorRegistry()
     

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_analysis/halo_catalog.py
--- a/yt/analysis_modules/halo_analysis/halo_catalog.py
+++ b/yt/analysis_modules/halo_analysis/halo_catalog.py
@@ -138,7 +138,7 @@
         self.actions = []
         # fields to be written to the halo catalog
         self.quantities = []
-        if not self.halos_ds is None:
+        if self.halos_ds is not None:
             self.add_default_quantities()
 
     def add_callback(self, callback, *args, **kwargs):

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_analysis/halo_finding_methods.py
--- a/yt/analysis_modules/halo_analysis/halo_finding_methods.py
+++ b/yt/analysis_modules/halo_analysis/halo_finding_methods.py
@@ -17,8 +17,6 @@
 
 from yt.analysis_modules.halo_finding.halo_objects import \
     FOFHaloFinder, HOPHaloFinder
-from yt.frontends.halo_catalog.data_structures import \
-    HaloCatalogDataset
 from yt.frontends.stream.data_structures import \
     load_particles
 from yt.units.dimensions import length

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_analysis/tests/test_halo_finders.py
--- a/yt/analysis_modules/halo_analysis/tests/test_halo_finders.py
+++ b/yt/analysis_modules/halo_analysis/tests/test_halo_finders.py
@@ -1,10 +1,7 @@
 import os
 import sys
 
-from yt.analysis_modules.halo_analysis.api import \
-    HaloCatalog
 from yt.convenience import load
-from yt.testing import *
 from yt.utilities.answer_testing.framework import \
     FieldValuesTest, \
     requires_ds

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_finding/fof/setup.py
--- a/yt/analysis_modules/halo_finding/fof/setup.py
+++ b/yt/analysis_modules/halo_finding/fof/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_finding/halo_objects.py
--- a/yt/analysis_modules/halo_finding/halo_objects.py
+++ b/yt/analysis_modules/halo_finding/halo_objects.py
@@ -17,21 +17,15 @@
 import h5py
 import math
 import numpy as np
-import random
-import sys
 import glob
 import os
 import os.path as path
 from functools import cmp_to_key
-from collections import defaultdict
 from yt.extern.six import add_metaclass
 from yt.extern.six.moves import zip as izip
 
 from yt.config import ytcfg
 from yt.funcs import mylog, ensure_dir_exists
-from yt.utilities.performance_counters import \
-    time_function, \
-    yt_counters
 from yt.utilities.math_utils import \
     get_rotation_matrix, \
     periodic_dist
@@ -39,7 +33,7 @@
     mass_sun_cgs, \
     TINY
 from yt.utilities.physical_ratios import \
-     rho_crit_g_cm3_h2
+    rho_crit_g_cm3_h2
 
 from .hop.EnzoHop import RunHOP
 from .fof.EnzoFOF import RunFOF
@@ -282,7 +276,7 @@
         return r.max()
 
     def __getitem__(self, key):
-        if ytcfg.getboolean("yt", "inline") == False:
+        if ytcfg.getboolean("yt", "inline") is False:
             return self.data[key][self.indices]
         else:
             return self.data[key][self.indices]
@@ -339,8 +333,6 @@
         if ('io','creation_time') in self.data.ds.field_list:
             handle.create_dataset("/%s/creation_time" % gn,
                 data=self['creation_time'])
-        n = handle["/%s" % gn]
-        # set attributes on n
         self._processing = False
 
     def virial_mass(self, virial_overdensity=200., bins=300):
@@ -419,7 +411,7 @@
         """
         self.virial_info(bins=bins)
         over = (self.overdensity > virial_overdensity)
-        if (over == True).any():
+        if over.any():
             vir_bin = max(np.arange(bins + 1)[over])
             return vir_bin
         else:
@@ -1233,7 +1225,6 @@
         fglob = path.join(basedir, 'halos_%d.*.bin' % n)
         files = glob.glob(fglob)
         halos = self._get_halos_binary(files)
-        Jc = 1.0
         length = 1.0 / ds['Mpchcm']
         conv = dict(pos = np.array([length, length, length,
                                     1, 1, 1]), # to unitary

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_finding/hop/setup.py
--- a/yt/analysis_modules/halo_finding/hop/setup.py
+++ b/yt/analysis_modules/halo_finding/hop/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_finding/rockstar/rockstar.py
--- a/yt/analysis_modules/halo_finding/rockstar/rockstar.py
+++ b/yt/analysis_modules/halo_finding/rockstar/rockstar.py
@@ -16,23 +16,21 @@
 
 from yt.config import ytcfg
 from yt.data_objects.time_series import \
-     DatasetSeries
+    DatasetSeries
 from yt.funcs import \
-     is_root
+    is_root, mylog
 from yt.utilities.parallel_tools.parallel_analysis_interface import \
-    ParallelAnalysisInterface, ProcessorPool, Communicator
-from yt.analysis_modules.halo_finding.halo_objects import * #Halos & HaloLists
+    ParallelAnalysisInterface, ProcessorPool
+from yt.analysis_modules.halo_finding.halo_objects import \
+    RockstarHaloList
 from yt.utilities.exceptions import YTRockstarMultiMassNotSupported
 
 from . import rockstar_interface
 
 import socket
 import time
-import threading
-import signal
 import os
-from os import environ
-from os import mkdir
+import numpy as np
 from os import path
 
 class InlineRunner(ParallelAnalysisInterface):
@@ -202,7 +200,7 @@
             mylog.info("http://adsabs.harvard.edu/abs/2013ApJ...762..109B")
         ParallelAnalysisInterface.__init__(self)
         # Decide how we're working.
-        if ytcfg.getboolean("yt", "inline") == True:
+        if ytcfg.getboolean("yt", "inline") is True:
             self.runner = InlineRunner()
         else:
             self.runner = StandardRunner(num_readers, num_writers)
@@ -247,8 +245,6 @@
 
         dd = tds.all_data()
         # Get DM particle mass.
-        all_fields = set(tds.derived_field_list + tds.field_list)
-        has_particle_type = ("particle_type" in all_fields)
 
         particle_mass = self.particle_mass
         if particle_mass is None:

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_finding/rockstar/setup.py
--- a/yt/analysis_modules/halo_finding/rockstar/setup.py
+++ b/yt/analysis_modules/halo_finding/rockstar/setup.py
@@ -1,9 +1,7 @@
 #!/usr/bin/env python
 from __future__ import print_function
-import setuptools
-import os, sys, os.path
-
 import os.path
+import sys
 
 def configuration(parent_package='',top_path=None):
     from numpy.distutils.misc_util import Configuration

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_finding/tests/test_rockstar.py
--- a/yt/analysis_modules/halo_finding/tests/test_rockstar.py
+++ b/yt/analysis_modules/halo_finding/tests/test_rockstar.py
@@ -2,7 +2,6 @@
 import sys
 
 from yt.convenience import load
-from yt.testing import *
 from yt.utilities.answer_testing.framework import \
     FieldValuesTest, \
     requires_sim

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_mass_function/halo_mass_function.py
--- a/yt/analysis_modules/halo_mass_function/halo_mass_function.py
+++ b/yt/analysis_modules/halo_mass_function/halo_mass_function.py
@@ -14,7 +14,7 @@
 #-----------------------------------------------------------------------------
 
 import numpy as np
-import math, time
+import math
 
 from yt.funcs import mylog
 from yt.units.yt_array import \
@@ -184,7 +184,7 @@
             if log_mass_max is None:
                 self.log_mass_max = 16
         # If we're making the analytic function...
-        if self.make_analytic == True:
+        if self.make_analytic is True:
             # Try to set cosmological parameters from the simulation dataset
             if simulation_ds is not None:
                 self.omega_matter0 = self.simulation_ds.omega_matter
@@ -623,27 +623,27 @@
 many times as you want. */
 
 /* TFmdm_set_cosm() -- User passes all the cosmological parameters as
-	arguments; the routine sets up all of the scalar quantites needed 
-	computation of the fitting formula.  The input parameters are: 
-	1) omega_matter -- Density of CDM, baryons, and massive neutrinos,
-				in units of the critical density. 
-	2) omega_baryon -- Density of baryons, in units of critical. 
-	3) omega_hdm    -- Density of massive neutrinos, in units of critical 
-	4) degen_hdm    -- (Int) Number of degenerate massive neutrino species 
-	5) omega_lambda -- Cosmological constant 
-	6) hubble       -- Hubble constant, in units of 100 km/s/Mpc 
-	7) redshift     -- The redshift at which to evaluate */
+   arguments; the routine sets up all of the scalar quantites needed 
+   computation of the fitting formula.  The input parameters are: 
+   1) omega_matter -- Density of CDM, baryons, and massive neutrinos,
+                      in units of the critical density. 
+   2) omega_baryon -- Density of baryons, in units of critical. 
+   3) omega_hdm    -- Density of massive neutrinos, in units of critical 
+   4) degen_hdm    -- (Int) Number of degenerate massive neutrino species 
+   5) omega_lambda -- Cosmological constant 
+   6) hubble       -- Hubble constant, in units of 100 km/s/Mpc 
+   7) redshift     -- The redshift at which to evaluate */
 
 /* TFmdm_onek_mpc() -- User passes a single wavenumber, in units of Mpc^-1.
-	Routine returns the transfer function from the Eisenstein & Hu
-	fitting formula, based on the cosmology currently held in the 
-	internal variables.  The routine returns T_cb (the CDM+Baryon
-	density-weighted transfer function), although T_cbn (the CDM+
-	Baryon+Neutrino density-weighted transfer function) is stored
-	in the global variable tf_cbnu. */
+   Routine returns the transfer function from the Eisenstein & Hu
+   fitting formula, based on the cosmology currently held in the 
+   internal variables.  The routine returns T_cb (the CDM+Baryon
+   density-weighted transfer function), although T_cbn (the CDM+
+   Baryon+Neutrino density-weighted transfer function) is stored
+   in the global variable tf_cbnu. */
 
 /* We also supply TFmdm_onek_hmpc(), which is identical to the previous
-	routine, but takes the wavenumber in units of h Mpc^-1. */
+   routine, but takes the wavenumber in units of h Mpc^-1. */
 
 /* We hold the internal scalar quantities in global variables, so that
 the user may access them in an external program, via "extern" declarations. */
@@ -667,7 +667,7 @@
         sets many global variables for use in TFmdm_onek_mpc() */
     """
     def __init__(self, omega_matter, omega_baryon, omega_hdm,
-	    degen_hdm, omega_lambda, hubble, redshift):
+                 degen_hdm, omega_lambda, hubble, redshift):
         self.qwarn = 0;
         self.theta_cmb = 2.728/2.7 # Assuming T_cmb = 2.728 K
     

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/halo_mass_function/setup.py
--- a/yt/analysis_modules/halo_mass_function/setup.py
+++ b/yt/analysis_modules/halo_mass_function/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/level_sets/clump_handling.py
--- a/yt/analysis_modules/level_sets/clump_handling.py
+++ b/yt/analysis_modules/level_sets/clump_handling.py
@@ -19,7 +19,7 @@
 
 from yt.fields.derived_field import \
     ValidateSpatial
-from yt.funcs import mylog
+from yt.funcs import mylog, iterable
 from yt.extern.six import string_types
 
 from .clump_info_items import \

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/level_sets/clump_tools.py
--- a/yt/analysis_modules/level_sets/clump_tools.py
+++ b/yt/analysis_modules/level_sets/clump_tools.py
@@ -28,9 +28,9 @@
     counter += 1
     list.append(clump)
     clump.level = level
-    if clump.children != None:
+    if clump.children is not None:
         for child in clump.children:
-            x = recursive_all_clumps(child,list,level+1,clump.number)
+            recursive_all_clumps(child,list,level+1,clump.number)
     return list
 
 def return_all_clumps(clump):
@@ -64,8 +64,6 @@
     Recursive. Prints the level and the number of cores to the screen."""
 
     global counter
-    if dbg > 0:
-        print(tabs(level), "l =",level, "n_core",counter)
 
     if ((clump.children is None) or (len(clump.children) == 0)):
         counter += 1

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/level_sets/clump_validators.py
--- a/yt/analysis_modules/level_sets/clump_validators.py
+++ b/yt/analysis_modules/level_sets/clump_validators.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.data_point_utilities import FindBindingEnergy
 from yt.utilities.operator_registry import \
     OperatorRegistry

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/level_sets/contour_finder.py
--- a/yt/analysis_modules/level_sets/contour_finder.py
+++ b/yt/analysis_modules/level_sets/contour_finder.py
@@ -13,11 +13,11 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-from itertools import chain
 import numpy as np
 
-from yt.funcs import *
-import yt.utilities.data_point_utilities as data_point_utilities
+from collections import defaultdict
+
+from yt.funcs import mylog, get_pbar
 from yt.utilities.lib.ContourFinding import \
     ContourTree, TileContourTree, link_node_contours, \
     update_joins
@@ -32,7 +32,6 @@
     contours = {}
     node_ids = []
     DLE = data_source.ds.domain_left_edge
-    selector = getattr(data_source, "base_object", data_source).selector
     masks = dict((g.id, m) for g, m in data_source.blocks)
     for (g, node, (sl, dims, gi)) in data_source.tiles.slice_traverse():
         node.node_ind = len(node_ids)

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/level_sets/setup.py
--- a/yt/analysis_modules/level_sets/setup.py
+++ b/yt/analysis_modules/level_sets/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/list_modules.py
--- a/yt/analysis_modules/list_modules.py
+++ b/yt/analysis_modules/list_modules.py
@@ -33,7 +33,7 @@
     def __getattr__(self, attr):
         try:
             name = "yt.analysis_modules.%s.api" % (attr)
-            nm = __import__(name, level=-1)
+            __import__(name, level=-1)
             setattr(self, attr, sys.modules[name])
         except ImportError:
             raise AttributeError(attr)

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/particle_trajectories/particle_trajectories.py
--- a/yt/analysis_modules/particle_trajectories/particle_trajectories.py
+++ b/yt/analysis_modules/particle_trajectories/particle_trajectories.py
@@ -16,7 +16,7 @@
 from yt.utilities.lib.CICDeposit import CICSample_3
 from yt.utilities.parallel_tools.parallel_analysis_interface import \
     parallel_root_only
-from yt.funcs import *
+from yt.funcs import mylog, get_pbar
 from yt.units.yt_array import array_like_field
 from yt.config import ytcfg
 from collections import OrderedDict

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/particle_trajectories/setup.py
--- a/yt/analysis_modules/particle_trajectories/setup.py
+++ b/yt/analysis_modules/particle_trajectories/setup.py
@@ -1,8 +1,5 @@
 #!/usr/bin/env python
-import setuptools
-import os
-import sys
-import os.path
+
 
 def configuration(parent_package='', top_path=None):
     from numpy.distutils.misc_util import Configuration

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/photon_simulator/photon_models.py
--- a/yt/analysis_modules/photon_simulator/photon_models.py
+++ b/yt/analysis_modules/photon_simulator/photon_models.py
@@ -24,7 +24,8 @@
 
 from yt.extern.six import string_types
 import numpy as np
-from yt.funcs import *
+from yt.funcs import mylog, get_pbar
+from yt.units.yt_array import YTArray
 from yt.utilities.physical_constants import mp
 from yt.utilities.parallel_tools.parallel_analysis_interface import \
      parallel_objects

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/photon_simulator/photon_simulator.py
--- a/yt/analysis_modules/photon_simulator/photon_simulator.py
+++ b/yt/analysis_modules/photon_simulator/photon_simulator.py
@@ -26,14 +26,15 @@
 #-----------------------------------------------------------------------------
 from yt.extern.six import string_types
 import numpy as np
-from yt.funcs import *
+from yt.funcs import \
+    mylog, get_pbar, iterable, ensure_list
 from yt.utilities.physical_constants import clight
 from yt.utilities.cosmology import Cosmology
 from yt.utilities.orientation import Orientation
 from yt.utilities.fits_image import assert_same_wcs
 from yt.utilities.parallel_tools.parallel_analysis_interface import \
-     communication_system, parallel_root_only, get_mpi_type, \
-     parallel_capable
+    communication_system, parallel_root_only, get_mpi_type, \
+    parallel_capable
 from yt.units.yt_array import YTQuantity, YTArray, uconcatenate
 import h5py
 from yt.utilities.on_demand_imports import _astropy

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/photon_simulator/setup.py
--- a/yt/analysis_modules/photon_simulator/setup.py
+++ b/yt/analysis_modules/photon_simulator/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/photon_simulator/spectral_models.py
--- a/yt/analysis_modules/photon_simulator/spectral_models.py
+++ b/yt/analysis_modules/photon_simulator/spectral_models.py
@@ -11,11 +11,12 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
+import h5py
 import numpy as np
 import os
-from yt.funcs import *
-from yt.units.yt_array import YTQuantity
-import h5py
+
+from yt.funcs import mylog
+from yt.units.yt_array import YTArray, YTQuantity
 from yt.utilities.on_demand_imports import _astropy, _scipy
 from yt.utilities.physical_constants import hcgs, clight, erg_per_keV, amu_cgs
 

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/photon_simulator/tests/test_cluster.py
--- a/yt/analysis_modules/photon_simulator/tests/test_cluster.py
+++ b/yt/analysis_modules/photon_simulator/tests/test_cluster.py
@@ -10,11 +10,13 @@
 # The full license is in the file COPYING.txt, distributed with this software.
 #-----------------------------------------------------------------------------
 
-from yt.testing import *
+from yt.analysis_modules.photon_simulator.api import \
+    TableApecModel, TableAbsorbModel, \
+    ThermalPhotonModel, PhotonList
 from yt.config import ytcfg
-from yt.analysis_modules.photon_simulator.api import *
+from yt.testing import requires_file
 from yt.utilities.answer_testing.framework import requires_ds, \
-     GenericArrayTest, data_dir_load
+    GenericArrayTest, data_dir_load
 import numpy as np
 
 def setup():

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/ppv_cube/setup.py
--- a/yt/analysis_modules/ppv_cube/setup.py
+++ b/yt/analysis_modules/ppv_cube/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/ppv_cube/tests/test_ppv.py
--- a/yt/analysis_modules/ppv_cube/tests/test_ppv.py
+++ b/yt/analysis_modules/ppv_cube/tests/test_ppv.py
@@ -15,7 +15,7 @@
 import yt.units as u
 from yt.utilities.physical_constants import kboltz, mh, clight
 import numpy as np
-from yt.testing import *
+from yt.testing import assert_allclose_units
 
 def setup():
     """Test specific setup."""

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
--- a/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
+++ b/yt/analysis_modules/radmc3d_export/tests/test_radmc3d_exporter.py
@@ -11,13 +11,13 @@
 #-----------------------------------------------------------------------------
 
 import yt
-from yt.testing import *
+from yt.testing import assert_allclose
 from yt.analysis_modules.radmc3d_export.api import RadMC3DWriter
 from yt.utilities.answer_testing.framework import \
     AnswerTestingTest, \
     requires_ds
-from yt.config import ytcfg
 import tempfile
+import numpy as np
 import os
 import shutil
 

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/setup.py
--- a/yt/analysis_modules/setup.py
+++ b/yt/analysis_modules/setup.py
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
-import sys
+
+
 def configuration(parent_package='', top_path=None):
     from numpy.distutils.misc_util import Configuration
     config = Configuration('analysis_modules', parent_package, top_path)

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/spectral_integrator/setup.py
--- a/yt/analysis_modules/spectral_integrator/setup.py
+++ b/yt/analysis_modules/spectral_integrator/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/star_analysis/setup.py
--- a/yt/analysis_modules/star_analysis/setup.py
+++ b/yt/analysis_modules/star_analysis/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/star_analysis/sfr_spectrum.py
--- a/yt/analysis_modules/star_analysis/sfr_spectrum.py
+++ b/yt/analysis_modules/star_analysis/sfr_spectrum.py
@@ -18,7 +18,6 @@
 import numpy as np
 import h5py
 import math
-import itertools
 
 from yt.config import ytcfg
 from yt.extern.six.moves import zip as izip

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/sunrise_export/sunrise_exporter.py
--- a/yt/analysis_modules/sunrise_export/sunrise_exporter.py
+++ b/yt/analysis_modules/sunrise_export/sunrise_exporter.py
@@ -19,14 +19,17 @@
 except ImportError: 
     pass
 
+import os
 import time
 import numpy as np
-from yt.funcs import *
+
 import yt.utilities.lib.api as amr_utils
+
+from yt import add_field
+from yt.funcs import get_pbar, mylog
 from yt.utilities.physical_constants import \
     kpc_per_cm, \
     sec_per_year
-from yt.mods import *
 
 def export_to_sunrise(ds, fn, star_particle_type, fc, fwidth, ncells_wide=None,
         debug=False,dd=None,**kwargs):
@@ -492,7 +495,7 @@
     idxst = dd["particle_type"] == star_type
 
     #make sure we select more than a single particle
-    assert na.sum(idxst)>0
+    assert np.sum(idxst)>0
     if pos is None:
         pos = np.array([dd["particle_position_%s" % ax]
                         for ax in 'xyz']).transpose()
@@ -543,7 +546,7 @@
     
     #make sure we have nonzero particle number
     assert pd_table.data.shape[0]>0
-    return pd_table,na.sum(idx)
+    return pd_table,np.sum(idx)
 
 
 def add_fields():
@@ -559,12 +562,8 @@
         # SFR in a cell. This assumes stars were created by the Cen & Ostriker algorithm
         # Check Grid_AddToDiskProfile.C and star_maker7.src
         star_mass_ejection_fraction = data.ds.get_parameter("StarMassEjectionFraction",float)
-        star_maker_minimum_dynamical_time = 3e6 # years, which will get divided out
-        dtForSFR = star_maker_minimum_dynamical_time / data.ds["years"]
         xv1 = ((data.ds["InitialTime"] - data["creation_time"])
                 / data["dynamical_time"])
-        xv2 = ((data.ds["InitialTime"] + dtForSFR - data["creation_time"])
-                / data["dynamical_time"])
         denom = (1.0 - star_mass_ejection_fraction * (1.0 - (1.0 + xv1)*np.exp(-xv1)))
         minitial = data["ParticleMassMsun"] / denom
         return minitial

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/sunyaev_zeldovich/setup.py
--- a/yt/analysis_modules/sunyaev_zeldovich/setup.py
+++ b/yt/analysis_modules/sunyaev_zeldovich/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/sunyaev_zeldovich/tests/test_projection.py
--- a/yt/analysis_modules/sunyaev_zeldovich/tests/test_projection.py
+++ b/yt/analysis_modules/sunyaev_zeldovich/tests/test_projection.py
@@ -11,12 +11,12 @@
 #-----------------------------------------------------------------------------
 
 from yt.frontends.stream.api import load_uniform_grid
-from yt.funcs import get_pbar, mylog
+from yt.funcs import get_pbar
 from yt.utilities.physical_constants import cm_per_kpc, K_per_keV, \
-     mh, cm_per_km, kboltz, Tcmb, hcgs, clight, sigma_thompson
-from yt.testing import *
+    mh, cm_per_km, kboltz, Tcmb, hcgs, clight, sigma_thompson
+from yt.testing import requires_module, assert_almost_equal
 from yt.utilities.answer_testing.framework import requires_ds, \
-     GenericArrayTest, data_dir_load, GenericImageTest
+    GenericArrayTest, data_dir_load, GenericImageTest
 try:
     from yt.analysis_modules.sunyaev_zeldovich.projection import SZProjection, I0
 except ImportError:

diff -r deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/two_point_functions/setup.py
--- a/yt/analysis_modules/two_point_functions/setup.py
+++ b/yt/analysis_modules/two_point_functions/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 deeb92e93357a433dd56e83a339a2192ca42e9e1 -r 4bfdb0ddccdb3bad26724484a89149b5a7ecfe51 yt/analysis_modules/two_point_functions/two_point_functions.py
--- a/yt/analysis_modules/two_point_functions/two_point_functions.py
+++ b/yt/analysis_modules/two_point_functions/two_point_functions.py
@@ -14,17 +14,19 @@
 #-----------------------------------------------------------------------------
 
 import h5py
-from yt.mods import *
-#from yt.utilities.math_utils import *
-from yt.utilities.performance_counters import yt_counters, time_function
+import numpy as np
+
+from yt.funcs import mylog
+from yt.utilities.performance_counters import yt_counters
 from yt.utilities.parallel_tools.parallel_analysis_interface import ParallelAnalysisInterface, parallel_blocking_call, parallel_root_only
 
 try:
-    from yt.utilities.kdtree.api import *
+    from yt.utilities.kdtree.api import \
+        fKD, free_tree, create_tree
 except ImportError:
     mylog.debug("The Fortran kD-Tree did not import correctly.")
 
-import math, sys, itertools, inspect, types, time
+import math, inspect, time
 from collections import defaultdict
 
 sep = 12
@@ -117,7 +119,7 @@
         self.index = ds.index
         self.center = (ds.domain_right_edge + ds.domain_left_edge)/2.0
         # Figure out the range of ruler lengths.
-        if length_range == None:
+        if length_range is None:
             length_range = [math.sqrt(3) * self.ds.index.get_smallest_dx(),
                 self.min_edge/2.]
         else:
@@ -679,7 +681,7 @@
         """
         for fset in self._fsets:
             # Only operate on correlation functions.
-            if fset.corr_norm == None: continue
+            if fset.corr_norm is None: continue
             fp = self.comm.write_on_root("%s_correlation.txt" % fset.function.__name__)
             line = "# length".ljust(sep)
             line += "\\xi".ljust(sep)

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