Beyond Plain Python.ipynb
1804 lines
| 65.9 KiB
| text/plain
|
TextLexer
Brian E. Granger
|
r17503 | { | |
Min RK
|
r18669 | "cells": [ | |
Brian E. Granger
|
r17503 | { | |
Min RK
|
r18669 | "cell_type": "markdown", | |
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"# IPython: beyond plain Python" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"When executing code in IPython, all valid Python syntax works as-is, but IPython provides a number of features designed to make the interactive experience more fluid and efficient." | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"## First things first: running code, getting help" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"In the notebook, to run a cell of code, hit `Shift-Enter`. This executes the cell and puts the cursor in the next cell below, or makes a new one if you are at the end. Alternately, you can use:\n", | |||
" \n", | |||
"- `Alt-Enter` to force the creation of a new cell unconditionally (useful when inserting new content in the middle of an existing notebook).\n", | |||
"- `Control-Enter` executes the cell and keeps the cursor in the same cell, useful for quick experimentation of snippets that you don't need to keep permanently." | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 1, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"Hi\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"print \"Hi\"" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"Getting help:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 2, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"?" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"Typing `object_name?` will print all sorts of details about any object, including docstrings, function definition lines (for call arguments) and constructor details for classes." | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 3, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"import collections\n", | |||
"collections.namedtuple?" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 4, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"collections.Counter??" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 5, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"*int*?" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"An IPython quick reference card:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 6, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"%quickref" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"## Tab completion" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Tab completion, especially for attributes, is a convenient way to explore the structure of any object you\u2019re dealing with. Simply type `object_name.<TAB>` to view the object\u2019s attributes. Besides Python objects and keywords, tab completion also works on file and directory names." | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 8, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"collections." | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"## The interactive workflow: input, output, history" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 7, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"data": { | |||
"text/plain": [ | |||
"12" | |||
] | |||
Brian E. Granger
|
r17503 | }, | |
Min RK
|
r18669 | "execution_count": 7, | |
Brian E. Granger
|
r17503 | "metadata": {}, | |
Min RK
|
r18669 | "output_type": "execute_result" | |
} | |||
], | |||
"source": [ | |||
"2+10" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 8, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"data": { | |||
"text/plain": [ | |||
"22" | |||
] | |||
Brian E. Granger
|
r17503 | }, | |
Min RK
|
r18669 | "execution_count": 8, | |
Brian E. Granger
|
r17503 | "metadata": {}, | |
Min RK
|
r18669 | "output_type": "execute_result" | |
} | |||
], | |||
"source": [ | |||
"_+10" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"You can suppress the storage and rendering of output if you append `;` to the last cell (this comes in handy when plotting with matplotlib, for example):" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 9, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"10+20;" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 10, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"data": { | |||
"text/plain": [ | |||
"22" | |||
] | |||
Brian E. Granger
|
r17503 | }, | |
Min RK
|
r18669 | "execution_count": 10, | |
Brian E. Granger
|
r17503 | "metadata": {}, | |
Min RK
|
r18669 | "output_type": "execute_result" | |
} | |||
], | |||
"source": [ | |||
"_" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"The output is stored in `_N` and `Out[N]` variables:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 11, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"data": { | |||
"text/plain": [ | |||
"True" | |||
] | |||
Brian E. Granger
|
r17503 | }, | |
Min RK
|
r18669 | "execution_count": 11, | |
Brian E. Granger
|
r17503 | "metadata": {}, | |
Min RK
|
r18669 | "output_type": "execute_result" | |
} | |||
], | |||
"source": [ | |||
"_10 == Out[10]" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"And the last three have shorthands for convenience:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 12, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"last output: True\n", | |||
"next one : 22\n", | |||
"and next : 22\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"print 'last output:', _\n", | |||
"print 'next one :', __\n", | |||
"print 'and next :', ___" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 13, | |||
"metadata": { | |||
"collapsed": false, | |||
"slideshow": { | |||
"slide_type": "-" | |||
} | |||
}, | |||
"outputs": [ | |||
Brian E. Granger
|
r17503 | { | |
Min RK
|
r18669 | "data": { | |
"text/plain": [ | |||
"u'_10 == Out[10]'" | |||
] | |||
Brian E. Granger
|
r17503 | }, | |
Min RK
|
r18669 | "execution_count": 13, | |
Brian E. Granger
|
r17503 | "metadata": {}, | |
Min RK
|
r18669 | "output_type": "execute_result" | |
} | |||
], | |||
"source": [ | |||
"In[11]" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 14, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"data": { | |||
"text/plain": [ | |||
"u'In[11]'" | |||
] | |||
Brian E. Granger
|
r17503 | }, | |
Min RK
|
r18669 | "execution_count": 14, | |
Brian E. Granger
|
r17503 | "metadata": {}, | |
Min RK
|
r18669 | "output_type": "execute_result" | |
} | |||
], | |||
"source": [ | |||
"_i" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 15, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"data": { | |||
"text/plain": [ | |||
"u'In[11]'" | |||
] | |||
Brian E. Granger
|
r17503 | }, | |
Min RK
|
r18669 | "execution_count": 15, | |
Brian E. Granger
|
r17503 | "metadata": {}, | |
Min RK
|
r18669 | "output_type": "execute_result" | |
} | |||
], | |||
"source": [ | |||
"_ii" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 16, | |||
"metadata": { | |||
"collapsed": false, | |||
"slideshow": { | |||
"slide_type": "subslide" | |||
} | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"last input: _ii\n", | |||
"next one : _i\n", | |||
"and next : In[11]\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"print 'last input:', _i\n", | |||
"print 'next one :', _ii\n", | |||
"print 'and next :', _iii" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 17, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
" 1: print \"Hi\"\n", | |||
" 2: ?\n", | |||
" 3:\n", | |||
"import collections\n", | |||
"collections.namedtuple?\n", | |||
" 4: collections.Counter??\n", | |||
" 5: *int*?\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"%history -n 1-5" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "subslide" | |||
} | |||
}, | |||
"source": [ | |||
"**Exercise**\n", | |||
"\n", | |||
"Write the last 10 lines of history to a file named `log.py`." | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": { | |||
"slideshow": { | |||
"slide_type": "slide" | |||
} | |||
}, | |||
"source": [ | |||
"## Accessing the underlying operating system" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 18, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"/home/fperez/ipython/tutorial/notebooks\r\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"!pwd" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 19, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"My current directory's files:\n", | |||
"['BackgroundJobs.ipynb', 'Custom Display Logic.ipynb', 'Customizing IPython - Condensed.ipynb', 'Customizing IPython - Config.ipynb', 'Customizing IPython - Extensions.ipynb', 'Customizing IPython - Magics.ipynb', 'data', 'figs', 'flare.json', 'Index.ipynb', 'Interactive Widgets.ipynb', 'IPython - beyond plain Python.ipynb', 'kernel-embedding', 'Markdown Cells.ipynb', 'myscript.py', 'nbconvert_arch.png', 'NbConvert from command line.ipynb', 'NbConvert Python library.ipynb', 'Notebook and javascript extension.ipynb', 'Notebook Basics.ipynb', 'Overview of IPython.parallel.ipynb', 'parallel', 'Rich Display System.ipynb', 'Running a Secure Public Notebook.ipynb', 'Running Code.ipynb', 'Sample.ipynb', 'soln', 'Terminal usage.ipynb', 'text_analysis.py', 'Typesetting Math Using MathJax.ipynb']\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"files = !ls\n", | |||
"print \"My current directory's files:\"\n", | |||
"print files" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 20, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"[BackgroundJobs.ipynb, Custom Display Logic.ipynb, Customizing IPython - Condensed.ipynb, Customizing IPython - Config.ipynb, Customizing IPython - Extensions.ipynb, Customizing IPython - Magics.ipynb, data, figs, flare.json, Index.ipynb, Interactive Widgets.ipynb, IPython - beyond plain Python.ipynb, kernel-embedding, Markdown Cells.ipynb, myscript.py, nbconvert_arch.png, NbConvert from command line.ipynb, NbConvert Python library.ipynb, Notebook and javascript extension.ipynb, Notebook Basics.ipynb, Overview of IPython.parallel.ipynb, parallel, Rich Display System.ipynb, Running a Secure Public Notebook.ipynb, Running Code.ipynb, Sample.ipynb, soln, Terminal usage.ipynb, text_analysis.py, Typesetting Math Using MathJax.ipynb]\r\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"!echo $files" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 21, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"BACKGROUNDJOBS.IPYNB\r\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"!echo {files[0].upper()}" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Note that all this is available even in multiline blocks:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 27, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"00 - BackgroundJobs\r\n", | |||
"01 - Custom Display Logic\r\n", | |||
"02 - Customizing IPython - Condensed\r\n", | |||
"03 - Customizing IPython - Config\r\n", | |||
"04 - Customizing IPython - Extensions\r\n", | |||
"05 - Customizing IPython - Magics\r\n", | |||
"--\n", | |||
"--\n", | |||
"--\n", | |||
"09 - Index\r\n", | |||
"10 - Interactive Widgets\r\n", | |||
"11 - IPython - beyond plain Python\r\n", | |||
"--\n", | |||
"13 - Markdown Cells\r\n", | |||
"--\n", | |||
"--\n", | |||
"16 - NbConvert from command line\r\n", | |||
"17 - NbConvert Python library\r\n", | |||
"18 - Notebook and javascript extension\r\n", | |||
"19 - Notebook Basics\r\n", | |||
"20 - Overview of IPython.parallel\r\n", | |||
"--\n", | |||
"22 - Rich Display System\r\n", | |||
"23 - Running a Secure Public Notebook\r\n", | |||
"24 - Running Code\r\n", | |||
"25 - Sample\r\n", | |||
"--\n", | |||
"27 - Terminal usage\r\n", | |||
"--\n", | |||
"29 - Typesetting Math Using MathJax\r\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"import os\n", | |||
"for i,f in enumerate(files):\n", | |||
" if f.endswith('ipynb'):\n", | |||
" !echo {\"%02d\" % i} - \"{os.path.splitext(f)[0]}\"\n", | |||
" else:\n", | |||
" print '--'" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"## Beyond Python: magic functions" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"The IPyhton 'magic' functions are a set of commands, invoked by prepending one or two `%` signs to their name, that live in a namespace separate from your normal Python variables and provide a more command-like interface. They take flags with `--` and arguments without quotes, parentheses or commas. The motivation behind this system is two-fold:\n", | |||
" \n", | |||
"- To provide an orthogonal namespace for controlling IPython itself and exposing other system-oriented functionality.\n", | |||
"\n", | |||
"- To expose a calling mode that requires minimal verbosity and typing while working interactively. Thus the inspiration taken from the classic Unix shell style for commands." | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 28, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"%magic" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Line vs cell magics:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 29, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"10000000 loops, best of 3: 190 ns per loop\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"%timeit range(10)" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 30, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"1000000 loops, best of 3: 888 ns per loop\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"%%timeit\n", | |||
"range(10)\n", | |||
"range(100)" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Line magics can be used even inside code blocks:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 31, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"size: 010000000 loops, best of 3: 129 ns per loop\n", | |||
" size: 1001000000 loops, best of 3: 649 ns per loop\n", | |||
" size: 2001000000 loops, best of 3: 1.09 \u00b5s per loop\n", | |||
" size: 3001000000 loops, best of 3: 1.74 \u00b5s per loop\n", | |||
" size: 400100000 loops, best of 3: 2.72 \u00b5s per loop\n", | |||
"\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"for i in range(5):\n", | |||
" size = i*100\n", | |||
" print 'size:',size, \n", | |||
" %timeit range(size)" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Magics can do anything they want with their input, so it doesn't have to be valid Python:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 32, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"My shell is: /bin/bash\n", | |||
"My memory status is:\n", | |||
" total used free shared buffers cached\n", | |||
"Mem: 7870888 6389328 1481560 0 662860 2505172\n", | |||
"-/+ buffers/cache: 3221296 4649592\n", | |||
"Swap: 3905532 4852 3900680\n" | |||
] | |||
} | |||
], | |||
"source": [ | |||
"%%bash\n", | |||
"echo \"My shell is:\" $SHELL\n", | |||
"echo \"My memory status is:\"\n", | |||
"free" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Another interesting cell magic: create any file you want locally from the notebook:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 33, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"Writing test.txt\n" | |||
] | |||
} | |||
], | |||
"source": [ | |||
"%%writefile test.txt\n", | |||
"This is a test file!\n", | |||
"It can contain anything I want...\n", | |||
"\n", | |||
"And more..." | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 34, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"This is a test file!\r\n", | |||
"It can contain anything I want...\r\n", | |||
"\r\n", | |||
Brian E. Granger
|
r17503 | "And more..." | |
] | |||
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"!cat test.txt" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Let's see what other magics are currently defined in the system:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 35, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"data": { | |||
"application/json": { | |||
"cell": { | |||
"!": "OSMagics", | |||
"HTML": "Other", | |||
"SVG": "Other", | |||
"bash": "Other", | |||
"capture": "ExecutionMagics", | |||
"debug": "ExecutionMagics", | |||
"file": "Other", | |||
"html": "DisplayMagics", | |||
"javascript": "DisplayMagics", | |||
"latex": "DisplayMagics", | |||
"perl": "Other", | |||
"prun": "ExecutionMagics", | |||
"pypy": "Other", | |||
"python": "Other", | |||
"python2": "Other", | |||
"python3": "Other", | |||
"ruby": "Other", | |||
"script": "ScriptMagics", | |||
"sh": "Other", | |||
"svg": "DisplayMagics", | |||
"sx": "OSMagics", | |||
"system": "OSMagics", | |||
"time": "ExecutionMagics", | |||
"timeit": "ExecutionMagics", | |||
"writefile": "OSMagics" | |||
}, | |||
"line": { | |||
"alias": "OSMagics", | |||
"alias_magic": "BasicMagics", | |||
"autocall": "AutoMagics", | |||
"automagic": "AutoMagics", | |||
"autosave": "KernelMagics", | |||
"bookmark": "OSMagics", | |||
"cat": "Other", | |||
"cd": "OSMagics", | |||
"cl": "Other", | |||
"clear": "KernelMagics", | |||
"clk": "Other", | |||
"colors": "BasicMagics", | |||
"config": "ConfigMagics", | |||
"connect_info": "KernelMagics", | |||
"cp": "Other", | |||
"d": "Other", | |||
"dd": "Other", | |||
"debug": "ExecutionMagics", | |||
"dhist": "OSMagics", | |||
"dirs": "OSMagics", | |||
"dl": "Other", | |||
"doctest_mode": "KernelMagics", | |||
"dx": "Other", | |||
"ed": "Other", | |||
"edit": "KernelMagics", | |||
"env": "OSMagics", | |||
"gui": "BasicMagics", | |||
"hist": "Other", | |||
"history": "HistoryMagics", | |||
"install_default_config": "DeprecatedMagics", | |||
"install_ext": "ExtensionMagics", | |||
"install_profiles": "DeprecatedMagics", | |||
"killbgscripts": "ScriptMagics", | |||
"ldir": "Other", | |||
"less": "KernelMagics", | |||
"lf": "Other", | |||
"lk": "Other", | |||
"ll": "Other", | |||
"load": "CodeMagics", | |||
"load_ext": "ExtensionMagics", | |||
"loadpy": "CodeMagics", | |||
"logoff": "LoggingMagics", | |||
"logon": "LoggingMagics", | |||
"logstart": "LoggingMagics", | |||
"logstate": "LoggingMagics", | |||
"logstop": "LoggingMagics", | |||
"ls": "Other", | |||
"lsmagic": "BasicMagics", | |||
"lx": "Other", | |||
"macro": "ExecutionMagics", | |||
"magic": "BasicMagics", | |||
"man": "KernelMagics", | |||
"matplotlib": "PylabMagics", | |||
"mkdir": "Other", | |||
"more": "KernelMagics", | |||
"mv": "Other", | |||
"notebook": "BasicMagics", | |||
"page": "BasicMagics", | |||
"pastebin": "CodeMagics", | |||
"pdb": "ExecutionMagics", | |||
"pdef": "NamespaceMagics", | |||
"pdoc": "NamespaceMagics", | |||
"pfile": "NamespaceMagics", | |||
"pinfo": "NamespaceMagics", | |||
"pinfo2": "NamespaceMagics", | |||
"popd": "OSMagics", | |||
"pprint": "BasicMagics", | |||
"precision": "BasicMagics", | |||
"profile": "BasicMagics", | |||
"prun": "ExecutionMagics", | |||
"psearch": "NamespaceMagics", | |||
"psource": "NamespaceMagics", | |||
"pushd": "OSMagics", | |||
"pwd": "OSMagics", | |||
"pycat": "OSMagics", | |||
"pylab": "PylabMagics", | |||
"qtconsole": "KernelMagics", | |||
"quickref": "BasicMagics", | |||
"recall": "HistoryMagics", | |||
"rehashx": "OSMagics", | |||
"reload_ext": "ExtensionMagics", | |||
"rep": "Other", | |||
"rerun": "HistoryMagics", | |||
"reset": "NamespaceMagics", | |||
"reset_selective": "NamespaceMagics", | |||
"rm": "Other", | |||
"rmdir": "Other", | |||
"run": "ExecutionMagics", | |||
"save": "CodeMagics", | |||
"sc": "OSMagics", | |||
"store": "StoreMagics", | |||
"sx": "OSMagics", | |||
"system": "OSMagics", | |||
"tb": "ExecutionMagics", | |||
"time": "ExecutionMagics", | |||
"timeit": "ExecutionMagics", | |||
"unalias": "OSMagics", | |||
"unload_ext": "ExtensionMagics", | |||
"who": "NamespaceMagics", | |||
"who_ls": "NamespaceMagics", | |||
"whos": "NamespaceMagics", | |||
"xdel": "NamespaceMagics", | |||
"xmode": "BasicMagics" | |||
} | |||
}, | |||
"text/plain": [ | |||
"Available line magics:\n", | |||
"%alias %alias_magic %autocall %automagic %autosave %bookmark %cat %cd %cl %clear %clk %colors %config %connect_info %cp %d %dd %debug %dhist %dirs %dl %doctest_mode %dx %ed %edit %env %gui %hist %history %install_default_config %install_ext %install_profiles %killbgscripts %ldir %less %lf %lk %ll %load %load_ext %loadpy %logoff %logon %logstart %logstate %logstop %ls %lsmagic %lx %macro %magic %man %matplotlib %mkdir %more %mv %notebook %page %pastebin %pdb %pdef %pdoc %pfile %pinfo %pinfo2 %popd %pprint %precision %profile %prun %psearch %psource %pushd %pwd %pycat %pylab %qtconsole %quickref %recall %rehashx %reload_ext %rep %rerun %reset %reset_selective %rm %rmdir %run %save %sc %store %sx %system %tb %time %timeit %unalias %unload_ext %who %who_ls %whos %xdel %xmode\n", | |||
"\n", | |||
"Available cell magics:\n", | |||
"%%! %%HTML %%SVG %%bash %%capture %%debug %%file %%html %%javascript %%latex %%perl %%prun %%pypy %%python %%python2 %%python3 %%ruby %%script %%sh %%svg %%sx %%system %%time %%timeit %%writefile\n", | |||
"\n", | |||
"Automagic is ON, % prefix IS NOT needed for line magics." | |||
] | |||
}, | |||
"execution_count": 35, | |||
Brian E. Granger
|
r17503 | "metadata": {}, | |
Min RK
|
r18669 | "output_type": "execute_result" | |
} | |||
], | |||
"source": [ | |||
"%lsmagic" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"## Running normal Python code: execution and errors" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Not only can you input normal Python code, you can even paste straight from a Python or IPython shell session:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 36, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"1\n", | |||
"1\n", | |||
"2\n", | |||
"3\n", | |||
"5\n", | |||
"8\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
">>> # Fibonacci series:\n", | |||
"... # the sum of two elements defines the next\n", | |||
"... a, b = 0, 1\n", | |||
">>> while b < 10:\n", | |||
"... print b\n", | |||
"... a, b = b, a+b" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 37, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"0 1 2 3 4 5 6 7 8 9\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"In [1]: for i in range(10):\n", | |||
" ...: print i,\n", | |||
" ...: " | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"And when your code produces errors, you can control how they are displayed with the `%xmode` magic:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 38, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"Writing mod.py\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"%%writefile mod.py\n", | |||
"\n", | |||
"def f(x):\n", | |||
" return 1.0/(x-1)\n", | |||
"\n", | |||
"def g(y):\n", | |||
" return f(y+1)" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Now let's call the function `g` with an argument that would produce an error:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 39, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"ename": "ZeroDivisionError", | |||
"evalue": "float division by zero", | |||
"output_type": "error", | |||
"traceback": [ | |||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", | |||
"\u001b[1;32m<ipython-input-39-a54c5799f57e>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mmod\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mmod\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", | |||
"\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mg\u001b[1;34m(y)\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", | |||
"\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mf\u001b[1;34m(x)\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[1;36m1.0\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |||
"\u001b[1;31mZeroDivisionError\u001b[0m: float division by zero" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"import mod\n", | |||
"mod.g(0)" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 40, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"Exception reporting mode: Plain\n" | |||
Brian E. Granger
|
r17503 | ] | |
}, | |||
{ | |||
Min RK
|
r18669 | "ename": "ZeroDivisionError", | |
"evalue": "float division by zero", | |||
"output_type": "error", | |||
"traceback": [ | |||
"Traceback \u001b[1;36m(most recent call last)\u001b[0m:\n", | |||
" File \u001b[0;32m\"<ipython-input-40-5a5bcec1553f>\"\u001b[0m, line \u001b[0;32m2\u001b[0m, in \u001b[0;35m<module>\u001b[0m\n mod.g(0)\n", | |||
" File \u001b[0;32m\"mod.py\"\u001b[0m, line \u001b[0;32m6\u001b[0m, in \u001b[0;35mg\u001b[0m\n return f(y+1)\n", | |||
"\u001b[1;36m File \u001b[1;32m\"mod.py\"\u001b[1;36m, line \u001b[1;32m3\u001b[1;36m, in \u001b[1;35mf\u001b[1;36m\u001b[0m\n\u001b[1;33m return 1.0/(x-1)\u001b[0m\n", | |||
"\u001b[1;31mZeroDivisionError\u001b[0m\u001b[1;31m:\u001b[0m float division by zero\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"%xmode plain\n", | |||
"mod.g(0)" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 41, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"Exception reporting mode: Verbose\n" | |||
Brian E. Granger
|
r17503 | ] | |
}, | |||
{ | |||
Min RK
|
r18669 | "ename": "ZeroDivisionError", | |
"evalue": "float division by zero", | |||
"output_type": "error", | |||
"traceback": [ | |||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", | |||
"\u001b[1;32m<ipython-input-41-81967cfaa0c3>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0mget_ipython\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmagic\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34mu'xmode verbose'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0mmod\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m \u001b[1;36mglobal\u001b[0m \u001b[0;36mmod.g\u001b[0m \u001b[1;34m= <function g at 0x237fc08>\u001b[0m\n", | |||
"\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mg\u001b[1;34m(y=0)\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m \u001b[1;36mglobal\u001b[0m \u001b[0;36mf\u001b[0m \u001b[1;34m= <function f at 0x2367c08>\u001b[0m\u001b[1;34m\n \u001b[0m\u001b[0;36my\u001b[0m \u001b[1;34m= 0\u001b[0m\n", | |||
"\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mf\u001b[1;34m(x=1)\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[1;36m1.0\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m \u001b[0;36mx\u001b[0m \u001b[1;34m= 1\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |||
"\u001b[1;31mZeroDivisionError\u001b[0m: float division by zero" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"%xmode verbose\n", | |||
"mod.g(0)" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"The default `%xmode` is \"context\", which shows additional context but not all local variables. Let's restore that one for the rest of our session." | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 42, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"Exception reporting mode: Context\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"%xmode context" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"## Running code in other languages with special `%%` magics" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 43, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"July" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"%%perl\n", | |||
"@months = (\"July\", \"August\", \"September\");\n", | |||
"print $months[0];" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 44, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"Hello World!\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"%%ruby\n", | |||
"name = \"world\"\n", | |||
"puts \"Hello #{name.capitalize}!\"" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"### Exercise" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Write a cell that executes in Bash and prints your current working directory as well as the date.\n", | |||
"\n", | |||
"Apologies to Windows users who may not have Bash available, not sure how to obtain the equivalent result with `cmd.exe` or Powershell." | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": null, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"%load soln/bash-script" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"## Raw Input in the notebook" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Since 1.0 the IPython notebook web application support `raw_input` which for example allow us to invoke the `%debug` magic in the notebook:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 45, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"ename": "ZeroDivisionError", | |||
"evalue": "float division by zero", | |||
"output_type": "error", | |||
"traceback": [ | |||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", | |||
"\u001b[1;32m<ipython-input-45-5e708f13c839>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mmod\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", | |||
"\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mg\u001b[1;34m(y)\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 6\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m+\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", | |||
"\u001b[1;32m/home/fperez/ipython/tutorial/notebooks/mod.py\u001b[0m in \u001b[0;36mf\u001b[1;34m(x)\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 2\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 3\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[1;36m1.0\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mx\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", | |||
"\u001b[1;31mZeroDivisionError\u001b[0m: float division by zero" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"mod.g(0)" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 38, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"> \u001b[0;32m/Users/bussonniermatthias/ipython-in-depth/notebooks/mod.py\u001b[0m(3)\u001b[0;36mf\u001b[0;34m()\u001b[0m\n", | |||
"\u001b[0;32m 2 \u001b[0;31m\u001b[0;32mdef\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |||
"\u001b[0m\u001b[0;32m----> 3 \u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0;36m1.0\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |||
"\u001b[0m\u001b[0;32m 4 \u001b[0;31m\u001b[0;34m\u001b[0m\u001b[0m\n", | |||
"\u001b[0m\n", | |||
"ipdb> x\n", | |||
"1\n", | |||
"ipdb> up\n", | |||
"> \u001b[0;32m/Users/bussonniermatthias/ipython-in-depth/notebooks/mod.py\u001b[0m(6)\u001b[0;36mg\u001b[0;34m()\u001b[0m\n", | |||
"\u001b[0;32m 4 \u001b[0;31m\u001b[0;34m\u001b[0m\u001b[0m\n", | |||
"\u001b[0m\u001b[0;32m 5 \u001b[0;31m\u001b[0;32mdef\u001b[0m \u001b[0mg\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |||
"\u001b[0m\u001b[0;32m----> 6 \u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m+\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |||
"\u001b[0m\n", | |||
"ipdb> y\n", | |||
"0\n", | |||
"ipdb> up\n", | |||
"> \u001b[0;32m<ipython-input-37-5e708f13c839>\u001b[0m(1)\u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n", | |||
"\u001b[0;32m----> 1 \u001b[0;31m\u001b[0mmod\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mg\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |||
"\u001b[0m\n", | |||
"ipdb> exit\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"%debug" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"Don't foget to exit your debugging session. Raw input can of course be use to ask for user input:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 39, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"Are you enjoying this tutorial ?Yes !\n", | |||
"enjoy is : Yes !\n" | |||
Brian E. Granger
|
r17503 | ] | |
Min RK
|
r18669 | } | |
], | |||
"source": [ | |||
"enjoy = raw_input('Are you enjoying this tutorial ?')\n", | |||
"print 'enjoy is :', enjoy" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"## Plotting in the notebook" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"This magic configures matplotlib to render its figures inline:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 46, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"%matplotlib inline" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 47, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"import numpy as np\n", | |||
"import matplotlib.pyplot as plt" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 48, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"data": { | |||
"image/png": [ | |||
"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\n", | |||
"ggL2eW4uc4BGOolFrX/fvsvvgoYPB8rLw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\n", | |||
"c88B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XQl5WxzVHLl3vz\n", | |||
"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9G5w9G7cMOWEo5cR3bS1sXe8PKeCqoBloT916hSmTp2KYcOG4cYbb0RDQ0PI63JycjBm\n", | |||
"zBiMHz8eV111leWFEnwQndOr5OhTUtzj6FVor0xMZCMyjAxY86rQ627eybMURGBZ6JcsWYKpU6fi\n", | |||
"4MGDuOGGG7BkyZKQ1/l8PpSUlGD37t0oLS21vFCCD7Eo9Jpm7fEqd92IKMb6fHILozqyhT5SRu/F\n", | |||
"fB6wIfTr1q3DvHnzAADz5s3D22+/HfZazepvGsEd0b30Kgl9167MpVo9k1VWH73Z6CYQYKInYseu\n", | |||
"0RZLtxZjo2X0XsznARtCX1tbi/Svtz+mp6ejtrY25HU+nw9TpkzBhAkT8Mc//tHq7QhO5OQAR46I\n", | |||
"ee5AgPXRDxgg5vmtYKcge+qUml03jY3M2fLYlRqMUdH1anTjVUcfH+mLU6dOxfHjxzv9/S9/+csO\n", | |||
"n/t8PvjChFrbt2/HgAEDcOLECUydOhUjRoxAUVFRyGsXL1586c/FxcUoLi6OsnzCLLm5wFdfiXnu\n", | |||
"EyeYO+3WTczzW0EvyA4ZYv6xMh29mehGRD6vY0Z0eb2gG7lnWxv7sPuzlZTEBtWFww2OvqSkBCUl\n", | |||
"JaYeE1HoN23aFPZr6enpOH78ODIyMlBTU4O0tLSQ1w34+qehf//+uO2221BaWmpI6Akx5OQAx44B\n", | |||
"fj/QpQvf51YpttGx00svy9EnJjIRa2lhcVM0ROTzOkaFvrERyM+Xd0/dzdstkiYlsc6wcLjB0Qeb\n", | |||
"4CeeeCLqYyy/+Zs1axaWL18OAFi+fDluvfXWTtdcuHABjV8HfufPn8f777+P0aNHW70lwYHERCAt\n", | |||
"Daio4P/cKgq91ejmwgVWxJXh7vRTpozGNyo4+sZGfi82iYnsRS5Stw+v4i9l9CZ5/PHHsWnTJgwb\n", | |||
"NgxbtmzB448/DgCorq7GzJkzAQDHjx9HUVERxo0bh8LCQtx000248cYb+aycsIyo+EZVobfi6HU3\n", | |||
"L6vNzkxBVrS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itCHyunJ0ROeRo9uzM68\n", | |||
"OXDAHfm8zqBBbFxDJJwW+gEDwgu9TEfvdaHv06ez0JOjJzxNWhrLLKuqzD3uiy9Ye6ZbGDwYOHYs\n", | |||
"8jVOC31GRvjuIBUcfX29uK4f2Y4+OLohR094HisF2c8/B0aNErMeEURz9JrGXuycdvThhF6mo09N\n", | |||
"DT0ErrZW3BygcEIv4sUl2NFrGu2MJWIAKzn9F1+4S+ijOfrTp9lZuk7+skcTelmOPiMj9Ax/kULf\n", | |||
"ty8T3/bjpFtbWXeM6DNqz59n72q7duV7H1UgoScAmHf0muY+oY/m6PUpnE7sitWJJPQyZ/CEKwqL\n", | |||
"nOwZH8/aOts7bb2dM46zUgU7ei+7eYCEnviaK68EPvnE+PWVlWyDT79+4tbEm2iO/sgRYMgQeesJ\n", | |||
"RaRibGUlkJkpZx3p6Z3XEQiIf1cRHN+ImtYZ7OhF7g9QARJ6AgAwciTLpyONp23P3r0s7nETuqMP\n", | |||
"112kwlx9/SDz4DUGAuzfJytLzjpCRTenTrFWWpHxhiyhJ0dPxCTx8czVf/yxses//hiYMEHsmniT\n", | |||
"nMzGKYc7P7a83HlHn5jIDr8ILkqeOMFyalnjoEM5epH5vI5MoW9varzcWgmQ0BPtuOoqoLTU2LWf\n", | |||
"fOI+oQciz99XZeRyqJy+ogLIzpa3hvR0lse3L4zKOHmrX7+ObZ2ihD74HYvItlEVIKEnLlFYCOzc\n", | |||
"aezajz8GvvENsesRQaSjE1Vw9ACrJQQXjSsr5cU2ANCtG3tn0d71OuHoRQlwcLFZH0/tVUjoiUsU\n", | |||
"FQHbt4eeWtie6mqgpYUJktsI5+g1TY2MHgByc9kMofbIdvRAZzGUIfTB/fvV1WIEOHhjGgk9ETOk\n", | |||
"p7OPaG2WO3cCEyc624ZolXBn5B47xjJa3v3aVsjLA776quPfVVTIdfRAaKEX3cefmcneveiIeoHr\n", | |||
"0we4eJGdJgaQ0BMxRnExUFIS+ZoPPmDXuZHhw0NHN59/rs44h1COvrJSvqMPLsjW1DDxF0lwbCVK\n", | |||
"6H2+ji9kJPRETFFcDGzZEvmakhL3Cn1eHhOSixc7/r1K4xxyczs7+mPH5Dv6IUM6ruPQIfb9E8mg\n", | |||
"QR33OoiMrNrvWSChJ2KKqVOZY9ff0gZz6hTrTrnySrnr4kViIotvgsc9qObojxy53PGi70IuKJC7\n", | |||
"juCYS8YhM9nZbL+A388+amrEbRIjR0/ELCkprG1y06bQX9+0iRVtExLkrosnEyd2biNVSeh79GA9\n", | |||
"/3qxsLqafb9FF0KDaV+4bmxkx++J3pnbrRv7GaypYSKcksL+TgR6G+v582ymDm2YImKKW24B3n47\n", | |||
"9NfeeAO44w656+FN8H6B5mYmaCNHOremYIYNA/btY3/+7DNndiHrjl7TWGyTn89/5kwo9JxedKeR\n", | |||
"7uh1N+/G5gKjWP5nW7NmDUaNGoUuXbpg165dYa/buHEjRowYgaFDh+Lpp5+2ejtCInfeCaxdy1xc\n", | |||
"e86fB95/n70QuJlgod++HRg7ljlpVfjmN4EdO9ifnRL6fv2Y+J08KfdsYD2nr6hgfxaF7ui9HtsA\n", | |||
"NoR+9OjReOutt3DttdeGvcbv92PRokXYuHEj9u3bh5UrV2L//v1Wb6k0JdFaVRQmeO2ZmazY+tpr\n", | |||
"Ha9bswaYNEm9QWZmv/ejRrFfbv1YwU2bWG3CKUKt/+qrnRd6n+/yBrNIQs/7Z1939EeOiBX6ggJg\n", | |||
"927g3XdLhN5HBSwL/YgRIzAsyjlypaWlyM/PR05ODhISEnDvvfdi7dq1Vm+pNF4SegBYtAh49lkW\n", | |||
"awCsMParXwE/+YnctRnB7Pc+IQG4/fbLL2Tvv6+e0E+axPYrtLYC27Y5N25i1CjgH/9g74DCdSXx\n", | |||
"/tmfOBH429+A9euByZO5PnUHCgtZJLV6dYmj//4yEJq4VVVVIbtdyJaVlYUqs+fVEY5w/fWsOPnz\n", | |||
"n7OMdskStlnGrW2VwcydCyxfDmzYwKKJwkKnV9SR1FR20tUPfsBm0I8d68w6vvMd4De/AT78ELjt\n", | |||
"Njn3vPlmNmLj00+BG28Ud5+EBNZYUF4OzJwp7j4qEB/pi1OnTsXxEMOxn3rqKdx8881Rn9zn5epG\n", | |||
"DPD737NfgDffZI5++3bvFKyKilhxccYM5hxV7CJ6/nlg+nRg2TLn1nDNNaxoec01bESxDLp3ZwX/\n", | |||
"c+fET+ucOpW9oMjuaJKOZpPi4mLtk08+Cfm1v//979q0adMuff7UU09pS5YsCXltXl6eBoA+6IM+\n", | |||
"6IM+THzk5eVF1emIjt4oWpiTHCZMmICysjKUl5dj4MCBWL16NVauXBny2kOHDvFYCkEQBBGE5Yz+\n", | |||
"rbfeQnZ2Nnbu3ImZM2di+vTpAIDq6mrM/Drwio+Px9KlSzFt2jSMHDkS99xzDwpkb+8jCIKIcXxa\n", | |||
"ODtOEARBeALHd8a6eUPV/PnzkZ6ejtFuOzz1ayoqKjB58mSMGjUKV1xxBX772986vSRTNDc3o7Cw\n", | |||
"EOPGjcPIkSPx05/+1Oklmcbv92P8+PGGmhtUJCcnB2PGjMH48eNx1VVXOb0cUzQ0NODOO+9EQUEB\n", | |||
"Ro4ciZ1GT91RgAMHDmD8+PGXPpKTkyP//lqov3Kjra1Ny8vL044cOaK1tLRoY8eO1fbt2+fkkkyx\n", | |||
"detWbdeuXdoVV1zh9FIsUVNTo+3evVvTNE1rbGzUhg0b5qrvv6Zp2vnz5zVN07TW1latsLBQ27Zt\n", | |||
"m8MrMsdzzz2n3XfffdrNN9/s9FIskZOTo9XX1zu9DEvMnTtXe/HFFzVNYz8/DQ0NDq/IGn6/X8vI\n", | |||
"yNCOHTsW9hpHHb3bN1QVFRWhb9++Ti/DMhkZGRg3bhwAoGfPnigoKEC1vl3UJSQlJQEAWlpa4Pf7\n", | |||
"keKigz8rKyuxfv16PPjgg2EbGtyAG9d+5swZbNu2DfPnzwfA6onJLp1qtnnzZuTl5XXYsxSMo0JP\n", | |||
"G6rUoby8HLt370ahajuHohAIBDBu3Dikp6dj8uTJGKnSZLIo/OAHP8AzzzyDOBmTwgTh8/kwZcoU\n", | |||
"TJgwAX/84x+dXo5hjhw5gv79++OBBx7AlVdeiX/+53/GhXCzuRVn1apVuO+++yJe4+hPGG2oUoNz\n", | |||
"587hzjvvxH//93+jp6xdMZyIi4vDp59+isrKSmzdutU1oyj++te/Ii0tDePHj3elI9bZvn07du/e\n", | |||
"jQ0bNuD3v/89tm3b5vSSDNHW1oZdu3bh4Ycfxq5du9CjRw8sWbLE6WWZpqWlBe+88w7uuuuuiNc5\n", | |||
"KvSZmZmoqKi49HlFRQWyZB+jE+O0trbijjvuwLe//W3ceuutTi/HMsnJyZg5cyY+/vhjp5diiB07\n", | |||
"dmDdunUYMmQIZs+ejS1btmDu3LlOL8s0A74e+9i/f3/cdtttKA0e9K8oWVlZyMrKwsSJEwEAd955\n", | |||
"Z8QpvKqyYcMGfOMb30D//v0jXueo0LffUNXS0oLVq1dj1qxZTi4pptA0DQsWLMDIkSPxL//yL04v\n", | |||
"xzQnT55EQ0MDAKCpqQmbNm3C+PHjHV6VMZ566ilUVFTgyJEjWLVqFa6//nqsWLHC6WWZ4sKFC2j8\n", | |||
"epb1+fPn8f7777umAy0jIwPZ2dk4+PXJKps3b8YoVc6SNMHKlSsxe/bsqNdx2RlrlfYbqvx+PxYs\n", | |||
"WOCqDVWzZ8/GBx98gPr6emRnZ+PJJ5/EAw884PSyDLN9+3a8+uqrl9rjAOBXv/oVvvWtbzm8MmPU\n", | |||
"1NRg3rx5CAQCCAQCmDNnDm644Qanl2UJN8aYtbW1uO3rSWdtbW24//77caPIKWSc+d3vfof7778f\n", | |||
"LS0tyMvLw8svv+z0kkxx/vx5bN682VBthDZMEQRBeBz3lvsJgiAIQ5DQEwRBeBwSeoIgCI9DQk8Q\n", | |||
"BOFxSOgJgiA8Dgk9QRCExyGhJwiC8Dgk9ARBEB7n/wOimSfhIIMDngAAAABJRU5ErkJggg==\n" | |||
], | |||
"text/plain": [ | |||
"<matplotlib.figure.Figure at 0x3436950>" | |||
] | |||
}, | |||
Brian E. Granger
|
r17503 | "metadata": {}, | |
Min RK
|
r18669 | "output_type": "display_data" | |
} | |||
], | |||
"source": [ | |||
"x = np.linspace(0, 2*np.pi, 300)\n", | |||
"y = np.sin(x**2)\n", | |||
"plt.plot(x, y)\n", | |||
"plt.title(\"A little chirp\")\n", | |||
"fig = plt.gcf() # let's keep the figure object around for later..." | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"## The IPython kernel/client model" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 43, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [ | |||
{ | |||
"name": "stdout", | |||
"output_type": "stream", | |||
"text": [ | |||
"{\n", | |||
" \"stdin_port\": 50023, \n", | |||
" \"ip\": \"127.0.0.1\", \n", | |||
" \"control_port\": 50024, \n", | |||
" \"hb_port\": 50025, \n", | |||
" \"signature_scheme\": \"hmac-sha256\", \n", | |||
" \"key\": \"b54b8859-d64d-48bb-814a-909f9beb3316\", \n", | |||
" \"shell_port\": 50021, \n", | |||
" \"transport\": \"tcp\", \n", | |||
" \"iopub_port\": 50022\n", | |||
"}\n", | |||
"\n", | |||
"Paste the above JSON into a file, and connect with:\n", | |||
" $> ipython <app> --existing <file>\n", | |||
"or, if you are local, you can connect with just:\n", | |||
" $> ipython <app> --existing kernel-30f00f4a-230c-4e64-bea5-0e5f6a52cb40.json \n", | |||
"or even just:\n", | |||
" $> ipython <app> --existing \n", | |||
"if this is the most recent IPython session you have started.\n" | |||
Brian E. Granger
|
r17503 | ] | |
} | |||
], | |||
Min RK
|
r18669 | "source": [ | |
"%connect_info" | |||
] | |||
}, | |||
{ | |||
"cell_type": "markdown", | |||
"metadata": {}, | |||
"source": [ | |||
"We can connect automatically a Qt Console to the currently running kernel with the `%qtconsole` magic, or by typing `ipython console --existing <kernel-UUID>` in any terminal:" | |||
] | |||
}, | |||
{ | |||
"cell_type": "code", | |||
"execution_count": 83, | |||
"metadata": { | |||
"collapsed": false | |||
}, | |||
"outputs": [], | |||
"source": [ | |||
"%qtconsole" | |||
] | |||
Brian E. Granger
|
r17503 | } | |
Min RK
|
r18669 | ], | |
Min RK
|
r19627 | "metadata": {}, | |
Min RK
|
r18669 | "nbformat": 4, | |
"nbformat_minor": 0 | |||
Brian E. Granger
|
r17503 | } |