Create visual array of pictures with presented and new objects

Ok, that looks fine. Could you please enter

print(Targets)
print(TargetsAndDistractors)

after the current code and look into the console in the runner which values are printed?

I put the code into the targets and distractors code component. and the runner gave the following:

Generating PsychoPy scriptā€¦

################## Running: C:\Users\sarah\Desktop\OMT\OMT.py ##################
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. Contribute - pygame wiki
[5, 4]
[5, 4, 2, 3, 0, 1]
[5, 4]
6
[5, 4, 2, 3, 0, 1]
6
6.2477 WARNING User requested fullscreen with size [1680 1050], but screen is actually [1920, 1200]. Using actual size
1.1268 WARNING Monitor specification not found. Creating a temporary oneā€¦
ioHub Server Process Completed With Code: 0
################ Experiment ended with exit code 0 [pid:14772] #################

Do you have an idea why it got printed 3 times? Should have only been once.
Also, did you change something in the code? Because the first print should simply be the first 3 elements of the second.

I made a little example that you can compare to what you are doing in your experiment.

stimuli.xlsx (8.7 KB)
example.psyexp (13.1 KB)

Iā€™m not sure why it printed 3 times my code looks like:

import random
TargetsAndDistractors = random.sample(range(6), 6)
Targets = TargetsAndDistractors[0:3]
print(Targets)
print(TargetsAndDistractors)

and the runner output:

Generating PsychoPy scriptā€¦

############## Running: C:\Users\sarah\Desktop\OMT\OMT_lastrun.py ##############
459.7312 EXP Imported omtprac.xlsx as conditions, 6 conditions, 1 params
459.7356 EXP Imported omtprac.xlsx as conditions, 6 conditions, 1 params
459.7356 WARNING duplicate variable names: image
459.7376 INFO Loaded monitor calibration from [ā€˜2022_09_14 11:58ā€™]
459.7757 EXP Imported omtprac.xlsx as conditions, 6 conditions, 1 params
459.7793 EXP Imported omtprac.xlsx as conditions, 6 conditions, 1 params
459.7793 WARNING duplicate variable names: image
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. Contribute - pygame wiki
[0, 4, 2]
[0, 4, 2, 3, 5, 1]
[0, 4, 2]
6
[0, 4, 2, 3, 5, 1]
6
5.2626 WARNING User requested fullscreen with size [1680 1050], but screen is actually [1920, 1200]. Using actual size
1.1207 WARNING Monitor specification not found. Creating a temporary oneā€¦
ioHub Server Process Completed With Code: 0
################# Experiment ended with exit code 0 [pid:6652] #################
482.4982 EXP Imported omtprac.xlsx as conditions, 6 conditions, 1 params
482.5018 EXP Imported omtprac.xlsx as conditions, 6 conditions, 1 params
482.5018 WARNING duplicate variable names: image
482.5045 INFO Loaded monitor calibration from [ā€˜2022_09_14 11:58ā€™]

The program is only showing 1 picture and then only 1 (not the same) picture for the response screen.

The example I posted above works fine with exactly this code. Please compare your experiment to the example to find out whatā€™s wrong.

The stimuli are appearing as they should during the first presentation! But the response page only shows one image, which is the same as your experiment only showing one letter.

Do you know how I might make this into an array of the images identified as targets and distractors?

Sorry, I only now understand that you want to present all targets and distractors in the same screen, not one after the other. Is that correct?

In case it is, you can this as a blueprint to work off:

stimuli.xlsx (8.6 KB)
example.psyexp (19.4 KB)
jpg|500x500

yeah, Iā€™m sorry about not clarifying that aspect

The code is working at 80%. The presentation of targets and distractors in the last routine are only showing 4 images. Iā€™ve been doing a line by line code comparison, but Iā€™m not sure where Iā€™m gonig wrong.

Could you upload your experiment? Then I could also have a look.

OMT.psyexp (50.0 KB)
omtprac.xlsx (8.7 KB)
OMT.py (24.2 KB)
0006

0002
0003
0004
0005
0001

Could you edit this post by removing the ā€œ!ā€ at the start of the line? This way, I can download the images easier. Also, one image is missing, right?

Nevermind, I found the problem: In the ā€œselected rowsā€ field for the loop, use $TargetsAndDistractors.

I do have that in the field

In what I posted there is only one loop and there you need to have that.

I went through my experiements code again with yours next to it. I couldnā€™t get mine to do what yours does, so I used your experiment as a skeleton and changed the stimuli to represent mine and it works perfect!

I still donā€™t know where I was going wrong, and I may eventually go back and do some more digging for learning purposes.

I hope itā€™s okay that I used your experiment file.

Thank you so much! You are an angel and I am so happy/relieved/excited to finally move forward with this project. Iā€™ve been working on this one task for a few months now, so againā€¦thank you so much!!

1 Like