From Lupyan_Lab_Wiki
Jump to: navigation, search


  • navigation
    • psych711|Main page
  • Download and Install
    • Psych711-PC|Installation PC
    • Psych711-Mac|Installation Mac
  • Notes for each class - will be updated ~week before each class.
    • Mini Bootcamp|Mini Bootcamp
    • Class 1|Class 1
    • Class 2|Class 2
    • Class 3|Class 3
    • Class 4|Class 4
    • Class 5|Class 5
    • Class 6|Class 6
    • Class 7|Class 7
    • Class 8|Class 8
    • Class 9|Class 9
    • Class 10|Class 10
    • Class 11|Class 11
    • Class 12|Class 12
    • Class 13|Class 13
    • Class 14|Class 14
  • Programming Exercises
    • Exercise-notes|Notes on doing the exercises
    • Exercise1-square|Exercise 1 - A square and beyond
    • Exercise2-names|Exercise 2 - Reading in files, collecting responses
    • Exercise3-trials|Exercise 3 - Generating trials, basic randomization
    • Exercise4-grouping|Exercise 4 - Toward a fuller experiment: A perceptual grouping task
    • Exercise5-morePractice|Exercise 5 - More practice with generating trials
    • Exercise6-debugging|Exercise 6 - Debugging practice. Fix this code
    • Exercise7-monty-and-birthday|Exercise 7 - Numerical simulations: Birthdays and Monty Hall
    • Exercise8-adjust-with-mousewheel|Exercise 8 - Orientation adjustment
    • Exercise9-strings|Exercise 9 - Fun with strings
    • Exercise10-FiniteState|Exercise 10 - Classes and Objects: An artificial Grammar Learning Task
    • Exercise11-FiniteState|Exercise 11 - Implementing the Artificial Grammar Learning Task
    • Exercise11-BlindCodeConditions|Exercise 12 - Renaming files
    • Exercise12-Pandas|Exercise 13 - Using Pandas
  • Projects
    • Project-1|Project 1
    • Project-2|Project 2
  • Quick reference
    • Linux Tips|Linux/MacOS Terminal tips
    • Python|Python
    • Psychopy|Psychopy
    • ImageMagick|ImageMagick
    • DataViz|Graphing and Data Visualization
    • MTurk|Mechanical Turk


Welcome to Psych 711 - Programming and Automation Techniques. Our mission is to teach you how to stop relying on point-and-click experiment packages and program your own experiments, script common tasks, organize your data, and in the process, become a better scientist. In Fall, 2015 we will be meeting on Wednesdays 9:00am-11:30am in Psych 634. The class is taught by Prof. Gary Lupyan (lab page), (lupyan _at_ wisc dot edu)).

Why Program?

Simply put, knowing how to program and how to automate common tasks will make your life (or at least your academic life) better. Much better. A programmatic approach will allow you to create experiments in hours that would take days or weeks of fiddling in point-and-click packages like Eprime. Programming your experiments will give you complete control overy every aspect of the procedure. You will never again need to worry about whether you can implement your experiment in some program. If you can think it, you can program it. A globally programmatic approach to behavioral research will also mean that you will never have to shuffle lists in Excel to create the proper counterbalancing or randomize things. You will never have to copy and paste data files, or <gasp> manually code (objective) responses. Changing the size of 1000 images or measuring the onset latency of a voice response becomes as simple as executing a little program, which at the end of the class, you will be able to write from scratch.

At the end of the class you'll be comfortable with creating full-blown experiments using Python and Psychopy. You will learn how to design experiments in a programmatic way (no pointing, no clicking) and be amazed with your increase in efficiency. In addition to coding experiments, by the end of the class you'll be on your way to doing all sorts of fancy schmancy things in Python and command-line tools (e.g., data massaging of all sorts, (basic) corpus linguistics, automatic image and audio processing, and collecting some data online. The world will be your oyster. Mmm, oysters.

Class philosophy

Programming, as taught by computer scientists, emphasizes lots of theory (pointers, O-notation) and abstract problem solving (sort algorithms, recursion, etc.). Although this is likely the best way to gain a deep understanding of computer science, we are betting that it is not the best way to teach applied programming skills in a short amount of time to non computer-scientists. In this class we'll be taking a more applied approach. Every exercise we do will introduce students to a skill directly relevant to solving problems commonly encountered in behavioral research. We'll learn some theory along the way, but the focus will be on practical how-to solutions. If you've never programmed before, you're in for an initially steep learning curve, but it will flatten out quickly, and your mind will be blown. If you have programmed before, you will appreciate the simplicity and elegance of Python compared to the the high overhead of more traditional languages like C and Java, the clunkiness of Matlab.

What now?

First, make sure you've joined the shared Box folder (check your email for the invite. If you don't see it, check the spam folder.). You'll also want to download the Box Sync client for Mac or PC.

Then, follow the download and install instructions.

For those of you using this site as a tutorial: you can simply copy/paste the code from the templates in the exercises. I have taken down the posted solutions in preparation for the Fall semester, but if you need a solution (or any code that's not posted), please email me (lupyan _at_ wisc dot edu).