Sharedsupport / notebook-slideshow-example.ipynbOpen in CoCalc
Author: William A. Stein
License: GNU General Public License v3.0
Description: Examples for support purposes.

Title here: a Notebook-based talk

With a great subtitle!

[ipython.org](http://ipython.org)

Fernando Pérez

[fperez.org](http://fperez.org), [@fperez_org](http://twitter.com/fperez_org)

U.C. Berkeley

How to use this to write slideshows...

Installation check

First, this presumes you've already read and executed once the accompanying install-support notebook, which should install the necessary tools for you, and you restarted your notebook server. If everything went well, right now your toolbar should look like this, with a new button highlighted here in red:

img

That new button is the toggle to enter live slideshow mode, which you can use to switch between the normal editing mode (with the whole notebook as one long scrolling document) and the presentation mode.

Loading the CSS

All the CSS is kept in a file called style.css, and it's loaded, along with a few handy utilities, by the talktools.py script. Simply run it once to load everything, or if you make any tweaks to the CSS:

In [30]:
# I keep this as a cell in my title slide so I can rerun # it easily if I make changes, but it's low enough it won't # be visible in presentation mode. %run talktools
{"html":["<style>\n","\n",".rendered_html\n","{\n","  color: #2C5494;\n","  font-family: Ubuntu;\n","  font-size: 140%;\n","  line-height: 1.1;\n","  margin: 0.5em 0;\n","  }\n","\n",".title\n","{\n","  color: #498AF3;\n","  font-size: 250%;\n","  font-weight:bold;\n","  line-height: 1.2; \n","  margin: 10px 50px 10px;\n","  }\n","\n",".subtitle\n","{\n","  color: #386BBC;\n","  font-size: 180%;\n","  font-weight:bold;\n","  line-height: 1.2; \n","  margin: 20px 50px 20px;\n","  }\n","\n",".slide-header, p.slide-header\n","{\n","  color: #498AF3;\n","  font-size: 200%;\n","  font-weight:bold;\n","  margin: 0px 20px 10px;\n","  page-break-before: always;\n","  text-align: center;\n","  }\n","\n",".rendered_html h1\n","{\n","  color: #498AF3;\n","  line-height: 1.2; \n","  margin: 0.15em 0em 0.5em;\n","  page-break-before: always;\n","  text-align: center;\n","  }\n","\n","\n",".rendered_html h2\n","{ \n","  color: #386BBC;\n","  line-height: 1.2;\n","  margin: 1.1em 0em 0.5em;\n","  }\n","\n",".rendered_html h3\n","{ \n","  font-size: 100%;\n","  line-height: 1.2;\n","  margin: 1.1em 0em 0.5em;\n","  }\n","\n",".rendered_html li\n","{\n","  line-height: 1.8;\n","  }\n","\n",".input_prompt, .CodeMirror-lines, .output_area\n","{\n","  font-family: Consolas;\n","  font-size: 120%;\n","  }\n","\n",".gap-above\n","{\n","  padding-top: 200px;\n","  }\n","\n",".gap01\n","{\n","  padding-top: 10px;\n","  }\n","\n",".gap05\n","{\n","  padding-top: 50px;\n","  }\n","\n",".gap1\n","{\n","  padding-top: 100px;\n","  }\n","\n",".gap2\n","{\n","  padding-top: 200px;\n","  }\n","\n",".gap3\n","{\n","  padding-top: 300px;\n","  }\n","\n",".emph\n","{\n","  color: #386BBC;\n","  }\n","\n",".warn\n","{\n","  color: red;\n","  }\n","\n",".center\n","{\n","  text-align: center;\n","  }\n","\n",".nb_link\n","{\n","    padding-bottom: 0.5em;\n","}\n","\n","</style>\n"],"metadata":{},"output_type":"display_data","text":["<IPython.core.display.HTML at 0x2872410>"]}
In [27]:
website('nbviewer.ipython.org', 'Notebook Viewer - nbviewer')

Editing

Once you've loaded the above, the editing workflow (a bit primitive, admittedly) is:

  • From the "Cell Toolbar" menu, select "Slideshow". This will give you a little dropdown for each cell.

  • To start a new slide, mark a cell as "Slide".

  • If you want a chunk of a slide to be revealed incrementally, mark it as 'Fragment'.

  • See the source for the various slides in this file or the contents of the style.css file for various useful CSS classes that you can use.

Note One thing this mode does NOT have is any notion of page size. What I do to estimate the size of my slides is to resize my browser window so the slideshow area is ~ 760px tall. Since most projectors work at 1024x768, this works well. I try to keep most of them confined to that vertical size, though if needed it's still OK to have taller ones, you just need to remember to scroll them down during presentation.

Presenting

For presentations, you should toggle the "Cell toolbar" menu to "None", so that it doesn't appear in your slides. Then you can move back and forth with the GUI controls.

If you click on the "Enable Slide Mode" button, the right/left arrows will become also keys to move between slides. But note that at any point if you start typing into the notebook, that functionality will be inactivated, so you can use the arrows normally. You can turn it on again for further presentation by clicking the button again.

Example slides

The next slides are a few example ones from a real talk of mine, so you can get a sense for how to lay things out in a presentation.

Why IPython?
*"The purpose of computing is insight, not numbers"*

Hamming '62

The Lifecycle of a Scientific Idea (schematically)

  1. Individual exploratory work
  2. Collaborative development
  3. Parallel production runs (HPC, cloud, ...)
  4. Publication (with reproducible results!)
  5. Education
  6. Goto 1.
From a better shell...
... to sharing notebooks with zero-install...
## Matthias Bussonnier, 2012
In [3]:
website('nbviewer.ipython.org', 'Notebook Viewer - nbviewer')
... to the first White House Hackathon...
## IPython and NetworkX go to DC
In [158]:
YouTubeVideo('sjfsUzECqK0', start='40', width=600, height=400)

IPython.parallel

  • Cluster: one controller (master), N dynamic engines (slaves). N300N \lesssim 300.
  • Accessed by users via dynamic proxy: parallel.Client.
  • A Client creates as many views as desired by user:
    • DirectView: SPMD.
    • LoadBalancedView: automatic task distribution.
    • Blocking and async APIs.
    • Direct put and get (and scatter/gather).
    • Views can span arbitrary subgroups of the cluster.
    • Multiple views coexist simultaneously.
  • One-sided communication model.
  • Happy coexistence with MPI.
  • All comms with ØMQ, in C++, no GIL, zero-copy when possible.

Lessons in building a community

A delicate balancing act

  • Individual leadership and sense of ownership vs turf wars.
  • Clear project vision vs. broad engagement of a community with many ideas.

Disagreement: highly reactive fuel

  • Can power creativity or spectacularly blow up.
  • Patience, trust, generosity and respect.
  • Make calls and live with the mistakes without recrimination.

The rules apply to everyone, starting with me

  • Even if they slow me down!