本文整理汇总了Python中scipy.spatial.KDTree方法的典型用法代码示例。如果您正苦于以下问题:Python spatial.KDTree方法的具体用法?Python spatial.KDTree怎么用?Python spatial.KDTree使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块scipy.spatial的用法示例。
在下文中一共展示了spatial.KDTree方法的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: generate_icp_results
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def generate_icp_results(self, gt_pose):
from icp import icp_test
from scipy.spatial import KDTree
M_given = self.templates[self.template_idx,:,:]
S_given = helper.apply_transformation(M_given.reshape((1,-1,3)), gt_pose)[0]
# S_given = S_given + np.random.normal(0,1,S_given.shape)# Noisy Data
M_given = M_given[0:self.NUM_POINT,:]# template data
S_given = S_given[0:self.NUM_POINT,:]# source data
tree_M = KDTree(M_given)
tree_M_sampled = KDTree(M_given[0:100,:])
final_pose, model_data, sensor_data, predicted_data, title, _, _ = icp_test(S_given[0:100,:], M_given, tree_M, M_given[0:100,:], tree_M_sampled, S_given, gt_pose.reshape((1,6)), self.MAX_LOOPS, self.ftol)
self.find_errors(gt_pose, final_pose)
helper.display_three_clouds(model_data, sensor_data, predicted_data, title)
开发者ID:vinits5,项目名称:pointnet-registration-framework,代码行数:19,
示例2: bench_build
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def bench_build(self):
print()
print(' Constructing kd-tree')
print('=====================================')
print(' dim | # points | KDTree | cKDTree ')
for (m, n, repeat) in [(3,10000,3), (8,10000,3), (16,10000,3)]:
print('%4s | %7s ' % (m, n), end=' ')
sys.stdout.flush()
data = np.concatenate((np.random.randn(n//2,m),
np.random.randn(n-n//2,m)+np.ones(m)))
print('| %6.3fs ' % (measure('T1 = KDTree(data)', repeat) / repeat), end=' ')
sys.stdout.flush()
print('| %6.3fs' % (measure('T2 = cKDTree(data)', repeat) / repeat), end=' ')
sys.stdout.flush()
print('')
开发者ID:ktraunmueller,项目名称:Computable,代码行数:20,
示例3: setUp
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def setUp(self):
self.data = np.array([[0,0,0],
[0,0,1],
[0,1,0],
[0,1,1],
[1,0,0],
[1,0,1],
[1,1,0],
[1,1,1]])
self.kdtree = KDTree(self.data)
self.n = self.kdtree.n
self.m = self.kdtree.m
np.random.seed(1234)
self.x = np.random.randn(3)
self.d = 0.5
self.k = 4
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,
示例4: test_onetree_query
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def test_onetree_query():
np.random.seed(0)
n = 50
k = 4
points = np.random.randn(n,k)
T = KDTree(points)
yield check_onetree_query, T, 0.1
points = np.random.randn(3*n,k)
points[:n] *= 0.001
points[n:2*n] += 2
T = KDTree(points)
yield check_onetree_query, T, 0.1
yield check_onetree_query, T, 0.001
yield check_onetree_query, T, 0.00001
yield check_onetree_query, T, 1e-6
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,
示例5: exact_full_marker_data
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def exact_full_marker_data(csv_path, marker_pkl):
all_data_arr = np.genfromtxt(csv_path, delimiter=",", skip_header=1)
marker_jdcs_collection = cPickle.load(open(marker_pkl[0], "rb"))
tmp_list = list()
for jdc in marker_jdcs_collection:
tmp_list.extend(jdc)
marker_pcd_arr = np.array(tmp_list)
tree = spatial.KDTree(all_data_arr[:, :3])
marker_full_data_ls = []
for i in xrange(marker_pcd_arr.shape[0]):
ret = tree.query(marker_pcd_arr[i])
marker_full_data_ls.append(all_data_arr[ret[1]])
marker_full_data_arr = np.array(marker_full_data_ls)
return marker_full_data_arr
# get the Hessian normal form of 3D plane
开发者ID:mfxox,项目名称:ILCC,代码行数:21,
示例6: build_index
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def build_index(self):
midpoints = []
self.index = {}
for ct, fset in enumerate(self.sets.values()):
mp = []
for vr in self.explanatory_variables:
mp.append(fset.sets[vr.name].centroid)
midpoints.append(mp)
self.index[ct] = fset.name
import sys
sys.setrecursionlimit(100000)
self.kdtree = KDTree(midpoints)
sys.setrecursionlimit(1000)
开发者ID:PYFTS,项目名称:pyFTS,代码行数:21,
示例7: build_index
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def build_index(self):
points = []
fset = self.sets[self.ordered_sets[0]]
points.append([fset.sets[1].lower, fset.sets[1].centroid, fset.sets[1].upper])
for ct, key in enumerate(self.ordered_sets[1:-1]):
fset = self.sets[key]
points.append([fset.lower, fset.centroid, fset.upper])
fset = self.sets[self.ordered_sets[-1]]
points.append([fset.sets[1].lower, fset.sets[1].centroid, fset.sets[1].upper])
import sys
sys.setrecursionlimit(100000)
self.kdtree = KDTree(points)
sys.setrecursionlimit(1000)
开发者ID:PYFTS,项目名称:pyFTS,代码行数:21,
示例8: build_index
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def build_index(self):
points = []
#self.index = {}
for ct, key in enumerate(self.ordered_sets):
fset = self.sets[key]
points.append([fset.lower, fset.centroid, fset.upper])
#self.index[ct] = fset.name
import sys
sys.setrecursionlimit(100000)
self.kdtree = KDTree(points)
sys.setrecursionlimit(1000)
开发者ID:PYFTS,项目名称:pyFTS,代码行数:18,
示例9: triangulatePolygon
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def triangulatePolygon(poly, hole=None):
# Triangulate poly with hole
cdt = CDT(poly.points)
if hole:
cdt.add_hole(hole)
triangles = cdt.triangulate()
# Frustratingly, CDT sometimes returns points that are not
# EXACTLY the same as the input points, so we use a KDTree
valid_points = [shapes.Point(p.x, p.y) for p in poly.points]
if hole:
valid_points += [shapes.Point(p.x, p.y) for p in hole]
tree = sp.KDTree(toNumpy(valid_points))
def convert(t):
def findClosest(point):
idx = tree.query(toNumpy([point]))[1]
return valid_points[idx]
A = findClosest(shapes.Point(t.a.x, t.a.y))
B = findClosest(shapes.Point(t.b.x, t.b.y))
C = findClosest(shapes.Point(t.c.x, t.c.y))
return shapes.Triangle(A, B, C)
return map(convert, triangles)
开发者ID:crm416,项目名称:point-location,代码行数:25,
示例10: __init__
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def __init__(self, primaryData):
self.id = str(uuid.uuid4())
self.griddedCount = 0
self.griddedMatched = 0
self.insituCount = len(primaryData)
self.insituMatches = 0
self.primary = primaryData
for r in self.primary:
r["matches"] = []
self.data = []
for s in primaryData:
u = utm.from_latlon(s["y"], s["x"])
v = (u[0], u[1], 0.0)
self.data.append(v)
if len(self.data) > 0:
self.tree = spatial.KDTree(self.data)
else:
self.tree = None
开发者ID:apache,项目名称:incubator-sdap-nexus,代码行数:25,
示例11: _friends_leaveoneout_radius
点赞 6
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def _friends_leaveoneout_radius(points, ftype):
"""Internal method used to compute the radius (half-side-length) for each
ball (cube) used in :class:`RadFriends` (:class:`SupFriends`) using
leave-one-out (LOO) cross-validation."""
# Construct KDTree to enable quick nearest-neighbor lookup for
# our resampled objects.
kdtree = spatial.KDTree(points)
if ftype == 'balls':
# Compute radius to two nearest neighbors (self + neighbor).
dists, ids = kdtree.query(points, k=2, eps=0, p=2)
elif ftype == 'cubes':
# Compute half-side-length to two nearest neighbors (self + neighbor).
dists, ids = kdtree.query(points, k=2, eps=0, p=np.inf)
dist = dists[:, 1] # distances to LOO nearest neighbor
return dist
开发者ID:joshspeagle,项目名称:dynesty,代码行数:21,
示例12: __init__
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def __init__(self, p0, p1):
""" p0.shape == (N, 3)
p1.shape == (N, 3)
"""
self.p0 = p0
self.p1 = p1
leafsize = 1000
self.nearest = KDTree(self.p0, leafsize=leafsize)
self.g_series = None
开发者ID:vinits5,项目名称:pointnet-registration-framework,代码行数:11,
示例13: closest_building_distance_median
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def closest_building_distance_median( point_ref, tree, df_closest_d, radius_search ):
"""
Dispersion metric at point_ref
Computes the median of the closest distance to another building for each building within a radius search
Uses the input KDTree to accelerate calculations
Parameters
----------
point_ref : shapely.Point
calculate index at input point
tree : scipy.spatial.KDTree
KDTree of buildings centroid
df : pandas.DataFrame
data frame of buildings with closest distance calculation
radius_search : float
circle radius to consider the dispersion calculation at a local point
Returns
----------
float
value of dispersion at input point
"""
# Query buildings within radius search
indices = tree.query_ball_point( point_ref, radius_search )
# No dispersion value
if (len(indices) == 0): return np.NaN
# Calculate median of closest distance values. If no information is available, NaN is set
return df_closest_d.loc[ indices ].median()
开发者ID:lgervasoni,项目名称:urbansprawl,代码行数:30,
示例14: closest_building_distance_average
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def closest_building_distance_average( point_ref, tree, df_closest_d, radius_search ):
"""
Dispersion metric at point_ref
Computes the mean of the closest distance to another building for each building within a radius search
Uses the input KDTree to accelerate calculations
Parameters
----------
point_ref : shapely.Point
calculate index at input point
tree : scipy.spatial.KDTree
KDTree of buildings centroid
df : pandas.DataFrame
data frame of buildings with closest distance calculation
radius_search : int
circle radius to consider the dispersion calculation at a local point
Returns
----------
float
value of dispersion at input point
"""
# Query buildings within radius search
indices = tree.query_ball_point( point_ref, radius_search )
# No dispersion value
if (len(indices) == 0): return np.NaN
# Calculate mean of closest distance values. If no information is available, NaN is set
return df_closest_d.loc[ indices ].mean()
##############################################################
### Dispersion indices calculation
##############################################################
开发者ID:lgervasoni,项目名称:urbansprawl,代码行数:35,
示例15: _apply_polygon_closest_distance_neighbor
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def _apply_polygon_closest_distance_neighbor(df_osm_built, K_nearest = 50):
"""
Computes for each polygon, the distance to the (approximated) nearest neighboring polygon
Approximation is done using distance between centroids to K nearest neighboring polygons, then evaluating the real polygon distance
A column `closest_d` is added in the data frame
Parameters
----------
df_osm_built: geopandas.GeoDataFrame
data frame containing the building's geometries
K_nearest: int
number of neighboring polygons to evaluate
Returns
----------
"""
def get_closest_indices(tree, x, K_nearest):
# Query the closest buidings considering their centroid
return tree.query( x.centroid.coords[0] , k=K_nearest+1)[1][1:]
def compute_closest_distance(x, buildings):
# Minimum distance of all distances between reference building 'x' and the other buildings
return (buildings.apply(lambda b: x.distance(b) ) ).min()
# Use all elements to get the exact closest neighbor?
if ( (K_nearest == -1) or (K_nearest >= len(df_osm_built)) ): K_nearest = len(df_osm_built)-1
# Get separate list for coordinates
coords_data = [ geom.centroid.coords[0] for geom in df_osm_built.geometry ]
# Create KD Tree using polygon's centroid
tree = spatial.KDTree( coords_data )
# Get the closest buildings indices
df_osm_built['closest_buildings'] = df_osm_built.geometry.apply(lambda x: get_closest_indices(tree, x, K_nearest) )
# Compute the minimum real distance for the closest buildings
df_osm_built['closest_d'] = df_osm_built.apply(lambda x: compute_closest_distance(x.geometry,df_osm_built.geometry.loc[x.closest_buildings]), axis=1 )
# Drop unnecessary column
df_osm_built.drop('closest_buildings', axis=1, inplace=True)
开发者ID:lgervasoni,项目名称:urbansprawl,代码行数:40,
示例16: associate_activities_closest_node
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def associate_activities_closest_node(G, df_activities_built, df_activities_pois ):
"""
Associates the number of existing activities to their closest nodes in the graph
Parameters
----------
G : networkx multidigraph
input graph to calculate accessibility
df_activities_built : pandas.DataFrame
data selection of buildings with activity uses
df_activities_pois : pandas.DataFrame
data selection of points of interest with activity uses
Returns
----------
"""
# Initialize number of activity references
for u, data in G.nodes(data=True):
data["num_activities"] = 0
# Initialize KDTree of graph nodes
coords = np.array([[node, data['x'], data['y']] for node, data in G.nodes(data=True)])
df_nodes = pd.DataFrame(coords, columns=['node', 'x', 'y'])
# zip coordinates
data = list(zip( df_nodes["x"].ravel(), df_nodes["y"].ravel() ))
# Create input tree
tree = spatial.KDTree( data )
def associate_to_node(tree, point, G):
distance, idx_node = tree.query( (point.x,point.y) )
G.node[ df_nodes.loc[ idx_node, "node"] ]["num_activities"] += 1
# Associate each activity to its closest node
df_activities_built.apply(lambda x: associate_to_node(tree, x.geometry.centroid, G) , axis=1)
df_activities_pois.apply(lambda x: associate_to_node(tree, x.geometry.centroid, G) , axis=1)
开发者ID:lgervasoni,项目名称:urbansprawl,代码行数:38,
示例17: _generate_invariants
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def _generate_invariants(sources):
"""Return an array of (unique) invariants derived from the array `sources`.
Return an array of the indices of `sources` that correspond to each invariant,
arranged as described in _arrangetriplet.
"""
from scipy.spatial import KDTree
from itertools import combinations
from functools import partial
arrange = partial(_arrangetriplet, sources=sources)
inv = []
triang_vrtx = []
coordtree = KDTree(sources)
# The number of nearest neighbors to request (to work with few sources)
knn = min(len(sources), NUM_NEAREST_NEIGHBORS)
for asrc in sources:
__, indx = coordtree.query(asrc, knn)
# Generate all possible triangles with the 5 indx provided, and store
# them with the order (a, b, c) defined in _arrangetriplet
all_asterism_triang = [
arrange(vertex_indices=list(cmb)) for cmb in combinations(indx, 3)
]
triang_vrtx.extend(all_asterism_triang)
inv.extend(
[
_invariantfeatures(*sources[triplet])
for triplet in all_asterism_triang
]
)
# Remove here all possible duplicate triangles
uniq_ind = [
pos for (pos, elem) in enumerate(inv) if elem not in inv[pos + 1 :]
]
inv_uniq = _np.array(inv)[uniq_ind]
triang_vrtx_uniq = _np.array(triang_vrtx)[uniq_ind]
return inv_uniq, triang_vrtx_uniq
开发者ID:toros-astro,项目名称:astroalign,代码行数:43,
示例18: test_register
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def test_register(self):
def compare_image(the_image):
"""Return the fraction of sources found in the reference image"""
# pixel comparison is not good, doesn't work. Compare catalogs.
full_algn = the_image.astype("float32")
import sep
bkg = sep.Background(full_algn)
thresh = 3.0 * bkg.globalrms
allobjs = sep.extract(full_algn - bkg.back(), thresh)
allxy = np.array([[obj["x"], obj["y"]] for obj in allobjs])
from scipy.spatial import KDTree
ref_coordtree = KDTree(self.star_ref_pos)
# Compare here srcs list with self.star_ref_pos
num_sources = 0
for asrc in allxy:
found_source = ref_coordtree.query_ball_point(asrc, 3)
if found_source:
num_sources += 1
fraction_found = float(num_sources) / float(len(allxy))
return fraction_found
registered_img, footp = aa.register(
source=self.image, target=self.image_ref
)
self.assertIs(type(registered_img), np.ndarray)
self.assertIs(type(footp), np.ndarray)
self.assertIs(footp.dtype, np.dtype("bool"))
fraction = compare_image(registered_img)
self.assertGreater(fraction, 0.85)
开发者ID:toros-astro,项目名称:astroalign,代码行数:35,
示例19: test_find_sources
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def test_find_sources(self):
srcs = aa._find_sources(self.image_ref)
from scipy.spatial import KDTree
ref_coordtree = KDTree(self.star_ref_pos)
# Compare here srcs list with self.star_ref_pos
num_sources = 0
for asrc in srcs:
found_source = ref_coordtree.query_ball_point(asrc, 3)
if found_source:
num_sources += 1
fraction_found = float(num_sources) / float(len(srcs))
self.assertGreater(fraction_found, 0.85)
开发者ID:toros-astro,项目名称:astroalign,代码行数:17,
示例20: bench_query
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def bench_query(self):
print()
print(' Querying kd-tree')
print('===============================================================')
print(' dim | # points | # queries | KDTree | cKDTree | flat cKDTree')
for (m, n, r, repeat) in [(3,10000,1000,3),
(8,10000,1000,3),
(16,10000,1000,3)]:
print('%4s | %8s | %8s ' % (m, n, r), end=' ')
sys.stdout.flush()
data = np.concatenate((np.random.randn(n//2,m),
np.random.randn(n-n//2,m)+np.ones(m)))
queries = np.concatenate((np.random.randn(r//2,m),
np.random.randn(r-r//2,m)+np.ones(m)))
T1 = KDTree(data)
T2 = cKDTree(data)
T3 = cKDTree(data,leafsize=n)
print('| %6.3fs ' % (measure('T1.query(queries)', 1) / 1), end=' ')
sys.stdout.flush()
print('| %6.3fs' % (measure('T2.query(queries)', repeat) / repeat), end=' ')
sys.stdout.flush()
print('| %6.3fs' % (measure('T3.query(queries)', repeat) / repeat), end=' ')
sys.stdout.flush()
print('')
开发者ID:ktraunmueller,项目名称:Computable,代码行数:29,
示例21: bench_query_ball_point
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def bench_query_ball_point(self):
print()
print(' Query ball point kd-tree')
print('===============================================================')
print(' dim | # points | # queries | probe radius | KDTree | cKDTree | flat cKDTree')
for (m, n, r, repeat) in [(3,10000,1000,3)]: # ,
# (8,10000,1000,3),
# (16,10000,1000,3)]:
for probe_radius in (0.2, 0.5):
print('%4s | %8s | %9s | %11.1f ' % (m, n, r, probe_radius), end=' ')
sys.stdout.flush()
data = np.concatenate((np.random.randn(n//2,m),
np.random.randn(n-n//2,m)+np.ones(m)))
queries = np.concatenate((np.random.randn(r//2,m),
np.random.randn(r-r//2,m)+np.ones(m)))
T1 = KDTree(data)
T2 = cKDTree(data)
T3 = cKDTree(data,leafsize=n)
print('| %6.3fs ' % (measure('T1.query_ball_point(queries, probe_radius)', 1) / 1), end=' ')
sys.stdout.flush()
print('| %6.3fs' % (measure('T2.query_ball_point(queries, probe_radius)', repeat) / repeat), end=' ')
sys.stdout.flush()
print('| %6.3fs' % (measure('T3.query_ball_point(queries, probe_radius)', repeat) / repeat), end=' ')
sys.stdout.flush()
print('')
开发者ID:ktraunmueller,项目名称:Computable,代码行数:30,
示例22: bench_query_pairs
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def bench_query_pairs(self):
print()
print(' Query pairs kd-tree')
print('==================================================================')
print(' dim | # points | probe radius | KDTree | cKDTree | flat cKDTree')
for (m, n, repeat) in [(3,1000,30),
(8,1000,30),
(16,1000,30)]:
for probe_radius in (0.2, 0.5):
print('%4s | %8s | %11.1f ' % (m, n, probe_radius), end=' ')
sys.stdout.flush()
data = np.concatenate((np.random.randn(n//2,m),
np.random.randn(n-n//2,m)+np.ones(m)))
T1 = KDTree(data)
T2 = cKDTree(data)
T3 = cKDTree(data,leafsize=n)
print('| %6.3fs ' % (measure('T1.query_pairs(probe_radius)', 1) / 1), end=' ')
sys.stdout.flush()
print('| %6.3fs' % (measure('T2.query_pairs(probe_radius)', repeat) / repeat), end=' ')
sys.stdout.flush()
print('| %6.3fs' % (measure('T3.query_pairs(probe_radius)', repeat) / repeat), end=' ')
sys.stdout.flush()
print('')
开发者ID:ktraunmueller,项目名称:Computable,代码行数:28,
示例23: bench_sparse_distance_matrix
点赞 5
# 需要导入模块: from scipy import spatial [as 别名]
# 或者: from scipy.spatial import KDTree [as 别名]
def bench_sparse_distance_matrix(self):
print()
print(' Sparse distance matrix kd-tree')
print('====================================================================')
print(' dim | # points T1 | # points T2 | probe radius | KDTree | cKDTree')
for (m, n1, n2, repeat) in [(3,1000,1000,30),
(8,1000,1000,30),
(16,1000,1000,30)]:
data1 = np.concatenate((np.random.randn(n1//2,m),
np.random.randn(n1-n1//2,m)+np.ones(m)))
data2 = np.concatenate((np.random.randn(n2//2,m),
np.random.randn(n2-n2//2,m)+np.ones(m)))
T1 = KDTree(data1)
T2 = KDTree(data2)
cT1 = cKDTree(data1)
cT2 = cKDTree(data2)
for probe_radius in (0.2, 0.5):
print('%4s | %11s | %11s | %11.1f ' % (m, n1, n2, probe_radius), end=' ')
sys.stdout.flush()
print('| %6.3fs ' % (measure('T1.sparse_distance_matrix(T2, probe_radius)', 1) / 1), end=' ')
sys.stdout.flush()
print('| %6.3fs ' % (measure('cT1.sparse_distance_matrix(cT2, probe_radius)', repeat) / repeat), end=' ')
sys.stdout.flush()
print('')
开发者ID:ktraunmueller,项目名称:Computable,代码行数:31,
注:本文中的scipy.spatial.KDTree方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。