#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy2 Experiment Builder (v1.75.01), Mon Jan 14 20:28:20 2013
If you publish work using this script please cite the relevant PsychoPy publications
Peirce, JW (2007) PsychoPy - Psychophysics software in Python. Journal of Neuroscience Methods, 162(1-2), 8-13.
Peirce, JW (2009) Generating stimuli for neuroscience using PsychoPy. Frontiers in Neuroinformatics, 2:10. doi: 10.3389/neuro.11.010.2008
"""
from __future__ import division # so that 1/3=0.333 instead of 1/3=0
from psychopy import visual, core, data, event, logging, gui, sound
from psychopy.constants import * # things like STARTED, FINISHED
import numpy as np # whole numpy lib is available, prepend 'np.'
from numpy import sin, cos, tan, log, log10, pi, average, sqrt, std, deg2rad, rad2deg, linspace, asarray
from numpy.random import random, randint, normal, shuffle
import os # handy system and path functions
# Store info about the experiment session
expName = 'None' # from the Builder filename that created this script
expInfo = {'participant':'', 'session':'001'}
dlg = gui.DlgFromDict(dictionary=expInfo, title=expName)
if dlg.OK == False: core.quit() # user pressed cancel
expInfo['date'] = data.getDateStr() # add a simple timestamp
expInfo['expName'] = expName
# Setup files for saving
if not os.path.isdir('data'):
os.makedirs('data') # if this fails (e.g. permissions) we will get error
filename = 'data' + os.path.sep + '%s_%s' %(expInfo['participant'], expInfo['date'])
logFile = logging.LogFile(filename+'.log', level=logging.EXP)
logging.console.setLevel(logging.WARNING) # this outputs to the screen, not a file
# 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)
# Setup the Window
win = visual.Window(size=(1440, 900), fullscr=True, screen=0, allowGUI=False, allowStencil=False,
monitor='testMonitor', color=[0,0,0], colorSpace='rgb')
# Initialize components for Routine "welcome"
welcomeClock = core.Clock()
welcome_text = visual.TextStim(win=win, ori=0, name='welcome_text',
text=u' \xbf\xbf\xbf WORD or PSEUDO WORD ???\nThank you for participating in this study! I am happy to have you here. Today you have two tasks in this experiment.\n\n1) You will hear words and determine whether you heard real or nonsense words.\n\n2) You will hear nonsense words and identify what you hear.\n\nPlease press SPACEBAR to proceed.',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=1.5,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "instruction01"
instruction01Clock = core.Clock()
instruction01_text = visual.TextStim(win=win, ori=0, name='instruction01_text',
text='INSTRUCTION\nLet\'s move onto the first task. You will hear words spoken by a person in the picture on your PC screen.\n\nPress "YES" if the word is a real word.\nPress "NO" if the word is a nonsense word.\n\nYou will have three practices before your experiment starts. Please try to respond as fast as possible.\n\nPress SPACEBAR to proceed.',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=1.5,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "ready"
readyClock = core.Clock()
ready_text = visual.TextStim(win=win, ori=0, name='ready_text',
text='READY?',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=None,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "fixation"
fixationClock = core.Clock()
fixation_text = visual.TextStim(win=win, ori=0, name='fixation_text',
text='++',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=None,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "practice"
practiceClock = core.Clock()
practice_sound = sound.Sound('A')
practice_sound.setVolume(1)
practice_image = visual.ImageStim(win=win, name='practice_image',
image='sin', mask=None,
ori=0, pos=[0, 0], size=[1.5, 1.5],
color=[1,1,1], colorSpace='rgb', opacity=1,
texRes=128, interpolate=True, depth=-1.0)
# Initialize components for Routine "break01"
break01Clock = core.Clock()
break01text = visual.TextStim(win=win, ori=0, name='break01text',
text='Great! Now you know what to do in this task. If you have any questions, call your assistant now. Otherwise, press SPACEBAR to proceed.',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=1.5,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "ready"
readyClock = core.Clock()
ready_text = visual.TextStim(win=win, ori=0, name='ready_text',
text='READY?',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=None,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "fixation"
fixationClock = core.Clock()
fixation_text = visual.TextStim(win=win, ori=0, name='fixation_text',
text='++',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=None,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "trial"
trialClock = core.Clock()
trial01_sound = sound.Sound('A')
trial01_sound.setVolume(1)
trial01_image = visual.ImageStim(win=win, name='trial01_image',
image='sin', mask=None,
ori=0, pos=[0, 0], size=[1.5, 1.5],
color=[1,1,1], colorSpace='rgb', opacity=1,
texRes=128, interpolate=True, depth=-1.0)
# Initialize components for Routine "minibreak"
minibreakClock = core.Clock()
mini_text = visual.TextStim(win=win, ori=0, name='mini_text',
text='You have been doing great job! Keep going! Press SPACEBAR to resume your task.',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=1.5,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "fixation"
fixationClock = core.Clock()
fixation_text = visual.TextStim(win=win, ori=0, name='fixation_text',
text='++',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=None,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "trial02"
trial02Clock = core.Clock()
trial02_sound = sound.Sound('A')
trial02_sound.setVolume(1)
trial_02image = visual.ImageStim(win=win, name='trial_02image',
image='sin', mask=None,
ori=0, pos=[0, 0], size=[1.5, 1.5],
color=[1,1,1], colorSpace='rgb', opacity=1,
texRes=128, interpolate=True, depth=-1.0)
# Initialize components for Routine "break02"
break02Clock = core.Clock()
break02_text = visual.TextStim(win=win, ori=0, name='break02_text',
text='Awesome! You just finished your first task. Before you move onto the next task, would you please call your assistant now?',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=1.5,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "welcomeback"
welcomebackClock = core.Clock()
welcoemback_text = visual.TextStim(win=win, ori=0, name='welcoemback_text',
text='Welcome back! Now you are set for the next task.\n\nWhenever you are ready, press SPACEBAR to proceed.',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=1.5,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "instruction02"
instruction02Clock = core.Clock()
instruction02_text = visual.TextStim(win=win, ori=0, name='instruction02_text',
text='INSTRUCTION\nYou will hear nonsense words, and determine if they contain S or SH sounds.\n\nPress "S" when you heard an S sound (e.g., see).\nPress "SH" when you heard an SH sound (e.g., she)\n\nWhen you are ready, press SPACEBAR to proceed.',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=1.5,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "ready"
readyClock = core.Clock()
ready_text = visual.TextStim(win=win, ori=0, name='ready_text',
text='READY?',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=None,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "fixation"
fixationClock = core.Clock()
fixation_text = visual.TextStim(win=win, ori=0, name='fixation_text',
text='++',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=None,
color='white', colorSpace='rgb', opacity=1,
depth=0.0)
# Initialize components for Routine "catergorization"
catergorizationClock = core.Clock()
cat_sound = sound.Sound('A')
cat_sound.setVolume(1)
cat_image = visual.ImageStim(win=win, name='cat_image',
image='sin', mask=None,
ori=0, pos=[0, 0], size=[1.5, 1.5],
color=[1,1,1], colorSpace='rgb', opacity=1,
texRes=128, interpolate=True, depth=-1.0)
# Initialize components for Routine "thankyou"
thankyouClock = core.Clock()
thanks_text = visual.TextStim(win=win, ori=0, name='thanks_text',
text='Well done! Thank you very much for participating in this experiment! Much appreciation for your help. Please call your assistant now.',
font='Arial',
pos=[0, 0], height=0.1, wrapWidth=1.5,
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"welcome"-------
t = 0
welcomeClock.reset() # clock
frameN = -1
# update component parameters for each repeat
welcome_key = event.BuilderKeyResponse() # create an object of type KeyResponse
welcome_key.status = NOT_STARTED
# keep track of which components have finished
welcomeComponents = []
welcomeComponents.append(welcome_text)
welcomeComponents.append(welcome_key)
for thisComponent in welcomeComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "welcome"-------
continueRoutine = True
while continueRoutine:
# get current time
t = welcomeClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *welcome_text* updates
if t >= 0.0 and welcome_text.status == NOT_STARTED:
# keep track of start time/frame for later
welcome_text.tStart = t # underestimates by a little under one frame
welcome_text.frameNStart = frameN # exact frame index
welcome_text.setAutoDraw(True)
# *welcome_key* updates
if t >= 0.0 and welcome_key.status == NOT_STARTED:
# keep track of start time/frame for later
welcome_key.tStart = t # underestimates by a little under one frame
welcome_key.frameNStart = frameN # exact frame index
welcome_key.status = STARTED
# keyboard checking is just starting
welcome_key.clock.reset() # now t=0
event.clearEvents()
if welcome_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['space'])
if len(theseKeys) > 0: # at least one key was pressed
welcome_key.keys = theseKeys[-1] # just the last key pressed
welcome_key.rt = welcome_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in welcomeComponents:
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 event.getKeys(["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 "welcome"-------
for thisComponent in welcomeComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
#------Prepare to start Routine"instruction01"-------
t = 0
instruction01Clock.reset() # clock
frameN = -1
# update component parameters for each repeat
instruction01_key = event.BuilderKeyResponse() # create an object of type KeyResponse
instruction01_key.status = NOT_STARTED
# keep track of which components have finished
instruction01Components = []
instruction01Components.append(instruction01_text)
instruction01Components.append(instruction01_key)
for thisComponent in instruction01Components:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "instruction01"-------
continueRoutine = True
while continueRoutine:
# get current time
t = instruction01Clock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *instruction01_text* updates
if t >= 0.0 and instruction01_text.status == NOT_STARTED:
# keep track of start time/frame for later
instruction01_text.tStart = t # underestimates by a little under one frame
instruction01_text.frameNStart = frameN # exact frame index
instruction01_text.setAutoDraw(True)
# *instruction01_key* updates
if t >= 0.0 and instruction01_key.status == NOT_STARTED:
# keep track of start time/frame for later
instruction01_key.tStart = t # underestimates by a little under one frame
instruction01_key.frameNStart = frameN # exact frame index
instruction01_key.status = STARTED
# keyboard checking is just starting
instruction01_key.clock.reset() # now t=0
event.clearEvents()
if instruction01_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['space'])
if len(theseKeys) > 0: # at least one key was pressed
instruction01_key.keys = theseKeys[-1] # just the last key pressed
instruction01_key.rt = instruction01_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in instruction01Components:
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 event.getKeys(["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 "instruction01"-------
for thisComponent in instruction01Components:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
#------Prepare to start Routine"ready"-------
t = 0
readyClock.reset() # clock
frameN = -1
routineTimer.add(2.000000)
# update component parameters for each repeat
# keep track of which components have finished
readyComponents = []
readyComponents.append(ready_text)
for thisComponent in readyComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "ready"-------
continueRoutine = True
while continueRoutine and routineTimer.getTime() > 0:
# get current time
t = readyClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *ready_text* updates
if t >= 0.0 and ready_text.status == NOT_STARTED:
# keep track of start time/frame for later
ready_text.tStart = t # underestimates by a little under one frame
ready_text.frameNStart = frameN # exact frame index
ready_text.setAutoDraw(True)
elif ready_text.status == STARTED and t >= (0.0 + 2.0):
ready_text.setAutoDraw(False)
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in readyComponents:
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 event.getKeys(["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 "ready"-------
for thisComponent in readyComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# set up handler to look after randomisation of conditions etc
practice_loop = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=None,
trialList=data.importConditions('practice.xlsx'),
seed=None, name='practice_loop')
thisExp.addLoop(practice_loop) # add the loop to the experiment
thisPractice_loop = practice_loop.trialList[0] # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb=thisPractice_loop.rgb)
if thisPractice_loop != None:
for paramName in thisPractice_loop.keys():
exec(paramName + '= thisPractice_loop.' + paramName)
for thisPractice_loop in practice_loop:
currentLoop = practice_loop
# abbreviate parameter names if possible (e.g. rgb = thisPractice_loop.rgb)
if thisPractice_loop != None:
for paramName in thisPractice_loop.keys():
exec(paramName + '= thisPractice_loop.' + paramName)
#------Prepare to start Routine"fixation"-------
t = 0
fixationClock.reset() # clock
frameN = -1
routineTimer.add(0.500000)
# update component parameters for each repeat
# keep track of which components have finished
fixationComponents = []
fixationComponents.append(fixation_text)
for thisComponent in fixationComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "fixation"-------
continueRoutine = True
while continueRoutine and routineTimer.getTime() > 0:
# get current time
t = fixationClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *fixation_text* updates
if t >= 0.0 and fixation_text.status == NOT_STARTED:
# keep track of start time/frame for later
fixation_text.tStart = t # underestimates by a little under one frame
fixation_text.frameNStart = frameN # exact frame index
fixation_text.setAutoDraw(True)
elif fixation_text.status == STARTED and t >= (0.0 + 0.5):
fixation_text.setAutoDraw(False)
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in fixationComponents:
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 event.getKeys(["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 "fixation"-------
for thisComponent in fixationComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
#------Prepare to start Routine"practice"-------
t = 0
practiceClock.reset() # clock
frameN = -1
# update component parameters for each repeat
practice_sound.setSound(sound01)
practice_image.setImage(picture01)
practice_key = event.BuilderKeyResponse() # create an object of type KeyResponse
practice_key.status = NOT_STARTED
# keep track of which components have finished
practiceComponents = []
practiceComponents.append(practice_sound)
practiceComponents.append(practice_image)
practiceComponents.append(practice_key)
for thisComponent in practiceComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "practice"-------
continueRoutine = True
while continueRoutine:
# get current time
t = practiceClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# start/stop practice_sound
if t >= 0.2 and practice_sound.status == NOT_STARTED:
# keep track of start time/frame for later
practice_sound.tStart = t # underestimates by a little under one frame
practice_sound.frameNStart = frameN # exact frame index
# *practice_image* updates
if t >= 0.2 and practice_image.status == NOT_STARTED:
# keep track of start time/frame for later
practice_image.tStart = t # underestimates by a little under one frame
practice_image.frameNStart = frameN # exact frame index
practice_image.setAutoDraw(True)
# *practice_key* updates
if t >= 0.2 and practice_key.status == NOT_STARTED:
# keep track of start time/frame for later
practice_key.tStart = t # underestimates by a little under one frame
practice_key.frameNStart = frameN # exact frame index
practice_key.status = STARTED
# keyboard checking is just starting
practice_key.clock.reset() # now t=0
event.clearEvents()
if practice_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['z', 'm'])
if len(theseKeys) > 0: # at least one key was pressed
practice_key.keys = theseKeys[-1] # just the last key pressed
practice_key.rt = practice_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in practiceComponents:
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 event.getKeys(["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 "practice"-------
for thisComponent in practiceComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# check responses
if len(practice_key.keys) == 0: # No response was made
practice_key.keys=None
# store data for practice_loop (TrialHandler)
practice_loop.addData('practice_key.keys',practice_key.keys)
if practice_key.keys != None: # we had a response
practice_loop.addData('practice_key.rt', practice_key.rt)
thisExp.nextEntry()
# completed 1 repeats of 'practice_loop'
#------Prepare to start Routine"break01"-------
t = 0
break01Clock.reset() # clock
frameN = -1
# update component parameters for each repeat
break01key = event.BuilderKeyResponse() # create an object of type KeyResponse
break01key.status = NOT_STARTED
# keep track of which components have finished
break01Components = []
break01Components.append(break01text)
break01Components.append(break01key)
for thisComponent in break01Components:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "break01"-------
continueRoutine = True
while continueRoutine:
# get current time
t = break01Clock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *break01text* updates
if t >= 0.0 and break01text.status == NOT_STARTED:
# keep track of start time/frame for later
break01text.tStart = t # underestimates by a little under one frame
break01text.frameNStart = frameN # exact frame index
break01text.setAutoDraw(True)
# *break01key* updates
if t >= 0.0 and break01key.status == NOT_STARTED:
# keep track of start time/frame for later
break01key.tStart = t # underestimates by a little under one frame
break01key.frameNStart = frameN # exact frame index
break01key.status = STARTED
# keyboard checking is just starting
break01key.clock.reset() # now t=0
event.clearEvents()
if break01key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['space'])
if len(theseKeys) > 0: # at least one key was pressed
break01key.keys = theseKeys[-1] # just the last key pressed
break01key.rt = break01key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in break01Components:
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 event.getKeys(["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 "break01"-------
for thisComponent in break01Components:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
#------Prepare to start Routine"ready"-------
t = 0
readyClock.reset() # clock
frameN = -1
routineTimer.add(2.000000)
# update component parameters for each repeat
# keep track of which components have finished
readyComponents = []
readyComponents.append(ready_text)
for thisComponent in readyComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "ready"-------
continueRoutine = True
while continueRoutine and routineTimer.getTime() > 0:
# get current time
t = readyClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *ready_text* updates
if t >= 0.0 and ready_text.status == NOT_STARTED:
# keep track of start time/frame for later
ready_text.tStart = t # underestimates by a little under one frame
ready_text.frameNStart = frameN # exact frame index
ready_text.setAutoDraw(True)
elif ready_text.status == STARTED and t >= (0.0 + 2.0):
ready_text.setAutoDraw(False)
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in readyComponents:
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 event.getKeys(["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 "ready"-------
for thisComponent in readyComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# set up handler to look after randomisation of conditions etc
trial01_loop = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=None,
trialList=data.importConditions('S-short01.xlsx'),
seed=None, name='trial01_loop')
thisExp.addLoop(trial01_loop) # add the loop to the experiment
thisTrial01_loop = trial01_loop.trialList[0] # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb=thisTrial01_loop.rgb)
if thisTrial01_loop != None:
for paramName in thisTrial01_loop.keys():
exec(paramName + '= thisTrial01_loop.' + paramName)
for thisTrial01_loop in trial01_loop:
currentLoop = trial01_loop
# abbreviate parameter names if possible (e.g. rgb = thisTrial01_loop.rgb)
if thisTrial01_loop != None:
for paramName in thisTrial01_loop.keys():
exec(paramName + '= thisTrial01_loop.' + paramName)
#------Prepare to start Routine"fixation"-------
t = 0
fixationClock.reset() # clock
frameN = -1
routineTimer.add(0.500000)
# update component parameters for each repeat
# keep track of which components have finished
fixationComponents = []
fixationComponents.append(fixation_text)
for thisComponent in fixationComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "fixation"-------
continueRoutine = True
while continueRoutine and routineTimer.getTime() > 0:
# get current time
t = fixationClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *fixation_text* updates
if t >= 0.0 and fixation_text.status == NOT_STARTED:
# keep track of start time/frame for later
fixation_text.tStart = t # underestimates by a little under one frame
fixation_text.frameNStart = frameN # exact frame index
fixation_text.setAutoDraw(True)
elif fixation_text.status == STARTED and t >= (0.0 + 0.5):
fixation_text.setAutoDraw(False)
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in fixationComponents:
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 event.getKeys(["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 "fixation"-------
for thisComponent in fixationComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
#------Prepare to start Routine"trial"-------
t = 0
trialClock.reset() # clock
frameN = -1
# update component parameters for each repeat
trial01_sound.setSound(sound01)
trial01_image.setImage(picture01)
trial01_key = event.BuilderKeyResponse() # create an object of type KeyResponse
trial01_key.status = NOT_STARTED
# keep track of which components have finished
trialComponents = []
trialComponents.append(trial01_sound)
trialComponents.append(trial01_image)
trialComponents.append(trial01_key)
for thisComponent in trialComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "trial"-------
continueRoutine = True
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
# start/stop trial01_sound
if t >= 0.0 and trial01_sound.status == NOT_STARTED:
# keep track of start time/frame for later
trial01_sound.tStart = t # underestimates by a little under one frame
trial01_sound.frameNStart = frameN # exact frame index
# *trial01_image* updates
if t >= 0.0 and trial01_image.status == NOT_STARTED:
# keep track of start time/frame for later
trial01_image.tStart = t # underestimates by a little under one frame
trial01_image.frameNStart = frameN # exact frame index
trial01_image.setAutoDraw(True)
# *trial01_key* updates
if t >= 0.0 and trial01_key.status == NOT_STARTED:
# keep track of start time/frame for later
trial01_key.tStart = t # underestimates by a little under one frame
trial01_key.frameNStart = frameN # exact frame index
trial01_key.status = STARTED
# keyboard checking is just starting
trial01_key.clock.reset() # now t=0
event.clearEvents()
if trial01_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['z', 'm'])
if len(theseKeys) > 0: # at least one key was pressed
trial01_key.keys = theseKeys[-1] # just the last key pressed
trial01_key.rt = trial01_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
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 event.getKeys(["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 "trial"-------
for thisComponent in trialComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# check responses
if len(trial01_key.keys) == 0: # No response was made
trial01_key.keys=None
# store data for trial01_loop (TrialHandler)
trial01_loop.addData('trial01_key.keys',trial01_key.keys)
if trial01_key.keys != None: # we had a response
trial01_loop.addData('trial01_key.rt', trial01_key.rt)
thisExp.nextEntry()
# completed 1 repeats of 'trial01_loop'
#------Prepare to start Routine"minibreak"-------
t = 0
minibreakClock.reset() # clock
frameN = -1
# update component parameters for each repeat
mini_key = event.BuilderKeyResponse() # create an object of type KeyResponse
mini_key.status = NOT_STARTED
# keep track of which components have finished
minibreakComponents = []
minibreakComponents.append(mini_text)
minibreakComponents.append(mini_key)
for thisComponent in minibreakComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "minibreak"-------
continueRoutine = True
while continueRoutine:
# get current time
t = minibreakClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *mini_text* updates
if t >= 0.0 and mini_text.status == NOT_STARTED:
# keep track of start time/frame for later
mini_text.tStart = t # underestimates by a little under one frame
mini_text.frameNStart = frameN # exact frame index
mini_text.setAutoDraw(True)
# *mini_key* updates
if t >= 0.0 and mini_key.status == NOT_STARTED:
# keep track of start time/frame for later
mini_key.tStart = t # underestimates by a little under one frame
mini_key.frameNStart = frameN # exact frame index
mini_key.status = STARTED
# keyboard checking is just starting
mini_key.clock.reset() # now t=0
event.clearEvents()
if mini_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['space'])
if len(theseKeys) > 0: # at least one key was pressed
mini_key.keys = theseKeys[-1] # just the last key pressed
mini_key.rt = mini_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in minibreakComponents:
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 event.getKeys(["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 "minibreak"-------
for thisComponent in minibreakComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# set up handler to look after randomisation of conditions etc
trial02_loop = data.TrialHandler(nReps=1, method='random',
extraInfo=expInfo, originPath=None,
trialList=data.importConditions('S-short02.xlsx'),
seed=None, name='trial02_loop')
thisExp.addLoop(trial02_loop) # add the loop to the experiment
thisTrial02_loop = trial02_loop.trialList[0] # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb=thisTrial02_loop.rgb)
if thisTrial02_loop != None:
for paramName in thisTrial02_loop.keys():
exec(paramName + '= thisTrial02_loop.' + paramName)
for thisTrial02_loop in trial02_loop:
currentLoop = trial02_loop
# abbreviate parameter names if possible (e.g. rgb = thisTrial02_loop.rgb)
if thisTrial02_loop != None:
for paramName in thisTrial02_loop.keys():
exec(paramName + '= thisTrial02_loop.' + paramName)
#------Prepare to start Routine"fixation"-------
t = 0
fixationClock.reset() # clock
frameN = -1
routineTimer.add(0.500000)
# update component parameters for each repeat
# keep track of which components have finished
fixationComponents = []
fixationComponents.append(fixation_text)
for thisComponent in fixationComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "fixation"-------
continueRoutine = True
while continueRoutine and routineTimer.getTime() > 0:
# get current time
t = fixationClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *fixation_text* updates
if t >= 0.0 and fixation_text.status == NOT_STARTED:
# keep track of start time/frame for later
fixation_text.tStart = t # underestimates by a little under one frame
fixation_text.frameNStart = frameN # exact frame index
fixation_text.setAutoDraw(True)
elif fixation_text.status == STARTED and t >= (0.0 + 0.5):
fixation_text.setAutoDraw(False)
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in fixationComponents:
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 event.getKeys(["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 "fixation"-------
for thisComponent in fixationComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
#------Prepare to start Routine"trial02"-------
t = 0
trial02Clock.reset() # clock
frameN = -1
# update component parameters for each repeat
trial02_sound.setSound(sound01)
trial_02image.setImage(picture01)
trial02_key = event.BuilderKeyResponse() # create an object of type KeyResponse
trial02_key.status = NOT_STARTED
# keep track of which components have finished
trial02Components = []
trial02Components.append(trial02_sound)
trial02Components.append(trial_02image)
trial02Components.append(trial02_key)
for thisComponent in trial02Components:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "trial02"-------
continueRoutine = True
while continueRoutine:
# get current time
t = trial02Clock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# start/stop trial02_sound
if t >= 0.0 and trial02_sound.status == NOT_STARTED:
# keep track of start time/frame for later
trial02_sound.tStart = t # underestimates by a little under one frame
trial02_sound.frameNStart = frameN # exact frame index
# *trial_02image* updates
if t >= 0.0 and trial_02image.status == NOT_STARTED:
# keep track of start time/frame for later
trial_02image.tStart = t # underestimates by a little under one frame
trial_02image.frameNStart = frameN # exact frame index
trial_02image.setAutoDraw(True)
# *trial02_key* updates
if t >= 0.0 and trial02_key.status == NOT_STARTED:
# keep track of start time/frame for later
trial02_key.tStart = t # underestimates by a little under one frame
trial02_key.frameNStart = frameN # exact frame index
trial02_key.status = STARTED
# keyboard checking is just starting
trial02_key.clock.reset() # now t=0
event.clearEvents()
if trial02_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['z', 'm'])
if len(theseKeys) > 0: # at least one key was pressed
trial02_key.keys = theseKeys[-1] # just the last key pressed
trial02_key.rt = trial02_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in trial02Components:
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 event.getKeys(["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 "trial02"-------
for thisComponent in trial02Components:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# check responses
if len(trial02_key.keys) == 0: # No response was made
trial02_key.keys=None
# store data for trial02_loop (TrialHandler)
trial02_loop.addData('trial02_key.keys',trial02_key.keys)
if trial02_key.keys != None: # we had a response
trial02_loop.addData('trial02_key.rt', trial02_key.rt)
thisExp.nextEntry()
# completed 1 repeats of 'trial02_loop'
#------Prepare to start Routine"break02"-------
t = 0
break02Clock.reset() # clock
frameN = -1
# update component parameters for each repeat
break02_key = event.BuilderKeyResponse() # create an object of type KeyResponse
break02_key.status = NOT_STARTED
# keep track of which components have finished
break02Components = []
break02Components.append(break02_text)
break02Components.append(break02_key)
for thisComponent in break02Components:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "break02"-------
continueRoutine = True
while continueRoutine:
# get current time
t = break02Clock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *break02_text* updates
if t >= 0.0 and break02_text.status == NOT_STARTED:
# keep track of start time/frame for later
break02_text.tStart = t # underestimates by a little under one frame
break02_text.frameNStart = frameN # exact frame index
break02_text.setAutoDraw(True)
# *break02_key* updates
if t >= 0.0 and break02_key.status == NOT_STARTED:
# keep track of start time/frame for later
break02_key.tStart = t # underestimates by a little under one frame
break02_key.frameNStart = frameN # exact frame index
break02_key.status = STARTED
# keyboard checking is just starting
break02_key.clock.reset() # now t=0
event.clearEvents()
if break02_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['space'])
if len(theseKeys) > 0: # at least one key was pressed
break02_key.keys = theseKeys[-1] # just the last key pressed
break02_key.rt = break02_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in break02Components:
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 event.getKeys(["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 "break02"-------
for thisComponent in break02Components:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
#------Prepare to start Routine"welcomeback"-------
t = 0
welcomebackClock.reset() # clock
frameN = -1
# update component parameters for each repeat
welcomeback_key = event.BuilderKeyResponse() # create an object of type KeyResponse
welcomeback_key.status = NOT_STARTED
# keep track of which components have finished
welcomebackComponents = []
welcomebackComponents.append(welcoemback_text)
welcomebackComponents.append(welcomeback_key)
for thisComponent in welcomebackComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "welcomeback"-------
continueRoutine = True
while continueRoutine:
# get current time
t = welcomebackClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *welcoemback_text* updates
if t >= 0.0 and welcoemback_text.status == NOT_STARTED:
# keep track of start time/frame for later
welcoemback_text.tStart = t # underestimates by a little under one frame
welcoemback_text.frameNStart = frameN # exact frame index
welcoemback_text.setAutoDraw(True)
# *welcomeback_key* updates
if t >= 0.0 and welcomeback_key.status == NOT_STARTED:
# keep track of start time/frame for later
welcomeback_key.tStart = t # underestimates by a little under one frame
welcomeback_key.frameNStart = frameN # exact frame index
welcomeback_key.status = STARTED
# keyboard checking is just starting
welcomeback_key.clock.reset() # now t=0
event.clearEvents()
if welcomeback_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['space'])
if len(theseKeys) > 0: # at least one key was pressed
welcomeback_key.keys = theseKeys[-1] # just the last key pressed
welcomeback_key.rt = welcomeback_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in welcomebackComponents:
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 event.getKeys(["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 "welcomeback"-------
for thisComponent in welcomebackComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
#------Prepare to start Routine"instruction02"-------
t = 0
instruction02Clock.reset() # clock
frameN = -1
# update component parameters for each repeat
instruction02_key = event.BuilderKeyResponse() # create an object of type KeyResponse
instruction02_key.status = NOT_STARTED
# keep track of which components have finished
instruction02Components = []
instruction02Components.append(instruction02_text)
instruction02Components.append(instruction02_key)
for thisComponent in instruction02Components:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "instruction02"-------
continueRoutine = True
while continueRoutine:
# get current time
t = instruction02Clock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *instruction02_text* updates
if t >= 0.0 and instruction02_text.status == NOT_STARTED:
# keep track of start time/frame for later
instruction02_text.tStart = t # underestimates by a little under one frame
instruction02_text.frameNStart = frameN # exact frame index
instruction02_text.setAutoDraw(True)
# *instruction02_key* updates
if t >= 0.0 and instruction02_key.status == NOT_STARTED:
# keep track of start time/frame for later
instruction02_key.tStart = t # underestimates by a little under one frame
instruction02_key.frameNStart = frameN # exact frame index
instruction02_key.status = STARTED
# keyboard checking is just starting
instruction02_key.clock.reset() # now t=0
event.clearEvents()
if instruction02_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['space'])
if len(theseKeys) > 0: # at least one key was pressed
instruction02_key.keys = theseKeys[-1] # just the last key pressed
instruction02_key.rt = instruction02_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in instruction02Components:
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 event.getKeys(["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 "instruction02"-------
for thisComponent in instruction02Components:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
#------Prepare to start Routine"ready"-------
t = 0
readyClock.reset() # clock
frameN = -1
routineTimer.add(2.000000)
# update component parameters for each repeat
# keep track of which components have finished
readyComponents = []
readyComponents.append(ready_text)
for thisComponent in readyComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "ready"-------
continueRoutine = True
while continueRoutine and routineTimer.getTime() > 0:
# get current time
t = readyClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *ready_text* updates
if t >= 0.0 and ready_text.status == NOT_STARTED:
# keep track of start time/frame for later
ready_text.tStart = t # underestimates by a little under one frame
ready_text.frameNStart = frameN # exact frame index
ready_text.setAutoDraw(True)
elif ready_text.status == STARTED and t >= (0.0 + 2.0):
ready_text.setAutoDraw(False)
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in readyComponents:
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 event.getKeys(["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 "ready"-------
for thisComponent in readyComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# set up handler to look after randomisation of conditions etc
cat_loop = data.TrialHandler(nReps=5, method='random',
extraInfo=expInfo, originPath=None,
trialList=data.importConditions('STHW categorization.xlsx'),
seed=None, name='cat_loop')
thisExp.addLoop(cat_loop) # add the loop to the experiment
thisCat_loop = cat_loop.trialList[0] # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb=thisCat_loop.rgb)
if thisCat_loop != None:
for paramName in thisCat_loop.keys():
exec(paramName + '= thisCat_loop.' + paramName)
for thisCat_loop in cat_loop:
currentLoop = cat_loop
# abbreviate parameter names if possible (e.g. rgb = thisCat_loop.rgb)
if thisCat_loop != None:
for paramName in thisCat_loop.keys():
exec(paramName + '= thisCat_loop.' + paramName)
#------Prepare to start Routine"fixation"-------
t = 0
fixationClock.reset() # clock
frameN = -1
routineTimer.add(0.500000)
# update component parameters for each repeat
# keep track of which components have finished
fixationComponents = []
fixationComponents.append(fixation_text)
for thisComponent in fixationComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "fixation"-------
continueRoutine = True
while continueRoutine and routineTimer.getTime() > 0:
# get current time
t = fixationClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *fixation_text* updates
if t >= 0.0 and fixation_text.status == NOT_STARTED:
# keep track of start time/frame for later
fixation_text.tStart = t # underestimates by a little under one frame
fixation_text.frameNStart = frameN # exact frame index
fixation_text.setAutoDraw(True)
elif fixation_text.status == STARTED and t >= (0.0 + 0.5):
fixation_text.setAutoDraw(False)
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in fixationComponents:
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 event.getKeys(["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 "fixation"-------
for thisComponent in fixationComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
#------Prepare to start Routine"catergorization"-------
t = 0
catergorizationClock.reset() # clock
frameN = -1
# update component parameters for each repeat
cat_sound.setSound(sound01)
cat_image.setImage(picture01)
cat_key = event.BuilderKeyResponse() # create an object of type KeyResponse
cat_key.status = NOT_STARTED
# keep track of which components have finished
catergorizationComponents = []
catergorizationComponents.append(cat_sound)
catergorizationComponents.append(cat_image)
catergorizationComponents.append(cat_key)
for thisComponent in catergorizationComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "catergorization"-------
continueRoutine = True
while continueRoutine:
# get current time
t = catergorizationClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# start/stop cat_sound
if t >= 0.2 and cat_sound.status == NOT_STARTED:
# keep track of start time/frame for later
cat_sound.tStart = t # underestimates by a little under one frame
cat_sound.frameNStart = frameN # exact frame index
# *cat_image* updates
if t >= 0.2 and cat_image.status == NOT_STARTED:
# keep track of start time/frame for later
cat_image.tStart = t # underestimates by a little under one frame
cat_image.frameNStart = frameN # exact frame index
cat_image.setAutoDraw(True)
# *cat_key* updates
if t >= 0.2 and cat_key.status == NOT_STARTED:
# keep track of start time/frame for later
cat_key.tStart = t # underestimates by a little under one frame
cat_key.frameNStart = frameN # exact frame index
cat_key.status = STARTED
# keyboard checking is just starting
cat_key.clock.reset() # now t=0
event.clearEvents()
if cat_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['z', 'm'])
if len(theseKeys) > 0: # at least one key was pressed
cat_key.keys = theseKeys[-1] # just the last key pressed
cat_key.rt = cat_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in catergorizationComponents:
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 event.getKeys(["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 "catergorization"-------
for thisComponent in catergorizationComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# check responses
if len(cat_key.keys) == 0: # No response was made
cat_key.keys=None
# store data for cat_loop (TrialHandler)
cat_loop.addData('cat_key.keys',cat_key.keys)
if cat_key.keys != None: # we had a response
cat_loop.addData('cat_key.rt', cat_key.rt)
thisExp.nextEntry()
# completed 5 repeats of 'cat_loop'
#------Prepare to start Routine"thankyou"-------
t = 0
thankyouClock.reset() # clock
frameN = -1
# update component parameters for each repeat
thanks_key = event.BuilderKeyResponse() # create an object of type KeyResponse
thanks_key.status = NOT_STARTED
# keep track of which components have finished
thankyouComponents = []
thankyouComponents.append(thanks_text)
thankyouComponents.append(thanks_key)
for thisComponent in thankyouComponents:
if hasattr(thisComponent, 'status'):
thisComponent.status = NOT_STARTED
#-------Start Routine "thankyou"-------
continueRoutine = True
while continueRoutine:
# get current time
t = thankyouClock.getTime()
frameN = frameN + 1 # number of completed frames (so 0 is the first frame)
# update/draw components on each frame
# *thanks_text* updates
if t >= 0.0 and thanks_text.status == NOT_STARTED:
# keep track of start time/frame for later
thanks_text.tStart = t # underestimates by a little under one frame
thanks_text.frameNStart = frameN # exact frame index
thanks_text.setAutoDraw(True)
# *thanks_key* updates
if t >= 0.0 and thanks_key.status == NOT_STARTED:
# keep track of start time/frame for later
thanks_key.tStart = t # underestimates by a little under one frame
thanks_key.frameNStart = frameN # exact frame index
thanks_key.status = STARTED
# keyboard checking is just starting
thanks_key.clock.reset() # now t=0
event.clearEvents()
if thanks_key.status == STARTED: # only update if being drawn
theseKeys = event.getKeys(keyList=['e'])
if len(theseKeys) > 0: # at least one key was pressed
thanks_key.keys = theseKeys[-1] # just the last key pressed
thanks_key.rt = thanks_key.clock.getTime()
# abort routine on response
continueRoutine = False
# check if all components have finished
if not continueRoutine: # a component has requested that we end
routineTimer.reset() # this is the new t0 for non-slip Routines
break
continueRoutine = False # will revert to True if at least one component still running
for thisComponent in thankyouComponents:
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 event.getKeys(["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 "thankyou"-------
for thisComponent in thankyouComponents:
if hasattr(thisComponent, "setAutoDraw"):
thisComponent.setAutoDraw(False)
# Shutting down:
win.close()
core.quit()