Exemplo n.º 1
0
                           opacity=1,
                           languageStyle='LTR',
                           depth=-2.0)

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer(
)  # to track time remaining of each (non-slip) routine

# ------Prepare to start Routine "wait_for_trig"-------
t = 0
wait_for_trigClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
initial_trigger = event.BuilderKeyResponse()
# keep track of which components have finished
wait_for_trigComponents = [intial_fix, initial_trigger]
for thisComponent in wait_for_trigComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "wait_for_trig"-------
while continueRoutine:
    # get current time
    t = wait_for_trigClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame

    # *intial_fix* updates
    if t >= 0.0 and intial_fix.status == NOT_STARTED:
Exemplo n.º 2
0
                                           depth=0.0)

blockList = ['1', '2', '3', '4', '5', '6']
random.shuffle(blockList)

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer(
)  # to track time remaining of each (non-slip) routine

#------Prepare to start Routine "start"-------
t = 0
startClock.reset()  # clock
frameN = -1
# update component parameters for each repeat
start_key_resp = event.BuilderKeyResponse(
)  # create an object of type KeyResponse
start_key_resp.status = NOT_STARTED
# keep track of which components have finished
startComponents = []
startComponents.append(start_text)
startComponents.append(start_key_resp)
for thisComponent in startComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

#-------Start Routine "start"-------
continueRoutine = True
while continueRoutine:
    # get current time
    t = startClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
Exemplo n.º 3
0
                         opacity=1,
                         languageStyle='LTR',
                         depth=0.0)

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer(
)  # to track time remaining of each (non-slip) routine

# ------Prepare to start Routine "instructions"-------
t = 0
instructionsClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
ready = event.BuilderKeyResponse()
# keep track of which components have finished
instructionsComponents = [text, ready]
for thisComponent in instructionsComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "instructions"-------
while continueRoutine:
    # get current time
    t = instructionsClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame

    # *text* updates
    if t >= 0.0 and text.status == NOT_STARTED:
Exemplo n.º 4
0
    for paramName in thisBlock_loop.keys():
        exec(paramName + '= thisBlock_loop.' + paramName)

for thisBlock_loop in block_loop:
    currentLoop = block_loop
    # abbreviate parameter names if possible (e.g. rgb = thisBlock_loop.rgb)
    if thisBlock_loop != None:
        for paramName in thisBlock_loop.keys():
            exec(paramName + '= thisBlock_loop.' + paramName)

    #------Prepare to start Routine "Block_Instructions"-------
    t = 0
    Block_InstructionsClock.reset()  # clock
    frameN = -1
    # update component parameters for each repeat
    block_key = event.BuilderKeyResponse(
    )  # create an object of type KeyResponse
    block_key.status = NOT_STARTED
    Block_image.setImage("Instructions/" + block_display + ".png")
    # keep track of which components have finished
    Block_InstructionsComponents = []
    Block_InstructionsComponents.append(block_key)
    Block_InstructionsComponents.append(Block_image)
    for thisComponent in Block_InstructionsComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED

    #-------Start Routine "Block_Instructions"-------
    continueRoutine = True
    while continueRoutine:
        # get current time
        t = Block_InstructionsClock.getTime()
Exemplo n.º 5
0
            core.quit()
        elif thisKey[0] == 'backspace' and counter > 0:
            counter -= 1
        else:
            counter += 1

    # ===== PRACTICE TRIALS ====== #
    trial_num = 0
    for thisPracTrial in prac_list:
        trial_num += 1
        # Abbeviate parameter names... e.g. thisPracTrial['beat_type'] becomes beat_type
        if thisPracTrial != None:
            for paramName in thisPracTrial:
                exec('{} = thisPracTrial[paramName]'.format(paramName))

        probe_resp = event.BuilderKeyResponse()

        ####====SETUP TRIAL COMPONENTS LIST====####
        # initialize trial components list
        trialComponents = []
        audio_stim = sound.Sound(
            str(
                os.path.join('Stimuli', 'Audio', 'Practise',
                             ('sent' + str(sent_number + 1) + '.wav'))))
        trialComponents.extend([
            audio_stim,
        ])  # add audio stim to trialComponents list

        # set probe text for the trial
        probe_text.setText(probe)
Exemplo n.º 6
0
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)

    # the Routine "simon_setup" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset()

    # ------Prepare to start Routine "simon_trial"-------
    t = 0
    simon_trialClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    routineTimer.add(2.000000)
    # update component parameters for each repeat
    left_stim.setText(left_stim_text)
    right_stim.setText(right_stim_text)
    resp = event.BuilderKeyResponse()
    # keep track of which components have finished
    simon_trialComponents = [fixation_cross, left_stim, right_stim, ITI, resp]
    for thisComponent in simon_trialComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED

    # -------Start Routine "simon_trial"-------
    while continueRoutine and routineTimer.getTime() > 0:
        # get current time
        t = simon_trialClock.getTime()
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame

        # *fixation_cross* updates
        if t >= 0.0 and fixation_cross.status == NOT_STARTED:
Exemplo n.º 7
0
                           texRes=128,
                           interpolate=True,
                           depth=-1.0)

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer(
)  # to track time remaining of each (non-slip) routine

# ------Prepare to start Routine "instructions"-------
t = 0
instructionsClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
Weiter = event.BuilderKeyResponse()
# keep track of which components have finished
instructionsComponents = [text, Weiter]
for thisComponent in instructionsComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "instructions"-------
while continueRoutine:
    # get current time
    t = instructionsClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame

    # *text* updates
    if t >= 0.0 and text.status == NOT_STARTED:
