Making Python more accessible for scientists and more powerful
Posted on 18 October 2012
Making Python more accessible for scientists and more powerful
By Aleksandra Pawlik, Agent and PhD student at the Open University.
IPython is a cross-platform tool developed by scientists to support the exploratory nature of scientific software development, and make it easier for researchers to quickly alter the Python code they use to advance their research. Excellent support from the development community has added many useful new features, such as support for cloud computing and even an Emacs interface.
Fernando Perez, a researcher at the Helen Wills Neuroscience Institute at U.C. Berkeley, is the developer behind IPython. Motivated by a desire to build Python into “good system for everyday scientific computing”, Fernando started working on IPython back in 2001. Today the bulk of the work is done as a team effort. The first prototype of IPython Notebook (an IPython front end) was coded in Summer of 2011 by Brian Granger, with later development supported by the rest of the IPython team.
IPython is a free, interactive shell environment for Python (it’s also easy to install and can be tried out online at PythonAnywhere). IPython provides a number of solutions that make work (and life) easier for anyone who uses the standard Python command line interpreter. For example, IPython allows autocompletion (with TAB), navigation of the file system and also enables users to see the input and output history. The stored input and output can be easily re-edited and re-run. This feature is particularly useful for scientists who typically need to look up or reuse data manipulation or calculation they used earlier.
IPython comes with some more magic: input lines beginning with % calls to magic functions which enable users to control IPython behaviour and the system-type features. Users can define their own magic functions to extend the system functionality and customise it to match their needs exactly. IPython provides interactive 2D and 3D data visualisation with Matplotlib. What’s more, IPython can be used for parallel computing. It supports all the different approaches to parallelisation, including those that are popular among scientists’ MPI-based applications.
IPython Notebook works great as an interactive, fully-editable, browser-based programming environment and a lab notebook. It allows a user to not only to enter and store bits of code and notes, but also to see the output of that code, visualise the data using Matplotlib or even embed pictures and videos. The Notebook elegantly renders mathematical equations (with the SymPy library).
IPython Notebook is a great tool for reproducible research. Have you ever lost days struggling to reproduce work, just because you didn’t save The Important Bit of Code, lost your notes somewhere in the black hole of your hard drive or in the depths of document piles on your desk? With IPython Notebook you are safe. The Notebook has its own file format enabling the users to store all information that was entered in the Notebook. This means important bits of code are safe, as is the output from your code and any other content that you may have produced for your research. And if you want to blog about that fantastic discovery you just made, you can do it directly from IPython Notebook!
Both IPython and IPython Notebook seem to be ideal for teaching programming. There are plans to incorporate them into the Software Carpentry, which could kill two birds with one stone by providing a flexible environment for teaching programming, as well as introducing scientists to useful tools supporting their everyday research practices.
IPython and IPython Notebook are gaining massive popularity among the scientific community. Various developers have built interfaces and integrated tools with other services, applications and environments. There is, for example, NotebookCloud web app which can be run on Google Accounts and Amazon Web Services. Using NotebookCloud you can launch and control IPython Notebook servers on Amazon Elastic Compute Cloud (Amazon EC2) directly from your browser. Emacs IPython Notebook allows a user to edit IPython Notebook straight from Emacs.
IPython and the Notebook are open-source projects, so there is no doubt that these tools will be incorporated into a variety of different projects. End-users appreciate the easy set-up and usability of IPython and IPython Notebook, and those who love to hack can extend and alter existing tools.
And, by the way, the IPython project is constantly looking for new developers who would like to join the development effort. If you feel like contributing and working on, check the project’s GitHub repository and get in touch with the development team.