def test_fof(): numpy.random.seed(1000) pos = numpy.linspace(0, 1, 10000, endpoint=False).reshape(-1, 1) tree = KDTree(pos).root label = tree.fof(1.1 / len(pos)) assert_equal(numpy.unique(label).size, 1) label = tree.fof(0.8 / len(pos)) assert_equal(numpy.unique(label).size, len(pos))
def test_fof(): numpy.random.seed(1000) pos = numpy.linspace(0, 1, 10000, endpoint=False).reshape(-1, 1) tree = KDTree(pos).root label = tree.fof(1.1/ len(pos)) assert_equal(numpy.unique(label).size, 1) label = tree.fof(0.8/ len(pos)) assert_equal(numpy.unique(label).size, len(pos))
def test_fof_ind(method): numpy.random.seed(1000) pos = numpy.arange(100000).reshape(-1, 1).astype('f4') ind = numpy.arange(len(pos))[::-2] tree = KDTree(pos, ind=ind).root label = tree.fof(2.1, method=method) assert len(label) == len(pos) correct_label = numpy.arange(len(pos)) correct_label[::-2] = label[1] assert_equal(label, correct_label) label = tree.fof(0.8, method=method) correct_label = numpy.arange(len(pos)) # one group per active particle. assert_equal(label, correct_label)