Today was Python Day at the MRC Cognition and Brain Sciences Unit. Participants of this workshop (and anyone who’s interested, really) can find the required documents here. (Scroll down to the bottom of the page.)
The workshop consisted of a morning part, during which a response time experiment was performed, using variable foreperiods. In the afternoon, a dataset that could have been generated through such an experiment was analysed.
Note: The data used here is computer-generated, completely fake, and only to be used for practice purposes.
- Download and install Anaconda. This is a Python distribution. Please select the version for your operating system, version 2.7, 64-bit. When prompted, make sure you ask the installer to make this your default Python installation. (NOTE: This is assuming you do not already have a Python installation up and running. If you do, you don’t have to install Anaconda!)
- Open a command prompt or terminal. See below for OS-specific instructions.
- Windows: Go to the folder where you installed Anaconda, for example C:\Anaconda27, and double-click on the programme called “Anaconda Command Prompt”.
- Linux: Open a Terminal.
- OS X: Type “Terminal” in the finder, and hit Enter.
- Install pygame by running the following command in your command prompt/terminal:
pip install pygame
- Install PsychoPy by running the following commands in your command prompt/terminal:
pip install pyglet
pip install json_tricks
pip install future
pip install psychopy
- Install PyGaze by running the following commands in your command prompt/terminal:
pip install python-pygaze
If you liked the taste of Python, there are a few options to continue learning.
A Byte Of Python is a free eBook that has an extensive overview of the language. Learn Python The Hard Way is a similar resource. A lot of the concepts these books introduce are not necessarily relevant for an experimental psychologist or cognitive neuroscientist, so feel free to be somewhat particular about which sections you read.
A more targeted resource is the book Python For Experimental Psychologists. It was written specifically with cognitive experiments in mind, and is therefore a good start for any researcher in experimental psychology or cognitive neuroscience.
Another great resource is the book Python Machine Learning. It has a more advanced scope, and you should definitely already be familiar with Python before sinking your teeth in it.