feilong / psyc161

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction to Programming for Psychologists & Neuroscientists

Course Objectives

Neuroimaging, computational neuroscience and other fields of brain research directions are becoming more and more data driven and employing sophisticated computational methods and paradigms, such as distributed and cloud computing. That is why it becomes critical for new researchers to develop at least basic skills in programming, software engineering, code and data management. This course intends to provide wide in scope and introductory in depth coverage of many important topics in programming, software engineering and some data structures and algorithms to streamline students current and future research projects. It will be practice and interaction oriented in its format: lectures will be interleaved within practice hands-on sessions. Although some topics and home exercises will involve using established data analysis frameworks, primary accent will be made on getting a good grasp of good coding and software developing practices: collaboration, testing, code review, etc. Thus, this course is intended to serve as a prerequisite to possible follow-up course(s) which would concentrate on in-depth learning of specific neuroimaging (and/or computational neuroscience) frameworks (from stimuli delivery to advanced analysis pipelines).

HOWTOs

Git

This is a git repository which contains only course materials. Homework assignment repositories were originally "linked" to this repository as git submodules but that was proven to be more distracting that useful.

Therefore, for the peace of our minds, I now recommend to clone/work with homework repositories outside of this repository. Just go to the parent directory and checkout those repositories one by one. Alternatively, there is now a script which you can run in a terminal and it will clone for you all present homework repositories, and would not touch existing ones:

 ./clone-homeworks

IPython notebooks

To interact with lecture notebooks run following commands in the terminal

cd classes
ipython notebook

Resources

Software

Neuroimaging could be considered a somewhat exemplar field of science since nearly all scientific software for fMRI and EEG/MEG data analysis was developed as a free and open source software (FOSS). Moreover, with recent developments of stimuli delivery toolboxes (e.g., psychtoolbox-3, PsychoPy, OpenSesame) it became possible to provide a complete free and open toolbelt for carrying out research in this domain. Therefore, in this course we will use/cover available FOSS tools (e.g., bash, git), programming languages (Python) and then overview computation environments (Matlab/Octave, R). To establish efficient hands-on sessions and code development in Python, we will use and recommend you to use in your research/coding practice:

  • IPython notebooks . Available for all platforms. Stock Debian/Ubuntu distributions: ipython-notebook package
  • PyCharm community edition. NeuroDebian (-devel) provides now pycharm-community-sloppy package

Python, IPython, Octave, R etc are available for any major operating system (Linux, OS X, MS Windows). But students are encouraged to use a turnkey platform for neuroscience -- NeuroDebian -- where all (but Matlab) aforementioned (and thousands of other) tools are conveniently available. In the class we will use a prepared NeuroDebian VirtualBox appliance which has already necessary software pre-installed. If you decide to use identical environment on your home laptop/desktop, just

  1. Install VirtualBox on your system

  2. Download appliance used in the class (1.5GB)

  3. Import appliance in the VirtualBox, Run it

  4. provide necessary customizations to your git-config

  5. (recommended) update list of available packages and upgrade them all. Open terminal and run

     sudo apt-get update
     sudo apt-get upgrade
    

    Default password is neurodebian.

  6. (recommended) install flake8 checked for Python:

     sudo apt-get install python-flake8
    

    in case you want to use the same code checker as Travis CI for you when you submit a pull request with your homework.

Data

We might possibly use some publicly available dataset as an example for hands-on sessions. For your project(s), you are welcome to use any publicly available dataset.

Format

This course is planned as a graduate level seminar course for the Spring 2015 semester -- Apr 2nd to June 2nd -- so we will have roughly 9 weeks. Each week we will have either one 3h (2:00-5:00pm) or two 1h:30m (3:30pm-5:00pm) classes, which would be a mix of small lectures and practice sessions. Practice sessions would include “pair programming” and “code review” sessions. Homeworks will be submitted via Git (further instructions TODO). Students will learn how to use Git/GitHub and will be encouraged to contribute to existing free and open-source projects.

Literature

The two main sources for lesson materials are:

Both books are available online (free and open), and you can fetch PDF directly using git-annex (git annex get books/).

In addition, we will make use of a number of other online resources, including documentation and user manuals for the various libraries and packages that you will be learning to use.

Master plan

