Skip to content

Commit 5e5ec61

Browse files
authored
Doc: Rename 'steadystate example' (#2174)
New title + some minor updates Closes #1990 Mark notebook to always execute it under nbsphinx
1 parent 847a596 commit 5e5ec61

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

binder/overview.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"\n",
1313
" Brief intro to AMICI for first-time users.\n",
1414
"\n",
15-
"* [Example \"steadystate\"](../python/examples/example_steadystate/ExampleSteadystate.ipynb)\n",
15+
"* [SBML import, observation model, sensitivity analysis, data export and visualization](../python/examples/example_steadystate/ExampleSteadystate.ipynb)\n",
1616
"\n",
1717
" A more detailed introduction to the AMICI interface, demonstrating sensitivity analysis, various options, finite difference checks, ...\n",
1818
"\n",

python/examples/example_steadystate/ExampleSteadystate.ipynb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# AMICI Python example \"steadystate\"\n",
7+
"# SBML import, observation model, sensitivity analysis, data export and visualization\n",
88
"\n",
9-
"This is an example using the [model_steadystate_scaled.sbml] model to demonstrate and test SBML import and AMICI Python interface."
9+
"This is an example using the [model_steadystate_scaled.sbml] model to demonstrate:\n",
10+
"\n",
11+
"* SBML import\n",
12+
"* specifying the observation model\n",
13+
"* performing sensitivity analysis\n",
14+
"* exporting and visualizing simulation results"
1015
]
1116
},
1217
{
@@ -23,10 +28,7 @@
2328
"model_output_dir = model_name\n",
2429
"\n",
2530
"import libsbml\n",
26-
"import importlib\n",
2731
"import amici\n",
28-
"import os\n",
29-
"import sys\n",
3032
"import numpy as np\n",
3133
"import matplotlib.pyplot as plt"
3234
]
@@ -145,7 +147,7 @@
145147
"metadata": {},
146148
"outputs": [],
147149
"source": [
148-
"constantParameters = [\"k0\"]"
150+
"constant_parameters = [\"k0\"]"
149151
]
150152
},
151153
{
@@ -341,7 +343,7 @@
341343
" model_output_dir,\n",
342344
" verbose=logging.INFO,\n",
343345
" observables=observables,\n",
344-
" constant_parameters=constantParameters,\n",
346+
" constant_parameters=constant_parameters,\n",
345347
" sigmas=sigmas,\n",
346348
")"
347349
]
@@ -361,8 +363,7 @@
361363
"metadata": {},
362364
"outputs": [],
363365
"source": [
364-
"sys.path.insert(0, os.path.abspath(model_output_dir))\n",
365-
"model_module = importlib.import_module(model_name)"
366+
"model_module = amici.import_model_module(model_name, model_output_dir)"
366367
]
367368
},
368369
{
@@ -447,7 +448,7 @@
447448
"print(\n",
448449
" \"Simulation was run using model default parameters as specified in the SBML model:\"\n",
449450
")\n",
450-
"print(model.getParameters())"
451+
"print(dict(zip(model.getParameterIds(), model.getParameters())))"
451452
]
452453
},
453454
{
@@ -862,18 +863,14 @@
862863
},
863864
{
864865
"cell_type": "code",
865-
"execution_count": 13,
866-
"outputs": [
867-
{
868-
"name": "stdout",
869-
"output_type": "stream",
870-
"text": [
871-
"(1.0, 0.5, 0.4, 2.0, 0.1, 2.0, 3.0, 0.2)\n"
872-
]
873-
}
874-
],
866+
"execution_count": null,
867+
"outputs": [],
875868
"source": [
876-
"print(model.getParameters())"
869+
"# In particular for interactive use, ReturnDataView.by_id() and amici.evaluate provides a more convenient way to access slices of the result:\n",
870+
"# Time trajectory of observable observable_x1\n",
871+
"print(f\"{rdata.by_id('observable_x1')=}\")\n",
872+
"# Time trajectory of state variable x2\n",
873+
"print(f\"{rdata.by_id('x2')=}\")"
877874
],
878875
"metadata": {
879876
"collapsed": false,
@@ -2037,6 +2034,9 @@
20372034
"toc_position": {},
20382035
"toc_section_display": true,
20392036
"toc_window_display": false
2037+
},
2038+
"nbsphinx": {
2039+
"execute": "always"
20402040
}
20412041
},
20422042
"nbformat": 4,

0 commit comments

Comments
 (0)