Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/implementation_discontinuities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ Solution Jump Discontinuities

SUNDIALS by itself does not support solution jump discontinuities. We
implement support by accessing private SUNDIALS API in
:cpp:func:`amici::Solver::resetState`,
:cpp:func:`amici::Solver::reInitPostProcess` and
:cpp:func:`amici::Solver::reInitPostProcessB`. These functions reset interval
:cpp:func:`amici::Solver::reset_tate`,
:cpp:func:`amici::Solver::reinit_post_process` and
:cpp:func:`amici::Solver::reinit_post_process_b`. These functions reset interval
variables to initial values to simulate a fresh integration start, but
keep/update the solution history, which is important for adjoint solutions.

Expand Down
4 changes: 2 additions & 2 deletions include/amici/model.h
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,8 @@ class Model : public AbstractModel, public ModelDimensions {
/**
* @brief Sets the estimated lower boundary for sigma_y.
*
* When :meth:`setAddSigmaResiduals` is activated, this lower boundary must
* ensure that log(sigma) + min_sigma > 0.
* When :meth:`set_add_sigma_residuals` is activated, this lower boundary
* must ensure that log(sigma) + min_sigma > 0.
*
* @param min_sigma lower boundary
*/
Expand Down
4 changes: 2 additions & 2 deletions python/sdist/amici/importers/petab/_petab_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def rdatas_to_measurement_df(
``rdatas`` and own information.

:param rdatas:
A sequence of :class:`amici.ReturnData`.
A sequence of :class:`amici.sim.sundials.ReturnData`.
:param model:
AMICI model used to generate ``rdatas``.
:param petab_problem:
Expand Down Expand Up @@ -693,7 +693,7 @@ def rdatas_to_simulation_df(
``rdatas`` and own information.

:param rdatas:
A sequence of :class:`amici.ReturnData`.
A sequence of :class:`amici.sim.sundials.ReturnData`.
:param model:
AMICI model used to generate ``rdatas``.
:param petab_problem:
Expand Down
40 changes: 21 additions & 19 deletions python/sdist/amici/importers/pysb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def pysb2jax(
simulations.

:param model:
pysb model, :attr:`pysb.Model.name` will determine the name of the
pysb model, :attr:`pysb.core.Model.name` will determine the name of the
generated module

:param output_dir:
Expand All @@ -98,12 +98,12 @@ def pysb2jax(
:param observation_model:
The different measurement channels that make up the observation
model, see also :class:`amici.importers.utils.MeasurementChannel`.
The ID is expected to be the name of a :class:`pysb.Expression` or
:class:`pysb.Observable` in the provided model that should be mapped to
an observable.
``sigma`` is expected to be the name of a :class:`pysb.Expression` to
be mapped to the scale parameter of the noise distribution.
``MeasurementChannel.formula`` is expected to be
The ID is expected to be the name of a :class:`pysb.core.Expression` or
:class:`pysb.core.Observable` in the provided model that should be
mapped to an observable.
``sigma`` is expected to be the name of a :class:`pysb.core.Expression`
to be mapped to the scale parameter of the noise distribution.
:attr:`MeasurementChannel.formula` is expected to be
``None``. Event-observables are not supported.

:param verbose: verbosity level for logging, True/False default to
Expand All @@ -124,11 +124,12 @@ def pysb2jax(
https://github.com/AMICI-dev/AMICI/pull/1672

:param model_name:
Name for the generated model module. If None, :attr:`pysb.Model.name`
will be used.
Name for the generated model module.
If None, :attr:`pysb.core.Model.name` will be used.

:param pysb_model_has_obs_and_noise:
if set to ``True``, the pysb model is expected to have extra observables and noise variables added
If set to ``True``, the pysb model is expected to have extra
observables and noise variables added.
"""
model_name = model_name or model.name

Expand Down Expand Up @@ -199,15 +200,16 @@ def pysb2amici(
The different measurement channels that make up the observation
model, see also :class:`amici.importers.utils.MeasurementChannel`.
The ID is expected to be the name of a :class:`pysb.core.Expression` or
:class:`pysb.Observable` in the provided model that should be mapped to
an observable.
``sigma`` is expected to be the name of a :class:`pysb.Expression` to
be mapped to the scale parameter of the noise distribution.
``MeasurementChannel.formula`` is expected to be
:class:`pysb.core.Observable` in the provided model that should be
mapped to an observable.
``sigma`` is expected to be the name of a :class:`pysb.core.Expression`
to be mapped to the scale parameter of the noise distribution.
:attr:`MeasurementChannel.formula` is expected to be
``None``. Event-observables are not supported.

:param fixed_parameters:
list of :class:`pysb.core.Parameter` to be excluded from sensitivity analysis
list of :class:`pysb.core.Parameter` to be excluded from sensitivity
analysis.

:param verbose: verbosity level for logging, True/False default to
:attr:`logging.DEBUG`/:attr:`logging.ERROR`
Expand Down Expand Up @@ -244,8 +246,8 @@ def pysb2amici(
generated

:param model_name:
Name for the generated model module. If None, :attr:`pysb.Model.name`
will be used.
Name for the generated model module.
If None, :attr:`pysb.core.Model.name` will be used.

:param pysb_model_has_obs_and_noise:
if set to ``True``, the pysb model is expected to have extra
Expand Down Expand Up @@ -323,7 +325,7 @@ def ode_model_from_pysb_importer(
_events: list[Event] = None,
) -> DEModel:
"""
Creates an :class:`amici.DEModel` instance from a :class:`pysb.Model`
Creates an :class:`DEModel` instance from a :class:`pysb.core.Model`
instance.

:param model:
Expand Down
2 changes: 1 addition & 1 deletion python/sdist/amici/importers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def __init__(
Expression representing the scale parameter of the noise
distribution. This can be a numeric value, a sympy expression,
or an expression string that will be passed to
:func:`sympy.sympify`.
:func:`sympy.core.sympify.sympify`.
:param event_id:
Identifier of the associated event for event-resolved observables.
`None` for time-resolved observables.
Expand Down
2 changes: 1 addition & 1 deletion python/sdist/amici/sim/sundials/_debugging.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def get_model_for_preeq(
During preequilibration, event-handling is disabled. However, when
simulating the returned model, event-handling will be enabled.
For events triggered at fixed timepoints, this can be avoided by setting
:meth:`t0 <amici.Model.setT0>` to a timepoints after the last trigger
:meth:`t0 <amici.Model.set_t0>` to a timepoints after the last trigger
timepoint.

:param model:
Expand Down
7 changes: 3 additions & 4 deletions python/sdist/amici/sim/sundials/_swig_wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def read_solver_settings_from_hdf5(
file: str, solver: AmiciSolver, location: str | None = "solverSettings"
) -> None:
"""
Convenience wrapper for :py:func:`amici.read_solver_settings_from_hdf5`
Apply solver settings from an HDF5 file to a Solver instance.

:param file: hdf5 filename
:param solver: Solver instance to which settings will be transferred
Expand All @@ -154,10 +154,9 @@ def write_solver_settings_to_hdf5(
location: str | None = "solverSettings",
) -> None:
"""
Convenience wrapper for :py:func:`amici.amici.writeSolverSettingsToHDF5`
Write solver settings from a Solver instance to an HDF5 file.

:param file: hdf5 filename, can also be an object created by
:py:func:`amici.amici.createOrOpenForWriting`
:param file: hdf5 filename
:param solver: Solver instance from which settings will be stored
:param location: location of solver settings in hdf5 file
"""
Expand Down
3 changes: 1 addition & 2 deletions python/sdist/amici/sim/sundials/petab/_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import numpy as np
import sympy as sp
from petab import v1 as v1
from petab import v2 as v2
from petab.v2 import ExperimentPeriod

Expand Down Expand Up @@ -41,7 +40,7 @@ class ExperimentManager:
Handles the creation of :class:`ExpData` objects for a given model and
PEtab problem.

The assumption is that we have a set of :class:`amici.ExpData` objects,
The assumption is that we have a set of :class:`ExpData` objects,
one for each PEtab experiment.
Those are updated based on a set of global parameters (PEtab
problem parameters, as opposed to model parameters for a single experiment
Expand Down
7 changes: 4 additions & 3 deletions python/sdist/amici/sim/sundials/petab/v1/_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def create_parameterized_edatas(
simulation_conditions: pd.DataFrame | dict = None,
warn_unused: bool = True,
) -> list[ExpData]:
"""Create list of :class:ExpData objects with parameters filled in.
"""Create list of :class:`ExpData` objects with parameters filled in.

:param amici_model:
AMICI Model assumed to be compatible with ``petab_problem``.
Expand All @@ -258,9 +258,10 @@ def create_parameterized_edatas(
If ``False``, they are assumed to be in linear scale.
:param parameter_mapping:
Optional precomputed PEtab parameter mapping for efficiency, as
generated by :func:`create_parameter_mapping`.
generated by
:func:`amici.sim.sundials.petab.v1.create_parameter_mapping`.
:param simulation_conditions:
Result of :func:`petab.get_simulation_conditions`. Can be provided to
Result of :func:`petab.v1.get_simulation_conditions`. Can be provided to
save time if this has been obtained before.
:param warn_unused:
Whether a warning should be emitted if not all problem parameters
Expand Down
14 changes: 7 additions & 7 deletions python/sdist/amici/sim/sundials/petab/v1/_simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ def simulate_petab(
``nominalValues`` will be used. To be provided as dict, mapping PEtab
problem parameters to SBML IDs.
:param simulation_conditions:
Result of :py:func:`petab.get_simulation_conditions`. Can be provided
to save time if this has be obtained before.
Result of :py:func:`petab.v1.get_simulation_conditions`.
Can be provided to save time if this has be obtained before.
Not required if ``edatas`` and ``parameter_mapping`` are provided.
:param edatas:
Experimental data. Parameters are inserted in-place for simulation.
Expand All @@ -113,7 +113,7 @@ def simulate_petab(
If `parameter_mapping` is provided, this must match the value of
`scaled_parameters` used to generate the mapping.
:param log_level:
Log level, see :mod:`amici.logging` module.
Log level, see :mod:`logging` module.
:param num_threads:
Number of threads to use for simulating multiple conditions
(only used if compiled with OpenMP).
Expand All @@ -128,12 +128,12 @@ def simulate_petab(
Dictionary of

* cost function value (``LLH``),
* list of :class:`amici.amici.ReturnData` (``RDATAS``),
* list of :class:`amici.amici.ExpData` (``EDATAS``),
* list of :class:`ReturnData` (``RDATAS``),
* list of :class:`ExpData` (``EDATAS``),

corresponding to the different simulation conditions.
For ordering of simulation conditions, see
:meth:`petab.Problem.get_simulation_conditions_from_measurement_df`.
:meth:`petab.v1.Problem.get_simulation_conditions_from_measurement_df`.
"""
logger.setLevel(log_level)

Expand Down Expand Up @@ -418,7 +418,7 @@ def rdatas_to_measurement_df(

:param rdatas:
A sequence of rdatas with the ordering of
:func:`petab.get_simulation_conditions`.
:func:`petab.v1.get_simulation_conditions`.

:param model:
AMICI model used to generate ``rdatas``.
Expand Down
4 changes: 2 additions & 2 deletions python/sdist/amici/sim/sundials/petab/v1/_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def simulate_without_noise(self, **kwargs) -> pd.DataFrame:
Additional keyword arguments can be supplied to specify arguments for
the AMICI PEtab import, simulate, and export methods. See the
docstrings for the respective methods for argument options:
- :py:func:`amici.petab_import.import_petab_problem`, and
- :py:func:`amici.petab_objective.simulate_petab`.
- :py:func:`import_petab_problem`, and
- :py:func:`simulate_petab`.

Note that some arguments are expected to have already been specified
in the Simulator constructor (including the PEtab problem).
Expand Down
4 changes: 2 additions & 2 deletions python/sdist/amici/sim/sundials/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def plot_state_trajectories(
:param state_indices:
Indices of state variables for which trajectories are to be plotted.
:param ax:
:class:`matplotlib.pyplot.Axes` instance to plot into.
:class:`matplotlib.axes.Axes` instance to plot into.
:param model:
The model *rdata* was generated from.
:param prefer_names:
Expand Down Expand Up @@ -103,7 +103,7 @@ def plot_observable_trajectories(
:param observable_indices:
Indices of observables for which trajectories are to be plotted.
:param ax:
:class:`matplotlib.pyplot.Axes` instance to plot into.
:class:`matplotlib.axes.Axes` instance to plot into.
:param model:
The model *rdata* was generated from.
:param prefer_names:
Expand Down
2 changes: 1 addition & 1 deletion swig/amici.i
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def __repr__(self):
"Swig-Generated class, which, in contrast to other Vector
classes, does not allow for simple interoperability with common
Python types, but must be created using
:func:`amici.amici.parameter_scaling_from_int_vector`";
:func:`parameter_scaling_from_int_vector`";
%{
namespace amici {
std::vector<amici::ParameterScaling> parameter_scaling_from_int_vector(std::vector<int> const& int_vec) {
Expand Down
2 changes: 1 addition & 1 deletion swig/model.i
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def simulate(
"""Simulate model with given solver and experimental data.

:param solver:
Solver to use for simulation. Defaults to :meth:`Model.get_solver`.
Solver to use for simulation. Defaults to :meth:`Model.create_solver`.
:param edata:
Experimental data to use for simulation.
A single :class:`ExpData` instance or a sequence of such instances.
Expand Down
8 changes: 4 additions & 4 deletions tests/sbml/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pathlib import Path

import amici
import amici.sim.sundials as asd
import libsbml as sbml
import numpy as np
import pandas as pd
Expand All @@ -12,10 +12,10 @@

def verify_results(
settings,
rdata: amici.ReturnData,
rdata: asd.ReturnData,
expected,
wrapper,
model: amici.Model,
model: asd.Model,
atol,
rtol,
):
Expand Down Expand Up @@ -201,7 +201,7 @@ def get_amount_and_variables(settings):


def apply_settings(
settings, solver: amici.Solver, model: amici.Model, test_id: str
settings, solver: asd.Solver, model: asd.Model, test_id: str
):
"""Apply model and solver settings as specified in the test case"""
# start/duration/steps may be empty
Expand Down
Loading