Python notebook - interactive science

Or how a notebook can be used to journalise science

In a previous post I showed that python, in combination with some additions such as numpy and matplotlib, can be a considered a worthy replacement of Matlab. There are some tricks that make the transition even easier. One of those additions is the browser ‘notebook’, an interactive Python interface running in the browser. Even if for some reason you don’t fancy browser-based python, the technology allows for more than just that. One of those new features (v0.12) is the inline graphics mode that is quite similar to Mathematica’s approach. In order to get this running I’ll just copy the steps (as previously described here):

sudo add-apt-repository ppa:chris-lea/zeromq
sudo add-apt-repository ppa:chris-lea/libpgm
sudo apt-get update
sudo apt-get install libzmq1
sudo apt-get install libzmq-dev
sudo apt-get install libpgm-5.1-0
sudo pip install pyzmq 
sudo pip install tornado
sudo pip install --upgrade ipython
sudo pip install numpy
sudo pip install matplotlib

That should get you the latest iPython. To get the inline graphics mode running, just type

ipython qtconsole –pylab=inline

The same example as previously but now with the inline graphics mode: ipython inline graphics

python interactive