Duplicating Random Visual Stimuli In Python/psychopy
Using Python/Psychopy. I am presenting 3 random visual stimuli to the center of the screen for 1 second (imgList1). I am then presenting 3 other random visual stimuli to the upper
Solution 1:
targetset
is the list that has your chosen images from imgList1. They don't go anywhere when you draw them. You can still access that list later (as long as you don't delete or overwrite). Just flip a coin (select a random number between 0 and 1 and check if less than 0.5. If so use pics
in the secondary stimuli, if not use targetset
(with the second location list). You might find this worth abstracting to a function.
def drawSet (imgs,locs):
for(i,l) in (imgs,locs):
i.pos = l
i.draw()
window.flip()
core.wait(0.25)
Then you would use this for drawSet(targetset,setlocation)
and drawSet(pics,location)
or drawSet(targetset,location)
with random (assuming you import random as r
somewhere)
if r.random() < 0.5:
drawSet(pics,location)
else:
drawSet(targetset,location)
Post a Comment for "Duplicating Random Visual Stimuli In Python/psychopy"