def startExperiment(self, stimuli_list, run):
        """
        Start the experiment with the specified stimuli list.

        Parameters
        ----------
        stimuli_list : str
            list of stimuli to use. Only specify the name of the list. 
            The respective file should reside in the folder of the python file. Wav-files should be stored in a subfolder "wav" without further subdirectories.
            If stimuli_list is empty, a reandomized list will be generated or used if it is already present. These lists are created for each
            participant and session and are stored in the subfolder 'stim_lists'
        """
        if not stimuli_list:
            filenames, responseTimes = self.generateOrReadStimulusList(run)
        else:
            filenames, responseTimes = self.readStimulusList(stimuli_list)

        self.waitForButton(-1, ['space'], 'Press space to start')
        self.fixation.autoDraw = True
        startTriggers(self)
        self.presentSound('wav' + os.sep + 'Instruktionen.wav')
        self.fixation.autoDraw = False
        waitForFMRITrigger(self, 'Gleich geht es los...')
        logging.log(level=logging.EXP,
                    msg='fMRI trigger (first)\t' +
                    str(self.globalClock.getTime()))
        self.fixation.autoDraw = True
        for n in range(0, len(filenames)):
            path = 'wav' + os.sep + filenames[n]
            self.presentSound(path, responseTime=responseTimes[n] / 1000)
        self.finish()
 def startTraining(self):
     """
     Start a training run which always uses the standard training stimuli list: stimuli_list_training.csv
     """
     filenames, responseTimes = self.readStimulusList(
         'stimuli_list_training.csv')
     startTriggers(self)
     self.waitForButton(-1, ['space'], 'Press space to start')
     self.presentSound('wav' + os.sep + 'Instruktionen.wav')
     self.waitForButton(-1, ['space'], 'Press space to continue')
     self.fixation.autoDraw = False
     for n in range(0, len(filenames)):
         path = 'wav' + os.sep + filenames[n]
         self.presentSound(path, responseTime=responseTimes[n] / 1000)
     self.finish()
Beispiel #3
0
    def startExperiment(self, run = 1):
        """
        Start the experiment with the specified parameters.

        Parameters
        ----------
        set : int (default : 1)
            set of audio files to use: 1 - files 1-12, 2 - files 13-24
            The respective files should reside in a "stimuli" subfolder of the directory of this python file.
            Within this subfolder, stimuli are organized in subfolders according to the language, e.g. "German"
        language : string
            language of the stimuli to use (default: 'German')
        """
        self.setup()
        self.setupStimuli(self.language, run)
        
        msg = 'Ihnen werden nun Ausschnitte aus der Geschichte "Alice im Wunderland" vorgespielt. Bitte hören Sie sich diese möglichst aufmerksam an. Wundern Sie sich nicht, wenn manche Passagen völlig unverständlich und voller Rauschen sind.'
        if self.language == "English":
            msg = 'We will now play excerpts from the story "Alice in Wonderland". Please listen carefully and don\'t be surprised if some parts are incomprehensible or noisy.'
        self.waitForButton(msg, ['space'])

        startTriggers(self)

        msg = 'Gleich geht es los...'
        if self.language == "English":
            msg = 'We\'ll start in a moment...'
        waitForFMRITrigger(self, msg)

        self.fixation.autoDraw = True
        self.processBlocks(run-1) # zero-based index
        self.fixation.autoDraw = False

        msg = 'Ende der Aufgabe'
        if self.language == "English":
            msg = 'You have completed the task.'
        self.waitForButton(msg, ['space'])
        self.finish()
Beispiel #4
0
    def test(self):
        keyb = keyboard.Keyboard()
        continueTest = True

        startTriggers(self)
        while (continueTest):
            trigger, button1, button2 = checkForFMRITriggerOrResponse(self)
            if trigger:
                print("fMRI trigger received")

            if button1 == BUTTON_PRESSED:
                print("Button 1 pressed")
            elif button1 == BUTTON_RELEASED:
                print("Button 1 released")

            if button2 == BUTTON_PRESSED:
                print("Button 2 pressed")
            elif button2 == BUTTON_RELEASED:
                print("Button 2 released")

            if keyb.getKeys(keyList=["escape"]):
                continueTest = False

        self.close()
Beispiel #5
0
                               font='Arial',
                               pos=(0, 0),
                               height=0.16,
                               wrapWidth=None,
                               ori=0,
                               color='white',
                               colorSpace='rgb',
                               opacity=1,
                               languageStyle='LTR',
                               depth=0.0)
if expInfo['Send triggers'] == 'yes':
    setupTriggers(self, MODE_EXP)
else:
    setupTriggers(self, MODE_DEV)

startTriggers(self)

# Initialize components for Routine "end"
endClock = core.Clock()
text_end = visual.TextStim(win=win,
                           name='text_end',
                           text='Ende der Aufgabe',
                           font='Arial',
                           pos=(0, 0),
                           height=0.1,
                           wrapWidth=None,
                           ori=0,
                           color='white',
                           colorSpace='rgb',
                           opacity=1,
                           languageStyle='LTR',