{ "metadata": { "name": "", "signature": "sha256:5e23527dd52e65cb4c26a0f790b558b082d9b4e039eb67e53687429b2a1decd1" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "IPython Notebook Basics" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Project directory" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* IPython Notebooks are just files (`.ipynb`) on your file system\n", "* The Notebook server is aware of Notebooks in a single directory, which we call the **Notebook directory**\n", "* If you cd to a Notebook directory and type:\n", "\n", " ipython notebook\n", "\n", " you will see the Notebooks in that directory in the dashboard" ] }, { "cell_type": "heading", "level": 2, "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Notebook files" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Notebook files:\n", "\n", "* Are just that - files (`.ipynb`) on your file system\n", "* Contain JSON data" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from IPython.nbformat import current\n", "with open('Notebook Basics.ipynb') as f:\n", " nb = current.read(f, 'json')" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "code", "collapsed": false, "input": [ "nb.worksheets[0].cells[0:5]" ], "language": "python", "metadata": {}, "outputs": [ { "metadata": {}, "output_type": "pyout", "prompt_number": 2, "text": [ "[{u'cell_type': u'heading',\n", " u'level': 1,\n", " u'metadata': {u'slideshow': {u'slide_type': u'slide'}},\n", " u'source': u'IPython Notebook Basics'},\n", " {u'cell_type': u'heading',\n", " u'level': 2,\n", " u'metadata': {},\n", " u'source': u'Project directory'},\n", " {u'cell_type': u'markdown',\n", " u'metadata': {},\n", " u'source': u'* IPython Notebooks are just files (`.ipynb`) on your file system\\n* The Notebook server is aware of Notebooks in a single directory, which we call the **Notebook directory**\\n* If you cd to a Notebook directory and type:\\n\\n ipython notebook\\n\\n you will see the Notebooks in that directory in the dashboard'},\n", " {u'cell_type': u'heading',\n", " u'level': 2,\n", " u'metadata': {u'slideshow': {u'slide_type': u'slide'}},\n", " u'source': u'Notebook files'},\n", " {u'cell_type': u'markdown',\n", " u'metadata': {},\n", " u'source': u'Notebook files:\\n\\n* Are just that - files (`.ipynb`) on your file system\\n* Contain JSON data'}]" ] } ], "prompt_number": 2 }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "* Embed code, Markdown text, LaTeX equations, images\n", "* Are version control friendly: post your Notebooks on GitHub\n", "* Can be viewed online by anyone at http://nbviewer.ipython.org" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "IPython Notebooks can also be exported to `.py` files (see \"File:Download As\" menu item). You can tell the Notebook server to always save these `.py` files alongside the `.ipynb` files by starting the Notebook as:\n", "\n", " ipython notebook --script\n", "\n", "You can import Notebooks from the main Dashboard or simply by copying a Notebook into the Notebook directory." ] }, { "cell_type": "heading", "level": 2, "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Overview of the UI" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Dashboard\n", "* Notebook area and cells\n", "* Menu\n", "* Toolbar" ] }, { "cell_type": "heading", "level": 2, "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Cell types" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* Code\n", "* Markdown\n", "* Raw text\n", "* Heading" ] }, { "cell_type": "heading", "level": 2, "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "Keyboard shortcuts" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* `Shift-Enter` to run a cell\n", "* `Ctrl-Enter` to run a cell in place\n", "* All other keyboard shortcuts have the form: `Ctrl-m ?`\n", "* Show all keyboard shortcuts using `Ctrl-m h`" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Sharing/displaying notebooks as html" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "[nbviewer-a simple way to share ipython notebooks](http://nbviewer.ipython.org/)" ] }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [] } ], "metadata": {} } ] }