[yt-svn] commit/yt: xarthisius: Merged in ngoldbaum/yt (pull request #1720)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Aug 27 09:12:01 PDT 2015
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/6f1e993ad7f9/
Changeset: 6f1e993ad7f9
Branch: yt
User: xarthisius
Date: 2015-08-27 16:11:49+00:00
Summary: Merged in ngoldbaum/yt (pull request #1720)
Linting yt.geometry
Affected #: 22 files
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/cartesian_coordinates.py
--- a/yt/geometry/coordinates/cartesian_coordinates.py
+++ b/yt/geometry/coordinates/cartesian_coordinates.py
@@ -1,5 +1,5 @@
"""
-Cartesian fields
+Definitions for cartesian coordinate systems
@@ -17,8 +17,9 @@
import numpy as np
from .coordinate_handler import \
CoordinateHandler, \
- _unknown_coord, \
- _get_coord_fields
+ _get_coord_fields, \
+ cartesian_to_cylindrical, \
+ cylindrical_to_cartesian
import yt.visualization._MPL as _MPL
class CartesianCoordinateHandler(CoordinateHandler):
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/coordinate_handler.py
--- a/yt/geometry/coordinates/coordinate_handler.py
+++ b/yt/geometry/coordinates/coordinate_handler.py
@@ -15,23 +15,19 @@
#-----------------------------------------------------------------------------
import numpy as np
-import abc
import weakref
from numbers import Number
-from yt.funcs import *
-from yt.fields.field_info_container import \
- NullFunc, FieldInfoContainer
-from yt.utilities.io_handler import io_registry
-from yt.utilities.logger import ytLogger as mylog
-from yt.utilities.parallel_tools.parallel_analysis_interface import \
- ParallelAnalysisInterface
-from yt.utilities.lib.pixelization_routines import \
- pixelize_cylinder
-import yt.visualization._MPL as _MPL
+from yt.extern.six import string_types
+from yt.funcs import \
+ validate_width_tuple, \
+ fix_unitary, \
+ iterable
from yt.units.yt_array import \
YTArray, YTQuantity
-from yt.extern.six import string_types
+from yt.utilities.exceptions import \
+ YTCoordinateNotImplemented, \
+ YTInvalidWidthError
def _unknown_coord(field, data):
raise YTCoordinateNotImplemented
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/cylindrical_coordinates.py
--- a/yt/geometry/coordinates/cylindrical_coordinates.py
+++ b/yt/geometry/coordinates/cylindrical_coordinates.py
@@ -1,5 +1,5 @@
"""
-Cylindrical fields
+Definitions for cylindrical coordinate systems
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/geographic_coordinates.py
--- a/yt/geometry/coordinates/geographic_coordinates.py
+++ b/yt/geometry/coordinates/geographic_coordinates.py
@@ -1,5 +1,5 @@
"""
-Geographic fields
+Definitions for geographic coordinate systems
@@ -19,7 +19,6 @@
CoordinateHandler, \
_unknown_coord, \
_get_coord_fields
-import yt.visualization._MPL as _MPL
from yt.utilities.lib.pixelization_routines import \
pixelize_cylinder, pixelize_aitoff
@@ -197,7 +196,27 @@
raise NotImplementedError
def convert_to_cartesian(self, coord):
- raise NotImplementedError
+ if isinstance(coord, np.ndarray) and len(coord.shape) > 1:
+ alt = self.axis_id['altitude']
+ lon = self.axis_id['longitude']
+ lat = self.axis_id['latitude']
+ r = coord[:,alt] + self.ds.surface_height
+ theta = coord[:,lon] * np.pi/180
+ phi = coord[:,lat] * np.pi/180
+ nc = np.zeros_like(coord)
+ # r, theta, phi
+ nc[:,lat] = np.cos(phi) * np.sin(theta)*r
+ nc[:,lon] = np.sin(phi) * np.sin(theta)*r
+ nc[:,alt] = np.cos(theta) * r
+ else:
+ a, b, c = coord
+ theta = b * np.pi/180
+ phi = a * np.pi/180
+ r = self.ds.surface_height + c
+ nc = (np.cos(phi) * np.sin(theta)*r,
+ np.sin(phi) * np.sin(theta)*r,
+ np.cos(theta) * r)
+ return nc
def convert_to_cylindrical(self, coord):
raise NotImplementedError
@@ -274,27 +293,3 @@
0.0 * display_center[2]]
display_center[self.axis_id['latitude']] = c
return center, display_center
-
- def convert_to_cartesian(self, coord):
- if isinstance(coord, np.ndarray) and len(coord.shape) > 1:
- alt = self.axis_id['altitude']
- lon = self.axis_id['longitude']
- lat = self.axis_id['latitude']
- r = coord[:,alt] + self.ds.surface_height
- theta = coord[:,lon] * np.pi/180
- phi = coord[:,lat] * np.pi/180
- nc = np.zeros_like(coord)
- # r, theta, phi
- nc[:,lat] = np.cos(phi) * np.sin(theta)*r
- nc[:,lon] = np.sin(phi) * np.sin(theta)*r
- nc[:,alt] = np.cos(theta) * r
- else:
- a, b, c = coord
- theta = b * np.pi/180
- phi = a * np.pi/180
- r = self.ds.surface_height + c
- nc = (np.cos(phi) * np.sin(theta)*r,
- np.sin(phi) * np.sin(theta)*r,
- np.cos(theta) * r)
- return nc
-
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/polar_coordinates.py
--- a/yt/geometry/coordinates/polar_coordinates.py
+++ b/yt/geometry/coordinates/polar_coordinates.py
@@ -1,5 +1,5 @@
"""
-Polar fields
+Definitions for polar coordinate systems
@@ -14,20 +14,11 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import numpy as np
-from yt.units.yt_array import YTArray
-from .coordinate_handler import \
- CoordinateHandler, \
- _unknown_coord, \
- cylindrical_to_cartesian, \
- _get_coord_fields
from .cylindrical_coordinates import CylindricalCoordinateHandler
-import yt.visualization._MPL as _MPL
-from yt.utilities.lib.pixelization_routines import \
- pixelize_cylinder
+
class PolarCoordinateHandler(CylindricalCoordinateHandler):
- def __init__(self, ds, ordering = ('r', 'theta', 'z')):
+ def __init__(self, ds, ordering = ('r', 'theta', 'z')):
super(PolarCoordinateHandler, self).__init__(ds, ordering)
# No need to set labels here
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/spec_cube_coordinates.py
--- a/yt/geometry/coordinates/spec_cube_coordinates.py
+++ b/yt/geometry/coordinates/spec_cube_coordinates.py
@@ -1,5 +1,5 @@
"""
-Cartesian fields
+Definitions for spectral cube coordinate systems
@@ -14,7 +14,6 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import numpy as np
from .cartesian_coordinates import \
CartesianCoordinateHandler
from .coordinate_handler import \
@@ -55,7 +54,7 @@
self.axis_field[self.ds.spec_axis] = _spec_axis
def setup_fields(self, registry):
- if self.ds.no_cgs_equiv_length == False:
+ if self.ds.no_cgs_equiv_length is False:
return super(SpectralCubeCoordinateHandler, self
).setup_fields(registry)
for axi, ax in enumerate("xyz"):
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/spherical_coordinates.py
--- a/yt/geometry/coordinates/spherical_coordinates.py
+++ b/yt/geometry/coordinates/spherical_coordinates.py
@@ -1,5 +1,5 @@
"""
-Spherical fields
+Definitions for spherical coordinate systems
@@ -19,7 +19,6 @@
CoordinateHandler, \
_unknown_coord, \
_get_coord_fields
-import yt.visualization._MPL as _MPL
from yt.utilities.lib.pixelization_routines import \
pixelize_cylinder, pixelize_aitoff
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/tests/test_cartesian_coordinates.py
--- a/yt/geometry/coordinates/tests/test_cartesian_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_cartesian_coordinates.py
@@ -1,6 +1,10 @@
# Some tests for the Cartesian coordinates handler
-from yt.testing import *
+import numpy as np
+
+from yt.testing import \
+ fake_amr_ds, \
+ assert_equal
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/tests/test_cylindrical_coordinates.py
--- a/yt/geometry/coordinates/tests/test_cylindrical_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_cylindrical_coordinates.py
@@ -1,6 +1,11 @@
# Some tests for the Cylindrical coordinates handler
-from yt.testing import *
+import numpy as np
+
+from yt.testing import \
+ fake_amr_ds, \
+ assert_equal, \
+ assert_almost_equal
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -14,7 +19,6 @@
dd = ds.all_data()
fi = ("index", axis)
fd = ("index", "d%s" % axis)
- fp = ("index", "path_element_%s" % axis)
ma = np.argmax(dd[fi])
yield assert_equal, dd[fi][ma] + dd[fd][ma] / 2.0, ds.domain_right_edge[i].d
mi = np.argmin(dd[fi])
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/tests/test_geographic_coordinates.py
--- a/yt/geometry/coordinates/tests/test_geographic_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_geographic_coordinates.py
@@ -1,6 +1,11 @@
# Some tests for the geographic coordinates handler
-from yt.testing import *
+import numpy as np
+
+from yt.testing import \
+ fake_amr_ds, \
+ assert_equal, \
+ assert_rel_equal
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -19,7 +24,6 @@
dd = ds.all_data()
fi = ("index", axis)
fd = ("index", "d%s" % axis)
- fp = ("index", "path_element_%s" % axis)
ma = np.argmax(dd[fi])
yield assert_equal, dd[fi][ma] + dd[fd][ma] / 2.0, ds.domain_right_edge[i].d
mi = np.argmin(dd[fi])
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/tests/test_polar_coordinates.py
--- a/yt/geometry/coordinates/tests/test_polar_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_polar_coordinates.py
@@ -1,7 +1,12 @@
# Some tests for the polar coordinates handler
# (Pretty similar to cylindrical, but different ordering)
-from yt.testing import *
+import numpy as np
+
+from yt.testing import \
+ fake_amr_ds, \
+ assert_equal, \
+ assert_almost_equal
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -15,7 +20,6 @@
dd = ds.all_data()
fi = ("index", axis)
fd = ("index", "d%s" % axis)
- fp = ("index", "path_element_%s" % axis)
ma = np.argmax(dd[fi])
yield assert_equal, dd[fi][ma] + dd[fd][ma] / 2.0, ds.domain_right_edge[i].d
mi = np.argmin(dd[fi])
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/coordinates/tests/test_spherical_coordinates.py
--- a/yt/geometry/coordinates/tests/test_spherical_coordinates.py
+++ b/yt/geometry/coordinates/tests/test_spherical_coordinates.py
@@ -1,6 +1,11 @@
# Some tests for the Cylindrical coordinates handler
-from yt.testing import *
+import numpy as np
+
+from yt.testing import \
+ fake_amr_ds, \
+ assert_equal, \
+ assert_almost_equal
# Our canonical tests are that we can access all of our fields and we can
# compute our volume correctly.
@@ -14,7 +19,6 @@
dd = ds.all_data()
fi = ("index", axis)
fd = ("index", "d%s" % axis)
- fp = ("index", "path_element_%s" % axis)
ma = np.argmax(dd[fi])
yield assert_equal, dd[fi][ma] + dd[fd][ma] / 2.0, ds.domain_right_edge[i].d
mi = np.argmin(dd[fi])
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/geometry_handler.py
--- a/yt/geometry/geometry_handler.py
+++ b/yt/geometry/geometry_handler.py
@@ -19,18 +19,11 @@
import weakref
import h5py
import numpy as np
-import abc
-import copy
-from yt.funcs import *
from yt.config import ytcfg
+from yt.funcs import iterable
from yt.units.yt_array import \
- uconcatenate
-from yt.fields.field_info_container import \
- NullFunc
-from yt.fields.particle_fields import \
- particle_deposition_functions, \
- particle_scalar_functions
+ YTArray, uconcatenate
from yt.utilities.io_handler import io_registry
from yt.utilities.logger import ytLogger as mylog
from yt.utilities.parallel_tools.parallel_analysis_interface import \
@@ -183,7 +176,7 @@
Return the dataset with a given *name* located at *node* in the
datafile.
"""
- if self._data_file == None:
+ if self._data_file is None:
return None
if node[0] != "/": node = "/%s" % node
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/grid_geometry_handler.py
--- a/yt/geometry/grid_geometry_handler.py
+++ b/yt/geometry/grid_geometry_handler.py
@@ -16,29 +16,22 @@
import h5py
import numpy as np
-import string, re, gc, time
-from yt.extern.six.moves import cPickle
-from yt.extern.six.moves import zip as izip
import weakref
-from itertools import chain
+from collections import defaultdict
-from yt.funcs import *
-from yt.utilities.logger import ytLogger as mylog
from yt.arraytypes import blankRecordArray
from yt.config import ytcfg
-from yt.fields.field_info_container import NullFunc
+from yt.funcs import \
+ ensure_list, ensure_numpy_array
from yt.geometry.geometry_handler import \
Index, YTDataChunk, ChunkDataCache
+from yt.units.yt_array import YTArray
from yt.utilities.definitions import MAXLEVEL
-from yt.utilities.physical_constants import sec_per_year
-from yt.utilities.io_handler import io_registry
-from yt.utilities.parallel_tools.parallel_analysis_interface import \
- ParallelAnalysisInterface
+from yt.utilities.logger import ytLogger as mylog
from .grid_container import \
GridTree, MatchPointsToGrids
-from yt.data_objects.data_containers import data_object_registry
class GridIndex(Index):
"""The index class for patch and block AMR datasets. """
@@ -201,7 +194,6 @@
self.ds.current_time.in_units("s"),
self.ds.current_time.in_units("yr")))
print("\nSmallest Cell:")
- u=[]
for item in ("Mpc", "pc", "AU", "cm"):
print("\tWidth: %0.3e %s" % (dx.in_units(item), item))
@@ -322,9 +314,9 @@
def _chunk_spatial(self, dobj, ngz, sort = None, preload_fields = None):
gobjs = getattr(dobj._current_chunk, "objs", dobj._chunk_info)
if sort in ("+level", "level"):
- giter = sorted(gobjs, key = g.Level)
+ giter = sorted(gobjs, key=lambda g: g.Level)
elif sort == "-level":
- giter = sorted(gobjs, key = -g.Level)
+ giter = sorted(gobjs, key=lambda g: -g.Level)
elif sort is None:
giter = gobjs
if preload_fields is None: preload_fields = []
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/object_finding_mixin.py
--- a/yt/geometry/object_finding_mixin.py
+++ b/yt/geometry/object_finding_mixin.py
@@ -16,15 +16,17 @@
import numpy as np
from yt.config import ytcfg
-from yt.funcs import *
+from yt.funcs import \
+ mylog, ensure_numpy_array, \
+ ensure_list
from yt.utilities.lib.misc_utilities import \
- get_box_grids_level, \
get_box_grids_below_level
from yt.geometry.grid_container import \
MatchPointsToGrids, \
GridTree
from yt.utilities.physical_constants import \
HUGE
+from yt.utilities.exceptions import YTTooParallel
class ObjectFindingMixin(object) :
@@ -174,12 +176,10 @@
*axis*
"""
# Let's figure out which grids are on the slice
- mask=np.ones(self.num_grids)
+ mask = np.ones(self.num_grids)
# So if gRE > coord, we get a mask, if not, we get a zero
# if gLE > coord, we get a zero, if not, mask
# Thus, if the coordinate is between the edges, we win!
- #ind = np.where( np.logical_and(self.grid_right_edge[:,axis] > coord, \
- #self.grid_left_edge[:,axis] < coord))
np.choose(np.greater(self.grid_right_edge[:,axis],coord),(0,mask),mask)
np.choose(np.greater(self.grid_left_edge[:,axis],coord),(mask,0),mask)
ind = np.where(mask == 1)
@@ -204,8 +204,10 @@
Gets back all the grids between a left edge and right edge
"""
eps = np.finfo(np.float64).eps
- grid_i = np.where((np.all((self.grid_right_edge - left_edge) > eps, axis=1)
- & np.all((right_edge - self.grid_left_edge) > eps, axis=1)) == True)
+ grid_i = np.where(
+ (np.all((self.grid_right_edge - left_edge) > eps, axis=1) &
+ np.all((right_edge - self.grid_left_edge) > eps, axis=1))
+ )
return self.grids[grid_i], grid_i
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/oct_geometry_handler.py
--- a/yt/geometry/oct_geometry_handler.py
+++ b/yt/geometry/oct_geometry_handler.py
@@ -14,27 +14,9 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import h5py
-import numpy as np
-import string, re, gc, time
-from yt.extern.six.moves import cPickle
-from yt.extern.six.moves import zip as izip
-import weakref
+from yt.utilities.logger import ytLogger as mylog
+from yt.geometry.geometry_handler import Index
-from itertools import chain
-
-from yt.funcs import *
-from yt.utilities.logger import ytLogger as mylog
-from yt.arraytypes import blankRecordArray
-from yt.config import ytcfg
-from yt.fields.field_info_container import NullFunc
-from yt.geometry.geometry_handler import Index, YTDataChunk
-from yt.utilities.definitions import MAXLEVEL
-from yt.utilities.io_handler import io_registry
-from yt.utilities.parallel_tools.parallel_analysis_interface import \
- ParallelAnalysisInterface
-
-from yt.data_objects.data_containers import data_object_registry
class OctreeIndex(Index):
"""The Index subclass for oct AMR datasets"""
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/particle_geometry_handler.py
--- a/yt/geometry/particle_geometry_handler.py
+++ b/yt/geometry/particle_geometry_handler.py
@@ -14,31 +14,15 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
-import h5py
-import numpy as na
-import string, re, gc, time
-from yt.extern.six.moves import cPickle
-from yt.extern.six.moves import zip as izip
-
+import numpy as np
+import os
import weakref
-from itertools import chain
-
-from yt.funcs import *
from yt.utilities.logger import ytLogger as mylog
-from yt.arraytypes import blankRecordArray
-from yt.config import ytcfg
-from yt.fields.field_info_container import NullFunc
+from yt.data_objects.octree_subset import ParticleOctreeSubset
from yt.geometry.geometry_handler import Index, YTDataChunk
from yt.geometry.particle_oct_container import \
ParticleOctreeContainer, ParticleRegions
-from yt.utilities.definitions import MAXLEVEL
-from yt.utilities.io_handler import io_registry
-from yt.utilities.parallel_tools.parallel_analysis_interface import \
- ParallelAnalysisInterface
-
-from yt.data_objects.data_containers import data_object_registry
-from yt.data_objects.octree_subset import ParticleOctreeSubset
class ParticleIndex(Index):
"""The Index subclass for particle datasets"""
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/setup.py
--- a/yt/geometry/setup.py
+++ b/yt/geometry/setup.py
@@ -1,8 +1,5 @@
#!/usr/bin/env python
-import setuptools
-import os, sys, os.path
-import os.path
def configuration(parent_package='',top_path=None):
from numpy.distutils.misc_util import Configuration
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/tests/test_grid_container.py
--- a/yt/geometry/tests/test_grid_container.py
+++ b/yt/geometry/tests/test_grid_container.py
@@ -21,10 +21,8 @@
load_amr_grids
-def setup():
+def setup_test_ds():
"""Prepare setup specific environment"""
- global test_ds
-
grid_data = [
dict(left_edge=[0.0, 0.0, 0.0], right_edge=[1.0, 1.0, 1.],
level=0, dimensions=[16, 16, 16]),
@@ -45,11 +43,12 @@
for grid in grid_data:
grid["density"] = \
np.random.random(grid["dimensions"]) * 2 ** grid["level"]
- test_ds = load_amr_grids(grid_data, [16, 16, 16], 1.0)
+ return load_amr_grids(grid_data, [16, 16, 16], 1.0)
def test_grid_tree():
"""Main test suite for GridTree"""
+ test_ds = setup_test_ds()
grid_tree = test_ds.index._get_grid_tree()
indices, levels, nchild, children = grid_tree.return_tree_info()
@@ -71,6 +70,7 @@
def test_find_points():
"""Main test suite for MatchPoints"""
num_points = 100
+ test_ds = setup_test_ds()
randx = np.random.uniform(low=test_ds.domain_left_edge[0],
high=test_ds.domain_right_edge[0],
size=num_points)
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/tests/test_neighbor_search.py
--- a/yt/geometry/tests/test_neighbor_search.py
+++ b/yt/geometry/tests/test_neighbor_search.py
@@ -1,6 +1,27 @@
+"""
+Tests for neighbor finding
+
+
+
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+import numpy as np
+
from yt.fields.particle_fields import \
add_nearest_neighbor_field
-from yt.testing import *
+from yt.testing import \
+ fake_particle_ds, \
+ assert_equal, \
+ assert_array_almost_equal
+
def test_neighbor_search():
np.random.seed(0x4d3d3d3)
@@ -26,7 +47,6 @@
DR[DRo < -ds.domain_width[j]/2.0] += ds.domain_width[j]
r2 += DR*DR
radius = np.sqrt(r2)
- iii = np.argsort(radius)
radius.sort()
assert(radius[0] == 0.0)
all_neighbors[i] = radius[63]
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/tests/test_particle_octree.py
--- a/yt/geometry/tests/test_particle_octree.py
+++ b/yt/geometry/tests/test_particle_octree.py
@@ -1,18 +1,39 @@
-from yt.testing import *
+"""
+Tests for particle octree
+
+
+
+"""
+
+#-----------------------------------------------------------------------------
+# Copyright (c) 2013, yt Development Team.
+#
+# Distributed under the terms of the Modified BSD License.
+#
+# The full license is in the file COPYING.txt, distributed with this software.
+#-----------------------------------------------------------------------------
+
+
import numpy as np
+import time
+
+from yt.frontends.stream.data_structures import load_particles
from yt.geometry.oct_container import \
OctreeContainer
from yt.geometry.particle_oct_container import \
ParticleOctreeContainer, \
ParticleRegions
from yt.geometry.oct_container import _ORDER_MAX
+from yt.geometry.selection_routines import RegionSelector, AlwaysSelector
+from yt.testing import \
+ assert_equal, \
+ requires_file
+from yt.units.unit_registry import UnitRegistry
+from yt.units.yt_array import YTArray
from yt.utilities.lib.geometry_utils import get_morton_indices
-from yt.frontends.stream.api import load_particles
-from yt.geometry.selection_routines import RegionSelector, AlwaysSelector
-from yt.units.unit_registry import UnitRegistry
+
import yt.units.dimensions as dimensions
import yt.data_objects.api
-import time, os
NPART = 32**3
DLE = np.array([0.0, 0.0, 0.0])
@@ -77,7 +98,6 @@
def test_particle_octree_counts():
np.random.seed(int(0x4d3d3d3))
# Eight times as many!
- pos = []
data = {}
bbox = []
for i, ax in enumerate('xyz'):
@@ -98,7 +118,6 @@
def test_particle_overrefine():
np.random.seed(int(0x4d3d3d3))
- pos = []
data = {}
bbox = []
for i, ax in enumerate('xyz'):
diff -r 048450de2ed04be67e2f39ad89dea98a64169807 -r 6f1e993ad7f98b94a09193007022e8e90607c72e yt/geometry/unstructured_mesh_handler.py
--- a/yt/geometry/unstructured_mesh_handler.py
+++ b/yt/geometry/unstructured_mesh_handler.py
@@ -14,9 +14,10 @@
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+import numpy as np
+import os
import weakref
-from yt.funcs import *
from yt.utilities.logger import ytLogger as mylog
from yt.geometry.geometry_handler import Index, YTDataChunk
from yt.utilities.lib.mesh_utilities import smallest_fwidth
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