Call-up previously shown, code created, stimuli to check accuracy

Hello,

I am using a modified version of the visual search task created by Wakefield found here: VESPR / letter-search · GitLab

The main changes are removing the mouse components, and changing the letters to shapes, otherwise the code is the same.

What I’d like to do is show the shapes, then a blank screen, then either 1 or more shapes again. At this stage those shapes will either be in the same place they were previously, or in a different place. I am using a simple “press space if the shapes are in the right place”, so will also need a way to check for accuracy.

Any help would be great, I know that it’s saving the positions of the elements but I’m just not sure on how to both call them back, accuracy check and also create some new ones for when it’s an incorrect trial.

I have managed to figure this out for now!

I added a conditions file for the correct answer, number of distractors and if the location should remain the same.

I then made a routine with the code below, which checks the conditions in the loop and either redraws the previous stimuli, or draws a new one.

if probePres == 'y':
    elements[0].setAutoDraw(True)
    if nDistractors > 1:
        for Idx in range(1,nDistractors):
            elements[Idx].setAutoDraw(True)

elif probePres == 'n':
    shuffle(positions)
    elements[0].setPos([positions[0][0]+random()*jitter-random()*jitter, positions[0][1]+random()*jitter-random()*jitter])
    elements[0].setAutoDraw(True)
    if nDistractors > 1:
        for Idx in range(1,nDistractors):
            elements[Idx].setPos([positions[Idx][0]+random()*jitter-random()*jitter, positions[Idx][1]+random()*jitter-random()*jitter])
            elements[Idx].setAutoDraw(True)