I’m starting to build a pairwise comparison task with image. Two image appear in the same time on the screen (one at the left and one at the right).
My problem is : when I’m running the experiment the two image are the same cause in the Excel file there is the same image paired.
hi @Milena this might not be the best way to do it, but…
you could write Python code to generate an excel file for each subject as the experiment is starting that randomizes the order of each column.
you could have the master file above live in your experiment directory, then create a per-subject file on the fly when the experiment is run. then in the ‘Conditions’ field, you could have a variable referring to the per-subject file.
What I do in this circumstance is have the columns fixed and shuffle a list of coordinates (or x positions) each trial. Make sure you save the x position of the target
Then add locations[0] as the position for one image and locations[1] as the position for the other, to be updated each routine.
If your task is to say which food has more calories, then you could put the higher calorie food in aliment1 and then add code in Begin Routine for to calculate the correct answer:
But it doesn’t work
When I run my experiment with the code I have this error message :
3.0738 WARNING User requested fullscreen with size [1024 768], but screen is actually [1920, 1080]. Using actual size
Traceback (most recent call last):
File “C:\Users\Milena\Desktop\EXP\untitled_lastrun.py”, line 201, in
shuffle(locations)
File “mtrand.pyx”, line 4417, in numpy.random.mtrand.RandomState.shuffle
TypeError: object of type ‘int’ has no len()
This code is about saving the location of the first column
The first word (in quotes) is the name of the column in the data file
The second word (no quotes) is the variable to be saved. locations[0][0] should just save the x coordinate
If you want to also save the x coordinate of the second location, it should be
At the moment you are seeing the same image on both sides because you have the same image twice in each row of your Excel file.
Would you prefer to
a. Have each image paired with a specific other image, but randomise which one is on the left or
b. Randomly pair images from your image set?
In this demo there is an outer loop that cycles through all stimuli. However, the trial itself is only presented on odd-numbered iterations of the outer loop (remember that the numbering starts from zero). The even numbered iterations save the stimulus to a variable ready to be used in the next trial.
Hi there, how does this code work for images? I’m a programming newbie and my input is a slider not a click answer like you have it. The respondents need to make a pairwise comparison between the two images.
In my case, I’ve already pre-combined the 6 images into 15 pairs so that they don’t appear twice (see Excel file below).
What I’m currently stumped on, is how to randomize the relative position of the pairs (so that 001.jpg isn’t always on the left and 006.jpg isn’t always on the right, for example).
Is my strategy all wrong? Should I be importing each image in like OP did?
Have a column for the target and another for the foil. Use locations[0] for the target location and locations[1] for the foil location. (where locations = [[-.3,0],[3,0]] and shuffled)