Go down for licence and other metadata about this presentation

Licence

Unless stated otherwise all content is released under a [CC0]+BY licence. I'd appreciate it if you reference this but it is not necessary.

Using Ipython for presentations

I've created a short video showing how to use Ipython for presentations


In [1]:
from IPython.display import YouTubeVideo
YouTubeVideo('F4rFuIb1Ie4')


Out[1]:

Key activities

  • Inline things
  • Exporting
    • as html5
      • static - and locally served: - !ipython nbconvert Template.ipynb --to slides --post serve
        • SPEAKER NOTES work in the above
      • static - !ipython nbconvert Template.ipynb --to slides
    • as pdf
  • hosting:
    • on slideshare
    • on github:
      • just create a git project with these presentations in them :-)

PDF output - hack from Damian

The environment

In order to replicate my environment you need to know what I have installed!

Set up watermark

This describes the versions of software used during the creation.

Please note that critical libraries can also be watermarked as follows:

%watermark -v -m -p numpy,scipy

In [2]:
%install_ext https://raw.githubusercontent.com/rasbt/python_reference/master/ipython_magic/watermark.py
%load_ext watermark


Installed watermark.py. To use it, type:
  %load_ext watermark

In [3]:
%watermark -a "Anthony Beck"  -d -v -m -g


Anthony Beck 29/06/2015 

CPython 2.7.10
IPython 3.2.0

compiler   : GCC 4.4.7 20120313 (Red Hat 4.4.7-1)
system     : Linux
release    : 3.13.0-37-generic
machine    : x86_64
processor  : x86_64
CPU cores  : 4
interpreter: 64bit
Git hash   : 

In [9]:
#List of installed conda packages
!conda list