This is a preliminary plan, which can (and probably will) change depending on our progress and students' preferences

  • Weeks 1-3: Get to know the tools (environments, VCS, QA) and Python language fundamentals (from variables to modules and classes)

  • Weeks 4-5: Fundamentals of the scientific Python core (NumPy, SciPy, matplotlib)

  • Week 6: Overview of the extended scientific core (pandas, statsmodels, seaborn, PyMVPA)

  • Week 7: Stimuli delivery with Python (PsychoPy)

  • Weeks 8-9: Tour into R and Matlab and their offerings

Schedule

Date Times Lecture Reading HW
T 4/02 2:00-5:00 Intro/Python Concepts (Variables,..,Functions,QA) THP(1-6), PSL(1.2.1-1.2.5), git bootcamp materials HW1
T 4/07 2:00-5:00 Rehearsal, Python Concepts (Conditionals, Loops, Lists) THP(5-8,10), PSL(1.2.1-1.2.5) HW2
T 4/14 3:30-5:00 Rehearsal, Python Concepts (Tuples, Dicts, Sets) THP(11, 12) -
Th 4/16 3:30-5:00 Rehearsal, Python Concepts (Classes, Modules) THP(15-18) HW3
T 4/21 3:30-5:00 Rehearsal, Python Concepts (Exceptions, Context Handlers, Generators) THP(14.5), PSL(1.2.8), PT(8,9.10) -
Th 4/23 3:30-5:00 Rehearsal, Numerical Python (Numpy) PSL(1.3.2, 1.3.2), video -
T 4/28 2:00-5:00 Rehearsal, Numerical Python (Numpy, continued), Common data I/O PSL(1.3.2) -
Th 4/30 3:30-5:00 Visualizing the data (matplotlib #1, #2) MPL, AMPL HW4
T 5/05 2:00-5:00 Hands-on: Camera Man, Arteries, Convolution PSL(1.5) -
Th 5/07 3:30-5:00 Hands-on: Haxby 2001 - -
Th 5/14 3:30-5:00 Finishing up Haxby 2001 - PRJ
Th 5/21 3:30-5:00 Debugging, Hands-on: Slice-timing - -
T 5/26 3:30-5:00 PsychoPy PsychoPy Coder Manual PRJ/HW5
Th 5/28 3:30-5:00 TBA TBA -
T 6/02 3:30-5:00 TBA TBA -

Student Evaluation

Students will be evaluated on the basis of:

  • Lesson exercises / class participation. Every week there will be a set of small exercises to be submitted for the first class in the upcoming week

  • Final project, given 3-4 final weeks to work on.

Final project

Final project will be optional -- students will be welcome to choose either to do some final project or do two final homeworks, or both (project + homeworks) for "extra credit".

For the final project, students have two possibilities: self-proposed or a suggested project. For a self-proposed project:

  • It must be a new development (i.e. not something you did before this course), although you can choose to improve upon your prior code

  • Ideally should be something you or someone would end up re-using later on

  • Contribution to an existing scientific projects is strongly encouraged (benefit from established QA, feedback, distribution channels, etc)

  • Possible domains can be

    • Data structures/algorithms implementation
    • Stimuli/experiment
    • Data Analysis
    • Establishing/improving quality assurance (tests, etc) of an existing scientific FOSS project
  • Team work is encouraged (but contribution ratio will be assessed)

Suggested projects will be given in the class. For any of those types of projects code must be documented (docstrings, code comments), follow style guidelines (flake8 run in .travis.yml), carry unit- and possibly doc-tests, and submitted via GitHub making Travis-CI happy. You are most welcome to use materials from previous homeworks, and even review and grab ideas (not cut/pasted code) from code of others. You can either clone blank psyc161-prj against which you would submit your solution in private, or create a new public git repository on github.

Code of conduct

In non-official words: you must not re-use/cut-paste complete solutions found online. You are strongly encouraged to do your best to try figuring out the solution yourself. If you are stuck on some technical detail, it is perfectly fine to consult documentation, even "ask google", and/or email me for a hint/help. But if you are fully stuck ad researched/found a complete solution online and saw/read it (aren't you a fast reader of Python code by now) -- it is not the end of the world -- close that page and try recreating that solution yourself without looking up there again.

License/Attributions

Creative Commons Share-Alike License
This work and other related to the course materials under https://github.com/dartmouth-pbs are licensed under a Creative Commons Attribution Share-Alike 4.0 International License.

Some portions are materials borrowed from other sources distributed under compatible terms from

About


Languages

Language:Jupyter Notebook 99.7%Language:Python 0.3%Language:Shell 0.1%