PSYC770: Research Instrumentation & Computers
(with Python & PsychoPy)

Spring 2025
Last updated 4/21/2025

Session

   Description

Assignment
1/14-16 Overview of the course and the Python ecosystem for behavioral research
Installation of PsychoPy standalone software (Windows 64-bit) with Python 3
Peirce Chap. 1
     
 

Introduction to PsychoPy Development

PsychoPy Tech Manual
[12 MB]
1/21 Using the Builder graphical interface to specify a simple experiment (Stroop paradigm) Peirce Chap. 2
1/23 Building a simple experiment using images as stimuli (Glasgow Face Matching Test) Peirce Chap. 3
1/28 Implementing visual stimulus presentations with video-frame accuracy and precision (Posner Cueing paradigm) Peirce Chap.4
1/30 Dynamic animation of stimulus size, location and color (as a function of Routine-level clock time) Peirce Chap. 6
2/4 Using Python extension code to provide trial-by-trial feedback in PsychoPy Peirce Chap. 7
2/6 Mouse-based input and selection (Visual search paradigm) Peirce Chap. 11
2/11 Multimedia: Sound clips and movies movie.zip   sounds.zip
    sliders.zip colorWheel.zip
 

Basic Python Coding

Manual: A Byte of Python
[338 KB]
2/13 Exploring PsychoPy's Coder interface window and the Python3 IDLE interpreter Video Intro to Python
  Python 4 - Basics:
Variables, data types, objects, and code blocking via indentation
 
  Python 5 - Operations:
Math operators, order of operations and logical operators
 
2/18 Python 6 - Control Flow
If...elif blocks, while blocks and for...loops [with a preview of 'iterators']
Homework Assignment 1
2/20 Python 7 - Functions
Subroutines, input arguements and return values
 
2/25 Python 8 - Modules and Python 14 - Python Standard Library:
Importing external functions/libraries that extend the Python language and functionality
function_examples
numpy_examples
2/27 Python 9 - Data Structures:
Lists, Tuples, Dictionaries and Sequences
list_comprehensions
3/4 and  3/18 Python 12 - File Input/Output      csv_writer   csv_reader   CSV Module Documentation   pickling file_demos.py
stroop_conditions_excel
Homework Assignment 2
  Benchmarking Temporal Accuracy and Precision
Using Microcontroller-based Systems
 
3/20 The problem: MS-Windows, macOS and Linux are NOT real-time operating systems
How microcontrollers solve the time management dilema.
 
3/25 Arduino microconroller system and programming development environment (ATMega32U4) Arduino Pro Micro
Arduino Benchmark Circuit
Arduino Benchmark Script
3/27 Developing and uploading Arduino programs externalBlinky
Arduino Exercise 1
4/1 Measuring the latency of serial input/output to Arduino microcontroller ArduinoLatency
LatencyCustomCode
  Measuring PsychoPy stimulus display timing using the Arduino and a simple light-sensitive sensor            Light Sensor
SimpleLightMeter
Exercise 1 Code
4/3 Measuring duration of brief visual display stimuli Arduino Exercise 2
Exercise 2 Code
4/8 Measuring the latency of visual stimulus onset Arduino Exercise 3
Exercise 3 Code
4/10 Measuring the temporal latency of PsychoPy sound stimuli        Benchmark Circuit toneLatency2025.py
4/15 Characterizing the temporal latency of keyboard input     KB Benchmark Circuit kb_test_arduino2025.py
  Plot the Distribution of Sampled Data
Arduino-to-Python Serial Data Transfer Demo
How to Send a Serial Command Character from Python to Arduino
Arduino Random Number Generation
SerialControlAnalogDev9
     
  Instrumentation Interfacing  
4/17 Digital I/O: Legacy parallel port (LPT:) interfacing   
 LPT diagram       High-Speed Light Sensor
parallel_test.py
LPT Output Benchmark
LPT Benchmark Data
plot_lpt_output_latency.py
LPT Benchmark Results
  Arduino-based simulation of parallel port (Implementing a Custom Button Box) SerialButtonBox3
  Analog I/O: Labjack sample implementation     LabJack T7-Pro  
4/22 TCP/IP communication between computers:  UDP client-server and TCP client-server applications (Crossover cables; local network switches)       
netcat for Windows   
TTY_server.py
TTY_client.py
UDP Data Transfer Client
UDP Data Transfer Server
4/24 Lab Streaming Layer (LSL)    Intro to LSL Presentation
Legacy serial communications (e.g., COM1:) interface (practical demo: reading the Minola CS100A colorimeter/photometer)
Builder LSL Demo
Builder LSL Code
LSL TimeSeries Demo
4/29 Project Presentations I  
5/1 Project Presentations II  

Notes
Companion website for PSYC770 can be found at http://moundtop.com/psyc770/
The latest version of this syllabus is available at http://moundtop.com/psyc770/psyc770-syllabus.html

Deliverables
Select homework exercises will require completed work to be submitted to the instructor.
Each student must develop a plan for an experimental project and successfully implement PsychoPy/Python code that implements the project.  The proposal for this project must be approved by the instructor prior to initiating work.  Project proposals are due April 3, 2025.  Final projects are due by the last day of class.

Grading
25% Homework Assignments; 25% Attendanace; 50% Final Project

Required Texts:

Peirce, J. & MacAskill, M. (2022). Building experiments in PsychoPy (2nd edition). Thousand Oaks, CA: Sage Publishing.
ISBN: 978-1-5297-4165-0 (paperback)
 

Swaroop, C.H. (2005). A byte of Python.
A free Internet-based tutorial introduction to the Python programming language.
(See the appropriate link listed above to access this document)