Exemplo n.º 1
0
from job_generator import generate_job
from casting_strategyABCD import create_trajectory_data
#from graphics_from_file import save_plot, save_detection_plot
"""
generates several job files containing the conditions of the simulations
calls upon "casting competition" to create trajectory data
(each call simulates four navigator types in one plume simulation)
plots a single plot for each one

"""

if __name__ == "__main__":
    for i in range(4):
        job_file_name = 'sims/job' + str(i) + '.json'
        data_file_name = 'sims/data' + str(i) + '.json'
        #titles_file_name = 'titles'+ str(i)+ '.json'
        generate_job(char_time=7,
                     amplitude=0.1,
                     job_file=job_file_name,
                     t_max=20,
                     puff_release_rate=100,
                     puff_spread_rate=0.0001 * (1 + i),
                     dt=0.01,
                     num_it=1)
        navigator_titles = create_trajectory_data(job_file_name,
                                                  data_file_name)
        title = 'loop ' + str(i)
        #save_plot(job_file_name,data_file_name,title,navigator_titles)
        #save_detection_plot(job_file_name,data_file_name,navigators_titles)
        print('finished simulation number ' + str(i + 1))
Exemplo n.º 2
0
"""

if __name__ == "__main__":
    num_jobs = 10
    for i in range(num_jobs):
        detectthresh = 1640
        speed = 50
        molamount = 41.28
        timesimulated = 20

        sim_name = 'detectthresh-'+str(detectthresh)+'_speed-'+str(speed)+'_molamount-'+str(molamount)+'_timesimulated-'+str(timesimulated)+'/'
        Path('sims/'+sim_name).mkdir(parents=True, exist_ok=True)

        job_file_name = 'sims/'+sim_name+'job'+ str(i)+ '.json'
        data_file_name = 'sims/'+sim_name+'data'+ str(i)+ '.json'

        generate_job(char_time = 7, amplitude = 0.1, job_file = job_file_name,
                     t_max = timesimulated, dt = 0.01, num_it = 1, puff_spread_rate = 0.0001, 
                     puff_release_rate = 50+i*(200-50)/(num_jobs-1), detect_threshold = detectthresh,
                     flight_speed = speed, puff_mol_amount = molamount
                     )
        navigator_titles = create_trajectory_data(job_file_name,data_file_name)
        print ('finished simulation number ' + str(i+1))

# run the plots right after running the simulation
#exec(open("stats_compare1strategy.py").read())

# run stats right after running the simulation
calculate_stats(sim_name,num_jobs)

from job_generator import generate_job
from casting_competition import create_trajectory_data
from graphics_from_file import save_plot, save_detection_plot

"""
generates several job files containing the conditions of the simulations
calls upon "casting competition" to create trajectory data
(each call simulates four navigator types in one plume simulation)
plots a single plot for each one

"""

if __name__ == "__main__":
    for i in range(4):
        job_file_name = 'job'+ str(i)+ '.json'
        data_file_name = 'data'+ str(i)+ '.json'
        #titles_file_name = 'titles'+ str(i)+ '.json'       
        generate_job(char_time = 7, amplitude = 0.05*i, job_file = job_file_name,
                     t_max =15, puff_release_rate = 100,
                     puff_spread_rate = 0.0003,
                     dt = 0.01, num_it = 1)
        navigator_titles = create_trajectory_data(job_file_name,data_file_name)
        title = 'loop ' +str(i) 
        #save_plot(job_file_name,data_file_name,title,navigator_titles)
        #save_detection_plot(job_file_name,data_file_name,navigators_titles)
        print ('finished simulation number ' + str(i+1))