Wednesday, February 13, 2013

Running IPython Notebook in CIAO/Sherpa

I wanted to work with  IPython Notebook  in CIAO to create a nice record of analysis for my collaborators. Sherpa uses IPython 0.13, but CIAO does not come with 'pyzmq' and 'tornado'  required for running the Notebook. I also needed to install zmq library.  

Here are my installation steps after my downloading and installing CIAO 4.5 binaries on my iMAC OS 10.6.8:

1/ Start with "zmq" library. 

   Download  zeromq-3.2.2.tar.gz (version from23-Nov-2012 09:01) from:

tar xvf zeromq-3.2.2.tar.gz       
cd zeromq-3.2.2      
sudo make install

2/  Install pyzmq into CIAO area.

    Need to "source $ASCDS_INSTALL/bin/ciao.csh" to be in CIAO environment for installation in CIAO Python site-packages area. This can be done with "ciaorun" as I did below:
download the source file pyzmq-2.2.0.tar.gz from:

tar xvf pyzmq-2.2.0.tar.gz
cd pyzmq-2.2.0
ciaorun python install \

3/ Install tornado into CIAO area.

 Download the source file tornado-2.4.1.tar.gz from:

tar xvf tornado-2.4.1.tar.gz
cd tornado-2.4.1/
ciaorun python install \

4/ Run IPython Notebook

ipython notebook will start  a notebook session in your browser. Open the New Notebook to get to the interactive session. In the first cell type:

import numpy as np
from sherpa.astro.ui import *
from pychips import *

and then shift-return to run it. In the second cell:

x = np.arange(20)
y = np.sin(x)

shift-return to run it. You should see the CHIPS plot appearing outside the browser.