I want my students to use Psychopy for some reaction time experiments.
As much as I like the idea behind iohub it was a bit unstable for me on a stock Ubuntu install and I find it hard to explain to students without a certain background (psychologists and physicians).
At least for Linux it’s possible to read input events with os timestamps asynchronously to get accurate timestamps in the same process. I’ve prepared a small demo, the output looks as follows:
Using your Logitech USB Optical Mouse Testing blocking reads. Please press a button. You pressed ['BTN_LEFT', 'BTN_MOUSE'] at 1485507073.918361. Testing async reads. I'll sleep for 15 seconds, press some buttons. Don't worry if your mouse doesn't do anything, I've grabbed it. It's optional but helpful in this case. Time's up. Here's what you pressed: You released ['BTN_LEFT', 'BTN_MOUSE'] at 1485507074.022344. You pressed ['BTN_LEFT', 'BTN_MOUSE'] at 1485507075.598357. You released ['BTN_LEFT', 'BTN_MOUSE'] at 1485507075.774361. You pressed BTN_RIGHT at 1485507076.254348. You released BTN_RIGHT at 1485507076.374365. You pressed BTN_MIDDLE at 1485507076.958374. You released BTN_MIDDLE at 1485507077.070364. You pressed ['BTN_LEFT', 'BTN_MOUSE'] at 1485507077.830383. You released ['BTN_LEFT', 'BTN_MOUSE'] at 1485507077.982376.
This could also be done with keyboard and joystick events and enables us to differentiate events from multiple devices (e.g. attach two mice for two participants). The only requirements are read/write access to files in
If you’d be willing to merge this, I would try to write a backend that returns accurate timestamps on linux if
python-evdev is installed and the user has the necessary permissions and falls back to the old input method otherwise.