def Transition(self, phase): # present stimuli and update state variables to record what is going on #======================================================================= # #Update some states # self.states['Intertrial'] = int(phase in ['intertrial']) self.states['Baseline'] = int(phase in ['baseline']) self.states['GoCue'] = int(phase in ['gocue']) self.states['Task'] = int(phase in ['task']) # self.states['Response'] = int(phase in ['response']) # self.states['StopCue'] = int(phase in ['stopcue']) #======================================================================= if phase == 'intertrial': pass elif phase == 'baseline': pass #Do I need the new TargetClass in baseline for any of the addons? #If not, then it belongs in gocue for consistency with regular BCI2000 modules. elif phase == 'gocue': self.states['TargetClass'] = self.target_codes[ self.states['CurrentTrial'] - 1] t = self.states[ 'TargetClass'] #It's useful to pull from states in case "enslave states" is used. self.states[ 'LastTargetClass'] = t #LastTargetClass maintains throughout baseline. self.stimuli['cue'].text = self.params['GoCueText'][t - 1] elif phase == 'task': task_length = self.params['TaskDur'].val + random( ) * self.params['TaskRand'].val self.states['TaskMinNBlocks'] = task_length * self.eegfs / self.spb elif phase == 'response': pass elif phase == 'stopcue': self.stimuli['cue'].text = "Relax" self.states[ 'TargetClass'] = 0 #Note we don't turn off the LastTargetClass self.stimuli['cue'].on = (phase in ['gocue', 'stopcue']) if 'MSEnable' in self.params: MagstimApp.transition(self, phase) if 'DigitimerEnable' in self.params: DigitimerApp.transition(self, phase) if 'GatingEnable' in self.params: GatingApp.transition(self, phase) if 'ERPDatabaseEnable' in self.params: ERPApp.transition(self, phase) if 'ContFeedbackEnable' in self.params: FeedbackApp.transition(self, phase)
def Transition(self, phase): # present stimuli and update state variables to record what is going on #======================================================================= # #Update some states # self.states['Intertrial'] = int(phase in ['intertrial']) self.states['Baseline'] = int(phase in ['baseline']) self.states['GoCue'] = int(phase in ['gocue']) self.states['Task'] = int(phase in ['task']) # self.states['Response'] = int(phase in ['response']) # self.states['StopCue'] = int(phase in ['stopcue']) #======================================================================= if phase == 'intertrial': pass elif phase == 'baseline': pass #Do I need the new TargetClass in baseline for any of the addons? #If not, then it belongs in gocue for consistency with regular BCI2000 modules. elif phase == 'gocue': self.states['TargetClass'] = self.target_codes[self.states['CurrentTrial']-1] t = self.states['TargetClass'] #It's useful to pull from states in case "enslave states" is used. self.states['LastTargetClass'] = t#LastTargetClass maintains throughout baseline. self.stimuli['cue'].text = self.params['GoCueText'][t-1] elif phase == 'task': task_length = self.params['TaskDur'].val + random()*self.params['TaskRand'].val self.states['TaskMinNBlocks'] = task_length * self.eegfs / self.spb elif phase == 'response': pass elif phase == 'stopcue': self.stimuli['cue'].text = "Relax" self.states['TargetClass'] = 0 #Note we don't turn off the LastTargetClass self.stimuli['cue'].on = (phase in ['gocue', 'stopcue']) if 'MSEnable' in self.params: MagstimApp.transition(self, phase) if 'DigitimerEnable' in self.params: DigitimerApp.transition(self, phase) if 'GatingEnable' in self.params: GatingApp.transition(self, phase) if 'ERPDatabaseEnable' in self.params: ERPApp.transition(self, phase) if 'ContFeedbackEnable' in self.params: FeedbackApp.transition(self, phase)