Stimulus delivery for neuroscience and psychophysics: a PsychoPy course
Welcome to this course on proper stimulus delivery for psychophysics using PsychoPy. PsychoPy has a number of advantages over E-Prime and Presentation. Notably it’s free and cross-platform, making it easy to get started and to collaborate. In addition, I think that PsychoPy encourages you to get better visual timing and total control of your experiment. Finally, since PsychoPy is called from Python, you have the full power equivalent to MATLAB, R, etc. at your fingertips, just an “import” away.
The full copy- and paste ready course materials are available on the course’s github page. Two particularly useful products of this course is the ppc.py helper module and the experimental template, which concludes the course. They should make it a breeze to write up your next experiment.
Day 1: Getting started
This is all about setting up a good development environment and get your python skills up to speed.
- Follow the Getting started guide to install psychopy and an editor.
- See the motivational presentation on why psychopy is great.
- Follow this introduction and exercises on python basics for psychopy coding.
Here’s the instructor’s notes for day 1.
Day 2: Stimulus precision
This contains code and guides on how to control stimulus appearance and timing. This section of the course is dedicated to the prevention of common pitfalls.
- All the following topics for this day are complemented by some slides which show the underlying theory and summarises best practices.
- We with code and exercises that introduces some of the most common psychopy stimuli and present them using visual angle for size and how to do isoluminant colors using the DKL colorspace.
- Code and exercises on the exact timing of visual and auditory stimuli. There’s also some examples of good and (common) bad practices for timing and a rescue script in case your system does not sync to the monitor’s update intervals.
- A brief introductory code example on collecting key responses using the iohub module rather than the event module.
See also instructor’s notes for day 2.
Day 3: Experimental control
This will build on the skills learned during day 1 and 2 to build a full experiment with intro dialogue box, multiple conditions, precise stimulus delivery, saving data, etc. It really only consists of an experiment template which you can use to copy-paste useful bits from and which easily extends to more complicated situations. I also consider different ways of handling trials.
See instructor’s notes for day 3, including exercises to build the template experiment from scratch.
These pages contain all the material for the course, including scripts (thoroughly commented and copy-and-paste ready), exercises, and slides. One of my primary motivations for doing this course is to help people design cool experiments without committing rookie mistakes. It also contains notes for instructors (in the presentations folder on github)
Feel free to use all content here. Attribution is nice but not mandatory. If you’re new to psychopy, go through the menu in chronological order. The course materials are licensed under the GNU GPL2 license, meaning that you are free to do with it what you want, but must keep it open source.
Contact and recent courses
I’m happy to hear from you if you’d like to organize a PsychoPy course. In addition, I’m a fairly quick Python/PsychoPy developer with a flair for precision and stability, so feel free to contact me for a code-for-authorship collaboration if you need someone to write up your next experiment.
- Jan, 2014: Center for Functionally Integrative Neuroscience, Aarhus University.
- Feb, 2014: Cognition and Behavior Lab, Aarhus University.
- May 2015: Cognition and Behavior Lab, Aarhus Univeristy.