You are here

Programming Experiments in Python

Programming Experiments in Python

February 2019 | 297 pages | SAGE Publications Ltd

Python is a free, open-source, cross-platform programming language that allows a great deal to be accomplished in very few lines of code. As well as having a powerful, flexible syntax, Python can interface easily with other libraries and hardware on any computer system, making it ideal for interacting with additional devices hardware (e.g. for fMRI, EEG, eye tracking etc.). Python has become the go-to language for a wide variety of behavioural science studies and experiments.

Aimed at advanced undergraduate students, postgraduate students and professional scientists, this textbook provides a comprehensive guide to enable readers to write experiments in Python, or using Python within PsychoPy. This text offers a more advanced guide to developing psychological experiments in Python and can be used as a guide to using software and hardware together – for example, programming a psychological experiment using eye tracking software or EEG systems.  Highly practical in nature, the book shows how to programme one full experiment and how to analyse data and scripting.


Read together with Building Experiments in PsychoPy, this text is designed to support students who are familiar with PsychoPy and how want to progress into programming in the original software package Python (on which PsychoPy is built).  It will help advanced students to programme directly in Python and support them when they use hardware in their experiments, and it particularly suited to those students programming experiments in cognitive psychology and neuroscience. 
Python Programming basics
Python for MATLAB migrants
Coding a full experiment: Posner cuing task
Improving the Posner task
Understanding your hardware
Other PsychoPy stimuli
Using Rating Scales
Connecting to hardware with ioHub
Using adaptive methods to find thresholds
Combining PsychoPy Builder experiments with code
Good coding practices
Data analysis
Using Python for all your scripting needs
Using Python for neuroimaging
Advanced Features of PsychoPy

Preview this book

For instructors

Select a Purchasing Option

ISBN: 9781473991415

ISBN: 9781473991408