| Reference | Downloads | Github

Increase processing rate of code

Hi there,

we want to process eyetracking data (e.g. microsaccades) with 500 Hz via psychopy. However, maximum processing rate of code seems to depend solely on the monitor’s refresh rate.Is there any possibility to change this value, other than buying a 500 Hz monitor?

Would be glad if anyone could help.


Hi Lukas,

(1) ioHub is designed to work in parallel with PsychoPy, recording eye tracking data asynchronously, at the native rate of the tracker rather than the screen. Look at one of the demos under the demo menu in the Coder view.

(2) having code execute only once every screen refresh isn’t compulsory if you write your own PsychoPy code, but it sure makes things easier. Would definitely suggest keeping the psychoPy drawing loop at the rate of your screen, and using ioHub for collecting data independently at a higher rate.

Hi Michael,

thank you for your reply!

Collecting data at the desired rate is surely possible via ioHub. But how can I run calculations or check conditional statements based on that data at a higher rate?

You’d have to be more specific what those calculations are. It might be possible that you only need to run them at 60 Hz (because, at the end of the day, you can’t update the screen in response to any calculations faster than that) but that you access the ioHub data store for more data samples rather than the current one.

e.g. if you are testing for a velocity threshold and will change the display if it exceeds some value, you only need to do this calculation at 60 Hz, as there is no point in running the calculation faster than you can give feedback on it. But you would need to access the previous, say, 20 ms or so of data to get a good estimate of velocity in a moving window. So your code would run syncronously with the screen, but it could utilise data collected asynchronously by ioHub.

One implementation of mine is very similar to your example. A target should change when gaze reaches a specific position during a saccade. The advantage of running the code that changes the target variable at 500 Hz instead of 60 Hz is that it takes a maximum of 1/60 s (screen refresh) until the change is diplayed compared to a maximum of 2/60 s when running everything at 60 Hz.