示例#1
0
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
示例#2
0
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
示例#3
0
    'build': {
        'read_sequence': Schleyer_raw_cols,
        'read_metadata': True
    },
    'enrich': SchleyerEnrichConf
}

SchleyerGroup = {
    'id':
    'SchleyerGroup',
    'conf':
    'SchleyerConf',
    'path':
    'SchleyerGroup',
    'arena_pars':
    env.dish(0.15),
    'subgroups':
    ['no_odor', 'Ntrials', 'odor_conc', 'FRU_conc', 'new-reward-punishment']
}

JovanicDataConf = {'fr': 11.27, 'Npoints': 11, 'Ncontour': 0}

JovanicEnrichConf = {
    'rescale_by': None,
    'drop_collisions': False,
    'interpolate_nans': False,
    'filter_f': 2,
    'length_and_centroid': True,
    'drop_contour': False,
    'drop_unused_pars': False,
    # 'drop_unused_pars': True,