def gen_control_targets(self, psc_target): u_vec = gc.calc_control(self, psc_target) u_vec_reduced = u_vec[0:self.N_ACTIVE_TIME] mvc_list, phase_list = gc.betas_to_mvc_phase(self, self.psc_betas, u_vec_reduced) return self.gen_target_list(mvc_list, phase_list)
def frame_based_updates(game, time_passed): # check for controller update if (game.run_type == 'nfb' and not(game.controller_calc_bool) and game.timers['trial'].time > game.CONTROL_TRIGGER_TIME): game.controller_calc_bool = True if game.timers['trial'].count > 0: game.calc_y_psc() if game.RUN_TYPE_LIST[game.nfb_run_count-1] == 'closed': u_vec = gc.calc_control(game, game.PSC_TARGET_LIST[ game.nfb_run_count-1], game.u_vec, game.y_vec) game.update_control_targets(u_vec) else: game.u_vec = gc.calc_control(game, game.PSC_TARGET_LIST[ game.nfb_run_count-1]) game.update_control_targets(np.zeros((1,game.N_CONTROL_STEPS))) fu.record_control(game,game.f_control) if game.timers['trial'].time_limit_hit: game.timers['trial'].update(time_passed) reset_for_next_trial(game) elif game.timers['trial'].time < game.INTRO_TRIGGER_TIME['trial']: game.timers['trial'].update(time_passed) show_fixation(game) elif game.timers['trial'].time < game.ACTIVE_TRIGGER_TIME['trial']: game.timers['trial'].update(time_passed) blink_in_targets(game) # self-paced logic elif game.self_paced_bool: if not(check_done(game)): game.timers['move'].update(time_passed) check_targets(game, time_passed) fu.record_frame(game,game.f_frame) elif not(game.timers['trial'].time_limit_hit): if not(game.calc_score_bool): calc_score_s_p(game) game.timers['trial'].update(time_passed) show_score_s_p(game) # timed logic else: if game.timers['trial'].time < game.FEEDBACK_TRIGGER_TIME['trial']: game.timers['trial'].update(time_passed) check_targets(game, time_passed) fu.record_frame(game,game.f_frame) elif not(game.timers['trial'].time_limit_hit): if not(game.calc_score_bool): calc_score_timed(game) game.timers['trial'].update(time_passed) show_score_timed(game) else: reset_for_next_trial(game) if game.timers['trial'].count_limit_hit: game.run_mode = 'idle'