j1-template 2022.2.2 → 2022.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/blocks/footer/boxes/contacts_box.proc +46 -18
  3. data/_includes/themes/j1/blocks/footer/boxes/links_box.proc +1 -0
  4. data/assets/data/fab.html +2 -2
  5. data/assets/data/footer.html +2 -2
  6. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +64 -206
  7. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +2 -2
  8. data/assets/themes/j1/modules/nbInteract/README.md +169 -0
  9. data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.css +4 -0
  10. data/assets/themes/j1/modules/nbInteract/css/nbinteract-core.min.css +4 -0
  11. data/lib/j1/version.rb +1 -1
  12. data/lib/starter_web/Gemfile +1 -1
  13. data/lib/starter_web/_config.yml +1 -1
  14. data/lib/starter_web/_data/blocks/defaults/footer.yml +25 -17
  15. data/lib/starter_web/_data/blocks/footer.yml +78 -65
  16. data/lib/starter_web/_data/resources.yml +0 -22
  17. data/lib/starter_web/_includes/attributes.asciidoc +14 -0
  18. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  19. data/lib/starter_web/assets/images/pages/nbinteract/nbi-textbook-example.jpg +0 -0
  20. data/lib/starter_web/package.json +1 -1
  21. data/lib/starter_web/pages/public/jupyter/docs/_includes/documents/j1_docs_example_static.asciidoc +232 -232
  22. data/lib/starter_web/pages/public/jupyter/docs/j1-nbinteract-doc.adoc +135 -134
  23. data/lib/starter_web/pages/public/jupyter/docs/nbi-widget-manual.adoc +2 -4
  24. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive_widgets-checkpoint.ipynb +170 -15
  25. data/lib/starter_web/pages/public/jupyter/notebooks/j1/j1_interactive_widgets.ipynb +170 -15
  26. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_interactive_questions-checkpoint.ipynb +185 -0
  27. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/nbi_docs_recipes_interactive_questions.ipynb +19 -22
  28. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/binder-launches.html +670 -546
  29. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_docs_example_dynamic.html +186 -186
  30. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_interactive_widgets.html +919 -702
  31. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/j1_ode_selected.html +186 -186
  32. data/lib/starter_web/pages/public/jupyter/notebooks/textbooks/nbi_docs_recipes_interactive_questions.html +242 -243
  33. data/lib/starter_web/pages/public/jupyter/{apis/binderhub-api.adoc → services/binderhub.adoc} +22 -25
  34. data/lib/starter_web/pages/public/jupyter/{apis/jupyterhub-api.adoc → services/jupyterhub.adoc} +2 -2
  35. data/lib/starter_web/pages/public/learn/roundtrip/300_icon_fonts.adoc +11 -0
  36. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  37. data/lib/starter_web/utilsrv/package.json +1 -1
  38. metadata +7 -28
  39. data/lib/starter_web/_data/_resources.yml +0 -1668
  40. data/lib/starter_web/assets/images/pages/nbinteract/binderhub-architecture.png +0 -0
  41. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/algebra_with_sympy-checkpoint.ipynb +0 -14488
  42. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/climate-change-forecast-checkpoint.ipynb +0 -916
  43. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/ipympl_test_plots-checkpoint.ipynb +0 -14517
  44. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_algebra_with_sympy-checkpoint.ipynb +0 -14517
  45. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_interactive-checkpoint.ipynb +0 -16493
  46. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization-checkpoint.ipynb +0 -15358
  47. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_altair_visualization_full-checkpoint.ipynb +0 -2576
  48. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast-checkpoint.ipynb +0 -1058
  49. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_climate_change_forecast.ipynb +0 -1060
  50. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_example_dynamic-checkpoint.ipynb +0 -14478
  51. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_docs_hist-checkpoint.ipynb +0 -98
  52. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_interactive-checkpoint.ipynb +0 -560
  53. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ipympl_test_plots-checkpoint.ipynb +0 -14511
  54. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_ode_selected-checkpoint.ipynb +0 -14478
  55. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_odes_in_python-checkpoint.ipynb +0 -14818
  56. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_pandas_creating_reading_and_writing-checkpoint.ipynb +0 -328
  57. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/j1_recipes_layout-checkpoint.ipynb +0 -341
  58. data/lib/starter_web/pages/public/jupyter/notebooks/j1/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -98
  59. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_correlation-checkpoint.ipynb +0 -651
  60. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_examples_variability_of_the_sample_mean-checkpoint.ipynb +0 -323
  61. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_graphing-checkpoint.ipynb +0 -387
  62. data/lib/starter_web/pages/public/jupyter/notebooks/nbi-docs/.ipynb_checkpoints/nbi_docs_recipes_layout-checkpoint.ipynb +0 -384
