Course coordinator: Matthias Nau , Contact: m.nau[at]vu.nl
Teaching Assistants: Anna van Harmelen, Camilla U. Enwereuzor
This repository contains the course materials for the course "Programming for Psychologists" (P_MPROPSY) at the Vrije Universiteit Amsterdam. This 6 EC course is going to teach you your new superpower: Programming in Python!
Over the course of 2 months, you will start thinking like a programmer and learn how to use Python for experimental design, data analysis, and visualization. You will get to know many essential concepts, data structures, and libraries relevant to research in Psychology and Neuroscience, and develop a solid foundation for further learning.
In addition, you will learn what it means to write and share code in the spirit of Open Science, how to review other people's code, and how to ensure your research is rigorous, reproducible, accessible, and transparent.
The course is organized into 7 modules, each comprising a lecture (1.5h) and two practicals (~2.5h each). Each module will focus on a different topic.
Lectures will focus on conceptual understanding. You will learn why programming is important for psychologists, what Python is, and how it can support your research. We will further discuss coding best practices and principles of Open Science.
Practicals will focus on skills. You will learn how to write code in Python to perform basic operations, design simple experiments, and analyze and visualize data. Moreover, you will learn how to use GitHub for version control and sharing code.
- Lecture 1: Welcome
- Practical 1.1: Programming mindset
- Practical 1.2: Setup & Software
- Lecture 2: Introduction to Python
- Practical 2.1: Basic expressions, datatypes, loops
- Practical 2.2: Libraries, conditionals, debugging
- Lecture 3: Functions, data, debugging
- Practical 3.1: More datatypes and loops, nesting, f-strings, PEP-8
- Practical 3.2: Functions & ASCII Art
- Lecture 4: DataViz basics, Matplotlib, Seaborn
- Practical 4.1: Matplotlib
- Practical 4.2: Plot your own data
- Lecture 5: Git & GitHub
- Practical 5.1: GitHub & Copilot (live demo only)
- Practical 5.2: AI-assisted coding
- Lecture 6: Psychopy
- Practical 6.1: Build your own experiment
- Practical 6.2: How to design a log file
- Lecture 7: Recap & Workflow
- Practical 7.1: Data analysis
- Practical 7.2: Home assignment
- Q&A session
- Home assignment
- Exam
The home assignment of this course will be writing code for simple data analysis and visualization of magnetic resonance imaging (MRI) data. You will write this code in your own time, along with a brief statement about the best practices it follows and how. You will upload this code to GitHub, where other students will comment on it as part of a code review. You will also be asked to review other students' code.
The home assignment will determine 25% of your grade.
At the end of the course, you will take an exam, where you will:
- Receive code snippets and answer questions about them
- Answer conceptual questions based on lecture and practical content
- Solve a mix of open-ended and multiple-choice questions
The outcome of the exam will determine 50% of your grade.
Each module will come with a quiz containing multiple-choice and multiple-answer questions about the week’s lecture and practicals.
The outcome of the quizzes will determine 25% of your grade.
However, learning a new (programming) language takes practice and time, more than this course can offer. To grow beyond the course and become an expert, check out the following open resources meant to help you practice at home:
- Ten principles for better coding – Coding best practices for different levels of experience, by Roth et al.
- Ten tips for AI-assisted coding – How to use (or not to use) LLMs in your programming, by Bridgeford et al.
- The Good Research Handbook – Coding best practices with a focus on research, by Patrick Mineault.
- Automate the Boring Stuff – Fantastic book for beginners who want to learn Python basics, by Al Sweigart.
- Python for Neuroscientists – Useful resource for practicing neuroscientists, by Schlafly et al.
- Version Control Book – Online book on version control with Git for researchers, by Lennart Wittkuhn.
- Dartmouth programming course – Python course for Psych students, by Jeremy Manning.
- Harvard CS50 Python Course – Popular and comprehensive Python course.
- Super Science Bros. – Fun video game coded entirely in PsychoPy, by Jason Ozubko.
- Online Quiz – Test your Python knowledge here!
Thank you to Anna van Harmelen for her immense help in crafting the practical notebooks, and to Camilla U. Enwereuzor for helping to keep them up to date. I also thank David Collien for insightful discussions on programming mindset.