def __init__(self, view, trigger, iter, seq_fac, config, trial_fix_cross=False, burst_fix_cross=False, trial_input=False, burst_input=False, sequence_input=False): self._view = view self._trigger = trigger self._iter = iter self._stimulus_sequence = seq_fac self._trial_input = trial_input self._burst_input = burst_input self._sequence_input = sequence_input self._triggerer = BurstTriggerer(config.nonalpha_trigger, self._trigger) self.__init_parameters(config) self.__init_attributes()
class Trial(object): def __init__(self, view, trigger, iter, seq_fac, config, trial_fix_cross=False, burst_fix_cross=False, trial_input=False, burst_input=False, sequence_input=False): self._view = view self._trigger = trigger self._iter = iter self._stimulus_sequence = seq_fac self._trial_input = trial_input self._burst_input = burst_input self._sequence_input = sequence_input self._triggerer = BurstTriggerer(config.nonalpha_trigger, self._trigger) self.__init_parameters(config) self.__init_attributes() def __init_parameters(self, config): self._inter_burst = config.inter_burst self._inter_sequence = config.inter_sequence self._symbol_duration = config.symbol_duration self._max_diff = config.max_diff self._trial_countdown = config.show_trial_countdown self._trial_fix_cross = config.show_trial_fix_cross self._burst_fix_cross = config.show_burst_fix_cross def __init_attributes(self): self._logger = logging.getLogger('Trial') self.asking = False self._current_target = '' def _burst(self, symbols): for symbol, color in self._iter(symbols): self._view.symbol(symbol, color) self._triggerer.symbol(symbol) self._triggerer() self._view.present(self._symbol_duration) self._view.clear_center_word() def _ask(self): self.asking = True self._view.ask() self.asking = False def _sequence(self, sequence): pass def run(self, sequences): self._trigger(marker.TRIAL_START, wait=True) self._run(sequences) self._trigger(marker.TRIAL_END, wait=True) def _run(self, sequences): if self._trial_countdown: self._view.countdown() if self._trial_fix_cross: self._view.show_fixation_cross() for seq in self._iter(sequences): self._sequence(seq) if self._sequence_input: self._ask() sleep(self._inter_sequence) if self._trial_input: self._ask() def target(self, target): self._current_target = target self._triggerer.target(target) def evaluate(self, input_handler): pass