Exemplo n.º 8
0
                             pos=[0.9, -0.9],
                             height=0.1,
                             wrapWidth=None,
                             color=u'red',
                             colorSpace='rgb',
                             opacity=1,
                             depth=-4.0)

#------Prepare to start Routine "trial"-------
t = 0
kk = np.random.randint(3, 20, size=1)
trialClock.reset()  # clock
trialClock_all.reset()  # clock
#routineTimer.add(40.000000)
# update component parameters for each repeat
keybrd_input = event.BuilderKeyResponse(
)  # create an object of type KeyResponse
keybrd_input.status = NOT_STARTED
# keep track of which components have finished
trialComponents = []
trialComponents.append(instruction)
trialComponents.append(keybrd_input)
trialComponents.append(fixation)
trialComponents.append(End_instruction)
trialComponents.append(clock_disp)
for thisComponent in trialComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

#-------Start Routine "trial"-------
continueRoutine = True
Exemplo n.º 9
0
        frameN = -1
        # update component parameters for each repeat
        if podle == 'vy':
            if verze == '2D':
                textNapoveda = u'shora, od Vás'
            else:
                textNapoveda = u'z boku, od Vás'
        else:
            if verze == '2D':
                textNapoveda = u'shora, od Značky'
            else:
                textNapoveda = u'z boku, od Značky'

        text.setText(textNapoveda)
        text3.setText(opakovani)
        respNapoveda = event.BuilderKeyResponse(
        )  # create an object of type KeyResponse
        respNapoveda.status = NOT_STARTED
        # keep track of which components have finished
        napovedaComponents = []
        napovedaComponents.append(text)
        napovedaComponents.append(text2)
        napovedaComponents.append(text3)
        napovedaComponents.append(respNapoveda)
        for thisComponent in napovedaComponents:
            if hasattr(thisComponent, 'status'):
                thisComponent.status = NOT_STARTED

        #-------Start Routine "napoveda"-------
        continueRoutine = True
        while continueRoutine:
            # get current time
Exemplo n.º 10
0
def run3_func(expInfo):
    # main function
# Ensure that relative paths start from the same directory as this script
    _thisDir = os.path.dirname(os.path.abspath(__file__)).decode(sys.getfilesystemencoding())
    os.chdir(_thisDir)

# Store info about the experiment session
    expName = u'tnac_exp' # from the Builder filename that created this script
    expInfo['expName'] = expName

