Image randomization

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version (2022.2.5)

What are you trying to achieve?:
The study design:
Subjects complete 3 blocks of a facial recognition task. Each block is randomly assigned and counterbalanced to 1 of 3 instruction conditions and 1 of 3 subsets of face stimuli. Each subset consists of 2 lists of 15 faces, one of which is randomly assigned to be presented. There is then a filler task and then a recognition test with the 15 presented (old) faces and 15 new faces.

The part that is proving difficult is incorporating the presentation images into PsychoPy. Notably, the filler task is also image based, and those images are working fine. I am having trouble identifying the difference that is the source of the problem. All image files currently used and tested are PNGs.

What did you try to make it work?:
To avoid ambiguity, I am going to include a fair bit code.
At the beginning of the experiment, I create several empty variables to add things too.

face_p1a = []
face_t1a = []
face_p1b = []
face_t1b = []
face_p2a = []
face_t2a = []
face_p2b = []
face_t2b = []
face_p3a = []
face_t3a = []
face_p3b = []
face_t3b = []
random = []

At the start of the same routine, I then add on the images from an excel file.

face_p1a.append(p1a)
face_p1b.append(p1b)
face_p2a.append(p2a)
face_p2b.append(p2b)
face_p3a.append(p3a)
face_p3b.append(p3b)

For context, here is part of the excel file. The excel file is in the same folder as the PsychoPy build. All images are in nested folders within that folder (a separate folder for filler and presentation images). There are images that repeat in the excel file as part of the test attempts.

There is never a crash in the counterbalancing block, but I will include some code as further context. One thing that does worry me is if the multiple layers of conditional statements of append or push commands is somehow causing difficulties. The counterbalances are repeated to cover every possible iteration of the 3 instructions, 3 stimuli subsets, and 2 lists per subset.

Counterbalancing which of the 2 lists in a stimulus subset are the presentation item

random = randint(1,3)

if random == 1:
    face_p1o.append(face_p1a)
    face_t1o.append(face_t1a)

if random == 2:
    face_p1o.append(face_p1b)
    face_t1o.append(face_t1b)

Counterbalancing the order of the subjects go through the stimuli subset.

random = randint(1,7)

if random == 1:
    face_p1.append(face_p1o)
    face_t1.append(face_t1o)
    face_p2.append(face_p2o)
    face_t2.append(face_t2o)
    face_p3.append(face_p3o)
    face_t3.append(face_t3o)

if random == 2:
    face_p1.append(face_p1o)
    face_t1.append(face_t1o)
    face_p2.append(face_p3o)
    face_t2.append(face_t3o)
    face_p3.append(face_p2o)
    face_t3.append(face_t2o)

Creating empty current variables to determine what item in a variable list is presented each routine.

current_wordsearch = 0
current_inst = 0
current_p1 = 0
current_t1 = 0
current_p2 = 0
current_t2 = 0
current_p3 = 0
current_t3 = 0

The presentation phase occurs with 1 block looped 15 times. The block consists of an image and code. The image itself should pull up the picture from the appropriate list. The purpose of the code is to change what image is pulled up next. So far not a single presentation image is successfully shown.


At the end of the routine for every run through of the presentation block:
current_p1 += 1

What specifically went wrong when you tried that?:
I am going to post the whole error message and bold the parts that are most notable as far as I can tell.

Running: C:\Users\Grant\Documents\Claremont Graduate University\2023 Spring\PSY162 Learning and Mem\ML Original Project\OG_project2_lastrun.py

