|
6 | 6 | "source": [ |
7 | 7 | "# Getting Started in AMICI\n", |
8 | 8 | "\n", |
9 | | - "This notebook is a brief tutorial for new users that explains the first steps necessary for model simulation in AMICI, including pointers to documentation and more advanced notebooks." |
| 9 | + "This notebook is a brief tutorial for new users that explains the first steps necessary for model simulation in AMICI, including pointers to documentation and more advanced notebooks. Here, we focus on AMICI's SUNDIALS backend. Users interested in using the JAX backend can find a respective tutorial in the [ExampleJAX](https://amici.readthedocs.io/en/latest/examples/example_jax/ExampleJax.html) notebook." |
10 | 10 | ] |
11 | 11 | }, |
12 | 12 | { |
13 | 13 | "cell_type": "markdown", |
14 | 14 | "metadata": {}, |
15 | 15 | "source": [ |
16 | 16 | "## Model Compilation\n", |
17 | | - "Before simulations can be run, the model must be imported and compiled. In this process, AMICI performs all symbolic manipulations that later enable scalable simulations and efficient sensitivity computation. The first step towards model compilation is the creation of an [SbmlImporter](https://amici.readthedocs.io/en/latest/generated/amici.sbml_import.SbmlImporter.html) instance, which requires an SBML Document that specifies the model using the [Systems Biology Markup Language (SBML)](https://sbml.org/).\n", |
| 17 | + "\n", |
| 18 | + "Before any simulations can be run, the model must be imported and compiled. In this process, AMICI performs all symbolic manipulations that later enable scalable simulations and efficient sensitivity computation. The first step towards model compilation is the creation of an [SbmlImporter](https://amici.readthedocs.io/en/latest/generated/amici.importers.sbml.html#amici.importers.sbml.SbmlImporter) instance, which requires an SBML Document that specifies the model using the [Systems Biology Markup Language (SBML)](https://sbml.org/).\n", |
18 | 19 | "\n", |
19 | 20 | "For the purpose of this tutorial, we will use `model_steadystate_scaled.xml`, which is contained in the same directory as this notebook." |
20 | 21 | ] |
|
34 | 35 | { |
35 | 36 | "cell_type": "markdown", |
36 | 37 | "metadata": {}, |
37 | | - "source": [ |
38 | | - "Next, we will compile the model as python extension using the [amici.SBMLImporter.sbml2amici](https://amici.readthedocs.io/en/latest/generated/amici.sbml_import.SbmlImporter.html#amici.sbml_import.SbmlImporter.sbml2amici) method. The first two arguments of this method are the name of the model, which will also be the name of the generated python module, and the model directory, which defines the directory in which the model module will be placed. Compilation will take a couple of seconds." |
39 | | - ] |
| 38 | + "source": "Next, we will compile the model as python extension using the [SBMLImporter.sbml2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.sbml.html#amici.importers.sbml.SbmlImporter.sbml2amici) method. The first two arguments of this method are the name of the model, which will also be the name of the generated Python module, and the model directory, which defines the directory in which the model module will be placed. Compilation will take a couple of seconds." |
40 | 39 | }, |
41 | 40 | { |
42 | 41 | "cell_type": "code", |
|
54 | 53 | "metadata": {}, |
55 | 54 | "source": [ |
56 | 55 | "## Loading the model module\n", |
57 | | - "To run simulations, we need to instantiate [amici.Model](https://amici.readthedocs.io/en/latest/generated/amici.amici.Model.html) and [amici.Solver](https://amici.readthedocs.io/en/latest/generated/amici.amici.Solver.html) instances. As simulations require instances matching the imported model, they have to be imported from the generated model module." |
| 56 | + "\n", |
| 57 | + "To run simulations, we need to instantiate [amici.sim.sundials.Model](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.Model) and [amici.sim.sundials.Solver](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.Solver) instances.\n", |
| 58 | + "As simulations require instances matching the imported model, they have to be imported from the generated model module." |
58 | 59 | ] |
59 | 60 | }, |
60 | 61 | { |
|
109 | 110 | { |
110 | 111 | "cell_type": "markdown", |
111 | 112 | "metadata": {}, |
112 | | - "source": "Model simulations can be executed using the [Model.simulate](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.Model.simulate) method (or, alternatively, [amici.run_simulation](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.run_simulation)). By default, the model does not contain any output timepoints for which the model is to be simulated. Here we define a simulation timecourse with two output timepoints at `0` and `1` and then run the simulation." |
| 113 | + "source": "Model simulations can be executed using the [Model.simulate](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.Model.simulate) method (or, alternatively, [amici.sim.sundials.run_simulation](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.run_simulation)). By default, the model does not contain any output timepoints for which the model is to be simulated. Here we define a simulation timecourse with two output timepoints at `0` and `1` and then run the simulation." |
113 | 114 | }, |
114 | 115 | { |
115 | 116 | "cell_type": "code", |
|
125 | 126 | { |
126 | 127 | "cell_type": "markdown", |
127 | 128 | "metadata": {}, |
128 | | - "source": "Simulation results are returned as [ReturnData](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.ReturnData) instance. The simulated SBML species are stored as `x` attribute, where rows correspond to the different timepoints and columns correspond to different species." |
| 129 | + "source": "Simulation results are returned as [amici.sim.sundials.ReturnData](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.ReturnData) instance. The simulated SBML species are stored as `x` attribute, where rows correspond to the different timepoints and columns correspond to different species." |
129 | 130 | }, |
130 | 131 | { |
131 | 132 | "cell_type": "code", |
|
175 | 176 | "plot_state_trajectories(rdata)" |
176 | 177 | ] |
177 | 178 | }, |
| 179 | + { |
| 180 | + "metadata": {}, |
| 181 | + "cell_type": "markdown", |
| 182 | + "source": [ |
| 183 | + "## Summary\n", |
| 184 | + "\n", |
| 185 | + "This notebook explained the first steps necessary to run simulations in AMICI. The main steps include the compilation of the model, importing the resulting model module, instantiation of model and solver objects, and running simulations using those objects.\n", |
| 186 | + "\n", |
| 187 | + "" |
| 188 | + ] |
| 189 | + }, |
178 | 190 | { |
179 | 191 | "cell_type": "markdown", |
180 | 192 | "metadata": {}, |
|
0 commit comments