psychopy.org | Reference | Downloads | Github

Nested loops for presenting images


#1

Hi there,

basically I want to configure a nested loop that presents images and that is conceptually the same as this block of code.

for i in range(10):
  for j in range(3):
    print('(' + str(j) + ')' + '(' + str(i) + ')')

Where I have 10 sets of 3 images each.

I tried using the builder to create two loops, and made the condition file for the inner loop callback ‘$first’, ‘$second’, and ‘$third’ for each iteration under the heading ‘stim’. Then for the outer loop I had a different condition file that had ‘first’, ‘second’, and ‘third’ as headers and called back the paths for the images themselves for each condition.

I then set my image component to $stim, but then I got this error

IOError: Couldn't find image $first; check path? (tried: D:\Footboy2\NUS\Thesis\Psychopy\$first)

I know it’s because the image component is expecting an image, but is there a way to make the component not do so?

Thanks,
Zac


#2

Hi Zac,

I’m struggling to understand your question, perhaps because of some non-standard use of terminology like “call back”. Perhaps rather than attempt to describe how you have implemented things so far, perhaps it would be best to describe what you want to achieve, in terms of what the participant will experience (i.e. in terms of images, trials, and blocks of trials).