Saving data from one routine to use on following routines

I made a staircase routine to find out each participant’s thresholds for a visual stimuli.

I’m trying to use the individual thresholds for the following routines.

Thus, I need to save the threshold value(the mean of last 4 trials)of the 1st routine, and use that value on the following tasks(feature task)

Is there a way to save the data temporarily?

Hi Eugene,

Yes, you can use a code component! Create a variable at the beginning of the experiment whose value is []:

thStore = []

then at the end of each routine use .append() to append the threshold value to it:


then, at the beginning of your feature task, you can calculate the mean:

value = (thStore[-1] + thStore[-2] + thStore[-3] + thStore [-4])/4
1 Like

What I did to store the last four items would look like

if len(thStore)>4:

You can then just use sum(thStore)/4 or np.mean(thStore) to find the average.

1 Like

thank you! this worked perfectly.