# packages in environment at /home/arb/LocalPython/Anaconda27/anaconda:
#
_license                  1.1                      py27_0  
abstract-rendering        0.5.1                np19py27_0  
accelerate                1.11.0              np19py27_p0  
affine                    1.1.0                    py27_0  
alabaster                 0.7.3                    py27_0  
anaconda                  2.2.0                np19py27_0  
argcomplete               0.8.4                    py27_0  
arrow                     0.5.4                     <pip>
astroid                   1.3.6                     <pip>
astropy                   1.0.2                np19py27_0  
babel                     1.3                      py27_0  
backports.ssl-match-hostname 3.4.0.2                   <pip>
basemap                   1.0.7                np19py27_0  
bcolz                     0.8.1                np19py27_0  
beautiful-soup            4.3.2                    py27_0  
beautifulsoup4            4.3.2                     <pip>
binstar                   0.10.3                   py27_0  
bitarray                  0.8.1                    py27_0  
blaze                     0.8.0                     <pip>
blaze-core                0.8.0                np19py27_0  
blz                       0.6.2                np19py27_0  
bokeh                     0.8.2                np19py27_0  
boto                      2.38.0                   py27_0  
bottle                    0.12.7                   py27_0  
brewer2mpl                1.4                      py27_0  
cairo                     1.12.18                       4  
cartopy                   0.10.0               np18py27_0  
cdecimal                  2.3                      py27_0  
certifi                   14.05.14                 py27_0  
cffi                      0.9.2                    py27_0  
click                     4.0                      py27_0  
cligj                     0.1.0                    py27_0  
cloog                     0.18.0                        0  
clyent                    0.3.4                    py27_0  
colorama                  0.3.3                    py27_0  
conda                     3.14.0                   py27_0  
conda-build               1.12.1                   py27_0  
conda-env                 2.2.3                    py27_0  
configobj                 5.0.6                    py27_0  
cryptography              0.8.2                    py27_0  
cudatoolkit               6.0                          p0  
curl                      7.38.0                        0  
cython                    0.22                     py27_0  
cytoolz                   0.7.2                    py27_0  
datashape                 0.4.5                np19py27_0  
dateutil                  2.4.1                    py27_0  
decorator                 3.4.0                    py27_0  
descartes                 1.0.1                    py27_0  
docutils                  0.12                     py27_0  
dynd-python               0.6.5                np19py27_0  
enum                      0.4.4                     <pip>
enum34                    1.0.4                    py27_0  
fastcache                 1.0.2                    py27_0  
fiona                     1.5.1                np19py27_0  
flask                     0.10.1                   py27_1  
fontconfig                2.11.1                        4  
freetype                  2.5.2                         2  
funcsigs                  0.4                      py27_0  
futures                   2.2.0                    py27_0  
gdal                      1.11.2               np19py27_2  
geopandas                 0.1.1                    py27_0  
geopy                     1.10.0                    <pip>
geos                      3.3.3                         0  
gevent                    1.0.1                    py27_0  
gevent-websocket          0.9.3                    py27_0  
glib                      2.43.0                        2  
gmp                       5.1.2                         2  
greenlet                  0.4.6                    py27_0  
grin                      1.2.1                    py27_1  
h5py                      2.5.0                np19py27_0  
harfbuzz                  0.9.35                        6  
hdf5                      1.8.14                        0  
html5lib                  0.99999                   <pip>
ipython                   3.2.0                    py27_0  
ipython-notebook          3.2.0                    py27_0  
ipython-qtconsole         3.1.0                    py27_0  
isl                       0.12.2                        0  
itsdangerous              0.24                     py27_0  
jdcal                     1.0                      py27_0  
jedi                      0.8.1                    py27_0  
jinja2                    2.7.3                    py27_1  
jpeg                      8d                            0  
jsonschema                2.4.0                    py27_0  
libdynd                   0.6.5                         0  
libffi                    3.0.13                        0  
libgcc                    4.8.4                         1  
libgdal                   1.11.2                        0  
libnetcdf                 4.3.2                         1  
libpng                    1.6.17                        0  
libsodium                 0.4.5                         0  
libtiff                   4.0.2                         1  
libxml2                   2.9.0                         0  
libxslt                   1.1.28                        0  
llvmlite                  0.4.0                    py27_0  
logilab-common            0.63.2                    <pip>
lxml                      3.4.4                    py27_0  
mapnik                    0.1                       <pip>
markupsafe                0.23                     py27_0  
matplotlib                1.4.3                np19py27_2  
mistune                   0.6                      py27_0  
mkl                       11.1                np19py27_p3  
mkl-rt                    11.1                         p0  
mkl-service               1.0.0                   py27_p1  
mklfft                    2.0                 np19py27_p0  
mock                      1.0.1                    py27_0  
mpc                       1.0.1                         0  
mpfr                      3.1.2                         0  
multipledispatch          0.4.7                    py27_0  
ncurses                   5.9                           4  
networkx                  1.9.1                    py27_0  
nltk                      3.0.2                np19py27_0  
nose                      1.3.6                    py27_0  
notedown                  1.4.4                     <pip>
numba                     0.18.2               np19py27_1  
numbapro                  0.18.0              np19py27_p2  
numbapro_cudalib          0.2                           0  
numexpr                   2.3.1               np19py27_p0  [mkl]
numpy                     1.9.2                   py27_p0  [mkl]
odo                       0.3.2                np19py27_0  
openpyxl                  2.0.2                    py27_0  
openssl                   1.0.1k                        1  
pandana                   0.1.2                    py27_0  
pandas                    0.16.2               np19py27_0  
pandasql                  0.6.2                np19py27_0  
pandoc-attributes         0.1.7                     <pip>
pandocfilters             1.2.4                     <pip>
pango                     1.36.8                        3  
patchelf                  0.6                           0  
patsy                     0.3.0                np19py27_0  
pcre                      8.31                          0  
pep8                      1.6.2                    py27_0  
pillow                    2.7.0                    py27_1  
pip                       7.0.3                    py27_0  
pixman                    0.26.2                        0  
plotly                    1.6.17                    <pip>
ply                       3.6                      py27_0  
prettyplotlib             0.1.7                     <pip>
prettytable               0.7.2                    py27_0  
proj4                     4.8.0                         0  
psutil                    2.2.1                    py27_0  
ptyprocess                0.4                      py27_0  
py                        1.4.26                   py27_0  
py2cairo                  1.10.0                   py27_2  
pyasn1                    0.1.7                    py27_0  
pycosat                   0.6.1                    py27_0  
pycparser                 2.12                     py27_0  
pycrypto                  2.6.1                    py27_0  
pycurl                    7.19.5.1                 py27_0  
pyflakes                  0.8.1                    py27_0  
pygments                  2.0.2                    py27_0  
pylint                    1.4.3                     <pip>
pymc                      2.3.4               np19py27_p0  [mkl]
pyopenssl                 0.15.1                   py27_0  
pyparsing                 2.0.3                    py27_0  
pyproj                    1.9.3                    py27_0  
pyqt                      4.11.3                   py27_1  
pysal                     1.6.0                np19py27_1  
pyshp                     1.2.1                     <pip>
pytables                  3.1.1                np19py27_2  
pytest                    2.7.0                    py27_0  
python                    2.7.10                        0  
python-dateutil           2.4.2                    py27_0  
pytz                      2015.4                   py27_0  
pyyaml                    3.11                     py27_1  
pyzmq                     14.7.0                   py27_0  
qt                        4.8.6                         3  
r                         3.1.3                         0  
r-base                    3.1.3                         2  
r-boot                    1.3_16                 r3.1.3_0  
r-class                   7.3_12                 r3.1.3_0  
r-cluster                 1.15.3                        0  
r-codetools               0.2_11                 r3.1.3_0  
r-foreign                 0.8_63                 r3.1.3_0  
r-kernsmooth              2.23_14                r3.1.3_0  
r-lattice                 0.20_31                r3.1.3_0  
r-mass                    7.3.37                        0  
r-matrix                  1.2_1                  r3.1.3_0  
r-mgcv                    1.8_6                  r3.1.3_0  
r-nlme                    3.1.118                       0  
r-nlme                    3.1_120                r3.1.3_0  
r-nnet                    7.3_9                  r3.1.3_0  
r-recommended             3.1.3                         0  
r-rpart                   4.1_9                  r3.1.3_0  
r-spatial                 7.3_9                  r3.1.3_0  
r-survival                2.38_2                 r3.1.3_0  
rasterio                  0.15.1                   py27_0  
readline                  6.2                           2  
redis                     2.6.9                         0  
redis-py                  2.10.3                   py27_0  
requests                  2.7.0                    py27_0  
rope                      0.9.4                    py27_1  
rpy2                      2.5.6                    py27_0  
runipy                    0.1.3                    py27_0  
scikit-image              0.11.3               np19py27_0  
scikit-learn              0.16.1              np19py27_p0  [mkl]
scipy                     0.15.1              np19py27_p0  [mkl]
seaborn                   0.5.1                     <pip>
setuptools                17.1.1                   py27_0  
shapely                   1.5.9                     <pip>
simplejson                3.6.3                    py27_0  
singledispatch            3.4.0.3                  py27_1  
sip                       4.16.5                   py27_0  
six                       1.9.0                    py27_0  
snowballstemmer           1.2.0                    py27_0  
snuggs                    1.3.1                     <pip>
sockjs-tornado            1.0.1                    py27_0  
sphinx                    1.3.1                    py27_0  
sphinx-rtd-theme          0.1.7                     <pip>
sphinx_rtd_theme          0.1.7                    py27_0  
spyder                    2.3.4                    py27_1  
spyder-app                2.3.4                    py27_0  
sqlalchemy                1.0.3                    py27_0  
sqlite                    3.8.4.1                       1  
sqlparse                  0.1.14                   py27_0  
ssl_match_hostname        3.4.0.2                  py27_0  
statsmodels               0.6.1                np19py27_0  
sympy                     0.7.6                    py27_0  
system                    5.8                           2  
tables                    3.1.1                     <pip>
terminado                 0.5                      py27_0  
theano                    0.7.0                np19py27_0  
tk                        8.5.18                        0  
toolz                     0.7.2                    py27_0  
tornado                   4.2                      py27_0  
tweepy                    2.3                      py27_0  
twitter                   1.17.0                    <pip>
ujson                     1.33                     py27_0  
unicodecsv                0.9.4                    py27_0  
urbansim                  2.0.1                     <pip>
util-linux                2.21                          0  
werkzeug                  0.10.4                   py27_0  
xlrd                      0.9.3                    py27_0  
xlsxwriter                0.7.2                    py27_0  
xlwt                      1.0.0                    py27_0  
yaml                      0.1.6                         0  
zeromq                    4.0.5                         0  
zlib                      1.2.8                         0  