6979.8735 EXP Imported instuctionprompts.xlsx as conditions, 3 conditions, 1 params
6979.8864 EXP Imported face_pres.xlsx as conditions, 15 conditions, 6 params
6979.8944 EXP Imported wordsearch.xlsx as conditions, 6 conditions, 1 params
6979.9165 EXP Imported face_test.xlsx as conditions, 30 conditions, 6 params
6979.9616 INFO Loaded monitor calibration from [‘2023_01_14 15:58’]
6980.0632 EXP Imported instuctionprompts.xlsx as conditions, 3 conditions, 1 params
6980.0788 EXP Imported face_pres.xlsx as conditions, 15 conditions, 6 params
6980.0878 EXP Imported wordsearch.xlsx as conditions, 6 conditions, 1 params
6980.1075 EXP Imported face_test.xlsx as conditions, 30 conditions, 6 params
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. Contribute - pygame wiki
0
[[[‘wspic/wordsearch1.png’, ‘wspic/wordsearch2.png’, ‘wspic/wordsearch3.png’, ‘wspic/wordsearch4.png’, ‘wspic/wordsearch5.png’, ‘wspic/wordsearch6.png’, ‘wspic/wordsearch1.png’, ‘wspic/wordsearch2.png’, ‘wspic/wordsearch3.png’, ‘wspic/wordsearch1.png’, ‘wspic/wordsearch2.png’, ‘wspic/wordsearch3.png’, ‘wspic/wordsearch4.png’, ‘wspic/wordsearch5.png’, ‘wspic/wordsearch6.png’]]]
4.0091 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\basevisual.py”, line 1050, in _createTexture
im = tex.copy().transpose(Image.FLIP_TOP_BOTTOM)
341.5624 WARNING User requested fullscreen with size [1280 720], but screen is actually [1920, 1080]. Using actual size
362.3953 WARNING Couldn’t measure a consistent frame rate!

  • Is your graphics card set to sync to vertical blank?
  • Are you running other processes on your computer?

362.6260 WARNING t of last frame was 23.22ms (=1/43)
362.6681 WARNING t of last frame was 23.39ms (=1/42)
362.8751 WARNING t of last frame was 26.15ms (=1/38)
362.9763 WARNING t of last frame was 29.83ms (=1/33)
363.0433 WARNING Multiple dropped frames have occurred - I’ll stop bothering you about them!
364.5791 WARNING Couldn’t measure a consistent frame rate!

  • Is your graphics card set to sync to vertical blank?
  • Are you running other processes on your computer?

