psychopy.org | Reference | Downloads | Github

Reaction time in visual search task

Hello,

I am building a visual search task and I would like people to get rewarded based on their reaction time (RT). instead of giving a reward like I do here to all responses quicker than 1.05 seconds, i want to give reward to all responses which are below the median RT of each individual participant. In other words keep recording the RT of each participant in all trials and then put as an RT benchamark their median RT (which I guess will roughly keep changing throughout the experiment). Is this possible? How can I edit the code below to achieve this?

     if trial_resp.rt <= 1.05:
         playsound = soundfile[1]
         msg = "Correct! You have won 7 points!"
         msgColor = "green"
         score = score + 7
     else:
          playsound = soundfile[3]
          msg = "Too slow! No reward."

Thank you