Calculate response time limit from the last 5 trials
Hello,
I got a question about how to calculate a maximum for response time.
In my study participants see a visual stimuli for a very short moment. After that they have to decide if they have seen the stimuli or not. The experiment begins with a adaptation phase of 20 trials with an unlimited response time for each trial.
In the next block the maximum response time should be limited to raise time pressure. I want to set the maximum response time by taking the median of the last 5 response times in the adaptation phase + a 250ms buffer.
Until now I can't find a solution for this issue.
This is what I tried so far:

Thank you very much for your help!!
Comments
found a solution - inline script:
for response_time in responses:
print(responses.response_time)
print('last_five response_times:')
print(responses.response_time[:5])
var.response_time_lastfive_adapt = responses.response_time[:5]
print (var.response_time_lastfive_adapt)
l = var.response_time_lastfive_adapt
l.sort()
count = len(l)
if count % 2:
median = l[count/2]
else:
median = (l[count/2-1] + l[count/2]) / 2.0
print('median_response_time_lastfive_adapt:')
print median
var.max_response_time_practice = median+250
print('max_response_time_practice:')
print var.max_response_time_practice