![]() ![]() # Start Code - component code to be run before the window creation (logging.WARNING) # this outputs to the screen, not a fileĮndExpNow = False # flag for 'escape' or other condition => quit the exp LogFile = logging.LogFile(filename+'.log', level=logging.EXP) ThisExp = data.ExperimentHandler(name=expName, version='', # An ExperimentHandler isn't essential but helps with data saving log, etcįilename = _thisDir + os.sep + 'data/%s_%s_%s' %(expInfo, expName, expInfo) # Data file name stem = absolute path + name later add. If dlg.OK = False: core.quit() # user pressed cancelĮxpInfo = data.getDateStr() # add a simple timestamp # Store info about the experiment sessionĮxpName = 'simultaneous_04' # from the Builder filename that created this scriptĮxpInfo = ĭlg = gui.DlgFromDict(dictionary=expInfo, title=expName) _thisDir = os.path.dirname(os.path.abspath(_file_)) # Ensure that relative paths start from the same directory as this script 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 doi: 10.3389/neuro.11.010.2008įrom _future_ import division # so that 1/3=0.333 instead of 1/3=0įrom psychopy import visual, core, data, event, logging, sound, guiįrom nstants import * # things like STARTED, FINISHED Peirce, JW (2009) Generating stimuli for neuroscience using PsychoPy. Journal of Neuroscience Methods, 162(1-2), 8-13. Peirce, JW (2007) PsychoPy - Psychophysics software in Python. If you publish work using this script please cite the relevant PsychoPy publications This experiment was created using PsychoPy2 Experiment Builder (v1.82.01), Thu Aug 27 10:56:53 2015 Have I gone about this in the wrong way? The full code pasted below. I started to make the loop proceed through the conditions file randomly, but the result is that every triangle changes its orientation at every rep (rather than just one at a time). I am having a hard time figuring out what code to use to make this possible. However, my ultimate goal is to have a variable number of distractor shifts before the target shift in each trial, and for each trial to end with a fixation cross before moving onto the next trial. Right now I have this set as a sequential loop, with fixed numbers of distractor shifts, for the sake of simplicity. This is the "target shift." I have the orientations for all triangles specified in an Excel conditions file. When one of the triangle changes like this, it is called a "distractor shift."Īfter a number of these distractor shifts, one of the triangles shifts into the "target" position (either pointing left or right, 90 or 270 degrees), at which point the person is meant to respond with a keypress. So, if you can see in the snippet above, I created each row in the conditions file such that only one triangle changes its orientation every second. The orientation of each triangle is determined by the conditions file-triangle 1 orientation field is set to "angle_01," triangle 2 orientation is set to "angle_02" and so forth. Each triangle is set to have a 1 second duration. **The subject is then presented with an array of 4 triangles. ![]() The subject is instructed to press the corresponding left or right arrow keys when they spot either one of these targets.Ī sample of the Excel conditions file looks like this: angle_01 angle_02 angle_03 angle_04 corrAns Subject is first presented with two target triangles: one pointing to the left, one pointing to the right. ![]() I've run into a roadblock with a task and would appreciate any advice from the community! My knowledge of Python is still very limited. I am using PsychoPy version 1.82.01 in the Builder View. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |