Welcome to introPy

This website contains information about the two-week Python & PsychoPy course taught at the Research Master Psychology (University of Amsterdam).

Prerequisites

As this two-week Python course is preceded by a two-week R course in the Research Master Psychology, we assume that students are familiar with basic programming concepts (such as variables, conditionals, loops, and functions). Familiarity with Python is not necessary. Those that already have some experience with Python, however, may find the tutorials from this course (too) easy. To challenge those people, we included several more difficult (optional) sections and exercises in the tutorials!

Teaching philosophy

We believe in learning by doing. Most of your time will be spent by working on exercises, which we call ToDos. Although these exercises are ungraded, we highly recommend that you try to do them. If you manage to work through all of them, getting a decent grade on this course is expected.

Overview

In week 1, you will learn the basics of Python. We assume that you have some programming experience in other languages (e.g., Matlab or R). In week 2, you will learn about the Python package PsychoPy, which you can use to program experiments. The preliminary program can be found below.

Week

Day

Format

Topic

1

Mo.

Lecture

Introduction to Python

1

Mo.

Tutorial

Python essentials

1

We.

Lecture

Working with data

1

We.

Tutorial

Matplotlib + Pandas + Numpy

1

Fr.

Assigment

All of the above

2

Mo.

Lecture

Introduction to stimulus presentation

2

Mo.

Tutorial

PsychoPy Builder

2

We.

-

No lecture!

2

We.

Tutorial

PsychoPy Coder

2

Fr.

Exam

Create a PsychoPy experiment from scratch!

Expect to spend about 20-40 hours per week on this course (as is expected for a four week, full-time 6 EC course), which includes watching the lecture, doing the tutorials (including exercises), and working on the assignments. The amount of time you need for this course depends, of course, on your previous experience with programming in general, and programming in Python specifically.

Examination

For students from the Research Master taking this course, there will be two graded assignments: one on Friday in week 1 and one on Friday in week 2 (but the latter might be postponed). The assignment in week 1 will involve a task in which you need to use your Python and Pandas skills to preprocess some data, perform several simple analyses, and use Matplotlib to visualize the results. This will be done in a Jupyter notebook on our Jupyterhub server. For the assignment in week 2, you’ll have to program an experiment from scratch using the PsychoPy Coder interface.

For both assignments, you have 3 hours to complete it. It’s an “open-book” assignment, but you have to do it on your (i.e., no collaboration with your fellow students), and you’ll have to be present on Zoom during those three hours. The assignments are based only on the material discussed in the tutorials; the material that is indicated to be optional won’t be part of either of the assignments. About 80% of the assignment will be similar in difficulty as most exercises (“ToDos”) in the tutorials, but about 20% of the assignment will feature substantially more difficult exercises (similar in difficulty, but not in content, to the optional exercises from the tutorials). In other words, if you complete all tutorials, getting an 8 (out of 10) for the assignments is definitely doable. But getting a(n even) better grade will be more challenging!

Learning goals

At the end of this course, you will …

  • know the major differences between Python and R;

  • know the (dis)advantages of Python relative to other programming languages;

  • understand the concept of “object-oriented programming”;

  • be able to create basic Python scripts;

  • be able to implement basic data processing operations and visualization using pandas and matplotlib;

  • know the basics of stimulus presentation;

  • be able to implement simple experiments using the PsychoPy Builder and Coder interface.

Importantly, this course focuses on the basics of Python and PsychoPy, but we have highlighted several resources that you may use to continue your Python/PsychoPy journey here.

Getting started

Learn more about the course here or get started with the installation instructions.