decision.py 69.7 KB
Newer Older
Eleonore 's avatar
1  
Eleonore committed
1 2 3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Eleonore 's avatar
_  
Eleonore committed
4
This experiment was created using PsychoPy3 Experiment Builder (v3.1.1),
Eleonore 's avatar
_  
Eleonore committed
5
    on October 04, 2019, at 11:58
Eleonore 's avatar
1  
Eleonore committed
6 7 8 9 10 11 12 13
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
Eleonore 's avatar
_  
Eleonore committed
14 15 16 17

import psychopy
psychopy.useVersion('3.1.1')

Eleonore 's avatar
1  
Eleonore committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
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

from psychopy.hardware import keyboard

# 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
Eleonore 's avatar
_  
Eleonore committed
35
psychopyVersion = '3.1.1'
Eleonore 's avatar
1  
Eleonore committed
36
expName = 'decision'  # from the Builder filename that created this script
Eleonore 's avatar
_  
Eleonore committed
37
expInfo = {'Willkommen zur Studie! Bevor es losgeht, beantworten Sie bitte ein paar Fragen zu Ihrer Person. Diese werden anonymisiert behandelt und ausschließlich zu wissenschaftlichen Zwecken verwendet. Fragen, die Sie nicht beantworten wollen, können Sie auslassen. Beim Feld "Teilnehmer_in" können Sie einfach einen ausgedachten Namen eintragen. Vielen Dank! In welchem Jahr sind Sie geboren?': '', 'Welches Geschlecht haben Sie?': '', 'Was ist Ihr höchster Bildungsabschluss?': '', 'Wurde bei Ihnen eine Lese-Rechtschreibschwäche festgestellt?': '', 'Nutzen Sie vornehmlich Ihre linke oder Ihre rechte Hand?': '', 'Welche Muttersprache/n sprechen Sie? (Muttersprache/n = Sprache/n, die Sie bis zum 12. Lebensjahr außerhalb der Schule gesprochen haben)': '', 'Sprechen Sie in Ihrem familiären Umfeld vornehmlich Standard oder Dialekt?': '', 'Sprechen Sie einen Dialekt, wenn ja welchen?': '', 'Wo sind Sie (bis zum 18. Lebensjahr) aufgewachsen? Bitte nennen Sie Ort(e) und (wenn möglich) Postleitzahlen.': '', 'Wie oft lesen Sie (Zeitung, Artikel im Internet, Mails, Romane etc)? täglich, wöchentlich oder monatlich?': '', 'Teilnehmer_in': ''}
Eleonore 's avatar
1  
Eleonore committed
38 39 40 41 42 43 44 45
dlg = gui.DlgFromDict(dictionary=expInfo, sortKeys=False, title=expName)
if dlg.OK == False:
    core.quit()  # user pressed cancel
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
Eleonore 's avatar
_  
Eleonore committed
46
filename = _thisDir + os.sep + u'data/%s_%s_%s' % (expInfo['Teilnehmer_in'], expName, expInfo['date'])
Eleonore 's avatar
1  
Eleonore committed
47 48 49 50

