Skip to content

Commit 7d16380

Browse files
authored
Merge pull request #150 from neuromatch/staging
Staging
2 parents e59fbbf + 3401db9 commit 7d16380

21 files changed

Lines changed: 1025 additions & 50 deletions

tutorials/Projects_GoodResearchPractices/Projects_Intro.ipynb

Lines changed: 159 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "4439da88",
65
"metadata": {
76
"execution": {}
87
},
@@ -12,7 +11,6 @@
1211
},
1312
{
1413
"cell_type": "markdown",
15-
"id": "60f237f1",
1614
"metadata": {
1715
"execution": {}
1816
},
@@ -22,7 +20,6 @@
2220
},
2321
{
2422
"cell_type": "markdown",
25-
"id": "077e2215",
2623
"metadata": {
2724
"execution": {}
2825
},
@@ -34,7 +31,6 @@
3431
},
3532
{
3633
"cell_type": "markdown",
37-
"id": "01f5b2db-5c99-4d8c-ab4f-b74b1b5750fe",
3834
"metadata": {
3935
"execution": {}
4036
},
@@ -44,7 +40,6 @@
4440
},
4541
{
4642
"cell_type": "markdown",
47-
"id": "6aeeb24a-ef31-4194-b892-9c8cd280c760",
4843
"metadata": {
4944
"execution": {}
5045
},
@@ -55,6 +50,163 @@
5550
"* Communicate your results to a scientific audience as well as the public.\n",
5651
"\n"
5752
]
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+
]
58210
}
59211
],
60212
"metadata": {
@@ -84,9 +236,9 @@
84236
"name": "python",
85237
"nbconvert_exporter": "python",
86238
"pygments_lexer": "ipython3",
87-
"version": "3.9.19"
239+
"version": "3.9.18"
88240
}
89241
},
90242
"nbformat": 4,
91-
"nbformat_minor": 5
243+
"nbformat_minor": 4
92244
}

0 commit comments

Comments
 (0)