

Rtdisp=str(round(rt, 1))# round the rt to 1 decimal place If key in (): # if one of the key presses has been escape then quitĮlif key in (): # if it matches the response Press the space bar to begin when you are ready')

The next three trials are practice trials\n\n\ Instpres('Press the space bar as soon as you see the numbers appear\n\n\ Pictureframe_inner = visual.Rect(mywin, width=(imsize), height=(imsize),opacity=1,fillColor='white',autoLog=False) PictureframeISI = visual.Rect(mywin, width=(imsize+1), height=(imsize+1),opacity=1,fillColor='white',autoLog=False)#extra frame for 2AFC task Pictureframe = visual.Rect(mywin, width=(imsize+1), height=(imsize+1),opacity=1,fillColor='black',autoLog=False) IS=visual.TextStim(win=mywin, color='black', height=(instrtextsize), text=string, alignHoriz='center',wrapWidth=30,autoLog=False,font='verdana')# this is alignment to the screen not the text alignment, irritatingly IS=visual.TextStim(win=mywin, color='black', height=(textsize), text=string, alignHoriz='center',wrapWidth=30,autoLog=False, font='verdana') IS=visual.TextStim(win=mywin, color='black', height=(textsize), text=string, alignHoriz='center',autoLog=False, font='verdana') IS=visual.TextStim(win=mywin, color='black', height=(instrtextsize), text=string, alignHoriz='center',wrapWidth=18,autoLog=False,font='verdana')# this is alignment to the screen not the text alignment, irritatinglyįor key in event.getKeys(): #EJD: I've removed "space" because (from the below code) you want to collect all key presses LogFile = logging.LogFile(filename+'.log', level=logging.EXP) # save a log file for detail verbose info tMouseVisible(False)# stops the mouse appearing ontop Mywin = visual.Window(fullscr=True, monitor="dell", units="deg", color =,autoLog=False)# to set a window use size and remove the fullscr arguement, you can choose "deg" = visual angle, or "pix" for pixels, this then use the approp units in your image defs below ThisExp = data.ExperimentHandler(name=expName, version='',extraInfo=expInfo, runtimeInfo=None,originPath=None,savePickle=False, saveWideText=True,dataFileName=filename) # An ExperimentHandler isn't essential but helps with data saving log, etcįilename = _thisDir + os.sep + u'data/%s_%s_%s' % (expInfo, expName, expInfo,)+'_PVT' # Data file name stem = absolute path + name later add. # Store info about the experiment sessionĮxpName = u'PVT' # from the Builder filename that created this scriptĮxpInfo = ĭlg = gui.DlgFromDict(dictionary=expInfo, title=expName)ĮxpInfo = data.getDateStr() # add a simple timestamp _thisDir = os.path.dirname(os.path.abspath(_file_)).decode(sys.getfilesystemencoding()) # Ensure that relative paths start from the same directory as this script Import csv #useful for handling csv files Import os # handy system and path functions Import numpy as np # whole numpy lib is available, prepend 'np.'įrom numpy import (sin, cos, tan, log, log10, pi, average,sqrt, std, deg2rad, rad2deg, linspace, asarray)įrom numpy.random import random, randint, normal, shuffle # you can either just import random, then call random.shuffle or you can import the specific elements of random, e.g. Import pandas as pd # these are for reading from excel filesįrom psychopy import visual, logging, core, event, data, sound, gui,locale_setup# import some libraries from PsychoPyįrom nstants import (NOT_STARTED, STARTED, PLAYING, PAUSED,STOPPED, FINISHED, PRESSED, RELEASED, FOREVER) George from _future_ import absolute_import, division I have a range of different experiments with this issue, below is an example of the simplest one.įYI running this in Win 10, dell laptop, 16gb ram, i7, running an old version of Psychopy 1.90.3

Is there anything I can do in the way I have structured the experiment handler to speed this up? When the experiment and window closes I go back to the coder view, and there can be a very long lag while the various different events are displayed in the output window, and written to txt and csv files. I have an issue with slow write speeds at the end of my experiments.
