About

PyGaze acts as a wrapper around several existing packages, among which PyGame, PsychoPy, pylink (for SR Research EyeLink systems), SensoMotoric Instruments’ iViewX API, and the Tobii SDK. What it adds to these is a uniform and user-friendly syntax, as well as some gaze contingent functionality and custom online event detection (please refer to our paper for the algorithm details). PyGaze is aimed at people with minor to advanced programming skills, preferably in Python 2.X. Do not be alarmed by this, though, as Python is surprisingly easy to learn.

Why Python?

First of all, Python is open-source. This is great for two reasons: 1) it is completely free to use Python and 2) the source code is available, meaning you could know exactly what Python does. With proprietary software it often is unclear what happens ‘under the hood’, so it is likely you might not be aware of sources of extra noise. In experimental psychology, where people are willing to spend lots of money on hardware that reduces noise by only a little bit (think of EEG equipment), this is no minor thing. Another major advantage of Python, is it’s portability: Python will run on pretty much everything (I once heard a story of somebody installing it on a potato, but that might be slightly fabricated).

Why PyGaze?

PyGaze offers a platform that is more user-friendly than the currently existing alternatives, when it comes to creating complicated experiments (or other software). From stimulus presentation to eye-tracker communication: everything can be handled by via PyGaze scripting. Of course, we do rely heavily on all the brilliant dependencies (see the links in the first paragraph) and you could do pretty much the same if you were to use each of these independently, but this would require more programming skills and would cost more effort and time than when you would use PyGaze. Apart from this, PyGaze does come with some added functionality. For example, we provide an implementation of a saccade detection algorithm that was specifically designed for online detection (for details, please refer to our paper).

Another very cool feature is that you do not have to adjust your code to switch between eye-trackers. If you are using an EyeLink 1000 and you want to share your code with an overseas colleague who uses SMI equipment, you can. Just email your code and your colleague can run it on his own computer using whatever operating system, since PyGaze supports Windows, Linux and Mac OSX.

Benchmark tests for PyGaze have been performed on EyeLink, iViewX, and Tobii setups. Results, raw data, and scripts are provided here.

What if I am…

…not experienced

If you have no experience in programming whatsoever and are looking for a very easy way to build an experiment, you’re very welcome to try using Python and PyGaze, but you could have a look at graphical experiment builders as well. These will allow you to create your own experiments in a drag ‘n drop interface, which is way easier than programming, but limits freedom and flexibility as well. We recommend OpenSesame, an excellent and free experiment builder. If you are eager to learn how to program, this A Byte of Python e-book (warning: GIANT pdf, do not click if you’re not ready for a big download) might be a very useful guide to get you started with Python 2.

…a novice

If you’re a novice programmer, PyGaze might be exactly what you’re looking for: programming experiments is easy and the functionality our package offers is very large. Please do be aware that basic knowledge of the Python language helps quite a lot in understanding how to use PyGaze. You do not have to fully grasp the concept of classes, nor do you have to know how to create your own, but you do need to be able to import them and use them within a script. Have a look at the examples; if you understand those, you’ll be fine.

…a PROgrammer

If you’re already an experienced programmer PyGaze could still be very useful to you, since its short syntax allows you to program very quickly. Apart from this, we might need you too! If you want to help us out with expanding and improving PyGaze, please contact the developers or fork our GitHub repository.

Paper

If you’re looking for more information, please read our paper in Behavior Research Methods (reference is listed below). If you do not have access to the journal, you can download the manuscript here. Please note that there may be some slight differences between the published version and the manuscript.

  • Dalmaijer, E.S., Mathôt, S., & Van der Stigchel, S. (2014). PyGaze: an open-source, cross-platform toolbox for minimal-effort programming of eye tracking experiments. Behavior Research Methods, 46, 913-921. doi:10.3758/s13428-013-0422-2

Comments are closed