def show_output_dynamics(sync_output_dynamics): """! @brief Shows several output dynamics (output of each oscillator) during simulation. @details Each dynamic is presented on separate plot. @param[in] sync_output_dynamics (list): list of output dynamics 'sync_dynamic' of the Sync network. @see show_output_dynamic """ draw_dynamics_set(sync_output_dynamics, "t", "phase", None, [0, 2 * 3.14], False, False)
def show_output_dynamics(sync_output_dynamics): """! @brief Shows several output dynamics (output of each oscillator) during simulation. @details Each dynamic is presented on separate plot. @param[in] sync_output_dynamics (list): list of output dynamics 'sync_dynamic' of the Sync network. @see show_output_dynamic """ draw_dynamics_set(sync_output_dynamics, "t", "phase", None, [0, 2 * 3.14], False, False);
def template_segmentation_image(source, color_radius, object_radius, noise_size, show_dyn): data = read_image(source); print("Pixel dimension: ", len(data[0])); network = syncnet(data, color_radius, ccore = True); print("Network has been created"); (ticks, analyser) = timedcall(network.process, 0.9995, solve_type.FAST, show_dyn); print("Sample: ", source, "\t\tExecution time: ", ticks, "\n"); if (show_dyn is True): sync_visualizer.show_output_dynamic(analyser); clusters = analyser.allocate_clusters(); real_clusters = [cluster for cluster in clusters if len(cluster) > noise_size]; draw_image_mask_segments(source, real_clusters); if (object_radius is None): return; # continue analysis pointer_image = Image.open(source); image_size = pointer_image.size; object_colored_clusters = []; object_colored_dynamics = []; total_dyn = []; for cluster in clusters: coordinates = []; for index in cluster: y = floor(index / image_size[0]); x = index - y * image_size[0]; coordinates.append([x, y]); print(coordinates); # perform clustering analysis of the colored objects if (network is not None): del network; network = None; if (len(coordinates) < noise_size): continue; network = syncnet(coordinates, object_radius, ccore = True); analyser = network.process(0.999, solve_type.FAST, show_dyn); if (show_dyn is True): object_colored_dynamics.append( (analyser.time, analyser.output) ); object_clusters = analyser.allocate_clusters(); # decode it real_description_clusters = []; for object_cluster in object_clusters: real_description = []; for index_object in object_cluster: real_description.append(cluster[index_object]); real_description_clusters.append(real_description); if (len(real_description) > noise_size): object_colored_clusters.append(real_description); # draw_image_mask_segments(source, [ cluster ]); # draw_image_mask_segments(source, real_description_clusters); draw_image_mask_segments(source, object_colored_clusters); if (show_dyn is True): draw_dynamics_set(object_colored_dynamics, None, None, None, [0, 2 * 3.14], False, False);