#!/usr/bin/env python # -*- coding: utf-8 -*- """ This experiment was created using PsychoPy3 Experiment Builder (v2020.1.2), on Thu May 14 18:17:50 2020 If you publish work using this script the most relevant publication is: Peirce J, Gray JR, Simpson S, MacAskill M, Höchenberger R, Sogo H, Kastman E, Lindeløv JK. (2019) PsychoPy2: Experiments in behavior made easy Behav Res 51: 195. https://doi.org/10.3758/s13428-018-01193-y """ from __future__ import absolute_import, division from psychopy import locale_setup from psychopy import prefs from psychopy import 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 psychopyVersion = '2020.1.2' expName = 'HoMer00baocun' # from the Builder filename that created this script expInfo = {'participant': '', 'session': '001'} 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 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='/Users/athens/Desktop/Homer00_PSB/HoMER00PSB_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 frameTolerance = 0.001 # how close to onset before 'same' frame # Start Code - component code to be run before the window creation # Setup the Window win = visual.Window( size=[1536, 864], fullscr=True, screen=0, winType='pyglet', allowGUI=False, allowStencil=False, monitor='testMonitor', color=[0.976,0.976,0.976], 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 # create a default keyboard (e.g. to check for escape) defaultKeyboard = keyboard.Keyboard() # Initialize components for Routine "Willkommen0" Willkommen0Clock = core.Clock() image_ein = visual.ImageStim( win=win, name='image_ein', image='images/einfuhrung/einfuhrungsfolie0.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=0.0) key_resp_2 = keyboard.Keyboard() # Initialize components for Routine "Willkommen1" Willkommen1Clock = core.Clock() image_7 = visual.ImageStim( win=win, name='image_7', image='images/einfuhrung/einfuhrungsfolie1.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=0.0) key_resp_11 = keyboard.Keyboard() # Initialize components for Routine "pre_ein" pre_einClock = core.Clock() key_resp_4 = keyboard.Keyboard() image = visual.ImageStim( win=win, name='image', image='images/vortest/pre0.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "Pre" PreClock = core.Clock() image_pre = visual.ImageStim( win=win, name='image_pre', image='sin', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=0.0) screenText = visual.TextStim(win=win, name='screenText', text=None, font='Times', pos=(-0.2, -0.25), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); cornerText = visual.TextStim(win=win, name='cornerText', text=None, font='Times New Roman', pos=(-0.5, -0.3), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); allLetters = ["a","b","c","d","e","f","g","h","i","g","k","l","m","n","o","p","q","r","s","t","u","v","w","x","z","y","ö","ä","ß","ü"] shift_flag = False key_resp = keyboard.Keyboard() # Initialize components for Routine "pre2_Ein" pre2_EinClock = core.Clock() key_resp_7 = keyboard.Keyboard() image_3 = visual.ImageStim( win=win, name='image_3', image='images/vortest/pre4.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "Pre" PreClock = core.Clock() image_pre = visual.ImageStim( win=win, name='image_pre', image='sin', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=0.0) screenText = visual.TextStim(win=win, name='screenText', text=None, font='Times', pos=(-0.2, -0.25), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); cornerText = visual.TextStim(win=win, name='cornerText', text=None, font='Times New Roman', pos=(-0.5, -0.3), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); allLetters = ["a","b","c","d","e","f","g","h","i","g","k","l","m","n","o","p","q","r","s","t","u","v","w","x","z","y","ö","ä","ß","ü"] shift_flag = False key_resp = keyboard.Keyboard() # Initialize components for Routine "Pause1" Pause1Clock = core.Clock() key_resp_8 = keyboard.Keyboard() image_4 = visual.ImageStim( win=win, name='image_4', image='images/problem_solving/ps0.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "ps_Ein" ps_EinClock = core.Clock() key_resp_10 = keyboard.Keyboard() image_6 = visual.ImageStim( win=win, name='image_6', image='images/problem_solving/ps1.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "ps_ein1" ps_ein1Clock = core.Clock() key_resp_22 = keyboard.Keyboard() image_18 = visual.ImageStim( win=win, name='image_18', image='images/problem_solving/ps2.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "PS" PSClock = core.Clock() image_ps = visual.ImageStim( win=win, name='image_ps', image='sin', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=0.0) key_resp_3 = keyboard.Keyboard() # Initialize components for Routine "ps8" ps8Clock = core.Clock() key_resp_14 = keyboard.Keyboard() image_9 = visual.ImageStim( win=win, name='image_9', image='images/problem_solving/ps8.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) screenText3 = visual.TextStim(win=win, name='screenText3', text=None, font='Times New Roman', pos=(0.15, -0.2), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); cornerText3 = visual.TextStim(win=win, name='cornerText3', text=None, font='Times New Roman', pos=(-0.5, -0.3), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); # Initialize components for Routine "ps9" ps9Clock = core.Clock() key_resp_12 = keyboard.Keyboard() image_8 = visual.ImageStim( win=win, name='image_8', image='images/problem_solving/ps9.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "ps10" ps10Clock = core.Clock() key_resp_13 = keyboard.Keyboard() image_10 = visual.ImageStim( win=win, name='image_10', image='images/problem_solving/ps10.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) screenText4 = visual.TextStim(win=win, name='screenText4', text=None, font='Times New Roman', pos=(0.15, -0.2), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); cornerText4 = visual.TextStim(win=win, name='cornerText4', text=None, font='Times New Roman', pos=(-0.5, -0.3), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); # Initialize components for Routine "Pause2" Pause2Clock = core.Clock() key_resp_15 = keyboard.Keyboard() image_11 = visual.ImageStim( win=win, name='image_11', image='images/problem_solving/ps0.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "post_Ein" post_EinClock = core.Clock() key_resp_9 = keyboard.Keyboard() image_5 = visual.ImageStim( win=win, name='image_5', image='images/ein_posttest/ein_post.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "Post" PostClock = core.Clock() image_post = visual.ImageStim( win=win, name='image_post', image='sin', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=0.0) key_resp_5 = keyboard.Keyboard() screenText2 = visual.TextStim(win=win, name='screenText2', text=None, font='Times New Roman', pos=(0.2, -0.1), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); cornerText2 = visual.TextStim(win=win, name='cornerText2', text=None, font='Times New Roman', pos=(-0.5, -0.3), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); # Initialize components for Routine "Post15" Post15Clock = core.Clock() key_resp_16 = keyboard.Keyboard() image_12 = visual.ImageStim( win=win, name='image_12', image='images/posttest_paralleltestb/post15.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "POST16" POST16Clock = core.Clock() image_20 = visual.ImageStim( win=win, name='image_20', image='images/posttest_paralleltestb/post15.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=0.0) key_resp_24 = keyboard.Keyboard() # Initialize components for Routine "POST17" POST17Clock = core.Clock() key_resp_23 = keyboard.Keyboard() image_19 = visual.ImageStim( win=win, name='image_19', image='images/posttest_paralleltestb/post17.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "Post18" Post18Clock = core.Clock() key_resp_17 = keyboard.Keyboard() image_13 = visual.ImageStim( win=win, name='image_13', image='images/posttest_paralleltestb/post18.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) screenText5 = visual.TextStim(win=win, name='screenText5', text=None, font='Times New Roman', pos=(0.1, -0.1), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); cornerText5 = visual.TextStim(win=win, name='cornerText5', text=None, font='Times New Roman', pos=(0.1, 0), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); # Initialize components for Routine "post19" post19Clock = core.Clock() key_resp_18 = keyboard.Keyboard() image_14 = visual.ImageStim( win=win, name='image_14', image='images/posttest_paralleltestb/post19.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "Post20" Post20Clock = core.Clock() key_resp_19 = keyboard.Keyboard() image_15 = visual.ImageStim( win=win, name='image_15', image='images/posttest_paralleltestb/post20.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) cornerText6 = visual.TextStim(win=win, name='cornerText6', text=None, font='Times New Roman', pos=(0.1, 0), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); screenText6 = visual.TextStim(win=win, name='screenText6', text=None, font='Times New Roman', pos=(0.1, -0.1), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-3.0); # Initialize components for Routine "Ende_1_Termin_2" Ende_1_Termin_2Clock = core.Clock() key_resp_6 = keyboard.Keyboard() image_2 = visual.ImageStim( win=win, name='image_2', image='sin', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Initialize components for Routine "Umfrage1" Umfrage1Clock = core.Clock() screenText7 = visual.TextStim(win=win, name='screenText7', text=None, font='Times New Roman', pos=(0.2, 0.1), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); cornerText7 = visual.TextStim(win=win, name='cornerText7', text='Ihr Feedback:', font='Times New Roman', pos=(0.4, 0.2), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); image_16 = visual.ImageStim( win=win, name='image_16', image='sin', mask=None, ori=0, pos=(-0.35, 0), size=(0.9, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-3.0) key_resp_20 = keyboard.Keyboard() # Initialize components for Routine "Umfrage2" Umfrage2Clock = core.Clock() image_17 = visual.ImageStim( win=win, name='image_17', image='images/umfrage2.jpg', mask=None, ori=0, pos=(-0.35, 0), size=(0.6, 0.7), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=0.0) screenText8 = visual.TextStim(win=win, name='screenText8', text=None, font='Times New Roman', pos=(0.3, 0.1), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-1.0); cornerText8 = visual.TextStim(win=win, name='cornerText8', text='Ihr Feedback: ', font='Times New Roman', pos=(0.2, 0.3), height=0.03, wrapWidth=None, ori=0, color='black', colorSpace='rgb', opacity=1, languageStyle='LTR', depth=-2.0); key_resp_21 = keyboard.Keyboard() # Initialize components for Routine "Ende_1_Termin" Ende_1_TerminClock = core.Clock() key_resp_25 = keyboard.Keyboard() image_21 = visual.ImageStim( win=win, name='image_21', image='images/abschluss/1.jpg', mask=None, ori=0, pos=(0, 0), size=(1.5, 0.8), color=[1,1,1], colorSpace='rgb', opacity=1, flipHoriz=False, flipVert=False, texRes=128, interpolate=True, depth=-1.0) # Create some handy timers globalClock = core.Clock() # to track the time since experiment started routineTimer = core.CountdownTimer() # to track time remaining of each (non-slip) routine # ------Prepare to start Routine "Willkommen0"------- continueRoutine = True # update component parameters for each repeat key_resp_2.keys = [] key_resp_2.rt = [] _key_resp_2_allKeys = [] # keep track of which components have finished Willkommen0Components = [image_ein, key_resp_2] for thisComponent in Willkommen0Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Willkommen0Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Willkommen0"------- while continueRoutine: # get current time t = Willkommen0Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=Willkommen0Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *image_ein* updates if image_ein.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_ein.frameNStart = frameN # exact frame index image_ein.tStart = t # local t and not account for scr refresh image_ein.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_ein, 'tStartRefresh') # time at next scr refresh image_ein.setAutoDraw(True) # *key_resp_2* updates waitOnFlip = False if key_resp_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_2.frameNStart = frameN # exact frame index key_resp_2.tStart = t # local t and not account for scr refresh key_resp_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_2, 'tStartRefresh') # time at next scr refresh key_resp_2.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_2.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_2.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_2.status == STARTED and not waitOnFlip: theseKeys = key_resp_2.getKeys(keyList=['right'], waitRelease=False) _key_resp_2_allKeys.extend(theseKeys) if len(_key_resp_2_allKeys): key_resp_2.keys = _key_resp_2_allKeys[-1].name # just the last key pressed key_resp_2.rt = _key_resp_2_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Willkommen0Components: 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 "Willkommen0"------- for thisComponent in Willkommen0Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('image_ein.started', image_ein.tStartRefresh) thisExp.addData('image_ein.stopped', image_ein.tStopRefresh) # the Routine "Willkommen0" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "Willkommen1"------- continueRoutine = True # update component parameters for each repeat key_resp_11.keys = [] key_resp_11.rt = [] _key_resp_11_allKeys = [] # keep track of which components have finished Willkommen1Components = [image_7, key_resp_11] for thisComponent in Willkommen1Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Willkommen1Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Willkommen1"------- while continueRoutine: # get current time t = Willkommen1Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=Willkommen1Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *image_7* updates if image_7.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_7.frameNStart = frameN # exact frame index image_7.tStart = t # local t and not account for scr refresh image_7.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_7, 'tStartRefresh') # time at next scr refresh image_7.setAutoDraw(True) # *key_resp_11* updates waitOnFlip = False if key_resp_11.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_11.frameNStart = frameN # exact frame index key_resp_11.tStart = t # local t and not account for scr refresh key_resp_11.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_11, 'tStartRefresh') # time at next scr refresh key_resp_11.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_11.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_11.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_11.status == STARTED and not waitOnFlip: theseKeys = key_resp_11.getKeys(keyList=['right'], waitRelease=False) _key_resp_11_allKeys.extend(theseKeys) if len(_key_resp_11_allKeys): key_resp_11.keys = _key_resp_11_allKeys[-1].name # just the last key pressed key_resp_11.rt = _key_resp_11_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Willkommen1Components: 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 "Willkommen1"------- for thisComponent in Willkommen1Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('image_7.started', image_7.tStartRefresh) thisExp.addData('image_7.stopped', image_7.tStopRefresh) # the Routine "Willkommen1" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "pre_ein"------- continueRoutine = True # update component parameters for each repeat key_resp_4.keys = [] key_resp_4.rt = [] _key_resp_4_allKeys = [] # keep track of which components have finished pre_einComponents = [key_resp_4, image] for thisComponent in pre_einComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") pre_einClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "pre_ein"------- while continueRoutine: # get current time t = pre_einClock.getTime() tThisFlip = win.getFutureFlipTime(clock=pre_einClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_4* updates waitOnFlip = False if key_resp_4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_4.frameNStart = frameN # exact frame index key_resp_4.tStart = t # local t and not account for scr refresh key_resp_4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_4, 'tStartRefresh') # time at next scr refresh key_resp_4.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_4.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_4.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_4.status == STARTED and not waitOnFlip: theseKeys = key_resp_4.getKeys(keyList=['right'], waitRelease=False) _key_resp_4_allKeys.extend(theseKeys) if len(_key_resp_4_allKeys): key_resp_4.keys = _key_resp_4_allKeys[-1].name # just the last key pressed key_resp_4.rt = _key_resp_4_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image* updates if image.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image.frameNStart = frameN # exact frame index image.tStart = t # local t and not account for scr refresh image.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image, 'tStartRefresh') # time at next scr refresh image.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 pre_einComponents: 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 "pre_ein"------- for thisComponent in pre_einComponents: 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.addData('key_resp_4.started', key_resp_4.tStartRefresh) thisExp.addData('key_resp_4.stopped', key_resp_4.tStopRefresh) thisExp.nextEntry() thisExp.addData('image.started', image.tStartRefresh) thisExp.addData('image.stopped', image.tStopRefresh) # the Routine "pre_ein" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # set up handler to look after randomisation of conditions etc Images = data.TrialHandler(nReps=1, method='sequential', extraInfo=expInfo, originPath=-1, trialList=data.importConditions('image_stimuli.xlsx', selection='2:10'), seed=None, name='Images') thisExp.addLoop(Images) # add the loop to the experiment thisImage = Images.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisImage.rgb) if thisImage != None: for paramName in thisImage: exec('{} = thisImage[paramName]'.format(paramName)) for thisImage in Images: currentLoop = Images # abbreviate parameter names if possible (e.g. rgb = thisImage.rgb) if thisImage != None: for paramName in thisImage: exec('{} = thisImage[paramName]'.format(paramName)) # ------Prepare to start Routine "Pre"------- continueRoutine = True # update component parameters for each repeat image_pre.setImage(Imagefile) textFill = '' key_resp.keys = [] key_resp.rt = [] _key_resp_allKeys = [] # keep track of which components have finished PreComponents = [image_pre, screenText, cornerText, key_resp] for thisComponent in PreComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") PreClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Pre"------- while continueRoutine: # get current time t = PreClock.getTime() tThisFlip = win.getFutureFlipTime(clock=PreClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *image_pre* updates if image_pre.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_pre.frameNStart = frameN # exact frame index image_pre.tStart = t # local t and not account for scr refresh image_pre.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_pre, 'tStartRefresh') # time at next scr refresh image_pre.setAutoDraw(True) # *screenText* updates if screenText.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later screenText.frameNStart = frameN # exact frame index screenText.tStart = t # local t and not account for scr refresh screenText.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(screenText, 'tStartRefresh') # time at next scr refresh screenText.setAutoDraw(True) # *cornerText* updates if cornerText.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later cornerText.frameNStart = frameN # exact frame index cornerText.tStart = t # local t and not account for scr refresh cornerText.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(cornerText, 'tStartRefresh') # time at next scr refresh cornerText.setAutoDraw(True) if cornerText.status == STARTED: # only update if drawing cornerText.setText('', log=False) #try: # shift_flag # print(True) #except NameError: # print("Name Error") # shift_flag = False shift_flag print("event: ") print(event) keys = event.getKeys() if 'escape' in keys: core.quit() else: if keys: if keys[0] == 'space': textFill += ' ' elif keys[0] == 'backspace': textFill = textFill[:-1] # Deletes elif keys[0] == 'return': textFill += '\n' elif keys[0] == 'right': # record the answer in your data file: thisExp.addData('answer', textFill) # go on to the next trial: continueRoutine = False elif keys[0] in ['lshift', 'rshift']: shift_flag=True pass elif keys[0] == 'period': textFill = textFill+'.' elif keys[0] == 'plus': textFill = textFill+'+' elif keys[0] == 'minus': textFill = textFill+'-' elif keys[0] == 'comma': textFill = textFill+',' elif keys[0] == 'capslock': shift_flag == True elif shift_flag == True and keys[0] == '0': textFill = textFill+'=' elif shift_flag == True and keys[0] == '8': textFill = textFill+'(' elif shift_flag == True and keys[0] == '9': textFill = textFill+')' elif shift_flag == True and keys[0] == 'ß': textFill = textFill+'?' elif shift_flag == True: textFill = textFill+keys[0].upper() shift_flag = False else: textFill = textFill+keys[0] screenText.setText(textFill) # Set new text on screen # *key_resp* updates waitOnFlip = False if key_resp.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp.frameNStart = frameN # exact frame index key_resp.tStart = t # local t and not account for scr refresh key_resp.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp, 'tStartRefresh') # time at next scr refresh key_resp.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp.status == STARTED and not waitOnFlip: theseKeys = key_resp.getKeys(keyList=['right'], waitRelease=False) _key_resp_allKeys.extend(theseKeys) if len(_key_resp_allKeys): key_resp.keys = _key_resp_allKeys[-1].name # just the last key pressed key_resp.rt = _key_resp_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 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 "Pre"------- for thisComponent in PreComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) Images.addData('image_pre.started', image_pre.tStartRefresh) Images.addData('image_pre.stopped', image_pre.tStopRefresh) Images.addData('screenText.started', screenText.tStartRefresh) Images.addData('screenText.stopped', screenText.tStopRefresh) Images.addData('cornerText.started', cornerText.tStartRefresh) Images.addData('cornerText.stopped', cornerText.tStopRefresh) for index, word in enumerate(cornerText.text.split('\n')): word = word.strip(' ') if len(word): thisExp.addData("word{}".format(index), word) # check responses if key_resp.keys in ['', [], None]: # No response was made key_resp.keys = None Images.addData('key_resp.keys',key_resp.keys) if key_resp.keys != None: # we had a response Images.addData('key_resp.rt', key_resp.rt) Images.addData('key_resp.started', key_resp.tStartRefresh) Images.addData('key_resp.stopped', key_resp.tStopRefresh) # the Routine "Pre" was not non-slip safe, so reset the non-slip timer routineTimer.reset() thisExp.nextEntry() # completed 1 repeats of 'Images' # ------Prepare to start Routine "pre2_Ein"------- continueRoutine = True # update component parameters for each repeat key_resp_7.keys = [] key_resp_7.rt = [] _key_resp_7_allKeys = [] # keep track of which components have finished pre2_EinComponents = [key_resp_7, image_3] for thisComponent in pre2_EinComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") pre2_EinClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "pre2_Ein"------- while continueRoutine: # get current time t = pre2_EinClock.getTime() tThisFlip = win.getFutureFlipTime(clock=pre2_EinClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_7* updates waitOnFlip = False if key_resp_7.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_7.frameNStart = frameN # exact frame index key_resp_7.tStart = t # local t and not account for scr refresh key_resp_7.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_7, 'tStartRefresh') # time at next scr refresh key_resp_7.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_7.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_7.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_7.status == STARTED and not waitOnFlip: theseKeys = key_resp_7.getKeys(keyList=['right'], waitRelease=False) _key_resp_7_allKeys.extend(theseKeys) if len(_key_resp_7_allKeys): key_resp_7.keys = _key_resp_7_allKeys[-1].name # just the last key pressed key_resp_7.rt = _key_resp_7_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_3* updates if image_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_3.frameNStart = frameN # exact frame index image_3.tStart = t # local t and not account for scr refresh image_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_3, 'tStartRefresh') # time at next scr refresh image_3.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 pre2_EinComponents: 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 "pre2_Ein"------- for thisComponent in pre2_EinComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_7.keys in ['', [], None]: # No response was made key_resp_7.keys = None thisExp.addData('key_resp_7.keys',key_resp_7.keys) if key_resp_7.keys != None: # we had a response thisExp.addData('key_resp_7.rt', key_resp_7.rt) thisExp.addData('key_resp_7.started', key_resp_7.tStartRefresh) thisExp.addData('key_resp_7.stopped', key_resp_7.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_3.started', image_3.tStartRefresh) thisExp.addData('image_3.stopped', image_3.tStopRefresh) # the Routine "pre2_Ein" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # set up handler to look after randomisation of conditions etc images2 = data.TrialHandler(nReps=1, method='sequential', extraInfo=expInfo, originPath=-1, trialList=data.importConditions('image_stimuli.xlsx', selection='12:18'), seed=None, name='images2') thisExp.addLoop(images2) # add the loop to the experiment thisImages2 = images2.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisImages2.rgb) if thisImages2 != None: for paramName in thisImages2: exec('{} = thisImages2[paramName]'.format(paramName)) for thisImages2 in images2: currentLoop = images2 # abbreviate parameter names if possible (e.g. rgb = thisImages2.rgb) if thisImages2 != None: for paramName in thisImages2: exec('{} = thisImages2[paramName]'.format(paramName)) # ------Prepare to start Routine "Pre"------- continueRoutine = True # update component parameters for each repeat image_pre.setImage(Imagefile) textFill = '' key_resp.keys = [] key_resp.rt = [] _key_resp_allKeys = [] # keep track of which components have finished PreComponents = [image_pre, screenText, cornerText, key_resp] for thisComponent in PreComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") PreClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Pre"------- while continueRoutine: # get current time t = PreClock.getTime() tThisFlip = win.getFutureFlipTime(clock=PreClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *image_pre* updates if image_pre.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_pre.frameNStart = frameN # exact frame index image_pre.tStart = t # local t and not account for scr refresh image_pre.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_pre, 'tStartRefresh') # time at next scr refresh image_pre.setAutoDraw(True) # *screenText* updates if screenText.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later screenText.frameNStart = frameN # exact frame index screenText.tStart = t # local t and not account for scr refresh screenText.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(screenText, 'tStartRefresh') # time at next scr refresh screenText.setAutoDraw(True) # *cornerText* updates if cornerText.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later cornerText.frameNStart = frameN # exact frame index cornerText.tStart = t # local t and not account for scr refresh cornerText.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(cornerText, 'tStartRefresh') # time at next scr refresh cornerText.setAutoDraw(True) if cornerText.status == STARTED: # only update if drawing cornerText.setText('', log=False) #try: # shift_flag # print(True) #except NameError: # print("Name Error") # shift_flag = False shift_flag print("event: ") print(event) keys = event.getKeys() if 'escape' in keys: core.quit() else: if keys: if keys[0] == 'space': textFill += ' ' elif keys[0] == 'backspace': textFill = textFill[:-1] # Deletes elif keys[0] == 'return': textFill += '\n' elif keys[0] == 'right': # record the answer in your data file: thisExp.addData('answer', textFill) # go on to the next trial: continueRoutine = False elif keys[0] in ['lshift', 'rshift']: shift_flag=True pass elif keys[0] == 'period': textFill = textFill+'.' elif keys[0] == 'plus': textFill = textFill+'+' elif keys[0] == 'minus': textFill = textFill+'-' elif keys[0] == 'comma': textFill = textFill+',' elif keys[0] == 'capslock': shift_flag == True elif shift_flag == True and keys[0] == '0': textFill = textFill+'=' elif shift_flag == True and keys[0] == '8': textFill = textFill+'(' elif shift_flag == True and keys[0] == '9': textFill = textFill+')' elif shift_flag == True and keys[0] == 'ß': textFill = textFill+'?' elif shift_flag == True: textFill = textFill+keys[0].upper() shift_flag = False else: textFill = textFill+keys[0] screenText.setText(textFill) # Set new text on screen # *key_resp* updates waitOnFlip = False if key_resp.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp.frameNStart = frameN # exact frame index key_resp.tStart = t # local t and not account for scr refresh key_resp.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp, 'tStartRefresh') # time at next scr refresh key_resp.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp.status == STARTED and not waitOnFlip: theseKeys = key_resp.getKeys(keyList=['right'], waitRelease=False) _key_resp_allKeys.extend(theseKeys) if len(_key_resp_allKeys): key_resp.keys = _key_resp_allKeys[-1].name # just the last key pressed key_resp.rt = _key_resp_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 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 "Pre"------- for thisComponent in PreComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) images2.addData('image_pre.started', image_pre.tStartRefresh) images2.addData('image_pre.stopped', image_pre.tStopRefresh) images2.addData('screenText.started', screenText.tStartRefresh) images2.addData('screenText.stopped', screenText.tStopRefresh) images2.addData('cornerText.started', cornerText.tStartRefresh) images2.addData('cornerText.stopped', cornerText.tStopRefresh) for index, word in enumerate(cornerText.text.split('\n')): word = word.strip(' ') if len(word): thisExp.addData("word{}".format(index), word) # check responses if key_resp.keys in ['', [], None]: # No response was made key_resp.keys = None images2.addData('key_resp.keys',key_resp.keys) if key_resp.keys != None: # we had a response images2.addData('key_resp.rt', key_resp.rt) images2.addData('key_resp.started', key_resp.tStartRefresh) images2.addData('key_resp.stopped', key_resp.tStopRefresh) # the Routine "Pre" was not non-slip safe, so reset the non-slip timer routineTimer.reset() thisExp.nextEntry() # completed 1 repeats of 'images2' # ------Prepare to start Routine "Pause1"------- continueRoutine = True # update component parameters for each repeat key_resp_8.keys = [] key_resp_8.rt = [] _key_resp_8_allKeys = [] # keep track of which components have finished Pause1Components = [key_resp_8, image_4] for thisComponent in Pause1Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Pause1Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Pause1"------- while continueRoutine: # get current time t = Pause1Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=Pause1Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_8* updates waitOnFlip = False if key_resp_8.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_8.frameNStart = frameN # exact frame index key_resp_8.tStart = t # local t and not account for scr refresh key_resp_8.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_8, 'tStartRefresh') # time at next scr refresh key_resp_8.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_8.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_8.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_8.status == STARTED and not waitOnFlip: theseKeys = key_resp_8.getKeys(keyList=['right'], waitRelease=False) _key_resp_8_allKeys.extend(theseKeys) if len(_key_resp_8_allKeys): key_resp_8.keys = _key_resp_8_allKeys[-1].name # just the last key pressed key_resp_8.rt = _key_resp_8_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_4* updates if image_4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_4.frameNStart = frameN # exact frame index image_4.tStart = t # local t and not account for scr refresh image_4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_4, 'tStartRefresh') # time at next scr refresh image_4.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Pause1Components: 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 "Pause1"------- for thisComponent in Pause1Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('image_4.started', image_4.tStartRefresh) thisExp.addData('image_4.stopped', image_4.tStopRefresh) # the Routine "Pause1" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "ps_Ein"------- continueRoutine = True # update component parameters for each repeat key_resp_10.keys = [] key_resp_10.rt = [] _key_resp_10_allKeys = [] # keep track of which components have finished ps_EinComponents = [key_resp_10, image_6] for thisComponent in ps_EinComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") ps_EinClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "ps_Ein"------- while continueRoutine: # get current time t = ps_EinClock.getTime() tThisFlip = win.getFutureFlipTime(clock=ps_EinClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_10* updates waitOnFlip = False if key_resp_10.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_10.frameNStart = frameN # exact frame index key_resp_10.tStart = t # local t and not account for scr refresh key_resp_10.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_10, 'tStartRefresh') # time at next scr refresh key_resp_10.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_10.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_10.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_10.status == STARTED and not waitOnFlip: theseKeys = key_resp_10.getKeys(keyList=['right'], waitRelease=False) _key_resp_10_allKeys.extend(theseKeys) if len(_key_resp_10_allKeys): key_resp_10.keys = _key_resp_10_allKeys[-1].name # just the last key pressed key_resp_10.rt = _key_resp_10_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_6* updates if image_6.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_6.frameNStart = frameN # exact frame index image_6.tStart = t # local t and not account for scr refresh image_6.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_6, 'tStartRefresh') # time at next scr refresh image_6.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 ps_EinComponents: 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 "ps_Ein"------- for thisComponent in ps_EinComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_10.keys in ['', [], None]: # No response was made key_resp_10.keys = None thisExp.addData('key_resp_10.keys',key_resp_10.keys) if key_resp_10.keys != None: # we had a response thisExp.addData('key_resp_10.rt', key_resp_10.rt) thisExp.addData('key_resp_10.started', key_resp_10.tStartRefresh) thisExp.addData('key_resp_10.stopped', key_resp_10.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_6.started', image_6.tStartRefresh) thisExp.addData('image_6.stopped', image_6.tStopRefresh) # the Routine "ps_Ein" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "ps_ein1"------- continueRoutine = True # update component parameters for each repeat key_resp_22.keys = [] key_resp_22.rt = [] _key_resp_22_allKeys = [] # keep track of which components have finished ps_ein1Components = [key_resp_22, image_18] for thisComponent in ps_ein1Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") ps_ein1Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "ps_ein1"------- while continueRoutine: # get current time t = ps_ein1Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=ps_ein1Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_22* updates waitOnFlip = False if key_resp_22.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_22.frameNStart = frameN # exact frame index key_resp_22.tStart = t # local t and not account for scr refresh key_resp_22.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_22, 'tStartRefresh') # time at next scr refresh key_resp_22.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_22.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_22.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_22.status == STARTED and not waitOnFlip: theseKeys = key_resp_22.getKeys(keyList=['right'], waitRelease=False) _key_resp_22_allKeys.extend(theseKeys) if len(_key_resp_22_allKeys): key_resp_22.keys = _key_resp_22_allKeys[-1].name # just the last key pressed key_resp_22.rt = _key_resp_22_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_18* updates if image_18.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_18.frameNStart = frameN # exact frame index image_18.tStart = t # local t and not account for scr refresh image_18.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_18, 'tStartRefresh') # time at next scr refresh image_18.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 ps_ein1Components: 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 "ps_ein1"------- for thisComponent in ps_ein1Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_22.keys in ['', [], None]: # No response was made key_resp_22.keys = None thisExp.addData('key_resp_22.keys',key_resp_22.keys) if key_resp_22.keys != None: # we had a response thisExp.addData('key_resp_22.rt', key_resp_22.rt) thisExp.addData('key_resp_22.started', key_resp_22.tStartRefresh) thisExp.addData('key_resp_22.stopped', key_resp_22.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_18.started', image_18.tStartRefresh) thisExp.addData('image_18.stopped', image_18.tStopRefresh) # the Routine "ps_ein1" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # set up handler to look after randomisation of conditions etc trials_ps = data.TrialHandler(nReps=1, method='sequential', extraInfo=expInfo, originPath=-1, trialList=data.importConditions('image_stimuli.xlsx', selection='22:26'), seed=None, name='trials_ps') thisExp.addLoop(trials_ps) # add the loop to the experiment thisTrials_p = trials_ps.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisTrials_p.rgb) if thisTrials_p != None: for paramName in thisTrials_p: exec('{} = thisTrials_p[paramName]'.format(paramName)) for thisTrials_p in trials_ps: currentLoop = trials_ps # abbreviate parameter names if possible (e.g. rgb = thisTrials_p.rgb) if thisTrials_p != None: for paramName in thisTrials_p: exec('{} = thisTrials_p[paramName]'.format(paramName)) # ------Prepare to start Routine "PS"------- continueRoutine = True # update component parameters for each repeat image_ps.setImage(Imagefile) key_resp_3.keys = [] key_resp_3.rt = [] _key_resp_3_allKeys = [] # keep track of which components have finished PSComponents = [image_ps, key_resp_3] for thisComponent in PSComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") PSClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "PS"------- while continueRoutine: # get current time t = PSClock.getTime() tThisFlip = win.getFutureFlipTime(clock=PSClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *image_ps* updates if image_ps.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_ps.frameNStart = frameN # exact frame index image_ps.tStart = t # local t and not account for scr refresh image_ps.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_ps, 'tStartRefresh') # time at next scr refresh image_ps.setAutoDraw(True) # *key_resp_3* updates waitOnFlip = False if key_resp_3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_3.frameNStart = frameN # exact frame index key_resp_3.tStart = t # local t and not account for scr refresh key_resp_3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_3, 'tStartRefresh') # time at next scr refresh key_resp_3.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_3.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_3.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_3.status == STARTED and not waitOnFlip: theseKeys = key_resp_3.getKeys(keyList=['right'], waitRelease=False) _key_resp_3_allKeys.extend(theseKeys) if len(_key_resp_3_allKeys): key_resp_3.keys = _key_resp_3_allKeys[-1].name # just the last key pressed key_resp_3.rt = _key_resp_3_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 PSComponents: 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 "PS"------- for thisComponent in PSComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) trials_ps.addData('image_ps.started', image_ps.tStartRefresh) trials_ps.addData('image_ps.stopped', image_ps.tStopRefresh) # the Routine "PS" was not non-slip safe, so reset the non-slip timer routineTimer.reset() thisExp.nextEntry() # completed 1 repeats of 'trials_ps' # ------Prepare to start Routine "ps8"------- continueRoutine = True # update component parameters for each repeat key_resp_14.keys = [] key_resp_14.rt = [] _key_resp_14_allKeys = [] textFill = '' # keep track of which components have finished ps8Components = [key_resp_14, image_9, screenText3, cornerText3] for thisComponent in ps8Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") ps8Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "ps8"------- while continueRoutine: # get current time t = ps8Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=ps8Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_14* updates waitOnFlip = False if key_resp_14.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_14.frameNStart = frameN # exact frame index key_resp_14.tStart = t # local t and not account for scr refresh key_resp_14.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_14, 'tStartRefresh') # time at next scr refresh key_resp_14.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_14.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_14.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_14.status == STARTED and not waitOnFlip: theseKeys = key_resp_14.getKeys(keyList=['right'], waitRelease=False) _key_resp_14_allKeys.extend(theseKeys) if len(_key_resp_14_allKeys): key_resp_14.keys = _key_resp_14_allKeys[-1].name # just the last key pressed key_resp_14.rt = _key_resp_14_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_9* updates if image_9.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_9.frameNStart = frameN # exact frame index image_9.tStart = t # local t and not account for scr refresh image_9.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_9, 'tStartRefresh') # time at next scr refresh image_9.setAutoDraw(True) # *screenText3* updates if screenText3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later screenText3.frameNStart = frameN # exact frame index screenText3.tStart = t # local t and not account for scr refresh screenText3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(screenText3, 'tStartRefresh') # time at next scr refresh screenText3.setAutoDraw(True) # *cornerText3* updates if cornerText3.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later cornerText3.frameNStart = frameN # exact frame index cornerText3.tStart = t # local t and not account for scr refresh cornerText3.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(cornerText3, 'tStartRefresh') # time at next scr refresh cornerText3.setAutoDraw(True) try: shift_flag except NameError: shift_flag = False keys = event.getKeys() if 'escape' in keys: core.quit() else: if keys: if keys[0] == 'space': textFill += ' ' elif keys[0] == 'backspace': textFill = textFill[:-1] # Deletes elif keys[0] == 'return': textFill += '\n' elif keys[0] == 'right': # record the answer in your data file: thisExp.addData('answer', textFill) # go on to the next trial: continueRoutine = False elif keys[0] in ['lshift', 'rshift']: shift_flag=True pass elif keys[0] == 'period': textFill = textFill+'.' elif keys[0] == 'plus': textFill = textFill+'+' elif keys[0] == 'minus': textFill = textFill+'-' elif keys[0] == 'comma': textFill = textFill+',' elif keys[0] == 'capslock': shift_flag == True elif shift_flag == True and keys[0] == '0': textFill = textFill+'=' elif shift_flag == True and keys[0] == '8': textFill = textFill+'(' elif shift_flag == True and keys[0] == '9': textFill = textFill+')' elif shift_flag == True and keys[0] == 'ß': textFill = textFill+'?' elif shift_flag == True: textFill = textFill+keys[0].upper() shift_flag = False else: textFill = textFill+keys[0] screenText3.setText(textFill) # Set new text on screen # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 ps8Components: 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 "ps8"------- for thisComponent in ps8Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_14.keys in ['', [], None]: # No response was made key_resp_14.keys = None thisExp.addData('key_resp_14.keys',key_resp_14.keys) if key_resp_14.keys != None: # we had a response thisExp.addData('key_resp_14.rt', key_resp_14.rt) thisExp.addData('key_resp_14.started', key_resp_14.tStartRefresh) thisExp.addData('key_resp_14.stopped', key_resp_14.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_9.started', image_9.tStartRefresh) thisExp.addData('image_9.stopped', image_9.tStopRefresh) thisExp.addData('screenText3.started', screenText3.tStartRefresh) thisExp.addData('screenText3.stopped', screenText3.tStopRefresh) thisExp.addData('cornerText3.started', cornerText3.tStartRefresh) thisExp.addData('cornerText3.stopped', cornerText3.tStopRefresh) for index, word in enumerate(cornerText3.text.split('\n')): word = word.strip(' ') if len(word): thisExp.addData("word{}".format(index), word) # the Routine "ps8" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "ps9"------- continueRoutine = True # update component parameters for each repeat key_resp_12.keys = [] key_resp_12.rt = [] _key_resp_12_allKeys = [] # keep track of which components have finished ps9Components = [key_resp_12, image_8] for thisComponent in ps9Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") ps9Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "ps9"------- while continueRoutine: # get current time t = ps9Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=ps9Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_12* updates waitOnFlip = False if key_resp_12.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_12.frameNStart = frameN # exact frame index key_resp_12.tStart = t # local t and not account for scr refresh key_resp_12.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_12, 'tStartRefresh') # time at next scr refresh key_resp_12.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_12.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_12.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_12.status == STARTED and not waitOnFlip: theseKeys = key_resp_12.getKeys(keyList=['right'], waitRelease=False) _key_resp_12_allKeys.extend(theseKeys) if len(_key_resp_12_allKeys): key_resp_12.keys = _key_resp_12_allKeys[-1].name # just the last key pressed key_resp_12.rt = _key_resp_12_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_8* updates if image_8.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_8.frameNStart = frameN # exact frame index image_8.tStart = t # local t and not account for scr refresh image_8.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_8, 'tStartRefresh') # time at next scr refresh image_8.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 ps9Components: 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 "ps9"------- for thisComponent in ps9Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_12.keys in ['', [], None]: # No response was made key_resp_12.keys = None thisExp.addData('key_resp_12.keys',key_resp_12.keys) if key_resp_12.keys != None: # we had a response thisExp.addData('key_resp_12.rt', key_resp_12.rt) thisExp.addData('key_resp_12.started', key_resp_12.tStartRefresh) thisExp.addData('key_resp_12.stopped', key_resp_12.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_8.started', image_8.tStartRefresh) thisExp.addData('image_8.stopped', image_8.tStopRefresh) # the Routine "ps9" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "ps10"------- continueRoutine = True # update component parameters for each repeat key_resp_13.keys = [] key_resp_13.rt = [] _key_resp_13_allKeys = [] textFill = '' # keep track of which components have finished ps10Components = [key_resp_13, image_10, screenText4, cornerText4] for thisComponent in ps10Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") ps10Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "ps10"------- while continueRoutine: # get current time t = ps10Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=ps10Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_13* updates waitOnFlip = False if key_resp_13.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_13.frameNStart = frameN # exact frame index key_resp_13.tStart = t # local t and not account for scr refresh key_resp_13.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_13, 'tStartRefresh') # time at next scr refresh key_resp_13.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_13.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_13.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_13.status == STARTED and not waitOnFlip: theseKeys = key_resp_13.getKeys(keyList=['right'], waitRelease=False) _key_resp_13_allKeys.extend(theseKeys) if len(_key_resp_13_allKeys): key_resp_13.keys = _key_resp_13_allKeys[-1].name # just the last key pressed key_resp_13.rt = _key_resp_13_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_10* updates if image_10.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_10.frameNStart = frameN # exact frame index image_10.tStart = t # local t and not account for scr refresh image_10.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_10, 'tStartRefresh') # time at next scr refresh image_10.setAutoDraw(True) # *screenText4* updates if screenText4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later screenText4.frameNStart = frameN # exact frame index screenText4.tStart = t # local t and not account for scr refresh screenText4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(screenText4, 'tStartRefresh') # time at next scr refresh screenText4.setAutoDraw(True) # *cornerText4* updates if cornerText4.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later cornerText4.frameNStart = frameN # exact frame index cornerText4.tStart = t # local t and not account for scr refresh cornerText4.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(cornerText4, 'tStartRefresh') # time at next scr refresh cornerText4.setAutoDraw(True) try: shift_flag except NameError: shift_flag = False keys = event.getKeys() if 'escape' in keys: core.quit() else: if keys: if keys[0] == 'space': textFill += ' ' elif keys[0] == 'backspace': textFill = textFill[:-1] # Deletes elif keys[0] == 'return': textFill += '\n' elif keys[0] == 'right': # record the answer in your data file: thisExp.addData('answer', textFill) # go on to the next trial: continueRoutine = False elif keys[0] in ['lshift', 'rshift']: shift_flag=True pass elif keys[0] == 'period': textFill = textFill+'.' elif keys[0] == 'plus': textFill = textFill+'+' elif keys[0] == 'minus': textFill = textFill+'-' elif keys[0] == 'comma': textFill = textFill+',' elif keys[0] == 'capslock': shift_flag == True elif shift_flag == True and keys[0] == '0': textFill = textFill+'=' elif shift_flag == True and keys[0] == '8': textFill = textFill+'(' elif shift_flag == True and keys[0] == '9': textFill = textFill+')' elif shift_flag == True and keys[0] == 'ß': textFill = textFill+'?' elif shift_flag == True: textFill = textFill+keys[0].upper() shift_flag = False else: textFill = textFill+keys[0] screenText4.setText(textFill) # Set new text on screen # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 ps10Components: 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 "ps10"------- for thisComponent in ps10Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_13.keys in ['', [], None]: # No response was made key_resp_13.keys = None thisExp.addData('key_resp_13.keys',key_resp_13.keys) if key_resp_13.keys != None: # we had a response thisExp.addData('key_resp_13.rt', key_resp_13.rt) thisExp.addData('key_resp_13.started', key_resp_13.tStartRefresh) thisExp.addData('key_resp_13.stopped', key_resp_13.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_10.started', image_10.tStartRefresh) thisExp.addData('image_10.stopped', image_10.tStopRefresh) thisExp.addData('screenText4.started', screenText4.tStartRefresh) thisExp.addData('screenText4.stopped', screenText4.tStopRefresh) thisExp.addData('cornerText4.started', cornerText4.tStartRefresh) thisExp.addData('cornerText4.stopped', cornerText4.tStopRefresh) for index, word in enumerate(cornerText4.text.split('\n')): word = word.strip(' ') if len(word): thisExp.addData("word{}".format(index), word) # the Routine "ps10" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "Pause2"------- continueRoutine = True # update component parameters for each repeat key_resp_15.keys = [] key_resp_15.rt = [] _key_resp_15_allKeys = [] # keep track of which components have finished Pause2Components = [key_resp_15, image_11] for thisComponent in Pause2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Pause2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Pause2"------- while continueRoutine: # get current time t = Pause2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=Pause2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_15* updates waitOnFlip = False if key_resp_15.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_15.frameNStart = frameN # exact frame index key_resp_15.tStart = t # local t and not account for scr refresh key_resp_15.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_15, 'tStartRefresh') # time at next scr refresh key_resp_15.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_15.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_15.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_15.status == STARTED and not waitOnFlip: theseKeys = key_resp_15.getKeys(keyList=['right'], waitRelease=False) _key_resp_15_allKeys.extend(theseKeys) if len(_key_resp_15_allKeys): key_resp_15.keys = _key_resp_15_allKeys[-1].name # just the last key pressed key_resp_15.rt = _key_resp_15_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_11* updates if image_11.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_11.frameNStart = frameN # exact frame index image_11.tStart = t # local t and not account for scr refresh image_11.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_11, 'tStartRefresh') # time at next scr refresh image_11.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Pause2Components: 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 "Pause2"------- for thisComponent in Pause2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_15.keys in ['', [], None]: # No response was made key_resp_15.keys = None thisExp.addData('key_resp_15.keys',key_resp_15.keys) if key_resp_15.keys != None: # we had a response thisExp.addData('key_resp_15.rt', key_resp_15.rt) thisExp.addData('key_resp_15.started', key_resp_15.tStartRefresh) thisExp.addData('key_resp_15.stopped', key_resp_15.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_11.started', image_11.tStartRefresh) thisExp.addData('image_11.stopped', image_11.tStopRefresh) # the Routine "Pause2" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "post_Ein"------- continueRoutine = True # update component parameters for each repeat key_resp_9.keys = [] key_resp_9.rt = [] _key_resp_9_allKeys = [] # keep track of which components have finished post_EinComponents = [key_resp_9, image_5] for thisComponent in post_EinComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") post_EinClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "post_Ein"------- while continueRoutine: # get current time t = post_EinClock.getTime() tThisFlip = win.getFutureFlipTime(clock=post_EinClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_9* updates waitOnFlip = False if key_resp_9.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_9.frameNStart = frameN # exact frame index key_resp_9.tStart = t # local t and not account for scr refresh key_resp_9.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_9, 'tStartRefresh') # time at next scr refresh key_resp_9.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_9.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_9.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_9.status == STARTED and not waitOnFlip: theseKeys = key_resp_9.getKeys(keyList=['right'], waitRelease=False) _key_resp_9_allKeys.extend(theseKeys) if len(_key_resp_9_allKeys): key_resp_9.keys = _key_resp_9_allKeys[-1].name # just the last key pressed key_resp_9.rt = _key_resp_9_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_5* updates if image_5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_5.frameNStart = frameN # exact frame index image_5.tStart = t # local t and not account for scr refresh image_5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_5, 'tStartRefresh') # time at next scr refresh image_5.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 post_EinComponents: 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 "post_Ein"------- for thisComponent in post_EinComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_9.keys in ['', [], None]: # No response was made key_resp_9.keys = None thisExp.addData('key_resp_9.keys',key_resp_9.keys) if key_resp_9.keys != None: # we had a response thisExp.addData('key_resp_9.rt', key_resp_9.rt) thisExp.addData('key_resp_9.started', key_resp_9.tStartRefresh) thisExp.addData('key_resp_9.stopped', key_resp_9.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_5.started', image_5.tStartRefresh) thisExp.addData('image_5.stopped', image_5.tStopRefresh) # the Routine "post_Ein" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # set up handler to look after randomisation of conditions etc post_trial = data.TrialHandler(nReps=1, method='sequential', extraInfo=expInfo, originPath=-1, trialList=data.importConditions('image_stimuli.xlsx', selection='77:89'), seed=None, name='post_trial') thisExp.addLoop(post_trial) # add the loop to the experiment thisPost_trial = post_trial.trialList[0] # so we can initialise stimuli with some values # abbreviate parameter names if possible (e.g. rgb = thisPost_trial.rgb) if thisPost_trial != None: for paramName in thisPost_trial: exec('{} = thisPost_trial[paramName]'.format(paramName)) for thisPost_trial in post_trial: currentLoop = post_trial # abbreviate parameter names if possible (e.g. rgb = thisPost_trial.rgb) if thisPost_trial != None: for paramName in thisPost_trial: exec('{} = thisPost_trial[paramName]'.format(paramName)) # ------Prepare to start Routine "Post"------- continueRoutine = True # update component parameters for each repeat image_post.setImage(Imagefile) key_resp_5.keys = [] key_resp_5.rt = [] _key_resp_5_allKeys = [] textFill = '' # keep track of which components have finished PostComponents = [image_post, key_resp_5, screenText2, cornerText2] for thisComponent in PostComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") PostClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Post"------- while continueRoutine: # get current time t = PostClock.getTime() tThisFlip = win.getFutureFlipTime(clock=PostClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *image_post* updates if image_post.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_post.frameNStart = frameN # exact frame index image_post.tStart = t # local t and not account for scr refresh image_post.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_post, 'tStartRefresh') # time at next scr refresh image_post.setAutoDraw(True) # *key_resp_5* updates waitOnFlip = False if key_resp_5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_5.frameNStart = frameN # exact frame index key_resp_5.tStart = t # local t and not account for scr refresh key_resp_5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_5, 'tStartRefresh') # time at next scr refresh key_resp_5.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_5.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_5.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_5.status == STARTED and not waitOnFlip: theseKeys = key_resp_5.getKeys(keyList=['right'], waitRelease=False) _key_resp_5_allKeys.extend(theseKeys) if len(_key_resp_5_allKeys): key_resp_5.keys = _key_resp_5_allKeys[-1].name # just the last key pressed key_resp_5.rt = _key_resp_5_allKeys[-1].rt # a response ends the routine continueRoutine = False # *screenText2* updates if screenText2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later screenText2.frameNStart = frameN # exact frame index screenText2.tStart = t # local t and not account for scr refresh screenText2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(screenText2, 'tStartRefresh') # time at next scr refresh screenText2.setAutoDraw(True) # *cornerText2* updates if cornerText2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later cornerText2.frameNStart = frameN # exact frame index cornerText2.tStart = t # local t and not account for scr refresh cornerText2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(cornerText2, 'tStartRefresh') # time at next scr refresh cornerText2.setAutoDraw(True) try: shift_flag except NameError: shift_flag = False keys = event.getKeys() if 'escape' in keys: core.quit() else: if keys: if keys[0] == 'space': textFill += ' ' elif keys[0] == 'backspace': textFill = textFill[:-1] # Deletes elif keys[0] == 'return': textFill += '\n' elif keys[0] == 'right': # record the answer in your data file: thisExp.addData('answer', textFill) # go on to the next trial: continueRoutine = False elif keys[0] in ['lshift', 'rshift']: shift_flag=True pass elif keys[0] == 'period': textFill = textFill+'.' elif keys[0] == 'plus': textFill = textFill+'+' elif keys[0] == 'minus': textFill = textFill+'-' elif keys[0] == 'comma': textFill = textFill+',' elif keys[0] == 'capslock': shift_flag == True elif shift_flag == True and keys[0] == '0': textFill = textFill+'=' elif shift_flag == True and keys[0] == '8': textFill = textFill+'(' elif shift_flag == True and keys[0] == '9': textFill = textFill+')' elif shift_flag == True and keys[0] == 'ß': textFill = textFill+'?' elif shift_flag == True: textFill = textFill+keys[0].upper() shift_flag = False else: textFill = textFill+keys[0] screenText2.setText(textFill) # Set new text on screen # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 PostComponents: 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 "Post"------- for thisComponent in PostComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) post_trial.addData('image_post.started', image_post.tStartRefresh) post_trial.addData('image_post.stopped', image_post.tStopRefresh) # check responses if key_resp_5.keys in ['', [], None]: # No response was made key_resp_5.keys = None post_trial.addData('key_resp_5.keys',key_resp_5.keys) if key_resp_5.keys != None: # we had a response post_trial.addData('key_resp_5.rt', key_resp_5.rt) post_trial.addData('key_resp_5.started', key_resp_5.tStartRefresh) post_trial.addData('key_resp_5.stopped', key_resp_5.tStopRefresh) post_trial.addData('screenText2.started', screenText2.tStartRefresh) post_trial.addData('screenText2.stopped', screenText2.tStopRefresh) post_trial.addData('cornerText2.started', cornerText2.tStartRefresh) post_trial.addData('cornerText2.stopped', cornerText2.tStopRefresh) for index, word in enumerate(cornerText2.text.split('\n')): word = word.strip(' ') if len(word): thisExp.addData("word{}".format(index), word) # the Routine "Post" was not non-slip safe, so reset the non-slip timer routineTimer.reset() thisExp.nextEntry() # completed 1 repeats of 'post_trial' # ------Prepare to start Routine "Post15"------- continueRoutine = True # update component parameters for each repeat key_resp_16.keys = [] key_resp_16.rt = [] _key_resp_16_allKeys = [] # keep track of which components have finished Post15Components = [key_resp_16, image_12] for thisComponent in Post15Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Post15Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Post15"------- while continueRoutine: # get current time t = Post15Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=Post15Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_16* updates waitOnFlip = False if key_resp_16.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_16.frameNStart = frameN # exact frame index key_resp_16.tStart = t # local t and not account for scr refresh key_resp_16.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_16, 'tStartRefresh') # time at next scr refresh key_resp_16.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_16.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_16.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_16.status == STARTED and not waitOnFlip: theseKeys = key_resp_16.getKeys(keyList=['right'], waitRelease=False) _key_resp_16_allKeys.extend(theseKeys) if len(_key_resp_16_allKeys): key_resp_16.keys = _key_resp_16_allKeys[-1].name # just the last key pressed key_resp_16.rt = _key_resp_16_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_12* updates if image_12.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_12.frameNStart = frameN # exact frame index image_12.tStart = t # local t and not account for scr refresh image_12.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_12, 'tStartRefresh') # time at next scr refresh image_12.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Post15Components: 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 "Post15"------- for thisComponent in Post15Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_16.keys in ['', [], None]: # No response was made key_resp_16.keys = None thisExp.addData('key_resp_16.keys',key_resp_16.keys) if key_resp_16.keys != None: # we had a response thisExp.addData('key_resp_16.rt', key_resp_16.rt) thisExp.addData('key_resp_16.started', key_resp_16.tStartRefresh) thisExp.addData('key_resp_16.stopped', key_resp_16.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_12.started', image_12.tStartRefresh) thisExp.addData('image_12.stopped', image_12.tStopRefresh) # the Routine "Post15" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "POST16"------- continueRoutine = True # update component parameters for each repeat key_resp_24.keys = [] key_resp_24.rt = [] _key_resp_24_allKeys = [] # keep track of which components have finished POST16Components = [image_20, key_resp_24] for thisComponent in POST16Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") POST16Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "POST16"------- while continueRoutine: # get current time t = POST16Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=POST16Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *image_20* updates if image_20.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_20.frameNStart = frameN # exact frame index image_20.tStart = t # local t and not account for scr refresh image_20.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_20, 'tStartRefresh') # time at next scr refresh image_20.setAutoDraw(True) # *key_resp_24* updates waitOnFlip = False if key_resp_24.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_24.frameNStart = frameN # exact frame index key_resp_24.tStart = t # local t and not account for scr refresh key_resp_24.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_24, 'tStartRefresh') # time at next scr refresh key_resp_24.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_24.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_24.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_24.status == STARTED and not waitOnFlip: theseKeys = key_resp_24.getKeys(keyList=['right'], waitRelease=False) _key_resp_24_allKeys.extend(theseKeys) if len(_key_resp_24_allKeys): key_resp_24.keys = _key_resp_24_allKeys[-1].name # just the last key pressed key_resp_24.rt = _key_resp_24_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 POST16Components: 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 "POST16"------- for thisComponent in POST16Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('image_20.started', image_20.tStartRefresh) thisExp.addData('image_20.stopped', image_20.tStopRefresh) # check responses if key_resp_24.keys in ['', [], None]: # No response was made key_resp_24.keys = None thisExp.addData('key_resp_24.keys',key_resp_24.keys) if key_resp_24.keys != None: # we had a response thisExp.addData('key_resp_24.rt', key_resp_24.rt) thisExp.addData('key_resp_24.started', key_resp_24.tStartRefresh) thisExp.addData('key_resp_24.stopped', key_resp_24.tStopRefresh) thisExp.nextEntry() # the Routine "POST16" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "POST17"------- continueRoutine = True # update component parameters for each repeat key_resp_23.keys = [] key_resp_23.rt = [] _key_resp_23_allKeys = [] # keep track of which components have finished POST17Components = [key_resp_23, image_19] for thisComponent in POST17Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") POST17Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "POST17"------- while continueRoutine: # get current time t = POST17Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=POST17Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_23* updates waitOnFlip = False if key_resp_23.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_23.frameNStart = frameN # exact frame index key_resp_23.tStart = t # local t and not account for scr refresh key_resp_23.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_23, 'tStartRefresh') # time at next scr refresh key_resp_23.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_23.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_23.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_23.status == STARTED and not waitOnFlip: theseKeys = key_resp_23.getKeys(keyList=['right'], waitRelease=False) _key_resp_23_allKeys.extend(theseKeys) if len(_key_resp_23_allKeys): key_resp_23.keys = _key_resp_23_allKeys[-1].name # just the last key pressed key_resp_23.rt = _key_resp_23_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_19* updates if image_19.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_19.frameNStart = frameN # exact frame index image_19.tStart = t # local t and not account for scr refresh image_19.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_19, 'tStartRefresh') # time at next scr refresh image_19.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 POST17Components: 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 "POST17"------- for thisComponent in POST17Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_23.keys in ['', [], None]: # No response was made key_resp_23.keys = None thisExp.addData('key_resp_23.keys',key_resp_23.keys) if key_resp_23.keys != None: # we had a response thisExp.addData('key_resp_23.rt', key_resp_23.rt) thisExp.addData('key_resp_23.started', key_resp_23.tStartRefresh) thisExp.addData('key_resp_23.stopped', key_resp_23.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_19.started', image_19.tStartRefresh) thisExp.addData('image_19.stopped', image_19.tStopRefresh) # the Routine "POST17" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "Post18"------- continueRoutine = True # update component parameters for each repeat key_resp_17.keys = [] key_resp_17.rt = [] _key_resp_17_allKeys = [] textFill = '' # keep track of which components have finished Post18Components = [key_resp_17, image_13, screenText5, cornerText5] for thisComponent in Post18Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Post18Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Post18"------- while continueRoutine: # get current time t = Post18Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=Post18Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_17* updates waitOnFlip = False if key_resp_17.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_17.frameNStart = frameN # exact frame index key_resp_17.tStart = t # local t and not account for scr refresh key_resp_17.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_17, 'tStartRefresh') # time at next scr refresh key_resp_17.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_17.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_17.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_17.status == STARTED and not waitOnFlip: theseKeys = key_resp_17.getKeys(keyList=['right'], waitRelease=False) _key_resp_17_allKeys.extend(theseKeys) if len(_key_resp_17_allKeys): key_resp_17.keys = _key_resp_17_allKeys[-1].name # just the last key pressed key_resp_17.rt = _key_resp_17_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_13* updates if image_13.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_13.frameNStart = frameN # exact frame index image_13.tStart = t # local t and not account for scr refresh image_13.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_13, 'tStartRefresh') # time at next scr refresh image_13.setAutoDraw(True) # *screenText5* updates if screenText5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later screenText5.frameNStart = frameN # exact frame index screenText5.tStart = t # local t and not account for scr refresh screenText5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(screenText5, 'tStartRefresh') # time at next scr refresh screenText5.setAutoDraw(True) # *cornerText5* updates if cornerText5.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later cornerText5.frameNStart = frameN # exact frame index cornerText5.tStart = t # local t and not account for scr refresh cornerText5.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(cornerText5, 'tStartRefresh') # time at next scr refresh cornerText5.setAutoDraw(True) try: shift_flag except NameError: shift_flag = False keys = event.getKeys() if 'escape' in keys: core.quit() else: if keys: if keys[0] == 'space': textFill += ' ' elif keys[0] == 'backspace': textFill = textFill[:-1] # Deletes elif keys[0] == 'return': textFill += '\n' elif keys[0] == 'right': # record the answer in your data file: thisExp.addData('answer', textFill) # go on to the next trial: continueRoutine = False elif keys[0] in ['lshift', 'rshift']: shift_flag=True pass elif keys[0] == 'period': textFill = textFill+'.' elif keys[0] == 'plus': textFill = textFill+'+' elif keys[0] == 'minus': textFill = textFill+'-' elif keys[0] == 'comma': textFill = textFill+',' elif keys[0] == 'capslock': shift_flag == True elif shift_flag == True and keys[0] == '0': textFill = textFill+'=' elif shift_flag == True and keys[0] == '8': textFill = textFill+'(' elif shift_flag == True and keys[0] == '9': textFill = textFill+')' elif shift_flag == True and keys[0] == 'ß': textFill = textFill+'?' elif shift_flag == True: textFill = textFill+keys[0].upper() shift_flag = False else: textFill = textFill+keys[0] screenText5.setText(textFill) # Set new text on screen # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Post18Components: 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 "Post18"------- for thisComponent in Post18Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_17.keys in ['', [], None]: # No response was made key_resp_17.keys = None thisExp.addData('key_resp_17.keys',key_resp_17.keys) if key_resp_17.keys != None: # we had a response thisExp.addData('key_resp_17.rt', key_resp_17.rt) thisExp.addData('key_resp_17.started', key_resp_17.tStartRefresh) thisExp.addData('key_resp_17.stopped', key_resp_17.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_13.started', image_13.tStartRefresh) thisExp.addData('image_13.stopped', image_13.tStopRefresh) thisExp.addData('screenText5.started', screenText5.tStartRefresh) thisExp.addData('screenText5.stopped', screenText5.tStopRefresh) thisExp.addData('cornerText5.started', cornerText5.tStartRefresh) thisExp.addData('cornerText5.stopped', cornerText5.tStopRefresh) for index, word in enumerate(cornerText5.text.split('\n')): word = word.strip(' ') if len(word): thisExp.addData("word{}".format(index), word) # the Routine "Post18" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "post19"------- continueRoutine = True # update component parameters for each repeat key_resp_18.keys = [] key_resp_18.rt = [] _key_resp_18_allKeys = [] # keep track of which components have finished post19Components = [key_resp_18, image_14] for thisComponent in post19Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") post19Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "post19"------- while continueRoutine: # get current time t = post19Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=post19Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_18* updates waitOnFlip = False if key_resp_18.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_18.frameNStart = frameN # exact frame index key_resp_18.tStart = t # local t and not account for scr refresh key_resp_18.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_18, 'tStartRefresh') # time at next scr refresh key_resp_18.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_18.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_18.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_18.status == STARTED and not waitOnFlip: theseKeys = key_resp_18.getKeys(keyList=['right'], waitRelease=False) _key_resp_18_allKeys.extend(theseKeys) if len(_key_resp_18_allKeys): key_resp_18.keys = _key_resp_18_allKeys[-1].name # just the last key pressed key_resp_18.rt = _key_resp_18_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_14* updates if image_14.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_14.frameNStart = frameN # exact frame index image_14.tStart = t # local t and not account for scr refresh image_14.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_14, 'tStartRefresh') # time at next scr refresh image_14.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 post19Components: 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 "post19"------- for thisComponent in post19Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_18.keys in ['', [], None]: # No response was made key_resp_18.keys = None thisExp.addData('key_resp_18.keys',key_resp_18.keys) if key_resp_18.keys != None: # we had a response thisExp.addData('key_resp_18.rt', key_resp_18.rt) thisExp.addData('key_resp_18.started', key_resp_18.tStartRefresh) thisExp.addData('key_resp_18.stopped', key_resp_18.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_14.started', image_14.tStartRefresh) thisExp.addData('image_14.stopped', image_14.tStopRefresh) # the Routine "post19" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "Post20"------- continueRoutine = True # update component parameters for each repeat key_resp_19.keys = [] key_resp_19.rt = [] _key_resp_19_allKeys = [] textFill = '' # keep track of which components have finished Post20Components = [key_resp_19, image_15, cornerText6, screenText6] for thisComponent in Post20Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Post20Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Post20"------- while continueRoutine: # get current time t = Post20Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=Post20Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_19* updates waitOnFlip = False if key_resp_19.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_19.frameNStart = frameN # exact frame index key_resp_19.tStart = t # local t and not account for scr refresh key_resp_19.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_19, 'tStartRefresh') # time at next scr refresh key_resp_19.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_19.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_19.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_19.status == STARTED and not waitOnFlip: theseKeys = key_resp_19.getKeys(keyList=['right'], waitRelease=False) _key_resp_19_allKeys.extend(theseKeys) if len(_key_resp_19_allKeys): key_resp_19.keys = _key_resp_19_allKeys[-1].name # just the last key pressed key_resp_19.rt = _key_resp_19_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_15* updates if image_15.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_15.frameNStart = frameN # exact frame index image_15.tStart = t # local t and not account for scr refresh image_15.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_15, 'tStartRefresh') # time at next scr refresh image_15.setAutoDraw(True) # *cornerText6* updates if cornerText6.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later cornerText6.frameNStart = frameN # exact frame index cornerText6.tStart = t # local t and not account for scr refresh cornerText6.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(cornerText6, 'tStartRefresh') # time at next scr refresh cornerText6.setAutoDraw(True) # *screenText6* updates if screenText6.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later screenText6.frameNStart = frameN # exact frame index screenText6.tStart = t # local t and not account for scr refresh screenText6.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(screenText6, 'tStartRefresh') # time at next scr refresh screenText6.setAutoDraw(True) try: shift_flag except NameError: shift_flag = False keys = event.getKeys() if 'escape' in keys: core.quit() else: if keys: if keys[0] == 'space': textFill += ' ' elif keys[0] == 'backspace': textFill = textFill[:-1] # Deletes elif keys[0] == 'return': textFill += '\n' elif keys[0] == 'right': # record the answer in your data file: thisExp.addData('answer', textFill) # go on to the next trial: continueRoutine = False elif keys[0] in ['lshift', 'rshift']: shift_flag=True pass elif keys[0] == 'period': textFill = textFill+'.' elif keys[0] == 'plus': textFill = textFill+'+' elif keys[0] == 'minus': textFill = textFill+'-' elif keys[0] == 'comma': textFill = textFill+',' elif keys[0] == 'capslock': shift_flag == True elif shift_flag == True and keys[0] == '0': textFill = textFill+'=' elif shift_flag == True and keys[0] == '8': textFill = textFill+'(' elif shift_flag == True and keys[0] == '9': textFill = textFill+')' elif shift_flag == True and keys[0] == 'ß': textFill = textFill+'?' elif shift_flag == True: textFill = textFill+keys[0].upper() shift_flag = False else: textFill = textFill+keys[0] screenText6.setText(textFill) # Set new text on screen # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Post20Components: 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 "Post20"------- for thisComponent in Post20Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_19.keys in ['', [], None]: # No response was made key_resp_19.keys = None thisExp.addData('key_resp_19.keys',key_resp_19.keys) if key_resp_19.keys != None: # we had a response thisExp.addData('key_resp_19.rt', key_resp_19.rt) thisExp.addData('key_resp_19.started', key_resp_19.tStartRefresh) thisExp.addData('key_resp_19.stopped', key_resp_19.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_15.started', image_15.tStartRefresh) thisExp.addData('image_15.stopped', image_15.tStopRefresh) thisExp.addData('cornerText6.started', cornerText6.tStartRefresh) thisExp.addData('cornerText6.stopped', cornerText6.tStopRefresh) thisExp.addData('screenText6.started', screenText6.tStartRefresh) thisExp.addData('screenText6.stopped', screenText6.tStopRefresh) for index, word in enumerate(cornerText6.text.split('\n')): word = word.strip(' ') if len(word): thisExp.addData("word{}".format(index), word) # the Routine "Post20" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "Ende_1_Termin_2"------- continueRoutine = True # update component parameters for each repeat key_resp_6.keys = [] key_resp_6.rt = [] _key_resp_6_allKeys = [] image_2.setImage('images/abschluss/2.jpg') # keep track of which components have finished Ende_1_Termin_2Components = [key_resp_6, image_2] for thisComponent in Ende_1_Termin_2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Ende_1_Termin_2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Ende_1_Termin_2"------- while continueRoutine: # get current time t = Ende_1_Termin_2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=Ende_1_Termin_2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_6* updates waitOnFlip = False if key_resp_6.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_6.frameNStart = frameN # exact frame index key_resp_6.tStart = t # local t and not account for scr refresh key_resp_6.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_6, 'tStartRefresh') # time at next scr refresh key_resp_6.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_6.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_6.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_6.status == STARTED and not waitOnFlip: theseKeys = key_resp_6.getKeys(keyList=['right'], waitRelease=False) _key_resp_6_allKeys.extend(theseKeys) if len(_key_resp_6_allKeys): key_resp_6.keys = _key_resp_6_allKeys[-1].name # just the last key pressed key_resp_6.rt = _key_resp_6_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_2* updates if image_2.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_2.frameNStart = frameN # exact frame index image_2.tStart = t # local t and not account for scr refresh image_2.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_2, 'tStartRefresh') # time at next scr refresh image_2.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Ende_1_Termin_2Components: 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_1_Termin_2"------- for thisComponent in Ende_1_Termin_2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('image_2.started', image_2.tStartRefresh) thisExp.addData('image_2.stopped', image_2.tStopRefresh) # the Routine "Ende_1_Termin_2" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "Umfrage1"------- continueRoutine = True # update component parameters for each repeat textFill = '' image_16.setImage('images/umfrage1.jpg') key_resp_20.keys = [] key_resp_20.rt = [] _key_resp_20_allKeys = [] # keep track of which components have finished Umfrage1Components = [screenText7, cornerText7, image_16, key_resp_20] for thisComponent in Umfrage1Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Umfrage1Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Umfrage1"------- while continueRoutine: # get current time t = Umfrage1Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=Umfrage1Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame try: shift_flag except NameError: shift_flag = False keys = event.getKeys() if 'escape' in keys: core.quit() else: if keys: if keys[0] == 'space': textFill += ' ' elif keys[0] == 'backspace': textFill = textFill[:-1] # Deletes elif keys[0] == 'return': textFill += '\n' elif keys[0] == 'right': # record the answer in your data file: thisExp.addData('answer', textFill) # go on to the next trial: continueRoutine = False elif keys[0] in ['lshift', 'rshift']: shift_flag=True pass elif keys[0] == 'period': textFill = textFill+'.' elif keys[0] == 'plus': textFill = textFill+'+' elif keys[0] == 'minus': textFill = textFill+'-' elif keys[0] == 'comma': textFill = textFill+',' elif keys[0] == 'capslock': shift_flag == True elif shift_flag == True and keys[0] == '0': textFill = textFill+'=' elif shift_flag == True and keys[0] == '8': textFill = textFill+'(' elif shift_flag == True and keys[0] == '9': textFill = textFill+')' elif shift_flag == True and keys[0] == 'ß': textFill = textFill+'?' elif shift_flag == True: textFill = textFill+keys[0].upper() shift_flag = False else: textFill = textFill+keys[0] screenText7.setText(textFill) # Set new text on screen # *screenText7* updates if screenText7.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later screenText7.frameNStart = frameN # exact frame index screenText7.tStart = t # local t and not account for scr refresh screenText7.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(screenText7, 'tStartRefresh') # time at next scr refresh screenText7.setAutoDraw(True) # *cornerText7* updates if cornerText7.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later cornerText7.frameNStart = frameN # exact frame index cornerText7.tStart = t # local t and not account for scr refresh cornerText7.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(cornerText7, 'tStartRefresh') # time at next scr refresh cornerText7.setAutoDraw(True) # *image_16* updates if image_16.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_16.frameNStart = frameN # exact frame index image_16.tStart = t # local t and not account for scr refresh image_16.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_16, 'tStartRefresh') # time at next scr refresh image_16.setAutoDraw(True) # *key_resp_20* updates waitOnFlip = False if key_resp_20.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_20.frameNStart = frameN # exact frame index key_resp_20.tStart = t # local t and not account for scr refresh key_resp_20.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_20, 'tStartRefresh') # time at next scr refresh key_resp_20.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_20.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_20.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_20.status == STARTED and not waitOnFlip: theseKeys = key_resp_20.getKeys(keyList=['right'], waitRelease=False) _key_resp_20_allKeys.extend(theseKeys) if len(_key_resp_20_allKeys): key_resp_20.keys = _key_resp_20_allKeys[-1].name # just the last key pressed key_resp_20.rt = _key_resp_20_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Umfrage1Components: 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 "Umfrage1"------- for thisComponent in Umfrage1Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) for index, word in enumerate(cornerText7.text.split('\n')): word = word.strip(' ') if len(word): thisExp.addData("word{}".format(index), word) thisExp.addData('screenText7.started', screenText7.tStartRefresh) thisExp.addData('screenText7.stopped', screenText7.tStopRefresh) thisExp.addData('cornerText7.started', cornerText7.tStartRefresh) thisExp.addData('cornerText7.stopped', cornerText7.tStopRefresh) thisExp.addData('image_16.started', image_16.tStartRefresh) thisExp.addData('image_16.stopped', image_16.tStopRefresh) # the Routine "Umfrage1" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "Umfrage2"------- continueRoutine = True # update component parameters for each repeat textFill = '' key_resp_21.keys = [] key_resp_21.rt = [] _key_resp_21_allKeys = [] # keep track of which components have finished Umfrage2Components = [image_17, screenText8, cornerText8, key_resp_21] for thisComponent in Umfrage2Components: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Umfrage2Clock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Umfrage2"------- while continueRoutine: # get current time t = Umfrage2Clock.getTime() tThisFlip = win.getFutureFlipTime(clock=Umfrage2Clock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *image_17* updates if image_17.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_17.frameNStart = frameN # exact frame index image_17.tStart = t # local t and not account for scr refresh image_17.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_17, 'tStartRefresh') # time at next scr refresh image_17.setAutoDraw(True) # *screenText8* updates if screenText8.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later screenText8.frameNStart = frameN # exact frame index screenText8.tStart = t # local t and not account for scr refresh screenText8.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(screenText8, 'tStartRefresh') # time at next scr refresh screenText8.setAutoDraw(True) # *cornerText8* updates if cornerText8.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later cornerText8.frameNStart = frameN # exact frame index cornerText8.tStart = t # local t and not account for scr refresh cornerText8.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(cornerText8, 'tStartRefresh') # time at next scr refresh cornerText8.setAutoDraw(True) try: shift_flag except NameError: shift_flag = False keys = event.getKeys() if 'escape' in keys: core.quit() else: if keys: if keys[0] == 'space': textFill += ' ' elif keys[0] == 'backspace': textFill = textFill[:-1] # Deletes elif keys[0] == 'return': textFill += '\n' elif keys[0] == 'right': # record the answer in your data file: thisExp.addData('answer', textFill) # go on to the next trial: continueRoutine = False elif keys[0] in ['lshift', 'rshift']: shift_flag=True pass elif keys[0] == 'period': textFill = textFill+'.' elif keys[0] == 'plus': textFill = textFill+'+' elif keys[0] == 'minus': textFill = textFill+'-' elif keys[0] == 'comma': textFill = textFill+',' elif keys[0] == 'capslock': shift_flag == True elif shift_flag == True and keys[0] == '0': textFill = textFill+'=' elif shift_flag == True and keys[0] == '8': textFill = textFill+'(' elif shift_flag == True and keys[0] == '9': textFill = textFill+')' elif shift_flag == True and keys[0] == 'ß': textFill = textFill+'?' elif shift_flag == True: textFill = textFill+keys[0].upper() shift_flag = False else: textFill = textFill+keys[0] screenText8.setText(textFill) # Set new text on screen # *key_resp_21* updates waitOnFlip = False if key_resp_21.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_21.frameNStart = frameN # exact frame index key_resp_21.tStart = t # local t and not account for scr refresh key_resp_21.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_21, 'tStartRefresh') # time at next scr refresh key_resp_21.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_21.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_21.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_21.status == STARTED and not waitOnFlip: theseKeys = key_resp_21.getKeys(keyList=['right'], waitRelease=False) _key_resp_21_allKeys.extend(theseKeys) if len(_key_resp_21_allKeys): key_resp_21.keys = _key_resp_21_allKeys[-1].name # just the last key pressed key_resp_21.rt = _key_resp_21_allKeys[-1].rt # a response ends the routine continueRoutine = False # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Umfrage2Components: 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 "Umfrage2"------- for thisComponent in Umfrage2Components: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) thisExp.addData('image_17.started', image_17.tStartRefresh) thisExp.addData('image_17.stopped', image_17.tStopRefresh) thisExp.addData('screenText8.started', screenText8.tStartRefresh) thisExp.addData('screenText8.stopped', screenText8.tStopRefresh) thisExp.addData('cornerText8.started', cornerText8.tStartRefresh) thisExp.addData('cornerText8.stopped', cornerText8.tStopRefresh) for index, word in enumerate(cornerText8.text.split('\n')): word = word.strip(' ') if len(word): thisExp.addData("word{}".format(index), word) # the Routine "Umfrage2" was not non-slip safe, so reset the non-slip timer routineTimer.reset() # ------Prepare to start Routine "Ende_1_Termin"------- continueRoutine = True # update component parameters for each repeat key_resp_25.keys = [] key_resp_25.rt = [] _key_resp_25_allKeys = [] # keep track of which components have finished Ende_1_TerminComponents = [key_resp_25, image_21] for thisComponent in Ende_1_TerminComponents: thisComponent.tStart = None thisComponent.tStop = None thisComponent.tStartRefresh = None thisComponent.tStopRefresh = None if hasattr(thisComponent, 'status'): thisComponent.status = NOT_STARTED # reset timers t = 0 _timeToFirstFrame = win.getFutureFlipTime(clock="now") Ende_1_TerminClock.reset(-_timeToFirstFrame) # t0 is time of first possible flip frameN = -1 # -------Run Routine "Ende_1_Termin"------- while continueRoutine: # get current time t = Ende_1_TerminClock.getTime() tThisFlip = win.getFutureFlipTime(clock=Ende_1_TerminClock) tThisFlipGlobal = win.getFutureFlipTime(clock=None) frameN = frameN + 1 # number of completed frames (so 0 is the first frame) # update/draw components on each frame # *key_resp_25* updates waitOnFlip = False if key_resp_25.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later key_resp_25.frameNStart = frameN # exact frame index key_resp_25.tStart = t # local t and not account for scr refresh key_resp_25.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(key_resp_25, 'tStartRefresh') # time at next scr refresh key_resp_25.status = STARTED # keyboard checking is just starting waitOnFlip = True win.callOnFlip(key_resp_25.clock.reset) # t=0 on next screen flip win.callOnFlip(key_resp_25.clearEvents, eventType='keyboard') # clear events on next screen flip if key_resp_25.status == STARTED and not waitOnFlip: theseKeys = key_resp_25.getKeys(keyList=['right'], waitRelease=False) _key_resp_25_allKeys.extend(theseKeys) if len(_key_resp_25_allKeys): key_resp_25.keys = _key_resp_25_allKeys[-1].name # just the last key pressed key_resp_25.rt = _key_resp_25_allKeys[-1].rt # a response ends the routine continueRoutine = False # *image_21* updates if image_21.status == NOT_STARTED and tThisFlip >= 0.0-frameTolerance: # keep track of start time/frame for later image_21.frameNStart = frameN # exact frame index image_21.tStart = t # local t and not account for scr refresh image_21.tStartRefresh = tThisFlipGlobal # on global time win.timeOnFlip(image_21, 'tStartRefresh') # time at next scr refresh image_21.setAutoDraw(True) # check for quit (typically the Esc key) if endExpNow or defaultKeyboard.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 Ende_1_TerminComponents: 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_1_Termin"------- for thisComponent in Ende_1_TerminComponents: if hasattr(thisComponent, "setAutoDraw"): thisComponent.setAutoDraw(False) # check responses if key_resp_25.keys in ['', [], None]: # No response was made key_resp_25.keys = None thisExp.addData('key_resp_25.keys',key_resp_25.keys) if key_resp_25.keys != None: # we had a response thisExp.addData('key_resp_25.rt', key_resp_25.rt) thisExp.addData('key_resp_25.started', key_resp_25.tStartRefresh) thisExp.addData('key_resp_25.stopped', key_resp_25.tStopRefresh) thisExp.nextEntry() thisExp.addData('image_21.started', image_21.tStartRefresh) thisExp.addData('image_21.stopped', image_21.tStopRefresh) # the Routine "Ende_1_Termin" 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()