460.2232 DEPRECATION Couldn’t make sense of requested image.
7.1617 WARNING Monitor specification not found. Creating a temporary one…
AttributeError: ‘list’ object has no attribute ‘transpose’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\Grant\Documents\Claremont Graduate University\2023 Spring\PSY162 Learning and Mem\ML Original Project\OG_project2_lastrun.py”, line 1424, in
pres1image.setImage(face_p1[current_p1])
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\image.py”, line 416, in setImage
setAttribute(self, ‘image’, value, log)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\tools\attributetools.py”, line 134, in setAttribute
setattr(self, attrib, value)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\tools\attributetools.py”, line 27, in set
newValue = self.func(obj, value)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\image.py”, line 382, in image
self.isLumImage = self._createTexture(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\basevisual.py”, line 1055, in _createTexture
raise AttributeError(msg)
AttributeError: Couldn’t make sense of requested image.
################ Experiment ended with exit code 1 [pid:13888] #################

A curious point.
For the presentation stimuli, I am following the same general procedure as the filler images. The filler images are randomized but not counterbalanced. They have worked fine. For context, the filler is handled with this code, image, and file. I am having trouble identifying why the filler is working and the presentation block is not.
Beginning of the experiment:
wordsearch = []

The image is:
$wordsearch[current_wordsearch]

As with the current tracker for p1, the word search tracker increases by 1 at the end of each completion of the block.
current_wordsearch +=1

All of the wordsearch files are named wordsearchx.png with x being numbers 1-6. The wordsearch images are in a nested folder called wspic. In the excel file, the variable is “crossword” and the values are wspic/wordsearchx.png.

Hi @Grant,

The error message suggests that the image filename you’re trying to use is actually a list.

I think this might be happening because face_p1o is a list, then you’re appending that list to the face_p1 list. So face_p1 ends up being a list of lists (a LOT of lists there - sorry!). Therefore, when you’re trying to index into that list in the image filename field, what’s populated is a list rather than a filename. You can check this by adding print(face_p1[current_p1]) just after you’ve appended to the face_p1 (etc.) lists.

Whereas it looks like when you’re setting up the same thing for your filler you’re only appending items (the filenames) to a list, rather than appending lists to a list. So when you index into that list, a filename is returned and things work as they should.

Please let me know if that makes sense!

Kim

1 Like

Thanks for taking the time to look and respond. Based on this idea, I changed my counterbalancing so that the first-round of counterbalancing sets face_p1o and all the other such lists that end in o are parts of conditional statements in the second round of the counterbalancing and are not appended to the to the lists (example below).

#Subset 1 presentation assignment

random = randint(1,3)

if random == 1:
    face_p1o = 1
    face_t1o = 1

if random == 2:
    face_p1o = 2
    face_t1o = 2

A section of the code run for some of the variations of order 1.

if random == 1 and face_p1o == 1 and face_p2o == 1 and face_p3o ==1:
    face_p1.append(face_p1a)
    face_t1.append(face_t1a)
    face_p2.append(face_p2a)
    face_t2.append(face_t2a)
    face_p3.append(face_p3a)
    face_t3.append(face_t3a)

if random == 1 and face_p1o == 2 and face_p2o == 1 and face_p3o ==1:
    face_p1.append(face_p1b)
    face_t1.append(face_t1b)
    face_p2.append(face_p2a)
    face_t2.append(face_t2a)
    face_p3.append(face_p3a)
    face_t3.append(face_t3a)

Unfortunately, this did not seem to fix the issue. I got what appears to be the same error as far as I can tell. This occurred even when testing the build with the presentation images the same as the filler images.

Also, as an interesting point, and I do not know if or how important this is, when I tried to print(face_p1[current_p1]) as suggested, it returned current_p1 (0) and then the entire face_p1 list twice (using the excel sheet input, italicized below), rather than supplying the current (first) item on the list.

14050.8674 EXP Imported instuctionprompts.xlsx as conditions, 3 conditions, 1 params
14050.8792 EXP Imported face_pres.xlsx as conditions, 15 conditions, 6 params
14050.8871 EXP Imported wordsearch.xlsx as conditions, 6 conditions, 1 params
14050.9131 EXP Imported face_test.xlsx as conditions, 30 conditions, 6 params
14051.0137 INFO Loaded monitor calibration from [‘2023_01_14 15:58’]
14051.0650 EXP Imported instuctionprompts.xlsx as conditions, 3 conditions, 1 params
14051.0760 EXP Imported face_pres.xlsx as conditions, 15 conditions, 6 params
14051.0833 EXP Imported wordsearch.xlsx as conditions, 6 conditions, 1 params
14051.0987 EXP Imported face_test.xlsx as conditions, 30 conditions, 6 params
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. Contribute - pygame wiki
0
[[[‘wspic/wordsearch1.png’, ‘wspic/wordsearch2.png’, ‘wspic/wordsearch3.png’, ‘wspic/wordsearch4.png’, ‘wspic/wordsearch5.png’, ‘wspic/wordsearch6.png’, ‘wspic/wordsearch1.png’, ‘wspic/wordsearch2.png’, ‘wspic/wordsearch3.png’, ‘wspic/wordsearch1.png’, ‘wspic/wordsearch2.png’, ‘wspic/wordsearch3.png’, ‘wspic/wordsearch4.png’, ‘wspic/wordsearch5.png’, ‘wspic/wordsearch6.png’]]]
[[‘wspic/wordsearch1.png’, ‘wspic/wordsearch2.png’, ‘wspic/wordsearch3.png’, ‘wspic/wordsearch4.png’, ‘wspic/wordsearch5.png’, ‘wspic/wordsearch6.png’, ‘wspic/wordsearch1.png’, ‘wspic/wordsearch2.png’, ‘wspic/wordsearch3.png’, ‘wspic/wordsearch1.png’, ‘wspic/wordsearch2.png’, ‘wspic/wordsearch3.png’, ‘wspic/wordsearch4.png’, ‘wspic/wordsearch5.png’, ‘wspic/wordsearch6.png’]]
4.0992 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
Traceback (most recent call last):
9.8095 WARNING User requested fullscreen with size [1280 720], but screen is actually [1920, 1080]. Using actual size
18.5467 DEPRECATION Couldn’t make sense of requested image.
2.4012 WARNING Monitor specification not found. Creating a temporary one…
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\basevisual.py”, line 1050, in _createTexture
im = tex.copy().transpose(Image.FLIP_TOP_BOTTOM)
AttributeError: ‘list’ object has no attribute ‘transpose’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\Grant\Documents\Claremont Graduate University\2023 Spring\PSY162 Learning and Mem\ML Original Project\OG_project2_lastrun.py”, line 1676, in
pres1image.setImage(face_p1[current_p1])
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\image.py”, line 416, in setImage
setAttribute(self, ‘image’, value, log)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\tools\attributetools.py”, line 134, in setAttribute
setattr(self, attrib, value)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\tools\attributetools.py”, line 27, in set
newValue = self.func(obj, value)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\image.py”, line 382, in image
self.isLumImage = self._createTexture(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\visual\basevisual.py”, line 1055, in _createTexture
raise AttributeError(msg)
AttributeError: Couldn’t make sense of requested image.
################# Experiment ended with exit code 1 [pid:9016] #################

On that curiosity point, I added print(wordsearch[current_wordsearch]). That returned only a single response and not the whole list. I think Kim is on to something, but changing the counterbalance did not fix it. I am not sure where the problem is that is making PsychoPy engage differently with these lists.

Offering an update in case anyone can help. The presentation list is now working initially. Turns out the problem was as Kim described. I just had to make some further code alterations to make in work.

The new problem is after running through the 15 items in the first presentation list, PsychoPy crashes with the error:

Traceback (most recent call last):
2.9729 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
7.7645 WARNING User requested fullscreen with size [1280 720], but screen is actually [1920, 1080]. Using actual size
1.9513 WARNING Monitor specification not found. Creating a temporary one…
File “C:\Users\Grant\Documents\Claremont Graduate University\2023 Spring\PSY162 Learning and Mem\ML Original Project\OG_project2_copy_lastrun.py”, line 2117, in
pres1image.setImage(face_p1[current_p1])
IndexError: list index out of range
################# Experiment ended with exit code 1 [pid:2044] #################
37320.2064 EXP Imported instuctionprompts.xlsx as conditions, 3 conditions, 1 params
37320.2129 EXP Imported wordsearch.xlsx as conditions, 6 conditions, 1 params
37320.2236 EXP Imported face_pres.xlsx as conditions, 16 conditions, 6 params
37320.2391 EXP Imported face_test.xlsx as conditions, 30 conditions, 6 params
37320.2508 EXP Imported face_pres.xlsx as conditions, 16 conditions, 6 params
37320.2517 WARNING duplicate variable names: p3a, p3b, p2b, p1b, p2a, p1a
37320.3740 INFO Loaded monitor calibration from [‘2023_01_14 15:58’]

The loop occurs 15 times and there are 15 items in the variable list. I even added a 16th item and still got the error to check the problem wasn’t the block very briefly trying to display a nonexistent 16th item. So there is a new problem I am not sure of though progress has been made.

To add a bit more detail because my prior message was a bit incomplete based on what I have since learned regarding the error:

The error code I get:
498.7408 EXP Imported instuctionprompts.xlsx as conditions, 3 conditions, 1 params
498.7477 EXP Imported wordsearch.xlsx as conditions, 6 conditions, 1 params
498.7582 EXP Imported face_pres.xlsx as conditions, 15 conditions, 6 params
498.7738 EXP Imported face_test.xlsx as conditions, 30 conditions, 6 params
498.7851 EXP Imported face_pres.xlsx as conditions, 15 conditions, 6 params
498.7860 WARNING duplicate variable names: p2b, p1a, p1b, p2a, p3b, p3a
498.9117 INFO Loaded monitor calibration from [‘2023_01_14 15:58’]
498.9672 EXP Imported instuctionprompts.xlsx as conditions, 3 conditions, 1 params
498.9744 EXP Imported wordsearch.xlsx as conditions, 6 conditions, 1 params
498.9850 EXP Imported face_pres.xlsx as conditions, 15 conditions, 6 params
499.1650 EXP Imported face_test.xlsx as conditions, 30 conditions, 6 params
499.1768 EXP Imported face_pres.xlsx as conditions, 15 conditions, 6 params
499.1778 WARNING duplicate variable names: p2b, p1a, p1b, p2a, p3b, p3a
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community.
facesp/face5.png
Traceback (most recent call last):
9
wspic/wordsearch6.png
facesp/face5.png
9
wspic/wordsearch1.png
facesp/face5.png
9
wspic/wordsearch5.png
facesp/face5.png
9
wspic/wordsearch5.png
facesp/face5.png
9
wspic/wordsearch3.png
facesp/face5.png
9
wspic/wordsearch1.png
facesp/face5.png
9
wspic/wordsearch4.png
facesp/face5.png
9
wspic/wordsearch2.png
facesp/face5.png
9
wspic/wordsearch3.png
facesp/face5.png
9
wspic/wordsearch6.png
facesp/face5.png
9
wspic/wordsearch6.png
facesp/face5.png
9
wspic/wordsearch6.png
facesp/face5.png
9
wspic/wordsearch6.png
facesp/face5.png
9
wspic/wordsearch3.png
facesp/face5.png
9
wspic/wordsearch1.png
[‘facesp/face4.png’, ‘facesp/face1.png’, ‘facesp/face4.png’, ‘facesp/face5.png’, ‘facesp/face1.png’, ‘facesp/face5.png’, ‘facesp/face2.png’, ‘facesp/face3.png’, ‘facesp/face2.png’, ‘facesp/face3.png’, ‘facesp/face5.png’, ‘facesp/face2.png’, ‘facesp/face3.png’, ‘facesp/face1.png’, ‘facesp/face4.png’]
3.1271 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
9.5269 WARNING User requested fullscreen with size [1280 720], but screen is actually [1920, 1080]. Using actual size
1.9498 WARNING Monitor specification not found. Creating a temporary one…
File “C:\Users\Grant\Documents\Claremont Graduate University\2023 Spring\PSY162 Learning and Mem\ML Original Project\OG_project2_copy_lastrun.py”, line 2201, in
pres1image.setImage(face_p1[current_p1])
IndexError: list index out of range
################# Experiment ended with exit code 1 [pid:9784] #################
634.2810 EXP Imported instuctionprompts.xlsx as conditions, 3 conditions, 1 params
634.2881 EXP Imported wordsearch.xlsx as conditions, 6 conditions, 1 params
634.2989 EXP Imported face_pres.xlsx as conditions, 15 conditions, 6 params
634.3146 EXP Imported face_test.xlsx as conditions, 30 conditions, 6 params
634.3256 EXP Imported face_pres.xlsx as conditions, 15 conditions, 6 params
634.3267 WARNING duplicate variable names: p2b, p1a, p1b, p2a, p3b, p3a
634.4478 INFO Loaded monitor calibration from [‘2023_01_14 15:58’]

Now here is the weird part:
Every bit of discourse I could find on “IndexError: list index out of range” seems to indicate this error occurs when the variable is first displayed. For me, what happens is I get through the 15 presentation images and only then does PsychoPy crash. I separately tried going from 15 to 14 loops and adding a 16th value to make sure the problem isn’t PsychoPy trying to load one more value than there is. Neither of these attempts worked. What is more, the filler task is next. The problem does not appear to be the filler task itself as it worked fine when I put it before the presentation phase as a test and there is no code in the presentation phase that interacts with anything in the filler block.

The error message indicates that you’ve asked for a number that’s more than available. Are you aware that in Python, like many programming languages (but not like Matlab), the index starts at 0 which means the 15th image is going to be face_p1[14]? If you have 15 images and you ask for face_p1[15] then you’ll get index out of range because that’s actually the 16th image including 0

Thanks for taking the time to try and help. I am aware. The initial value is current_p1 = 0. In the end routine part of presentation routine code is current_p1 += 1. This occurs 15 times so the image calls face_p1[0 through 14] across the loop. After the last presentation, current_p1 should equal 15 with there not being a 15th item, but because this occurs at the end of the routine, face_p1[15] is never presented.

I tried moving the current_p1 += 0 code to filler block that is in the same loop in case the problem was the image very briefly trying to present face_p1[15]. That did not fix the issue. I also tested decreasing the loop repeats by 1 and adding a 16th item to the presentation stimuli list, what would then be face_p1[15]. Neither of these worked either. That is why I am confused because the error message indicates the problem is PsychoPy trying to present a variable value that isn’t there, but these attempted solutions indicate the problem is something else.

For some reason I do not understand, the presentation phase is working with the loop repeats set to 1 with it showing all 15 values despite the image presenting $face_p1[current_p1]. I am very confused and do not understand why it works.

The latest problem is the test list now returning this error despite being loaded the exact same way as the presentation list which is presented fine. The build crashes the moment it tries to present the first test image (error bolded below). Additionally, I do not know if this is irrelevant or symptomatic of a bigger issue, but the various print commands that I added to be able to check things in the Stdout seem to repeat several times despite being in a loops with nReps set to 1 (italicized below).

6017.4902 INFO Loaded monitor calibration from [‘2023_01_14 15:58’]
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community.
facesp/face4.png
9
wspic/wordsearch5.png
facesp/face4.png
9
wspic/wordsearch4.png
facesp/face4.png
9
wspic/wordsearch3.png
facesp/face4.png
9
wspic/wordsearch1.png
facesp/face4.png
9
wspic/wordsearch5.png
facesp/face4.png
9
wspic/wordsearch3.png
facesp/face4.png
9
wspic/wordsearch4.png
facesp/face4.png
9
wspic/wordsearch3.png
facesp/face4.png
9
wspic/wordsearch4.png
facesp/face4.png
9
wspic/wordsearch1.png
facesp/face4.png
9
wspic/wordsearch4.png
facesp/face4.png
9
wspic/wordsearch6.png
facesp/face4.png
9
wspic/wordsearch1.png
facesp/face4.png
9
wspic/wordsearch1.png
facesp/face4.png
9
wspic/wordsearch6.png
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
123
3
2
2
2
[‘facesp/face4.png’, ‘facesp/face1.png’, ‘facesp/face2.png’, ‘facesp/face5.png’, ‘facesp/face3.png’, ‘facesp/face4.png’, ‘facesp/face2.png’, ‘facesp/face1.png’, ‘facesp/face5.png’, ‘facesp/face3.png’, ‘facesp/face3.png’, ‘facesp/face4.png’, ‘facesp/face5.png’, ‘facesp/face1.png’, ‘facesp/face2.png’]
0
0
12
Traceback (most recent call last):
0
[‘facesp/face3.png’, ‘facesp/face2.png’, ‘facesp/face5.png’, ‘facesp/face1.png’, ‘facesp/face4.png’, ‘facesp/face4.png’, ‘facesp/face2.png’, ‘facesp/face5.png’, ‘facesp/face1.png’, ‘facesp/face4.png’, ‘facesp/face4.png’, ‘facesp/face2.png’, ‘facesp/face3.png’, ‘facesp/face2.png’, ‘facesp/face3.png’, ‘facesp/face1.png’, ‘facesp/face2.png’, ‘facesp/face1.png’, ‘facesp/face3.png’, ‘facesp/face3.png’, ‘facesp/face5.png’, ‘facesp/face1.png’, ‘facesp/face1.png’, ‘facesp/face5.png’, ‘facesp/face4.png’, ‘facesp/face5.png’, ‘facesp/face2.png’, ‘facesp/face5.png’, ‘facesp/face3.png’, ‘facesp/face4.png’]
3.0225 WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
8.8066 WARNING User requested fullscreen with size [1280 720], but screen is actually [1920, 1080]. Using actual size
1.8516 WARNING Monitor specification not found. Creating a temporary one…
File “C:\Users\Grant\Documents\Claremont Graduate University\2023 Spring\PSY162 Learning and Mem\ML Original Project\OG_project2_copy_lastrun.py”, line 2594, in
test1image.setImage(face_t1(current_t1))
TypeError: ‘list’ object is not callable
################# Experiment ended with exit code 1 [pid:9404] #################

I forgot to mention in the above message that print commands confirm that current_t1 equals 0 before start of the test phase and that there 30 items, as there should be, in the test list.

Well, I feel extremely foolish. The problem with the test pictures is that the picture was set to $face_t1(current_t1) with parentheses rather than $face_t1[current_t1]. This is not the first time I’ve spent a lot of time and stress on this error. May there not be a third time.

For some reason I do not understand, the presentation phase is working with the loop repeats set to 1 with it showing all 15 values despite the image presenting $face_p1[current_p1] . I am very confused and do not understand why it works.

When you start your second loop do you remember to reset your counter to start at 0? Maybe the second time around it’s starting from where you left off and therefore running out of numbers. To debug you should print out the value of that integer current_t1 just before accessing it so you can see what it’s actually doing

I use a separate counter for each trial. So far the trials themselves are working fine, but the loading loop despite being set to only one repetition are loading the list multiple times. Then when it is shuffled, the lists become contaminated rather than being separate and items repeat.

The issue is pretty clearly in your custom code. If you need further help you need to break down to a “minimal working example” of the failing experiment. That means removing ALL components/routines that aren’t relevant to the problem, removing all stimuli (just print the files) etc. When you’ve broken it down to the simplest possible experiment with just a few lines of code then the solution may jump out, or it will be something that others can inspect and help.

Right now, with your full study there’s too much for people to help you any further I think