Skip to content

Commit bdced69

Browse files
committed
Updates to notebook content.
1 parent 5b10459 commit bdced69

File tree

7 files changed

+101
-46
lines changed

7 files changed

+101
-46
lines changed

notebooks/Custom Display Logic.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
" <circle cx=\"50\" cy=\"50\" r=\"20\" stroke=\"black\" stroke-width=\"1\" fill=\"white\"/>\n",
112112
" </svg>\n",
113113
"\n",
114-
"For LaTeX:\n",
114+
"For LaTeX (wrap with `$` and use a raw Python string):\n",
115115
"\n",
116116
" \\bigcirc\n",
117117
"\n",
@@ -137,7 +137,7 @@
137137
"cell_type": "code",
138138
"collapsed": false,
139139
"input": [
140-
"%load soln/circle.py"
140+
"%load soln/mycircle.py"
141141
],
142142
"language": "python",
143143
"metadata": {},
@@ -147,7 +147,7 @@
147147
"cell_type": "code",
148148
"collapsed": false,
149149
"input": [
150-
"class Circle(object):\n",
150+
"class MyCircle(object):\n",
151151
" \n",
152152
" def _repr_html_(self):\n",
153153
" return \"&#x25CB;\"\n",
@@ -178,7 +178,7 @@
178178
"cell_type": "code",
179179
"collapsed": false,
180180
"input": [
181-
"c = Circle()"
181+
"c = MyCircle()"
182182
],
183183
"language": "python",
184184
"metadata": {},
@@ -340,7 +340,7 @@
340340
"cell_type": "code",
341341
"collapsed": false,
342342
"input": [
343-
"png_f.for_type(Circle, png_circle)"
343+
"png_f.for_type(MyCircle, png_circle)"
344344
],
345345
"language": "python",
346346
"metadata": {},
@@ -357,7 +357,7 @@
357357
"cell_type": "code",
358358
"collapsed": false,
359359
"input": [
360-
"c2 = Circle()"
360+
"c2 = MyCircle()"
361361
],
362362
"language": "python",
363363
"metadata": {},

notebooks/Markdown Cells.ipynb

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,32 @@
7272
"3. Now this"
7373
]
7474
},
75+
{
76+
"cell_type": "heading",
77+
"level": 3,
78+
"metadata": {},
79+
"source": [
80+
"Exercise"
81+
]
82+
},
83+
{
84+
"cell_type": "markdown",
85+
"metadata": {},
86+
"source": [
87+
"Create a Markdown cell and try the following constructs:\n",
88+
"\n",
89+
"* Bold and italic text\n",
90+
"* Itemized and enumerated lists"
91+
]
92+
},
93+
{
94+
"cell_type": "heading",
95+
"level": 2,
96+
"metadata": {},
97+
"source": [
98+
"More elements"
99+
]
100+
},
75101
{
76102
"cell_type": "markdown",
77103
"metadata": {},
@@ -257,6 +283,21 @@
257283
"These do not embed the data into the notebook file, and require that the files exist when you are viewing the notebook."
258284
]
259285
},
286+
{
287+
"cell_type": "heading",
288+
"level": 3,
289+
"metadata": {},
290+
"source": [
291+
"Exercise"
292+
]
293+
},
294+
{
295+
"cell_type": "markdown",
296+
"metadata": {},
297+
"source": [
298+
"Create a small text file in your Notebook directory. Then create a Markdown cell that links to that text file using the files URL pattern. "
299+
]
300+
},
260301
{
261302
"cell_type": "heading",
262303
"level": 3,

notebooks/Notebook Basics.ipynb

Lines changed: 21 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
"metadata": {},
2929
"source": [
3030
"* IPython Notebooks are just files (`.ipynb`) on your file system\n",
31-
"* The Notebook server is aware of Notebooks in a single directory, which we call the *Notebook directory*\n",
31+
"* The Notebook server is aware of Notebooks in a single directory, which we call the **Notebook directory**\n",
3232
"* If you cd to a Notebook directory and type:\n",
3333
"\n",
3434
" ipython notebook\n",
3535
"\n",
36-
" you will see those notebooks in the dashboard"
36+
" you will see the Notebooks in that directory in the dashboard"
3737
]
3838
},
3939
{
@@ -64,8 +64,7 @@
6464
],
6565
"language": "python",
6666
"metadata": {},
67-
"outputs": [],
68-
"prompt_number": 1
67+
"outputs": []
6968
},
7069
{
7170
"cell_type": "code",
@@ -75,40 +74,14 @@
7574
],
7675
"language": "python",
7776
"metadata": {},
78-
"outputs": [
79-
{
80-
"output_type": "pyout",
81-
"prompt_number": 2,
82-
"text": [
83-
"[{u'cell_type': u'heading',\n",
84-
" u'level': 1,\n",
85-
" u'metadata': {},\n",
86-
" u'source': u'IPython Notebook Basics'},\n",
87-
" {u'cell_type': u'heading',\n",
88-
" u'level': 2,\n",
89-
" u'metadata': {},\n",
90-
" u'source': u'Project directory'},\n",
91-
" {u'cell_type': u'markdown',\n",
92-
" u'metadata': {},\n",
93-
" 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 = Notebook directory\\n* If you cd to that directory and type:\\n\\n ipython notebook\\n\\n you will see those notebooks in the dashboard'},\n",
94-
" {u'cell_type': u'heading',\n",
95-
" u'level': 2,\n",
96-
" u'metadata': {},\n",
97-
" u'source': u'Notebook files'},\n",
98-
" {u'cell_type': u'markdown',\n",
99-
" u'metadata': {},\n",
100-
" u'source': u'Notebook files:\\n\\n* Are just that - files (`.ipynb`) on your file system\\n* Contain JSON data'}]"
101-
]
102-
}
103-
],
104-
"prompt_number": 2
77+
"outputs": []
10578
},
10679
{
10780
"cell_type": "markdown",
10881
"metadata": {},
10982
"source": [
110-
"* Embed code, Markdown text, equations, images, LaTeX\n",
111-
"* Are version control friendly - post your Notebooks on GitHub\n",
83+
"* Embed code, Markdown text, LaTeX equations, images\n",
84+
"* Are version control friendly: post your Notebooks on GitHub\n",
11285
"* Can be viewed online by anyone at http://nbviewer.ipython.org"
11386
]
11487
},
@@ -223,8 +196,22 @@
223196
"cell_type": "markdown",
224197
"metadata": {},
225198
"source": [
226-
"Go back to that last Notebook and repeat some of those cell operations using keyboard shortcuts. Make sure you try inserting cells above and below the current one and moving cell up and down."
199+
"Go back to that last Notebook and repeat some of those cell operations using keyboard shortcuts:\n",
200+
"\n",
201+
"* Inserting cells above/below\n",
202+
"* Delete cell\n",
203+
"* Move cell up/down\n",
204+
"* Cut/copy/paste cell\n",
205+
"* Changing cell types"
227206
]
207+
},
208+
{
209+
"cell_type": "code",
210+
"collapsed": false,
211+
"input": [],
212+
"language": "python",
213+
"metadata": {},
214+
"outputs": []
228215
}
229216
],
230217
"metadata": {}

