Hello all,
WHAT DO I HAVE?
I have an object image list with 127x6 items. Each object has 6 colors. For instance, I have a car with 6 different colors, a book with 6 different colors, etc. Corresponding to each object image, I have a word list with 6 different color names of corresponding objects. E.g. words “Blue Car”, “Pink Car”, “Green Car”, etc. Participants will be presented with images and words simultaneously on the two sides of the screen.
WHAT DO I WANT?
So, I want to randomly select one image among 6 different colors (e.g. image of Blue Car) and randomly select one of the 6 corresponding word colors (e.g. “Pink Car”).
I do not want to manipulate the object name (e.g. I do not want to see the word “Green Book” while presenting a blue car image).
WHAT DID I DO?
Here is what I have created:
Begin experiment :
curr_item = -1
Begin Routine:
curr_item +=1
word = word_list [curr_item]
image = image_list [curr_item]
#this is for every 6 images and words to match within each other. so that the object name will not be manipulated.
if image == image_list [6xcurr_item: curr_itemx6+6]:
word = word_list[6xcurr_item, curr_itemx6]
THIS METHOD DID NOT WORD
Example: Green Car image matched with “Green Car” word. However, what I want is to shuffle the corresponding word list (e.g. I want it to be possible to see the word “Red Car” or one of the other colors)
Excel sheet (different colored columns represents the same object with different colors-normally they are not colored):
Trial Information:
for image:
for text:
Please ignore the “imagery”
Code components
Begin Routine:
Begin Experiment:
SECOND WAY:
SINCE THIS METHOD DID NOT WORK, I TRIED ANOTHER WAY
Defined every 6 image and word options as 6 columns.
Code for images:
columnChoice = [1,2,3,4,5,6]
shuffle(columnChoice)
thisExp.addData(‘imageN’,columnChoice[0])
if columnChoice == 1:
thisImage = image1
elif columnChoice == 2:
thisImage = image2
elif columnChoice == 3:
thisImage = image3
elif columnChoice == 4:
thisImage = image4
elif columnChoice == 5:
thisImage = image5
elif columnChoice == 6:
thisImage = image6
Code for words:
shuffle(columnChoice)
thisExp.addData(‘wordN’,columnChoice[0])
if columnChoice == 1:
thisWord = word1
elif columnChoice == 2:
thisWord = word2
elif columnChoice == 3:
thisWord = word3
elif columnChoice == 4:
thisWord = word4
elif columnChoice == 5:
thisWord = word5
elif columnChoice == 6:
thisWord = word6
Component information:
Other Codes:
ERROR
** It says that the image1 is not defined. **
-
How am I going to define image 1? I mean, 6 columns of images so that they can be randomly selected among 6 columns?
Suggestion was: thisImage = ‘images/’+image6 +’.png’ gave a Syntax Error. -
How am I going to do the first option for word?
thisWord = … ??
I tried defining image1…image6 and word1…word6 as separate empty lists, did not work. I tried to append these all in the image variable, did not work. I tried to append image1, …image6 into image list but did not work either.
I do not have enough coding skills. I would be really appreciated it if you explain it to me step by step.
Thank you.