Adaptive sketchpad duration based on accuracy in previous trials
I hope I didn't overlook a discussion that might answer my question already.
A brief background: I am conducting a study in which participants see an array of 3D objects and have to indicate whether or not the target was among the stimuli. However, I want to combine the search task with a priming design. So one trial in my experiment consists of two search displays (interrupted by a blank for 50 ms). The objects remain the same in both displays but can be illuminated from either the left or the right.
Now to my question: I would like to adapt the presentation duration of each search display based on the participant's performance in the previous 10 trials. I tried to achieve this via the following inline-script (I set the variable "dur" (=duration) already at the beginning of the experiment to 995 ms):
#get number of trials no_trials = self.get("count_trial_sequence_main") #if number of trials is 10 (if the rest after division by 11 is 10) #do adaption process if no_trials%11 == 10: #get presentation duration pres = self.get("dur") #access the results from the last 10 trials #(make them a float so division gives decimals) res=float(sum(responses.correct[:10])) #kind of redundand, but divide sum of 0s (incorrect) and 1s (correct) #from last 10 trials by 10 for var.recent_acc = res/10 #we decrease presentation time by 100 ms if participants perform good (> 80%) if var.recent_acc > 0.80: var.dur = pres - 100 #we increase presentation time by 100 ms if participants perform poor (< 80%) if var.recent_acc < 0.80: var.dur = pres + 100 #Although it will never happen, stimulus presentation is at least 50 ms if var.dur <= 0: var.dur = 45 </pre> This script works fine if i only have one keyboard response. However, both search displays are presented for 995 ms (well, kind of) and participants can make a response at any point. Hence, my trial sequence looks like this:
When I conduct my experiment like this, the variable "dur" just increases and the search displays are presented longer and longer. I guess the multiple keyboard responses mess up the logged accuracies but I don't know how to prevent that from happening.
Thanks for any suggestions!