I am using Psychopy and this code for measuring keystroke duration as suggested in this answer for my question “Freeware for measuring keystroke duration” https://cogsci.stackexchange.com/questions/17454/freeware-for-measuring-keystroke-duration. Therefore this question was also asked in the cognitive science stackexchange some days ago without any luck, but hopefully I can find the experts concerning this topic here.
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 https://groups.google.com/forum/m/#!topic/psychopy-dev/u3WyDfnIYBo but I don’t know, how the measurements changed with further development of psychopy, and how exactly these command behave on windows. 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 campare 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 measruement of the keystroke duration more accurate?
- Will saving the data into an excelsheet change the accuracy?
- Has anyone measured the keystroke duration accuracy of psychopys2 different functions (e.g iohub and pyglet) in windows himself or stumbled upon literature about this?
Help would be much appreciated!