This is a course on how to write experiments in Python using the PsychoPy module. After this course, you should be well suited to design your own cool experiments from scratch without too much trouble or rookie mistakes!
This course does require that you have some basic skills at the outset. You should be familiar with computerized experiments (know terms like trial, block, fixation cross, reaction time etc.) and know basic programming. If you can answer what is printed in the small script below within a few minutes, you should be good. If not, you will have a hard time following the course.
# Generate a sequence of numbers.
trials = [2, 3, 4, 5]
# Give "result" a new value
result = 0
for i in trials:
if i != 3 and i < 5:
result += i
# Quiz: what is the value of "result"?
Day 1: python basics
We’re going to stay in pure python for a full day. Python is a beautiful programming language and this time will be very well spent! Day 2 and 3 are going to be pure python programming and we want to make sure that all of you know enough Python so that it is your friend and not your enemy when we load the psychopy module and start digging into the fun stuff.
Day 2: stimulus precision
We’re going to get really familiar with the different kinds of stimuli that we can present using PsychoPy and how they work. In particular, we’re going to worry about the exact appearance and timing of stimuli, making sure that psychopy carries out our instructions to the smallest detail.
If time permits, we’re going to start slowly on building an actual experiment.
Day 3: building an experiment
Now that we know how to present stimuli, we’re going to embed them in an experiment, all in python/psychopy.
PREPARing for the course
Follow the Getting Started guide in order to install PsychoPy and get up to speed with Python. Also, feel free to peek around these pages (under the “psychopy course” menu entry) in order to orient yourself.
You need to bring your laptop every day.