@@ -1,384 +0,0 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "markdown",
5
- "metadata": {},
6
- "source": [
7
- "### Page Layout and Dashboarding\n",
8
- "`nbinteract` gives basic page layout functionality using special comments in your code. Include one or more of these markers in a Python. Outputting the HTML code by `nbinteract` add their corresponding CSS classes to the generated cells.\n",
9
- "\n",
10
- "| Marker | Description | CSS class added |\n",
11
- "| --------- | --------- | --------- |\n",
12
- "| `nbi:left` | Floats cell to the left | `nbinteract-left` |\n",
13
- "| `nbi:right` | Floats cell to the right | `nbinteract-right` |\n",
14
- "| `nbi:hide_in` | Hides cell input | `nbinteract-hide_in` |\n",
15
- "| `nbi:hide_out` | Hides cell output | `nbinteract-hide_out` |\n",
16
- "\n",
17
- "By default, only the `full` template will automatically provide styling for these classes. For other templates, `nbinteract` assumes that the embedding page will use the CSS classes to style the cells.\n",
18
- "\n",
19
- "You can use the layout markers to create simple dashboards. In this page, we create a dashboard using a dataset of trending videos on YouTube. We first create a dashboard showing the code used to generate the plots. Further down the page, we replicate the dashboard without showing the code."
20
- ]
21
- },
22
- {
23
- "cell_type": "code",
24
- "execution_count": 1,
25
- "metadata": {},
26
- "outputs": [],
27
- "source": [
28
- "# nbi:hide_in\n",
29
- "import warnings\n",
30
- "# Ignore numpy dtype warnings. These warnings are caused by an interaction\n",
31
- "# between numpy and Cython and can be safely ignored.\n",
32
- "# Reference: https://stackoverflow.com/a/40846742\n",
33
- "warnings.filterwarnings(\"ignore\", message=\"numpy.dtype size changed\")\n",
34
- "warnings.filterwarnings(\"ignore\", message=\"numpy.ufunc size changed\")\n",
35
- "\n",
36
- "import numpy as np\n",
37
- "import matplotlib.pyplot as plt\n",
38
- "import pandas as pd\n",
39
- "import nbinteract as nbi\n",
40
- "\n",
41
- "# Jupyter Specifics\n",
42
- "#\n",
43
- "import ipywidgets as widgets\n",
44
- "# from ipywidgets import interact, interactive, fixed, interact_manual\n",
45
- "from ipywidgets.widgets import interact, IntSlider, FloatSlider, Layout\n",
46
- "\n",
47
- "\n",
48
- "np.set_printoptions(threshold=20, precision=2, suppress=True)\n",
49
- "pd.options.display.max_rows = 7\n",
50
- "pd.options.display.max_columns = 8\n",
51
- "pd.set_option('precision', 2)\n",
52
- "\n",
53
- "# This option stops scientific notation for pandas\n",
54
- "pd.set_option('display.float_format', '{:.2f}'.format)\n",
55
- "\n",
56
- "style = {'description_width': '150px'}\n",
57
- "slider_layout = Layout(width='90%')\n",
58
- "\n",
59
- "# Some Magics\n",
60
- "#\n",
61
- "%matplotlib inline"
62
- ]
63
- },
64
- {
65
- "cell_type": "code",
66
- "execution_count": 2,
67
- "metadata": {},
68
- "outputs": [],
69
- "source": [
70
- "# nbi:hide_in\n",
71
- "def df_interact(df, nrows=7, ncols=7):\n",
72
- " '''\n",
73
- " Outputs sliders that show rows and columns of df\n",
74
- " '''\n",
75
- " def peek(row=0, col=0):\n",
76
- " return df.iloc[row:row + nrows, col:col + ncols]\n",
77
- " if len(df.columns) <= ncols:\n",
78
- " interact(peek, row=(0, len(df) - nrows, nrows), col=fixed(0))\n",
79
- " else:\n",
80
- " interact(peek,\n",
81
- " row=(0, len(df) - nrows, nrows),\n",
82
- " col=(0, len(df.columns) - ncols))\n",
83
- " print('({} rows, {} columns) total'.format(df.shape[0], df.shape[1]))"
84
- ]
85
- },
86
- {
87
- "cell_type": "code",
88
- "execution_count": 3,
89
- "metadata": {},
90
- "outputs": [],
91
- "source": [
92
- "# nbi:hide_in\n",
93
- "videos = pd.read_csv('https://github.com/SamLau95/nbinteract/raw/master/notebooks/youtube_trending.csv',\n",
94
- " parse_dates=['publish_time'],\n",
95
- " index_col='publish_time')"
96
- ]
97
- },
98
- {
99
- "cell_type": "code",
100
- "execution_count": 4,
101
- "metadata": {},
102
- "outputs": [
103
- {
104
- "data": {
105
- "application/vnd.jupyter.widget-view+json": {
106
- "model_id": "6ed80eba09224d9fa0e2006a1c6273de",
107
- "version_major": 2,
108
- "version_minor": 0
109
- },
110
- "text/plain": [
111
- "interactive(children=(IntSlider(value=0, description='row', max=2428, step=7), IntSlider(value=0, description=…"
112
- ]
113
- },
114
- "metadata": {},
115
- "output_type": "display_data"
116
- },
117
- {
118
- "name": "stdout",
119
- "output_type": "stream",
120
- "text": [
121
- "(2435 rows, 8 columns) total\n"
122
- ]
123
- }
124
- ],
125
- "source": [
126
- "df_interact(videos)"
127
- ]
128
- },
129
- {
130
- "cell_type": "markdown",
131
- "metadata": {},
132
- "source": [
133
- "#### Dashboard 1"
134
- ]
135
- },
136
- {
137
- "cell_type": "code",
138
- "execution_count": 5,
139
- "metadata": {},
140
- "outputs": [
141
- {
142
- "data": {
143
- "application/vnd.jupyter.widget-view+json": {
144
- "model_id": "f34ff64d283745d898be02d71dce8870",
145
- "version_major": 2,
146
- "version_minor": 0
147
- },
148
- "text/plain": [
149
- "VBox(children=(interactive(children=(Dropdown(description='channel', options=('The View', 'CBS This Morning', …"
150
- ]
151
- },
152
- "metadata": {},
153
- "output_type": "display_data"
154
- }
155
- ],
156
- "source": [
157
- "# nbi:left\n",
158
- "options = {\n",
159
- " 'title': 'Views for Trending Videos',\n",
160
- " 'xlabel': 'Date Trending',\n",
161
- " 'ylabel': 'Views [1k]',\n",
162
- " 'animation_duration': 500,\n",
163
- " 'aspect_ratio': 1.0,\n",
164
- "}\n",
165
- "\n",
166
- "def xs(channel):\n",
167
- " return videos.loc[videos['channel_title']\n",
168
- " == channel].index\n",
169
- "\n",
170
- "def ys(xs): \n",
171
- " return (videos.loc[xs, 'views'])/1000\n",
172
- "\n",
173
- "\n",
174
- "\n",
175
- "\n",
176
- "nbi.scatter(xs, ys,\n",
177
- " channel =\n",
178
- " videos['channel_title'].unique()[9:15],\n",
179
- " options = options)"
180
- ]
181
- },
182
- {
183
- "cell_type": "code",
184
- "execution_count": 6,
185
- "metadata": {},
186
- "outputs": [
187
- {
188
- "data": {
189
- "application/vnd.jupyter.widget-view+json": {
190
- "model_id": "bfae675465fc4796b21a9ab268ee36db",
191
- "version_major": 2,
192
- "version_minor": 0
193
- },
194
- "text/plain": [
195
- "VBox(children=(interactive(children=(ToggleButtons(description='col', options=('comment_count', 'likes', 'disl…"
196
- ]
197
- },
198
- "metadata": {},
199
- "output_type": "display_data"
200
- }
201
- ],
202
- "source": [
203
- "# nbi:right\n",
204
- "options={\n",
205
- " 'ylabel': 'Proportion per Unit [1k]',\n",
206
- " 'xlabel': 'Units',\n",
207
- " 'bins': 100,\n",
208
- " 'aspect_ratio': 1.0,\n",
209
- "}\n",
210
- "\n",
211
- "def values(col):\n",
212
- " vals = videos[col]\n",
213
- " return (vals[vals < vals.quantile(0.8)])/1000\n",
214
- "\n",
215
- "\n",
216
- "\n",
217
- "\n",
218
- "\n",
219
- "\n",
220
- "nbi.hist(\n",
221
- " values,col =\n",
222
- " widgets.ToggleButtons(\n",
223
- " options =\n",
224
- " ['comment_count', 'likes', 'dislikes', 'views']), \n",
225
- " options = options)"
226
- ]
227
- },
228
- {
229
- "cell_type": "markdown",
230
- "metadata": {},
231
- "source": [
232
- " "
233
- ]
234
- },
235
- {
236
- "cell_type": "markdown",
237
- "metadata": {},
238
- "source": [
239
- "#### Dashboard 2\n",
240
- "\n",
241
- "This dashboard example is using the same widgets used for *Dashboard 1*, but **without** showing the code."
242
- ]
243
- },
244
- {
245
- "cell_type": "code",
246
- "execution_count": 7,
247
- "metadata": {
248
- "scrolled": true
249
- },
250
- "outputs": [
251
- {
252
- "data": {
253
- "application/vnd.jupyter.widget-view+json": {
254
- "model_id": "05643581d48f4e099cefe122abb69fc3",
255
- "version_major": 2,
256
- "version_minor": 0
257
- },
258
- "text/plain": [
259
- "interactive(children=(IntSlider(value=0, description='row', max=2428, step=7), IntSlider(value=0, description=…"
260
- ]
261
- },
262
- "metadata": {},
263
- "output_type": "display_data"
264
- },
265
- {
266
- "name": "stdout",
267
- "output_type": "stream",
268
- "text": [
269
- "(2435 rows, 8 columns) total\n"
270
- ]
271
- }
272
- ],
273
- "source": [
274
- "# nbi:hide_in\n",
275
- "df_interact(videos)"
276
- ]
277
- },
278
- {
279
- "cell_type": "code",
280
- "execution_count": 8,
281
- "metadata": {},
282
- "outputs": [
283
- {
284
- "data": {
285
- "application/vnd.jupyter.widget-view+json": {
286
- "model_id": "26eb63dac95d4f5f8cf6eb709ae3114e",
287
- "version_major": 2,
288
- "version_minor": 0
289
- },
290
- "text/plain": [
291
- "VBox(children=(interactive(children=(Dropdown(description='channel', options=('The View', 'CBS This Morning', …"
292
- ]
293
- },
294
- "metadata": {},
295
- "output_type": "display_data"
296
- }
297
- ],
298
- "source": [
299
- "# nbi:hide_in\n",
300
- "# nbi:left\n",
301
- "options = {\n",
302
- " 'title': 'Views for Trending Videos',\n",
303
- " 'xlabel': 'Date Trending',\n",
304
- " 'ylabel': 'Views [1k]',\n",
305
- " 'animation_duration': 500,\n",
306
- " 'aspect_ratio': 1.0,\n",
307
- "}\n",
308
- "\n",
309
- "def xs(channel):\n",
310
- " return videos.loc[videos['channel_title'] == channel].index\n",
311
- "\n",
312
- "def ys(xs): \n",
313
- " return (videos.loc[xs, 'views'])/1000\n",
314
- "\n",
315
- "nbi.scatter(xs, ys,\n",
316
- " channel=videos['channel_title'].unique()[9:15],\n",
317
- " options = options)"
318
- ]
319
- },
320
- {
321
- "cell_type": "code",
322
- "execution_count": 9,
323
- "metadata": {},
324
- "outputs": [
325
- {
326
- "data": {
327
- "application/vnd.jupyter.widget-view+json": {
328
- "model_id": "ad29e611b9924f5fac314bac49bafc6e",
329
- "version_major": 2,
330
- "version_minor": 0
331
- },
332
- "text/plain": [
333
- "VBox(children=(interactive(children=(ToggleButtons(description='col', options=('comment_count', 'likes', 'disl…"
334
- ]
335
- },
336
- "metadata": {},
337
- "output_type": "display_data"
338
- }
339
- ],
340
- "source": [
341
- "# nbi:hide_in\n",
342
- "# nbi:right\n",
343
- "options={\n",
344
- " 'ylabel': 'Proportion per Unit [1k]',\n",
345
- " 'xlabel': 'Units',\n",
346
- " 'bins': 100,\n",
347
- " 'aspect_ratio': 1.0,\n",
348
- "}\n",
349
- "\n",
350
- "def values(col):\n",
351
- " vals = videos[col]\n",
352
- " return (vals[vals < vals.quantile(0.8)])/1000\n",
353
- "\n",
354
- "nbi.hist(\n",
355
- " values,col =\n",
356
- " widgets.ToggleButtons(\n",
357
- " options =\n",
358
- " ['comment_count', 'likes', 'dislikes', 'views']), \n",
359
- " options = options)"
360
- ]
361
- }
362
- ],
363
- "metadata": {
364
- "kernelspec": {
365
- "display_name": "Python 3",
366
- "language": "python",
367
- "name": "python3"
368
- },
369
- "language_info": {
370
- "codemirror_mode": {
371
- "name": "ipython",
372
- "version": 3
373
- },
374
- "file_extension": ".py",
375
- "mimetype": "text/x-python",
376
- "name": "python",
377
- "nbconvert_exporter": "python",
378
- "pygments_lexer": "ipython3",
379
- "version": "3.7.9"
380
- }
381
- },
382
- "nbformat": 4,
383
- "nbformat_minor": 2
384
- }