In [10]:
#List of installed pip packages
!pip list


abstract-rendering (0.5.1)
affine (1.1.0)
alabaster (0.7.3)
argcomplete (0.8.4)
arrow (0.5.4)
astroid (1.3.6)
astropy (1.0.2)
Babel (1.3)
backports.ssl-match-hostname (3.4.0.2)
basemap (1.0.7)
bcolz (0.8.1)
beautifulsoup4 (4.3.2)
binstar (0.10.3)
bitarray (0.8.1)
blaze (0.8.0)
blz (0.6.2)
bokeh (0.8.2)
boto (2.38.0)
bottle (0.12.7)
brewer2mpl (1.4.1)
Cartopy (0.10.0)
cdecimal (2.3)
certifi (14.5.14)
cffi (0.9.2)
click (4.0)
cligj (0.1.0)
clyent (0.3.4)
colorama (0.3.3)
conda (3.14.0)
conda-build (1.12.1)
conda-env (2.2.3)
configobj (5.0.6)
cryptography (0.8.2)
Cython (0.22)
cytoolz (0.7.2)
datashape (0.4.5)
decorator (3.4.0)
descartes (1.0.1)
docutils (0.12)
enum (0.4.4)
enum34 (1.0.4)
fastcache (1.0.2)
Fiona (1.5.1)
Flask (0.10.1)
funcsigs (0.4)
futures (2.2.0)
GDAL (1.11.2)
geopandas (0.1.1)
geopy (1.10.0)
gevent (1.0.1)
gevent-websocket (0.9.3)
greenlet (0.4.6)
grin (1.2.1)
h5py (2.5.0)
html5lib (0.99999)
ipython (3.2.0)
itsdangerous (0.24)
jdcal (1.0)
jedi (0.8.1)
Jinja2 (2.7.3)
jsonschema (2.4.0)
llvmlite (0.4.0)
logilab-common (0.63.2)
lxml (3.4.4)
mapnik (0.1)
MarkupSafe (0.23)
matplotlib (1.4.3)
mistune (0.6)
mklfft (0.0.0)
mock (1.0.1)
multipledispatch (0.4.7)
networkx (1.9.1)
nltk (3.0.2)
nose (1.3.6)
notedown (1.4.4)
numba (0.18.2)
numbapro (0.18.0)
numexpr (2.3.1)
numpy (1.9.2)
odo (0.3.2)
openpyxl (2.0.2)
pandana (0.1.2)
pandas (0.16.2)
pandasql (0.6.2)
pandoc-attributes (0.1.7)
pandocfilters (1.2.4)
patsy (0.3.0)
pep8 (1.6.2)
Pillow (2.7.0)
pip (7.0.3)
plotly (1.6.17)
ply (3.6)
prettyplotlib (0.1.7)
prettytable (0.7.2)
psutil (2.2.1)
ptyprocess (0.4)
py (1.4.26)
pyasn1 (0.1.7)
pycosat (0.6.1)
pycparser (2.12)
pycrypto (2.6.1)
pycurl (7.19.5.1)
pyflakes (0.8.1)
Pygments (2.0.2)
pylint (1.4.3)
pymc (2.3.4)
pyOpenSSL (0.15.1)
pyparsing (2.0.3)
pyproj (1.9.4)
PySAL (1.6.0)
pyshp (1.2.1)
pytest (2.7.0)
python-dateutil (2.4.2)
pytz (2015.4)
PyYAML (3.11)
pyzmq (14.7.0)
rasterio (0.23.0)
redis (2.10.3)
requests (2.7.0)
rope (0.9.4)
rpy2 (2.5.6)
runipy (0.1.3)
scikit-image (0.11.3)
scikit-learn (0.16.1)
scipy (0.15.1)
seaborn (0.5.1)
setuptools (17.1.1)
Shapely (1.5.9)
simplejson (3.6.3)
singledispatch (3.4.0.3)
six (1.9.0)
snowballstemmer (1.2.0)
snuggs (1.3.1)
sockjs-tornado (1.0.1)
Sphinx (1.2.3)
sphinx-rtd-theme (0.1.7)
spyder (2.3.4)
SQLAlchemy (1.0.3)
sqlparse (0.1.14)
statsmodels (0.6.1)
sympy (0.7.6)
tables (3.1.1)
terminado (0.5)
Theano (0.7.0)
toolz (0.7.2)
tornado (4.2)
tweepy (2.3.0)
twitter (1.17.0)
ujson (1.33)
unicodecsv (0.9.4)
urbansim (2.0.1)
Werkzeug (0.10.4)
xlrd (0.9.3)
XlsxWriter (0.7.2)
xlwt (1.0.0)

Background

You need to install the RISE Ipython Library from Damián Avila for dynamic presentations

To convert and run this as a static presentation run the following command:


In [ ]:
!ipython nbconvert Template.ipynb --to slides --post serve

To close this instances press control 'c' in the ipython notebook terminal console

Static presentations allow the presenter to see speakers notes (use the 's' key)

If running dynamically run the scripts below

Pre load some useful libraries


In [13]:
#Future proof python 2
from __future__ import print_function #For python3 print syntax
from __future__ import division

# def
import IPython.core.display

# A function to collect user input - ipynb_input(varname='username', prompt='What is your username')

def ipynb_input(varname, prompt=''):
        """Prompt user for input and assign string val to given variable name."""
        js_code = ("""
            var value = prompt("{prompt}","");
            var py_code = "{varname} = '" + value + "'";
            IPython.notebook.kernel.execute(py_code);
        """).format(prompt=prompt, varname=varname)
        return IPython.core.display.Javascript(js_code)
    
# inline

%pylab inline


Populating the interactive namespace from numpy and matplotlib

About me

  • Research Fellow, University of Nottingham: orcid
  • Director, Geolytics Limited - A spatial data analytics consultancy

In the beginning was the geoword

and the geoword was cartography


In [ ]: