Skip to content

Commit 22b0965

Browse files
authored
doc: Fix formatting, update names, fix swig-ignores (#3156)
* doc: Fix formatting, update names, fix swig-ignores Fix formatting, update object names, fix swig-ignores * escape underscores; fixes #3153 * update links
1 parent ca04e25 commit 22b0965

File tree

7 files changed

+34
-32
lines changed

7 files changed

+34
-32
lines changed

doc/examples/example_errors.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@
137137
"\n",
138138
"The number of steps the solver has to take is closely related to the chosen error tolerance. More accurate results, more steps. Therefore, this problem can be solved in two ways:\n",
139139
"\n",
140-
"1. Increasing the maximum number of steps via [Solver.set_max_steps](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.Solver.html#amici.sim.sundials.Solver.set_max_steps). Note that this will increase the time required for simulation, and that simulation may still fail eventually. Sometimes it may be preferable to not increase this limit but rather fail fast. Also note that increasing the number of allowed steps increase RAM requirements (even if fewer steps are actually taken), so don't set this to ridiculously large values in order to avoid this error.\n",
140+
"1. Increasing the maximum number of steps via [Solver.set_max_steps](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.Solver.set_max_steps). Note that this will increase the time required for simulation, and that simulation may still fail eventually. Sometimes it may be preferable to not increase this limit but rather fail fast. Also note that increasing the number of allowed steps increase RAM requirements (even if fewer steps are actually taken), so don't set this to ridiculously large values in order to avoid this error.\n",
141141
"\n",
142-
"2. Reducing the number of steps CVODES has to take. This is determined by the required error tolerance. There are various solver error tolerances than can be adjusted. The most relevant ones are those controlled via [Solver.set_relative_tolerance()](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.Solver.html#amici.sim.sundials.Solver.set_relative_tolerance) and [Solver.set_absolute_tolerance()](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.Solver.html#amici.sim.sundials.Solver.set_absolute_tolerance).\n",
142+
"2. Reducing the number of steps CVODES has to take. This is determined by the required error tolerance. There are various solver error tolerances than can be adjusted. The most relevant ones are those controlled via [Solver.set_relative_tolerance()](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.Solver.set_relative_tolerance) and [Solver.set_absolute_tolerance()](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.Solver.set_absolute_tolerance).\n",
143143
"\n",
144144
"So, let's fix that:"
145145
]