# Data file name stem = absolute path + name; later add .psyexp, .csv, .log, etc
    filename = _thisDir + os.sep + u'data/%s_%s_%s' %(expInfo['participant'], expName, expInfo['date'])

    trg_dict = {"music": 1,
                "voice": 2,
                "song": 3,
                "sound_off": 100,
                "pause_block": 200,
                "stop_run": 300,
                "start_run": 400,
                "start_block": 500,
                }


    #define path to csvs
    run_var= _thisDir+'/run3.csv'
    # An ExperimentHandler isn't essential but helps with data saving
    thisExp = data.ExperimentHandler(name=expName, version='',
        extraInfo=expInfo, runtimeInfo=None,
        originPath=None,
        savePickle=True, saveWideText=True,
        dataFileName=filename)
    # save a log file for detail verbose info
    logFile = logging.LogFile(filename+'.log', level=logging.EXP)
    logging.console.setLevel(logging.WARNING)  # this outputs to the screen, not a file

    endExpNow = False  # flag for 'escape' or other condition => quit the exp

    # Start Code - component code to be run before the window creation

    # Setup the Window
    ## TODO: set window to fullscreen
    win = visual.Window(
        size=[1366, 768], fullscr=True, screen=0,
        allowGUI=True, allowStencil=False,
        monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
        blendMode='avg', useFBO=True)
    # store frame rate of monitor if we can measure it
    expInfo['frameRate'] = win.getActualFrameRate()
    if expInfo['frameRate'] != None:
        frameDur = 1.0 / round(expInfo['frameRate'])
    else:
        frameDur = 1.0 / 60.0  # could not measure, so guess

    # Initialize components for Routine "trial"
    trialClock = core.Clock()
    stim_1 = sound.Sound('A', secs=-1)
    stim_1.setVolume(1)
    fix_1 = visual.TextStim(win=win, name='fix_1',
        text='+',
        font='Arial',
        pos=(0, 0), height=0.1, wrapWidth=None, ori=0,
        color='white', colorSpace='rgb', opacity=1,
        depth=-1.0);

    # Initialize components for Routine "run_start"
    run_startClock = core.Clock()
    run_start_msg_screen = visual.TextStim(win=win, name='run_start_msg_screen',
        text=u'Kurze Pause.',
        font='Arial',
        units='norm', pos=[0,0], height=0.12, wrapWidth=2, ori=0,
        color='white', colorSpace='rgb', opacity=1,
        depth=0.0);

    # Initialize components for Routine "run_trigger_sync"
    StartClock = core.Clock()
    run_trigger_syncClock = core.Clock()
    run_start_msg = visual.TextStim(win=win, name='run_start_msg',
        text='Durchgang beginnt!',
        font='Arial',
        units='norm', pos=[0, 0], height=0.15, wrapWidth=2, ori=0,
        color='white', colorSpace='rgb', opacity=1,
        depth=-1.0);
    movie = visual.MovieStim3(
        win=win, name='movie',units='pix',
        noAudio = True,
        # rename path
        filename='C:\Paradigmen\AG_Brain\Peer\TNAC\movies\mov3.mkv',
        ori=0, pos=(0, 0), opacity=1,
        depth=0.0,)

    # Create some handy timers
    globalClock = core.Clock()  # to track the time since experiment started
    routineTimer = core.CountdownTimer()  # to track time remaining of each (non-slip) routine


    block_delay = [4,5,6]*12
    random.shuffle(block_delay)
    #print(block_delay)
    # ------Prepare to start Routine "run_start"-------
    t = 0
    run_startClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    # update component parameters for each repeat
    run_start_trigger_key = event.BuilderKeyResponse()
    # keep track of which components have finished
    run_startComponents = [run_start_msg_screen, run_start_trigger_key]
    for thisComponent in run_startComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED

    # -------Start Routine "run_start"-------
    while continueRoutine:
        # get current time
        t = run_startClock.getTime()
        thisExp.addData('start_run',globalClock.getTime())
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame

        # *run_start_msg_screen* updates
        if t >= 0.0 and run_start_msg_screen.status == NOT_STARTED:
            # keep track of start time/frame for later
            run_start_msg_screen.tStart = t
            run_start_msg_screen.frameNStart = frameN  # exact frame index
            run_start_msg_screen.setAutoDraw(True)

        # *run_start_trigger_key* updates
        if t >= 0.0 and run_start_trigger_key.status == NOT_STARTED:
            # keep track of start time/frame for later
            run_start_trigger_key.tStart = t
            run_start_trigger_key.frameNStart = frameN  # exact frame index
            run_start_trigger_key.status = STARTED
            # keyboard checking is just starting
            event.clearEvents(eventType='keyboard')
        if run_start_trigger_key.status == STARTED:
            theseKeys = event.getKeys(keyList=['s'])

            # check for quit:
            if "escape" in theseKeys:
                endExpNow = True
            if len(theseKeys) > 0:  # at least one key was pressed
                # a response ends the routine
                continueRoutine = False

        # check if all components have finished
        if not continueRoutine:  # a component has requested a forced-end of Routine
            break
        continueRoutine = False  # will revert to True if at least one component still running
        for thisComponent in run_startComponents:
            if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
                continueRoutine = True
                break  # at least one component has not yet finished

        # check for quit (the Esc key)
        if endExpNow or event.getKeys(keyList=["escape"]):
            core.quit()

        # refresh the screen
        if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
            win.flip()

    # -------Ending Routine "run_start"-------
    for thisComponent in run_startComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    # the Routine "run_start" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset()

    # ------Prepare to start Routine "run_trigger_sync"-------
    t = 0
    run_trigger_syncClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    # update component parameters for each repeat
    run_trigger_sync_ = event.BuilderKeyResponse()

    # keep track of which components have finished
    run_trigger_syncComponents = [run_trigger_sync_, run_start_msg]
    for thisComponent in run_trigger_syncComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED

    # -------Start Routine "run_trigger_sync"-------
    while continueRoutine:
        # get current time
        print('waiting for scanner trigger....')
        t = run_trigger_syncClock.getTime()
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame

        # *run_trigger_sync_* updates
        if t >= 0.0 and run_trigger_sync_.status == NOT_STARTED:
            # keep track of start time/frame for later
            run_trigger_sync_.tStart = t
            run_trigger_sync_.frameNStart = frameN  # exact frame index
            run_trigger_sync_.status = STARTED
            # keyboard checking is just starting
            win.callOnFlip(run_trigger_sync_.clock.reset)  # t=0 on next screen flip
            event.clearEvents(eventType='keyboard')
        if run_trigger_sync_.status == STARTED:
            theseKeys = event.getKeys(keyList=['t'])

            # check for quit:
            if "escape" in theseKeys:
                endExpNow = True
            if len(theseKeys) > 0:  # at least one key was pressed
                run_trigger_sync_.keys = theseKeys[-1]  # just the last key pressed
                run_trigger_sync_.rt = run_trigger_sync_.clock.getTime()
                # a response ends the routine
                continueRoutine = False

        # *run_start_msg* updates
        if t >= 0.0 and run_start_msg.status == NOT_STARTED:
            # keep track of start time/frame for later
            run_start_msg.tStart = t
            run_start_msg.frameNStart = frameN  # exact frame index
            run_start_msg.setAutoDraw(True)
        frameRemains = 0.0 + 5- win.monitorFramePeriod * 0.75  # most of one frame period left
        if run_start_msg.status == STARTED and t >= frameRemains:
            run_start_msg.setAutoDraw(False)

        # check if all components have finished
        if not continueRoutine:  # a component has requested a forced-end of Routine
            break
        continueRoutine = False  # will revert to True if at least one component still running
        for thisComponent in run_trigger_syncComponents:
            if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
                continueRoutine = True
                break  # at least one component has not yet finished

        # check for quit (the Esc key)
        if endExpNow or event.getKeys(keyList=["escape"]):
            core.quit()

        # refresh the screen
        if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
            win.flip()

    # -------Ending Routine "run_trigger_sync"-------
    for thisComponent in run_trigger_syncComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    # check responses
    if run_trigger_sync_.keys in ['', [], None]:  # No response was made
        run_trigger_sync_.keys=None
    thisExp.addData('run_trigger_sync_.keys',run_trigger_sync_.keys)
    if run_trigger_sync_.keys != None:  # we had a response
        thisExp.addData('run_trigger_sync_.rt', run_trigger_sync_.rt)
    run_start_timestamp = StartClock.getTime()

    send_trigger(400)
    # the Routine "run_trigger_sync" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset()

    start_delay=False
    delay_counter= 0
    #print(block_delay)
    #print(delay_counter)
    # start movie for whole run (loop over trials)
    mov='movies/mov3.mkv'
    #print(mov)
    movie.setMovie(mov)
    if t >= 0.0 and movie.status == NOT_STARTED:
        # keep track of start time/frame for later
        movie.tStart = t
        movie.frameNStart = frameN  # exact frame index
        movie.setAutoDraw(True)
        frameRemains = 0.0 + 2- win.monitorFramePeriod * 0.75  # most of one frame period left

        # set up handler to look after randomisation of conditions etc
        trials = data.TrialHandler(nReps=1, method='sequential',
            extraInfo=expInfo, originPath=-1,
        trialList=data.importConditions(run_var),
        seed=None, name='trials')
        thisExp.addLoop(trials)  # add the loop to the experiment
        thisTrial = trials.trialList[0]  # so we can initialise stimuli with some values
        # abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
        if thisTrial != None:
            for paramName in thisTrial.keys():
                exec(paramName + '= thisTrial.' + paramName)
        stimuli_played=0

        for thisTrial in trials:
            currentLoop = trials
            # abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
            if thisTrial != None:
                for paramName in thisTrial.keys():
                    exec(paramName + '= thisTrial.' + paramName)

            # ------Prepare to start Routine "trial"-------
            t = 0
            trialClock.reset()  # clock
            frameN = -1
            continueRoutine = True

            routineTimer.add(2.000000)
            # update component parameters for each repeat
            stim_1.setSound(stimuli, secs=2)
            #read stimuli into dict and set port value
            abc= stimuli.split('/')[0]
            trg = trg_dict.get(abc, 100)
            # keep track of which components have finished
            trialComponents = [stim_1, fix_1]
            for thisComponent in trialComponents:
                if hasattr(thisComponent, 'status'):
                    thisComponent.status = NOT_STARTED

            # -------Start Routine "trial"-------
            while continueRoutine and routineTimer.getTime() > 0:


                # get current time
                t = trialClock.getTime()
                frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
                # update/draw components on each frame
                # start/stop stim_1
                if t >= 0.0 and stim_1.status == NOT_STARTED:
                    # keep track of start time/frame for later
                    stim_1.tStart = t
                    stim_1.frameNStart = frameN  # exact frame index

            ## TODO reinstate: send_trigger(abc)
                    #print(abc)
                    stim_1.play()  # start the sound (it finishes automatically)
                    send_trigger(trg) # send block specific trigger
                    # get time for stimuls start
                    thisExp.addData('stimulus_start_global',globalClock.getTime())
                    thisExp.addData('stimulus_start_routineTimer',routineTimer.getTime())
                    thisExp.addData('stimulus_start_',frameN)
                    #print(stim_1)
                    stimuli_played+=1
                    if stimuli_played%5 == 0:
                        start_delay=True
                    print('stimuli_nr:'+str(stimuli_played))


                frameRemains = 0.0 + 1.5 - win.monitorFramePeriod * 0.75  # most of one frame period left
                #frameRemainsdelay = 0.0 + 1.5- win.monitorFramePeriod * 0.75  # most of one frame period left
                if stim_1.status == STARTED and t >= frameRemains:
                    stim_1.stop()  # stop the sound (if longer than duration)
                    send_trigger(100) # send sound off trigger
                    # get info on stim end
                thisExp.addData('stimulus_end_global',globalClock.getTime())
                thisExp.addData('stimulus_end_routineTimer',routineTimer.getTime())

                # add delay intervall after 5 stimuli
                if stimuli_played %5 == 0 and start_delay and delay_counter != 35:
                    send_trigger(200)
                    delay=block_delay[delay_counter]
                    routineTimer.add(block_delay[delay_counter])
                    #frameRemainsdelay = 0.0 + 1.5 + delay - win.monitorFramePeriod * 0.75  # most of one frame period left
                    #print('delay='+str(delay_counter))
                    delay_counter +=1
                    thisExp.addData('delay_counter',block_delay[delay_counter])
                    thisExp.addData('block_end_global',globalClock.getTime())
                    start_delay=False
                
                if stim_1.status == STARTED and t >= frameRemains:
                    stim_1.stop()  # stop the sound (if longer than duration)
                    send_trigger(100) # send sound off trigger
                    # get info on stim end
                thisExp.addData('stimulus_end_global',globalClock.getTime())
                thisExp.addData('stimulus_end_routineTimer',routineTimer.getTime())
                
                # check if all components have finished
                if not continueRoutine:  # a component has requested a forced-end of Routine
                    break
                continueRoutine = False  # will revert to True if at least one component still running
                for thisComponent in trialComponents:
                    if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
                        continueRoutine = True
                        break  # at least one component has not yet finished

                # check for quit (the Esc key)
                if endExpNow or event.getKeys(keyList=["escape"]):
                    core.quit()

                # refresh the screen
                if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
                    win.flip()




            stim_1.stop()  # ensure sound has stopped at end of routine
            thisExp.nextEntry()

            # completed 1 repeats of 'trials'

        thisExp.nextEntry()



        # completed 1 repeats of 'block'

    if stimuli_played == 180:
        movie.setAutoDraw(False)
        send_trigger(300) # END RUN
        thisExp.saveAsWideText(filename+'run3'+'.csv')
        thisExp.saveAsPickle(filename+'run3')
        logging.flush()
        # make sure everything is closed down
        thisExp.abort()  # or data files will save again on exit
        win.close()
