Hello,
I have a ‘reward amount’ that varies every trial. Currently I have a parameter ‘rewards’ that is a vector of reward options:
rewards = ['$0.25','$0.50','$1','$2','$4','$8','$16','$32']
Currently every trial displays a different reward randomly:
current_reward = random.choice(rewards)
reward_amnt.setText(current_reward)
I would like the amounts offered in ‘rewards’ to be different depending on which section of the task the participant is in. So in the high reward section the rewards would be [’$8’,’$16’,’$32’]. For the low reward section the rewards would be [’$0.25’,’$0.50’,’$1’,’$2’]. And for the all rewards section the rewards would remain the same as above.
I have created an array called myvec that is one column and 16-1000 rows (depending on how many trials aka rows I would like). The column is build of a series of either 1,2 or 3. I would like the 1 to represent the all reward section. The 2 to represent high reward section and the 3 to represent low reward section.
For example:
array([[1],
[1],
[1],
[1],
[2],
[2],
[2],
[2],
[1],
[1],
[1],
[1],
[3],
[3],
[3],
[3]])
I chose an array because I could easily manipulate the amount of rows and section length. In the above array the section length is 4.
I have this sample draft code that will vary the rewards in the fashion I want:
for i in range(0,len(myvec)):
if myvec[i,0] == 1:
rewards = ['$0.25','$0.50','$1','$2','$4','$8','$16','$32']
elif myvec [i,0]== 2:
rewards = ['$8','$16','$32']
else:
rewards = ['$0.25','$0.50','$1','$2']
My current issue is that I don’t know how to make this code interact with my task code so far. I’m not sure if there is a specific field to place it on builder or coder so that the trial handler that creates the loops interacts with this.
Essentially every row of the array would be a trial. And therefore I know it should interact with the loop I created in builder, but I’m not sure how. Any help would be great, thank you!!