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.