Exemplo n.º 11
0
    font='Arial',
    pos=(0, 0), height=30, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1,
    depth=0.0);

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer()  # to track time remaining of each (non-slip) routine 

# ------Prepare to start Routine "consg"-------
t = 0
consgClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
resp = event.BuilderKeyResponse()

# keep track of which components have finished
consgComponents = [appuyer, resp]
for thisComponent in consgComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "consg"-------
while continueRoutine:
    # get current time
    t = consgClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *appuyer* updates
Exemplo n.º 12
0
    font='arial',
    pos=[0, 0], height=0.2, wrapWidth=None, ori=0, 
    color=[1, 1, 1], colorSpace='rgb', opacity=1,
    depth=0.0);

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer()  # to track time remaining of each (non-slip) routine 

# ------Prepare to start Routine "instructPractice"-------
t = 0
instructPracticeClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
ready1 = event.BuilderKeyResponse()
# keep track of which components have finished
instructPracticeComponents = [instr1, ready1]
for thisComponent in instructPracticeComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "instructPractice"-------
while continueRoutine:
    # get current time
    t = instructPracticeClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *instr1* updates
    if t >= 0.0 and instr1.status == NOT_STARTED:
Exemplo n.º 13
0
    colorSpace='rgb',
    opacity=1,
    depth=0.0)

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer(
)  # to track time remaining of each (non-slip) routine

