| Reference | Downloads | Github

Feedback (mean Rt)

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Mac
PsychoPy version (e.g. 1.84.x): 1.84.1

What are you trying to achieve?:
I’m trying to give a mean Rt of the four conditions in the experiment. 1 block has 32 trials. 8 trials per condition. I want psychopy to calculate the mean of each condition (8trials) and present the participant mean Rts to them at the end.

What did you try to make it work?:
I have this at the begining of my experiment:
#msg variable just needs some value at start

This at the beginning of my routine:
if Condition:#1
msg=“RT=%.3f” %(resp.rt + 2)
msg=“RT=%.3f” %(resp.rt)

I also tried the
if resp.corr Condition: #1
msg=“RT=%.3f” %(resp.rt + 2)

**What specifically went wrong when you tried that?: Nothing worked. I’m just not sure how to do this anymore.


Not sure if this is the best way to do this, but spontaneously I would tend to create a dictionary, use the condition names as keys, and append the RT after every trial.


This of course assumes that your condition name is part of the trial, e.g., is coded in an input file you use.

After a block, you could then use the dictionary to calculate the mean RT per condition and present the means as feedback.

Hope this is sufficient as a starting point.


I used this code in the begining of the experiment code and I’m assuming it appended the RTs after the trials. How would I then use it to calculate mean RTs for the condition?
Do I put this as present msg in the experiment on the next routine?

Thank you for your help! It really helped.


To get the condition means into a dictionary, you could do the following:

import numpy as np
meansDict = {}  # create an empty dictionary for the means

for cond in conditionDict:  # loop over the keys in the dictionary
   meansDict[cond] = np.mean(conditionDict[cond])  # calculate means per condition

Hope this helps.