[yt-svn] commit/yt: brittonsmith: Merged in ngoldbaum/yt (pull request #1762)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Oct 12 11:30:00 PDT 2015
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/03e316bc6fdd/
Changeset: 03e316bc6fdd
Branch: yt
User: brittonsmith
Date: 2015-10-12 18:29:43+00:00
Summary: Merged in ngoldbaum/yt (pull request #1762)
Linting yt.frontends
Affected #: 112 files
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d doc/source/reference/api/api.rst
--- a/doc/source/reference/api/api.rst
+++ b/doc/source/reference/api/api.rst
@@ -211,8 +211,6 @@
~yt.frontends.boxlib.data_structures.OrionDataset
~yt.frontends.boxlib.fields.BoxlibFieldInfo
~yt.frontends.boxlib.io.IOHandlerBoxlib
- ~yt.frontends.boxlib.io.IOHandlerCastro
- ~yt.frontends.boxlib.io.IOHandlerNyx
~yt.frontends.boxlib.io.IOHandlerOrion
Chombo
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/_skeleton/data_structures.py
--- a/yt/frontends/_skeleton/data_structures.py
+++ b/yt/frontends/_skeleton/data_structures.py
@@ -13,6 +13,8 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+import os
+
from yt.data_objects.grid_patch import \
AMRGridPatch
from yt.geometry.grid_geometry_handler import \
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/_skeleton/fields.py
--- a/yt/frontends/_skeleton/fields.py
+++ b/yt/frontends/_skeleton/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.funcs import mylog
from yt.fields.field_info_container import \
FieldInfoContainer
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/_skeleton/setup.py
--- a/yt/frontends/_skeleton/setup.py
+++ b/yt/frontends/_skeleton/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 b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/art/data_structures.py
--- a/yt/frontends/art/data_structures.py
+++ b/yt/frontends/art/data_structures.py
@@ -9,48 +9,47 @@
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+import glob
import numpy as np
import os
import stat
+import struct
import weakref
-from yt.extern.six.moves import cStringIO
-import difflib
-import glob
-from yt.funcs import *
from yt.geometry.oct_geometry_handler import \
OctreeIndex
from yt.geometry.geometry_handler import \
- Index, YTDataChunk
+ YTDataChunk
from yt.data_objects.static_output import \
Dataset, ParticleFile
from yt.data_objects.octree_subset import \
OctreeSubset
+from yt.funcs import \
+ mylog
from yt.geometry.oct_container import \
ARTOctreeContainer
-from .fields import ARTFieldInfo
-from yt.utilities.io_handler import \
- io_registry
-from yt.utilities.lib.misc_utilities import \
- get_box_grids_level
+from yt.frontends.art.definitions import \
+ fluid_fields, \
+ particle_fields, \
+ filename_pattern, \
+ particle_header_struct, \
+ amr_header_struct, \
+ dmparticle_header_struct, \
+ constants, \
+ seek_extras
+from yt.frontends.art.fields import ARTFieldInfo
from yt.data_objects.particle_unions import \
ParticleUnion
from yt.geometry.particle_geometry_handler import \
ParticleIndex
-from yt.utilities.lib.geometry_utils import compute_morton
-from yt.frontends.art.definitions import *
import yt.utilities.fortran_utils as fpu
-from .io import _read_art_level_info
-from .io import _read_child_level
-from .io import _read_root_level
-from .io import b2t
-from .io import a2b
-
-from yt.utilities.io_handler import \
- io_registry
-from yt.fields.field_info_container import \
- FieldInfoContainer, NullFunc
+from yt.frontends.art.io import \
+ _read_art_level_info, \
+ _read_child_level, \
+ _read_root_level, \
+ b2t, \
+ a2b
class ARTIndex(OctreeIndex):
@@ -181,8 +180,6 @@
self.max_level = limit_level
self.force_max_level = force_max_level
self.spread_age = spread_age
- self.domain_left_edge = np.zeros(3, dtype='float')
- self.domain_right_edge = np.zeros(3, dtype='float')+1.0
Dataset.__init__(self, filename, dataset_type,
units_override=units_override)
self.storage_filename = storage_filename
@@ -231,7 +228,6 @@
aexpn = self.parameters["aexpn"]
# all other units
- wmu = self.parameters["wmu"]
Om0 = self.parameters['Om0']
ng = self.parameters['ng']
boxh = self.parameters['boxh']
@@ -255,6 +251,8 @@
"""
Get the various simulation parameters & constants.
"""
+ self.domain_left_edge = np.zeros(3, dtype='float')
+ self.domain_right_edge = np.zeros(3, dtype='float')+1.0
self.dimensionality = 3
self.refine_by = 2
self.periodicity = (True, True, True)
@@ -268,7 +266,7 @@
with open(self._file_amr, 'rb') as f:
amr_header_vals = fpu.read_attrs(f, amr_header_struct, '>')
for to_skip in ['tl', 'dtl', 'tlold', 'dtlold', 'iSO']:
- skipped = fpu.skip(f, endian='>')
+ fpu.skip(f, endian='>')
(self.ncell) = fpu.read_vector(f, 'i', '>')[0]
# Try to figure out the root grid dimensions
est = int(np.rint(self.ncell**(1.0/3.0)))
@@ -383,7 +381,7 @@
return False
with open(f, 'rb') as fh:
try:
- amr_header_vals = fpu.read_attrs(fh, amr_header_struct, '>')
+ fpu.read_attrs(fh, amr_header_struct, '>')
return True
except:
return False
@@ -425,8 +423,6 @@
self.parameter_filename = filename
self.skip_stars = skip_stars
self.spread_age = spread_age
- self.domain_left_edge = np.zeros(3, dtype='float')
- self.domain_right_edge = np.zeros(3, dtype='float')+1.0
Dataset.__init__(self, filename, dataset_type)
self.storage_filename = storage_filename
@@ -470,7 +466,6 @@
aexpn = self.parameters["aexpn"]
# all other units
- wmu = self.parameters["wmu"]
Om0 = self.parameters['Om0']
ng = self.parameters['ng']
boxh = self.parameters['boxh']
@@ -494,6 +489,8 @@
"""
Get the various simulation parameters & constants.
"""
+ self.domain_left_edge = np.zeros(3, dtype='float')
+ self.domain_right_edge = np.zeros(3, dtype='float')+1.0
self.dimensionality = 3
self.refine_by = 2
self.periodicity = (True, True, True)
@@ -633,32 +630,32 @@
try:
seek = 4
fh.seek(seek)
- headerstr = np.fromfile(fh, count=1, dtype=(str,45))
- aexpn = np.fromfile(fh, count=1, dtype='>f4')
- aexp0 = np.fromfile(fh, count=1, dtype='>f4')
- amplt = np.fromfile(fh, count=1, dtype='>f4')
- astep = np.fromfile(fh, count=1, dtype='>f4')
- istep = np.fromfile(fh, count=1, dtype='>i4')
- partw = np.fromfile(fh, count=1, dtype='>f4')
- tintg = np.fromfile(fh, count=1, dtype='>f4')
- ekin = np.fromfile(fh, count=1, dtype='>f4')
- ekin1 = np.fromfile(fh, count=1, dtype='>f4')
- ekin2 = np.fromfile(fh, count=1, dtype='>f4')
- au0 = np.fromfile(fh, count=1, dtype='>f4')
- aeu0 = np.fromfile(fh, count=1, dtype='>f4')
- nrowc = np.fromfile(fh, count=1, dtype='>i4')
- ngridc = np.fromfile(fh, count=1, dtype='>i4')
- nspecs = np.fromfile(fh, count=1, dtype='>i4')
- nseed = np.fromfile(fh, count=1, dtype='>i4')
- Om0 = np.fromfile(fh, count=1, dtype='>f4')
- Oml0 = np.fromfile(fh, count=1, dtype='>f4')
- hubble = np.fromfile(fh, count=1, dtype='>f4')
- Wp5 = np.fromfile(fh, count=1, dtype='>f4')
- Ocurv = np.fromfile(fh, count=1, dtype='>f4')
- wspecies = np.fromfile(fh, count=10, dtype='>f4')
- lspecies = np.fromfile(fh, count=10, dtype='>i4')
- extras = np.fromfile(fh, count=79, dtype='>f4')
- boxsize = np.fromfile(fh, count=1, dtype='>f4')
+ headerstr = np.fromfile(fh, count=1, dtype=(str,45)) # NOQA
+ aexpn = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ aexp0 = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ amplt = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ astep = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ istep = np.fromfile(fh, count=1, dtype='>i4') # NOQA
+ partw = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ tintg = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ ekin = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ ekin1 = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ ekin2 = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ au0 = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ aeu0 = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ nrowc = np.fromfile(fh, count=1, dtype='>i4') # NOQA
+ ngridc = np.fromfile(fh, count=1, dtype='>i4') # NOQA
+ nspecs = np.fromfile(fh, count=1, dtype='>i4') # NOQA
+ nseed = np.fromfile(fh, count=1, dtype='>i4') # NOQA
+ Om0 = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ Oml0 = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ hubble = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ Wp5 = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ Ocurv = np.fromfile(fh, count=1, dtype='>f4') # NOQA
+ wspecies = np.fromfile(fh, count=10, dtype='>f4') # NOQA
+ lspecies = np.fromfile(fh, count=10, dtype='>i4') # NOQA
+ extras = np.fromfile(fh, count=79, dtype='>f4') # NOQA
+ boxsize = np.fromfile(fh, count=1, dtype='>f4') # NOQA
return True
except:
return False
@@ -702,7 +699,7 @@
oct_handler.fill_level(0, levels, cell_inds, file_inds, tr, source)
del source
# Now we continue with the additional levels.
- for level in range(1, self.ds.max_level + 1):
+ for level in range(1, self.ds.index.max_level + 1):
no = self.domain.level_count[level]
noct_range = [0, no]
source = _read_child_level(
@@ -789,9 +786,7 @@
Level[Lev], iNOLL[Lev], iHOLL[Lev] = fpu.read_vector(f, 'i', '>')
# print 'Level %i : '%Lev, iNOLL
# print 'offset after level record:',f.tell()
- iOct = iHOLL[Lev] - 1
nLevel = iNOLL[Lev]
- nLevCells = nLevel * nchild
ntot = ntot + nLevel
# Skip all the oct hierarchy data
@@ -834,11 +829,9 @@
def _read_amr_root(self, oct_handler):
self.level_offsets
- f = open(self.ds._file_amr, "rb")
# add the root *cell* not *oct* mesh
root_octs_side = self.ds.domain_dimensions[0]/2
NX = np.ones(3)*root_octs_side
- octs_side = NX*2 # Level == 0
LE = np.array([0.0, 0.0, 0.0], dtype='float64')
RE = np.array([1.0, 1.0, 1.0], dtype='float64')
root_dx = (RE - LE) / NX
@@ -849,7 +842,7 @@
LL[1]:RL[1]:NX[1]*1j,
LL[2]:RL[2]:NX[2]*1j]
root_fc = np.vstack([p.ravel() for p in root_fc]).T
- nocts_check = oct_handler.add(self.domain_id, 0, root_fc)
+ oct_handler.add(self.domain_id, 0, root_fc)
assert(oct_handler.nocts == root_fc.shape[0])
mylog.debug("Added %07i octs on level %02i, cumulative is %07i",
root_octs_side**3, 0, oct_handler.nocts)
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/art/fields.py
--- a/yt/frontends/art/fields.py
+++ b/yt/frontends/art/fields.py
@@ -13,13 +13,8 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import numpy as np
-
from yt.fields.field_info_container import \
FieldInfoContainer
-from yt.units.yt_array import \
- YTArray
-from yt.frontends.art.definitions import *
b_units = "code_magnetic"
ra_units = "code_length / code_time**2"
@@ -68,7 +63,7 @@
tr *= data.ds.parameters['wmu'] * data.ds.parameters['Om0']
tr *= (data.ds.parameters['gamma'] - 1.)
tr /= data.ds.parameters['aexpn']**2
- return tr * data['art', 'GasEnergy'] / data['art', 'Density']
+ return tr * data['art', 'GasEnergy'] / data['art', 'Density']
self.add_field(('gas', 'temperature'),
function=_temperature,
units='K')
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/art/io.py
--- a/yt/frontends/art/io.py
+++ b/yt/frontends/art/io.py
@@ -15,24 +15,30 @@
import numpy as np
-import struct
import os
import os.path
import sys
+
+from collections import defaultdict
+
if sys.version_info >= (3,0,0):
long = int
-
-from yt.funcs import *
+
+from yt.frontends.art.definitions import \
+ particle_star_fields, \
+ particle_fields, \
+ star_struct, \
+ hydro_struct
from yt.utilities.io_handler import \
BaseIOHandler
-from yt.utilities.fortran_utils import *
from yt.utilities.logger import ytLogger as mylog
-from yt.frontends.art.definitions import *
-from yt.utilities.physical_constants import sec_per_year
from yt.utilities.lib.geometry_utils import compute_morton
-from yt.geometry.oct_container import _ORDER_MAX
-from yt.units.yt_array import YTQuantity
-
+from yt.utilities.fortran_utils import \
+ read_vector, \
+ skip
+from yt.units.yt_array import \
+ YTQuantity, \
+ YTArray
class IOHandlerART(BaseIOHandler):
_dataset_type = "art"
@@ -80,7 +86,6 @@
key = (selector, ftype)
if key in self.masks.keys() and self.caching:
return self.masks[key]
- ds = self.ds
pstr = 'particle_position_%s'
x,y,z = [self._get_field((ftype, pstr % ax)) for ax in 'xyz']
mask = selector.select_points(x, y, z, 0.0)
@@ -120,7 +125,7 @@
tr = {}
ftype, fname = field
ptmax = self.ws[-1]
- pbool, idxa, idxb = _determine_field_size(self.ds, ftype,
+ pbool, idxa, idxb = _determine_field_size(self.ds, ftype,
self.ls, ptmax)
npa = idxb - idxa
sizes = np.diff(np.concatenate(([0], self.ls)))
@@ -178,7 +183,7 @@
# dark_matter -- stars are regular matter.
tr[field] /= self.ds.domain_dimensions.prod()
if tr == {}:
- tr = dict((f, np.array([])) for f in fields)
+ tr = dict((f, np.array([])) for f in [field])
if self.caching:
self.cache[field] = tr[field]
return self.cache[field]
@@ -195,7 +200,6 @@
count = data_file.ds.parameters['lspecies'][-1]
DLE = data_file.ds.domain_left_edge
DRE = data_file.ds.domain_right_edge
- dx = (DRE - DLE) / 2**_ORDER_MAX
with open(data_file.filename, "rb") as f:
# The first total_particles * 3 values are positions
pp = np.fromfile(f, dtype = '>f4', count = totcount*3)
@@ -209,7 +213,6 @@
def _identify_fields(self, domain):
field_list = []
- tp = domain.total_particles
self.particle_field_list = [f for f in particle_fields]
for ptype in self.ds.particle_types_raw:
for pfield in self.particle_field_list:
@@ -225,7 +228,7 @@
tr = {}
ftype, fname = field
ptmax = self.ws[-1]
- pbool, idxa, idxb = _determine_field_size(self.ds, ftype,
+ pbool, idxa, idxb = _determine_field_size(self.ds, ftype,
self.ls, ptmax)
npa = idxb - idxa
sizes = np.diff(np.concatenate(([0], self.ls)))
@@ -258,17 +261,6 @@
data[a: a + size] = i
a += size
tr[field] = data
- if fname == "particle_creation_time":
- self.tb, self.ages, data = interpolate_ages(
- tr[field][-nstars:],
- self.file_stars,
- self.tb,
- self.ages,
- self.ds.current_time)
- temp = tr.get(field, np.zeros(npa, 'f8'))
- temp[-nstars:] = data
- tr[field] = temp
- del data
# We check again, after it's been filled
if fname.startswith("particle_mass"):
# We now divide by NGrid in order to make this match up. Note that
@@ -356,7 +348,6 @@
# ioct always represents the index of the next variable
# not the current, so shift forward one index
# the last index isn't used
- ioctso = iocts.copy()
iocts[1:] = iocts[:-1] # shift
iocts = iocts[:nLevel] # chop off the last, unused, index
iocts[0] = iOct # starting value
@@ -400,11 +391,11 @@
# Posy = d_x * (iOctPs(2,iO) + sign ( id , idelta(j,2) ))
# Posz = d_x * (iOctPs(3,iO) + sign ( id , idelta(j,3) ))
# idelta = [[-1, 1, -1, 1, -1, 1, -1, 1],
- #[-1, -1, 1, 1, -1, -1, 1, 1],
- #[-1, -1, -1, -1, 1, 1, 1, 1]]
+ # [-1, -1, 1, 1, -1, -1, 1, 1],
+ # [-1, -1, -1, -1, 1, 1, 1, 1]]
# idelta = np.array(idelta)
# if ncell0 is None:
- # ncell0 = coarse_grid**3
+ # ncell0 = coarse_grid**3
# nchild = 8
# ndim = 3
# nshift = nchild -1
@@ -424,15 +415,13 @@
f.seek(pos)
return unitary_center, fl, iocts, nLevel, root_level
-def get_ranges(skip, count, field, words=6, real_size=4, np_per_page=4096**2,
+def get_ranges(skip, count, field, words=6, real_size=4, np_per_page=4096**2,
num_pages=1):
#translate every particle index into a file position ranges
ranges = []
arr_size = np_per_page * real_size
- page_size = words * np_per_page * real_size
idxa, idxb = 0, 0
posa, posb = 0, 0
- left = count
for page in range(num_pages):
idxb += np_per_page
for i, fname in enumerate(['x', 'y', 'z', 'vx', 'vy', 'vz']):
@@ -462,7 +451,7 @@
num_pages = os.path.getsize(file)/(real_size*words*np_per_page)
fh = open(file, 'r')
skip, count = idxa, idxb - idxa
- kwargs = dict(words=words, real_size=real_size,
+ kwargs = dict(words=words, real_size=real_size,
np_per_page=np_per_page, num_pages=num_pages)
arrs = []
for field in fields:
@@ -495,7 +484,6 @@
def _read_child_mask_level(f, level_child_offsets, level, nLevel, nhydro_vars):
f.seek(level_child_offsets[level])
- nvals = nLevel * (nhydro_vars + 6) # 2 vars, 2 pads
ioctch = np.zeros(nLevel, dtype='uint8')
idc = np.zeros(nLevel, dtype='int32')
@@ -639,8 +627,6 @@
return a2t(b2a(tb))
if len(tb) < n:
n = len(tb)
- age_min = a2t(b2a(tb.max(), **kwargs), **kwargs)
- age_max = a2t(b2a(tb.min(), **kwargs), **kwargs)
tbs = -1.*np.logspace(np.log10(-tb.min()),
np.log10(-tb.max()), n)
ages = []
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/art/setup.py
--- a/yt/frontends/art/setup.py
+++ b/yt/frontends/art/setup.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python
-import setuptools
-import os, sys, os.path
+
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/art/tests/test_outputs.py
--- a/yt/frontends/art/tests/test_outputs.py
+++ b/yt/frontends/art/tests/test_outputs.py
@@ -17,49 +17,60 @@
from yt.testing import \
requires_file, \
assert_equal, \
- units_override_check
+ units_override_check, \
+ assert_almost_equal
+from yt.units.yt_array import \
+ YTQuantity
from yt.utilities.answer_testing.framework import \
requires_ds, \
- big_patch_amr, \
+ FieldValuesTest, \
PixelizedProjectionValuesTest, \
data_dir_load
from yt.frontends.art.api import ARTDataset
-_fields = ("density", "temperature", "particle_mass", ("all", "particle_position_x"))
+_fields = (
+ ("gas", "density"),
+ ("gas", "temperature"),
+ ("all", "particle_mass"),
+ ("all", "particle_position_x")
+)
d9p = "D9p_500/10MpcBox_HartGal_csf_a0.500.d"
@requires_ds(d9p, big_data=True)
def test_d9p():
ds = data_dir_load(d9p)
+ ds.index
yield assert_equal, str(ds), "10MpcBox_HartGal_csf_a0.500.d"
- for test in big_patch_amr(d9p, _fields):
- test_d9p.__name__ = test.description
- yield test
dso = [None, ("sphere", ("max", (0.1, 'unitary')))]
for field in _fields:
for axis in [0, 1, 2]:
for dobj_name in dso:
for weight_field in [None, "density"]:
- yield PixelizedProjectionValuesTest(
- d9p, axis, field, weight_field,
- dobj_name)
-
+ if field[0] not in ds.particle_types:
+ yield PixelizedProjectionValuesTest(
+ d9p, axis, field, weight_field,
+ dobj_name)
+ yield FieldValuesTest(d9p, field, dobj_name)
ad = ds.all_data()
# 'Ana' variable values output from the ART Fortran 'ANA' analysis code
AnaNStars = 6255
- yield assert_equal, ad[('stars','particle_type')].size, AnaNStars
+ yield assert_equal, ad[('stars', 'particle_type')].size, AnaNStars
yield assert_equal, ad[('specie4', 'particle_type')].size, AnaNStars
- AnaNDM = 2833405
- yield assert_equal, ad[('darkmatter','particle_type')].size, AnaNDM
- yield assert_equal, ad[('specie0', 'particle_type')].size + \
- ad[('specie1', 'particle_type')].size + \
- ad[('specie2', 'particle_type')].size + \
- ad[('specie3', 'particle_type')].size, AnaNDM
- AnaBoxSize = yt.units.yt_array.YTQuantity(7.1442196564,'Mpc')
- AnaVolume = yt.units.yt_array.YTQuantity(364.640074656,'Mpc**3')
+ # The *real* asnwer is 2833405, but yt misses one particle since it lives
+ # on a domain boundary. See issue 814. When that is fixed, this test
+ # will need to be updated
+ AnaNDM = 2833404
+ yield assert_equal, ad[('darkmatter', 'particle_type')].size, AnaNDM
+ yield assert_equal, (ad[('specie0', 'particle_type')].size +
+ ad[('specie1', 'particle_type')].size +
+ ad[('specie2', 'particle_type')].size +
+ ad[('specie3', 'particle_type')].size), AnaNDM
+
+ AnaBoxSize = YTQuantity(7.1442196564, 'Mpc')
+ AnaVolume = YTQuantity(364.640074656, 'Mpc**3')
Volume = 1
for i in ds.domain_width.in_units('Mpc'):
yield assert_almost_equal, i, AnaBoxSize
@@ -67,26 +78,29 @@
yield assert_almost_equal, Volume, AnaVolume
AnaNCells = 4087490
- yield assert_equal, len(ad[('index','cell_volume')]), AnaNCells
+ yield assert_equal, len(ad[('index', 'cell_volume')]), AnaNCells
- AnaTotDMMass = yt.units.yt_array.YTQuantity(1.01191786811e+14,'Msun')
- yield assert_almost_equal, ad[('darkmatter','particle_mass')].sum()\
- .in_units('Msun'), AnaTotDMMass
+ AnaTotDMMass = YTQuantity(1.01191786808255e+14, 'Msun')
+ yield (assert_almost_equal,
+ ad[('darkmatter', 'particle_mass')].sum().in_units('Msun'),
+ AnaTotDMMass)
- AnaTotStarMass = yt.units.yt_array.YTQuantity(1776251.,'Msun')
- yield assert_almost_equal, ad[('stars','particle_mass')].sum()\
- .in_units('Msun'), AnaTotStarMass
+ AnaTotStarMass = YTQuantity(1776701.3990607238, 'Msun')
+ yield (assert_almost_equal,
+ ad[('stars', 'particle_mass')].sum().in_units('Msun'),
+ AnaTotStarMass)
- AnaTotStarMassInitial = yt.units.yt_array.YTQuantity(2422854.,'Msun')
- yield assert_almost_equal, ad[('stars','particle_mass_initial')].sum()\
- .in_units('Msun'), AnaTotStarMass
+ AnaTotStarMassInitial = YTQuantity(2423468.2801332865, 'Msun')
+ yield (assert_almost_equal,
+ ad[('stars', 'particle_mass_initial')].sum().in_units('Msun'),
+ AnaTotStarMassInitial)
- AnaTotGasMass = yt.units.yt_array.YTQuantity(1.781994e+13,'Msun')
- yield assert_almost_equal, ad[('gas','cell_mass')].sum()\
- .in_units('Msun'), AnaTotGasMass
+ AnaTotGasMass = YTQuantity(1.7826982029216785e+13, 'Msun')
+ yield (assert_almost_equal, ad[('gas', 'cell_mass')].sum().in_units('Msun'),
+ AnaTotGasMass)
- AnaTotTemp = yt.units.yt_array.YTQuantity(1.5019e11, 'K') #just leaves
- yield assert_equal, ad[('gas','temperature')].sum(), AnaTotTemp
+ AnaTotTemp = YTQuantity(150219844793.39072, 'K') # just leaves
+ yield assert_equal, ad[('gas', 'temperature')].sum(), AnaTotTemp
@requires_file(d9p)
@@ -97,4 +111,3 @@
def test_units_override():
for test in units_override_check(d9p):
yield test
-
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/artio/data_structures.py
--- a/yt/frontends/artio/data_structures.py
+++ b/yt/frontends/artio/data_structures.py
@@ -13,26 +13,27 @@
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+
import numpy as np
+import os
import stat
import weakref
-from yt.extern.six.moves import cStringIO
-from .definitions import ARTIOconstants
-from ._artio_caller import \
- artio_is_valid, artio_fileset, ARTIOOctreeContainer, \
- ARTIORootMeshContainer, ARTIOSFCRangeHandler
-from . import _artio_caller
-from yt.utilities.definitions import \
- mpc_conversion, sec_conversion
-from .fields import \
+from collections import defaultdict
+
+from yt.frontends.artio._artio_caller import \
+ artio_is_valid, \
+ artio_fileset, \
+ ARTIOSFCRangeHandler
+from yt.frontends.artio import _artio_caller
+from yt.frontends.artio.fields import \
ARTIOFieldInfo
-from yt.fields.particle_fields import \
- standard_particle_fields
-from yt.funcs import *
+from yt.funcs import \
+ mylog
from yt.geometry.geometry_handler import \
- Index, YTDataChunk
+ Index, \
+ YTDataChunk
import yt.geometry.particle_deposit as particle_deposit
from yt.data_objects.static_output import \
Dataset
@@ -40,9 +41,8 @@
OctreeSubset
from yt.data_objects.data_containers import \
YTFieldData
-
-from yt.fields.field_info_container import \
- FieldInfoContainer, NullFunc
+from yt.utilities.exceptions import \
+ YTParticleDepositionNotImplemented
class ARTIOOctreeSubset(OctreeSubset):
_domain_offset = 0
@@ -346,7 +346,6 @@
# hard-coded -- not provided by headers
self.dimensionality = 3
self.refine_by = 2
- print(self.parameters)
self.parameters["HydroMethod"] = 'artio'
self.parameters["Time"] = 1. # default unit is 1...
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/artio/fields.py
--- a/yt/frontends/artio/fields.py
+++ b/yt/frontends/artio/fields.py
@@ -14,9 +14,6 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import numpy as np
-
-from yt.funcs import mylog
from yt.fields.field_info_container import \
FieldInfoContainer
from yt.fields.field_detector import \
@@ -25,8 +22,6 @@
YTArray
from yt.utilities.physical_constants import \
- mh, \
- mass_sun_cgs, \
boltzmann_constant_cgs, \
amu_cgs
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/artio/setup.py
--- a/yt/frontends/artio/setup.py
+++ b/yt/frontends/artio/setup.py
@@ -1,8 +1,4 @@
#!/usr/bin/env python
-import setuptools
-import os
-import sys
-import os.path
import glob
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/artio/tests/test_outputs.py
--- a/yt/frontends/artio/tests/test_outputs.py
+++ b/yt/frontends/artio/tests/test_outputs.py
@@ -14,7 +14,10 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.testing import *
+from yt.testing import \
+ assert_equal, \
+ requires_file, \
+ units_override_check
from yt.utilities.answer_testing.framework import \
requires_ds, \
data_dir_load, \
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/athena/data_structures.py
--- a/yt/frontends/athena/data_structures.py
+++ b/yt/frontends/athena/data_structures.py
@@ -13,25 +13,27 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.utilities.on_demand_imports import _h5py as h5py
import numpy as np
+import os
import weakref
-import glob #ST 9/12
-from yt.funcs import *
+import glob
+
+from yt.funcs import \
+ mylog, \
+ ensure_tuple
from yt.data_objects.grid_patch import \
- AMRGridPatch
+ AMRGridPatch
from yt.geometry.grid_geometry_handler import \
GridIndex
from yt.data_objects.static_output import \
- Dataset
+ Dataset
from yt.utilities.lib.misc_utilities import \
get_box_grids_level
from yt.geometry.geometry_handler import \
YTDataChunk
-from yt.extern.six import PY2, PY3
+from yt.extern.six import PY2
from .fields import AthenaFieldInfo
-from yt.units.yt_array import YTQuantity
from yt.utilities.decompose import \
decompose_array, get_psize
@@ -75,9 +77,9 @@
class AthenaGrid(AMRGridPatch):
_id_offset = 0
+
def __init__(self, id, index, level, start, dimensions,
file_offset, read_dims):
- df = index.dataset.filename[4:-4]
gname = index.grid_filenames[id]
AMRGridPatch.__init__(self, id, filename = gname,
index = index)
@@ -224,7 +226,6 @@
grid = {}
grid['read_field'] = None
grid['read_type'] = None
- table_read=False
line = f.readline()
while grid['read_field'] is None:
parse_line(line, grid)
@@ -270,7 +271,6 @@
gridread = {}
gridread['read_field'] = None
gridread['read_type'] = None
- table_read=False
line = f.readline()
while gridread['read_field'] is None:
parse_line(line, gridread)
@@ -421,8 +421,6 @@
self.grid_levels[i] + 1,
self.grid_left_edge, self.grid_right_edge,
self.grid_levels, mask)
- #ids = np.where(mask.astype("bool")) # where is a tuple
- #mask[ids] = True
grid.Children = [g for g in self.grids[mask.astype("bool")] if g.Level == grid.Level + 1]
mylog.debug("Second pass; identifying parents")
for i, grid in enumerate(self.grids): # Second pass
@@ -436,7 +434,6 @@
return [g for g in self.grids[mask] if g.Level == grid.Level + 1]
def _chunk_io(self, dobj, cache = True, local_only = False):
- gfiles = defaultdict(list)
gobjs = getattr(dobj._current_chunk, "objs", dobj._chunk_info)
for subset in gobjs:
yield YTDataChunk(dobj, "io", [subset],
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/athena/fields.py
--- a/yt/frontends/athena/fields.py
+++ b/yt/frontends/athena/fields.py
@@ -13,12 +13,10 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import numpy as np
from yt.fields.field_info_container import \
FieldInfoContainer
from yt.utilities.physical_constants import \
- kboltz,mh
-from yt.units.yt_array import YTArray
+ kboltz, mh
b_units = "code_magnetic"
pres_units = "code_mass/(code_length*code_time**2)"
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/athena/io.py
--- a/yt/frontends/athena/io.py
+++ b/yt/frontends/athena/io.py
@@ -12,10 +12,11 @@
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+
from yt.utilities.io_handler import \
- BaseIOHandler
+ BaseIOHandler
import numpy as np
-from yt.funcs import mylog, defaultdict
+from yt.funcs import mylog
from .data_structures import chk23
float_size = {"float":np.dtype(">f4").itemsize,
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/athena/setup.py
--- a/yt/frontends/athena/setup.py
+++ b/yt/frontends/athena/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 b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/athena/tests/test_outputs.py
--- a/yt/frontends/athena/tests/test_outputs.py
+++ b/yt/frontends/athena/tests/test_outputs.py
@@ -13,11 +13,13 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.testing import *
+from yt.testing import \
+ assert_equal, \
+ requires_file, \
+ assert_allclose_units
from yt.utilities.answer_testing.framework import \
requires_ds, \
small_patch_amr, \
- big_patch_amr, \
data_dir_load
from yt.frontends.athena.api import AthenaDataset
from yt.config import ytcfg
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/boxlib/data_structures.py
--- a/yt/frontends/boxlib/data_structures.py
+++ b/yt/frontends/boxlib/data_structures.py
@@ -13,6 +13,7 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+import inspect
import os
import re
@@ -20,7 +21,9 @@
import numpy as np
-from yt.funcs import *
+from yt.funcs import \
+ mylog, \
+ ensure_tuple
from yt.data_objects.grid_patch import AMRGridPatch
from yt.extern.six.moves import zip as izip
from yt.geometry.grid_geometry_handler import GridIndex
@@ -188,7 +191,7 @@
vals = next(header_file).split()
lev, ngrids = int(vals[0]), int(vals[1])
assert(lev == level)
- nsteps = int(next(header_file))
+ nsteps = int(next(header_file)) # NOQA
for gi in range(ngrids):
xlo, xhi = [float(v) for v in next(header_file).split()]
if self.dimensionality > 1:
@@ -211,7 +214,7 @@
next(level_header_file)
next(level_header_file)
# Now we get the number of components
- ncomp_this_file = int(next(level_header_file))
+ ncomp_this_file = int(next(level_header_file)) # NOQA
# Skip the next line, which contains the number of ghost zones
next(level_header_file)
# To decipher this next line, we expect something like:
@@ -889,15 +892,16 @@
['particle_velocity_%s' % ax for ax in 'xyz']:
self.field_list.append(("io", fn))
header = open(os.path.join(self.ds.output_dir, "DM", "Header"))
- version = header.readline()
- ndim = header.readline()
- nfields = header.readline()
- ntotalpart = int(header.readline())
- dummy = header.readline() # nextid
- maxlevel = int(header.readline()) # max level
+ version = header.readline() # NOQA
+ ndim = header.readline() # NOQA
+ nfields = header.readline() # NOQA
+ ntotalpart = int(header.readline()) # NOQA
+ nextid = header.readline() # NOQA
+ maxlevel = int(header.readline()) # NOQA
# Skip over how many grids on each level; this is degenerate
- for i in range(maxlevel + 1): dummy = header.readline()
+ for i in range(maxlevel + 1):
+ header.readline()
grid_info = np.fromiter((int(i) for line in header.readlines()
for i in line.split()),
@@ -972,8 +976,9 @@
def _guess_pcast(vals):
# Now we guess some things about the parameter and its type
- v = vals.split()[0] # Just in case there are multiple; we'll go
- # back afterward to using vals.
+ # Just in case there are multiple; we'll go
+ # back afterward to using vals.
+ v = vals.split()[0]
try:
float(v.upper().replace("D", "E"))
except:
@@ -986,6 +991,7 @@
pcast = float
else:
pcast = int
- vals = [pcast(v) for v in vals.split()]
- if len(vals) == 1: vals = vals[0]
+ vals = [pcast(value) for value in vals.split()]
+ if len(vals) == 1:
+ vals = vals[0]
return vals
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/boxlib/definitions.py
--- a/yt/frontends/boxlib/definitions.py
+++ b/yt/frontends/boxlib/definitions.py
@@ -12,7 +12,7 @@
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.funcs import *
+
# TODO: get rid of enzo parameters we do not need
parameterDict = {"CosmologyCurrentRedshift": float,
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/boxlib/fields.py
--- a/yt/frontends/boxlib/fields.py
+++ b/yt/frontends/boxlib/fields.py
@@ -184,9 +184,10 @@
if field[3] in string.ascii_letters:
element, weight = field[2:4], field[4:-1]
else:
- element, weight = field[2:3], field[3:-1]
+ element, weight = field[2:3], field[3:-1] # NOQA
- # Here we can, later, add number density.
+ # Here we can, later, add number density
+ # right now element and weight inferred above are unused
class MaestroFieldInfo(FieldInfoContainer):
@@ -280,10 +281,12 @@
if field[3] in string.ascii_letters:
element, weight = field[2:4], field[4:-1]
else:
- element, weight = field[2:3], field[3:-1]
+ element, weight = field[2:3], field[3:-1] # NOQA
weight = int(weight)
- # Here we can, later, add number density.
+ # Here we can, later, add number density using 'element' and
+ # 'weight' inferred above
+
elif field.startswith("omegadot("):
nice_name, tex_label = _nice_species_name(field)
display_name = r'\dot{\omega}\left[%s\right]' % tex_label
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/boxlib/io.py
--- a/yt/frontends/boxlib/io.py
+++ b/yt/frontends/boxlib/io.py
@@ -15,10 +15,8 @@
import os
import numpy as np
-from yt.utilities.lib.fortran_reader import \
- read_castro_particles
from yt.utilities.io_handler import \
- BaseIOHandler
+ BaseIOHandler
from yt.funcs import mylog, defaultdict
from yt.frontends.chombo.io import parse_orion_sinks
@@ -156,37 +154,3 @@
line = lines[num]
particles.append(read(line, field))
return np.array(particles)
-
-
-class IOHandlerCastro(IOHandlerBoxlib):
- _dataset_type = "castro_native"
-
- def _read_particle_field(self, grid, field):
- offset = grid._particle_offset
- filen = os.path.expanduser(grid.particle_filename)
- off = grid._particle_offset
- tr = np.zeros(grid.NumberOfParticles, dtype='float64')
- read_castro_particles(filen, off,
- castro_particle_field_names.index(field),
- len(castro_particle_field_names),
- tr)
- return tr
-
-nyx_particle_field_names = ['particle_position_%s' % ax for ax in 'xyz'] + \
- ['particle_mass'] + \
- ['particle_velocity_%s' % ax for ax in 'xyz']
-
-class IOHandlerNyx(IOHandlerBoxlib):
- _dataset_type = "nyx_native"
-
- def _read_particle_coords(self, chunks, ptf):
- offset = grid._particle_offset
- filen = os.path.expanduser(grid.particle_filename)
- off = grid._particle_offset
- tr = np.zeros(grid.NumberOfParticles, dtype='float64')
- read_castro_particles(filen, off,
- nyx_particle_field_names.index(field),
- len(nyx_particle_field_names), tr)
-
- def _read_particle_fields(self, chunks, ptf, fields):
- pass
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/boxlib/setup.py
--- a/yt/frontends/boxlib/setup.py
+++ b/yt/frontends/boxlib/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 b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/boxlib/tests/test_orion.py
--- a/yt/frontends/boxlib/tests/test_orion.py
+++ b/yt/frontends/boxlib/tests/test_orion.py
@@ -13,11 +13,13 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.testing import *
+from yt.testing import \
+ assert_equal, \
+ requires_file, \
+ units_override_check
from yt.utilities.answer_testing.framework import \
requires_ds, \
small_patch_amr, \
- big_patch_amr, \
data_dir_load
from yt.frontends.boxlib.api import OrionDataset
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/chombo/data_structures.py
--- a/yt/frontends/chombo/data_structures.py
+++ b/yt/frontends/chombo/data_structures.py
@@ -19,10 +19,11 @@
import weakref
import numpy as np
+from six import string_types
from stat import \
ST_CTIME
-from yt.funcs import *
+from yt.funcs import mylog
from yt.data_objects.grid_patch import \
AMRGridPatch
from yt.extern import six
@@ -30,8 +31,6 @@
GridIndex
from yt.data_objects.static_output import \
Dataset
-from yt.utilities.definitions import \
- mpc_conversion, sec_conversion
from yt.utilities.file_handler import \
HDF5FileHandler
from yt.utilities.parallel_tools.parallel_analysis_interface import \
@@ -108,9 +107,10 @@
self.directory = ds.fullpath
self._handle = ds._handle
- tr = self._handle['Chombo_global'].attrs.get("testReal", "float32")
+ self._levels = [
+ key for key in self._handle.keys() if key.startswith('level')
+ ]
- self._levels = [key for key in self._handle.keys() if key.startswith('level')]
GridIndex.__init__(self, ds, dataset_type)
self._read_particles()
@@ -650,7 +650,7 @@
pluto_ini_file_exists = False
orion2_ini_file_exists = False
- if type(args[0]) == type(""):
+ if isinstance(args[0], string_types):
dir_name = os.path.dirname(os.path.abspath(args[0]))
pluto_ini_filename = os.path.join(dir_name, "pluto.ini")
orion2_ini_filename = os.path.join(dir_name, "orion2.ini")
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/chombo/io.py
--- a/yt/frontends/chombo/io.py
+++ b/yt/frontends/chombo/io.py
@@ -182,9 +182,9 @@
offsets = np.append(np.array([0]), offsets)
offsets = np.array(offsets, dtype=np.int64)
- # convert between the global grid id and the id on this level
+ # convert between the global grid id and the id on this level
grid_levels = np.array([g.Level for g in self.ds.index.grids])
- grid_ids = np.array([g.id for g in self.ds.index.grids])
+ grid_ids = np.array([g.id for g in self.ds.index.grids])
grid_level_offset = grid_ids[np.where(grid_levels == grid.Level)[0][0]]
lo = grid.id - grid_level_offset
hi = lo + 1
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/chombo/setup.py
--- a/yt/frontends/chombo/setup.py
+++ b/yt/frontends/chombo/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 b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/eagle/data_structures.py
--- a/yt/frontends/eagle/data_structures.py
+++ b/yt/frontends/eagle/data_structures.py
@@ -17,7 +17,6 @@
from yt.utilities.on_demand_imports import _h5py as h5py
import numpy as np
-import types
from yt.frontends.gadget.data_structures import \
GadgetHDF5Dataset
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/eagle/fields.py
--- a/yt/frontends/eagle/fields.py
+++ b/yt/frontends/eagle/fields.py
@@ -15,19 +15,12 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import os
-import numpy as np
-
-from yt.funcs import *
-
-from yt.fields.field_info_container import \
- FieldInfoContainer
from yt.frontends.owls.fields import \
OWLSFieldInfo
-import yt.frontends.owls.owls_ion_tables as oit
from yt.units.yt_array import YTQuantity
+from yt.utilities.periodic_table import periodic_table
-from .definitions import \
+from yt.frontends.eagle.definitions import \
eaglenetwork_ion_lookup
class EagleNetworkFieldInfo(OWLSFieldInfo):
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/eagle/setup.py
--- a/yt/frontends/eagle/setup.py
+++ b/yt/frontends/eagle/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 b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/eagle/tests/test_outputs.py
--- a/yt/frontends/eagle/tests/test_outputs.py
+++ b/yt/frontends/eagle/tests/test_outputs.py
@@ -17,7 +17,6 @@
from yt.testing import \
requires_file
from yt.utilities.answer_testing.framework import \
- requires_ds, \
data_dir_load
from yt.frontends.eagle.api import EagleDataset
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/enzo/answer_testing_support.py
--- a/yt/frontends/enzo/answer_testing_support.py
+++ b/yt/frontends/enzo/answer_testing_support.py
@@ -13,20 +13,22 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.testing import *
+import numpy as np
+import os
+
+from functools import wraps
+
from yt.config import ytcfg
-from yt.mods import *
-
+from yt.convenience import load
+from yt.testing import assert_allclose
from yt.utilities.answer_testing.framework import \
- AnswerTestingTest, \
- can_run_ds, \
- FieldValuesTest, \
- GridHierarchyTest, \
- GridValuesTest, \
- ProjectionValuesTest, \
- ParentageRelationshipsTest, \
- temp_cwd, \
- AssertWrapper
+ AnswerTestingTest, \
+ can_run_ds, \
+ FieldValuesTest, \
+ GridValuesTest, \
+ ProjectionValuesTest, \
+ temp_cwd, \
+ AssertWrapper
def requires_outputlog(path = ".", prefix = ""):
def ffalse(func):
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/enzo/data_structures.py
--- a/yt/frontends/enzo/data_structures.py
+++ b/yt/frontends/enzo/data_structures.py
@@ -19,13 +19,16 @@
import os
import stat
import string
+import time
import re
-from threading import Thread
-
+from collections import defaultdict
from yt.extern.six.moves import zip as izip
-from yt.funcs import *
+from yt.funcs import \
+ ensure_list, \
+ ensure_tuple, \
+ get_pbar
from yt.config import ytcfg
from yt.data_objects.grid_patch import \
AMRGridPatch
@@ -36,20 +39,15 @@
from yt.data_objects.static_output import \
Dataset
from yt.fields.field_info_container import \
- FieldInfoContainer, NullFunc
-from yt.utilities.definitions import \
- mpc_conversion, sec_conversion
+ NullFunc
from yt.utilities.physical_constants import \
rho_crit_g_cm3_h2, cm_per_mpc
-from yt.utilities.io_handler import io_registry
from yt.utilities.logger import ytLogger as mylog
from yt.utilities.pyparselibconfig import libconfig
from .fields import \
EnzoFieldInfo
-from yt.utilities.parallel_tools.parallel_analysis_interface import \
- parallel_blocking_call
class EnzoGrid(AMRGridPatch):
"""
@@ -77,7 +75,6 @@
"""
rf = self.ds.refine_by
my_ind = self.id - self._id_offset
- le = self.LeftEdge
self.dds = self.Parent.dds/rf
ParentLeftIndex = np.rint((self.LeftEdge-self.Parent.LeftEdge)/self.Parent.dds)
self.start_index = rf*(ParentLeftIndex + self.Parent.get_global_startindex()).astype('int64')
@@ -148,12 +145,9 @@
# We will attempt this by creating a datacube that is exactly bigger
# than the grid by nZones*dx in each direction
nl = self.get_global_startindex() - n_zones
- nr = nl + self.ActiveDimensions + 2*n_zones
new_left_edge = nl * self.dds + self.ds.domain_left_edge
- new_right_edge = nr * self.dds + self.ds.domain_left_edge
# Something different needs to be done for the root grid, though
level = self.Level
- args = (level, new_left_edge, new_right_edge)
kwargs = {'dims': self.ActiveDimensions + 2*n_zones,
'num_ghost_zones':n_zones,
'use_pbar':False}
@@ -197,7 +191,7 @@
def __init__(self, ds, dataset_type):
self.dataset_type = dataset_type
- if ds.file_style != None:
+ if ds.file_style is not None:
self._bn = ds.file_style
else:
self._bn = "%s.cpu%%04i"
@@ -268,14 +262,12 @@
for line in f:
if line.startswith(token):
return line.split()[2:]
- t1 = time.time()
pattern = r"Pointer: Grid\[(\d*)\]->NextGrid(Next|This)Level = (\d*)\s+$"
patt = re.compile(pattern)
f = open(self.index_filename, "rt")
self.grids = [self.grid(1, self)]
self.grids[0].Level = 0
si, ei, LE, RE, fn, npart = [], [], [], [], [], []
- all = [si, ei, LE, RE, fn]
pbar = get_pbar("Parsing Hierarchy ", self.num_grids)
version = self.dataset.parameters.get("VersionNumber", None)
params = self.dataset.parameters
@@ -326,7 +318,6 @@
temp_grids[:] = self.grids
self.grids = temp_grids
self.filenames = fn
- t2 = time.time()
def _initialize_grid_arrays(self):
super(EnzoHierarchy, self)._initialize_grid_arrays()
@@ -403,7 +394,7 @@
fields = []
for ptype in self.dataset["AppendActiveParticleType"]:
select_grids = self.grid_active_particle_count[ptype].flat
- if np.any(select_grids) == False:
+ if np.any(select_grids) is False:
current_ptypes = self.dataset.particle_types
new_ptypes = [p for p in current_ptypes if p != ptype]
self.dataset.particle_types = new_ptypes
@@ -1027,7 +1018,8 @@
self.hubble_constant = self.cosmological_simulation = 0.0
def _obtain_enzo(self):
- import enzo; return enzo
+ import enzo
+ return enzo
@classmethod
def _is_valid(cls, *args, **kwargs):
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -13,16 +13,11 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import numpy as np
-
-from yt.funcs import mylog
from yt.fields.field_info_container import \
FieldInfoContainer
-from yt.units.yt_array import \
- YTArray
from yt.utilities.physical_constants import \
- mh, me, mp, \
- mass_sun_cgs
+ me, \
+ mp
b_units = "code_magnetic"
ra_units = "code_length / code_time**2"
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/enzo/io.py
--- a/yt/frontends/enzo/io.py
+++ b/yt/frontends/enzo/io.py
@@ -13,19 +13,18 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import os
import random
from contextlib import contextmanager
from yt.utilities.io_handler import \
- BaseIOHandler, _axis_ids
+ BaseIOHandler
from yt.utilities.logger import ytLogger as mylog
-from yt.geometry.selection_routines import mask_fill, AlwaysSelector
+from yt.geometry.selection_routines import AlwaysSelector
from yt.extern.six import u, b, iteritems
from yt.utilities.on_demand_imports import _h5py as h5py
import numpy as np
-from yt.funcs import *
+
_convert_mass = ("particle_mass","mass")
@@ -305,7 +304,7 @@
_dataset_type = "enzo_packed_3d_gz"
def __init__(self, *args, **kwargs):
- super(IOHandlerPackgedHDF5GhostZones, self).__init__(*args, **kwargs)
+ super(IOHandlerPackedHDF5GhostZones, self).__init__(*args, **kwargs)
NGZ = self.ds.parameters.get("NumberOfGhostZones", 3)
self._base = (slice(NGZ, -NGZ),
slice(NGZ, -NGZ),
@@ -357,7 +356,8 @@
raise RuntimeError
g = chunks[0].objs[0]
for ftype, fname in fields:
- rv[(ftype, fname)] = self.grids_in_memory[grid.id][fname].swapaxes(0,2)
+ rv[(ftype, fname)] = \
+ self.grids_in_memory[g.id][fname].swapaxes(0, 2)
return rv
if size is None:
size = sum((g.count(selector) for chunk in chunks
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/enzo/setup.py
--- a/yt/frontends/enzo/setup.py
+++ b/yt/frontends/enzo/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 b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/enzo/simulation_handling.py
--- a/yt/frontends/enzo/simulation_handling.py
+++ b/yt/frontends/enzo/simulation_handling.py
@@ -17,6 +17,8 @@
import glob
import os
+from math import ceil
+
from yt.convenience import \
load, \
only_on_root
@@ -26,13 +28,14 @@
from yt.units.unit_registry import \
UnitRegistry
from yt.units.yt_array import \
- YTArray, YTQuantity
+ YTArray
from yt.utilities.cosmology import \
Cosmology
from yt.utilities.exceptions import \
InvalidSimulationTimeSeries, \
MissingParameter, \
- NoStoppingCondition
+ NoStoppingCondition, \
+ YTOutputNotIdentified
from yt.utilities.logger import ytLogger as \
mylog
from yt.utilities.parallel_tools.parallel_analysis_interface import \
@@ -385,7 +388,7 @@
'final_redshift': 'CosmologyFinalRedshift'}
self.cosmological_simulation = 1
for a, v in cosmo_attr.items():
- if not v in self.parameters:
+ if v not in self.parameters:
raise MissingParameter(self.parameter_filename, v)
setattr(self, a, self.parameters[v])
else:
@@ -412,7 +415,7 @@
self.all_time_outputs = []
if self.final_time is None or \
- not 'dtDataDump' in self.parameters or \
+ 'dtDataDump' not in self.parameters or \
self.parameters['dtDataDump'] <= 0.0: return []
index = 0
@@ -441,7 +444,7 @@
mylog.warn('Calculating cycle outputs. Dataset times will be unavailable.')
if self.stop_cycle is None or \
- not 'CycleSkipDataDump' in self.parameters or \
+ 'CycleSkipDataDump' not in self.parameters or \
self.parameters['CycleSkipDataDump'] <= 0.0: return []
self.all_time_outputs = []
@@ -623,7 +626,6 @@
mylog.info("Writing redshift output list to %s.", filename)
f = open(filename, 'w')
for q, output in enumerate(outputs):
- z_string = "%%s[%%d] = %%.%df" % decimals
f.write(("CosmologyOutputRedshift[%d] = %."
+ str(decimals) + "f\n") %
((q + start_index), output['redshift']))
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/enzo/tests/test_outputs.py
--- a/yt/frontends/enzo/tests/test_outputs.py
+++ b/yt/frontends/enzo/tests/test_outputs.py
@@ -13,7 +13,14 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.testing import *
+import numpy as np
+
+from yt.testing import \
+ assert_almost_equal, \
+ assert_equal, \
+ requires_file, \
+ units_override_check, \
+ assert_array_equal
from yt.utilities.answer_testing.framework import \
requires_ds, \
small_patch_amr, \
@@ -41,12 +48,12 @@
dd = ds.all_data()
dens_enzo = dd["Density"].copy()
for f in sorted(ds.field_list):
- if not f[1].endswith("_Density") or \
- f[1].startswith("Dark_Matter_") or \
- f[1].startswith("Electron_") or \
- f[1].startswith("SFR_") or \
- f[1].startswith("Forming_Stellar_") or \
- f[1].startswith("Star_Particle_"):
+ ff = f[1]
+ if not ff.endswith("_Density"):
+ continue
+ start_strings = ["Electron_", "SFR_", "Forming_Stellar_",
+ "Dark_Matter", "Star_Particle_"]
+ if any([ff.startswith(ss) for ss in start_strings]):
continue
dens_enzo -= dd[f]
delta_enzo = np.abs(dens_enzo / dd["Density"])
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/fits/data_structures.py
--- a/yt/frontends/fits/data_structures.py
+++ b/yt/frontends/fits/data_structures.py
@@ -11,17 +11,22 @@
#-----------------------------------------------------------------------------
import stat
-import types
import numpy as np
import numpy.core.defchararray as np_char
+import os
+import re
+import time
+import uuid
import weakref
import warnings
-import re
-import uuid
-from yt.extern.six import iteritems
+
+from collections import defaultdict
+
from yt.config import ytcfg
-from yt.funcs import *
+from yt.funcs import \
+ mylog, \
+ ensure_list
from yt.data_objects.grid_patch import \
AMRGridPatch
from yt.geometry.grid_geometry_handler import \
@@ -42,7 +47,6 @@
prefixable_units, \
unit_prefixes
from yt.units import dimensions
-from yt.units.yt_array import YTQuantity
from yt.utilities.on_demand_imports import _astropy, NotAModule
@@ -137,10 +141,10 @@
mylog.info("Adding field %s to the list of fields." % (fname))
self.field_list.append(("io",fname))
if k in ["x","y"]:
- unit = "code_length"
+ field_unit = "code_length"
else:
- unit = v
- self.dataset.field_units[("io",fname)] = unit
+ field_unit = v
+ self.dataset.field_units[("io",fname)] = field_unit
return
self._axis_map = {}
self._file_map = {}
@@ -149,7 +153,9 @@
dup_field_index = {}
# Since FITS header keywords are case-insensitive, we only pick a subset of
# prefixes, ones that we expect to end up in headers.
- known_units = dict([(unit.lower(),unit) for unit in self.ds.unit_registry.lut])
+ known_units = dict(
+ [(unit.lower(), unit) for unit in self.ds.unit_registry.lut]
+ )
for unit in list(known_units.values()):
if unit in prefixable_units:
for p in ["n","u","m","c","k"]:
@@ -211,8 +217,7 @@
self.num_grids = self.ds.parameters["nprocs"]
def _parse_index(self):
- f = self._handle # shortcut
- ds = self.dataset # shortcut
+ ds = self.dataset
# If nprocs > 1, decompose the domain into virtual grids
if self.num_grids > 1:
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/fits/fields.py
--- a/yt/frontends/fits/fields.py
+++ b/yt/frontends/fits/fields.py
@@ -10,8 +10,6 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import numpy as np
-from yt.utilities.exceptions import *
from yt.fields.field_info_container import \
FieldInfoContainer
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/fits/misc.py
--- a/yt/frontends/fits/misc.py
+++ b/yt/frontends/fits/misc.py
@@ -14,8 +14,8 @@
import base64
from yt.extern.six import PY3
from yt.fields.derived_field import ValidateSpatial
+from yt.funcs import mylog
from yt.utilities.on_demand_imports import _astropy
-from yt.funcs import mylog, get_image_suffix
from yt.visualization._mpl_imports import FigureCanvasAgg
from yt.units.yt_array import YTQuantity, YTArray
from yt.utilities.fits_image import FITSImageData
@@ -23,7 +23,7 @@
from io import BytesIO as IO
else:
from yt.extern.six.moves import StringIO as IO
-
+
import os
def _make_counts(emin, emax):
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/fits/setup.py
--- a/yt/frontends/fits/setup.py
+++ b/yt/frontends/fits/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 b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/fits/tests/test_outputs.py
--- a/yt/frontends/fits/tests/test_outputs.py
+++ b/yt/frontends/fits/tests/test_outputs.py
@@ -13,7 +13,10 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.testing import *
+from yt.testing import \
+ assert_equal, \
+ requires_file, \
+ units_override_check
from yt.utilities.answer_testing.framework import \
requires_ds, \
small_patch_amr, \
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -13,27 +13,20 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.utilities.on_demand_imports import _h5py as h5py
+import os
import stat
import numpy as np
import weakref
-from yt.config import ytcfg
-from yt.funcs import *
+from yt.funcs import mylog
from yt.data_objects.grid_patch import \
AMRGridPatch
from yt.geometry.grid_geometry_handler import \
GridIndex
-from yt.geometry.geometry_handler import \
- YTDataChunk
from yt.data_objects.static_output import \
Dataset
-from yt.utilities.definitions import \
- mpc_conversion, sec_conversion
from yt.utilities.file_handler import \
HDF5FileHandler
-from yt.utilities.io_handler import \
- io_registry
from yt.utilities.physical_constants import cm_per_mpc
from .fields import FLASHFieldInfo
@@ -71,7 +64,6 @@
pass
def _detect_output_fields(self):
- ncomp = self._handle["/unknown names"].shape[0]
self.field_list = [("flash", s.decode("ascii","ignore"))
for s in self._handle["/unknown names"][:].flat]
if ("/particle names" in self._particle_handle):
@@ -159,9 +151,6 @@
gre[i][:ND] = np.rint(gre[i][:ND]/dx[0][:ND])*dx[0][:ND]
def _populate_grid_objects(self):
- # We only handle 3D data, so offset is 7 (nfaces+1)
-
- offset = 7
ii = np.argsort(self.grid_levels.flat)
gid = self._handle["/gid"][:]
first_ind = -(self.dataset.refine_by**self.dataset.dimensionality)
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/flash/fields.py
--- a/yt/frontends/flash/fields.py
+++ b/yt/frontends/flash/fields.py
@@ -13,13 +13,10 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import numpy as np
from yt.fields.field_info_container import \
FieldInfoContainer
from yt.utilities.physical_constants import \
- kboltz, mh, Na
-from yt.units.yt_array import \
- YTArray
+ Na
# Common fields in FLASH: (Thanks to John ZuHone for this list)
#
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/flash/io.py
--- a/yt/frontends/flash/io.py
+++ b/yt/frontends/flash/io.py
@@ -14,8 +14,6 @@
#-----------------------------------------------------------------------------
import numpy as np
-from yt.utilities.on_demand_imports import _h5py as h5py
-from yt.utilities.math_utils import prec_accum
from itertools import groupby
from yt.utilities.io_handler import \
@@ -110,7 +108,6 @@
rv = {}
for field in fields:
ftype, fname = field
- dt = f["/%s" % fname].dtype
# Always use *native* 64-bit float.
rv[field] = np.empty(size, dtype="=f8")
ng = sum(len(c.objs) for c in chunks)
@@ -149,7 +146,6 @@
for field in fluid_fields:
ftype, fname = field
ds = f["/%s" % fname]
- ind = 0
for gs in grid_sequences(chunk.objs):
start = gs[0].id - gs[0]._id_offset
end = gs[-1].id - gs[-1]._id_offset + 1
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/flash/setup.py
--- a/yt/frontends/flash/setup.py
+++ b/yt/frontends/flash/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 b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/flash/tests/test_outputs.py
--- a/yt/frontends/flash/tests/test_outputs.py
+++ b/yt/frontends/flash/tests/test_outputs.py
@@ -13,11 +13,13 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.testing import *
+from yt.testing import \
+ assert_equal, \
+ requires_file, \
+ units_override_check
from yt.utilities.answer_testing.framework import \
requires_ds, \
small_patch_amr, \
- big_patch_amr, \
data_dir_load
from yt.frontends.flash.api import FLASHDataset
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/gadget/data_structures.py
--- a/yt/frontends/gadget/data_structures.py
+++ b/yt/frontends/gadget/data_structures.py
@@ -20,7 +20,6 @@
import stat
import struct
import os
-import types
from yt.data_objects.static_output import \
ParticleFile
@@ -30,8 +29,6 @@
ParticleIndex
from yt.utilities.cosmology import \
Cosmology
-from yt.utilities.definitions import \
- sec_conversion
from yt.utilities.fortran_utils import read_record
from yt.utilities.logger import ytLogger as mylog
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/gadget/setup.py
--- a/yt/frontends/gadget/setup.py
+++ b/yt/frontends/gadget/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 b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/gadget/simulation_handling.py
--- a/yt/frontends/gadget/simulation_handling.py
+++ b/yt/frontends/gadget/simulation_handling.py
@@ -26,13 +26,15 @@
from yt.units.unit_registry import \
UnitRegistry
from yt.units.yt_array import \
- YTArray, YTQuantity
+ YTArray
from yt.utilities.cosmology import \
Cosmology
from yt.utilities.exceptions import \
InvalidSimulationTimeSeries, \
MissingParameter, \
NoStoppingCondition
+from yt.utilities.exceptions import \
+ YTOutputNotIdentified
from yt.utilities.logger import ytLogger as \
mylog
from yt.utilities.parallel_tools.parallel_analysis_interface import \
@@ -328,7 +330,7 @@
self.final_redshift = 1.0 / self.parameters["TimeMax"] - 1.0
self.cosmological_simulation = 1
for a, v in cosmo_attr.items():
- if not v in self.parameters:
+ if v not in self.parameters:
raise MissingParameter(self.parameter_filename, v)
setattr(self, a, self.parameters[v])
else:
@@ -426,7 +428,7 @@
self.final_time = self.quan(self.parameters["TimeMax"], "code_time")
else:
self.final_time = None
- if not "TimeMax" in self.parameters:
+ if "TimeMax" not in self.parameters:
raise NoStoppingCondition(self.parameter_filename)
def _find_outputs(self):
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/gadget_fof/data_structures.py
--- a/yt/frontends/gadget_fof/data_structures.py
+++ b/yt/frontends/gadget_fof/data_structures.py
@@ -18,19 +18,14 @@
from yt.utilities.on_demand_imports import _h5py as h5py
import numpy as np
import stat
-import weakref
-import struct
import glob
-import time
import os
-from .fields import \
+from yt.frontends.gadget_fof.fields import \
GadgetFOFFieldInfo
from yt.utilities.cosmology import \
Cosmology
-from yt.utilities.definitions import \
- mpc_conversion, sec_conversion
from yt.utilities.exceptions import \
YTException
from yt.utilities.logger import ytLogger as \
@@ -42,10 +37,7 @@
ParticleFile
from yt.frontends.gadget.data_structures import \
_fix_unit_ordering
-import yt.utilities.fortran_utils as fpu
-from yt.units.yt_array import \
- YTArray, \
- YTQuantity
+
class GadgetFOFParticleIndex(ParticleIndex):
def __init__(self, ds, dataset_type):
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/gadget_fof/fields.py
--- a/yt/frontends/gadget_fof/fields.py
+++ b/yt/frontends/gadget_fof/fields.py
@@ -14,11 +14,8 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-from yt.funcs import mylog
from yt.fields.field_info_container import \
FieldInfoContainer
-from yt.units.yt_array import \
- YTArray
m_units = "code_mass"
p_units = "code_length"
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/gadget_fof/io.py
--- a/yt/frontends/gadget_fof/io.py
+++ b/yt/frontends/gadget_fof/io.py
@@ -17,7 +17,7 @@
from yt.utilities.on_demand_imports import _h5py as h5py
import numpy as np
-from yt.utilities.exceptions import *
+from yt.utilities.exceptions import YTDomainOverflow
from yt.funcs import mylog
from yt.utilities.io_handler import \
diff -r b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/gadget_fof/setup.py
--- a/yt/frontends/gadget_fof/setup.py
+++ b/yt/frontends/gadget_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 b4941cba3982e6eddba1aba16e8d458f9de6980c -r 03e316bc6fddecfb4705d0f73754ce2553e45a3d yt/frontends/gdf/data_structures.py
--- a/yt/frontends/gdf/data_structures.py
+++ b/yt/frontends/gdf/data_structures.py
@@ -14,7 +14,6 @@
#-----------------------------------------------------------------------------
from yt.utilities.on_demand_imports import _h5py as h5py
-import types
import numpy as np
import weakref
import os
This diff is so big that we needed to truncate the remainder.
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list