# ------Prepare to start Routine "intro"-------
t = 0
introClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp_2 = event.BuilderKeyResponse()
# keep track of which components have finished
introComponents = [key_resp_2, intro_txt]
for thisComponent in introComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "intro"-------
while continueRoutine:
    # get current time
    t = introClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame

    # *key_resp_2* updates
    if t >= 0.0 and key_resp_2.status == NOT_STARTED:
def choice(leftVarText, leftVarMoney, rightVarText, rightVarMoney):
    t = 0
    ChoiceClock.reset()
    frameN = -1
    continueRoutine = True
    routineTimer.add(3.0000)
    leftText.setText(leftVarText)
    rightText.setText(rightVarText)
    rightMoney.setText(rightVarMoney)
    leftMoney.setText(leftVarMoney)
    responses = event.BuilderKeyResponse()
    blank.setText('')
    ChoiceComponents = [
        leftText, rightText, rightMoney, leftMoney, responses, blank
    ]
    for thisComponent in ChoiceComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED

    while continueRoutine:
        t = ChoiceClock.getTime()
        frameN = frameN + 1

        if t >= 0.0 and leftText.status == NOT_STARTED:
            leftText.tStart = t
            leftText.frameNStart = frameN
            leftText.setAutoDraw(True)

        if t >= 0.0 and rightText.status == NOT_STARTED:
            rightText.tStart = t
            rightText.frameNStart = frameN
            rightText.setAutoDraw(True)

        if t >= 0.0 and rightMoney.status == NOT_STARTED:
            rightMoney.tStart = t
            rightMoney.frameNStart = frameN
            rightMoney.setAutoDraw(True)

        if t >= 0.0 and leftMoney.status == NOT_STARTED:
            leftMoney.tStart = t
            leftMoney.frameNStart = frameN
            leftMoney.setAutoDraw(True)

        if t >= 0.0 and responses.status == NOT_STARTED:
            responses.tStart = t
            responses.frameNStart = frameN
            responses.status = STARTED
            win.callOnFlip(responses.clock.reset)
            event.clearEvents(eventType='keyboard')
        if responses.status == STARTED and bool(blank.status == STARTED):
            responses.status = FINISHED
        if responses.status == STARTED:
            theseKeys = event.getKeys(keyList=['q', 'p'])

            if "escape" in theseKeys:
                endExpNow = True
            if len(theseKeys) > 0:
                responses.keys = theseKeys[-1]
                responses.rt = responses.clock.getTime()

        if responses.keys == 'p':
            rightMoney.setColor("green")
            rightText.setColor('green')
        if responses.keys == 'q':
            leftMoney.setColor("green")
            leftText.setColor('green')

        if leftText.status == STARTED and t >= 3.000:
            leftText.setAutoDraw(False)
            rightText.setAutoDraw(False)
            leftMoney.setAutoDraw(False)
            rightMoney.setAutoDraw(False)
            blank.setAutoDraw(False)
            continueRoutine = False

        if (blank.status == STARTED and t >= (blank.tStart + 1.0)):
            blank.setAutoDraw(False)

        if responses.keys == 'p' or responses.keys == 'q':
            responses.status = FINISHED

        if (blank.status == FINISHED):
            rightText.setAutoDraw(False)
            rightMoney.setAutoDraw(False)
            leftMoney.setAutoDraw(False)
            leftText.setAutoDraw(False)
            continueRoutine = False

        if (responses.keys == 'p'
                or responses.keys == 'q') and blank.status == NOT_STARTED:
            blank.tStart = t
            blank.frameNStart = frameN
            blank.setAutoDraw(True)

        if not continueRoutine:
            break
        continueRoutine = False
        for thisComponent in ChoiceComponents:
            if hasattr(thisComponent,
                       "status") and thisComponent.status != FINISHED:
                continueRoutine = True
                break

        if continueRoutine:
            win.flip()

    for thisComponent in ChoiceComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    if responses.keys in ['', [], None]:
        responses.keys = None
    Loop.addData('responses.keys', responses.keys)
    if responses.keys != None:
        Loop.addData('responses.rt', responses.rt)

    if blank.status == FINISHED:
        leftMoney.setAutoDraw(False)
        rightMoney.setAutoDraw(False)
        leftText.setAutoDraw(False)
        rightText.setAutoDraw(False)

    leftMoney.setColor('white')
    rightMoney.setColor('white')
    leftText.setColor('white')
    rightText.setColor('white')

    routineTimer.reset()
Exemplo n.º 15
0
        dfStims['block_'+str(type+1)+'_img'] = img_ids
        dfStims['block_'+str(type+1)+'_ans'] = seq_ans

dfStims.to_csv('practice_stims.csv', index= False)


# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer()  # to track time remaining of each (non-slip) routine

