random.seed(1)
dataset = random.rand(dataSize, dim)
testset = random.rand(testSize, dim)

def test1(numIter=1000):
    """Test tree build time."""
flann = FLANN()
for k in range(numIter):
    kdtree = spatial.cKDTree(dataset, leafsize=10)
params = flann.build_index(dataset, target_precision=0.0, log_level='info')

def test2(numIter=100):
    kdtree = spatial.cKDTree(dataset, leafsize=10)
K nearest neighbour in python