# An ExperimentHandler isn't essential but helps with data saving
thisExp = data.ExperimentHandler(name=expName, version='',
    extraInfo=expInfo, runtimeInfo=None,
Eleonore 's avatar
5  
Eleonore committed
51
    originPath='C:\\Users\\ba1fh1\\Local Folders\\My Local Files\\decision\\decision.py',
Eleonore 's avatar
1  
Eleonore committed
52 53 54 55 56 57 58 59 60 61 62 63
    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(
Eleonore 's avatar
_  
Eleonore committed
64
    size=[1280, 720], fullscr=True, screen=0, 
Eleonore 's avatar
5  
Eleonore committed
65
    winType='pyglet', allowGUI=False, allowStencil=False,
Eleonore 's avatar
1  
Eleonore committed
66 67 68 69 70 71 72 73 74 75 76 77 78
    monitor='testMonitor', color=[0,0,0], colorSpace='rgb',
    blendMode='avg', useFBO=True, 
    units='height')
# 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 "willkommen"
willkommenClock = core.Clock()
Willk_text = visual.TextStim(win=win, name='Willk_text',
Eleonore 's avatar
_  
Eleonore committed
79
    text='Hallo und herzlich willkommen! \n\nEs freut mich, dass Sie Interesse an der Studie haben. \nSie dauert ca. 10 Minuten. \nBitte konzentrieren Sie sich auf die Aufgabe \nund stellen Sie sicher, dass Sie sich in einem ruhigen Raum befinden \nund nicht gestört werden. \n\nIn der Studie geht es darum, \nmöglichst schnell Wörter zu beurteilen. \nSie werden gleich ein Beispiel sehen. \n\nDie Teilnahme an der Studie ist freiwillig. Bitte führen Sie die Studie bis zum Ende durch, da ich Ihre Daten ansonsten nicht auswerten kann. \nMit der Teilnahme stimmen Sie zu, dass Ihre Daten anonymisiert gespeichert werden.\n\nDrücken Sie die Leertaste, um weiter zu gelangen.\n',
Eleonore 's avatar
1  
Eleonore committed
80 81 82 83 84 85 86 87 88
    font='Arial',
    pos=(0, 0), height=0.03, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);

# Initialize components for Routine "beispiel"
beispielClock = core.Clock()
text_Bsp = visual.TextStim(win=win, name='text_Bsp',
Eleonore 's avatar
_  
Eleonore committed
89 90 91 92 93 94 95 96 97 98 99
    text='\nIhre Aufgabe ist es, Wörter zu beurteilen.\n\n\nBeantworten Sie dazu immer folgende Frage:\nKennen Sie dieses Wort? \n\nDrücken Sie "f" für "nein" und "j" für "ja". \n\n\nDrücken Sie die Leertaste, um weiter zu gelangen.\n',
    font='Arial',
    pos=(0, 0), height=0.04, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);

# Initialize components for Routine "bsp_einf"
bsp_einfClock = core.Clock()
text_5 = visual.TextStim(win=win, name='text_5',
    text='Vor jedem Testwort erscheint ### in der Mitte des Bildschirms. \n\nIm Anschluss erscheint dann das zu beurteilende Wort.\n\n\nMit der Leertaste gelangen Sie zu den Beispielwörtern.\n',
Eleonore 's avatar
1  
Eleonore committed
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
    font='Arial',
    pos=(0, 0), height=0.04, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);

# Initialize components for Routine "beispiel_block"
beispiel_blockClock = core.Clock()
text_Bspw = visual.TextStim(win=win, name='text_Bspw',
    text='default text',
    font='Arial',
    pos=(0, 0), height=0.1, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);
Angabe_bsp_j = visual.TextStim(win=win, name='Angabe_bsp_j',
Eleonore 's avatar
5  
Eleonore committed
116
    text='j = "ja"',
Eleonore 's avatar
1  
Eleonore committed
117
    font='Arial',
Eleonore 's avatar
5  
Eleonore committed
118
    pos=(0.4, -0.2), height=0.05, wrapWidth=None, ori=0, 
Eleonore 's avatar
1  
Eleonore committed
119 120 121 122
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-2.0);
Angabe_bsp_n = visual.TextStim(win=win, name='Angabe_bsp_n',
Eleonore 's avatar
5  
Eleonore committed
123
    text='f = "nein"',
Eleonore 's avatar
1  
Eleonore committed
124
    font='Arial',
Eleonore 's avatar
5  
Eleonore committed
125
    pos=(-0.4,-0.2), height=0.05, wrapWidth=None, ori=0, 
Eleonore 's avatar
1  
Eleonore committed
126 127 128 129 130 131 132 133 134 135
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-3.0);
test_text = visual.TextStim(win=win, name='test_text',
    text='Kennen Sie dieses Wort?',
    font='Arial',
    pos=(0, + 0.2), height=0.05, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-4.0);
Eleonore 's avatar
_  
Eleonore committed
136 137 138 139 140 141 142
text_2 = visual.TextStim(win=win, name='text_2',
    text='###',
    font='Arial',
    pos=(0, 0), height=0.1, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-5.0);
Eleonore 's avatar
1  
Eleonore committed
143 144 145 146

# Initialize components for Routine "beispiel_ende"
beispiel_endeClock = core.Clock()
beispiel_text = visual.TextStim(win=win, name='beispiel_text',
Eleonore 's avatar
_  
Eleonore committed
147
    text='\nJetzt haben Sie einen Eindruck erhalten, wie die Aufgabe funktioniert.\n\nDie folgenden Wörter beurteilen Sie bitte auch danach, ob Sie das Wort kennen. \nBitte denken Sie nicht lange über die Wörter nach, sondern antworten spontan nach Ihrem Gefühl.\n\nMit der Leertaste geht es zu den Wörtern.',
Eleonore 's avatar
1  
Eleonore committed
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
    font='Arial',
    pos=(0, 0), height=0.04, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);

# Initialize components for Routine "test_block"
test_blockClock = core.Clock()
Angabe_test = visual.TextStim(win=win, name='Angabe_test',
    text='default text',
    font='Arial',
    pos=(0, 0), height=0.1, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);
Angabe_test_j = visual.TextStim(win=win, name='Angabe_test_j',
Eleonore 's avatar
5  
Eleonore committed
164
    text='j = "ja"',
Eleonore 's avatar
1  
Eleonore committed
165
    font='Arial',
Eleonore 's avatar
5  
Eleonore committed
166
    pos=(0.4, -0.2), height=0.05, wrapWidth=None, ori=0, 
Eleonore 's avatar
1  
Eleonore committed
167 168 169 170
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-2.0);
Angabe_test_n = visual.TextStim(win=win, name='Angabe_test_n',
Eleonore 's avatar
5  
Eleonore committed
171
    text='f = "nein"',
Eleonore 's avatar
1  
Eleonore committed
172
    font='Arial',
Eleonore 's avatar
5  
Eleonore committed
173
    pos=(-0.4, -0.2), height=0.05, wrapWidth=None, ori=0, 
Eleonore 's avatar
1  
Eleonore committed
174 175 176
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-3.0);
Eleonore 's avatar
_  
Eleonore committed
177 178 179 180 181 182 183
text_3 = visual.TextStim(win=win, name='text_3',
    text='###',
    font='Arial',
    pos=(0, 0), height=0.1, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-4.0);
Eleonore 's avatar
1  
Eleonore committed
184 185 186 187 188 189 190 191 192 193 194

# Initialize components for Routine "trial"
trialClock = core.Clock()
Angabe = visual.TextStim(win=win, name='Angabe',
    text='default text',
    font='Arial',
    pos=(0, 0), height=0.1, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);
Angabe_y = visual.TextStim(win=win, name='Angabe_y',
Eleonore 's avatar
5  
Eleonore committed
195
    text='j = "ja"',
Eleonore 's avatar
1  
Eleonore committed
196
    font='Arial',
Eleonore 's avatar
5  
Eleonore committed
197
    pos=(0.4, -0.2), height=0.05, wrapWidth=None, ori=0, 
Eleonore 's avatar
1  
Eleonore committed
198 199 200 201
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-2.0);
Angabe_n = visual.TextStim(win=win, name='Angabe_n',
Eleonore 's avatar
5  
Eleonore committed
202
    text='f = "nein"',
Eleonore 's avatar
1  
Eleonore committed
203
    font='Arial',
Eleonore 's avatar
5  
Eleonore committed
204
    pos=(-0.4, -0.2), height=0.05, wrapWidth=None, ori=0, 
Eleonore 's avatar
1  
Eleonore committed
205 206 207
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-3.0);
Eleonore 's avatar
_  
Eleonore committed
208 209 210 211 212 213 214
text_4 = visual.TextStim(win=win, name='text_4',
    text='###',
    font='Arial',
    pos=(0, 0), height=0.1, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-4.0);
Eleonore 's avatar
1  
Eleonore committed
215 216 217 218

# Initialize components for Routine "fragen_anfang"
fragen_anfangClock = core.Clock()
text = visual.TextStim(win=win, name='text',
Eleonore 's avatar
_  
Eleonore committed
219
    text='Vielen Dank! \nSie haben es fast geschafft! \nIch habe nur noch drei kurze abschließende Fragen, die Sie per Mausklick beantworten können.\n\nMit der Leertaste kommen Sie zu den Fragen.\n\n',
Eleonore 's avatar
1  
Eleonore committed
220 221 222 223 224 225 226 227
    font='Arial',
    pos=(0, 0), height=0.04, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);

# Initialize components for Routine "fragen1"
fragen1Clock = core.Clock()
Eleonore 's avatar
5  
Eleonore committed
228
konzentration = visual.Slider(win=win, name='konzentration',
Eleonore 's avatar
_  
Eleonore committed
229
    size=(0.035, 0.35), pos=(0,-0.03),
Eleonore 's avatar
5  
Eleonore committed
230
    labels=["unkonzentriert","hochkonzentriert"], ticks=(1, 2, 3, 4, 5),
Eleonore 's avatar
_  
Eleonore committed
231
    granularity=0, style=['slider'],
Eleonore 's avatar
5  
Eleonore committed
232 233 234 235 236
    color='LightGray', font='Arial',
    flip=False)
Konzentration = visual.TextStim(win=win, name='Konzentration',
    text='Wie konzentriert waren Sie während der Studie?',
    font='Arial',
Eleonore 's avatar
_  
Eleonore committed
237
    pos=(0, 0.2), height=0.04, wrapWidth=None, ori=0, 
Eleonore 's avatar
5  
Eleonore committed
238 239 240
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-1.0);
Eleonore 's avatar
1  
Eleonore committed
241 242 243

# Initialize components for Routine "fragen2"
fragen2Clock = core.Clock()
Eleonore 's avatar
5  
Eleonore committed
244
Ernsthaftigkeit = visual.Slider(win=win, name='Ernsthaftigkeit',
Eleonore 's avatar
_  
Eleonore committed
245
    size=(0.035, 0.35), pos=(0, -0.03),
Eleonore 's avatar
5  
Eleonore committed
246 247 248 249 250 251 252
    labels=["nicht ernsthaft","sehr ernsthaft"], ticks=(1, 2, 3, 4, 5),
    granularity=0, style=['rating', 'triangleMarker'],
    color='LightGray', font='Arial',
    flip=False)
ernsthaftigkeit = visual.TextStim(win=win, name='ernsthaftigkeit',
    text='Wie ernsthaft haben Sie die Aufgabe erfüllt?',
    font='Arial',
Eleonore 's avatar
_  
Eleonore committed
253
    pos=(0, 0.2), height=0.04, wrapWidth=None, ori=0, 
Eleonore 's avatar
5  
Eleonore committed
254 255 256
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-1.0);
Eleonore 's avatar
1  
Eleonore committed
257 258 259

# Initialize components for Routine "fragen3"
fragen3Clock = core.Clock()
Eleonore 's avatar
5  
Eleonore committed
260
Ruhe = visual.Slider(win=win, name='Ruhe',
Eleonore 's avatar
_  
Eleonore committed
261
    size=(0.035, 0.35), pos=(0, -0.03),
Eleonore 's avatar
5  
Eleonore committed
262 263 264 265 266 267 268
    labels=["leise","laut"], ticks=(1, 2, 3, 4, 5),
    granularity=0, style=['rating', 'triangleMarker'],
    color='LightGray', font='Arial',
    flip=False)
ruhe = visual.TextStim(win=win, name='ruhe',
    text='Wie ruhig war es im Raum?',
    font='Arial',
Eleonore 's avatar
_  
Eleonore committed
269
    pos=(0, 0.2), height=0.04, wrapWidth=None, ori=0, 
Eleonore 's avatar
5  
Eleonore committed
270 271 272
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=-1.0);
Eleonore 's avatar
1  
Eleonore committed
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 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 337 338 339 340 341 342 343

# Initialize components for Routine "ende"
endeClock = core.Clock()
ende_text = visual.TextStim(win=win, name='ende_text',
    text='Vielen Dank für die Teilnahme!\n\nWenn Sie an den Ergebnissen der Studie interessiert sind, können Sie mich gerne unter eleonore.schmitt@uni-bamberg.de kontaktieren.\n\nMit der Leertaste beenden Sie die Studie.',
    font='Arial',
    pos=(0, 0), height=0.04, wrapWidth=None, ori=0, 
    color='white', colorSpace='rgb', opacity=1, 
    languageStyle='LTR',
    depth=0.0);

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

# ------Prepare to start Routine "willkommen"-------
t = 0
willkommenClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp_W = keyboard.Keyboard()
# keep track of which components have finished
willkommenComponents = [Willk_text, key_resp_W]
for thisComponent in willkommenComponents:
    thisComponent.tStart = None
    thisComponent.tStop = None
    thisComponent.tStartRefresh = None
    thisComponent.tStopRefresh = None
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "willkommen"-------
while continueRoutine:
    # get current time
    t = willkommenClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *Willk_text* updates
    if t >= 0.0 and Willk_text.status == NOT_STARTED:
        # keep track of start time/frame for later
        Willk_text.tStart = t  # not accounting for scr refresh
        Willk_text.frameNStart = frameN  # exact frame index
        win.timeOnFlip(Willk_text, 'tStartRefresh')  # time at next scr refresh
        Willk_text.setAutoDraw(True)
    
    # *key_resp_W* updates
    if t >= 0.0 and key_resp_W.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp_W.tStart = t  # not accounting for scr refresh
        key_resp_W.frameNStart = frameN  # exact frame index
        win.timeOnFlip(key_resp_W, 'tStartRefresh')  # time at next scr refresh
        key_resp_W.status = STARTED
        # keyboard checking is just starting
        win.callOnFlip(key_resp_W.clock.reset)  # t=0 on next screen flip
        key_resp_W.clearEvents(eventType='keyboard')
    if key_resp_W.status == STARTED:
        theseKeys = key_resp_W.getKeys(keyList=['space'], waitRelease=False)
        if len(theseKeys):
            theseKeys = theseKeys[0]  # at least one key was pressed
            
            # check for quit:
            if "escape" == theseKeys:
                endExpNow = True
            key_resp_W.keys = theseKeys.name  # just the last key pressed
            key_resp_W.rt = theseKeys.rt
            # a response ends the routine
            continueRoutine = False
    
    # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
344
    if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 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 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
        core.quit()
    
    # 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 willkommenComponents:
        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 "willkommen"-------
for thisComponent in willkommenComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
thisExp.addData('Willk_text.started', Willk_text.tStartRefresh)
thisExp.addData('Willk_text.stopped', Willk_text.tStopRefresh)
# check responses
if key_resp_W.keys in ['', [], None]:  # No response was made
    key_resp_W.keys = None
thisExp.addData('key_resp_W.keys',key_resp_W.keys)
if key_resp_W.keys != None:  # we had a response
    thisExp.addData('key_resp_W.rt', key_resp_W.rt)
thisExp.addData('key_resp_W.started', key_resp_W.tStartRefresh)
thisExp.addData('key_resp_W.stopped', key_resp_W.tStopRefresh)
thisExp.nextEntry()
# the Routine "willkommen" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

# ------Prepare to start Routine "beispiel"-------
t = 0
beispielClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp_Bsp = keyboard.Keyboard()
# keep track of which components have finished
beispielComponents = [text_Bsp, key_resp_Bsp]
for thisComponent in beispielComponents:
    thisComponent.tStart = None
    thisComponent.tStop = None
    thisComponent.tStartRefresh = None
    thisComponent.tStopRefresh = None
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "beispiel"-------
while continueRoutine:
    # get current time
    t = beispielClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *text_Bsp* updates
    if t >= 0.0 and text_Bsp.status == NOT_STARTED:
        # keep track of start time/frame for later
        text_Bsp.tStart = t  # not accounting for scr refresh
        text_Bsp.frameNStart = frameN  # exact frame index
        win.timeOnFlip(text_Bsp, 'tStartRefresh')  # time at next scr refresh
        text_Bsp.setAutoDraw(True)
    
    # *key_resp_Bsp* updates
    if t >= 0.0 and key_resp_Bsp.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp_Bsp.tStart = t  # not accounting for scr refresh
        key_resp_Bsp.frameNStart = frameN  # exact frame index
        win.timeOnFlip(key_resp_Bsp, 'tStartRefresh')  # time at next scr refresh
        key_resp_Bsp.status = STARTED
        # keyboard checking is just starting
        win.callOnFlip(key_resp_Bsp.clock.reset)  # t=0 on next screen flip
        key_resp_Bsp.clearEvents(eventType='keyboard')
    if key_resp_Bsp.status == STARTED:
        theseKeys = key_resp_Bsp.getKeys(keyList=['space'], waitRelease=False)
        if len(theseKeys):
            theseKeys = theseKeys[0]  # at least one key was pressed
            
            # check for quit:
            if "escape" == theseKeys:
                endExpNow = True
            key_resp_Bsp.keys = theseKeys.name  # just the last key pressed
            key_resp_Bsp.rt = theseKeys.rt
            # a response ends the routine
            continueRoutine = False
    
    # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
434
    if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
        core.quit()
    
    # 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 beispielComponents:
        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 "beispiel"-------
for thisComponent in beispielComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
thisExp.addData('text_Bsp.started', text_Bsp.tStartRefresh)
thisExp.addData('text_Bsp.stopped', text_Bsp.tStopRefresh)
# check responses
if key_resp_Bsp.keys in ['', [], None]:  # No response was made
    key_resp_Bsp.keys = None
thisExp.addData('key_resp_Bsp.keys',key_resp_Bsp.keys)
if key_resp_Bsp.keys != None:  # we had a response
    thisExp.addData('key_resp_Bsp.rt', key_resp_Bsp.rt)
thisExp.addData('key_resp_Bsp.started', key_resp_Bsp.tStartRefresh)
thisExp.addData('key_resp_Bsp.stopped', key_resp_Bsp.tStopRefresh)
thisExp.nextEntry()
# the Routine "beispiel" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

Eleonore 's avatar
_  
Eleonore committed
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 513 514 515 516 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
# ------Prepare to start Routine "bsp_einf"-------
t = 0
bsp_einfClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp_2 = keyboard.Keyboard()
# keep track of which components have finished
bsp_einfComponents = [text_5, key_resp_2]
for thisComponent in bsp_einfComponents:
    thisComponent.tStart = None
    thisComponent.tStop = None
    thisComponent.tStartRefresh = None
    thisComponent.tStopRefresh = None
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "bsp_einf"-------
while continueRoutine:
    # get current time
    t = bsp_einfClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *text_5* updates
    if t >= 0.0 and text_5.status == NOT_STARTED:
        # keep track of start time/frame for later
        text_5.tStart = t  # not accounting for scr refresh
        text_5.frameNStart = frameN  # exact frame index
        win.timeOnFlip(text_5, 'tStartRefresh')  # time at next scr refresh
        text_5.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  # not accounting for scr refresh
        key_resp_2.frameNStart = frameN  # exact frame index
        win.timeOnFlip(key_resp_2, 'tStartRefresh')  # time at next scr refresh
        key_resp_2.status = STARTED
        # keyboard checking is just starting
        win.callOnFlip(key_resp_2.clock.reset)  # t=0 on next screen flip
        key_resp_2.clearEvents(eventType='keyboard')
    if key_resp_2.status == STARTED:
        theseKeys = key_resp_2.getKeys(keyList=['space'], waitRelease=False)
        if len(theseKeys):
            theseKeys = theseKeys[0]  # at least one key was pressed
            
            # check for quit:
            if "escape" == theseKeys:
                endExpNow = True
            key_resp_2.keys = theseKeys.name  # just the last key pressed
            key_resp_2.rt = theseKeys.rt
            # a response ends the routine
            continueRoutine = False
    
    # check for quit (typically the Esc key)
    if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
        core.quit()
    
    # 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 bsp_einfComponents:
        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 "bsp_einf"-------
for thisComponent in bsp_einfComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
thisExp.addData('text_5.started', text_5.tStartRefresh)
thisExp.addData('text_5.stopped', text_5.tStopRefresh)
# 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.addData('key_resp_2.started', key_resp_2.tStartRefresh)
thisExp.addData('key_resp_2.stopped', key_resp_2.tStopRefresh)
thisExp.nextEntry()
# the Routine "bsp_einf" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

Eleonore 's avatar
1  
Eleonore committed
558 559 560
# set up handler to look after randomisation of conditions etc
trials_2 = data.TrialHandler(nReps=1, method='sequential', 
    extraInfo=expInfo, originPath=-1,
Eleonore 's avatar
5  
Eleonore committed
561
    trialList=data.importConditions('Beispiel.xlsx'),
Eleonore 's avatar
1  
Eleonore committed
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582
    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 "beispiel_block"-------
    t = 0
    beispiel_blockClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    # update component parameters for each repeat
Eleonore 's avatar
5  
Eleonore committed
583
    text_Bspw.setText(Stimulus)
Eleonore 's avatar
1  
Eleonore committed
584 585
    key_resp_Bspw = keyboard.Keyboard()
    # keep track of which components have finished
Eleonore 's avatar
_  
Eleonore committed
586
    beispiel_blockComponents = [text_Bspw, key_resp_Bspw, Angabe_bsp_j, Angabe_bsp_n, test_text, text_2]
Eleonore 's avatar
1  
Eleonore committed
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602
    for thisComponent in beispiel_blockComponents:
        thisComponent.tStart = None
        thisComponent.tStop = None
        thisComponent.tStartRefresh = None
        thisComponent.tStopRefresh = None
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED
    
    # -------Start Routine "beispiel_block"-------
    while continueRoutine:
        # get current time
        t = beispiel_blockClock.getTime()
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame
        
        # *text_Bspw* updates
Eleonore 's avatar
_  
Eleonore committed
603
        if t >= 2 and text_Bspw.status == NOT_STARTED:
Eleonore 's avatar
1  
Eleonore committed
604 605 606 607 608 609 610
            # keep track of start time/frame for later
            text_Bspw.tStart = t  # not accounting for scr refresh
            text_Bspw.frameNStart = frameN  # exact frame index
            win.timeOnFlip(text_Bspw, 'tStartRefresh')  # time at next scr refresh
            text_Bspw.setAutoDraw(True)
        
        # *key_resp_Bspw* updates
Eleonore 's avatar
_  
Eleonore committed
611
        if t >= 2 and key_resp_Bspw.status == NOT_STARTED:
Eleonore 's avatar
1  
Eleonore committed
612 613 614 615 616 617 618 619 620
            # keep track of start time/frame for later
            key_resp_Bspw.tStart = t  # not accounting for scr refresh
            key_resp_Bspw.frameNStart = frameN  # exact frame index
            win.timeOnFlip(key_resp_Bspw, 'tStartRefresh')  # time at next scr refresh
            key_resp_Bspw.status = STARTED
            # keyboard checking is just starting
            win.callOnFlip(key_resp_Bspw.clock.reset)  # t=0 on next screen flip
            key_resp_Bspw.clearEvents(eventType='keyboard')
        if key_resp_Bspw.status == STARTED:
Eleonore 's avatar
5  
Eleonore committed
621
            theseKeys = key_resp_Bspw.getKeys(keyList=['f', 'j'], waitRelease=False)
Eleonore 's avatar
1  
Eleonore committed
622 623 624 625 626 627 628 629
            if len(theseKeys):
                theseKeys = theseKeys[0]  # at least one key was pressed
                
                # check for quit:
                if "escape" == theseKeys:
                    endExpNow = True
                key_resp_Bspw.keys = theseKeys.name  # just the last key pressed
                key_resp_Bspw.rt = theseKeys.rt
Eleonore 's avatar
5  
Eleonore committed
630 631 632 633 634
                # was this 'correct'?
                if (key_resp_Bspw.keys == str(correctKey)) or (key_resp_Bspw.keys == correctKey):
                    key_resp_Bspw.corr = 1
                else:
                    key_resp_Bspw.corr = 0
Eleonore 's avatar
1  
Eleonore committed
635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661
                # a response ends the routine
                continueRoutine = False
        
        # *Angabe_bsp_j* updates
        if t >= 0.0 and Angabe_bsp_j.status == NOT_STARTED:
            # keep track of start time/frame for later
            Angabe_bsp_j.tStart = t  # not accounting for scr refresh
            Angabe_bsp_j.frameNStart = frameN  # exact frame index
            win.timeOnFlip(Angabe_bsp_j, 'tStartRefresh')  # time at next scr refresh
            Angabe_bsp_j.setAutoDraw(True)
        
        # *Angabe_bsp_n* updates
        if t >= 0.0 and Angabe_bsp_n.status == NOT_STARTED:
            # keep track of start time/frame for later
            Angabe_bsp_n.tStart = t  # not accounting for scr refresh
            Angabe_bsp_n.frameNStart = frameN  # exact frame index
            win.timeOnFlip(Angabe_bsp_n, 'tStartRefresh')  # time at next scr refresh
            Angabe_bsp_n.setAutoDraw(True)
        
        # *test_text* updates
        if t >= 0.0 and test_text.status == NOT_STARTED:
            # keep track of start time/frame for later
            test_text.tStart = t  # not accounting for scr refresh
            test_text.frameNStart = frameN  # exact frame index
            win.timeOnFlip(test_text, 'tStartRefresh')  # time at next scr refresh
            test_text.setAutoDraw(True)
        
Eleonore 's avatar
_  
Eleonore committed
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676
        # *text_2* updates
        if t >= 0.0 and text_2.status == NOT_STARTED:
            # keep track of start time/frame for later
            text_2.tStart = t  # not accounting for scr refresh
            text_2.frameNStart = frameN  # exact frame index
            win.timeOnFlip(text_2, 'tStartRefresh')  # time at next scr refresh
            text_2.setAutoDraw(True)
        frameRemains = 0.0 + 2.0- win.monitorFramePeriod * 0.75  # most of one frame period left
        if text_2.status == STARTED and t >= frameRemains:
            # keep track of stop time/frame for later
            text_2.tStop = t  # not accounting for scr refresh
            text_2.frameNStop = frameN  # exact frame index
            win.timeOnFlip(text_2, 'tStopRefresh')  # time at next scr refresh
            text_2.setAutoDraw(False)
        
Eleonore 's avatar
1  
Eleonore committed
677
        # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
678
        if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702
            core.quit()
        
        # 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 beispiel_blockComponents:
            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 "beispiel_block"-------
    for thisComponent in beispiel_blockComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    trials_2.addData('text_Bspw.started', text_Bspw.tStartRefresh)
    trials_2.addData('text_Bspw.stopped', text_Bspw.tStopRefresh)
    # check responses
    if key_resp_Bspw.keys in ['', [], None]:  # No response was made
        key_resp_Bspw.keys = None
Eleonore 's avatar
5  
Eleonore committed
703 704 705 706 707 708
        # was no response the correct answer?!
        if str(correctKey).lower() == 'none':
           key_resp_Bspw.corr = 1;  # correct non-response
        else:
           key_resp_Bspw.corr = 0;  # failed to respond (incorrectly)
    # store data for trials_2 (TrialHandler)
Eleonore 's avatar
1  
Eleonore committed
709
    trials_2.addData('key_resp_Bspw.keys',key_resp_Bspw.keys)
Eleonore 's avatar
5  
Eleonore committed
710
    trials_2.addData('key_resp_Bspw.corr', key_resp_Bspw.corr)
Eleonore 's avatar
1  
Eleonore committed
711 712 713 714 715 716 717 718 719 720
    if key_resp_Bspw.keys != None:  # we had a response
        trials_2.addData('key_resp_Bspw.rt', key_resp_Bspw.rt)
    trials_2.addData('key_resp_Bspw.started', key_resp_Bspw.tStartRefresh)
    trials_2.addData('key_resp_Bspw.stopped', key_resp_Bspw.tStopRefresh)
    trials_2.addData('Angabe_bsp_j.started', Angabe_bsp_j.tStartRefresh)
    trials_2.addData('Angabe_bsp_j.stopped', Angabe_bsp_j.tStopRefresh)
    trials_2.addData('Angabe_bsp_n.started', Angabe_bsp_n.tStartRefresh)
    trials_2.addData('Angabe_bsp_n.stopped', Angabe_bsp_n.tStopRefresh)
    trials_2.addData('test_text.started', test_text.tStartRefresh)
    trials_2.addData('test_text.stopped', test_text.tStopRefresh)
Eleonore 's avatar
_  
Eleonore committed
721 722
    trials_2.addData('text_2.started', text_2.tStartRefresh)
    trials_2.addData('text_2.stopped', text_2.tStopRefresh)
Eleonore 's avatar
1  
Eleonore committed
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785
    # the Routine "beispiel_block" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset()
    thisExp.nextEntry()
    
# completed 1 repeats of 'trials_2'


# ------Prepare to start Routine "beispiel_ende"-------
t = 0
beispiel_endeClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp_bsp_text = keyboard.Keyboard()
# keep track of which components have finished
beispiel_endeComponents = [beispiel_text, key_resp_bsp_text]
for thisComponent in beispiel_endeComponents:
    thisComponent.tStart = None
    thisComponent.tStop = None
    thisComponent.tStartRefresh = None
    thisComponent.tStopRefresh = None
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "beispiel_ende"-------
while continueRoutine:
    # get current time
    t = beispiel_endeClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *beispiel_text* updates
    if t >= 0.0 and beispiel_text.status == NOT_STARTED:
        # keep track of start time/frame for later
        beispiel_text.tStart = t  # not accounting for scr refresh
        beispiel_text.frameNStart = frameN  # exact frame index
        win.timeOnFlip(beispiel_text, 'tStartRefresh')  # time at next scr refresh
        beispiel_text.setAutoDraw(True)
    
    # *key_resp_bsp_text* updates
    if t >= 0.0 and key_resp_bsp_text.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp_bsp_text.tStart = t  # not accounting for scr refresh
        key_resp_bsp_text.frameNStart = frameN  # exact frame index
        win.timeOnFlip(key_resp_bsp_text, 'tStartRefresh')  # time at next scr refresh
        key_resp_bsp_text.status = STARTED
        # keyboard checking is just starting
        win.callOnFlip(key_resp_bsp_text.clock.reset)  # t=0 on next screen flip
        key_resp_bsp_text.clearEvents(eventType='keyboard')
    if key_resp_bsp_text.status == STARTED:
        theseKeys = key_resp_bsp_text.getKeys(keyList=['space'], waitRelease=False)
        if len(theseKeys):
            theseKeys = theseKeys[0]  # at least one key was pressed
            
            # check for quit:
            if "escape" == theseKeys:
                endExpNow = True
            key_resp_bsp_text.keys = theseKeys.name  # just the last key pressed
            key_resp_bsp_text.rt = theseKeys.rt
            # a response ends the routine
            continueRoutine = False
    
    # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
786
    if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
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
        core.quit()
    
    # 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 beispiel_endeComponents:
        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 "beispiel_ende"-------
for thisComponent in beispiel_endeComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
thisExp.addData('beispiel_text.started', beispiel_text.tStartRefresh)
thisExp.addData('beispiel_text.stopped', beispiel_text.tStopRefresh)
# check responses
if key_resp_bsp_text.keys in ['', [], None]:  # No response was made
    key_resp_bsp_text.keys = None
thisExp.addData('key_resp_bsp_text.keys',key_resp_bsp_text.keys)
if key_resp_bsp_text.keys != None:  # we had a response
    thisExp.addData('key_resp_bsp_text.rt', key_resp_bsp_text.rt)
thisExp.addData('key_resp_bsp_text.started', key_resp_bsp_text.tStartRefresh)
thisExp.addData('key_resp_bsp_text.stopped', key_resp_bsp_text.tStopRefresh)
thisExp.nextEntry()
# the Routine "beispiel_ende" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

# set up handler to look after randomisation of conditions etc
test = data.TrialHandler(nReps=1, method='sequential', 
    extraInfo=expInfo, originPath=-1,
Eleonore 's avatar
5  
Eleonore committed
823
    trialList=data.importConditions('Test.xlsx'),
Eleonore 's avatar
1  
Eleonore committed
824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847
    seed=None, name='test')
thisExp.addLoop(test)  # add the loop to the experiment
thisTest = test.trialList[0]  # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb = thisTest.rgb)
if thisTest != None:
    for paramName in thisTest:
        exec('{} = thisTest[paramName]'.format(paramName))

for thisTest in test:
    currentLoop = test
    # abbreviate parameter names if possible (e.g. rgb = thisTest.rgb)
    if thisTest != None:
        for paramName in thisTest:
            exec('{} = thisTest[paramName]'.format(paramName))
    
    # ------Prepare to start Routine "test_block"-------
    t = 0
    test_blockClock.reset()  # clock
    frameN = -1
    continueRoutine = True
    # update component parameters for each repeat
    Angabe_test.setText(Stimulus)
    key_resp_test = keyboard.Keyboard()
    # keep track of which components have finished
Eleonore 's avatar
_  
Eleonore committed
848
    test_blockComponents = [Angabe_test, key_resp_test, Angabe_test_j, Angabe_test_n, text_3]
Eleonore 's avatar
1  
Eleonore committed
849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864
    for thisComponent in test_blockComponents:
        thisComponent.tStart = None
        thisComponent.tStop = None
        thisComponent.tStartRefresh = None
        thisComponent.tStopRefresh = None
        if hasattr(thisComponent, 'status'):
            thisComponent.status = NOT_STARTED
    
    # -------Start Routine "test_block"-------
    while continueRoutine:
        # get current time
        t = test_blockClock.getTime()
        frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
        # update/draw components on each frame
        
        # *Angabe_test* updates
Eleonore 's avatar
_  
Eleonore committed
865
        if t >= 2 and Angabe_test.status == NOT_STARTED:
Eleonore 's avatar
1  
Eleonore committed
866 867 868 869 870 871 872
            # keep track of start time/frame for later
            Angabe_test.tStart = t  # not accounting for scr refresh
            Angabe_test.frameNStart = frameN  # exact frame index
            win.timeOnFlip(Angabe_test, 'tStartRefresh')  # time at next scr refresh
            Angabe_test.setAutoDraw(True)
        
        # *key_resp_test* updates
Eleonore 's avatar
_  
Eleonore committed
873
        if t >= 2 and key_resp_test.status == NOT_STARTED:
Eleonore 's avatar
1  
Eleonore committed
874 875 876 877 878 879 880 881 882
            # keep track of start time/frame for later
            key_resp_test.tStart = t  # not accounting for scr refresh
            key_resp_test.frameNStart = frameN  # exact frame index
            win.timeOnFlip(key_resp_test, 'tStartRefresh')  # time at next scr refresh
            key_resp_test.status = STARTED
            # keyboard checking is just starting
            win.callOnFlip(key_resp_test.clock.reset)  # t=0 on next screen flip
            key_resp_test.clearEvents(eventType='keyboard')
        if key_resp_test.status == STARTED:
Eleonore 's avatar
5  
Eleonore committed
883
            theseKeys = key_resp_test.getKeys(keyList=['f', 'j'], waitRelease=False)
Eleonore 's avatar
1  
Eleonore committed
884 885 886 887 888 889 890 891
            if len(theseKeys):
                theseKeys = theseKeys[0]  # at least one key was pressed
                
                # check for quit:
                if "escape" == theseKeys:
                    endExpNow = True
                key_resp_test.keys = theseKeys.name  # just the last key pressed
                key_resp_test.rt = theseKeys.rt
Eleonore 's avatar
5  
Eleonore committed
892 893 894 895 896
                # was this 'correct'?
                if (key_resp_test.keys == str(correctKey)) or (key_resp_test.keys == correctKey):
                    key_resp_test.corr = 1
                else:
                    key_resp_test.corr = 0
Eleonore 's avatar
1  
Eleonore committed
897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915
                # a response ends the routine
                continueRoutine = False
        
        # *Angabe_test_j* updates
        if t >= 0.0 and Angabe_test_j.status == NOT_STARTED:
            # keep track of start time/frame for later
            Angabe_test_j.tStart = t  # not accounting for scr refresh
            Angabe_test_j.frameNStart = frameN  # exact frame index
            win.timeOnFlip(Angabe_test_j, 'tStartRefresh')  # time at next scr refresh
            Angabe_test_j.setAutoDraw(True)
        
        # *Angabe_test_n* updates
        if t >= 0.0 and Angabe_test_n.status == NOT_STARTED:
            # keep track of start time/frame for later
            Angabe_test_n.tStart = t  # not accounting for scr refresh
            Angabe_test_n.frameNStart = frameN  # exact frame index
            win.timeOnFlip(Angabe_test_n, 'tStartRefresh')  # time at next scr refresh
            Angabe_test_n.setAutoDraw(True)
        
Eleonore 's avatar
_  
Eleonore committed
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930
        # *text_3* updates
        if t >= 0.0 and text_3.status == NOT_STARTED:
            # keep track of start time/frame for later
            text_3.tStart = t  # not accounting for scr refresh
            text_3.frameNStart = frameN  # exact frame index
            win.timeOnFlip(text_3, 'tStartRefresh')  # time at next scr refresh
            text_3.setAutoDraw(True)
        frameRemains = 0.0 + 2- win.monitorFramePeriod * 0.75  # most of one frame period left
        if text_3.status == STARTED and t >= frameRemains:
            # keep track of stop time/frame for later
            text_3.tStop = t  # not accounting for scr refresh
            text_3.frameNStop = frameN  # exact frame index
            win.timeOnFlip(text_3, 'tStopRefresh')  # time at next scr refresh
            text_3.setAutoDraw(False)
        
Eleonore 's avatar
1  
Eleonore committed
931
        # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
932
        if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956
            core.quit()
        
        # 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_blockComponents:
            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_block"-------
    for thisComponent in test_blockComponents:
        if hasattr(thisComponent, "setAutoDraw"):
            thisComponent.setAutoDraw(False)
    test.addData('Angabe_test.started', Angabe_test.tStartRefresh)
    test.addData('Angabe_test.stopped', Angabe_test.tStopRefresh)
    # check responses
    if key_resp_test.keys in ['', [], None]:  # No response was made
        key_resp_test.keys = None
Eleonore 's avatar
5  
Eleonore committed
957 958 959 960 961 962
        # was no response the correct answer?!
        if str(correctKey).lower() == 'none':
           key_resp_test.corr = 1;  # correct non-response
        else:
           key_resp_test.corr = 0;  # failed to respond (incorrectly)
    # store data for test (TrialHandler)
Eleonore 's avatar
1  
Eleonore committed
963
    test.addData('key_resp_test.keys',key_resp_test.keys)
Eleonore 's avatar
5  
Eleonore committed
964
    test.addData('key_resp_test.corr', key_resp_test.corr)
Eleonore 's avatar
1  
Eleonore committed
965 966 967 968 969 970 971 972
    if key_resp_test.keys != None:  # we had a response
        test.addData('key_resp_test.rt', key_resp_test.rt)
    test.addData('key_resp_test.started', key_resp_test.tStartRefresh)
    test.addData('key_resp_test.stopped', key_resp_test.tStopRefresh)
    test.addData('Angabe_test_j.started', Angabe_test_j.tStartRefresh)
    test.addData('Angabe_test_j.stopped', Angabe_test_j.tStopRefresh)
    test.addData('Angabe_test_n.started', Angabe_test_n.tStartRefresh)
    test.addData('Angabe_test_n.stopped', Angabe_test_n.tStopRefresh)
Eleonore 's avatar
_  
Eleonore committed
973 974
    test.addData('text_3.started', text_3.tStartRefresh)
    test.addData('text_3.stopped', text_3.tStopRefresh)
Eleonore 's avatar
1  
Eleonore committed
975 976 977 978 979 980 981 982 983 984
    # the Routine "test_block" was not non-slip safe, so reset the non-slip timer
    routineTimer.reset()
    thisExp.nextEntry()
    
# completed 1 repeats of 'test'


# set up handler to look after randomisation of conditions etc
blocks = data.TrialHandler(nReps=1, method='random', 
    extraInfo=expInfo, originPath=-1,
Eleonore 's avatar
5  
Eleonore committed
985
    trialList=data.importConditions('choosefile.xlsx'),
Eleonore 's avatar
1  
Eleonore committed
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028
    seed=None, name='blocks')
thisExp.addLoop(blocks)  # add the loop to the experiment
thisBlock = blocks.trialList[0]  # so we can initialise stimuli with some values
# abbreviate parameter names if possible (e.g. rgb = thisBlock.rgb)
if thisBlock != None:
    for paramName in thisBlock:
        exec('{} = thisBlock[paramName]'.format(paramName))

for thisBlock in blocks:
    currentLoop = blocks
    # abbreviate parameter names if possible (e.g. rgb = thisBlock.rgb)
    if thisBlock != None:
        for paramName in thisBlock:
            exec('{} = thisBlock[paramName]'.format(paramName))
    
    # set up handler to look after randomisation of conditions etc
    trials = data.TrialHandler(nReps=1, method='sequential', 
        extraInfo=expInfo, originPath=-1,
        trialList=data.importConditions(condsFile),
        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 "trial"-------
        t = 0
        trialClock.reset()  # clock
        frameN = -1
        continueRoutine = True
        # update component parameters for each repeat
        Angabe.setText(Stimulus)
        key_resp_Ang = keyboard.Keyboard()
        # keep track of which components have finished
Eleonore 's avatar
_  
Eleonore committed
1029
        trialComponents = [Angabe, key_resp_Ang, Angabe_y, Angabe_n, text_4]
Eleonore 's avatar
1  
Eleonore committed
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045
        for thisComponent in trialComponents:
            thisComponent.tStart = None
            thisComponent.tStop = None
            thisComponent.tStartRefresh = None
            thisComponent.tStopRefresh = None
            if hasattr(thisComponent, 'status'):
                thisComponent.status = NOT_STARTED
        
        # -------Start Routine "trial"-------
        while continueRoutine:
            # get current time
            t = trialClock.getTime()
            frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
            # update/draw components on each frame
            
            # *Angabe* updates
Eleonore 's avatar
_  
Eleonore committed
1046
            if t >= 2 and Angabe.status == NOT_STARTED:
Eleonore 's avatar
1  
Eleonore committed
1047 1048 1049 1050 1051 1052 1053
                # keep track of start time/frame for later
                Angabe.tStart = t  # not accounting for scr refresh
                Angabe.frameNStart = frameN  # exact frame index
                win.timeOnFlip(Angabe, 'tStartRefresh')  # time at next scr refresh
                Angabe.setAutoDraw(True)
            
            # *key_resp_Ang* updates
Eleonore 's avatar
_  
Eleonore committed
1054
            if t >= 2 and key_resp_Ang.status == NOT_STARTED:
Eleonore 's avatar
1  
Eleonore committed
1055 1056 1057 1058 1059 1060 1061 1062 1063
                # keep track of start time/frame for later
                key_resp_Ang.tStart = t  # not accounting for scr refresh
                key_resp_Ang.frameNStart = frameN  # exact frame index
                win.timeOnFlip(key_resp_Ang, 'tStartRefresh')  # time at next scr refresh
                key_resp_Ang.status = STARTED
                # keyboard checking is just starting
                win.callOnFlip(key_resp_Ang.clock.reset)  # t=0 on next screen flip
                key_resp_Ang.clearEvents(eventType='keyboard')
            if key_resp_Ang.status == STARTED:
Eleonore 's avatar
5  
Eleonore committed
1064
                theseKeys = key_resp_Ang.getKeys(keyList=['f', 'j'], waitRelease=False)
Eleonore 's avatar
1  
Eleonore committed
1065 1066 1067 1068 1069 1070 1071 1072
                if len(theseKeys):
                    theseKeys = theseKeys[0]  # at least one key was pressed
                    
                    # check for quit:
                    if "escape" == theseKeys:
                        endExpNow = True
                    key_resp_Ang.keys = theseKeys.name  # just the last key pressed
                    key_resp_Ang.rt = theseKeys.rt
Eleonore 's avatar
5  
Eleonore committed
1073 1074 1075 1076 1077
                    # was this 'correct'?
                    if (key_resp_Ang.keys == str(correctKey)) or (key_resp_Ang.keys == correctKey):
                        key_resp_Ang.corr = 1
                    else:
                        key_resp_Ang.corr = 0
Eleonore 's avatar
1  
Eleonore committed
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096
                    # a response ends the routine
                    continueRoutine = False
            
            # *Angabe_y* updates
            if t >= 0.0 and Angabe_y.status == NOT_STARTED:
                # keep track of start time/frame for later
                Angabe_y.tStart = t  # not accounting for scr refresh
                Angabe_y.frameNStart = frameN  # exact frame index
                win.timeOnFlip(Angabe_y, 'tStartRefresh')  # time at next scr refresh
                Angabe_y.setAutoDraw(True)
            
            # *Angabe_n* updates
            if t >= 0.0 and Angabe_n.status == NOT_STARTED:
                # keep track of start time/frame for later
                Angabe_n.tStart = t  # not accounting for scr refresh
                Angabe_n.frameNStart = frameN  # exact frame index
                win.timeOnFlip(Angabe_n, 'tStartRefresh')  # time at next scr refresh
                Angabe_n.setAutoDraw(True)
            
Eleonore 's avatar
_  
Eleonore committed
1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111
            # *text_4* updates
            if t >= 0.0 and text_4.status == NOT_STARTED:
                # keep track of start time/frame for later
                text_4.tStart = t  # not accounting for scr refresh
                text_4.frameNStart = frameN  # exact frame index
                win.timeOnFlip(text_4, 'tStartRefresh')  # time at next scr refresh
                text_4.setAutoDraw(True)
            frameRemains = 0.0 + 2- win.monitorFramePeriod * 0.75  # most of one frame period left
            if text_4.status == STARTED and t >= frameRemains:
                # keep track of stop time/frame for later
                text_4.tStop = t  # not accounting for scr refresh
                text_4.frameNStop = frameN  # exact frame index
                win.timeOnFlip(text_4, 'tStopRefresh')  # time at next scr refresh
                text_4.setAutoDraw(False)
            
Eleonore 's avatar
1  
Eleonore committed
1112
            # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
1113
            if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137
                core.quit()
            
            # check if all components have finished
            if not continueRoutine:  # a component has requested a forced-end of Routine
                break
            continueRoutine = False  # will revert to True if at least one component still running
            for thisComponent in trialComponents:
                if hasattr(thisComponent, "status") and thisComponent.status != FINISHED:
                    continueRoutine = True
                    break  # at least one component has not yet finished
            
            # 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)
        trials.addData('Angabe.started', Angabe.tStartRefresh)
        trials.addData('Angabe.stopped', Angabe.tStopRefresh)
        # check responses
        if key_resp_Ang.keys in ['', [], None]:  # No response was made
            key_resp_Ang.keys = None
Eleonore 's avatar
5  
Eleonore committed
1138 1139 1140 1141 1142 1143
            # was no response the correct answer?!
            if str(correctKey).lower() == 'none':
               key_resp_Ang.corr = 1;  # correct non-response
            else:
               key_resp_Ang.corr = 0;  # failed to respond (incorrectly)
        # store data for trials (TrialHandler)
Eleonore 's avatar
1  
Eleonore committed
1144
        trials.addData('key_resp_Ang.keys',key_resp_Ang.keys)
Eleonore 's avatar
5  
Eleonore committed
1145
        trials.addData('key_resp_Ang.corr', key_resp_Ang.corr)
Eleonore 's avatar
1  
Eleonore committed
1146 1147 1148 1149 1150 1151 1152 1153
        if key_resp_Ang.keys != None:  # we had a response
            trials.addData('key_resp_Ang.rt', key_resp_Ang.rt)
        trials.addData('key_resp_Ang.started', key_resp_Ang.tStartRefresh)
        trials.addData('key_resp_Ang.stopped', key_resp_Ang.tStopRefresh)
        trials.addData('Angabe_y.started', Angabe_y.tStartRefresh)
        trials.addData('Angabe_y.stopped', Angabe_y.tStopRefresh)
        trials.addData('Angabe_n.started', Angabe_n.tStartRefresh)
        trials.addData('Angabe_n.stopped', Angabe_n.tStopRefresh)
Eleonore 's avatar
_  
Eleonore committed
1154 1155
        trials.addData('text_4.started', text_4.tStartRefresh)
        trials.addData('text_4.stopped', text_4.tStopRefresh)
Eleonore 's avatar
1  
Eleonore committed
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
        # the Routine "trial" was not non-slip safe, so reset the non-slip timer
        routineTimer.reset()
        thisExp.nextEntry()
        
    # completed 1 repeats of 'trials'
    
    thisExp.nextEntry()
    
# completed 1 repeats of 'blocks'


# ------Prepare to start Routine "fragen_anfang"-------
t = 0
fragen_anfangClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp = keyboard.Keyboard()
# keep track of which components have finished
fragen_anfangComponents = [text, key_resp]
for thisComponent in fragen_anfangComponents:
    thisComponent.tStart = None
    thisComponent.tStop = None
    thisComponent.tStartRefresh = None
    thisComponent.tStopRefresh = None
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "fragen_anfang"-------
while continueRoutine:
    # get current time
    t = fragen_anfangClock.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  # not accounting for scr refresh
        text.frameNStart = frameN  # exact frame index
        win.timeOnFlip(text, 'tStartRefresh')  # time at next scr refresh
        text.setAutoDraw(True)
    
    # *key_resp* updates
    if t >= 0.0 and key_resp.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp.tStart = t  # not accounting for scr refresh
        key_resp.frameNStart = frameN  # exact frame index
        win.timeOnFlip(key_resp, 'tStartRefresh')  # time at next scr refresh
        key_resp.status = STARTED
        # keyboard checking is just starting
        win.callOnFlip(key_resp.clock.reset)  # t=0 on next screen flip
        key_resp.clearEvents(eventType='keyboard')
    if key_resp.status == STARTED:
        theseKeys = key_resp.getKeys(keyList=['space'], waitRelease=False)
        if len(theseKeys):
            theseKeys = theseKeys[0]  # at least one key was pressed
            
            # check for quit:
            if "escape" == theseKeys:
                endExpNow = True
            key_resp.keys = theseKeys.name  # just the last key pressed
            key_resp.rt = theseKeys.rt
            # a response ends the routine
            continueRoutine = False
    
    # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
1223
    if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
1224 1225 1226 1227 1228 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
        core.quit()
    
    # 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 fragen_anfangComponents:
        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 "fragen_anfang"-------
for thisComponent in fragen_anfangComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
thisExp.addData('text.started', text.tStartRefresh)
thisExp.addData('text.stopped', text.tStopRefresh)
# check responses
if key_resp.keys in ['', [], None]:  # No response was made
    key_resp.keys = None
thisExp.addData('key_resp.keys',key_resp.keys)
if key_resp.keys != None:  # we had a response
    thisExp.addData('key_resp.rt', key_resp.rt)
thisExp.addData('key_resp.started', key_resp.tStartRefresh)
thisExp.addData('key_resp.stopped', key_resp.tStopRefresh)
thisExp.nextEntry()
# the Routine "fragen_anfang" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

# ------Prepare to start Routine "fragen1"-------
t = 0
fragen1Clock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
Eleonore 's avatar
5  
Eleonore committed
1263
konzentration.reset()
Eleonore 's avatar
1  
Eleonore committed
1264
# keep track of which components have finished
Eleonore 's avatar
5  
Eleonore committed
1265
fragen1Components = [konzentration, Konzentration]
Eleonore 's avatar
1  
Eleonore committed
1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279
for thisComponent in fragen1Components:
    thisComponent.tStart = None
    thisComponent.tStop = None
    thisComponent.tStartRefresh = None
    thisComponent.tStopRefresh = None
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "fragen1"-------
while continueRoutine:
    # get current time
    t = fragen1Clock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
Eleonore 's avatar
5  
Eleonore committed
1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292
    
    # *konzentration* updates
    if t >= 0.0 and konzentration.status == NOT_STARTED:
        # keep track of start time/frame for later
        konzentration.tStart = t  # not accounting for scr refresh
        konzentration.frameNStart = frameN  # exact frame index
        win.timeOnFlip(konzentration, 'tStartRefresh')  # time at next scr refresh
        konzentration.setAutoDraw(True)
    
    # Check konzentration for response to end routine
    if konzentration.getRating() is not None and konzentration.status == STARTED:
        continueRoutine = False
    
Eleonore 's avatar
1  
Eleonore committed
1293 1294 1295 1296 1297 1298 1299 1300 1301
    # *Konzentration* updates
    if t >= 0.0 and Konzentration.status == NOT_STARTED:
        # keep track of start time/frame for later
        Konzentration.tStart = t  # not accounting for scr refresh
        Konzentration.frameNStart = frameN  # exact frame index
        win.timeOnFlip(Konzentration, 'tStartRefresh')  # time at next scr refresh
        Konzentration.setAutoDraw(True)
    
    # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
1302
    if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321
        core.quit()
    
    # 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 fragen1Components:
        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 "fragen1"-------
for thisComponent in fragen1Components:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
Eleonore 's avatar
5  
Eleonore committed
1322 1323 1324 1325 1326 1327
thisExp.addData('konzentration.response', konzentration.getRating())
thisExp.addData('konzentration.rt', konzentration.getRT())
thisExp.addData('konzentration.started', konzentration.tStartRefresh)
thisExp.addData('konzentration.stopped', konzentration.tStopRefresh)
thisExp.addData('Konzentration.started', Konzentration.tStartRefresh)
thisExp.addData('Konzentration.stopped', Konzentration.tStopRefresh)
Eleonore 's avatar
1  
Eleonore committed
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
# the Routine "fragen1" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

# ------Prepare to start Routine "fragen2"-------
t = 0
fragen2Clock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
Ernsthaftigkeit.reset()
# keep track of which components have finished
Eleonore 's avatar
5  
Eleonore committed
1339
fragen2Components = [Ernsthaftigkeit, ernsthaftigkeit]
Eleonore 's avatar
1  
Eleonore committed
1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353
for thisComponent in fragen2Components:
    thisComponent.tStart = None
    thisComponent.tStop = None
    thisComponent.tStartRefresh = None
    thisComponent.tStopRefresh = None
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "fragen2"-------
while continueRoutine:
    # get current time
    t = fragen2Clock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
Eleonore 's avatar
5  
Eleonore committed
1354
    
Eleonore 's avatar
1  
Eleonore committed
1355 1356 1357 1358 1359 1360 1361
    # *Ernsthaftigkeit* updates
    if t >= 0.0 and Ernsthaftigkeit.status == NOT_STARTED:
        # keep track of start time/frame for later
        Ernsthaftigkeit.tStart = t  # not accounting for scr refresh
        Ernsthaftigkeit.frameNStart = frameN  # exact frame index
        win.timeOnFlip(Ernsthaftigkeit, 'tStartRefresh')  # time at next scr refresh
        Ernsthaftigkeit.setAutoDraw(True)
Eleonore 's avatar
5  
Eleonore committed
1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373
    
    # Check Ernsthaftigkeit for response to end routine
    if Ernsthaftigkeit.getRating() is not None and Ernsthaftigkeit.status == STARTED:
        continueRoutine = False
    
    # *ernsthaftigkeit* updates
    if t >= 0.0 and ernsthaftigkeit.status == NOT_STARTED:
        # keep track of start time/frame for later
        ernsthaftigkeit.tStart = t  # not accounting for scr refresh
        ernsthaftigkeit.frameNStart = frameN  # exact frame index
        win.timeOnFlip(ernsthaftigkeit, 'tStartRefresh')  # time at next scr refresh
        ernsthaftigkeit.setAutoDraw(True)
Eleonore 's avatar
1  
Eleonore committed
1374 1375
    
    # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
1376
    if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397
        core.quit()
    
    # 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 fragen2Components:
        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 "fragen2"-------
for thisComponent in fragen2Components:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
thisExp.addData('Ernsthaftigkeit.response', Ernsthaftigkeit.getRating())
thisExp.addData('Ernsthaftigkeit.rt', Ernsthaftigkeit.getRT())
Eleonore 's avatar
5  
Eleonore committed
1398 1399 1400 1401
thisExp.addData('Ernsthaftigkeit.started', Ernsthaftigkeit.tStartRefresh)
thisExp.addData('Ernsthaftigkeit.stopped', Ernsthaftigkeit.tStopRefresh)
thisExp.addData('ernsthaftigkeit.started', ernsthaftigkeit.tStartRefresh)
thisExp.addData('ernsthaftigkeit.stopped', ernsthaftigkeit.tStopRefresh)
Eleonore 's avatar
1  
Eleonore committed
1402 1403 1404 1405 1406 1407 1408 1409 1410
# the Routine "fragen2" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

# ------Prepare to start Routine "fragen3"-------
t = 0
fragen3Clock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
Eleonore 's avatar
5  
Eleonore committed
1411
Ruhe.reset()
Eleonore 's avatar
1  
Eleonore committed
1412
# keep track of which components have finished
Eleonore 's avatar
5  
Eleonore committed
1413
fragen3Components = [Ruhe, ruhe]
Eleonore 's avatar
1  
Eleonore committed
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427
for thisComponent in fragen3Components:
    thisComponent.tStart = None
    thisComponent.tStop = None
    thisComponent.tStartRefresh = None
    thisComponent.tStopRefresh = None
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "fragen3"-------
while continueRoutine:
    # get current time
    t = fragen3Clock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
Eleonore 's avatar
5  
Eleonore committed
1428 1429 1430
    
    # *Ruhe* updates
    if t >= 0.0 and Ruhe.status == NOT_STARTED:
Eleonore 's avatar
1  
Eleonore committed
1431
        # keep track of start time/frame for later
Eleonore 's avatar
5  
Eleonore committed
1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447
        Ruhe.tStart = t  # not accounting for scr refresh
        Ruhe.frameNStart = frameN  # exact frame index
        win.timeOnFlip(Ruhe, 'tStartRefresh')  # time at next scr refresh
        Ruhe.setAutoDraw(True)
    
    # Check Ruhe for response to end routine
    if Ruhe.getRating() is not None and Ruhe.status == STARTED:
        continueRoutine = False
    
    # *ruhe* updates
    if t >= 0.0 and ruhe.status == NOT_STARTED:
        # keep track of start time/frame for later
        ruhe.tStart = t  # not accounting for scr refresh
        ruhe.frameNStart = frameN  # exact frame index
        win.timeOnFlip(ruhe, 'tStartRefresh')  # time at next scr refresh
        ruhe.setAutoDraw(True)
Eleonore 's avatar
1  
Eleonore committed
1448 1449
    
    # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
1450
    if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469
        core.quit()
    
    # 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 fragen3Components:
        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 "fragen3"-------
for thisComponent in fragen3Components:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
Eleonore 's avatar
5  
Eleonore committed
1470 1471 1472 1473 1474 1475
thisExp.addData('Ruhe.response', Ruhe.getRating())
thisExp.addData('Ruhe.rt', Ruhe.getRT())
thisExp.addData('Ruhe.started', Ruhe.tStartRefresh)
thisExp.addData('Ruhe.stopped', Ruhe.tStopRefresh)
thisExp.addData('ruhe.started', ruhe.tStartRefresh)
thisExp.addData('ruhe.stopped', ruhe.tStopRefresh)
Eleonore 's avatar
1  
Eleonore committed
1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534
# the Routine "fragen3" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

# ------Prepare to start Routine "ende"-------
t = 0
endeClock.reset()  # clock
frameN = -1
continueRoutine = True
# update component parameters for each repeat
key_resp_ende = keyboard.Keyboard()
# keep track of which components have finished
endeComponents = [ende_text, key_resp_ende]
for thisComponent in endeComponents:
    thisComponent.tStart = None
    thisComponent.tStop = None
    thisComponent.tStartRefresh = None
    thisComponent.tStopRefresh = None
    if hasattr(thisComponent, 'status'):
        thisComponent.status = NOT_STARTED

# -------Start Routine "ende"-------
while continueRoutine:
    # get current time
    t = endeClock.getTime()
    frameN = frameN + 1  # number of completed frames (so 0 is the first frame)
    # update/draw components on each frame
    
    # *ende_text* updates
    if t >= 0.0 and ende_text.status == NOT_STARTED:
        # keep track of start time/frame for later
        ende_text.tStart = t  # not accounting for scr refresh
        ende_text.frameNStart = frameN  # exact frame index
        win.timeOnFlip(ende_text, 'tStartRefresh')  # time at next scr refresh
        ende_text.setAutoDraw(True)
    
    # *key_resp_ende* updates
    if t >= 0.0 and key_resp_ende.status == NOT_STARTED:
        # keep track of start time/frame for later
        key_resp_ende.tStart = t  # not accounting for scr refresh
        key_resp_ende.frameNStart = frameN  # exact frame index
        win.timeOnFlip(key_resp_ende, 'tStartRefresh')  # time at next scr refresh
        key_resp_ende.status = STARTED
        # keyboard checking is just starting
        win.callOnFlip(key_resp_ende.clock.reset)  # t=0 on next screen flip
        key_resp_ende.clearEvents(eventType='keyboard')
    if key_resp_ende.status == STARTED:
        theseKeys = key_resp_ende.getKeys(keyList=['space'], waitRelease=False)
        if len(theseKeys):
            theseKeys = theseKeys[0]  # at least one key was pressed
            
            # check for quit:
            if "escape" == theseKeys:
                endExpNow = True
            key_resp_ende.keys = theseKeys.name  # just the last key pressed
            key_resp_ende.rt = theseKeys.rt
            # a response ends the routine
            continueRoutine = False
    
    # check for quit (typically the Esc key)
Eleonore 's avatar
_  
Eleonore committed
1535
    if endExpNow or keyboard.Keyboard().getKeys(keyList=["escape"]):
Eleonore 's avatar
1  
Eleonore committed
1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580
        core.quit()
    
    # 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 endeComponents:
        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 "ende"-------
for thisComponent in endeComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
thisExp.addData('ende_text.started', ende_text.tStartRefresh)
thisExp.addData('ende_text.stopped', ende_text.tStopRefresh)
# check responses
if key_resp_ende.keys in ['', [], None]:  # No response was made
    key_resp_ende.keys = None
thisExp.addData('key_resp_ende.keys',key_resp_ende.keys)
if key_resp_ende.keys != None:  # we had a response
    thisExp.addData('key_resp_ende.rt', key_resp_ende.rt)
thisExp.addData('key_resp_ende.started', key_resp_ende.tStartRefresh)
thisExp.addData('key_resp_ende.stopped', key_resp_ende.tStopRefresh)
thisExp.nextEntry()
# the Routine "ende" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()

# Flip one final time so any remaining win.callOnFlip() 
# and win.timeOnFlip() tasks get executed before quitting
win.flip()

# 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()