#------Prepare to start Routine "Instructions"-------
t = 0
InstructionsClock.reset()  # clock
frameN = -1
# update component parameters for each repeat
instructions_response = event.BuilderKeyResponse()  # create an object of type KeyResponse
instructions_response.status = NOT_STARTED
# keep track of which components have finished
InstructionsComponents = []
InstructionsComponents.append(instrText)
InstructionsComponents.append(instructions_response)
for thisComponent in InstructionsComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

#-------Start Routine "Instructions"-------
continueRoutine = True
while continueRoutine:
    # get current time
    t = InstructionsClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
Exemplo n.º 16
0
    colorSpace='rgb',
    opacity=1,
    depth=-1.0)

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer(
)  # to track time remaining of each (non-slip) routine

#------Prepare to start Routine "Inst"-------
t = 0
InstClock.reset()  # clock
frameN = -1
# update component parameters for each repeat

MoveOn = event.BuilderKeyResponse()  # create an object of type KeyResponse
MoveOn.status = NOT_STARTED
# keep track of which components have finished
InstComponents = []
InstComponents.append(Instructions)
InstComponents.append(MoveOn)
for thisComponent in InstComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

#-------Start Routine "Inst"-------
continueRoutine = True
while continueRoutine:
    # get current time
    t = InstClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
Exemplo n.º 17
0
    pos=[0, 0], height=0.1, wrapWidth=None,
    color='white', colorSpace='rgb', opacity=1,
    depth=0.0)

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer()  # to track time remaining of each (non-slip) routine 

#------Prepare to start Routine "instr"-------
switchasdf4 = False
switchasdf6 = False
t = 0
instrClock.reset()  # clock 
frameN = -1
# update component parameters for each repeat
key_resp_3 = event.BuilderKeyResponse()  # create an object of type KeyResponse
key_resp_3.status = NOT_STARTED
# keep track of which components have finished
instrComponents = []
instrComponents.append(text)
instrComponents.append(key_resp_3)
for thisComponent in instrComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

#-------Start Routine "instr"-------
continueRoutine = True
while continueRoutine:
    # get current time
    t = instrClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
Exemplo n.º 18
0
    WordListObjects.append(textTemp)
    count += 1

# ########
# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer(
)  # to track time remaining of each (non-slip) routine

# ------Prepare to start Routine "Instructions"-------
t = 0
InstructionsClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp_4 = event.BuilderKeyResponse()
# keep track of which components have finished
InstructionsComponents = [instr, key_resp_4]
for thisComponent in InstructionsComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "Instructions"-------
while continueRoutine:
    # get current time
    t = InstructionsClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame

    # *instr* updates
    if t >= 0.0 and instr.status == NOT_STARTED:
Exemplo n.º 19
0
                               color='white',
                               colorSpace='rgb',
                               opacity=1,
                               depth=-3.0)

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer(
)  # to track time remaining of each (non-slip) routine

#------Prepare to start Routine "wait_for_trig"-------
t = 0
wait_for_trigClock.reset()  # clock
frameN = -1
# update component parameters for each repeat
start_trigger = event.BuilderKeyResponse(
)  # create an object of type KeyResponse
start_trigger.status = NOT_STARTED
# keep track of which components have finished
wait_for_trigComponents = []
wait_for_trigComponents.append(wait_crosshair)
wait_for_trigComponents.append(start_trigger)
for thisComponent in wait_for_trigComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

#-------Start Routine "wait_for_trig"-------
continueRoutine = True
while continueRoutine:
    # get current time
    t = wait_for_trigClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    pos=[0, 0], height=0.2, wrapWidth=None, ori=0, 
    color=[1, 1, 1], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer()  # to track time remaining of each (non-slip) routine 

# ------Prepare to start Routine "instruct"-------
t = 0
instructClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
ready = event.BuilderKeyResponse()
# keep track of which components have finished
instructComponents = [instrText, ready]
for thisComponent in instructComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "instruct"-------
while continueRoutine:
    # get current time
    t = instructClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *instrText* updates
    if t >= 0 and instrText.status == NOT_STARTED:
Exemplo n.º 21
0
 while prac_redo:
     for thisPrac_inst_trial in prac_inst_trials:
         currentLoop = prac_inst_trials
         # abbreviate parameter names if possible (e.g. rgb = thisPrac_inst_trial.rgb)
         if thisPrac_inst_trial != None:
             for paramName in thisPrac_inst_trial:
                 exec('{} = thisPrac_inst_trial[paramName]'.format(paramName))
         
         # ------Prepare to start Routine "trial"-------
         t = 0
         trialClock.reset()  # clock
         frameN = -1
         continueRoutine = True
         # update component parameters for each repeat
         inst_image.setImage(inst_cat_path + inst_image_path)
         key_resp_2 = event.BuilderKeyResponse()
         
         # keep track of which components have finished
         trialComponents = [inst_image, key_resp_2]
         for thisComponent in trialComponents:
             if hasattr(thisComponent, 'status'):
                 thisComponent.status = NOT_STARTED
         
         # -------Start Routine "trial"-------
         while continueRoutine:
             # get current time
             t = trialClock.getTime()
             frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
             # update/draw components on each frame
             
             # *inst_image* updates
Exemplo n.º 22
0
        # Pre-load first distractor so psychopy will be ready to draw it.
        # Keep track of stim number here, to be updated each loop (after distractor "off")
        stim_num = 0
        CRA_distractor = CRA_dist_list[stim][stim_num]

        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        # Pre-load first position so psychopy will be ready to draw it.
        # Keep track of position number here, to be updated each loop (after distractor "off")
        pos_num = 0
        CRA_distractor.pos = CRA_pos_list[position][pos_num]

        # !!!!!!!!!!!!!!!!!!!!!!!!!!!
        # How long between distractors
        offTime = distTime + 1.0

    solution_cra = event.BuilderKeyResponse(
    )  # create an object of type KeyResponse
    solution_cra.status = NOT_STARTED
    # keep track of which components have finished
    CRAComponents = []
    CRAComponents.append(CRA_problems)
    CRAComponents.append(CRA_distractor)
    CRAComponents.append(solution_cra)

    for thisComponent in CRAComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED

    # -------Start Routine "CRA"-------
    continueRoutine = True
    while continueRoutine and routineTimer.getTime() > 0:
        # get current time
