Visual Array component building

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2022.2.2
Standard Standalone? (y/n) If not then what?: I’m not sure what this means
What are you trying to achieve?:

I am trying to create a response screen for an object memory task with 10 presented and 10 distractor objects. I want my participants to click the pictures they saw in the order they saw them.

I have 4 sets with 10 objects in each set. Currently the way I have created the response screen is to insert individual image components (the text is for me to know where to break up my lines):

And it gives me the screen I want:

I am wondering if there is a cleaner way to achieve this? I imagine a list in excel would work? I guess I’m just not experienced enough to figure out jsut how to create the list so that I can counterbalance test and distractor images across participants, as well as for each participant, since I will have 2 blocks of this task.

Indeed there is a cleaner way in terms of decluttering your routine. I asked a similar question myself, have a look Advice on creating many text stimuli...without too much work :-)

2 Likes

Okay, so my next problem is that this array will consist of 10 previously objects and 10 distractors. All presented and distractor objects will be in the same nested list and any object can be either the test or distractor.

I need to make sure that the visual array is showing the presented objects for that block and then pulling another 10 random objects as the distractor.

I’m assuming I will use and “If, then” statement, but I’m not sure how or where I would add this. In the routine I have two image components (one for the original 10 and one for the 10 distractors)

The code I have started only encompasses the omt_distractor component. Should I just change this to one iamge component and then specify it is the original 10 objects and 10 new objects? If so, I’m not sure how to do this with code.

Either way, here is the code piece I’ve been working on to create the array:

number of distractors

n_distractors = 10
distractors = []

for i in range(n_distractors): 
    omt_distract = visual.ImageStim(
        win=win,
        name='omt_distract', 
        image=None, mask=None, anchor='center',
        ori=0.0, pos=(0, 0), size=(0.5, 0.5),
        color=[1,1,1], colorSpace='rgb', opacity=None,
        flipHoriz=False, flipVert=False,
        texRes=128.0, interpolate=True, depth=-2.0)
        
    distractors.append(omt_distract)

for omt_distract in distractors:
    omt_distract.setAutoDraw(TRUE)

You can simplify this slightly with

n_distractors = 10
distractors = []

for i in range(n_distractors): 
    distractors.append(visual.ImageStim(
        win=win,
        name='omt_distract', 
        image=None, mask=None, anchor='center',
        ori=0.0, pos=(0, 0), size=(0.5, 0.5),
        color=[1,1,1], colorSpace='rgb', opacity=None,
        flipHoriz=False, flipVert=False,
        texRes=128.0, interpolate=True, depth=-2.0))
        
for omt_distract in distractors:
    omt_distract.setAutoDraw(True)

Though presumably there’s no point setting them to auto draw until you’ve given them unique locations.