Example #1
0
def plot_nums(kappa, real_kappa, error):
    msg = "\t\t\tK"+str(real_kappa)+"\t\t\t"
    print msg
    names, rod_groups = system_state.create_rods(kappas=kappa, real_kappas=real_kappa,
                                            allowed_kappa_error=error)
    experiment_ = experiment.Experiment(system_states_name_list=names, kappas=real_kappa,
                                        system_states_list=rod_groups,
                                        dates=dates, diff_t=5/3.0)
    experiment_.plot_number_of_rods_over_time()
Example #2
0
 def run_default(kappa, real_kappa, error):
     print "\n\n\n"
     plottable_rods, density_matrices = None, None
     bursts_groups = None
     name = str(int(real_kappa)) + "_default.log"
     log = open(name, 'w')
     msg = "\t\t\tK"+str(real_kappa)+"\t\t\t"
     print msg
     log.write(str(msg+"\n"))
     names, rod_groups = system_state.create_rods(kappas=kappa, real_kappas=real_kappa,
                                             allowed_kappa_error=error)
     experiment_ = experiment.Experiment(system_states_name_list=names, kappas=real_kappa,
                                         system_states_list=rod_groups,
                                         dates=dates, diff_t=3/5.0)
     experiment_.set_coef(coef)
     times = experiment_.times(1)
     if create_videos:
         experiment_.create_videos(divisions=divisions, fps=10, max_distance=evol_max_dist, max_angle_diff=evol_max_ang_diff,
                                  number_of_bursts=number_of_bursts, limit=temp_final_rod_num_limit, bursts_coef=burst_mult)
     if clusters:
         experiment_.plot_cluster_areas(cluster_divisions, cluster_index_length,
                 number_of_bursts=cluster_bursts, max_distance=cluster_max_dist,
                 max_angle_diff=cluster_max_angle, min_size=cluster_min_size)
     if clusters_hist:
         experiment_.create_cluster_histogram_video(cluster_divisions, 
                     cluster_index_length, max_distance=cluster_max_dist,
                     max_angle_diff=cluster_max_angle, fps=15)
     if avg_temp:
         experiment_.plot_average_average_quadratic_speed(100, 10, 5)
     if lost_percentage:
         percentage, std_dev = experiment_.lost_rods_percentage
         msg = "Rods lost: "+str(percentage)+"%\t"+" Standard deviation: "+str(std_dev)
         log.write(str(msg+"\n"))
     if plot_rods:
         plottable_rods = experiment_.plottable_rods
     if order_param:
         density_matrices = experiment_.plottable_density_matrices(divisions)
         bursts_groups = experiment_.bursts_groups
     try:
         names = None
         experiment_ = None
         rod_groups = None
         gc.collect()
     except NameError:
         pass
     log.close()
     return plottable_rods, density_matrices, bursts_groups, times
Example #3
0
 def run_prop(kappa, real_kappa, error):
     """
         Gets proportions of long/shorts rods.
     """
     msg = "\t\t\tK"+str(real_kappa)+"\t\t\t"
     names, rod_groups = system_state.create_rods(kappas=kappa, real_kappas=real_kappa,
                                             allowed_kappa_error=error, file_range=[0,5])
     experiment_ = experiment.Experiment(system_states_name_list=names, kappas=real_kappa,
                                         system_states_list=rod_groups,
                                         dates=dates, diff_t=5/3.0)
     # experiment_.set_coef(coef)
     msg = str(experiment_.average_kappa) + "\t|\t" + str(experiment_.average_kappa_dev)
     rad = experiment_.average_system_rad
     #print msg
     length = experiment_.average_rod_length
     width = experiment_.average_rod_width
     cov_area, cov_area_dev = experiment_.average_covered_area_proportion
     num_rods, num_rods_dev = experiment_.average_number_of_rods
     return cov_area, cov_area_dev, int(num_rods), int(num_rods_dev), rad, msg
Example #4
0
                    except:
                        pass
                else:
                    rods_12, matrices_12, bursts_groups, times = run_default_length(145, 35, 12)#(15, 12, 3)#run_default_length(160, 30, 12)
                    rods_6, matrices_6, bursts_groups, times = run_default_length(70, 35, 6)#(7.8, 6, 2)#run_default_length(80, 30, 6)
                if plot_rods:
                    center_x, center_y, rad = zone_coords[0], zone_coords[1], zone_coords[2]
                    x_lims = (center_x-rad, center_x+rad)
                    y_lims = (center_y-rad, center_y+rad)
                    methods.rods_animation([rods_12, rods_6], ['b', 'r'], x_lims, y_lims, zone_coords, name="rods.mp4", fps=1)
                if order_param:
                    methods.order_param_animation(matrices_12, matrices_6, divisions, bursts_groups, times)
                    

            if run_check_dim:
                names, rod_groups = system_state.create_rods(kappas=10, real_kappas=12,
                                                        allowed_kappa_error=10)
                experiment_ = experiment.Experiment(system_states_name_list=names, kappas=12,
                                                    system_states_list=rod_groups,
                                                    dates=dates, diff_t=5/3.0)
                experiment_.set_coef(coef)
                experiment_.plot_rods(0)


            #os.system("bash tomp4script.sh")
        #except KeyboardInterrupt:
        #    os.system("pkill -f main.py")
        except AssertionError as error:
            print "Assertion error({0})".format(error)
            os.system("pkill -f main.py")
    #print hp.heap()
    #print "Type exit() to exit."