Exemplo n.º 23
0
    # update component parameters for each repeat
    stimuli.setSound('Stimuli' + os.path.sep + 'normalized-180' + os.path.sep +
                     '%s_%s' % (thisTrial.sound, thisTrial.speaker) +
                     os.path.sep + '%s%s.wav' %
                     (thisTrial.sound, thisTrial.file))
    triggercounter = 0
    trialClock = core.Clock()
    t = 0
    trialClock.reset()  # clock
    frameN = -1
    routineTimer.add(0.500000)

    # keep track of which components have finished
    pausePress = []
    resumePress = []
    pauseKey = event.BuilderKeyResponse(
    )  #create an object of type KeyResponse
    pauseKey.status = NOT_STARTED
    resumeKey = event.BuilderKeyResponse(
    )  #create an object of type KeyResponse
    resumeKey.status = NOT_STARTED
    respKey1 = event.BuilderKeyResponse(
    )  #create an object of type KeyResponse
    respKey1.status = NOT_STARTED
    trialComponents = []
    trialComponents.append(stimuli)
    trialComponents.append(pauseScr)
    for thisComponent in trialComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED

    #-------Start Routine "trial"-------
Exemplo n.º 24
0
    # refresh the screen
    if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
        win.flip()

# -------Ending Routine "welcome"-------
for thisComponent in welcomeComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)

# ------Prepare to start Routine "scantrigger"-------
t = 0
scantriggerClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
scan_trigger = event.BuilderKeyResponse()
# keep track of which components have finished
scantriggerComponents = [scan_trigger, scan_trigger_text]
for thisComponent in scantriggerComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "scantrigger"-------
while continueRoutine:
    # get current time
    t = scantriggerClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *scan_trigger* updates
    if t >= 0.0 and scan_trigger.status == NOT_STARTED:
Exemplo n.º 25
0
treminder_sound.setVolume(1)

blockList = ['1', '2', '3', '4', '5', '6']
random.shuffle(blockList)

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer(
)  # to track time remaining of each (non-slip) routine

#------Prepare to start Routine "instr3_5"-------
t = 0
instr3_5Clock.reset()  # clock
frameN = -1
# update component parameters for each repeat
key_resp_13 = event.BuilderKeyResponse(
)  # create an object of type KeyResponse
key_resp_13.status = NOT_STARTED
# keep track of which components have finished
instr3_5Components = []
instr3_5Components.append(text_11)
instr3_5Components.append(key_resp_13)
instr3_5Components.append(image_15)
for thisComponent in instr3_5Components:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

#-------Start Routine "instr3_5"-------
continueRoutine = True
while continueRoutine:
    # get current time
    t = instr3_5Clock.getTime()
Exemplo n.º 26
0
     InstructionLoopNum = 1
 
 
 #-----If 'left' button is pressed to go back in instructions------
 #--------call up appropriate instruction to be displayed.---------
 instructionImgDisplayed = instruct_Dir + os.sep+'memInstruct_' + str(InstructionLoopNum) + '.JPG'
 
 
 #-----------Get Time of Onset for each Instruction----------
 Onset = TaskClock.getTime()
 
 #-----------------Add Data---------------------
 thisExp.addData('Stimulus','instructions')
 thisExp.addData('Onset',Onset)
 Instruction.setImage(instructionImgDisplayed)
 nextInstruction = event.BuilderKeyResponse()
 # keep track of which components have finished
 InstructComponents = [Instruction, nextInstruction]
 for thisComponent in InstructComponents:
     if hasattr(thisComponent, 'status'):
         thisComponent.status = NOT_STARTED
 
 # -------Start Routine "Instruct"-------
 while continueRoutine:
     # get current time
     t = InstructClock.getTime()
     frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
     # update/draw components on each frame
     
     
     # *Instruction* updates
Exemplo n.º 27
0
# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer(
)  # to track time remaining of each (non-slip) routine

#------Prepare to start Routine "trial_2"-------
t = 0
trial_2Clock.reset()  # clock
frameN = -1
routineTimer.add(11.000000)
# update component parameters for each repeat
UpperText.setText(' L K R G M X ')
UpperBrackets.setText('  {         }')
LowerText.setText(' b t y g q j ')
resp = event.BuilderKeyResponse()  # create an object of type KeyResponse
resp.status = NOT_STARTED
# keep track of which components have finished
trial_2Components = []
trial_2Components.append(ISI)
trial_2Components.append(TopUpperLine)
trial_2Components.append(UpperText)
trial_2Components.append(UpperBrackets)
trial_2Components.append(BotUpperLine)
trial_2Components.append(TopLowerLine)
trial_2Components.append(LowerText)
trial_2Components.append(LowerBrackets)
trial_2Components.append(BotLowerLine)
trial_2Components.append(TrialCrossHair)
trial_2Components.append(RestCrossHair)
trial_2Components.append(resp)
Exemplo n.º 28
0
    font='Arial',
    units='pix', pos=[0, 0], height=60.0, wrapWidth=None, ori=0, 
    color='black', colorSpace='rgb', opacity=1,
    depth=-1.0);

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer()  # to track time remaining of each (non-slip) routine 

