本文整理匯總了Python中Bio.KDTree.KDTree.get_radii方法的典型用法代碼示例。如果您正苦於以下問題:Python KDTree.get_radii方法的具體用法?Python KDTree.get_radii怎麽用?Python KDTree.get_radii使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Bio.KDTree.KDTree
的用法示例。
在下文中一共展示了KDTree.get_radii方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_search
# 需要導入模塊: from Bio.KDTree import KDTree [as 別名]
# 或者: from Bio.KDTree.KDTree import get_radii [as 別名]
def test_search(nr_points, dim, bucket_size, radius):
"""Test search all points within radius of center.
Search all point pairs that are within radius.
Arguments:
- nr_points: number of points used in test
- dim: dimension of coords
- bucket_size: nr of points per tree node
- radius: radius of search
Returns true if the test passes.
"""
kdt = KDTree(dim, bucket_size)
coords = random.random((nr_points, dim))
kdt.set_coords(coords)
kdt.search(coords[0], radius * 100)
radii = kdt.get_radii()
l1 = 0
for i in range(0, nr_points):
p = coords[i]
if _dist(p, coords[0]) <= radius * 100:
l1 = l1 + 1
if l1 == len(radii):
return True
else:
return False