def get_replay_kwargs(args): if args.tick_range is not None: if len(args.tick_range) != 2 or args.tick_range[0] > args.tick_range[1]: raise ValueError('Inappropriate tick range') fix = args.fix_points if fix is not None: use_background = True if len(fix) == 2 and np.abs(fix[1]) == 1: fix_point, secondary_fix_point = fix[0], fix[0] + fix[1] elif len(fix) == 1: fix_point, secondary_fix_point = fix[0], None else: raise ValueError('Inappropriate fix points') else: fix_point, secondary_fix_point = None, None use_background = False if args.dynamic_color is None: dynamic_color = None elif args.dynamic_color == 'lin': dynamic_color = 'lin_color' elif args.dynamic_color == 'ang': dynamic_color = 'ang_color' dims = args.arena_dims if dims is not None: if len(dims) == 2: arena_pars = env.arena(dims[0], dims[1]) elif len(dims) == 1: arena_pars = env.dish(dims[0]) else: raise ValueError('Inappropriate arena dimensions') else: arena_pars = None replay_kwargs = {'agent_ids': args.agent_ids, 'align_mode': args.align_mode, 'fix_point': fix_point, 'secondary_fix_point': secondary_fix_point, 'draw_Nsegs': args.draw_Nsegs, 'use_background': use_background, 'time_range_in_ticks': args.tick_range, 'dynamic_color': dynamic_color, 'arena_pars': arena_pars, 'draw_contour': args.draw_contour, 'draw_midline': args.draw_midline, 'draw_centroid': args.draw_centroid, } return replay_kwargs
def setDataGroup(id=None): if id is None: id = get_input("Enter DataGroup id", itype=str) print(f' ----- Registration of new DataGroup : {id} ----- ') print(f' -- Step 1 : DataGroup Configuration') if get_input("Use an existing configuration? ", itype=bool, default=False): conf_id = get_input("Enter the id of the DataGroup Configuration to use", itype=str, accepted=list(loadConfDict().keys())) else: conf_id = get_input("Enter the id of the new DataGroup Configuration", itype=str, default=f'{id}Conf') conf = setConf(conf_id) print(f' -- Step 2 : DataGroup Path') path = get_input("Enter DataGroup relative path", itype=str, default=id) print(f' -- Step 3 : DataGroup Arena') shape = get_input("Enter arena shape", itype=str, accepted=['circular', 'rectangular'], default='circular') if shape == 'circular': r = get_input("Enter arena radius in m", itype=float, range=[0, +np.inf], default=0.15) arena_pars = env.dish(r) elif shape == 'rectangular': x = get_input("Enter arena x dimension in m", itype=float, range=[0, +np.inf], default=0.15) y = get_input("Enter arena y dimension in m", itype=float, range=[0, +np.inf], default=0.15) arena_pars = env.arena(x, y) print(f' -- Step 4 : DataGroup Subgroups') Nsubgroups = get_input("How many subgroups are there?", itype=int, default=0) subgroups = [] for i in range(Nsubgroups): subgroups.append(get_input(f"Set id of subgroup {i} of {Nsubgroups}", itype=str, default=f'subgroup_{i}')) DataGroup = { 'id': id, 'conf': conf_id, 'path': path, 'arena_pars': arena_pars, 'subgroups': subgroups } print(f' -- Step 5 : DataGroup additional parameters') while get_input("Add additional parameter?", itype=bool, default=False): key = get_input("Enter additional parameter name", itype=str) itype = get_input(f"Enter data type for {key}", itype=type) value = get_input(f"Enter value for {key}", itype=itype) DataGroup[key] = value saveDataGroup(DataGroup) return DataGroup
'par': 'JovanicParConf', 'build': { 'read_sequence': None, 'read_metadata': False }, 'enrich': JovanicEnrichConf } JovanicGroup = { 'id': 'JovanicGroup', 'conf': 'JovanicConf', 'path': 'JovanicGroup', 'genotypes': ['AttP2@UAS_TNT', 'AttP240@UAS_TNT'], 'subgroups': ['AttP2@UAS_TNT', 'AttP240@UAS_TNT', 'FoodPatches'], 'conditions': ['Fed', 'ProteinDeprived', 'Starved'], 'arena_pars': env.arena(0.193, 0.193) } TestGroup = { 'id': 'TestGroup', 'conf': 'SchleyerConf', 'path': 'TestGroup', 'subgroups': [], 'arena_pars': env.dish(0.15) } SimGroup = { 'id': 'SimGroup', 'conf': 'SimConf', 'path': 'SimGroup', 'subgroups': ['single_runs', 'batch_runs'],