doc/examples/example_large_models/example_performance_optimization.ipynb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"4. Compiling the generated code\n",
2020
"5. Simulating the model\n",
2121
"\n",
22-
"![AMICI workflow](https://raw.githubusercontent.com/AMICI-dev/AMICI/master/doc/gfx/amici_workflow.png)\n",
22+
"![AMICI workflow](https://raw.githubusercontent.com/AMICI-dev/AMICI/main/doc/gfx/amici_workflow.png)\n",
2323
"\n",
2424
"There are various options to speed up individual steps of this process. Generally, faster import comes with slower simulation and vice versa. During parameter estimation, a model is often imported only once, and then millions of simulations are run. Therefore, faster simulation will easily compensate for slower import (one-off cost). In other cases, many models may to have to be imported, but only few simulations will be executed. In this case, faster import may be more relevant.\n",
2525
"\n",
@@ -71,15 +71,15 @@
7171
"\n",
7272
"#### Fixing parameters\n",
7373
"\n",
74-
"By default, AMICI will generate sensitivity equations with respect to all model parameters. If it is clear upfront, that sensitivities with respect to certain parameters will not be required, their IDs can be passed to [amici.importers.sbml.SbmlImporter.sbml2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.sbml.SbmlImporter.html#amici.importers.sbml.SbmlImporter.sbml2amici) or [amici.importers.pysb.pysb2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.pysb.html?highlight=pysb2amici#amici.importers.pysb.pysb2amici) via the `fixed_parameters` argument to not generate the respective equations. This will reduce CPU time and RAM requirements during import and simulation.\n",
74+
"By default, AMICI will generate sensitivity equations with respect to all model parameters. If it is clear upfront, that sensitivities with respect to certain parameters will not be required, their IDs can be passed to [amici.importers.sbml.SbmlImporter.sbml2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.sbml.html#amici.importers.sbml.SbmlImporter.sbml2amici) or [amici.importers.pysb.pysb2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.pysb.html#amici.importers.pysb.pysb2amici) via the `fixed_parameters` argument to not generate the respective equations. This will reduce CPU time and RAM requirements during import and simulation.\n",
7575
"The PEtab import will automatically pass all parameters with `petab.ESTIMATE==False` as `fixed_parameters` arguments.\n",
7676
"\n",
7777
"See also the following section for the case that no sensitivities are required at all.\n",
7878
"\n",
7979
"\n",
8080
"#### Not generating sensitivity code\n",
8181
"\n",
82-
"If only forward simulations of a model are required, a modest import speedup can be obtained from not generating sensitivity code. This can be enabled via the `generate_sensitivity_code` argument of [amici.importers.sbml.SbmlImporter.sbml2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.sbml.SbmlImporter.html#amici.importers.sbml.SbmlImporter.sbml2amici) or [amici.importers.pysb.pysb2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.pysb.html?highlight=pysb2amici#amici.importers.pysb.pysb2amici).\n",
82+
"If only forward simulations of a model are required, a modest import speedup can be obtained from not generating sensitivity code. This can be enabled via the `generate_sensitivity_code` argument of [amici.importers.sbml.SbmlImporter.sbml2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.sbml.html#amici.importers.sbml.SbmlImporter.sbml2amici) or [amici.importers.pysb.pysb2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.pysb.html#amici.importers.pysb.pysb2amici).\n",
8383
"\n",
8484
"Example:\n",
8585
"```bash\n",
@@ -219,7 +219,7 @@
219219
"\n",
220220
"By default, AMICI will try to perform some basic simplification of model expressions. For complex model expressions, or for large models, this can become costly. It very much depends on the model expressions, whether the benefits outweigh the cost.\n",
221221
"\n",
222-
"Simplification of model expressions can be disabled by passing `simplify=None` to [amici.importers.sbml.SbmlImporter.sbml2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.sbml.SbmlImporter.html#amici.importers.sbml.SbmlImporter.sbml2amici) or [amici.importers.pysb.pysb2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.pysb.html?highlight=pysb2amici#amici.importers.pysb.pysb2amici).\n",
222+
"Simplification of model expressions can be disabled by passing `simplify=None` to [amici.importers.sbml.SbmlImporter.sbml2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.sbml.html#amici.importers.sbml.SbmlImporter.sbml2amici) or [amici.importers.pysb.pysb2amici](https://amici.readthedocs.io/en/latest/generated/amici.importers.pysb.html#amici.importers.pysb.pysb2amici).\n",
223223
"\n",
224224
"Depending on the given model, different simplification schemes may be cheaper or more beneficial than the default. SymPy's simplification functions are [well documented](https://docs.sympy.org/latest/modules/simplify/simplify.html)."
225225
]
@@ -477,24 +477,23 @@
477477
"\n",
478478
"### Sensitivities w.r.t. a subset of parameters\n",
479479
"\n",
480-
"If only sensitivities with respect to a subset of model parameters are of interest to you (see also *Fixing parameters* above), you can speed up the simulation by selecting the relevant parameter indices via [amici.Model.setParameterList](https://amici.readthedocs.io/en/latest/generated/amici.amici.Model.html#amici.amici.Model.setParameterList).\n"
480+
"If only sensitivities with respect to a subset of model parameters are of interest to you (see also *Fixing parameters* above), you can speed up the simulation by selecting the relevant parameter indices via [amici.sim.sundials.Model.set_parameter_list](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.Model.set_parameter_list).\n"
481481
]
482482
},
483483
{
484484
"cell_type": "markdown",
485485
"id": "af4bd3d5",
486486
"metadata": {},
487487
"source": [
488-
"\n",
489488
"### Parallel simulation of multiple conditions\n",
490489
"\n",
491-
"Whenever there are multiple independent simulations to perform, you can use [amici.runAmiciSimulations(..., num_threads=...)](https://amici.readthedocs.io/en/latest/generated/amici.amici.html#amici.amici.runAmiciSimulations) instead of [amici.runAmiciSimulations(...)](https://amici.readthedocs.io/en/latest/generated/amici.amici.html#amici.amici.runAmiciSimulation) to run them in parallel. Note that all simulation results have to be kept in memory, which may become problematic for very large numbers of simulations.\n",
490+
"Whenever there are multiple independent simulations to perform, you can use [amici.sim.sundials.run_simulations(..., num_threads=...)](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.run_simulations) instead of `amici.sim.sundials.run_simulations(...)` to run them in parallel. Note that all simulation results have to be kept in memory, which may become problematic for very large numbers of simulations.\n",
492491
"Parallelization is based on OpenMP and does not come with the issues associated with Python's multiprocessing or multithreading (spawning extra processes or limitations related to the global interpreter lock).\n",
493492
"\n",
494493
"### Reporting mode\n",
495494
"\n",
496495
"During model simulation, many quantities are calculated, but not all might be of interest for you. For example, for parameter estimation you might only be interested in the likelihood and gradient. In this case, you can save time and memory using\n",
497-
"[amici.Solver.setReturnDataReportingMode(amici.RDataReporting.likelihood)](https://amici.readthedocs.io/en/latest/generated/amici.amici.Solver.html#amici.amici.Solver.setReturnDataReportingMode)."
496+
"[amici.sim.sundials.Solver.set_return_data_reporting_mode(amici.sim.sundials.RDataReporting.likelihood)](https://amici.readthedocs.io/en/latest/generated/amici.sim.sundials.html#amici.sim.sundials.Solver.set_return_data_reporting_mode)."
498497
]
499498
}
500499
],

