Skip to content

Commit bc7bb4b

Browse files
committed
Add ESRF demo
1 parent fa79a00 commit bc7bb4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+8790
-0
lines changed

2019-01-10-ESRF/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Installation
2+
------------
3+
4+
Building this presentation requires npm. From the talk directory, run:
5+
6+
```bash
7+
npm install
8+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,313 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Jupyter Interactive widgets\n",
8+
"The notebook comes alive with the interactive widgets:\n",
9+
"\n",
10+
"- Part of the Jupyter project\n",
11+
"- BSD Licensed\n",
12+
"\n",
13+
"**Installation for the legacy notebook:**\n",
14+
"\n",
15+
"```bash\n",
16+
"conda install -c conda-forge ipywidgets\n",
17+
"```"
18+
]
19+
},
20+
{
21+
"cell_type": "markdown",
22+
"metadata": {},
23+
"source": [
24+
"## Speeding up the bottleneck in the REPL\n",
25+
"\n",
26+
"<img src=\"./images/Flow.svg\"></img>"
27+
]
28+
},
29+
{
30+
"cell_type": "code",
31+
"execution_count": 2,
32+
"metadata": {},
33+
"outputs": [
34+
{
35+
"data": {
36+
"text/plain": [
37+
"100"
38+
]
39+
},
40+
"execution_count": 2,
41+
"metadata": {},
42+
"output_type": "execute_result"
43+
}
44+
],
45+
"source": [
46+
"10 * 10"
47+
]
48+
},
49+
{
50+
"cell_type": "code",
51+
"execution_count": 3,
52+
"metadata": {},
53+
"outputs": [],
54+
"source": [
55+
"def f(x):\n",
56+
" print(x * x)"
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": 4,
62+
"metadata": {},
63+
"outputs": [
64+
{
65+
"name": "stdout",
66+
"output_type": "stream",
67+
"text": [
68+
"81\n"
69+
]
70+
}
71+
],
72+
"source": [
73+
"f(9)"
74+
]
75+
},
76+
{
77+
"cell_type": "code",
78+
"execution_count": 5,
79+
"metadata": {},
80+
"outputs": [],
81+
"source": [
82+
"from ipywidgets import *\n",
83+
"from traitlets import dlink"
84+
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": 6,
89+
"metadata": {},
90+
"outputs": [
91+
{
92+
"data": {
93+
"application/vnd.jupyter.widget-view+json": {
94+
"model_id": "6ff7ff03c89841958aecd220c17d0eb8",
95+
"version_major": 2,
96+
"version_minor": 0
97+
},
98+
"text/plain": [
99+
"interactive(children=(IntSlider(value=50, description='x'), Output()), _dom_classes=('widget-interact',))"
100+
]
101+
},
102+
"metadata": {},
103+
"output_type": "display_data"
104+
}
105+
],
106+
"source": [
107+
"interact(f, x=(0, 100));"
108+
]
109+
},
110+
{
111+
"cell_type": "markdown",
112+
"metadata": {},
113+
"source": [
114+
"# Interactive Jupyter widgets"
115+
]
116+
},
117+
{
118+
"cell_type": "code",
119+
"execution_count": 7,
120+
"metadata": {},
121+
"outputs": [
122+
{
123+
"data": {
124+
"application/vnd.jupyter.widget-view+json": {
125+
"model_id": "4c44962b96874b6b9a5921b9e46150aa",
126+
"version_major": 2,
127+
"version_minor": 0
128+
},
129+
"text/plain": [
130+
"FloatSlider(value=7.5, description='Input:', max=10.0, min=5.0)"
131+
]
132+
},
133+
"metadata": {},
134+
"output_type": "display_data"
135+
}
136+
],
137+
"source": [
138+
"slider = FloatSlider(\n",
139+
" value=7.5,\n",
140+
" min=5.0,\n",
141+
" max=10.0,\n",
142+
" step=0.1,\n",
143+
" description='Input:',\n",
144+
")\n",
145+
"\n",
146+
"slider"
147+
]
148+
},
149+
{
150+
"cell_type": "code",
151+
"execution_count": 8,
152+
"metadata": {},
153+
"outputs": [
154+
{
155+
"data": {
156+
"application/vnd.jupyter.widget-view+json": {
157+
"model_id": "4c44962b96874b6b9a5921b9e46150aa",
158+
"version_major": 2,
159+
"version_minor": 0
160+
},
161+
"text/plain": [
162+
"FloatSlider(value=7.5, description='Input:', max=10.0, min=5.0)"
163+
]
164+
},
165+
"metadata": {},
166+
"output_type": "display_data"
167+
}
168+
],
169+
"source": [
170+
"slider"
171+
]
172+
},
173+
{
174+
"cell_type": "code",
175+
"execution_count": 10,
176+
"metadata": {},
177+
"outputs": [],
178+
"source": [
179+
"slider.value = 9"
180+
]
181+
},
182+
{
183+
"cell_type": "code",
184+
"execution_count": 11,
185+
"metadata": {},
186+
"outputs": [
187+
{
188+
"data": {
189+
"application/vnd.jupyter.widget-view+json": {
190+
"model_id": "277cf7934f0b4ff9809e8c02ec933d01",
191+
"version_major": 2,
192+
"version_minor": 0
193+
},
194+
"text/plain": [
195+
"FloatText(value=9.0, description='Value')"
196+
]
197+
},
198+
"metadata": {},
199+
"output_type": "display_data"
200+
}
201+
],
202+
"source": [
203+
"text = FloatText(description='Value')\n",
204+
"dlink((slider, 'value'), (text, 'value'))\n",
205+
"text"
206+
]
207+
},
208+
{
209+
"cell_type": "code",
210+
"execution_count": 12,
211+
"metadata": {},
212+
"outputs": [
213+
{
214+
"data": {
215+
"application/vnd.jupyter.widget-view+json": {
216+
"model_id": "4c44962b96874b6b9a5921b9e46150aa",
217+
"version_major": 2,
218+
"version_minor": 0
219+
},
220+
"text/plain": [
221+
"FloatSlider(value=9.0, description='Input:', max=10.0, min=5.0)"
222+
]
223+
},
224+
"metadata": {},
225+
"output_type": "display_data"
226+
}
227+
],
228+
"source": [
229+
"slider"
230+
]
231+
},
232+
{
233+
"cell_type": "markdown",
234+
"metadata": {},
235+
"source": [
236+
"Widgets are represented in the back-end by a single object. Each time a widget is displayed, a new representation of that same object is created in the front-end. These representations are called views.\n",
237+
"\n",
238+
"![Kernel & front-end diagram](./images/WidgetModelView.png)"
239+
]
240+
},
241+
{
242+
"cell_type": "markdown",
243+
"metadata": {},
244+
"source": [
245+
"# Jupyter widgets as a framework\n",
246+
"\n",
247+
" - bqplot\n",
248+
" - ipyleaflet\n",
249+
" - pythreejs"
250+
]
251+
},
252+
{
253+
"cell_type": "code",
254+
"execution_count": null,
255+
"metadata": {},
256+
"outputs": [],
257+
"source": []
258+
}
259+
],
260+
"metadata": {
261+
"kernelspec": {
262+
"display_name": "Python 3",
263+
"language": "python",
264+
"name": "python3"
265+
},
266+
"language_info": {
267+
"codemirror_mode": {
268+
"name": "ipython",
269+
"version": 3
270+
},
271+
"file_extension": ".py",
272+
"mimetype": "text/x-python",
273+
"name": "python",
274+
"nbconvert_exporter": "python",
275+
"pygments_lexer": "ipython3",
276+
"version": "3.7.1"
277+
},
278+
"widgets": {
279+
"state": {
280+
"0cb2d81d826b4e25aba3b1d39711ef3f": {
281+
"views": [
282+
{
283+
"cell_index": 6
284+
}
285+
]
286+
},
287+
"2cfe6521f9834ca69e54518716104cd2": {
288+
"views": [
289+
{
290+
"cell_index": 8
291+
},
292+
{
293+
"cell_index": 9
294+
},
295+
{
296+
"cell_index": 12
297+
}
298+
]
299+
},
300+
"889356d59ac543a49da33d134d791c3f": {
301+
"views": [
302+
{
303+
"cell_index": 11
304+
}
305+
]
306+
}
307+
},
308+
"version": "2.0.0-dev"
309+
}
310+
},
311+
"nbformat": 4,
312+
"nbformat_minor": 2
313+
}

0 commit comments

Comments
 (0)