Last updated on September 5, 2019
In this post, I will describe the existing free Python applications and libraries for creating experiments. So far, I have only used PsychoPy but I plan to test most of them. At least the ones that seem to still be maintained. All applications and libraries are open-source which makes it possible to download the source code and add your own stuff to it.
PsychoPy and OpenSesame are two applications for creating psychology, neuroscience, and psychophysics experiments. Both applications are free, open source, alternatives to Presentation™ or e-Prime™. Judging by the number of citations in Google Scholar, PsychoPy seems to be the most frequently used.
PsychoPy is simple to install and is cross-platform (works on Linux, OS-X, and Windows). It promises precision timing and it has a lot of different types of stimuli ready to use. An important aspect of PsychoPy is that if you prefer to write code you can do that using the Application Programming Interface (API). However, if you do not want to write code you can use the builder view. You can see PsychoPy – free software to use in Research for a more extensive post on PsychoPy. If you are interested in an example program you can have a look at Sustained Attention Task In PsychoPy.
OpenSesame is also easy to install and works on Linux, OS-X, Windows, and Android (both tablets, phones, and computers). OpenSesame is based on PsychoPy and the library Expyriment. As far as I can see you are not able to choose to write your own script (i.e., it does not have a coding interface). However, you are probably able to use your own editor and write a script. It is also possible to choose back-end (see About back-ends). That is, you can choose to use xpyriment (Expyriment), psycho (PsychoPy), legacy, opengl, and droid. It seems that xpyriment has replaced the opengl back-end. Much like E-prime, it is possible to write in-line scripts when needed. One interesting option in OpenSesame is that you seem to be able to test your experiment using auto responses. Another interesting feature of OpenSesame is that you seem to be able to create your own plug-ins and extensions.
There are a lot of example experiments on both applications websites as well as in the interfaces. Furthermore, you can also find a lot of guides and tutorials on their websites. There are some example tasks on OpenSesames GitHub Page. If you are interested I have created an OpenSesame Tutorial: How to Create a Flanker Task. In this how-to you will learn how to create a quite simple Psychology experiment, the Flanker Task.
Expyriment, The Vision Egg, and PyEPL are Python libraries. That is, while PsychoPy and OpenSesame offer graphical interfaces where you can create your experiment with minimal knowledge of Python programming the libraries requires you to write scripts. However, their aim seems to be to decrease scripting and seems to be relatively easy to use.
Expyriment is an open-source library and is, of course, also platform independent. Actually, this library is very promising since it also works on Android systems. This library takes cares of the presentation of stimuli. It can handle the recording of both input and output events, communication with other devices, and the collection and preprocessing of data. On the library’s website, it is stated that it suitable for researchers and students with little experience of programming.
I have created a tutorial for Expryiment on how to create a Psychology experiment (e.g., a Flanker task):
The Vision Egg
The Vision Egg is a Python library. The purpose of the library seems to be the production of visual stimuli (the clue might be in its name). Judging from the library’s GitHub page, it has not been updated for roughly 3 years.
PyEPL (the Python Experiment-Programming Library) is the last Python library, I have found, for coding psychology experiments. PyEPL can be used to create both visual and auditory stimuli. It supports both manual (keyboard/joystick) and sound (microphone) input as responses.
Note that for timing critical experiments it is probably wise to write your own scripts PsychoPy API or Expyriment. This will let you use system specific (e.g., Linux specific if using Linux) settings and optimize your experiment based on the hardware available (see Garaizar & Vadillo, 2014 for tests and comparisons of PsychoPy, E-prime, and DMDX).
To summarize, PsychoPy seem to be the only application that offers both coding and builder interfaces. I am, therefore, suggesting that undergraduate students, as well as graduate students and researchers uses it. Naturally, that it is free and not dependent on windows also make it a really strong alternative to proprietary software such as E-prime and Presentation. However, this is true for all the Python based applications and libraries. It might be worth end this post with noting that Python is also a free alternative to Matlab. Personally, I did find Python easier to learn compared to Matlab.
Garaizar, P., & Vadillo, M. A. (2014). Accuracy and Precision of Visual Stimulus Timing in PsychoPy: No Timing Errors in Standard Usage. PLoS ONE, 9(11), e112033. http://doi.org/10.1371/journal.pone.0112033
Garaizar, P., Vadillo, M. A., López-de-Ipiña, D., & Matute, H. (2014). Measuring Software Timing Errors in the Presentation of Visual Stimuli in Cognitive Neuroscience Experiments. PLoS ONE, 9(1), e85108. http://doi.org/10.1371/journal.pone.0085108
Krause, F. & Lindemann, O. (2014). Expyriment: A Python library for cognitive and neuroscientific experiments. Behavior Research Methods, 46(2), 416-428. doi:10.3758/s13428-013-0390-6.
Mathôt, S., Schreij, D., & Theeuwes, J. (2012). OpenSesame: An open-source, graphical experiment builder for the social sciences. Behavior Research Methods, 44(2), 314-324. doi:10.3758/s13428-011-0168-7
Peirce, J. (2010). PsychoPy – Psychology software for Python. Integration The Vlsi Journal.
Peirce, J. W. (2007). PsychoPy-Psychophysics software in Python. Journal of Neuroscience Methods, 162(1-2), 8–13. http://doi.org/10.1016/j.jneumeth.2006.11.017
Straw, Andrew D. (2008) Vision Egg: An Open-Source Library for Realtime Visual Stimulus Generation. Frontiers in Neuroinformatics. doi: 10.3389/neuro.11.004.2008 l