font=u'Arial', height=config['FEEDBACK_SIZE'], wrapWidth=win.size[0], color=u'black', alignHoriz='center', alignVert='center', pos=config["FEEDBACK_POS"]) mouse = event.Mouse() response_clock = core.Clock() trial_nr = 1 # TRAINING show_info(win, join('.', 'messages', "instruction1.txt"), text_size=config['TEXT_SIZE'], screen_width=SCREEN_RES[0]) # show_image(window, 'instruction.png', SCREEN_RES) for item in load_train(config["TRAINING_TRIALS"]): if config["TRAINING_FEEDBACK"]: accept_box.accept_label.text = config["ACCEPT_BOX_TEXT_FEEDBACK"] else: accept_box.accept_label.text = config["ACCEPT_BOX_TEXT"] trial = Trial(win=win, config=config, item=item) trial.run(config=config, win=win, response_clock=response_clock, clock_image=clock_image, mouse=mouse, accept_box=accept_box,
for k, n, ans_type in data_train: corr1, corr2, acc, rt1, rt2 = run_trial(win, k, n, ans_type, config, config["feedback_in_training"], feedb) RESULTS.append( [i, "train", k, n, ans_type, corr1, corr2, acc, rt1, rt2]) i += 1 mean_acc += 1 if acc else 0 if i > 1: mean_acc /= (i - 1) else: break if mean_acc < config["min_training_acc"] and training_nr == 5: show_info(win, join('.', 'messages', "end.txt"), text_size=config['TEXT_SIZE'], screen_width=SCREEN_RES[0]) logging.critical('Training not completed') exit(1) if mean_acc < config["min_training_acc"]: show_info(win, join('.', 'messages', "training_info.txt"), text_size=config['TEXT_SIZE'], screen_width=SCREEN_RES[0]) # EXPERIMENT show_info(win, join('.', 'messages', "instruction2.txt"), text_size=config['TEXT_SIZE'], screen_width=SCREEN_RES[0], key=config["exit_key"])
if config["OPHTHALMIC_PROCEDURE"]: TRIGGER_NO, TRIGGERS_LIST = ophthalmic_procedure( win, screen_res, FRAMES_PER_SEC, TRIGGER_NO, TRIGGERS_LIST, config["TEXT_SIZE"], send_eeg_triggers=config["EEG_TRIGGERS"], port_eeg=PORT_EEG, exit_key=config["EXIT_KEY"]) # TRAINING show_info(win, join('.', 'messages', "training.txt"), text_size=config['TEXT_SIZE'], screen_width=SCREEN_RES[0], exit_key=config["EXIT_KEY"]) run(words=train_words[:config["TRAIN_TRIALS"]]) # EXPERIMENT show_info(win, join('.', 'messages', "instruction.txt"), text_size=config['TEXT_SIZE'], screen_width=SCREEN_RES[0], exit_key=config["EXIT_KEY"]) run(words=exp_words) # END show_info(win, join('.', 'messages', "end.txt"),
RESULTS.append(prepare_result(i, info, answers, rt, acc, "train")) i += 1 if not config["one_target"]: mean_acc += 1 if acc["left"] and acc["right"] else 0 else: mean_acc += 1 if acc["left"] else 0 if i > 1: mean_acc /= (i - 1) else: print("AA") break if mean_acc < config["training_accuracy"] and training_nr == config[ 'training_attempts']: show_info(window, join('.', 'texts', "too_many_attempts.txt"), text_size=config['text_size'], screen_width=SCREEN_RES[0], color=config['text_color']) exit(1) if mean_acc < config["training_accuracy"]: show_info(window, join('.', 'texts', "after_unsuccessful_training.txt"), text_size=config['text_size'], screen_width=SCREEN_RES[0], color=config['text_color']) # EXPERIMENT if config["session_type"] == "Predefined test": _, data_exp = load_trials(join("tests", config['predefined_test'])) if config["randomize_trials_order"]: random.shuffle(data_exp)