Skip to content

Commit 270f7e8

Browse files
committed
colab badge for widgets_playground
1 parent 8a93509 commit 270f7e8

File tree

3 files changed

+40
-25
lines changed

3 files changed

+40
-25
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ gas_data = ppmc.GasData(("H2SO4", "HNO3", "HCl", "NH3", "NO", "NO2"))
7272
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/condense.ipynb)
7373
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/condense.ipynb)
7474
- `widgets_playground` notebook:
75+
[![nbviewer](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.jupyter.org/github/open-atmos/PyPartMC/blob/main/examples/widgets_playground.ipynb)
76+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/widgets_playground.ipynb)
7577
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/widgets_playground.ipynb)
7678

7779
#### usage in other projects

examples/condense.ipynb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
},
7474
{
7575
"cell_type": "code",
76-
"execution_count": 6,
76+
"execution_count": 14,
7777
"metadata": {},
7878
"outputs": [],
7979
"source": [
@@ -124,7 +124,7 @@
124124
},
125125
{
126126
"cell_type": "code",
127-
"execution_count": 9,
127+
"execution_count": null,
128128
"metadata": {},
129129
"outputs": [],
130130
"source": [
@@ -159,14 +159,14 @@
159159
},
160160
{
161161
"cell_type": "code",
162-
"execution_count": 10,
162+
"execution_count": 15,
163163
"metadata": {},
164164
"outputs": [],
165165
"source": [
166166
"run_part_opt = ppmc.RunPartOpt({\n",
167167
" \"do_coagulation\": False,\n",
168168
" \"do_parallel\": False,\n",
169-
" \"t_max\": 0 * si.s,\n",
169+
" \"t_max\": 1 * si.s,\n",
170170
" \"del_t\": 1 * si.s,\n",
171171
" \"t_output\": 0,\n",
172172
" \"t_progress\": 0,\n",
@@ -186,7 +186,7 @@
186186
},
187187
{
188188
"cell_type": "code",
189-
"execution_count": 12,
189+
"execution_count": 13,
190190
"metadata": {},
191191
"outputs": [],
192192
"source": [

examples/widgets_playground.ipynb

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
{
22
"cells": [
33
{
4-
"cell_type": "code",
5-
"execution_count": 1,
4+
"cell_type": "markdown",
65
"metadata": {},
7-
"outputs": [],
86
"source": [
9-
"import sys\n",
10-
"if 'google.colab' in sys.modules:\n",
11-
" !pip --quiet install git+https://github.com/open-atmos/PyPartMC.git"
7+
"[![nbviewer](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.jupyter.org/github/open-atmos/PyPartMC/blob/main/examples/widgets_playground.ipynb) \n",
8+
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/open-atmos/PyPartMC/blob/main/examples/widgets_playground.ipynb) \n",
9+
"[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open-atmos/PyPartMC.git/main?urlpath=lab/tree/examples/widgets_playground.ipynb)"
1210
]
1311
},
1412
{
1513
"cell_type": "code",
16-
"execution_count": 2,
14+
"execution_count": 1,
1715
"metadata": {},
1816
"outputs": [],
1917
"source": [
20-
"import subprocess\n",
21-
"for package in ('ipywidgets', 'matplotlib'):\n",
22-
" subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package])"
18+
"import subprocess, sys\n",
19+
"\n",
20+
"if 'google.colab' in sys.modules:\n",
21+
" packages = ('git+https://github.com/open-atmos/PyPartMC.git',)\n",
22+
"else:\n",
23+
" packages = ('ipywidgets', 'matplotlib')\n",
24+
"\n",
25+
"for package in packages:\n",
26+
" subprocess.check_call([\n",
27+
" sys.executable, \"-m\", \"pip\", \"install\", \"--quiet\", package\n",
28+
" ])"
2329
]
2430
},
2531
{
2632
"cell_type": "code",
27-
"execution_count": 3,
33+
"execution_count": 2,
2834
"metadata": {},
2935
"outputs": [],
3036
"source": [
@@ -36,7 +42,7 @@
3642
},
3743
{
3844
"cell_type": "code",
39-
"execution_count": 4,
45+
"execution_count": 3,
4046
"metadata": {},
4147
"outputs": [],
4248
"source": [
@@ -46,7 +52,7 @@
4652
},
4753
{
4854
"cell_type": "code",
49-
"execution_count": 5,
55+
"execution_count": 4,
5056
"metadata": {},
5157
"outputs": [],
5258
"source": [
@@ -55,7 +61,7 @@
5561
},
5662
{
5763
"cell_type": "code",
58-
"execution_count": 6,
64+
"execution_count": 5,
5965
"metadata": {},
6066
"outputs": [],
6167
"source": [
@@ -65,7 +71,7 @@
6571
},
6672
{
6773
"cell_type": "code",
68-
"execution_count": 7,
74+
"execution_count": 6,
6975
"metadata": {},
7076
"outputs": [],
7177
"source": [
@@ -89,7 +95,7 @@
8995
},
9096
{
9197
"cell_type": "code",
92-
"execution_count": 8,
98+
"execution_count": 7,
9399
"metadata": {},
94100
"outputs": [],
95101
"source": [
@@ -110,13 +116,13 @@
110116
},
111117
{
112118
"cell_type": "code",
113-
"execution_count": 9,
119+
"execution_count": 8,
114120
"metadata": {},
115121
"outputs": [
116122
{
117123
"data": {
118124
"application/vnd.jupyter.widget-view+json": {
119-
"model_id": "3e2802d5172d42a791329ae152b6e12b",
125+
"model_id": "2e539a71b14b40c2b96933a5398b2fd9",
120126
"version_major": 2,
121127
"version_minor": 0
122128
},
@@ -134,7 +140,7 @@
134140
},
135141
{
136142
"cell_type": "code",
137-
"execution_count": 10,
143+
"execution_count": 9,
138144
"metadata": {},
139145
"outputs": [
140146
{
@@ -151,7 +157,7 @@
151157
},
152158
{
153159
"cell_type": "code",
154-
"execution_count": 11,
160+
"execution_count": 10,
155161
"metadata": {},
156162
"outputs": [
157163
{
@@ -167,6 +173,13 @@
167173
"print(gas_data)"
168174
]
169175
},
176+
{
177+
"cell_type": "code",
178+
"execution_count": null,
179+
"metadata": {},
180+
"outputs": [],
181+
"source": []
182+
},
170183
{
171184
"cell_type": "code",
172185
"execution_count": null,

0 commit comments

Comments
 (0)