Some Python resources

videosong

Since I’ve switched to using PsychoPy for programming my behavioural and fMRI experiments (and if you spend time coding experiments, I strongly suggest you check it out too, it’s brilliant) I’ve been slowly getting up to speed with the Python programming language and syntax. Even though the PsychoPy GUI ‘Builder’ interface is very powerful and user-friendly, one inevitably needs to start learning to use a bit of code in order to get the best out of the system.

Before, when people occasionally asked me questions like “What programming language should I learn?” I used to give a somewhat vague answer, and say that it depended largely on what exactly they wanted to achieve. Nowadays, I’m happy to recommend that people learn Python, for practically any purpose. There are an incredible number of libraries available that enable you to do almost anything with it, and it’s flexible and powerful enough to fit a wide variety of use cases. Many people are now using it as a free alternative to Matlab, and even using it for ‘standard’ statistical analyses too. The syntax is incredibly straight-forward and sensible; even if an individual then goes on to use a different language, I think Python is a great place to start with programming for a novice. Python seems to have been rapidly adopted by scientists, and there are some terrific resources out there for learning Python in general, and its scientific applications in particular.

For those getting started there are a number of good introductory resources. This ‘Crash Course in Python for Scientists’ is a great and fairly brief introduction which starts from first principles and doesn’t assume any prior knowledge. ‘A Non-Programmers Tutorial for Python 2.6′ is similarly introductory, but covers a bit more material. ‘Learn Python the Hard Way’ is also a well-regarded introductory course which is free to view online, but has a paid option ($29.95) which gives you access to additional PDFs and video material. The ‘official’ Python documentation is also pretty useful, and very comprehensive, and starts off at a basic level. Yet another good option is Google’s Python Classes.

For those who prefer a more interactive experience, CodeAcademy has a fantastic set of interactive tutorials which guide you through from the complete beginning, up to fairly advanced topics. PythonMonk and TryPython.org also have similar systems, and all three are completely free to access – well worth checking out.

For Neuroimagers, there are some interesting Python tools out there, or currently under development. The NIPY (Neuroimaging in Python) community site is well worth a browse. Most interestingly (to me, anyway) is the nipype package, which is a tool that provides a standard interface and workflow for several fMRI analysis packages (FSL, SPM and FreeSurfer) and facilitates interaction between them – very cool. fMRI people might also be very interested in the PyMVPA project which has implemented various Multivariate Pattern Analysis algorithms.

People who want to do some 3D programming for game-like interfaces or experimental tasks will also want to check out VPython (“3D Programming for ordinary mortals”!).

Finally, those readers who are invested in the Apple ecosystem and own an iPhone/iPad will definitely want to check out Pythonista – a full featured development environment for iOS, with a lot of cool features, including exporting directly to XCode (thanks to @aechase for pointing this one out on Twitter). There looks to be a similar app called QPython for Android, though it’s probably not as full-featured; if you’re an Android user, you’re probably fairly used to dealing with that kind of disappointment though. ;o)

Anything I’ve missed? Let me know in the comments and I’ll update the post.

Toodles.

About these ads

About Matt Wall

I do brains. BRAINZZZZ.

Posted on October 17, 2013, in Cool new tech, Experimental techniques, Neuroimaging, Programming, Software and tagged , , , , , , . Bookmark the permalink. 14 Comments.

  1. Coursera offers a couple of free courses on learning to program in Python (for example, https://www.coursera.org/course/interactivepython). They are thinking of putting together a series of classes that will take a person through the steps of learning Python from scratch, to “mastery.” Something to look forward too.

    Thanks for putting this together Matt, always good to find more about programming in Python.

  2. Thank you very much for this very useful information

  3. I would suggest http://www.pythonweekly.com/ , which sends out the best hand curated links related to Python every week.

    Disclaimer: I am the curator of Python Weekly

  4. Since your have mentioned our PyMVPA, you could also take advantage of NeuroDebian — a rich (if not complete) platform for neuroscience — psychopy, pymvpa, nipy, nipype, and may others are available.

  5. Great to see you’ve switched to PsychoPy but it’s somewhat funny that in the list of tools/tutorial you provide there isn’t one for getting started on PsychoPy. So let me share a few useful resources:
    – Prof. Gary Lupyan’s course: http://sapir.psych.wisc.edu/wiki/index.php/Exercise1-square
    – (shameless self-promotion) Our lab’s one-day crash course on a IPython notebook (http://nbviewer.ipython.org/7036997) and a wiki http://gestaltrevision.be/wiki/python (it also contains more resources on Open Science tools)

  6. Dive Into Python! It’s free, available in several formats, a good way to get up and running (especially if you have a little experience with something else, but I think the “experienced” warning is a bit too strong).

    http://www.diveintopython.net/

  7. Are there any IDEs/itnerpreters for Python running on Windows that you would recommend? I use PsychoPy but it is a little clunky for testing out bits of code while coding an experiment.

  8. Hey Matt, Thanks a lot for sharing all these interesting tips and resources. Your collection is really very good and will definitely help beginners

  1. Pingback: Some Python resources | Bazaar | Scoop.it

  2. Pingback: Towards open-source psychology research | Computing for Psychologists

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 211 other followers

%d bloggers like this: