Skip to content

Duke-CNRI/python-intro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-intro

These resources are used in the teaching of the class Introduction to Python Programming for Experimental Design at Duke University for the Cognitive Neuroscience Research Program (CNRI) program. Our class was specifically designed around teaching and using Python to build behavioral experiments in PsychoPy.

Table of contents

Class 1: Introduction to computer programming, the purpose of this class, variables, and datatypes

  • Introduce syllabus and goals of the class
  • Introduce why scientist use computer programming, what it allows us to do and how we will use it in this class
  • Formally introduce setting variables and different datatypes of variables (string, integers, and floats), Booleans, and the concept of evaluations

Class 2: Introduction to control flow: conditionality and loops

  • Introduce conditionality, the concept of control flow, and why it's useful!
  • Introduce loops and iterators
  • Build familiarity with Python syntax, indentation, interactions with variables

Class 3: Building our own functions

  • Introduce functions and why we might want them
  • Continue to build familiarity with Python syntax, focusing on function creation
  • Create our own function and learn how to interact with them!

Class 4: Building experimental blocks, functions/methods (brief mention of classes/objects)

  • Introduce methods, how they are both similar and different to functions
  • Briefly mention concepts of classes and objects (that we will touch on again in the next class)

Class 5: Libraries and packages and a formal introduction to PsychoPy

  • Review the concepts of classes and objects, move to introducing libraries and packages
  • Why are libraries really cool and how do we use them?
  • Introduce PsychoPy and how to search for and read package documentation.

Class 6: Create stimuli, randomization/counterbalancing

  • Introduce specific methods in PsychoPy for creating stimuli and displaying them to screen
  • Introduce NumPy and how we can randomize our stimuli (plus why it's important to do so).

Class 7: Collecting and storing responses

  • Introduce specific methods in PsychoPy for collecting keyboard responses, how to store those responses momentarily and how to store them "long term".
  • Introduce Pandas and how to save/export data.

Class 8: User Testing + debugging

  • Explore how we address errors in our code
  • Introduce process of debugging: when our code runs but doesn't produce what we expect
  • Introduce the debugging tools, e.g., simulated data

Class 9 - 12: Building first experiment

  • Goal: to extend or replicate a prior finding from a behavioral study read during the semester
  • Start with experimental proposal that includes detailed sketch of control flow of experiment, control flow timing, and associated variables/stimuli
  • Class 9: collect and create stimuli needed, create all display screens (fixation cross, feedback screens, instruction screens, etc.)
  • Class 10: Set up any conditionality and create trial for loop
  • Class 11: Set up data collection and storage system
  • Class 12: Debugging and user testing on fellow cohort mates

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •