PSYCH 711/712: Introduction to Python

Course Outline

Instructor: Joey Legere (legerejk@mcmaster.ca)
Lectures: Tuesdays and Thursdays, 1:00PM-3:00PM, BSB 244

Course Description

The primary objective of this course is to introduce students to programming in the Python language. No prior experience with computer programming is assumed. The first 4 weeks will cover the basics of Python and will be accompanied by weekly assignments. Week 5 will walk through constructing a basic cognitive experiment using the PsychoPy coder.

There will be no assignments after week 4, instead there will be a final project. Students are encouraged to think of their own ideas that will help with their personal research projects. examples include analyzing or cleaning up a complex dataset, creating an experiment, or a game.

Lesson Structure

Lessons will be highly interactive. Students are expected to follow along with coding examples on their own laptops, or on the provided computers in the room. Each lecture will also have at least one in-class exercise (worth bonus marks to be added to the final grade).

Topics
Note: this schedule is only tentative, and may be modified slightly as the course progresses.

Week 1: Fundamentals. Mathematical operations (addition, subtraction, mutliplication, division, exponentiation and modulus), elementary data types. Loops and control flow.
Objective: Create and modify simple programs that produce meaningful output from user input (adding numbers, unit conversions).

Week 2: Working with and converting between data types: integers, floats, strings, lists, dictionaries.
Objective: Be able to write code that maps subject/trial/block numbers to experimental conditions.

Week 3: Control flow (loops, if statements, functions). Introduction to the standard library (randomization, timing).
Objective: Write functions to improve code legibility. Create simple text-based experiments and games.

Week 4: Reading and writing from files. Data analysis and visualization.
Objective: Read in data from an external source, modify as needed and save. Summarize data in graphs.

Week 5: Cognitive experiments in Psychopy.
Objective: Be able to create and modify cognitive tasks using the Psychopy coder.

Week 6: No formal lesson, or catch up from previous weeks. Drop-in assistance with final projects.

Required Materials

There is no required textbook for this course. Bringing your own laptop to class isn't mandatory, but highly recommended.
We will be using Jupyter notebooks for the majority of the course, with the exception of week 5 where will use the Psychopy coder. Instructions for installing Jupyter are available here.

Assessment

Weekly AssignmentsMax 40% (4 assignments, 10% each.)
In-class problems20%
Final Project40%

All assignments will be automatically graded, but grades will be manually reviewed to ensure they are accurate. The weight from any missed in-class problems will be moved to the final project. The final project, which students will have the entire term to complete, is worth 40% of the final grade. This project may be proposed at any time--students are encouraged to start thinking about their project early in the term in order to receive feedback.

Assigning of Grades

Numerical GradeLetter Grade
90 - 100A+
85 - 89A
80 - 84A-
77 - 79B+
73 - 76B
70 - 72B-
0 - 69F

Note 1: The penalty for assignments submitted after the due date is 10% per day late. Application of this penalty is at the discretion of the instructor.
Note 2: The instructor and university reserve the right to modify elements of the course during the term. The instructor and university may change the dates and deadlines for any or all courses in extreme circumstances. If either type of modification becomes necessary, reasonable notice and communication with the students will be given with explanation and the opportunity to comment on changes. It is the responsibility of the student to check their McMaster email and course website weekly during the term and to note any changes.
Note 3: Attention is drawn to the Statement on Academic Ethics and the Senate Resolutions on Academic Dishonesty as found in the Senate Policy Statements distributed at registration and available in the Senate Office. Any student who infringes one of these resolutions will be treated according to the published policy.