[open] Randomly present two stimuli from 8 separate lists
Hello,
I am attempting to build an experiment where I will present two picture stimuli at once side by side (on a sketchpad) in a random order and on random sides of the screen. One of the stimuli will be a 'real' while the other will be a 'foil'. Participants merely have to select one of the two stim. However, there are eight different groups to draw the images from (e.g., Real 1 vs Foil 1, Real 2 vs Foil 2, etc), such that the faces being compared always belong to the same group with the exception of 'real' and 'foil'
I've gotten pretty close to getting this to word by some if then statements in the sequence and an sketchpad for each scenario. But the sketchpad is still not appearing. Any help?
This is my in_line script for making the lists:
def my_function():
print 'import random
Genuine_MMA = ['MMA1_Oval.jpg', 'MMA18_Oval.jpg', 'MMA19_Oval.jpg', 'MMA20_Oval.jpg']
Genuine_MMH = ['MMH21_Oval.jpg', 'MMH6_Oval.jpg', 'MMH7_Oval.jpg', 'MMH8_Oval.jpg']
Genuine_MFA = ['MFA1_Oval.jpg', 'MFA20_Oval.jpg', 'MFA3_Oval.jpg', 'MFA4_Oval.jpg']
Genuine_MFH = ['MFH18_Oval.jpg', 'MFH6_Oval.jpg', 'MFH7_Oval.jpg', 'MFH8_Oval.jpg']
Genuine_YMA = ['YMA1_Oval.jpg', 'YMA18_Oval.jpg', 'YMA19_Oval.jpg', 'YMA2_Oval.jpg']
Genuine_YMH = ['YMH20_Oval.jpg', 'YMH6_Oval.jpg', 'YMH7_Oval.jpg', 'YMH8_Oval.jpg']
Genuine_YFA = ['YFA1_Oval.jpg', 'YFA18_Oval.jpg', 'YFA3_Oval.jpg', 'YFA4_Oval.jpg']
Genuine_YFH = ['YFH19_Oval.jpg', 'YFH5_Oval.jpg', 'YFH7_Oval.jpg', 'YFH8_Oval.jpg']
Foil_MMA = ['MMA16_Oval.jpg', 'MMA17_Oval.jpg', 'MMA5_Oval.jpg', 'MMA4_Oval.jpg']
Foil_MMH = ['MMH11_Oval.jpg', 'MMH23_Oval.jpg', 'MMH26_Oval.jpg', 'MMH22_Oval.jpg']
Foil_MFA = ['MFA16_Oval.jpg', 'MFA17_Oval.jpg', 'MFA19_Oval.jpg', 'MFA7_Oval.jpg']
Foil_MFH = ['MFH11_Oval.jpg', 'MFH13_Oval.jpg', 'MFH23_Oval.jpg', 'MFH26_Oval.jpg']
Foil_YMA = ['YMA14_Oval.jpg', 'YMA15_Oval.jpg', 'YMA5_Oval.jpg', 'YMA3_Oval.jpg']
Foil_YMH = ['YMH10_Oval.jpg', 'YMH24_Oval.jpg', 'YMH26_Oval.jpg', 'YMH23_Oval.jpg']
Foil_YFA = ['YFA16_Oval.jpg', 'YFA17_Oval.jpg', 'YFA19_Oval.jpg', 'YFA3_Oval.jpg']
Foil_YFH = ['YFH10_Oval.jpg', 'YFH23_Oval.jpg', 'YFH25_Oval.jpg', 'YFH22_Oval.jpg']
side = ('up','down')
combined_MMA = zip(Genuine_MMA, Foil_MMA)
combined_MMH = zip(Genuine_MMH, Foil_MMH)
combined_MFA = zip(Genuine_MFA, Foil_MFA)
combined_MFH = zip(Genuine_MFH, Foil_MFH)
combined_YMA = zip(Genuine_YMA, Foil_YMA)
combined_YMH = zip(Genuine_YMH, Foil_YMH)
combined_YFA = zip(Genuine_YFA, Foil_YFA)
combined_YFH = zip(Genuine_YFH, Foil_YFH)
combined_all = zip(combined_MMA, combined_MMH, combined_MFA, combined_MFH, combined_YMA, combined_YMH, combined_YFA, combined_YFH)
random.shuffle(combined_all)
combined_MMA[:], combined_MMH[:], combined_MFA[:], combined_MFH[:], combined_YMA[:], combined_YMH[:], combined_YFA[:], combined_YFH[:] = zip(*combined_all)
random.shuffle(combined_MMA)
random.shuffle(combined_MMH)
random.shuffle(combined_MFA)
random.shuffle(combined_MFH)
random.shuffle(combined_YMA)
random.shuffle(combined_YMH)
random.shuffle(combined_YFA)
random.shuffle(combined_YFH)
exp.set('combined_MMA', combined_MMA)
exp.set('combined_MMH', combined_MMH)
exp.set('combined_MFA', combined_MFA)
exp.set('combined_MFH', combined_MFH)
exp.set('combined_YMA', combined_YMA)
exp.set('combined_YMH', combined_YMH)
exp.set('combined_YFA', combined_YFA)
exp.set('combined_YFH', combined_YFH)
Genuine_MMA[:], Foil_MMA[:] = zip(*combined_MMA)
Genuine_MMH[:], Foil_MMH[:] = zip(*combined_MMH)
Genuine_MFA[:], Foil_MFA[:] = zip(*combined_MFA)
Genuine_MFH[:], Foil_MFH[:] = zip(*combined_MFH)
Genuine_YMA[:], Foil_YMA[:] = zip(*combined_YMA)
Genuine_YMH[:], Foil_YMH[:] = zip(*combined_YMH)
Genuine_YFA[:], Foil_YFA[:] = zip(*combined_YFA)
Genuine_YFH[:], Foil_YFH[:] = zip(*combined_YFH)
exp.set('Genuine_MMA', Genuine_MMA)
exp.set('Genuine_MMH', Genuine_MMH)
exp.set('Genuine_MFA', Genuine_MFA)
exp.set('Genuine_MFH', Genuine_MFH)
exp.set('Genuine_YMA', Genuine_YMA)
exp.set('Genuine_YMH', Genuine_YMH)
exp.set('Genuine_YFA', Genuine_YFA)
exp.set('Genuine_YFH', Genuine_YFH)
exp.set('Foil_MMA', Foil_MMA)
exp.set('Foil_MMH', Foil_MMH)
exp.set('Foil_MFA', Foil_MFA)
exp.set('Foil_MFH', Foil_MFH)
exp.set('Foil_YMA', Foil_YMA)
exp.set('Foil_YMH', Foil_YMH)
exp.set('Foil_YFA', Foil_YFA)
exp.set('Foil_YFH', Foil_YFH)
exp.set('side', side)
exp.set('combined_all', combined_all)
'
and here is the pop-in script
def my_function():
print 'import random
Genuine_MMA_pick = Genuine_MMA.pop()
Foil_MMA_pick = Foil_MMA.pop()
Genuine_MMH_pick = Genuine_MMH.pop()
Foil_MMH_pick = Foil_MMH.pop()
Genuine_MFA_pick = Genuine_MFA.pop()
Foil_MFA_pick = Foil_MFA.pop()
Genuine_MFH_pick = Genuine_MFH.pop()
Foil_MFH_pick = Foil_MFH.pop()
Genuine_YMA_pick = Genuine_YMA.pop()
Foil_YMA_pick = Foil_YMA.pop()
Genuine_YMH_pick = Genuine_YMH.pop()
Foil_YMH_pick = Foil_YMH.pop()
Genuine_YFA_pick = Genuine_YFA.pop()
Foil_YFA_pick = Foil_YFA.pop()
Genuine_YFH_pick = Genuine_YFH.pop()
Foil_YFH_pick = Foil_YFH.pop()
Foil_side = random.choice(side)
if Foil_side == 'up':
Genuine_side = 'down'
else:
Genuine_side = 'up'
if Foil_side == 'up':
cor_resp = 'up'
else:
cor_resp = 'down'
exp.set('Foil_side', Foil_side)
exp.set('Genuine_side', Genuine_side)
exp.set('Genuine_MMA_pick', Genuine_MMA_pick)
exp.set('Foil_MMA_pick', Foil_MMA_pick)
exp.set('Genuine_MMH_pick', Genuine_MMH_pick)
exp.set('Foil_MMH_pick', Foil_MMH_pick)
exp.set('Genuine_MFA_pick', Genuine_MFA_pick)
exp.set('Foil_MFA_pick', Foil_MFA_pick)
exp.set('Genuine_MFH_pick', Genuine_MFH_pick)
exp.set('Foil_MFH_pick', Foil_MFH_pick)
exp.set('Genuine_YMA_pick', Genuine_YMA_pick)
exp.set('Foil_YMA_pick', Foil_YMA_pick)
exp.set('Genuine_YMH_pick', Genuine_YMH_pick)
exp.set('Foil_YMH_pick', Foil_YMH_pick)
exp.set('Genuine_YFA_pick', Genuine_YFA_pick)
exp.set('Foil_YFA_pick', Foil_YFA_pick)
exp.set('Genuine_YFH_pick', Genuine_YFH_pick)
exp.set('Foil_YFH_pick', Foil_YFH_pick)
exp.set('cor_resp', cor_resp)
'
And for good measure, here is the if then statements in the sequence:
def my_function():
print 'run foil_MMA_up "[Foil_side] = up and [combined_all] = combined_MMA"
run foil_MMA_down "[Foil_side] = down and [combined_all] = combined_MMA"
run foil_MMH_up "[Foil_side] = up and [combined_all] = combined_MMH"
run foil_MMH_down "[Foil_side] =down and [combined_all] = combined_MMH"
run foil_MFA_up "[Foil_side] = up and [combined_all] = combined_MFA"
run foil_MFA_down "[Foil_side] =down and [combined_all] = combined_MFA"
run foil_MFH_up "[Foil_side] = up and [combined_all] = combined_MFH"
run foil_MFH_down "[Foil_side] =down and [combined_all] = combined_MFH"
run foil_YMA_up "[Foil_side] = up and [combined_all] = combined_YMA"
run foil_YMA_down "[Foil_side] =down and [combined_all] = combined_YMA"
run foil_YMH_up "[Foil_side] = up and [combined_all] = combined_YMH"
run foil_YMH_down "[Foil_side] =down and [combined_all] = combined_YMH"
run foil_YFA_up "[Foil_side] = up and [combined_all] = combined_YFA"
run foil_YFA_down "[Foil_side] =down and [combined_all] = combined_YFA"
run foil_YFH_up "[Foil_side] = up and [combined_all] = combined_YFH"
run foil_YFH_down "[Foil_side] =down and [combined_all] = combined_YFH"
run Recall_keyboard_response "always"
run logger "always"'
I'm apparently stonewalled.
Comments
Hi Troy,
It seems that you picked all your variables thoroughly; (but next time you might want to use a for-loop to mix 'n' match the pictures, so that you don't have to write 100 lines of code!). Honestly, the easiest way to finish up, now that you've everything in the prepare phase of your inline_script, is to draw a canvas in that same prepare phase and display it in the run phase. You won't need a sketchpad.
Every trial, make sure you have a "picture1" and a "picture2" variable. Note that these variables should contain absolute paths to the image files; see also http://osdoc.cogsci.nl/python/canvas/#function-__canvasimage__fname-ynone-xnone-scalenone-centertrue
The "up" and "down" variables could be coordinates. To create the canvas, you add:
Then, in the run phase, you add:
Let me know if this works.
Good luck!
Joshua