Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit abc5b2c

Browse files
committedOct 29, 2023
fix interactive path diagram
1 parent 104245f commit abc5b2c

File tree

2 files changed

+32
-64
lines changed

2 files changed

+32
-64
lines changed
 

‎environment.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ dependencies:
1111
- seaborn
1212
- coolprop
1313
- scikits.odes
14+
- python-graphviz

‎reactors/interactive_path_diagram.ipynb

+31-64
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
{
1313
"cell_type": "code",
14-
"execution_count": 1,
14+
"execution_count": 16,
1515
"metadata": {
1616
"tags": []
1717
},
@@ -20,7 +20,7 @@
2020
"name": "stdout",
2121
"output_type": "stream",
2222
"text": [
23-
"Using Cantera version: 2.6.0a4\n"
23+
"Using Cantera version: 2.6.0\n"
2424
]
2525
}
2626
],
@@ -29,6 +29,7 @@
2929
"from ipywidgets import widgets, interact\n",
3030
"import cantera as ct\n",
3131
"import numpy as np\n",
32+
"import graphviz\n",
3233
"\n",
3334
"%matplotlib inline\n",
3435
"%config InlineBackend.figure_formats = [\"svg\"]\n",
@@ -50,7 +51,7 @@
5051
},
5152
{
5253
"cell_type": "code",
53-
"execution_count": 2,
54+
"execution_count": 5,
5455
"metadata": {
5556
"tags": []
5657
},
@@ -73,7 +74,7 @@
7374
},
7475
{
7576
"cell_type": "code",
76-
"execution_count": 3,
77+
"execution_count": 6,
7778
"metadata": {
7879
"tags": []
7980
},
@@ -91,7 +92,7 @@
9192
},
9293
{
9394
"cell_type": "code",
94-
"execution_count": 4,
95+
"execution_count": 7,
9596
"metadata": {
9697
"tags": []
9798
},
@@ -109,7 +110,7 @@
109110
},
110111
{
111112
"cell_type": "code",
112-
"execution_count": 5,
113+
"execution_count": 8,
113114
"metadata": {
114115
"tags": []
115116
},
@@ -130,7 +131,7 @@
130131
},
131132
{
132133
"cell_type": "code",
133-
"execution_count": 6,
134+
"execution_count": 9,
134135
"metadata": {
135136
"tags": []
136137
},
@@ -158,18 +159,18 @@
158159
},
159160
{
160161
"cell_type": "code",
161-
"execution_count": 7,
162+
"execution_count": 10,
162163
"metadata": {},
163164
"outputs": [
164165
{
165166
"data": {
166167
"application/vnd.jupyter.widget-view+json": {
167-
"model_id": "e73efe770a6a424aab889d76a70ea2d4",
168+
"model_id": "e9eb8420e3d1441d8dacca916d65ccea",
168169
"version_major": 2,
169170
"version_minor": 0
170171
},
171172
"text/plain": [
172-
"interactive(children=(IntSlider(value=100, description='plot_step', max=1510, step=10), FloatSlider(value=0.1,…"
173+
"interactive(children=(IntSlider(value=100, description='plot_step', max=1730, step=10), FloatSlider(value=0.1,…"
173174
]
174175
},
175176
"metadata": {},
@@ -200,12 +201,8 @@
200201
" diagram.threshold = threshold\n",
201202
"\n",
202203
" diagram.show_details = details\n",
203-
" dot_file = \"reaction_paths.dot\"\n",
204-
" png_file = \"reaction_paths.png\"\n",
205-
" diagram.write_dot(dot_file)\n",
206-
" subprocess.run(f\"dot {dot_file} -Tpng -o{png_file} -Gdpi=100\".split())\n",
207-
" img = Image(filename=png_file)\n",
208-
" display(img)"
204+
" graph = graphviz.Source(diagram.get_dot())\n",
205+
" display(graph)"
209206
]
210207
},
211208
{
@@ -218,7 +215,7 @@
218215
},
219216
{
220217
"cell_type": "code",
221-
"execution_count": 8,
218+
"execution_count": null,
222219
"metadata": {
223220
"tags": []
224221
},
@@ -240,7 +237,7 @@
240237
},
241238
{
242239
"cell_type": "code",
243-
"execution_count": 9,
240+
"execution_count": null,
244241
"metadata": {
245242
"tags": []
246243
},
@@ -274,24 +271,9 @@
274271
},
275272
{
276273
"cell_type": "code",
277-
"execution_count": 10,
274+
"execution_count": null,
278275
"metadata": {},
279-
"outputs": [
280-
{
281-
"data": {
282-
"application/vnd.jupyter.widget-view+json": {
283-
"model_id": "f389251a70744d52b493b85eae3e909f",
284-
"version_major": 2,
285-
"version_minor": 0
286-
},
287-
"text/plain": [
288-
"interactive(children=(FloatSlider(value=0.01, description='annotation_cutoff', max=4.0, min=0.01), Output()), …"
289-
]
290-
},
291-
"metadata": {},
292-
"output_type": "display_data"
293-
}
294-
],
276+
"outputs": [],
295277
"source": [
296278
"@interact(\n",
297279
" annotation_cutoff=widgets.FloatSlider(value=1e-2, min=1e-2, max=4, steps=10),\n",
@@ -348,7 +330,7 @@
348330
},
349331
{
350332
"cell_type": "code",
351-
"execution_count": 11,
333+
"execution_count": null,
352334
"metadata": {
353335
"tags": []
354336
},
@@ -374,24 +356,9 @@
374356
},
375357
{
376358
"cell_type": "code",
377-
"execution_count": 12,
359+
"execution_count": null,
378360
"metadata": {},
379-
"outputs": [
380-
{
381-
"data": {
382-
"application/vnd.jupyter.widget-view+json": {
383-
"model_id": "8a6a58db99d7422790a30e3f448189c2",
384-
"version_major": 2,
385-
"version_minor": 0
386-
},
387-
"text/plain": [
388-
"interactive(children=(FloatLogSlider(value=1e-05, description='annotation_cutoff', max=-4.0, min=-5.0), Output…"
389-
]
390-
},
391-
"metadata": {},
392-
"output_type": "display_data"
393-
}
394-
],
361+
"outputs": [],
395362
"source": [
396363
"@interact(\n",
397364
" annotation_cutoff=widgets.FloatLogSlider(\n",
@@ -437,7 +404,7 @@
437404
"name": "python",
438405
"nbconvert_exporter": "python",
439406
"pygments_lexer": "ipython3",
440-
"version": "3.9.12"
407+
"version": "3.8.12"
441408
},
442409
"widgets": {
443410
"application/vnd.jupyter.widget-state+json": {
@@ -528,9 +495,9 @@
528495
"description": "annotation_cutoff",
529496
"layout": "IPY_MODEL_b31e0f2f2acb403b83a084fb18495310",
530497
"max": 0.0001,
531-
"min": 1e-06,
498+
"min": 0.000001,
532499
"step": 0.1,
533-
"value": 1e-06
500+
"value": 0.000001
534501
}
535502
},
536503
"11d4490fa73f470fa12134bdbe95172f": {
@@ -791,9 +758,9 @@
791758
"description": "annotation_cutoff",
792759
"layout": "IPY_MODEL_cebcfa314a17448385e00d23be4e1132",
793760
"max": 0.0001,
794-
"min": 1e-06,
761+
"min": 0.000001,
795762
"step": 0.1,
796-
"value": 1e-06
763+
"value": 0.000001
797764
}
798765
},
799766
"549874ce98c54398bdb34b108c543913": {
@@ -941,9 +908,9 @@
941908
"description": "annotation_cutoff",
942909
"layout": "IPY_MODEL_410cc700779545278ab29d6bdb515078",
943910
"max": 0.0001,
944-
"min": 1e-06,
911+
"min": 0.000001,
945912
"step": 0.1,
946-
"value": 1e-06
913+
"value": 0.000001
947914
}
948915
},
949916
"6c48772d2156460e98f2d2e53d19ce7d": {
@@ -956,9 +923,9 @@
956923
"description": "annotation_cutoff",
957924
"layout": "IPY_MODEL_d46402fffd6243a58b1eab788b948adc",
958925
"max": 0.1,
959-
"min": 1e-05,
926+
"min": 0.00001,
960927
"step": 0.1,
961-
"value": 1e-05
928+
"value": 0.00001
962929
}
963930
},
964931
"6db5fd30b2f7461ca1cc5547b1330a98": {
@@ -1527,9 +1494,9 @@
15271494
"description": "annotation_cutoff",
15281495
"layout": "IPY_MODEL_466f3c1486704068ac57d20e554de8cf",
15291496
"max": 0.1,
1530-
"min": 1e-05,
1497+
"min": 0.00001,
15311498
"step": 0.1,
1532-
"value": 1e-05
1499+
"value": 0.00001
15331500
}
15341501
},
15351502
"ce95d34031c1420abab17b1f372f6edc": {

0 commit comments

Comments
 (0)
This repository has been archived.