I am using Psychopy and this code for measuring keystroke duration as suggested in this answer for my previous question:
from psychopy.iohub import launchHubServer
io = launchHubServer()
keyboard = io.devices.keyboard
count = 0
keyinfo = ""
duration = 0
key = ""
io.clearEvents('all')
print 'begin'
while key not in ['escape', 'esc']:
key_info = keyboard.waitForReleases()[0]
count += 1
key = key_info.key
keyinfo = key_info
duration = key_info.duration
key = key_info.key
print 'round number:' , count
print key_info
print 'Press time was', key_info.duration
print 'key', key_info.key
The first tests look promising, but I was wondering if there is a difference in accuracy between iohub
or pyglet
function in Psychopy? Or if there would even be a more accurate solution than using one of theses two? And how is the measurement of the keystroke duration. I've been searching for it but haven't found any data for windows. The only thing I found are these tests
Has someone stumbled across a publication regarding the accuracy?
Moreover I don’t know how good RAM and CPU would need to be, right know I am using an ASUS notebook with Intel Core i7 2.6 GHz and 16GB RAM, (Bluetooth, Ethernet. Wi-Fi, Mobile and other kind of connections disabled; desktop visual effects disabled; antivirus, software updates, background programs, and other kind of asynchronous events sources disabled) and the last version of PsychoPy2.
I tried to do preliminary tests to measure the accuracy of my test and to measure the keystroke duration with Psychopy and my keyboard simulating device. Before renting more expensive equipment, I've tried to pretest the accuracy with a 60 fps camera recording the moment of touch and without touch to the device and measuring with Psychopy at the same, to be able to compare these to values to have the accuracy. The 60 fps means, that in between frames there are 16.67 ms. My cheap camera pretest showed, that most of the processing time would be a maximum of approximately 8ms, so that I think I will achieve even lower values with better recording equipment with a higher framerate. But approximately every tenth measurement I have 24-36 ms signal processing.
My questions summarized:
- Does anyone know, what the reason might be that approximately every tenth measurement has higher signal processing times?
- How could I make the measurement of the keystroke duration more accurate?
- Has anyone measured the keystroke duration accuracy of psychopys2 different functions (e.g
iohub
andpyglet
) in windows himself or stumbled upon literature about this?