logging simultaneous key presses
I have got a problem with simultaneous key presses on one of the same stimulus.
I know that python/OS works in sequence and not in parallel. Nevertheless, I assume that on ms (or even microseconds?) two keys are very rarely pressed at the same time by human subjects.
Here is a little experiment that requires two key presses after a stimulus.
kb = keyboard(keylist = ['f','g','h','j','LSHIFT','RSHIFT','d','k']) A = canvas() A.text('A') B = canvas() B.text('B') seq=[1,2] print seq, len(seq), (len(seq)-1), seq seq = [A,B]*5 for i in range(10): t = seq[i].show() var.T_Stim = t if seq[i] == A: var.Stim = 'A' elif seq[i] == B: var.Stim ='B' key, time = kb.get_key() var.Resp=key var.T_Resp=time log.write_vars() key, time = kb.get_key() var.Resp=key var.T_Resp=time log.write_vars()
When i run the experiment i noticed that for almost simultaneous presses (difference ca. < 16ms) only one key is counted. I have to press a third time. The third is logged, together with one of the first.
An idea that came to my mind is that it might have to do with "keydown/keylift", because the first key is not lifted before the second key is pressed. I played around with this, and that is not the problem.
I am not sure whether there is a debounce interval in open sesame (in presentation you can manually set the debounce intervall, although this counts for presses of the same key only). Or does the get_key() command need so much time for processing?
Any ideas how to solve this?