|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "markdown", |
5 | | - "id": "4439da88", |
6 | 5 | "metadata": { |
7 | 6 | "execution": {} |
8 | 7 | }, |
|
12 | 11 | }, |
13 | 12 | { |
14 | 13 | "cell_type": "markdown", |
15 | | - "id": "60f237f1", |
16 | 14 | "metadata": { |
17 | 15 | "execution": {} |
18 | 16 | }, |
|
22 | 20 | }, |
23 | 21 | { |
24 | 22 | "cell_type": "markdown", |
25 | | - "id": "077e2215", |
26 | 23 | "metadata": { |
27 | 24 | "execution": {} |
28 | 25 | }, |
|
34 | 31 | }, |
35 | 32 | { |
36 | 33 | "cell_type": "markdown", |
37 | | - "id": "01f5b2db-5c99-4d8c-ab4f-b74b1b5750fe", |
38 | 34 | "metadata": { |
39 | 35 | "execution": {} |
40 | 36 | }, |
|
44 | 40 | }, |
45 | 41 | { |
46 | 42 | "cell_type": "markdown", |
47 | | - "id": "6aeeb24a-ef31-4194-b892-9c8cd280c760", |
48 | 43 | "metadata": { |
49 | 44 | "execution": {} |
50 | 45 | }, |
|
55 | 50 | "* Communicate your results to a scientific audience as well as the public.\n", |
56 | 51 | "\n" |
57 | 52 | ] |
| 53 | + }, |
| 54 | + { |
| 55 | + "cell_type": "code", |
| 56 | + "execution_count": null, |
| 57 | + "metadata": { |
| 58 | + "cellView": "form", |
| 59 | + "execution": {} |
| 60 | + }, |
| 61 | + "outputs": [], |
| 62 | + "source": [ |
| 63 | + "# @title Install and import feedback gadget\n", |
| 64 | + "\n", |
| 65 | + "!pip3 install vibecheck datatops --quiet\n", |
| 66 | + "\n", |
| 67 | + "from vibecheck import DatatopsContentReviewContainer\n", |
| 68 | + "def content_review(notebook_section: str):\n", |
| 69 | + " return DatatopsContentReviewContainer(\n", |
| 70 | + " \"\", # No text prompt\n", |
| 71 | + " notebook_section,\n", |
| 72 | + " {\n", |
| 73 | + " \"url\": \"https://pmyvdlilci.execute-api.us-east-1.amazonaws.com/klab\",\n", |
| 74 | + " \"name\": \"comptools_4clim\",\n", |
| 75 | + " \"user_key\": \"l5jpxuee\",\n", |
| 76 | + " },\n", |
| 77 | + " ).render()\n", |
| 78 | + "\n", |
| 79 | + "\n", |
| 80 | + "feedback_prefix = \"GRP_Intro\"" |
| 81 | + ] |
| 82 | + }, |
| 83 | + { |
| 84 | + "cell_type": "markdown", |
| 85 | + "metadata": { |
| 86 | + "execution": {} |
| 87 | + }, |
| 88 | + "source": [ |
| 89 | + "## Video 1: Open Science 101\n" |
| 90 | + ] |
| 91 | + }, |
| 92 | + { |
| 93 | + "cell_type": "code", |
| 94 | + "execution_count": null, |
| 95 | + "metadata": { |
| 96 | + "cellView": "form", |
| 97 | + "execution": {} |
| 98 | + }, |
| 99 | + "outputs": [], |
| 100 | + "source": [ |
| 101 | + "# @markdown\n", |
| 102 | + "\n", |
| 103 | + "from ipywidgets import widgets\n", |
| 104 | + "from IPython.display import YouTubeVideo\n", |
| 105 | + "from IPython.display import IFrame\n", |
| 106 | + "from IPython.display import display\n", |
| 107 | + "\n", |
| 108 | + "\n", |
| 109 | + "class PlayVideo(IFrame):\n", |
| 110 | + " def __init__(self, id, source, page=1, width=400, height=300, **kwargs):\n", |
| 111 | + " self.id = id\n", |
| 112 | + " if source == \"Bilibili\":\n", |
| 113 | + " src = f\"https://player.bilibili.com/player.html?bvid={id}&page={page}\"\n", |
| 114 | + " elif source == \"Osf\":\n", |
| 115 | + " src = f\"https://mfr.ca-1.osf.io/render?url=https://osf.io/download/{id}/?direct%26mode=render\"\n", |
| 116 | + " super(PlayVideo, self).__init__(src, width, height, **kwargs)\n", |
| 117 | + "\n", |
| 118 | + "\n", |
| 119 | + "def display_videos(video_ids, W=400, H=300, fs=1):\n", |
| 120 | + " tab_contents = []\n", |
| 121 | + " for i, video_id in enumerate(video_ids):\n", |
| 122 | + " out = widgets.Output()\n", |
| 123 | + " with out:\n", |
| 124 | + " if video_ids[i][0] == \"Youtube\":\n", |
| 125 | + " video = YouTubeVideo(\n", |
| 126 | + " id=video_ids[i][1], width=W, height=H, fs=fs, rel=0\n", |
| 127 | + " )\n", |
| 128 | + " print(f\"Video available at https://youtube.com/watch?v={video.id}\")\n", |
| 129 | + " else:\n", |
| 130 | + " video = PlayVideo(\n", |
| 131 | + " id=video_ids[i][1],\n", |
| 132 | + " source=video_ids[i][0],\n", |
| 133 | + " width=W,\n", |
| 134 | + " height=H,\n", |
| 135 | + " fs=fs,\n", |
| 136 | + " autoplay=False,\n", |
| 137 | + " )\n", |
| 138 | + " if video_ids[i][0] == \"Bilibili\":\n", |
| 139 | + " print(\n", |
| 140 | + " f\"Video available at https://www.bilibili.com/video/{video.id}\"\n", |
| 141 | + " )\n", |
| 142 | + " elif video_ids[i][0] == \"Osf\":\n", |
| 143 | + " print(f\"Video available at https://osf.io/{video.id}\")\n", |
| 144 | + " display(video)\n", |
| 145 | + " tab_contents.append(out)\n", |
| 146 | + " return tab_contents\n", |
| 147 | + "\n", |
| 148 | + "\n", |
| 149 | + "video_ids = [(\"Youtube\", \"2tDQWIjEA2M\"), (\"Bilibili\", \"BV16a7dzSEG4\")]\n", |
| 150 | + "tab_contents = display_videos(video_ids, W=730, H=410)\n", |
| 151 | + "tabs = widgets.Tab()\n", |
| 152 | + "tabs.children = tab_contents\n", |
| 153 | + "for i in range(len(tab_contents)):\n", |
| 154 | + " tabs.set_title(i, video_ids[i][0])\n", |
| 155 | + "display(tabs)" |
| 156 | + ] |
| 157 | + }, |
| 158 | + { |
| 159 | + "cell_type": "code", |
| 160 | + "execution_count": null, |
| 161 | + "metadata": { |
| 162 | + "cellView": "form", |
| 163 | + "execution": {} |
| 164 | + }, |
| 165 | + "outputs": [], |
| 166 | + "source": [ |
| 167 | + "# @title Submit your feedback\n", |
| 168 | + "content_review(f\"{feedback_prefix}_Intro_Video\")" |
| 169 | + ] |
| 170 | + }, |
| 171 | + { |
| 172 | + "cell_type": "markdown", |
| 173 | + "metadata": { |
| 174 | + "execution": {} |
| 175 | + }, |
| 176 | + "source": [ |
| 177 | + "## Slides\n" |
| 178 | + ] |
| 179 | + }, |
| 180 | + { |
| 181 | + "cell_type": "code", |
| 182 | + "execution_count": null, |
| 183 | + "metadata": { |
| 184 | + "cellView": "form", |
| 185 | + "execution": {} |
| 186 | + }, |
| 187 | + "outputs": [], |
| 188 | + "source": [ |
| 189 | + "# @markdown\n", |
| 190 | + "from IPython.display import IFrame\n", |
| 191 | + "\n", |
| 192 | + "link_id = \"dptzs\"\n", |
| 193 | + "\n", |
| 194 | + "print(f\"If you want to download the slides: https://osf.io/download/{link_id}/\")\n", |
| 195 | + "IFrame(src=f\"https://mfr.ca-1.osf.io/render?url=https://osf.io/{link_id}/?direct%26mode=render%26action=download%26mode=render\", width=854, height=480)" |
| 196 | + ] |
| 197 | + }, |
| 198 | + { |
| 199 | + "cell_type": "code", |
| 200 | + "execution_count": null, |
| 201 | + "metadata": { |
| 202 | + "cellView": "form", |
| 203 | + "execution": {} |
| 204 | + }, |
| 205 | + "outputs": [], |
| 206 | + "source": [ |
| 207 | + "# @title Submit your feedback\n", |
| 208 | + "content_review(f\"{feedback_prefix}_Intro_Video_Slides\")" |
| 209 | + ] |
58 | 210 | } |
59 | 211 | ], |
60 | 212 | "metadata": { |
|
84 | 236 | "name": "python", |
85 | 237 | "nbconvert_exporter": "python", |
86 | 238 | "pygments_lexer": "ipython3", |
87 | | - "version": "3.9.19" |
| 239 | + "version": "3.9.18" |
88 | 240 | } |
89 | 241 | }, |
90 | 242 | "nbformat": 4, |
91 | | - "nbformat_minor": 5 |
| 243 | + "nbformat_minor": 4 |
92 | 244 | } |
0 commit comments