diff --git a/doc/implementation_discontinuities.rst b/doc/implementation_discontinuities.rst index 45e2d78aba..cbe91cdce5 100644 --- a/doc/implementation_discontinuities.rst +++ b/doc/implementation_discontinuities.rst @@ -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. diff --git a/include/amici/model.h b/include/amici/model.h index f63ead2004..b7e8e86a80 100644 --- a/include/amici/model.h +++ b/include/amici/model.h @@ -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 */ diff --git a/python/sdist/amici/importers/petab/_petab_importer.py b/python/sdist/amici/importers/petab/_petab_importer.py index 5013747b36..17c022766f 100644 --- a/python/sdist/amici/importers/petab/_petab_importer.py +++ b/python/sdist/amici/importers/petab/_petab_importer.py @@ -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: @@ -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: diff --git a/python/sdist/amici/importers/pysb/__init__.py b/python/sdist/amici/importers/pysb/__init__.py index ee248e51c8..ad09e75e73 100644 --- a/python/sdist/amici/importers/pysb/__init__.py +++ b/python/sdist/amici/importers/pysb/__init__.py @@ -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: @@ -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 @@ -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 @@ -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` @@ -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 @@ -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: diff --git a/python/sdist/amici/importers/utils.py b/python/sdist/amici/importers/utils.py index ef9c96e4c7..b813c0539e 100644 --- a/python/sdist/amici/importers/utils.py +++ b/python/sdist/amici/importers/utils.py @@ -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. diff --git a/python/sdist/amici/sim/sundials/_debugging.py b/python/sdist/amici/sim/sundials/_debugging.py index d70e437c6c..f7b2c04e9f 100644 --- a/python/sdist/amici/sim/sundials/_debugging.py +++ b/python/sdist/amici/sim/sundials/_debugging.py @@ -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 ` to a timepoints after the last trigger + :meth:`t0 ` to a timepoints after the last trigger timepoint. :param model: diff --git a/python/sdist/amici/sim/sundials/_swig_wrappers.py b/python/sdist/amici/sim/sundials/_swig_wrappers.py index 3fa9511ea4..564f05b5e0 100644 --- a/python/sdist/amici/sim/sundials/_swig_wrappers.py +++ b/python/sdist/amici/sim/sundials/_swig_wrappers.py @@ -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 @@ -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 """ diff --git a/python/sdist/amici/sim/sundials/petab/_v2.py b/python/sdist/amici/sim/sundials/petab/_v2.py index 8dab948825..6c6d61754d 100644 --- a/python/sdist/amici/sim/sundials/petab/_v2.py +++ b/python/sdist/amici/sim/sundials/petab/_v2.py @@ -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 @@ -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 diff --git a/python/sdist/amici/sim/sundials/petab/v1/_conditions.py b/python/sdist/amici/sim/sundials/petab/v1/_conditions.py index 6d29528c71..15fa640143 100644 --- a/python/sdist/amici/sim/sundials/petab/v1/_conditions.py +++ b/python/sdist/amici/sim/sundials/petab/v1/_conditions.py @@ -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``. @@ -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 diff --git a/python/sdist/amici/sim/sundials/petab/v1/_simulations.py b/python/sdist/amici/sim/sundials/petab/v1/_simulations.py index e2d19a925b..d054851f78 100644 --- a/python/sdist/amici/sim/sundials/petab/v1/_simulations.py +++ b/python/sdist/amici/sim/sundials/petab/v1/_simulations.py @@ -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. @@ -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). @@ -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) @@ -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``. diff --git a/python/sdist/amici/sim/sundials/petab/v1/_simulator.py b/python/sdist/amici/sim/sundials/petab/v1/_simulator.py index d92dfdcc77..7249789c17 100644 --- a/python/sdist/amici/sim/sundials/petab/v1/_simulator.py +++ b/python/sdist/amici/sim/sundials/petab/v1/_simulator.py @@ -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). diff --git a/python/sdist/amici/sim/sundials/plotting.py b/python/sdist/amici/sim/sundials/plotting.py index b8ea14fdb9..5e3eea37d1 100644 --- a/python/sdist/amici/sim/sundials/plotting.py +++ b/python/sdist/amici/sim/sundials/plotting.py @@ -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: @@ -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: diff --git a/swig/amici.i b/swig/amici.i index 84d900a126..cadd5efa44 100644 --- a/swig/amici.i +++ b/swig/amici.i @@ -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 parameter_scaling_from_int_vector(std::vector const& int_vec) { diff --git a/swig/model.i b/swig/model.i index e37cf5968d..6d7bb3a196 100644 --- a/swig/model.i +++ b/swig/model.i @@ -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. diff --git a/tests/sbml/utils.py b/tests/sbml/utils.py index 7457673bd5..84ff363048 100644 --- a/tests/sbml/utils.py +++ b/tests/sbml/utils.py @@ -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 @@ -12,10 +12,10 @@ def verify_results( settings, - rdata: amici.ReturnData, + rdata: asd.ReturnData, expected, wrapper, - model: amici.Model, + model: asd.Model, atol, rtol, ): @@ -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