def test_min_samples(self): peak_array0 = randint(6, size=(100, 2)) peak_array = np.vstack((peak_array0, [[54, 21], [53, 20], [55, 22]])) cluster_dict0 = ct._get_cluster_dict(peak_array, min_samples=2) labels0 = sorted(list(cluster_dict0.keys())) assert labels0 == [0, 1] cluster_dict1 = ct._get_cluster_dict(peak_array, min_samples=4) labels1 = sorted(list(cluster_dict1.keys())) assert labels1 == [-1, 0]
def test_eps(self): peak_array0 = randint(6, size=(100, 2)) + 80 peak_array1 = randint(6, size=(100, 2)) peak_array = np.vstack((peak_array0, peak_array1)) cluster_dict0 = ct._get_cluster_dict(peak_array) assert len(cluster_dict0) == 2 assert len(cluster_dict0[0]) == 100 assert len(cluster_dict0[1]) == 100 cluster_dict1 = ct._get_cluster_dict(peak_array, eps=200) assert len(cluster_dict1) == 1 assert len(cluster_dict1[0]) == 200
def test_three_clusters(self): peak_array0 = randint(6, size=(100, 2)) + 80 peak_array1 = randint(6, size=(100, 2)) peak_array = np.vstack((peak_array0, peak_array1, [ [54, 21], ])) cluster_dict = ct._get_cluster_dict(peak_array, min_samples=2) labels = sorted(list(cluster_dict.keys())) assert labels == [-1, 0, 1]
def test_simple(self): peak_array = randint(100, size=(100, 2)) ct._get_cluster_dict(peak_array)