-
Notifications
You must be signed in to change notification settings - Fork 0
Using IPython Notebooks
The IPython notebook is a web-based interactive Python environment which allows users to execute code, display text and mathematical equations, and plot figures in a single page. The Neurokernel source code includes several notebooks that illustrate how to run various neural circuit demos that make use of Neurokernel's API.
Assuming that IPython has been correctly installed, one may start a notebook server from the command line as follows:
$ ipython notebook --pylab inline
The optional argument --pylab inline
enables figures generated using Matplotlib to be displayed directly in the notebook. To enable the IPython notebook to continue running in the background even after one closes one's terminal, one can start the server as follows:
$ nohup ipython notebook --pylab inline &
By default, the IPython notebook server is run on port 8888. We can change the port number used to any other available port number XXXX either by starting the server with the --port XXXX
option or by creating a custom profile of the IPython notebook that specifies the port number to use. To create a profile for the notebook server, run the following command:
$ ipython profile create nbserver
A file named ipython_notebook_config.py
will be created in $HOME/.ipython/profile_nbserver
with all fields commented. Open the newly created custom profile, find the line
#c.NotebookApp.port = 8888
and replace 8888 with your preferred number. More details about customizing the IPython notebook are available here.
To securely access an IPython notebook server running on a host that is only accessible with ssh
, one can
set up an ssh tunnel that will create a secure connection between the host and one's web browser. If one has access to a command-line ssh
client (e.g., on Linux or MacOS X), one may set up a tunnel as follows:
$ ssh -L remoteport:localhost:localport the.remote.cluster
remoteport
should be set to whatever port the IPython notebook server is using on the remote host; localport
may be an available port on one's computer. Once the tunnel has been established, one can access the IPython notebook server by directing one's web browser to the URI http://localhost:localport
or http://127.0.0.1:localport
. One can also set up a tunnel using many graphical ssh
clients like PuTTY.