| Reference | Downloads | Github

PsychoPy code - visual stimuli in various locations



I am new to programming and have a problem. I need to create a procedure where 4 different visual stimuli will appear in 4 lolalizations on the screen (upper right corner, lower right corner, lower left corner, upper left corner).

Each stimulus must appear in a given location twice (i.e. 32 repetitions). Can somebody tell me how can I do that? I was thinking about creating a text file with the names of the stimuli (which I have in the folder) and the names of the positions in which the stimuli are to be placed (for the program to choose from this list). I just don’t know how to define positions … and let the program choose from this list.

You would put the info in a .csv or .xlsx file with columns like this, which capture all 16 possible combinations of the four images and four locations:

image_file    x     y
cat.jpg      -0.5  -0.5
cat.jpg      -0.5   0.5
cat.jpg       0.5  -0.5
cat.jpg       0.5   0.5
dog.jpg      -0.5  -0.5
dog.jpg      -0.5   0.5
dog.jpg       0.5  -0.5
dog.jpg       0.5   0.5
cow.jpg      -0.5  -0.5
cow.jpg      -0.5   0.5
cow.jpg       0.5  -0.5
cow.jpg       0.5   0.5
fly.jpg      -0.5  -0.5
fly.jpg      -0.5   0.5
fly.jpg       0.5  -0.5
fly.jpg       0.5   0.5

Then connect that as the conditions file to a loop in the Builder interface (or supplied to a TrialHandler if you are programming this manually), set to have an nReps value of 2, which will give you a total of 32 trials.