##// END OF EJS Templates
Merge pull request #6045 from minrk/nbformat4...
Merge pull request #6045 from minrk/nbformat4 nbformat v4

File last commit:

r17500:3a441826
r18617:482c7bd6 merge
Show More
Capturing Output.ipynb
331 lines | 18.0 KiB | text/plain | TextLexer
Brian Granger
First go and reorganizing the examples.
r9191 {
"metadata": {
Brian E. Granger
Minor updates.
r16106 "name": "",
Brian E. Granger
More work on notebook tutorials.
r17499 "signature": "sha256:df6354daf203e842bc040989d149760382d8ceec769160e4efe8cde9dfcb9107"
Brian Granger
First go and reorganizing the examples.
r9191 },
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
Brian E. Granger
More work on notebook tutorials.
r17499 "Capturing Output With <tt>%%capture</tt>"
Brian Granger
First go and reorganizing the examples.
r9191 ]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
Brian E. Granger
More work on notebook tutorials.
r17499 "IPython has a [cell magic](Cell Magics.ipynb), `%%capture`, which captures the stdout/stderr of a cell. With this magic you can discard these streams or store them in a variable."
Brian Granger
First go and reorganizing the examples.
r9191 ]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
Thomas Kluyver
More changes to example notebooks for Python 3 compatibility
r9198 "from __future__ import print_function\n",
Brian Granger
First go and reorganizing the examples.
r9191 "import sys"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 9
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"By default, `%%capture` discards these streams. This is a simple way to suppress unwanted output."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%capture\n",
Thomas Kluyver
More changes to example notebooks for Python 3 compatibility
r9198 "print('hi, stdout')\n",
"print('hi, stderr', file=sys.stderr)"
Brian Granger
First go and reorganizing the examples.
r9191 ],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 10
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you specify a name, then stdout/stderr will be stored in an object in your namespace."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%capture captured\n",
Thomas Kluyver
More changes to example notebooks for Python 3 compatibility
r9198 "print('hi, stdout')\n",
"print('hi, stderr', file=sys.stderr)"
Brian Granger
First go and reorganizing the examples.
r9191 ],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 11
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"captured"
],
"language": "python",
"metadata": {},
"outputs": [
{
MinRK
re-run example notebooks without `%pylab`...
r11536 "metadata": {},
Brian Granger
First go and reorganizing the examples.
r9191 "output_type": "pyout",
"prompt_number": 12,
"text": [
Brian E. Granger
Minor updates.
r16106 "<IPython.utils.capture.CapturedIO at 0x1076c9310>"
Brian Granger
First go and reorganizing the examples.
r9191 ]
}
],
"prompt_number": 12
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Calling the object writes the output to stdout/stderr as appropriate."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"captured()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"hi, stdout\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"hi, stderr\n"
]
}
],
"prompt_number": 13
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"captured.stdout"
],
"language": "python",
"metadata": {},
"outputs": [
{
MinRK
re-run example notebooks without `%pylab`...
r11536 "metadata": {},
Brian Granger
First go and reorganizing the examples.
r9191 "output_type": "pyout",
"prompt_number": 14,
"text": [
"'hi, stdout\\n'"
]
}
],
"prompt_number": 14
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"captured.stderr"
],
"language": "python",
"metadata": {},
"outputs": [
{
MinRK
re-run example notebooks without `%pylab`...
r11536 "metadata": {},
Brian Granger
First go and reorganizing the examples.
r9191 "output_type": "pyout",
"prompt_number": 15,
"text": [
"'hi, stderr\\n'"
]
}
],
"prompt_number": 15
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
Paul Ivanov
updated Basic Output notebook with new %%capture
r12226 "`%%capture` grabs all output types, not just stdout/stderr, so you can do plots and use IPython's display system inside `%%capture`"
Brian Granger
First go and reorganizing the examples.
r9191 ]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
MinRK
re-run example notebooks without `%pylab`...
r11536 "%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np"
Brian Granger
First go and reorganizing the examples.
r9191 ],
"language": "python",
"metadata": {},
MinRK
re-run example notebooks without `%pylab`...
r11536 "outputs": [],
Brian Granger
First go and reorganizing the examples.
r9191 "prompt_number": 16
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%capture wontshutup\n",
"\n",
Thomas Kluyver
More changes to example notebooks for Python 3 compatibility
r9198 "print(\"setting up X\")\n",
Brian Granger
First go and reorganizing the examples.
r9191 "x = np.linspace(0,5,1000)\n",
Thomas Kluyver
More changes to example notebooks for Python 3 compatibility
r9198 "print(\"step 2: constructing y-data\")\n",
Brian Granger
First go and reorganizing the examples.
r9191 "y = np.sin(x)\n",
Thomas Kluyver
More changes to example notebooks for Python 3 compatibility
r9198 "print(\"step 3: display info about y\")\n",
Brian Granger
First go and reorganizing the examples.
r9191 "plt.plot(x,y)\n",
Thomas Kluyver
More changes to example notebooks for Python 3 compatibility
r9198 "print(\"okay, I'm done now\")"
Brian Granger
First go and reorganizing the examples.
r9191 ],
"language": "python",
"metadata": {},
Paul Ivanov
updated Basic Output notebook with new %%capture
r12226 "outputs": [],
Brian Granger
First go and reorganizing the examples.
r9191 "prompt_number": 17
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"wontshutup()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"setting up X\n",
"step 2: constructing y-data\n",
"step 3: display info about y\n",
"okay, I'm done now\n"
]
Paul Ivanov
updated Basic Output notebook with new %%capture
r12226 },
{
"metadata": {},
"output_type": "display_data",
Brian E. Granger
Minor updates.
r16106 "png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAEACAYAAAC9Gb03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8ve//51Vq1YV+qzVQh8eHk52dvbJj7Ozs4mIiLCYSJzi6NGj3HTTTdx66630\n7NnTdhxHqFKlCt27d2f9+vW2o1ixevVqFi9eTN26denXrx8fffQRt99+u+1Y1tSqVQuAP/3pT9x4\n441kZmYW+qzVQv/HDVVHjhxh7ty5JCUl2YwkDuD1ehk8eDCNGjVi5MiRtuNYtWfPHvbt2wfA4cOH\n+eCDD4iLi7Ocyo6JEyeSnZ3Nt99+y5w5c+jYsSOzZs2yHcuKQ4cOceDAAQAOHjzI8uXLz7laz2qh\n14aq0/VNJLb3AAAAlUlEQVTr14+2bduydetWIiMjmTFjhu1IVqSnpzN79mxWrlxJXFwccXFxLFu2\nzHYsK3bu3EnHjh1p0aIFbdq0oUePHnTq1Ml2LEcI5tZvXl4eCQkJJ/+7uP7667nmmmsKfV4bpkRE\nXE5T1yIiLqdCLyLicir0IiIup0IvIuJyKvQiIi6nQi8i4nIq9CIiLqdCLyLicv8PoaUAhzXYTeQA\nAAAASUVORK5CYII=\n",
Paul Ivanov
updated Basic Output notebook with new %%capture
r12226 "text": [
Brian E. Granger
Minor updates.
r16106 "<matplotlib.figure.Figure at 0x10866ae90>"
Paul Ivanov
updated Basic Output notebook with new %%capture
r12226 ]
Brian Granger
First go and reorganizing the examples.
r9191 }
],
"prompt_number": 18
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
Paul Ivanov
updated Basic Output notebook with new %%capture
r12226 "And you can selectively disable capturing stdout, stderr or rich display, by passing `--no-stdout`, `--no-stderr` and `--no-display`"
Brian Granger
First go and reorganizing the examples.
r9191 ]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%%capture cap --no-stderr\n",
Thomas Kluyver
More changes to example notebooks for Python 3 compatibility
r9198 "print('hi, stdout')\n",
"print(\"hello, stderr\", file=sys.stderr)"
Brian Granger
First go and reorganizing the examples.
r9191 ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stderr",
"text": [
Paul Ivanov
updated Basic Output notebook with new %%capture
r12226 "hello, stderr\n"
Brian Granger
First go and reorganizing the examples.
r9191 ]
}
],
"prompt_number": 19
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cap.stdout"
],
"language": "python",
"metadata": {},
"outputs": [
{
Paul Ivanov
updated Basic Output notebook with new %%capture
r12226 "metadata": {},
Brian Granger
First go and reorganizing the examples.
r9191 "output_type": "pyout",
"prompt_number": 20,
"text": [
"'hi, stdout\\n'"
]
}
],
"prompt_number": 20
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"cap.stderr"
],
"language": "python",
"metadata": {},
"outputs": [
{
Paul Ivanov
updated Basic Output notebook with new %%capture
r12226 "metadata": {},
Brian Granger
First go and reorganizing the examples.
r9191 "output_type": "pyout",
"prompt_number": 21,
"text": [
"''"
]
}
],
"prompt_number": 21
Paul Ivanov
updated Basic Output notebook with new %%capture
r12226 },
{
"cell_type": "code",
"collapsed": false,
"input": [
"cap.outputs"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 22,
"text": [
"[]"
]
}
],
"prompt_number": 22
Brian Granger
First go and reorganizing the examples.
r9191 }
],
"metadata": {}
}
]
}