experiment2_b_lastrun.py 55.2 KB
Newer Older
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1 2 3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
4
This experiment was created using PsychoPy3 Experiment Builder (v3.0.4),
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
5
    on februar 27, 2019, at 16:16
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
If you publish work using this script please cite the 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 absolute_import, division
from psychopy import locale_setup, sound, gui, visual, core, data, event, logging, clock
from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED,
                                STOPPED, FINISHED, PRESSED, RELEASED, FOREVER)
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
import sys  # to get file system encoding


# Ensure that relative paths start from the same directory as this script
_thisDir = os.path.dirname(os.path.abspath(__file__))
os.chdir(_thisDir)

# Store info about the experiment session
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
30
psychopyVersion = '3.0.4'
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
31
expName = 'experiment2_b'  # from the Builder filename that created this script
32
expInfo = {'gender': '', 'age': '', 'participant': '001', 'language': ''}
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
expInfo['date'] = data.getDateStr()  # add a simple timestamp
expInfo['expName'] = expName
expInfo['psychopyVersion'] = psychopyVersion

# 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'])

# An ExperimentHandler isn't essential but helps with data saving
thisExp = data.ExperimentHandler(name=expName, version='',
    extraInfo=expInfo, runtimeInfo=None,
    originPath='C:\\Users\\julianrl_adm\\Experiment_Orthography\\experiment2_b_lastrun.py',
    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
win = visual.Window(
    size=[1920, 1080], fullscr=True, screen=0,
    allowGUI=False, allowStencil=False,
    monitor='testMonitor', color=[1.000,1.000,1.000], 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 "Instruction_Intro"
Instruction_IntroClock = core.Clock()
lub = visual.ImageStim(
70
    win=win, name='lub',units='norm', 
71
    image='sin', mask=None,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
72 73 74 75
    ori=0, pos=(0, 0), size=(2, 2),
    color=[1,1,1], colorSpace='rgb', opacity=1,
    flipHoriz=False, flipVert=False,
    texRes=128, interpolate=True, depth=-1.0)
76 77
import random
condition = random.choice(('A','B'))
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
78

Julian Lysvik's avatar
Julian Lysvik committed
79 80 81 82 83 84 85 86
# Initialize components for Routine "ISI_Pre"
ISI_PreClock = core.Clock()
ISI = clock.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI')
fixation = visual.ShapeStim(
    win=win, name='fixation', vertices='cross',units='deg', 
    size=(0.5, 0.5),
    ori=0, pos=(0, 0),
    lineWidth=1, lineColor=[1,1,1], lineColorSpace='rgb',
Julian Lysvik's avatar
Julian Lysvik committed
87
    fillColor=[-1.000,-1.000,-1.000], fillColorSpace='rgb',
Julian Lysvik's avatar
Julian Lysvik committed
88 89
    opacity=1, depth=-1.0, interpolate=True)

Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
90 91 92
# Initialize components for Routine "Exposure"
ExposureClock = core.Clock()
Sing_img = visual.ImageStim(
93
    win=win, name='Sing_img',units='norm', 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
94
    image='sin', mask=None,
Julian Lysvik's avatar
Julian Lysvik committed
95
    ori=0, pos=(0, 0.2), size=None,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
96 97
    color=[1,1,1], colorSpace='rgb', opacity=1,
    flipHoriz=False, flipVert=False,
Julian Lysvik's avatar
Julian Lysvik committed
98
    texRes=128, interpolate=True, depth=0.0)
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
99
Pl_img = visual.ImageStim(
100
    win=win, name='Pl_img',units='norm', 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
101
    image='sin', mask=None,
Julian Lysvik's avatar
Julian Lysvik committed
102
    ori=0, pos=(0, 0.2), size=None,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
103 104
    color=[1,1,1], colorSpace='rgb', opacity=1,
    flipHoriz=False, flipVert=False,
Julian Lysvik's avatar
Julian Lysvik committed
105
    texRes=128, interpolate=True, depth=-1.0)
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
106 107 108
Sing_txt = visual.TextStim(win=win, name='Sing_txt',
    text='default text',
    font='Arial',
109
    units='norm', pos=(0, -0.6), height=0.3, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
110 111
    color=[1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
112
    depth=-2.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
113 114 115
Pl_txt = visual.TextStim(win=win, name='Pl_txt',
    text='default text',
    font='Arial',
116
    units='norm', pos=(0, -0.6), height=0.3, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
117 118
    color=[1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
119
    depth=-3.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
120 121 122 123 124 125 126 127

# Initialize components for Routine "ISI_1sec"
ISI_1secClock = core.Clock()
ISI_2 = clock.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI_2')

# Initialize components for Routine "Instruction_Prod"
Instruction_ProdClock = core.Clock()
image_3 = visual.ImageStim(
128
    win=win, name='image_3',units='norm', 
129
    image='sin', mask=None,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
130 131 132 133 134
    ori=0, pos=(0, 0), size=(2, 2),
    color=[1,1,1], colorSpace='rgb', opacity=1,
    flipHoriz=False, flipVert=False,
    texRes=128, interpolate=True, depth=0.0)

Julian Lysvik's avatar
Julian Lysvik committed
135 136 137 138 139 140 141 142
# Initialize components for Routine "ISI_Pre"
ISI_PreClock = core.Clock()
ISI = clock.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI')
fixation = visual.ShapeStim(
    win=win, name='fixation', vertices='cross',units='deg', 
    size=(0.5, 0.5),
    ori=0, pos=(0, 0),
    lineWidth=1, lineColor=[1,1,1], lineColorSpace='rgb',
Julian Lysvik's avatar
Julian Lysvik committed
143
    fillColor=[-1.000,-1.000,-1.000], fillColorSpace='rgb',
Julian Lysvik's avatar
Julian Lysvik committed
144 145
    opacity=1, depth=-1.0, interpolate=True)

Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
146 147 148
# Initialize components for Routine "Test_Prod"
Test_ProdClock = core.Clock()
Target_ins1 = visual.TextStim(win=win, name='Target_ins1',
Julian Lysvik's avatar
Julian Lysvik committed
149
    text='default text',
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
150
    font='Arial',
151
    units='norm', pos=(0, 0.85), height=0.1, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
152 153
    color=[-1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
154
    depth=0.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
155
Trigger_img1 = visual.ImageStim(
156
    win=win, name='Trigger_img1',units='norm', 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
157
    image='sin', mask=None,
Julian Lysvik's avatar
Julian Lysvik committed
158
    ori=0, pos=(0, 0.2), size=None,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
159 160
    color=[1,1,1], colorSpace='rgb', opacity=1,
    flipHoriz=False, flipVert=False,
Julian Lysvik's avatar
Julian Lysvik committed
161
    texRes=128, interpolate=True, depth=-1.0)
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
162
Target_img1 = visual.ImageStim(
163
    win=win, name='Target_img1',units='norm', 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
164
    image='sin', mask=None,
Julian Lysvik's avatar
Julian Lysvik committed
165
    ori=0, pos=(0, 0.2), size=None,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
166 167
    color=[1,1,1], colorSpace='rgb', opacity=1,
    flipHoriz=False, flipVert=False,
Julian Lysvik's avatar
Julian Lysvik committed
168
    texRes=128, interpolate=True, depth=-2.0)
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
169 170 171
Trigger_txt1 = visual.TextStim(win=win, name='Trigger_txt1',
    text='default text',
    font='Arial',
172
    units='norm', pos=(0, -0.6), height=0.3, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
173 174
    color=[1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
175
    depth=-3.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
176 177 178 179
inputText = ""
txtinp = visual.TextStim(win=win, name='txtinp',
    text='default text',
    font='Arial',
180
    units='norm', pos=(0, -0.6), height=0.3, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
181 182
    color=[1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
183
    depth=-5.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
184 185 186 187 188 189 190 191

# Initialize components for Routine "ISI_1sec"
ISI_1secClock = core.Clock()
ISI_2 = clock.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI_2')

# Initialize components for Routine "Instruction_FC"
Instruction_FCClock = core.Clock()
image_6 = visual.ImageStim(
192
    win=win, name='image_6',units='norm', 
193
    image='sin', mask=None,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
194 195 196 197 198
    ori=0, pos=(0, 0), size=(2, 2),
    color=[1,1,1], colorSpace='rgb', opacity=1,
    flipHoriz=False, flipVert=False,
    texRes=128, interpolate=True, depth=0.0)

Julian Lysvik's avatar
Julian Lysvik committed
199 200 201 202 203 204 205 206
# Initialize components for Routine "ISI_Pre"
ISI_PreClock = core.Clock()
ISI = clock.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI')
fixation = visual.ShapeStim(
    win=win, name='fixation', vertices='cross',units='deg', 
    size=(0.5, 0.5),
    ori=0, pos=(0, 0),
    lineWidth=1, lineColor=[1,1,1], lineColorSpace='rgb',
Julian Lysvik's avatar
Julian Lysvik committed
207
    fillColor=[-1.000,-1.000,-1.000], fillColorSpace='rgb',
Julian Lysvik's avatar
Julian Lysvik committed
208 209
    opacity=1, depth=-1.0, interpolate=True)

Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
210 211 212
# Initialize components for Routine "Test_FC"
Test_FCClock = core.Clock()
Target_ins2 = visual.TextStim(win=win, name='Target_ins2',
Julian Lysvik's avatar
Julian Lysvik committed
213
    text='default text',
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
214
    font='Arial',
215
    units='norm', pos=(0, 0.85), height=0.1, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
216 217
    color=[-1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
218
    depth=0.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
219
Trigger_img2 = visual.ImageStim(
220
    win=win, name='Trigger_img2',units='norm', 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
221
    image='sin', mask=None,
Julian Lysvik's avatar
Julian Lysvik committed
222
    ori=0, pos=(0, 0.2), size=None,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
223 224
    color=[1,1,1], colorSpace='rgb', opacity=1,
    flipHoriz=False, flipVert=False,
Julian Lysvik's avatar
Julian Lysvik committed
225
    texRes=128, interpolate=True, depth=-1.0)
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
226
Target_img2 = visual.ImageStim(
227
    win=win, name='Target_img2',units='norm', 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
228
    image='sin', mask=None,
Julian Lysvik's avatar
Julian Lysvik committed
229
    ori=0, pos=(0, 0.2), size=None,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
230 231
    color=[1,1,1], colorSpace='rgb', opacity=1,
    flipHoriz=False, flipVert=False,
Julian Lysvik's avatar
Julian Lysvik committed
232
    texRes=128, interpolate=True, depth=-2.0)
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
233 234 235
Trigger_txt2 = visual.TextStim(win=win, name='Trigger_txt2',
    text='default text',
    font='Arial',
236
    units='norm', pos=(0, -0.6), height=0.3, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
237 238
    color=[1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
239
    depth=-3.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
240 241 242
Target_instr_l = visual.TextStim(win=win, name='Target_instr_l',
    text='Press a\n\n',
    font='Arial',
243
    units='norm', pos=(-0.5, -0.9), height=0.08, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
244 245
    color=[-1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
246
    depth=-4.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
247 248 249
Target_instr_r = visual.TextStim(win=win, name='Target_instr_r',
    text='Press k',
    font='Arial',
250
    units='norm', pos=(0.5, -0.8), height=0.08, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
251 252
    color=[-1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
253
    depth=-5.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
254 255 256
Resp_a = visual.TextStim(win=win, name='Resp_a',
    text='default text',
    font='Arial',
257
    units='norm', pos=(-0.5, -0.6), height=0.3, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
258 259
    color=[1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
260
    depth=-7.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
261 262 263
Resp_b = visual.TextStim(win=win, name='Resp_b',
    text='default text',
    font='Arial',
264
    units='norm', pos=(0.5, -0.6), height=0.3, wrapWidth=None, ori=0, 
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
265 266
    color=[1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
Julian Lysvik's avatar
Julian Lysvik committed
267
    depth=-8.0);
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
268 269 270 271 272

# Initialize components for Routine "ISI_1sec"
ISI_1secClock = core.Clock()
ISI_2 = clock.StaticPeriod(win=win, screenHz=expInfo['frameRate'], name='ISI_2')

Julian Lysvik's avatar
Julian Lysvik committed
273 274 275
# Initialize components for Routine "Thank_you"
Thank_youClock = core.Clock()
text = visual.TextStim(win=win, name='text',
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
276
    text='Thank you very much for participating!\n\nPress q to quit.',
Julian Lysvik's avatar
Julian Lysvik committed
277
    font='Arial',
278
    units='norm', pos=(0, 0), height=0.1, wrapWidth=None, ori=0, 
Julian Lysvik's avatar
Julian Lysvik committed
279 280 281 282
    color=[-1.000,-1.000,-1.000], colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);

Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
283 284 285 286 287 288 289 290 291 292 293
# 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_Intro"-------
t = 0
Instruction_IntroClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp_1 = event.BuilderKeyResponse()
294 295
lub.setImage("Images/intro"+condition+".png")

Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
# keep track of which components have finished
Instruction_IntroComponents = [key_resp_1, lub]
for thisComponent in Instruction_IntroComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "Instruction_Intro"-------
while continueRoutine:
    # get current time
    t = Instruction_IntroClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *key_resp_1* updates
    if t >= 0.0 and key_resp_1.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp_1.tStart = t
        key_resp_1.frameNStart = frameN  # exact frame index
        key_resp_1.status = STARTED
        # keyboard checking is just starting
        win.callOnFlip(key_resp_1.clock.reset)  # t=0 on next screen flip
        event.clearEvents(eventType='keyboard')
    if key_resp_1.status == STARTED:
        theseKeys = event.getKeys(keyList=['space'])
        
        # check for quit:
        if "escape" in theseKeys:
            endExpNow = True
        if len(theseKeys) > 0:  # at least one key was pressed
            key_resp_1.keys = theseKeys[-1]  # just the last key pressed
            key_resp_1.rt = key_resp_1.clock.getTime()
            # a response ends the routine
            continueRoutine = False
    
    # *lub* updates
    if t >= 0.0 and lub.status == NOT_STARTED:
        # keep track of start time/frame for later
        lub.tStart = t
        lub.frameNStart = frameN  # exact frame index
        lub.setAutoDraw(True)
    
337
    
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
338 339 340 341
    # check for quit (typically the Esc key)
    if endExpNow or event.getKeys(keyList=["escape"]):
        core.quit()
    
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
    # 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 Instruction_IntroComponents:
        if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
            continueRoutine = True
            break  # at least one component has not yet finished
    
    # refresh the screen
    if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
        win.flip()

# -------Ending Routine "Instruction_Intro"-------
for thisComponent in Instruction_IntroComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
# check responses
if key_resp_1.keys in ['', [], None]:  # No response was made
    key_resp_1.keys=None
thisExp.addData('key_resp_1.keys',key_resp_1.keys)
if key_resp_1.keys != None:  # we had a response
    thisExp.addData('key_resp_1.rt', key_resp_1.rt)
thisExp.nextEntry()
366

Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
367 368 369
# the Routine "Instruction_Intro" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

Julian Lysvik's avatar
Julian Lysvik committed
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407
# ------Prepare to start Routine "ISI_Pre"-------
t = 0
ISI_PreClock.reset()  # clock
frameN = -1
continueRoutine = True
routineTimer.add(1.000000)
# update component parameters for each repeat
# keep track of which components have finished
ISI_PreComponents = [ISI, fixation]
for thisComponent in ISI_PreComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "ISI_Pre"-------
while continueRoutine and routineTimer.getTime() > 0:
    # get current time
    t = ISI_PreClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *fixation* updates
    if t >= 0.0 and fixation.status == NOT_STARTED:
        # keep track of start time/frame for later
        fixation.tStart = t
        fixation.frameNStart = frameN  # exact frame index
        fixation.setAutoDraw(True)
    frameRemains = 0.0 + 1.0- win.monitorFramePeriod * 0.75  # most of one frame period left
    if fixation.status == STARTED and t >= frameRemains:
        fixation.setAutoDraw(False)
    # *ISI* period
    if t >= 0.0 and ISI.status == NOT_STARTED:
        # keep track of start time/frame for later
        ISI.tStart = t
        ISI.frameNStart = frameN  # exact frame index
        ISI.start(1)
    elif ISI.status == STARTED:  # one frame should pass before updating params and completing
        ISI.complete()  # finish the static period
    
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
408 409 410 411
    # check for quit (typically the Esc key)
    if endExpNow or event.getKeys(keyList=["escape"]):
        core.quit()
    
Julian Lysvik's avatar
Julian Lysvik committed
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
    # 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 ISI_PreComponents:
        if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
            continueRoutine = True
            break  # at least one component has not yet finished
    
    # refresh the screen
    if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
        win.flip()

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

Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
430 431 432
# set up handler to look after randomisation of conditions etc
trials = data.TrialHandler(nReps=1, method='random', 
    extraInfo=expInfo, originPath=-1,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
433
    trialList=data.importConditions("Lists/Order"+condition+".xlsx", selection='np.random.choice(43, size = 20, replace = False)'),
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
    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:
        exec('{} = thisTrial[paramName]'.format(paramName))

for thisTrial in trials:
    currentLoop = trials
    # abbreviate parameter names if possible (e.g. rgb = thisTrial.rgb)
    if thisTrial != None:
        for paramName in thisTrial:
            exec('{} = thisTrial[paramName]'.format(paramName))
    
    # ------Prepare to start Routine "Exposure"-------
    t = 0
    ExposureClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    routineTimer.add(6.000000)
    # update component parameters for each repeat
Julian Lysvik's avatar
Julian Lysvik committed
456 457 458 459
    Sing_img.setImage(trig_img)
    Pl_img.setImage(targ_img)
    Sing_txt.setText(trig)
    Pl_txt.setText(targ)
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
460
    # keep track of which components have finished
Julian Lysvik's avatar
Julian Lysvik committed
461
    ExposureComponents = [Sing_img, Pl_img, Sing_txt, Pl_txt]
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
    for thisComponent in ExposureComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED
    
    # -------Start Routine "Exposure"-------
    while continueRoutine and routineTimer.getTime() > 0:
        # get current time
        t = ExposureClock.getTime()
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame
        
        # *Sing_img* updates
        if t >= 0.0 and Sing_img.status == NOT_STARTED:
            # keep track of start time/frame for later
            Sing_img.tStart = t
            Sing_img.frameNStart = frameN  # exact frame index
            Sing_img.setAutoDraw(True)
        frameRemains = 0.0 + 3- win.monitorFramePeriod * 0.75  # most of one frame period left
        if Sing_img.status == STARTED and t >= frameRemains:
            Sing_img.setAutoDraw(False)
        
        # *Pl_img* updates
        if t >= 3 and Pl_img.status == NOT_STARTED:
            # keep track of start time/frame for later
            Pl_img.tStart = t
            Pl_img.frameNStart = frameN  # exact frame index
            Pl_img.setAutoDraw(True)
        frameRemains = 3 + 3- win.monitorFramePeriod * 0.75  # most of one frame period left
        if Pl_img.status == STARTED and t >= frameRemains:
            Pl_img.setAutoDraw(False)
        
        # *Sing_txt* updates
        if t >= 0.0 and Sing_txt.status == NOT_STARTED:
            # keep track of start time/frame for later
            Sing_txt.tStart = t
            Sing_txt.frameNStart = frameN  # exact frame index
            Sing_txt.setAutoDraw(True)
        frameRemains = 0.0 + 3- win.monitorFramePeriod * 0.75  # most of one frame period left
        if Sing_txt.status == STARTED and t >= frameRemains:
            Sing_txt.setAutoDraw(False)
        
        # *Pl_txt* updates
        if t >= 3 and Pl_txt.status == NOT_STARTED:
            # keep track of start time/frame for later
            Pl_txt.tStart = t
            Pl_txt.frameNStart = frameN  # exact frame index
            Pl_txt.setAutoDraw(True)
        frameRemains = 3 + 3- win.monitorFramePeriod * 0.75  # most of one frame period left
        if Pl_txt.status == STARTED and t >= frameRemains:
            Pl_txt.setAutoDraw(False)
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
513 514 515 516
        # check for quit (typically the Esc key)
        if endExpNow or event.getKeys(keyList=["escape"]):
            core.quit()
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
        # 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 ExposureComponents:
            if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
                continueRoutine = True
                break  # at least one component has not yet finished
        
        # refresh the screen
        if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
            win.flip()
    
    # -------Ending Routine "Exposure"-------
    for thisComponent in ExposureComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    
    # ------Prepare to start Routine "ISI_1sec"-------
    t = 0
    ISI_1secClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    routineTimer.add(0.750000)
    # update component parameters for each repeat
    # keep track of which components have finished
    ISI_1secComponents = [ISI_2]
    for thisComponent in ISI_1secComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED
    
    # -------Start Routine "ISI_1sec"-------
    while continueRoutine and routineTimer.getTime() > 0:
        # get current time
        t = ISI_1secClock.getTime()
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame
        # *ISI_2* period
        if t >= 0.0 and ISI_2.status == NOT_STARTED:
            # keep track of start time/frame for later
            ISI_2.tStart = t
            ISI_2.frameNStart = frameN  # exact frame index
            ISI_2.start(0.75)
        elif ISI_2.status == STARTED:  # one frame should pass before updating params and completing
            ISI_2.complete()  # finish the static period
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
563 564 565 566
        # check for quit (typically the Esc key)
        if endExpNow or event.getKeys(keyList=["escape"]):
            core.quit()
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
        # 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 ISI_1secComponents:
            if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
                continueRoutine = True
                break  # at least one component has not yet finished
        
        # refresh the screen
        if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
            win.flip()
    
    # -------Ending Routine "ISI_1sec"-------
    for thisComponent in ISI_1secComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    thisExp.nextEntry()
    
# completed 1 repeats of 'trials'


# ------Prepare to start Routine "Instruction_Prod"-------
t = 0
Instruction_ProdClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
595
image_3.setImage("Images/instrProd"+condition+".png")
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637
key_resp_2 = event.BuilderKeyResponse()
# keep track of which components have finished
Instruction_ProdComponents = [image_3, key_resp_2]
for thisComponent in Instruction_ProdComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "Instruction_Prod"-------
while continueRoutine:
    # get current time
    t = Instruction_ProdClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *image_3* updates
    if t >= 0.0 and image_3.status == NOT_STARTED:
        # keep track of start time/frame for later
        image_3.tStart = t
        image_3.frameNStart = frameN  # exact frame index
        image_3.setAutoDraw(True)
    
    # *key_resp_2* updates
    if t >= 0.0 and key_resp_2.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp_2.tStart = t
        key_resp_2.frameNStart = frameN  # exact frame index
        key_resp_2.status = STARTED
        # keyboard checking is just starting
        win.callOnFlip(key_resp_2.clock.reset)  # t=0 on next screen flip
        event.clearEvents(eventType='keyboard')
    if key_resp_2.status == STARTED:
        theseKeys = event.getKeys(keyList=['space'])
        
        # check for quit:
        if "escape" in theseKeys:
            endExpNow = True
        if len(theseKeys) > 0:  # at least one key was pressed
            key_resp_2.keys = theseKeys[-1]  # just the last key pressed
            key_resp_2.rt = key_resp_2.clock.getTime()
            # a response ends the routine
            continueRoutine = False
    
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
638 639 640 641
    # check for quit (typically the Esc key)
    if endExpNow or event.getKeys(keyList=["escape"]):
        core.quit()
    
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
    # 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 Instruction_ProdComponents:
        if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
            continueRoutine = True
            break  # at least one component has not yet finished
    
    # refresh the screen
    if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
        win.flip()

# -------Ending Routine "Instruction_Prod"-------
for thisComponent in Instruction_ProdComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
# check responses
if key_resp_2.keys in ['', [], None]:  # No response was made
    key_resp_2.keys=None
thisExp.addData('key_resp_2.keys',key_resp_2.keys)
if key_resp_2.keys != None:  # we had a response
    thisExp.addData('key_resp_2.rt', key_resp_2.rt)
thisExp.nextEntry()
# the Routine "Instruction_Prod" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

Julian Lysvik's avatar
Julian Lysvik committed
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706
# ------Prepare to start Routine "ISI_Pre"-------
t = 0
ISI_PreClock.reset()  # clock
frameN = -1
continueRoutine = True
routineTimer.add(1.000000)
# update component parameters for each repeat
# keep track of which components have finished
ISI_PreComponents = [ISI, fixation]
for thisComponent in ISI_PreComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "ISI_Pre"-------
while continueRoutine and routineTimer.getTime() > 0:
    # get current time
    t = ISI_PreClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *fixation* updates
    if t >= 0.0 and fixation.status == NOT_STARTED:
        # keep track of start time/frame for later
        fixation.tStart = t
        fixation.frameNStart = frameN  # exact frame index
        fixation.setAutoDraw(True)
    frameRemains = 0.0 + 1.0- win.monitorFramePeriod * 0.75  # most of one frame period left
    if fixation.status == STARTED and t >= frameRemains:
        fixation.setAutoDraw(False)
    # *ISI* period
    if t >= 0.0 and ISI.status == NOT_STARTED:
        # keep track of start time/frame for later
        ISI.tStart = t
        ISI.frameNStart = frameN  # exact frame index
        ISI.start(1)
    elif ISI.status == STARTED:  # one frame should pass before updating params and completing
        ISI.complete()  # finish the static period
    
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
707 708 709 710
    # check for quit (typically the Esc key)
    if endExpNow or event.getKeys(keyList=["escape"]):
        core.quit()
    
Julian Lysvik's avatar
Julian Lysvik committed
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728
    # 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 ISI_PreComponents:
        if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
            continueRoutine = True
            break  # at least one component has not yet finished
    
    # refresh the screen
    if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
        win.flip()

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

Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
729 730 731
# set up handler to look after randomisation of conditions etc
trials_2 = data.TrialHandler(nReps=1, method='random', 
    extraInfo=expInfo, originPath=-1,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
732
    trialList=data.importConditions("Lists/OrderProd"+condition+".xlsx", selection='np.random.choice(30, size = 10, replace = False)'),
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753
    seed=None, name='trials_2')
thisExp.addLoop(trials_2)  # add the loop to the experiment
thisTrial_2 = trials_2.trialList[0]  # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb = thisTrial_2.rgb)
if thisTrial_2 != None:
    for paramName in thisTrial_2:
        exec('{} = thisTrial_2[paramName]'.format(paramName))

for thisTrial_2 in trials_2:
    currentLoop = trials_2
    # abbreviate parameter names if possible (e.g. rgb = thisTrial_2.rgb)
    if thisTrial_2 != None:
        for paramName in thisTrial_2:
            exec('{} = thisTrial_2[paramName]'.format(paramName))
    
    # ------Prepare to start Routine "Test_Prod"-------
    t = 0
    Test_ProdClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    # update component parameters for each repeat
Julian Lysvik's avatar
Julian Lysvik committed
754 755 756 757
    Target_ins1.setText(instr)
    Trigger_img1.setImage(trig_img)
    Target_img1.setImage(targ_img)
    Trigger_txt1.setText(trig)
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
758 759 760 761 762
    theseKeys=""
    shift_flag = False
    txtinp.alignHoriz ='center'
    text_resp = event.BuilderKeyResponse()
    # keep track of which components have finished
Julian Lysvik's avatar
Julian Lysvik committed
763
    Test_ProdComponents = [Target_ins1, Trigger_img1, Target_img1, Trigger_txt1, txtinp, text_resp]
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869
    for thisComponent in Test_ProdComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED
    
    # -------Start Routine "Test_Prod"-------
    while continueRoutine:
        # get current time
        t = Test_ProdClock.getTime()
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame
        
        # *Target_ins1* updates
        if t >= 5 and Target_ins1.status == NOT_STARTED:
            # keep track of start time/frame for later
            Target_ins1.tStart = t
            Target_ins1.frameNStart = frameN  # exact frame index
            Target_ins1.setAutoDraw(True)
        
        # *Trigger_img1* updates
        if t >= 0.0 and Trigger_img1.status == NOT_STARTED:
            # keep track of start time/frame for later
            Trigger_img1.tStart = t
            Trigger_img1.frameNStart = frameN  # exact frame index
            Trigger_img1.setAutoDraw(True)
        frameRemains = 0.0 + 5- win.monitorFramePeriod * 0.75  # most of one frame period left
        if Trigger_img1.status == STARTED and t >= frameRemains:
            Trigger_img1.setAutoDraw(False)
        
        # *Target_img1* updates
        if t >= 5 and Target_img1.status == NOT_STARTED:
            # keep track of start time/frame for later
            Target_img1.tStart = t
            Target_img1.frameNStart = frameN  # exact frame index
            Target_img1.setAutoDraw(True)
        
        # *Trigger_txt1* updates
        if t >= 0.0 and Trigger_txt1.status == NOT_STARTED:
            # keep track of start time/frame for later
            Trigger_txt1.tStart = t
            Trigger_txt1.frameNStart = frameN  # exact frame index
            Trigger_txt1.setAutoDraw(True)
        frameRemains = 0.0 + 5- win.monitorFramePeriod * 0.75  # most of one frame period left
        if Trigger_txt1.status == STARTED and t >= frameRemains:
            Trigger_txt1.setAutoDraw(False)
        n= len(theseKeys)
        i = 0
        while i < n:
        
            if theseKeys[i] == 'return' and len(inputText) >1:
                # pressing RETURN means time to stop
                continueRoutine = False
                break
        
            elif theseKeys[i] == 'backspace':
                inputText = inputText[:-1]  # lose the final character
                i = i + 1
        
            elif theseKeys[i] == 'space':
                inputText += ' '
                i = i + 1
        
            elif theseKeys[i] in ['lshift', 'rshift']:
                shift_flag = True
                i = i + 1
        
            else:
                if len(theseKeys[i]) == 1:
                    # we only have 1 char so should be a normal key, 
                    # otherwise it might be 'ctrl' or similar so ignore it
                    if shift_flag:
                        inputText += chr( ord(theseKeys[i]) - ord(' '))
                        shift_flag = False
                    else:
                        inputText += theseKeys[i]
        
                i = i + 1
        
        
        # *txtinp* updates
        if t >= 5 and txtinp.status == NOT_STARTED:
            # keep track of start time/frame for later
            txtinp.tStart = t
            txtinp.frameNStart = frameN  # exact frame index
            txtinp.setAutoDraw(True)
        if txtinp.status == STARTED:  # only update if drawing
            txtinp.setText(inputText, log=False)
        
        # *text_resp* updates
        if t >= 5 and text_resp.status == NOT_STARTED:
            # keep track of start time/frame for later
            text_resp.tStart = t
            text_resp.frameNStart = frameN  # exact frame index
            text_resp.status = STARTED
            # keyboard checking is just starting
            win.callOnFlip(text_resp.clock.reset)  # t=0 on next screen flip
            event.clearEvents(eventType='keyboard')
        if text_resp.status == STARTED:
            theseKeys = event.getKeys()
            
            # check for quit:
            if "escape" in theseKeys:
                endExpNow = True
            if len(theseKeys) > 0:  # at least one key was pressed
                text_resp.keys.extend(theseKeys)  # storing all keys
                text_resp.rt.append(text_resp.clock.getTime())
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
870 871 872 873
        # check for quit (typically the Esc key)
        if endExpNow or event.getKeys(keyList=["escape"]):
            core.quit()
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930
        # 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 Test_ProdComponents:
            if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
                continueRoutine = True
                break  # at least one component has not yet finished
        
        # refresh the screen
        if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
            win.flip()
    
    # -------Ending Routine "Test_Prod"-------
    for thisComponent in Test_ProdComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    # let's store the final text string into the results finle...
    thisExp.addData('inputText', inputText)
    inputText=""
    # check responses
    if text_resp.keys in ['', [], None]:  # No response was made
        text_resp.keys=None
    trials_2.addData('text_resp.keys',text_resp.keys)
    if text_resp.keys != None:  # we had a response
        trials_2.addData('text_resp.rt', text_resp.rt)
    # the Routine "Test_Prod" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset()
    
    # ------Prepare to start Routine "ISI_1sec"-------
    t = 0
    ISI_1secClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    routineTimer.add(0.750000)
    # update component parameters for each repeat
    # keep track of which components have finished
    ISI_1secComponents = [ISI_2]
    for thisComponent in ISI_1secComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED
    
    # -------Start Routine "ISI_1sec"-------
    while continueRoutine and routineTimer.getTime() > 0:
        # get current time
        t = ISI_1secClock.getTime()
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame
        # *ISI_2* period
        if t >= 0.0 and ISI_2.status == NOT_STARTED:
            # keep track of start time/frame for later
            ISI_2.tStart = t
            ISI_2.frameNStart = frameN  # exact frame index
            ISI_2.start(0.75)
        elif ISI_2.status == STARTED:  # one frame should pass before updating params and completing
            ISI_2.complete()  # finish the static period
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
931 932 933 934
        # check for quit (typically the Esc key)
        if endExpNow or event.getKeys(keyList=["escape"]):
            core.quit()
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962
        # 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 ISI_1secComponents:
            if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
                continueRoutine = True
                break  # at least one component has not yet finished
        
        # refresh the screen
        if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
            win.flip()
    
    # -------Ending Routine "ISI_1sec"-------
    for thisComponent in ISI_1secComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    thisExp.nextEntry()
    
# completed 1 repeats of 'trials_2'


# ------Prepare to start Routine "Instruction_FC"-------
t = 0
Instruction_FCClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
963
image_6.setImage("Images/instrFC"+condition+".png")
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
key_resp_4 = event.BuilderKeyResponse()
# keep track of which components have finished
Instruction_FCComponents = [image_6, key_resp_4]
for thisComponent in Instruction_FCComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "Instruction_FC"-------
while continueRoutine:
    # get current time
    t = Instruction_FCClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *image_6* updates
    if t >= 0.0 and image_6.status == NOT_STARTED:
        # keep track of start time/frame for later
        image_6.tStart = t
        image_6.frameNStart = frameN  # exact frame index
        image_6.setAutoDraw(True)
    
    # *key_resp_4* updates
    if t >= 0.0 and key_resp_4.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp_4.tStart = t
        key_resp_4.frameNStart = frameN  # exact frame index
        key_resp_4.status = STARTED
        # keyboard checking is just starting
        win.callOnFlip(key_resp_4.clock.reset)  # t=0 on next screen flip
        event.clearEvents(eventType='keyboard')
    if key_resp_4.status == STARTED:
        theseKeys = event.getKeys(keyList=['space'])
        
        # check for quit:
        if "escape" in theseKeys:
            endExpNow = True
        if len(theseKeys) > 0:  # at least one key was pressed
            key_resp_4.keys = theseKeys[-1]  # just the last key pressed
            key_resp_4.rt = key_resp_4.clock.getTime()
            # a response ends the routine
            continueRoutine = False
    
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1006 1007 1008 1009
    # check for quit (typically the Esc key)
    if endExpNow or event.getKeys(keyList=["escape"]):
        core.quit()
    
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036
    # 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 Instruction_FCComponents:
        if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
            continueRoutine = True
            break  # at least one component has not yet finished
    
    # refresh the screen
    if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
        win.flip()

# -------Ending Routine "Instruction_FC"-------
for thisComponent in Instruction_FCComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
# check responses
if key_resp_4.keys in ['', [], None]:  # No response was made
    key_resp_4.keys=None
thisExp.addData('key_resp_4.keys',key_resp_4.keys)
if key_resp_4.keys != None:  # we had a response
    thisExp.addData('key_resp_4.rt', key_resp_4.rt)
thisExp.nextEntry()
# the Routine "Instruction_FC" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

Julian Lysvik's avatar
Julian Lysvik committed
1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074
# ------Prepare to start Routine "ISI_Pre"-------
t = 0
ISI_PreClock.reset()  # clock
frameN = -1
continueRoutine = True
routineTimer.add(1.000000)
# update component parameters for each repeat
# keep track of which components have finished
ISI_PreComponents = [ISI, fixation]
for thisComponent in ISI_PreComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "ISI_Pre"-------
while continueRoutine and routineTimer.getTime() > 0:
    # get current time
    t = ISI_PreClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *fixation* updates
    if t >= 0.0 and fixation.status == NOT_STARTED:
        # keep track of start time/frame for later
        fixation.tStart = t
        fixation.frameNStart = frameN  # exact frame index
        fixation.setAutoDraw(True)
    frameRemains = 0.0 + 1.0- win.monitorFramePeriod * 0.75  # most of one frame period left
    if fixation.status == STARTED and t >= frameRemains:
        fixation.setAutoDraw(False)
    # *ISI* period
    if t >= 0.0 and ISI.status == NOT_STARTED:
        # keep track of start time/frame for later
        ISI.tStart = t
        ISI.frameNStart = frameN  # exact frame index
        ISI.start(1)
    elif ISI.status == STARTED:  # one frame should pass before updating params and completing
        ISI.complete()  # finish the static period
    
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1075 1076 1077 1078
    # check for quit (typically the Esc key)
    if endExpNow or event.getKeys(keyList=["escape"]):
        core.quit()
    
Julian Lysvik's avatar
Julian Lysvik committed
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096
    # 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 ISI_PreComponents:
        if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
            continueRoutine = True
            break  # at least one component has not yet finished
    
    # refresh the screen
    if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
        win.flip()

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

Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1097 1098 1099
# set up handler to look after randomisation of conditions etc
trials_3 = data.TrialHandler(nReps=1, method='random', 
    extraInfo=expInfo, originPath=-1,
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1100
    trialList=data.importConditions("Lists/OrderFC"+condition+".xlsx", selection='np.random.choice(30, size = 10, replace = False)'),
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121
    seed=None, name='trials_3')
thisExp.addLoop(trials_3)  # add the loop to the experiment
thisTrial_3 = trials_3.trialList[0]  # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb = thisTrial_3.rgb)
if thisTrial_3 != None:
    for paramName in thisTrial_3:
        exec('{} = thisTrial_3[paramName]'.format(paramName))

for thisTrial_3 in trials_3:
    currentLoop = trials_3
    # abbreviate parameter names if possible (e.g. rgb = thisTrial_3.rgb)
    if thisTrial_3 != None:
        for paramName in thisTrial_3:
            exec('{} = thisTrial_3[paramName]'.format(paramName))
    
    # ------Prepare to start Routine "Test_FC"-------
    t = 0
    Test_FCClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    # update component parameters for each repeat
Julian Lysvik's avatar
Julian Lysvik committed
1122 1123 1124 1125
    Target_ins2.setText(instr)
    Trigger_img2.setImage(trig_img)
    Target_img2.setImage(targ_img)
    Trigger_txt2.setText(trig)
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1126
    FC_resp = event.BuilderKeyResponse()
Julian Lysvik's avatar
Julian Lysvik committed
1127 1128
    Resp_a.setText(a)
    Resp_b.setText(k)
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1129
    # keep track of which components have finished
Julian Lysvik's avatar
Julian Lysvik committed
1130
    Test_FCComponents = [Target_ins2, Trigger_img2, Target_img2, Trigger_txt2, Target_instr_l, Target_instr_r, FC_resp, Resp_a, Resp_b]
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224
    for thisComponent in Test_FCComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED
    
    # -------Start Routine "Test_FC"-------
    while continueRoutine:
        # get current time
        t = Test_FCClock.getTime()
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame
        
        # *Target_ins2* updates
        if t >= 4 and Target_ins2.status == NOT_STARTED:
            # keep track of start time/frame for later
            Target_ins2.tStart = t
            Target_ins2.frameNStart = frameN  # exact frame index
            Target_ins2.setAutoDraw(True)
        
        # *Trigger_img2* updates
        if t >= 0.0 and Trigger_img2.status == NOT_STARTED:
            # keep track of start time/frame for later
            Trigger_img2.tStart = t
            Trigger_img2.frameNStart = frameN  # exact frame index
            Trigger_img2.setAutoDraw(True)
        frameRemains = 0.0 + 4- win.monitorFramePeriod * 0.75  # most of one frame period left
        if Trigger_img2.status == STARTED and t >= frameRemains:
            Trigger_img2.setAutoDraw(False)
        
        # *Target_img2* updates
        if t >= 4 and Target_img2.status == NOT_STARTED:
            # keep track of start time/frame for later
            Target_img2.tStart = t
            Target_img2.frameNStart = frameN  # exact frame index
            Target_img2.setAutoDraw(True)
        
        # *Trigger_txt2* updates
        if t >= 0.0 and Trigger_txt2.status == NOT_STARTED:
            # keep track of start time/frame for later
            Trigger_txt2.tStart = t
            Trigger_txt2.frameNStart = frameN  # exact frame index
            Trigger_txt2.setAutoDraw(True)
        frameRemains = 0.0 + 4- win.monitorFramePeriod * 0.75  # most of one frame period left
        if Trigger_txt2.status == STARTED and t >= frameRemains:
            Trigger_txt2.setAutoDraw(False)
        
        # *Target_instr_l* updates
        if t >= 4 and Target_instr_l.status == NOT_STARTED:
            # keep track of start time/frame for later
            Target_instr_l.tStart = t
            Target_instr_l.frameNStart = frameN  # exact frame index
            Target_instr_l.setAutoDraw(True)
        
        # *Target_instr_r* updates
        if t >= 4 and Target_instr_r.status == NOT_STARTED:
            # keep track of start time/frame for later
            Target_instr_r.tStart = t
            Target_instr_r.frameNStart = frameN  # exact frame index
            Target_instr_r.setAutoDraw(True)
        
        # *FC_resp* updates
        if t >= 4 and FC_resp.status == NOT_STARTED:
            # keep track of start time/frame for later
            FC_resp.tStart = t
            FC_resp.frameNStart = frameN  # exact frame index
            FC_resp.status = STARTED
            # keyboard checking is just starting
            win.callOnFlip(FC_resp.clock.reset)  # t=0 on next screen flip
            event.clearEvents(eventType='keyboard')
        if FC_resp.status == STARTED:
            theseKeys = event.getKeys(keyList=['a', 'k'])
            
            # check for quit:
            if "escape" in theseKeys:
                endExpNow = True
            if len(theseKeys) > 0:  # at least one key was pressed
                FC_resp.keys = theseKeys[-1]  # just the last key pressed
                FC_resp.rt = FC_resp.clock.getTime()
                # a response ends the routine
                continueRoutine = False
        
        # *Resp_a* updates
        if t >= 4 and Resp_a.status == NOT_STARTED:
            # keep track of start time/frame for later
            Resp_a.tStart = t
            Resp_a.frameNStart = frameN  # exact frame index
            Resp_a.setAutoDraw(True)
        
        # *Resp_b* updates
        if t >= 4 and Resp_b.status == NOT_STARTED:
            # keep track of start time/frame for later
            Resp_b.tStart = t
            Resp_b.frameNStart = frameN  # exact frame index
            Resp_b.setAutoDraw(True)
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1225 1226 1227 1228
        # check for quit (typically the Esc key)
        if endExpNow or event.getKeys(keyList=["escape"]):
            core.quit()
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282
        # 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 Test_FCComponents:
            if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
                continueRoutine = True
                break  # at least one component has not yet finished
        
        # refresh the screen
        if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
            win.flip()
    
    # -------Ending Routine "Test_FC"-------
    for thisComponent in Test_FCComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    # check responses
    if FC_resp.keys in ['', [], None]:  # No response was made
        FC_resp.keys=None
    trials_3.addData('FC_resp.keys',FC_resp.keys)
    if FC_resp.keys != None:  # we had a response
        trials_3.addData('FC_resp.rt', FC_resp.rt)
    # the Routine "Test_FC" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset()
    
    # ------Prepare to start Routine "ISI_1sec"-------
    t = 0
    ISI_1secClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    routineTimer.add(0.750000)
    # update component parameters for each repeat
    # keep track of which components have finished
    ISI_1secComponents = [ISI_2]
    for thisComponent in ISI_1secComponents:
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED
    
    # -------Start Routine "ISI_1sec"-------
    while continueRoutine and routineTimer.getTime() > 0:
        # get current time
        t = ISI_1secClock.getTime()
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame
        # *ISI_2* period
        if t >= 0.0 and ISI_2.status == NOT_STARTED:
            # keep track of start time/frame for later
            ISI_2.tStart = t
            ISI_2.frameNStart = frameN  # exact frame index
            ISI_2.start(0.75)
        elif ISI_2.status == STARTED:  # one frame should pass before updating params and completing
            ISI_2.complete()  # finish the static period
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1283 1284 1285 1286
        # check for quit (typically the Esc key)
        if endExpNow or event.getKeys(keyList=["escape"]):
            core.quit()
        
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308
        # 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 ISI_1secComponents:
            if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
                continueRoutine = True
                break  # at least one component has not yet finished
        
        # refresh the screen
        if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
            win.flip()
    
    # -------Ending Routine "ISI_1sec"-------
    for thisComponent in ISI_1secComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    thisExp.nextEntry()
    
# completed 1 repeats of 'trials_3'


Julian Lysvik's avatar
Julian Lysvik committed
1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352
# ------Prepare to start Routine "Thank_you"-------
t = 0
Thank_youClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp_3 = event.BuilderKeyResponse()
# keep track of which components have finished
Thank_youComponents = [text, key_resp_3]
for thisComponent in Thank_youComponents:
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "Thank_you"-------
while continueRoutine:
    # get current time
    t = Thank_youClock.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:
        # keep track of start time/frame for later
        text.tStart = t
        text.frameNStart = frameN  # exact frame index
        text.setAutoDraw(True)
    
    # *key_resp_3* updates
    if t >= 0.0 and key_resp_3.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp_3.tStart = t
        key_resp_3.frameNStart = frameN  # exact frame index
        key_resp_3.status = STARTED
        # keyboard checking is just starting
    if key_resp_3.status == STARTED:
        theseKeys = event.getKeys(keyList=['q'])
        
        # 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
    
Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1353 1354 1355 1356
    # check for quit (typically the Esc key)
    if endExpNow or event.getKeys(keyList=["escape"]):
        core.quit()
    
Julian Lysvik's avatar
Julian Lysvik committed
1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376
    # 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 Thank_youComponents:
        if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
            continueRoutine = True
            break  # at least one component has not yet finished
    
    # refresh the screen
    if continueRoutine:  # don't flip if this routine is over or we'll get a blank screen
        win.flip()

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

1377

Julian Kirkeby Lysvik's avatar
Julian Kirkeby Lysvik committed
1378 1379 1380 1381 1382 1383 1384 1385
# these shouldn't be strictly necessary (should auto-save)
thisExp.saveAsWideText(filename+'.csv')
thisExp.saveAsPickle(filename)
logging.flush()
# make sure everything is closed down
thisExp.abort()  # or data files will save again on exit
win.close()
core.quit()