notebooks/Rich Display System.ipynb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
"cell_type": "markdown",
216216
"metadata": {},
217217
"source": [
218-
"Find an image online and use IPython's `Image` class to embed it in a Notebook using its URL. Then try downloading the image and embedding it by filename."
218+
"Find an image online and use IPython's `Image` class to embed it in a Notebook using its URL. Then try downloading the image into your Notebook directory and embedding it by filename."
219219
]
220220
},
221221
{
@@ -238,9 +238,7 @@
238238
"collapsed": false,
239239
"input": [
240240
"from IPython.display import YouTubeVideo\n",
241-
"# a talk about IPython at Sage Days at U. Washington, Seattle.\n",
242-
"# Video credit: William Stein.\n",
243-
"YouTubeVideo('1j_HxD4iLn8')"
241+
"YouTubeVideo('sjfsUzECqK0')"
244242
],
245243
"language": "python",
246244
"metadata": {},
@@ -620,6 +618,16 @@
620618
"Go to [SoundCloud](http://soundcloud.com) and search for a sound clip you want to embed in your Notebook. To find the HTML code to embed the sound, click on the \"Share\" link and copy the \"Widget\" HTML. Then paste it into `HTML(\"\"\" \"\"\")` in a Notebook cell."
621619
]
622620
},
621+
{
622+
"cell_type": "code",
623+
"collapsed": false,
624+
"input": [
625+
"%load soln/soundcloud.py"
626+
],
627+
"language": "python",
628+
"metadata": {},
629+
"outputs": []
630+
},
623631
{
624632
"cell_type": "heading",
625633
"level": 2,

notebooks/Typesetting Math Using MathJax.ipynb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
"worksheets": [
88
{
99
"cells": [
10+
{
11+
"cell_type": "heading",
12+
"level": 1,
13+
"metadata": {},
14+
"source": [
15+
"Typesetting Math"
16+
]
17+
},
1018
{
1119
"cell_type": "markdown",
1220
"metadata": {},
@@ -132,8 +140,16 @@
132140
"cell_type": "markdown",
133141
"metadata": {},
134142
"source": [
135-
"Go to the [MathJax website](http://www.mathjax.org/) and copy an example equations. Paste it into a Markdown cell and verify it gets rendered correctly."
143+
"Go to the [MathJax website](http://www.mathjax.org/) and copy an example equations. Paste it into a Markdown cell and verify it gets rendered correctly. Then try some LaTeX of your own."
136144
]
145+
},
146+
{
147+
"cell_type": "code",
148+
"collapsed": false,
149+
"input": [],
150+
"language": "python",
151+
"metadata": {},
152+
"outputs": []
137153
}
138154
],
139155
"metadata": {}

notebooks/soln/circle.py renamed to notebooks/soln/mycircle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class Circle(object):
1+
class MyCircle(object):
22

33
def _repr_html_(self):
44
return "&#x25CB;"

notebooks/soln/soundcloud.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from IPython.display import HTML
2+
h = HTML("""<iframe width="100%" height="166" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F94543639"></iframe>""")
3+
display(h)

0 commit comments

Comments
 (0)