def template_animated_clustering(file, radius, order, expected_cluster_amount): sample = read_sample(file) expected_result_obtained = False analyser = None while (expected_result_obtained == False): network = syncnet(sample, radius, initial_phases=initial_type.RANDOM_GAUSSIAN, ccore=True) analyser = network.process(order, solve_type.FAST, True) clusters = analyser.allocate_clusters(0.1) if (len(clusters) == expected_cluster_amount): print("Expected result is obtained - start rendering...") expected_result_obtained = True visualizer = cluster_visualizer() visualizer.append_clusters(clusters, sample) visualizer.show() else: print( "Expected result is NOT obtained - rendering is NOT started ( actual:", len(clusters), ")...") syncnet_visualizer.animate_cluster_allocation( sample, analyser, tolerance=0.1, save_movie="clustering_animation.mp4")
def template_animated_clustering(file, radius, order, expected_cluster_amount, title_animation = None): sample = read_sample(file); expected_result_obtained = False; analyser = None; while (expected_result_obtained == False): network = syncnet(sample, radius, initial_phases = initial_type.RANDOM_GAUSSIAN, ccore = True); analyser = network.process(order, solve_type.FAST, True); clusters = analyser.allocate_clusters(0.1); if (len(clusters) == expected_cluster_amount): print("Expected result is obtained - start rendering...") expected_result_obtained = True; visualizer = cluster_visualizer(); visualizer.append_clusters(clusters, sample); visualizer.show(); else: print("Expected result is NOT obtained - rendering is NOT started ( actual:", len(clusters), ")..."); syncnet_visualizer.animate_cluster_allocation(sample, analyser, tolerance = 0.1, save_movie = "clustering_animation.mp4", title = title_animation);
def testVisualizeClusteringAnimationNoError(self): sample = read_sample(SIMPLE_SAMPLES.SAMPLE_SIMPLE1) network = syncnet(sample, 1.0) analyser = network.process(0.998, solve_type.FAST, True) syncnet_visualizer.animate_cluster_allocation(sample, analyser)
def testVisualizerNoFailure(self): sample = read_sample(SIMPLE_SAMPLES.SAMPLE_SIMPLE1) network = syncnet(sample, 1.0, ccore=False) analyser = network.simulate(25, 5, solve_type.FAST, True) syncnet_visualizer.animate_cluster_allocation(sample, analyser)
def testVisualizerNoFailure(self): sample = read_sample(SIMPLE_SAMPLES.SAMPLE_SIMPLE1); network = syncnet(sample, 1.0, ccore = False); analyser = network.simulate(25, 5, solve_type.FAST, True); syncnet_visualizer.animate_cluster_allocation(sample, analyser);