Expyriment: A Python library for cognitive and neuroscientific experiments

An Erratum to this article was published on 24 January 2014


Expyriment is an open-source and platform-independent lightweight Python library for designing and conducting timing-critical behavioral and neuroimaging experiments. The major goal is to provide a well-structured Python library for script-based experiment development, with a high priority being the readability of the resulting program code. Expyriment has been tested extensively under Linux and Windows and is an all-in-one solution, as it handles stimulus presentation, the recording of input/output events, communication with other devices, and the collection and preprocessing of data. Furthermore, it offers a hierarchical design structure, which allows for an intuitive transition from the experimental design to a running program. It is therefore also suited for students, as well as for experimental psychologists and neuroscientists with little programming experience.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2
Fig. 3


  1. 1.

    www.debian.org. For the use of GNU/Linux in the field of neuroscience, see Hanke and Halchenko (2011).

  2. 2.


  3. 3.


  4. 4.

    Note that each Expyriment stimulus can be integrated into the design hierarchy as well, using the method.

  5. 5.



  1. Bassi, S. (2007). A primer on Python for life science researchers. PLoS Computational Biology, 3, e199.

    PubMed Central  PubMed  Article  Google Scholar 

  2. Brainard, D. H. (1997). The Psychophysics Toolbox. Spatial Vision, 10, 433–436. doi:10.1163/156856897X00357

    PubMed  Article  Google Scholar 

  3. Free Software Foundation. (2007). GNU General Public Licence. Retrieved from www.gnu.org/copyleft/gpl.html

  4. Halchenko, Y. O., & Hanke, M. (2012). Open is not enough. Let’s take the next step: An integrated, community-driven computing platform for neuroscience. Frontiers in Neuroinformatics, 6, 22. doi:10.3389/fninf.2012.00022

    PubMed Central  PubMed  Article  Google Scholar 

  5. Hanke, M., & Halchenko, Y. O. (2011). Neuroscience runs on GNU/Linux. Frontiers in Neuroinformatics, 5, 8. doi:10.3389/fninf.2011.00008

    PubMed Central  PubMed  Article  Google Scholar 

  6. Hommel, B. (1993). Inverting the Simon effect by intention: Determinants of direction and extent of effects of irrelevant spatial information. Psychological Research, 55, 270–279. doi:10.1007/BF00419687

    Article  Google Scholar 

  7. Jones, E., Oliphant, T. E., Peterson, P., et al. (2001). SciPy: Open source scientific tools for Python [Computer software]. Retrieved from www.scipy.org

  8. Mathôt, S., Schreij, D., & Theeuwes, J. (2012). OpenSesame: An open-source, graphical experiment builder for the social sciences. Behavior Research Methods, 44, 314–324. doi:10.3758/s13428-011-0168-7

    PubMed Central  PubMed  Article  Google Scholar 

  9. Oliphant, T. E. (2006). Guide to NumPy. Trelgol Publishing.

  10. Peirce, J. W. (2007). PsychoPy: Psychophysics software in Python. Journal of Neuroscience Methods, 162, 8–13.

    PubMed Central  PubMed  Article  Google Scholar 

  11. PyOpenGL. (2012). [Computer software]. Retrieved from http://pyopengl.sourceforge.net

  12. PySerial. (2012). [Computer software]. Retrieved from http://pyserial.sourceforge.net

  13. R Development Core Team. (2012). R: A language and environment for statistical computing. Vienna, Austria: R Foundation for Statistical Computing. Retrieved from www.R-project.org

    Google Scholar 

  14. Shinners, P. (2012). Pygame [Computer software]. Retrieved from www.pygame.org

  15. Stahl, C. (2006). Software for generating psychological experiments. Experimental Psychology, 53, 218–232.

    PubMed  Article  Google Scholar 

  16. Straw, A. D. (2008). Vision Egg: An open-source library for realtime visual stimulus generation. Frontiers in Neuroinformatics, 2(4), 1–10. doi:10.3389/neuro.11.004.2008

    Google Scholar 

  17. Van Rossum, G., & Drake, F. L. (2011). Python language reference manual. Bristol, UK: Network Theory Ltd.

    Google Scholar 

Download references


We thank Pascal de Water for great technical support, Sebastiaan Mathôt for his code evaluation and for choosing Expyriment as the default back end of OpenSesame 0.27, as well as dozens of students and colleagues for using old preliminary versions of Expyriment for their studies. Without their feedback, Exypriment would not have reached the level of a stable and reliable experiment programming library.

Author information



Corresponding author

Correspondence to Florian Krause.



Listing 1

Programming code for a response time experiment to assess a spatial stimulus–response compatibility effect (the Simon effect; Hommel, 1993)

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Krause, F., Lindemann, O. Expyriment: A Python library for cognitive and neuroscientific experiments. Behav Res 46, 416–428 (2014). https://doi.org/10.3758/s13428-013-0390-6

Download citation


  • Software
  • Programming library
  • Python
  • Experimental design
  • Stimulus presentation