Ejemplo n.º 1
0
logging.LogFile(join('.', 'results', 'logging', NAME + '_' + RAND + '.log'),
                level=logging.INFO)


@atexit.register
def save_beh():
    logging.flush()
    with open(
            join('results', 'behavioral_data',
                 'beh_{}_{}.csv'.format(NAME, RAND)), 'w') as csvfile:
        beh_writer = csv.writer(csvfile)
        beh_writer.writerows(RESULTS)


config = load_config()

SCREEN_RES = get_screen_res()
win = visual.Window(SCREEN_RES,
                    fullscr=True,
                    monitor='testMonitor',
                    units='pix',
                    screen=0,
                    color=config["BACKGROUND_COLOR"],
                    winType='pygame')
FRAMES_PER_SEC = get_frame_rate(win)

clock_image = visual.ImageStim(win=win,
                               image=join('images', 'clock.png'),
                               interpolate=True,
                               size=config['CLOCK_SIZE'],
Ejemplo n.º 2
0
        answers["left"],
        answers["right"],
        # 'LEFT_ACC', "RIGHT_ACC", "ACC",
        acc["left"],
        acc["right"],
        acc["left"] and acc["right"],
        # "LEFT_RT", "RIGHT_RT",
        rt["left"],
        rt["right"],
        # 'RT'
        round(max(rt["left"], rt["right"]), 3)
        if rt["left"] and rt["right"] else None
    ]


config = load_config("config.yaml", concatenate=True)

SCREEN_RES = get_screen_res()
window = visual.Window(SCREEN_RES,
                       fullscr=True,
                       units='pix',
                       color=config["background_color"])
mouse = event.Mouse(visible=True)

if config["show_clock_icon"]:
    clock_image = visual.ImageStim(
        win=window,
        image=join('images', 'clock.png'),
        size=config['clock_size'],
        interpolate=True,
        pos=[config['clock_position_x'], config['clock_position_y']])
Ejemplo n.º 3
0
        return page_3.page_3(info)
    if page_n == 4:
        return page_4.page_4(info)
    else:
        raise Exception("Wrong page number")


def create_new_config(info, config_name="config.yaml"):
    f = open(config_name, 'w+')
    yaml.safe_dump(info, f, allow_unicode=True)


if __name__ == "__main__":
    actual_page = 1
    try:
        information = load_config("config.yaml")
    except:
        information = {1: None, 2: None, 3: None, 4: None}
    while True:
        try:
            information[actual_page]
        except:
            information[actual_page] = None
        page_result = run_page(actual_page, information[actual_page])
        if page_result == "close":
            exit()
        elif page_result == "go_back":
            actual_page -= 1
        elif page_result is None:
            exit()
        elif actual_page == 4:
Ejemplo n.º 4
0
        answer_frame.setAutoDraw(False)
        press_space_msg.setAutoDraw(False)

    # cleaning
    for frame in frames:
        frame.setAutoDraw(False)
    matrix.set_auto_draw(False)
    idx_info.setAutoDraw(False)
    window.flip()

    time.sleep(config['JITTER_TIME'])

    return acc, rt, stim_time, m.n, m.answer_line_type


config = load_config("config_click.yaml")

window = visual.Window(SCREEN_RES, fullscr=True, monitor='testMonitor', units='pix', color='Gainsboro')
FRAMES_PER_SEC = get_frame_rate(window)
response_clock = core.Clock()
mouse = event.Mouse(visible=True)

clock_image = visual.ImageStim(win=window, image=join('images', 'clock.png'), interpolate=True,
                               size=config['CLOCK_SIZE'], pos=config['CLOCK_POS'])
pos_feedb = visual.TextStim(window, text=replace_polish(config["pos_feedb"]), color='black', height=25, pos=(0, -200))
neg_feedb = visual.TextStim(window, text=replace_polish(config["neg_feedb"]), color='black', height=25, pos=(0, -200))
no_feedb = visual.TextStim(window, text=replace_polish(config["no_feedb"]), color='black', height=25, pos=(0, -200))

press_space_msg = visual.TextStim(window, text=u'Przyci\u015Bnij spacje', color='black', height=25, pos=(0, -300))