Hi all (this is half linked to my previous topic; I have solved all other issues, apart from this one - see here Resources needed: Dynamic Image Presentation (Tracking, Storing & Randomizing) - #12 by Hans).
I have an effort discounting experiment and want to keep track of the participants’ choices. Currently, this works like a charm. But it has a problem executing the last choice (no matter the code I put in there). I think the problem stems from having to keep RewardLevel and EffortLevel as pairs (since they can’t be separated to do this or the choice is incorrect).
See the code below for more information.
Code from Routine Game_1 - end Routine
experiment_data = pandas.read_excel('decisionsTrials.xlsx')
thisExp.addData('RewardLev', RewardLevel)
thisExp.addData('EffortLev', EffortLevel)
Code from Routine Game_1 - end Routine
if Choice.keys == '2':
Comb = [RewardLevel, EffortLevel]
thisExp.addData('Comb', Comb)
elif Choice.keys == '1':
Comb = [1, 1]
thisExp.addData('Comb', Comb)
I have tried multiple things (and I don’t want to bore you with them all, but it includes using an empty list, etc.), and this code works (but it doesn’t compare against all the choices previously made—only the most recent, which is problematic). As I said, it stores the choices perfectly (see my screenshot at the end of this post).
What I want to achieve: Currently, it stores choices, so I want it to take all the choices made in that routine (/round) and pick the ‘best choice’, the pair with the lowest effort and highest reward.
In my Routine - end Routine (called Routine since this was an attempt to fix the issue)
if Comb[0] == 6:
rl = 't6.png'
elif Comb[0] == 5:
rl = 't5.png'
elif Comb[0] == 4:
rl = 't4.png'
elif Comb[0] == 3:
rl = 't3.png'
elif Comb[0] == 2:
rl = 't2.png'
elif Comb[0] == 1:
rl = 't1.png'
In my Routine - end Routine (same as above)
if Comb[1] == 2:
el = 'b2.png'
selected_rows = '10:21'
elif Comb[1] == 3:
el = 'b3.png'
selected_rows = '22:30'
elif Comb[1] == 4:
el = 'b4.png'
selected_rows = '31:39'
elif Comb[1] == 5:
el = 'b5.png'
selected_rows = '40:51'
elif Comb[1] == 6:
el = 'b6.png'
selected_rows = '52:60'
elif Comb[1] == 1:
el = 'b1.png'
selected_rows = '0:9'
Any help would be greatly appreciated or any ideas.