本文整理汇总了Python中dipy.segment.clustering.ClusterMap.get_large_clusters方法的典型用法代码示例。如果您正苦于以下问题:Python ClusterMap.get_large_clusters方法的具体用法?Python ClusterMap.get_large_clusters怎么用?Python ClusterMap.get_large_clusters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dipy.segment.clustering.ClusterMap
的用法示例。
在下文中一共展示了ClusterMap.get_large_clusters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cluster_map_get_small_and_large_clusters
# 需要导入模块: from dipy.segment.clustering import ClusterMap [as 别名]
# 或者: from dipy.segment.clustering.ClusterMap import get_large_clusters [as 别名]
def test_cluster_map_get_small_and_large_clusters():
rng = np.random.RandomState(42)
nb_clusters = 11
cluster_map = ClusterMap()
# Randomly generate small clusters
indices = [rng.randint(0, 10, size=i) for i in range(1, nb_clusters+1)]
small_clusters = [Cluster(indices=indices[i]) for i in range(nb_clusters)]
cluster_map.add_cluster(*small_clusters)
# Randomly generate small clusters
indices = [rng.randint(0, 10, size=i)
for i in range(nb_clusters+1, 2*nb_clusters+1)]
large_clusters = [Cluster(indices=indices[i]) for i in range(nb_clusters)]
cluster_map.add_cluster(*large_clusters)
assert_equal(len(cluster_map), 2*nb_clusters)
assert_equal(len(cluster_map.get_small_clusters(nb_clusters)),
len(small_clusters))
assert_arrays_equal(cluster_map.get_small_clusters(nb_clusters),
small_clusters)
assert_equal(len(cluster_map.get_large_clusters(nb_clusters+1)),
len(large_clusters))
assert_arrays_equal(cluster_map.get_large_clusters(nb_clusters+1),
large_clusters)