Potential_Fields.Direct_Arena_Potential_Field, Potential_Fields.Play_Arena_Potential_Field, Potential_Fields.Furtive_Arena_Potential_Field ] the_arenas = {} for a in arenas_tmp_lst: an_arena = a(C['Origin'], C['Mult'], C['markers'], False, 1.0, 1.5) the_arenas[an_arena['type']] = an_arena #break the_arenas_ready = True #img = an_arena['Image']['img'] #!!!!!!!!!! TEMP #img[img>1] = 0 cars = {} for car_name in C['car_names']: cars[car_name] = Cars.Car(N, car_name, C['Origin'], C['Mult'], C['markers']) # cars['Mr_Yellow']['runs']['direct_rewrite_test_29Apr17_00h23m07s_Mr_Yellow']['trajectory']['data']['t_to_indx'] #current_run = Runs.Run('direct_rewrite_test_25Apr17_16h09m24s_Mr_Black',cars,an_arena,C['bair_car_data_location']) current_run = Runs.Run('direct_rewrite_test_29Apr17_00h23m07s_Mr_Yellow', cars, an_arena, C['bair_car_data_location']) # clockwise = 270° relative angle, to wall = 0°, counter-clockwise = 90° for k in the_arenas: an_arena = the_arenas[k] T_OFFSET_VALUE = 0 ctr_timer = Timer(0)
for a in arenas_tmp_lst: an_arena = a(C['Origin'], C['Mult'], C['markers'], False, 1.0, 1.5) the_arenas[an_arena['type']] = an_arena del arenas_tmp_lst the_arenas_ready = True #so(opjD('the_arenas'),the_arenas) else: pass #the_arenas = lo(opjD('the_arenas')) if 'the_cars_ready' not in locals(): print("Loading cars . . .") cars = {} for car_name in C['car_names']: cars[car_name] = Cars.Car(N, car_name, C['Origin'], C['Mult'], C['markers'], C['bair_car_data_location']) the_cars_ready = True if SAVE_DATA: unix('mkdir -p ' + opjD('output_data')) car_name = current_car_name #for car_name in [C['car_names'][0]]: for run_name in cars[car_name]['runs'].keys(): output_data = {} try: current_run = Runs.Run(run_name, cars, an_arena, C['bair_car_data_location']) current_run['rewind']()
the_arena = Potential_Fields.Furtive_Arena_Potential_Field( Origin, Mult, markers) mode = the_arena['type'] the_arena['Image']['img'] = z2o(the_arena['Image']['img']) if mode == 'Follow_Arena_Potential_Field': the_arena['Image']['img'] *= 0.5 the_arena['Image']['img'] += 0.5 if 'INITALIZED' not in locals(): INITALIZED = True cars = {} for car_name in [ 'Mr_Black', 'Mr_Silver', 'Mr_Yellow', 'Mr_Orange', 'Mr_Blue' ]: cars[car_name] = Cars.Car(N, car_name, Origin, Mult, markers) run_name = 'direct_rewrite_test_28Apr17_17h23m15s_Mr_Black' our_car = Cars.car_name_from_run_name(run_name) T0 = cars[our_car]['runs'][run_name]['trajectory']['ts'][0] Tn = cars[our_car]['runs'][run_name]['trajectory']['ts'][-1] loct = cars[our_car]['runs'][run_name][ 'list_of_other_car_trajectories'] cars[our_car]['load_image_and_meta_data'](run_name, bair_car_data_location) for car_name in cars: cars[car_name]['rewind']() if GRAPHICS: figure(1, figsize=(12, 12)) clf() ds = 5
print("Creating arenas . . .") the_arenas = [ Potential_Fields.Direct_Arena_Potential_Field( Origin, Mult, markers) ] #, #Potential_Fields.Follow_Arena_Potential_Field(Origin,Mult,markers), #Potential_Fields.Furtive_Arena_Potential_Field(Origin,Mult,markers), #Potential_Fields.Play_Arena_Potential_Field(Origin,Mult,markers)] #if 'INITALIZED' not in locals(): INITALIZED = True cars = {} for car_name in [ 'Mr_Black', 'Mr_Silver', 'Mr_Yellow', 'Mr_Orange', 'Mr_Blue' ]: cars[car_name] = Cars.Car(N, car_name, Origin, Mult, markers) #run_name = 'direct_rewrite_test_28Apr17_17h23m15s_Mr_Black' #our_car = Cars.car_name_from_run_name(run_name) #our_car = random.choice(N.keys()) #run_name = random.choice(N[our_car].keys()) for our_car in [ 'Mr_Black', 'Mr_Silver', 'Mr_Yellow', 'Mr_Orange', 'Mr_Blue' ]: #cars.keys(): for run_name in cars[our_car]['runs'].keys(): output_data = {} output_name = opjD(run_name + '.output_data.pkl') output_data[run_name] = {} if len(gg(output_name)) > 0: print(output_name + ' exists, continuing.') #time.sleep(1)