# ------Prepare to start Routine "instruction"-------
t = 0
instructionClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
toStart = event.BuilderKeyResponse()
# keep track of which components have finished
instructionComponents = [Instr, toStart]
for thisComponent in instructionComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "instruction"-------
while continueRoutine:
    # get current time
    t = instructionClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *Instr* updates
    if t >= 0.0 and Instr.status == NOT_STARTED:
Exemplo n.º 29
0
    font='Arial',
    pos=[0, 0], height=0.1, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1,
    depth=0.0);

# Create some handy timers
globalClock = core.Clock()  # to track the time since experiment started
routineTimer = core.CountdownTimer()  # to track time remaining of each (non-slip) routine 

# ------Prepare to start Routine "intro"-------
t = 0
introClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp_2 = event.BuilderKeyResponse()
# keep track of which components have finished
introComponents = [intro_text, key_resp_2]
for thisComponent in introComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "intro"-------
while continueRoutine:
    # get current time
    t = introClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *intro_text* updates
    if t >= 0.0 and intro_text.status == NOT_STARTED:
def InstructionsPractice(thisPrac, endExpNow):

    # Setup the Window
    dispWidth = 1024
    dispHeight = 768
    wini = visual.Window(size=(dispWidth, dispHeight),
                         fullscr=True,
                         screen=0,
                         allowGUI=False,
                         allowStencil=False,
                         monitor='testMonitor',
                         color=[0.5, 0.5, 0.5],
                         colorSpace='rgb',
                         blendMode='avg',
                         useFBO=False,
                         units='pix')

    # Initialize components for Routine "instrMain"
    instrMainClock = core.Clock()
    inst = ''
    instrPic = visual.ImageStim(win=wini,
                                name='instrPic',
                                image='sin',
                                mask=None,
                                ori=0,
                                pos=(0, 0),
                                color=[1, 1, 1],
                                colorSpace='rgb',
                                opacity=1,
                                flipHoriz=False,
                                flipVert=False,
                                texRes=128,
                                interpolate=False,
                                depth=-1.0)

    # Show instructions on screen
    inst_n = 0
    inst_list = [
        'instr_prac1.png', 'instr_prac2.png', 'instr_prac3.png',
        'instr_prac4.png', 'instr_prac5.png', 'instr_prac6.png',
        'instr_prac7.png', 'instr_prac8.png', 'instr_prac9.png',
        'instr_prac10.png', 'instr_prac11.png', 'instr_prac12.png',
        'instr_prac13.png'
    ]
    inst_pres = 1
    while inst_pres == 1:
        # ------Prepare to start Routine "instrMain"-------
        t = 0
        instrMainClock.reset()  # clock
        continueRoutine = True
        # update component parameters for each repeat
        inst = 'instructions/' + inst_list[inst_n]
        instrPic.setImage(inst)
        ok1 = event.BuilderKeyResponse()
        # keep track of which components have finished
        instrMainComponents = [instrPic, ok1]
        for thisComponent in instrMainComponents:
            if hasattr(thisComponent, 'status'):
                thisComponent.status = NOT_STARTED

        # -------Start Routine "instrMain"-------
        while continueRoutine:
            # get current time
            t = instrMainClock.getTime()

            # *instrPic* updates
            if t >= 0.0 and instrPic.status == NOT_STARTED:
                # keep track of start time/frame for later
                instrPic.tStart = t
                instrPic.setAutoDraw(True)

            # *ok1* updates
            if t >= 0.0 and ok1.status == NOT_STARTED:
                # keep track of start time/frame for later
                ok1.tStart = t
                ok1.status = STARTED
                # keyboard checking is just starting
                wini.callOnFlip(ok1.clock.reset)  # t=0 on next screen flip
                event.clearEvents(eventType='keyboard')
            if ok1.status == STARTED:
                theseKeys = event.getKeys(keyList=['left', 'down', 'right'])
                # check for quit:
                if "escape" in theseKeys:
                    endExpNow = True
                if len(theseKeys) > 0:  # at least one key was pressed
                    ok1.keys = theseKeys[-1]  # just the last key pressed
                    ok1.rt = ok1.clock.getTime()
                    # a response ends the routine
                    continueRoutine = False

            # check if all components have finished
            if not continueRoutine:  # a component has requested a forced-end of Routine
                break
            continueRoutine = False  # will revert to True if at least one component still running
            for thisComponent in instrMainComponents:
                if hasattr(thisComponent,
                           "status") and thisComponent.status != FINISHED:
                    continueRoutine = True
                    break  # at least one component has not yet finished

            # check for quit (the Esc key)
            if endExpNow or event.getKeys(keyList=["escape"]):
                wini.close()
                core.quit()

            # refresh the screen
            if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
                wini.flip()

        # -------Ending Routine "instrMain"-------
        for thisComponent in instrMainComponents:
            if hasattr(thisComponent, "setAutoDraw"):
                thisComponent.setAutoDraw(False)

        # check responses
        thisPrac.addData('ok1.keys', ok1.keys)
        thisPrac.addData('ok1.rt', ok1.rt)
        thisPrac.nextEntry()

        # determine which image to show next
        if inst_n not in [5, 6, 8, 9]:
            if ok1.keys == 'right':  # right click = move forward
                if inst_n == 12:
                    inst_pres = 0
                    break
                else:
                    inst_n = inst_n + 1
            elif ok1.keys == 'left':  #left click = move back
                if inst_n >= 1:
                    inst_n = inst_n - 1
        elif inst_n in [5, 9]:  #test questions where correct response is down
            if ok1.keys == 'down':
                inst_n = inst_n + 1
        elif inst_n in [6, 8]:  #test questions where correct response is right
            if ok1.keys == 'right':
                inst_n = inst_n + 1

    return (thisPrac)