doc/examples/example_steady_states/ExampleEquilibrationLogic.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"\n",
5252
"$$\n",
5353
"\\begin{array}{llll}\n",
54-
" \\dot{s} = (\\text{synthesis_substrate} + k_{\\text{create}}) - k_{\\text{bind}}\\cdot s \\cdot e + k_{\\text{unbind}}\\cdot c,\\\\\n",
54+
" \\dot{s} = (\\text{synthesis\\_substrate} + k_{\\text{create}}) - k_{\\text{bind}}\\cdot s \\cdot e + k_{\\text{unbind}}\\cdot c,\\\\\n",
5555
" \\dot{e} = - k_{\\text{bind}}\\cdot s \\cdot e + k_{\\text{unbind}}\\cdot c + k_{\\text{convert}}\\cdot c,\\\\\n",
5656
" \\dot{c} = k_{\\text{bind}}\\cdot s \\cdot e - k_{\\text{unbind}}\\cdot c - k_{\\text{convert}}\\cdot c,\\\\\n",
5757
" \\dot{p} = k_{\\text{convert}}\\cdot c - k_{\\text{decay}}\\cdot p,\n",
@@ -73,7 +73,7 @@
7373
"\n",
7474
"It's easy to see that the first two columns (or the second and the third row) are linearly dependent and the determinant is equal to zero.\n",
7575
"\n",
76-
"If one is able to identify a conserved quantity, the model dimension can be reduced by excluding one of the states. For example, for the model above one can remove the second ODE and redefine $e$ as $\\text{enzyme_total} - c$, where $\\text{enzyme_total}$ is a constant specifying the total concentration of the enzyme. In general, conserved quantities or conserved moieties are functions of state variables of the dynamical system that remain constant over time. They can be automatically removed in the SBML import of AMICI, if an environment variable ``AMICI_EXPERIMENTAL_SBML_NONCONST_CLS`` is set, using a heuristic-based conserved moieties identification approach presented in [De Martino et al. (2014)](https://doi.org/10.1371/journal.pone.0100750).\n",
76+
"If one is able to identify a conserved quantity, the model dimension can be reduced by excluding one of the states. For example, for the model above one can remove the second ODE and redefine $e$ as $\\text{enzyme\\_total} - c$, where $\\text{enzyme\\_total}$ is a constant specifying the total concentration of the enzyme. In general, conserved quantities or conserved moieties are functions of state variables of the dynamical system that remain constant over time. They can be automatically removed in the SBML import of AMICI, if an environment variable ``AMICI_EXPERIMENTAL_SBML_NONCONST_CLS`` is set, using a heuristic-based conserved moieties identification approach presented in [De Martino et al. (2014)](https://doi.org/10.1371/journal.pone.0100750).\n",
7777
"\n",
7878
"In the following, we will consider two versions of this model, with and without eliminating the conserved quantity, to demonstrate the failure of Newton's method for steady-state computation and of two different approaches for sensitivities computation that are not applicable if the Jacobian is singular."
7979
]
@@ -1070,7 +1070,7 @@
10701070
"$$\n",
10711071
"`rtol` and `atol` denote relative and absolute tolerances, respectively.\n",
10721072
"\n",
1073-
"The respective tolerances for equilibrating a system with AMICI can be controlled by the user via the getter/setter functions `[get|set][Absolute|Relative]ToleranceSteadyState[Sensi]`:"
1073+
"The respective tolerances for equilibrating a system with AMICI can be controlled by the user via the getter/setter functions `[get|set]_[absolute|relative]_tolerance_steady_state[_sensi]`:"
10741074
]
10751075
},
10761076
{

include/amici/model_dimensions.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,16 @@ struct ModelDimensions {
131131
*/
132132
std::vector<int> ndJydy;
133133

134-
/** Number of nonzero elements in the \f$ x \f$ derivative of \f$ x_rdata
134+
/** Number of nonzero elements in the \f$ x \f$ derivative of \f$ x\_rdata
135135
* \f$ */
136136
int ndxrdatadxsolver{0};
137137

138-
/** Number of nonzero elements in the \f$ tcl\f$ derivative of \f$ x_rdata
138+
/** Number of nonzero elements in the \f$ tcl\f$ derivative of \f$ x\_rdata
139139
* \f$ */
140140
int ndxrdatadtcl{0};
141141

142-
/** Number of nonzero elements in the \f$ x_rdata\f$ derivative of
143-
* \f$ total_cl \f$ */
142+
/** Number of nonzero elements in the \f$ x\_rdata\f$ derivative of
143+
* \f$ total\_cl \f$ */
144144
int ndtotal_cldx_rdata{0};
145145

146146
/** Number of nonzero entries in Jacobian */

include/amici/solver.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ class Solver {
432432
*
433433
* Steady state simulation tolerances are the product of the simulation
434434
* tolerances and this factor, unless manually set with
435-
* `set(Absolute/Relative)ToleranceSteadyState()`.
435+
* `set_relative_tolerance_steady_state()` /
436+
* `set_absolute_tolerance_steady_state()`.
436437
*
437438
* @return steady state simulation tolerance factor
438439
*/
@@ -443,7 +444,8 @@ class Solver {
443444
*
444445
* Steady state simulation tolerances are the product of the simulation
445446
* tolerances and this factor, unless manually set with
446-
* `set(Absolute/Relative)ToleranceSteadyState()`.
447+
* `set_relative_tolerance_steady_state()` /
448+
* `set_absolute_tolerance_steady_state()`.
447449
*
448450
* @param factor tolerance factor (non-negative number)
449451
*/
@@ -640,17 +642,17 @@ class Solver {
640642
* @brief Gets KLU / SuperLUMT state ordering mode
641643
*
642644
* @return State-ordering as integer according to
643-
* SUNLinSolKLU::StateOrdering or SUNLinSolSuperLUMT::StateOrdering (which
644-
* differ).
645+
* `SUNLinSolKLU::StateOrdering` or `SUNLinSolSuperLUMT::StateOrdering`
646+
* (which differ).
645647
*/
646648
int get_state_ordering() const;
647649

648650
/**
649651
* @brief Sets KLU / SuperLUMT state ordering mode
650652
*
651-
* This only applies when linsol is set to LinearSolver::KLU or
652-
* LinearSolver::SuperLUMT. Mind the difference between
653-
* SUNLinSolKLU::StateOrdering and SUNLinSolSuperLUMT::StateOrdering.
653+
* This only applies when the linear solver is set to `LinearSolver::KLU`
654+
* or `LinearSolver::SuperLUMT`. Mind the difference between
655+
* `SUNLinSolKLU::StateOrdering` and `SUNLinSolSuperLUMT::StateOrdering`.
654656
*
655657
* @param ordering state ordering
656658
*/
@@ -900,21 +902,21 @@ class Solver {
900902
/**
901903
* @brief number of state variables with which the solver was initialized
902904
*
903-
* @return x.getLength()
905+
* @return Number of solver state variables.
904906
*/
905907
int nx() const;
906908

907909
/**
908910
* @brief number of parameters with which the solver was initialized
909911
*
910-
* @return sx.getLength()
912+
* @return Number of parameters w.r.t. which sensitivities are computed.
911913
*/
912914
int nplist() const;
913915

914916
/**
915917
* @brief number of quadratures with which the solver was initialized
916918
*
917-
* @return xQB.getLength()
919+
* @return Number of quadratures with which the solver was initialized.
918920
*/
919921
int nquad() const;
920922

python/sdist/amici/sim/sundials/petab/_v2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def __init__(
5757
:param model: The AMICI model to use.
5858
:param petab_problem: The PEtab problem to use.
5959
This is expected to be the output of
60-
:class:`petab.v2.ExperimentsToSbmlConverter` or an equivalent problem.
60+
:class:`petab.v2.converters.ExperimentsToSbmlConverter` or an
61+
equivalent problem.
6162
This object must not be modified after the creation of this
6263
:class:`ExperimentManager` instance.
6364
"""

swig/solver.i

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ using namespace amici;
5050
%ignore get_num_rhs_evals_b;
5151
%ignore get_num_steps;
5252
%ignore get_num_steps_b;
53-
%ignore gett;
54-
%ignore startTimer;
55-
%ignore switchForwardSensisOff;
56-
%ignore timeExceeded;
53+
%ignore get_t;
54+
%ignore start_timer;
55+
%ignore switch_forward_sensis_off;
56+
%ignore time_exceeded;
5757
%ignore getSunContext;
5858
%ignore get_adjoint_state;
5959
%ignore get_adjoint_derivative_state;

0 commit comments

Comments
 (0)