Source code for amici._installation.amici

"""

Core C++ bindings

This module encompasses the complete public C++ API of AMICI, which was
exposed via swig. All functions listed here are directly accessible in the
main amici package, i.e., :py:class:`amici.amici.ExpData` is available as
``amici.ExpData``.
Usage of functions and classes from the base ``amici`` package is
generally recommended as they often include convenience wrappers that avoid
common pitfalls when accessing C++ types from python and implement some
nonstandard type conversions.

"""
from __future__ import annotations
import sys
import os
if sys.platform == 'win32' and (dll_dirs := os.environ.get('AMICI_DLL_DIRS')):
    for dll_dir in dll_dirs.split(os.pathsep):
        os.add_dll_directory(dll_dir)
from pathlib import Path
_amici_dir = Path(__file__).parent.absolute()
_lib_dir = str(_amici_dir / 'lib')
if sys.platform == 'win32':
    os.add_dll_directory(_lib_dir)
from typing import TYPE_CHECKING, Iterable, Union, overload
from collections.abc import Sequence
import numpy as np
if TYPE_CHECKING:
    import numpy
    from amici.sim.sundials import ReturnDataView
import typing
if getattr(globals().get('__spec__'), 'parent', None) or __package__ or '.' in __name__:
    from . import _amici
else:
    import _amici
import builtins as __builtin__

def _swig_repr(self):
    try:
        strthis = 'proxy of ' + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ''
    return '<%s.%s; %s >' % (self.__class__.__module__, self.__class__.__name__, strthis)

def _swig_setattr_nondynamic_instance_variable(set):

    def set_instance_attr(self, name, value):
        if name == 'this':
            set(self, name, value)
        elif name == 'thisown':
            self.this.own(value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError('You cannot add instance attributes to %s' % self)
    return set_instance_attr

def _swig_setattr_nondynamic_class_variable(set):

    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and (not isinstance(getattr(cls, name), property)):
            set(cls, name, value)
        else:
            raise AttributeError('You cannot add class attributes to %s' % cls)
    return set_class_attr

class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
SWIG_VERSION_MAJOR = _amici.SWIG_VERSION_MAJOR
SWIG_VERSION_MINOR = _amici.SWIG_VERSION_MINOR
SWIG_VERSION_PATCH = _amici.SWIG_VERSION_PATCH
_SWIG_VERSION = (SWIG_VERSION_MAJOR, SWIG_VERSION_MINOR, SWIG_VERSION_PATCH)

class SwigPyIterator(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')

    def __init__(self, *args, **kwargs):
        raise AttributeError('No constructor defined - class is abstract')
    __repr__ = _swig_repr
    __swig_destroy__ = _amici.delete_SwigPyIterator

    def value(self):
        return _amici.SwigPyIterator_value(self)

    def incr(self, n=1):
        return _amici.SwigPyIterator_incr(self, n)

    def decr(self, n=1):
        return _amici.SwigPyIterator_decr(self, n)

    def distance(self, x):
        return _amici.SwigPyIterator_distance(self, x)

    def equal(self, x):
        return _amici.SwigPyIterator_equal(self, x)

    def copy(self):
        return _amici.SwigPyIterator_copy(self)

    def __next__(self):
        return _amici.SwigPyIterator___next__(self)

    def previous(self):
        return _amici.SwigPyIterator_previous(self)

    def advance(self, n):
        return _amici.SwigPyIterator_advance(self, n)

    def __eq__(self, x):
        return _amici.SwigPyIterator___eq__(self, x)

    def __ne__(self, x):
        return _amici.SwigPyIterator___ne__(self, x)

    def __iadd__(self, n):
        return _amici.SwigPyIterator___iadd__(self, n)

    def __isub__(self, n):
        return _amici.SwigPyIterator___isub__(self, n)

    def __add__(self, n):
        return _amici.SwigPyIterator___add__(self, n)

    def __sub__(self, *args):
        return _amici.SwigPyIterator___sub__(self, *args)

    def __iter__(self):
        return self
_amici.SwigPyIterator_swigregister(SwigPyIterator)

[docs] class DoubleVector(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def iterator(self): return _amici.DoubleVector_iterator(self) def __iter__(self): return self.iterator() def __bool__(self): return _amici.DoubleVector___bool__(self) def __len__(self): return _amici.DoubleVector___len__(self) def __delitem__(self, *args): return _amici.DoubleVector___delitem__(self, *args) def __getitem__(self, *args): return _amici.DoubleVector___getitem__(self, *args) def __setitem__(self, *args): return _amici.DoubleVector___setitem__(self, *args) def pop(self): return _amici.DoubleVector_pop(self) def append(self, x): return _amici.DoubleVector_append(self, x) def empty(self): return _amici.DoubleVector_empty(self) def size(self): return _amici.DoubleVector_size(self) def swap(self, v): return _amici.DoubleVector_swap(self, v) def begin(self): return _amici.DoubleVector_begin(self) def end(self): return _amici.DoubleVector_end(self) def rbegin(self): return _amici.DoubleVector_rbegin(self) def rend(self): return _amici.DoubleVector_rend(self) def clear(self): return _amici.DoubleVector_clear(self) def get_allocator(self): return _amici.DoubleVector_get_allocator(self) def pop_back(self): return _amici.DoubleVector_pop_back(self) def erase(self, *args): return _amici.DoubleVector_erase(self, *args) def __init__(self, *args): _amici.DoubleVector_swiginit(self, _amici.new_DoubleVector(*args)) def push_back(self, x): return _amici.DoubleVector_push_back(self, x) def front(self): return _amici.DoubleVector_front(self) def back(self): return _amici.DoubleVector_back(self) def assign(self, n, x): return _amici.DoubleVector_assign(self, n, x) def resize(self, *args): return _amici.DoubleVector_resize(self, *args) def insert(self, *args): return _amici.DoubleVector_insert(self, *args) def reserve(self, n): return _amici.DoubleVector_reserve(self, n) def capacity(self): return _amici.DoubleVector_capacity(self) def _to_ndarray(self): """Copy the data into a new 1D float64 numpy array.""" return _amici.DoubleVector__to_ndarray(self) def __array__(self, dtype=None, copy=None): """Copy the vector into a new :class:`numpy.ndarray`.""" if copy is False: raise ValueError(f'Unable to avoid copy while creating an array as requested: the data of a {type(self).__name__} is always copied.') arr = self._to_ndarray() return arr if dtype is None else arr.astype(dtype, copy=False) def __repr__(self): return self.this.__repr__()[:-1] + '; ' + repr(np.asarray(self, dtype=np.float64)) + ' >' __swig_destroy__ = _amici.delete_DoubleVector
_amici.DoubleVector_swigregister(DoubleVector)
[docs] class IntVector(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def iterator(self): return _amici.IntVector_iterator(self) def __iter__(self): return self.iterator() def __bool__(self): return _amici.IntVector___bool__(self) def __len__(self): return _amici.IntVector___len__(self) def __delitem__(self, *args): return _amici.IntVector___delitem__(self, *args) def __getitem__(self, *args): return _amici.IntVector___getitem__(self, *args) def __setitem__(self, *args): return _amici.IntVector___setitem__(self, *args) def pop(self): return _amici.IntVector_pop(self) def append(self, x): return _amici.IntVector_append(self, x) def empty(self): return _amici.IntVector_empty(self) def size(self): return _amici.IntVector_size(self) def swap(self, v): return _amici.IntVector_swap(self, v) def begin(self): return _amici.IntVector_begin(self) def end(self): return _amici.IntVector_end(self) def rbegin(self): return _amici.IntVector_rbegin(self) def rend(self): return _amici.IntVector_rend(self) def clear(self): return _amici.IntVector_clear(self) def get_allocator(self): return _amici.IntVector_get_allocator(self) def pop_back(self): return _amici.IntVector_pop_back(self) def erase(self, *args): return _amici.IntVector_erase(self, *args) def __init__(self, *args): _amici.IntVector_swiginit(self, _amici.new_IntVector(*args)) def push_back(self, x): return _amici.IntVector_push_back(self, x) def front(self): return _amici.IntVector_front(self) def back(self): return _amici.IntVector_back(self) def assign(self, n, x): return _amici.IntVector_assign(self, n, x) def resize(self, *args): return _amici.IntVector_resize(self, *args) def insert(self, *args): return _amici.IntVector_insert(self, *args) def reserve(self, n): return _amici.IntVector_reserve(self, n) def capacity(self): return _amici.IntVector_capacity(self) def _to_ndarray(self): """Copy the data into a new 1D int64 numpy array.""" return _amici.IntVector__to_ndarray(self) def __array__(self, dtype=None, copy=None): """Copy the vector into a new :class:`numpy.ndarray`.""" if copy is False: raise ValueError(f'Unable to avoid copy while creating an array as requested: the data of a {type(self).__name__} is always copied.') arr = self._to_ndarray() return arr if dtype is None else arr.astype(dtype, copy=False) def __repr__(self): return self.this.__repr__()[:-1] + '; ' + repr(np.asarray(self, dtype=np.int64)) + ' >' __swig_destroy__ = _amici.delete_IntVector
_amici.IntVector_swigregister(IntVector)
[docs] class BoolVector(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def iterator(self): return _amici.BoolVector_iterator(self) def __iter__(self): return self.iterator() def __bool__(self): return _amici.BoolVector___bool__(self) def __len__(self): return _amici.BoolVector___len__(self) def __delitem__(self, *args): return _amici.BoolVector___delitem__(self, *args) def __getitem__(self, *args): return _amici.BoolVector___getitem__(self, *args) def __setitem__(self, *args): return _amici.BoolVector___setitem__(self, *args) def pop(self): return _amici.BoolVector_pop(self) def append(self, x): return _amici.BoolVector_append(self, x) def empty(self): return _amici.BoolVector_empty(self) def size(self): return _amici.BoolVector_size(self) def swap(self, v): return _amici.BoolVector_swap(self, v) def begin(self): return _amici.BoolVector_begin(self) def end(self): return _amici.BoolVector_end(self) def rbegin(self): return _amici.BoolVector_rbegin(self) def rend(self): return _amici.BoolVector_rend(self) def clear(self): return _amici.BoolVector_clear(self) def get_allocator(self): return _amici.BoolVector_get_allocator(self) def pop_back(self): return _amici.BoolVector_pop_back(self) def erase(self, *args): return _amici.BoolVector_erase(self, *args) def __init__(self, *args): _amici.BoolVector_swiginit(self, _amici.new_BoolVector(*args)) def push_back(self, x): return _amici.BoolVector_push_back(self, x) def front(self): return _amici.BoolVector_front(self) def back(self): return _amici.BoolVector_back(self) def assign(self, n, x): return _amici.BoolVector_assign(self, n, x) def resize(self, *args): return _amici.BoolVector_resize(self, *args) def insert(self, *args): return _amici.BoolVector_insert(self, *args) def reserve(self, n): return _amici.BoolVector_reserve(self, n) def capacity(self): return _amici.BoolVector_capacity(self) def __repr__(self): return self.this.__repr__()[:-1] + '; ' + repr(np.asarray(self, dtype=np.bool_)) + ' >' __swig_destroy__ = _amici.delete_BoolVector
_amici.BoolVector_swigregister(BoolVector)
[docs] class StringVector(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def iterator(self): return _amici.StringVector_iterator(self) def __iter__(self): return self.iterator() def __bool__(self): return _amici.StringVector___bool__(self) def __len__(self): return _amici.StringVector___len__(self) def __delitem__(self, *args): return _amici.StringVector___delitem__(self, *args) def __getitem__(self, *args): return _amici.StringVector___getitem__(self, *args) def __setitem__(self, *args): return _amici.StringVector___setitem__(self, *args) def pop(self): return _amici.StringVector_pop(self) def append(self, x): return _amici.StringVector_append(self, x) def empty(self): return _amici.StringVector_empty(self) def size(self): return _amici.StringVector_size(self) def swap(self, v): return _amici.StringVector_swap(self, v) def begin(self): return _amici.StringVector_begin(self) def end(self): return _amici.StringVector_end(self) def rbegin(self): return _amici.StringVector_rbegin(self) def rend(self): return _amici.StringVector_rend(self) def clear(self): return _amici.StringVector_clear(self) def get_allocator(self): return _amici.StringVector_get_allocator(self) def pop_back(self): return _amici.StringVector_pop_back(self) def erase(self, *args): return _amici.StringVector_erase(self, *args) def __init__(self, *args): _amici.StringVector_swiginit(self, _amici.new_StringVector(*args)) def push_back(self, x): return _amici.StringVector_push_back(self, x) def front(self): return _amici.StringVector_front(self) def back(self): return _amici.StringVector_back(self) def assign(self, n, x): return _amici.StringVector_assign(self, n, x) def resize(self, *args): return _amici.StringVector_resize(self, *args) def insert(self, *args): return _amici.StringVector_insert(self, *args) def reserve(self, n): return _amici.StringVector_reserve(self, n) def capacity(self): return _amici.StringVector_capacity(self) __swig_destroy__ = _amici.delete_StringVector
_amici.StringVector_swigregister(StringVector)
[docs] class StringDoubleMap(object): """ Swig-Generated class templating :class:`Dict` [:class:`str`, :class:`float`] to facilitate interfacing with C++ bindings. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def iterator(self): return _amici.StringDoubleMap_iterator(self) def __iter__(self): return self.iterator() def __bool__(self): return _amici.StringDoubleMap___bool__(self) def __len__(self): return _amici.StringDoubleMap___len__(self) def __iter__(self): return self.key_iterator() def iterkeys(self): return self.key_iterator() def itervalues(self): return self.value_iterator() def iteritems(self): return self.iterator() def __getitem__(self, key): return _amici.StringDoubleMap___getitem__(self, key) def __delitem__(self, key): return _amici.StringDoubleMap___delitem__(self, key) def has_key(self, key): return _amici.StringDoubleMap_has_key(self, key) def keys(self): return _amici.StringDoubleMap_keys(self) def values(self): return _amici.StringDoubleMap_values(self) def items(self): return _amici.StringDoubleMap_items(self) def __contains__(self, key): return _amici.StringDoubleMap___contains__(self, key) def key_iterator(self): return _amici.StringDoubleMap_key_iterator(self) def value_iterator(self): return _amici.StringDoubleMap_value_iterator(self) def __setitem__(self, *args): return _amici.StringDoubleMap___setitem__(self, *args) def asdict(self): return _amici.StringDoubleMap_asdict(self) def __init__(self, *args): _amici.StringDoubleMap_swiginit(self, _amici.new_StringDoubleMap(*args)) def empty(self): return _amici.StringDoubleMap_empty(self) def size(self): return _amici.StringDoubleMap_size(self) def swap(self, v): return _amici.StringDoubleMap_swap(self, v) def begin(self): return _amici.StringDoubleMap_begin(self) def end(self): return _amici.StringDoubleMap_end(self) def rbegin(self): return _amici.StringDoubleMap_rbegin(self) def rend(self): return _amici.StringDoubleMap_rend(self) def clear(self): return _amici.StringDoubleMap_clear(self) def get_allocator(self): return _amici.StringDoubleMap_get_allocator(self) def count(self, x): return _amici.StringDoubleMap_count(self, x) def erase(self, *args): return _amici.StringDoubleMap_erase(self, *args) def find(self, x): return _amici.StringDoubleMap_find(self, x) def lower_bound(self, x): return _amici.StringDoubleMap_lower_bound(self, x) def upper_bound(self, x): return _amici.StringDoubleMap_upper_bound(self, x) def __repr__(self): return self.this.__repr__()[:-1] + '; ' + repr(dict(self)) + ' >' __swig_destroy__ = _amici.delete_StringDoubleMap
_amici.StringDoubleMap_swigregister(StringDoubleMap) def stdVec2ndarray(*args): """ *Overload 1:* Convert 1D array to *non-owning* numpy ndarray. :type vec: DoubleVector :param vec: :type dim1: int :param dim1: :rtype: PyObject :return: | *Overload 2:* Convert row-major flattened 2D array to *non-owning* numpy ndarray. :type vec: DoubleVector :param vec: :type dim1: int :param dim1: :type dim2: int :param dim2: :rtype: PyObject :return: | *Overload 3:* Convert row-major flattened 3D array to *non-owning* numpy ndarray. :type vec: DoubleVector :param vec: :type dim1: int :param dim1: :type dim2: int :param dim2: :type dim3: int :param dim3: :rtype: PyObject :return: | *Overload 4:* Convert row-major flattened 2D array to *non-owning* numpy ndarray. :type vec: DoubleVector :param vec: :type dim1: int :param dim1: :type dim2: int :param dim2: :type dim3: int :param dim3: :type dim4: int :param dim4: :rtype: PyObject :return: | *Overload 5:* Convert 1D array to *non-owning* numpy ndarray. :type vec: IntVector :param vec: :type dim1: int :param dim1: :rtype: PyObject :return: | *Overload 6:* Convert row-major flattened 2D array to *non-owning* numpy ndarray. :type vec: IntVector :param vec: :type dim1: int :param dim1: :type dim2: int :param dim2: :rtype: PyObject :return: | *Overload 7:* Convert row-major flattened 3D array to *non-owning* numpy ndarray. :type vec: IntVector :param vec: :type dim1: int :param dim1: :type dim2: int :param dim2: :type dim3: int :param dim3: :rtype: PyObject :return: | *Overload 8:* Convert row-major flattened 2D array to *non-owning* numpy ndarray. :type vec: IntVector :param vec: :type dim1: int :param dim1: :type dim2: int :param dim2: :type dim3: int :param dim3: :type dim4: int :param dim4: :rtype: PyObject :return: """ return _amici.stdVec2ndarray(*args)
[docs] class SolverPtr(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): _amici.SolverPtr_swiginit(self, _amici.new_SolverPtr(*args)) def __deref__(self): return _amici.SolverPtr___deref__(self) def release(self): return _amici.SolverPtr_release(self) def reset(self, *args): return _amici.SolverPtr_reset(self, *args) def swap(self, __u): return _amici.SolverPtr_swap(self, __u) def get(self): return _amici.SolverPtr_get(self) def __bool__(self): return _amici.SolverPtr___bool__(self) __swig_destroy__ = _amici.delete_SolverPtr def __repr__(self): return _solver_repr(self) def __deepcopy__(self, memo): return self.clone() def __reduce__(self): return _solver_reduce(self) def clone(self) -> Solver: """ Clone this instance :return: The clone """ return _amici.SolverPtr_clone(self) def get_class_name(self) -> str: """ Get the name of this class. :return: Class name. """ return _amici.SolverPtr_get_class_name(self) def get_sensitivity_method(self) -> SensitivityMethod: """ Return current sensitivity method :return: method enum """ return _amici.SolverPtr_get_sensitivity_method(self) def set_sensitivity_method(self, sensi_meth: SensitivityMethod): """ Set sensitivity method :param sensi_meth: """ return _amici.SolverPtr_set_sensitivity_method(self, sensi_meth) def get_sensitivity_method_pre_equilibration(self) -> SensitivityMethod: """ Return current sensitivity method during preequilibration :return: method enum """ return _amici.SolverPtr_get_sensitivity_method_pre_equilibration(self) def set_sensitivity_method_pre_equilibration(self, sensi_meth_preeq: SensitivityMethod): """ Set sensitivity method for preequilibration :param sensi_meth_preeq: """ return _amici.SolverPtr_set_sensitivity_method_pre_equilibration(self, sensi_meth_preeq) def get_newton_max_steps(self) -> int: """ Get maximum number of allowed Newton steps for steady state computation :return: """ return _amici.SolverPtr_get_newton_max_steps(self) def set_newton_max_steps(self, newton_maxsteps: int): """ Set maximum number of allowed Newton steps for steady state computation :param newton_maxsteps: """ return _amici.SolverPtr_set_newton_max_steps(self, newton_maxsteps) def get_newton_damping_factor_mode(self) -> NewtonDampingFactorMode: """ Get a state of the damping factor used in the Newton solver :return: """ return _amici.SolverPtr_get_newton_damping_factor_mode(self) def set_newton_damping_factor_mode(self, dampingFactorMode: NewtonDampingFactorMode): """ Turn on/off a damping factor in the Newton method :param dampingFactorMode: """ return _amici.SolverPtr_set_newton_damping_factor_mode(self, dampingFactorMode) def get_newton_damping_factor_lower_bound(self) -> float: """ Get a lower bound of the damping factor used in the Newton solver :return: """ return _amici.SolverPtr_get_newton_damping_factor_lower_bound(self) def set_newton_damping_factor_lower_bound(self, dampingFactorLowerBound: float): """ Set a lower bound of the damping factor in the Newton solver :param dampingFactorLowerBound: """ return _amici.SolverPtr_set_newton_damping_factor_lower_bound(self, dampingFactorLowerBound) def get_sensitivity_order(self) -> SensitivityOrder: """ Get sensitivity order :return: sensitivity order """ return _amici.SolverPtr_get_sensitivity_order(self) def set_sensitivity_order(self, sensi: SensitivityOrder): """ Set the sensitivity order :param sensi: sensitivity order """ return _amici.SolverPtr_set_sensitivity_order(self, sensi) def get_relative_tolerance(self) -> float: """ Get the relative tolerances for the forward problem Same tolerance is used for the backward problem if not specified differently via 'Solver::set_relative_tolerance_b'. :return: relative tolerances """ return _amici.SolverPtr_get_relative_tolerance(self) def set_relative_tolerance(self, rtol: float): """ Sets the relative tolerances for the forward problem Same tolerance is used for the backward problem if not specified differently via 'Solver::set_relative_tolerance_b'. :param rtol: relative tolerance (non-negative number) """ return _amici.SolverPtr_set_relative_tolerance(self, rtol) def get_absolute_tolerance(self) -> float: """ Get the absolute tolerances for the forward problem Same tolerance is used for the backward problem if not specified differently via 'Solver::set_absolute_tolerance_b'. :return: absolute tolerances """ return _amici.SolverPtr_get_absolute_tolerance(self) def set_absolute_tolerance(self, atol: float): """ Sets the absolute tolerances for the forward problem Same tolerance is used for the backward problem if not specified differently via 'Solver::set_absolute_tolerance_b'. :param atol: absolute tolerance (non-negative number) """ return _amici.SolverPtr_set_absolute_tolerance(self, atol) def get_relative_tolerance_fsa(self) -> float: """ Returns the relative tolerances for the forward sensitivity problem :return: relative tolerances """ return _amici.SolverPtr_get_relative_tolerance_fsa(self) def set_relative_tolerance_fsa(self, rtol: float): """ Sets the relative tolerances for the forward sensitivity problem :param rtol: relative tolerance (non-negative number) """ return _amici.SolverPtr_set_relative_tolerance_fsa(self, rtol) def get_absolute_tolerance_fsa(self) -> float: """ Returns the absolute tolerances for the forward sensitivity problem :return: absolute tolerances """ return _amici.SolverPtr_get_absolute_tolerance_fsa(self) def set_absolute_tolerance_fsa(self, atol: float): """ Sets the absolute tolerances for the forward sensitivity problem :param atol: absolute tolerance (non-negative number) """ return _amici.SolverPtr_set_absolute_tolerance_fsa(self, atol) def get_relative_tolerance_b(self) -> float: """ Returns the relative tolerances for the adjoint sensitivity problem :return: relative tolerances """ return _amici.SolverPtr_get_relative_tolerance_b(self) def set_relative_tolerance_b(self, rtol: float): """ Sets the relative tolerances for the adjoint sensitivity problem :param rtol: relative tolerance (non-negative number) """ return _amici.SolverPtr_set_relative_tolerance_b(self, rtol) def get_absolute_tolerance_b(self) -> float: """ Returns the absolute tolerances for the backward problem for adjoint sensitivity analysis :return: absolute tolerances """ return _amici.SolverPtr_get_absolute_tolerance_b(self) def set_absolute_tolerance_b(self, atol: float): """ Sets the absolute tolerances for the backward problem for adjoint sensitivity analysis :param atol: absolute tolerance (non-negative number) """ return _amici.SolverPtr_set_absolute_tolerance_b(self, atol) def get_relative_tolerance_quadratures(self) -> float: """ Returns the relative tolerance for the quadrature problem :return: relative tolerance """ return _amici.SolverPtr_get_relative_tolerance_quadratures(self) def set_relative_tolerance_quadratures(self, rtol: float): """ sets the relative tolerance for the quadrature problem :param rtol: relative tolerance (non-negative number) """ return _amici.SolverPtr_set_relative_tolerance_quadratures(self, rtol) def get_absolute_tolerance_quadratures(self) -> float: """ returns the absolute tolerance for the quadrature problem :return: absolute tolerance """ return _amici.SolverPtr_get_absolute_tolerance_quadratures(self) def set_absolute_tolerance_quadratures(self, atol: float): """ sets the absolute tolerance for the quadrature problem :param atol: absolute tolerance (non-negative number) """ return _amici.SolverPtr_set_absolute_tolerance_quadratures(self, atol) def get_steady_state_tolerance_factor(self) -> float: """ returns the steady state simulation tolerance factor. Steady state simulation tolerances are the product of the simulation tolerances and this factor, unless manually set with `set_relative_tolerance_steady_state()` / `set_absolute_tolerance_steady_state()`. :return: steady state simulation tolerance factor """ return _amici.SolverPtr_get_steady_state_tolerance_factor(self) def set_steady_state_tolerance_factor(self, factor: float): """ set the steady state simulation tolerance factor. Steady state simulation tolerances are the product of the simulation tolerances and this factor, unless manually set with `set_relative_tolerance_steady_state()` / `set_absolute_tolerance_steady_state()`. :param factor: tolerance factor (non-negative number) """ return _amici.SolverPtr_set_steady_state_tolerance_factor(self, factor) def get_relative_tolerance_steady_state(self) -> float: """ returns the relative tolerance for the steady state problem :return: relative tolerance """ return _amici.SolverPtr_get_relative_tolerance_steady_state(self) def set_relative_tolerance_steady_state(self, rtol: float): """ sets the relative tolerance for the steady state problem :param rtol: relative tolerance (non-negative number) """ return _amici.SolverPtr_set_relative_tolerance_steady_state(self, rtol) def get_absolute_tolerance_steady_state(self) -> float: """ returns the absolute tolerance for the steady state problem :return: absolute tolerance """ return _amici.SolverPtr_get_absolute_tolerance_steady_state(self) def set_absolute_tolerance_steady_state(self, atol: float): """ sets the absolute tolerance for the steady state problem :param atol: absolute tolerance (non-negative number) """ return _amici.SolverPtr_set_absolute_tolerance_steady_state(self, atol) def get_steady_state_sensi_tolerance_factor(self) -> float: """ returns the steady state sensitivity simulation tolerance factor. Steady state sensitivity simulation tolerances are the product of the sensitivity simulation tolerances and this factor, unless manually set with `set_{absolute,relative}_tolerance_steady_state_sensi()`. :return: steady state simulation tolerance factor """ return _amici.SolverPtr_get_steady_state_sensi_tolerance_factor(self) def set_steady_state_sensi_tolerance_factor(self, factor: float): """ set the steady state sensitivity simulation tolerance factor. Steady state sensitivity simulation tolerances are the product of the sensitivity simulation tolerances and this factor, unless manually set with `set_{absolute,relative}_tolerance_steady_state_sensi()`. :param factor: tolerance factor (non-negative number) """ return _amici.SolverPtr_set_steady_state_sensi_tolerance_factor(self, factor) def get_relative_tolerance_steady_state_sensi(self) -> float: """ returns the relative tolerance for the sensitivities of the steady state problem :return: relative tolerance """ return _amici.SolverPtr_get_relative_tolerance_steady_state_sensi(self) def set_relative_tolerance_steady_state_sensi(self, rtol: float): """ sets the relative tolerance for the sensitivities of the steady state problem :param rtol: relative tolerance (non-negative number) """ return _amici.SolverPtr_set_relative_tolerance_steady_state_sensi(self, rtol) def get_absolute_tolerance_steady_state_sensi(self) -> float: """ returns the absolute tolerance for the sensitivities of the steady state problem :return: absolute tolerance """ return _amici.SolverPtr_get_absolute_tolerance_steady_state_sensi(self) def set_absolute_tolerance_steady_state_sensi(self, atol: float): """ sets the absolute tolerance for the sensitivities of the steady state problem :param atol: absolute tolerance (non-negative number) """ return _amici.SolverPtr_set_absolute_tolerance_steady_state_sensi(self, atol) def get_max_steps(self) -> int: """ returns the maximum number of solver steps for the forward problem :return: maximum number of solver steps """ return _amici.SolverPtr_get_max_steps(self) def set_max_steps(self, maxsteps: int): """ sets the maximum number of solver steps for the forward problem :param maxsteps: maximum number of solver steps (positive number) """ return _amici.SolverPtr_set_max_steps(self, maxsteps) def get_max_time(self) -> float: """ Returns the maximum time allowed for integration :return: Time in seconds """ return _amici.SolverPtr_get_max_time(self) def set_max_time(self, maxtime: float): """ Set the maximum CPU time allowed for integration :param maxtime: Time in seconds. Zero means infinite time. """ return _amici.SolverPtr_set_max_time(self, maxtime) def get_max_steps_backward_problem(self) -> int: """ returns the maximum number of solver steps for the backward problem :return: maximum number of solver steps """ return _amici.SolverPtr_get_max_steps_backward_problem(self) def set_max_steps_backward_problem(self, maxsteps: int): """ sets the maximum number of solver steps for the backward problem :param maxsteps: maximum number of solver steps (non-negative number) Notes: default behaviour (100 times the value for the forward problem) can be restored by passing maxsteps=0 """ return _amici.SolverPtr_set_max_steps_backward_problem(self, maxsteps) def get_linear_multistep_method(self) -> LinearMultistepMethod: """ returns the linear system multistep method :return: linear system multistep method """ return _amici.SolverPtr_get_linear_multistep_method(self) def set_linear_multistep_method(self, lmm: LinearMultistepMethod): """ sets the linear system multistep method :param lmm: linear system multistep method """ return _amici.SolverPtr_set_linear_multistep_method(self, lmm) def get_non_linear_solver_iteration(self) -> NonlinearSolverIteration: """ returns the nonlinear system solution method :return: """ return _amici.SolverPtr_get_non_linear_solver_iteration(self) def set_non_linear_solver_iteration(self, iter: NonlinearSolverIteration): """ sets the nonlinear system solution method :param iter: nonlinear system solution method """ return _amici.SolverPtr_set_non_linear_solver_iteration(self, iter) def get_interpolation_type(self) -> InterpolationType: """ get_interpolation_type :return: """ return _amici.SolverPtr_get_interpolation_type(self) def set_interpolation_type(self, interpType: InterpolationType): """ sets the interpolation of the forward solution that is used for the backwards problem :param interpType: interpolation type """ return _amici.SolverPtr_set_interpolation_type(self, interpType) def get_state_ordering(self) -> int: """ Gets KLU / SuperLUMT state ordering mode :return: State-ordering as integer according to `SUNLinSolKLU::StateOrdering` or `SUNLinSolSuperLUMT::StateOrdering` (which differ). """ return _amici.SolverPtr_get_state_ordering(self) def set_state_ordering(self, ordering: int): """ Sets KLU / SuperLUMT state ordering mode This only applies when the linear solver is set to `LinearSolver::KLU` or `LinearSolver::SuperLUMT`. Mind the difference between `SUNLinSolKLU::StateOrdering` and `SUNLinSolSuperLUMT::StateOrdering`. :param ordering: state ordering """ return _amici.SolverPtr_set_state_ordering(self, ordering) def get_stability_limit_flag(self) -> bool: """ returns stability limit detection mode :return: stldet can be false (deactivated) or true (activated) """ return _amici.SolverPtr_get_stability_limit_flag(self) def set_stability_limit_flag(self, stldet: bool): """ set stability limit detection mode :param stldet: can be false (deactivated) or true (activated) """ return _amici.SolverPtr_set_stability_limit_flag(self, stldet) def get_linear_solver(self) -> LinearSolver: """ get_linear_solver :return: """ return _amici.SolverPtr_get_linear_solver(self) def set_linear_solver(self, linsol: LinearSolver): """ set_linear_solver :param linsol: """ return _amici.SolverPtr_set_linear_solver(self, linsol) def get_internal_sensitivity_method(self) -> InternalSensitivityMethod: """ returns the internal sensitivity method :return: internal sensitivity method """ return _amici.SolverPtr_get_internal_sensitivity_method(self) def set_internal_sensitivity_method(self, ism: InternalSensitivityMethod): """ sets the internal sensitivity method `InternalSensitivityMethod::staggered1` is only supported by CVODES. :param ism: internal sensitivity method """ return _amici.SolverPtr_set_internal_sensitivity_method(self, ism) def get_return_data_reporting_mode(self) -> RDataReporting: """ returns the ReturnData reporting mode :return: ReturnData reporting mode """ return _amici.SolverPtr_get_return_data_reporting_mode(self) def set_return_data_reporting_mode(self, rdrm: RDataReporting): """ sets the ReturnData reporting mode :param rdrm: ReturnData reporting mode """ return _amici.SolverPtr_set_return_data_reporting_mode(self, rdrm) def ignore_roots_after_reinit(self, root_directions: Sequence[int]): """ Records the roots of the discontinuity just handled. This information allows recognizing a spurious re-detection of exactly the same root, immediately following reinit(). :param root_directions: per-root bitmask of the crossing directions (see root_direction_bit()) seen during the discontinuity just handled, whether or not they triggered a state update """ return _amici.SolverPtr_ignore_roots_after_reinit(self, root_directions) def root_direction_bit(self, direction: int) -> int: """ Bit representing a root crossing direction. Used for the per-root bitmasks passed to ignore_roots_after_reinit(), where the same root may have crossed in both directions within one discontinuity, e.g. when an event assignment moves the state back across the event's own trigger. :param direction: root direction as reported by the solver (1: up-crossing, -1: down-crossing, 0: no crossing) :return: 1 for an up-crossing, 2 for a down-crossing, 0 otherwise """ return _amici.SolverPtr_root_direction_bit(self, direction) def nx(self) -> int: """ number of state variables with which the solver was initialized :return: Number of solver state variables. """ return _amici.SolverPtr_nx(self) def nplist(self) -> int: """ number of parameters with which the solver was initialized :return: Number of parameters w.r.t. which sensitivities are computed. """ return _amici.SolverPtr_nplist(self) def nquad(self) -> int: """ number of quadratures with which the solver was initialized :return: Number of quadratures with which the solver was initialized. """ return _amici.SolverPtr_nquad(self) def computing_fsa(self) -> bool: """ check if FSA is being computed :return: flag """ return _amici.SolverPtr_computing_fsa(self) def computing_asa(self) -> bool: """ check if ASA is being computed :return: flag """ return _amici.SolverPtr_computing_asa(self) def get_newton_step_steady_state_check(self) -> bool: """ Returns how convergence checks for steadystate computation are performed. If activated, convergence checks are limited to every 25 steps in the simulation solver to limit performance impact. :return: boolean flag indicating newton step (true) or the right hand side (false) """ return _amici.SolverPtr_get_newton_step_steady_state_check(self) def get_sensi_steady_state_check(self) -> bool: """ Returns how convergence checks for steadystate computation are performed. :return: boolean flag indicating state and sensitivity equations (true) or only state variables (false). """ return _amici.SolverPtr_get_sensi_steady_state_check(self) def set_newton_step_steady_state_check(self, flag: bool): """ Sets how convergence checks for steadystate computation are performed. :param flag: boolean flag to pick newton step (true) or the right hand side (false, default) """ return _amici.SolverPtr_set_newton_step_steady_state_check(self, flag) def set_sensi_steady_state_check(self, flag: bool): """ Sets for which variables convergence checks for steadystate computation are performed. :param flag: boolean flag to pick state and sensitivity equations (true, default) or only state variables (false). """ return _amici.SolverPtr_set_sensi_steady_state_check(self, flag) def set_max_nonlin_iters(self, max_nonlin_iters: int): """ Set the maximum number of nonlinear solver iterations permitted per step. :param max_nonlin_iters: maximum number of nonlinear solver iterations """ return _amici.SolverPtr_set_max_nonlin_iters(self, max_nonlin_iters) def get_max_nonlin_iters(self) -> int: """ Get the maximum number of nonlinear solver iterations permitted per step. :return: maximum number of nonlinear solver iterations """ return _amici.SolverPtr_get_max_nonlin_iters(self) def set_max_conv_fails(self, max_conv_fails: int): """ Set the maximum number of nonlinear solver convergence failures permitted per step. :param max_conv_fails: maximum number of nonlinear solver convergence """ return _amici.SolverPtr_set_max_conv_fails(self, max_conv_fails) def get_max_conv_fails(self) -> int: """ Get the maximum number of nonlinear solver convergence failures permitted per step. :return: maximum number of nonlinear solver convergence """ return _amici.SolverPtr_get_max_conv_fails(self) def set_constraints(self, constraints: Sequence[float]): """ Set constraints on the model state. See https://sundials.readthedocs.io/en/latest/cvode/Usage/index.html#c.CVodeSetConstraints. :param constraints: """ return _amici.SolverPtr_set_constraints(self, constraints) def get_constraints(self) -> Sequence[float]: """ Get constraints on the model state. :return: constraints """ return _amici.SolverPtr_get_constraints(self) def set_max_step_size(self, max_step_size: float): """ Set the maximum step size :param max_step_size: maximum step size. `0.0` means no limit. """ return _amici.SolverPtr_set_max_step_size(self, max_step_size) def get_max_step_size(self) -> float: """ Get the maximum step size :return: maximum step size """ return _amici.SolverPtr_get_max_step_size(self)
_amici.SolverPtr_swigregister(SolverPtr)
[docs] class ReturnDataPtr(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): _amici.ReturnDataPtr_swiginit(self, _amici.new_ReturnDataPtr(*args)) def __deref__(self): return _amici.ReturnDataPtr___deref__(self) def release(self): return _amici.ReturnDataPtr_release(self) def reset(self, *args): return _amici.ReturnDataPtr_reset(self, *args) def swap(self, __u): return _amici.ReturnDataPtr_swap(self, __u) def get(self): return _amici.ReturnDataPtr_get(self) def __bool__(self): return _amici.ReturnDataPtr___bool__(self) __swig_destroy__ = _amici.delete_ReturnDataPtr id = property(_amici.ReturnDataPtr_id_get, _amici.ReturnDataPtr_id_set, doc='Arbitrary (not necessarily unique) identifier.') ts = property(_amici.ReturnDataPtr_ts_get, _amici.ReturnDataPtr_ts_set, doc='Output or measurement timepoints (shape `nt`)') xdot = property(_amici.ReturnDataPtr_xdot_get, _amici.ReturnDataPtr_xdot_set, doc='time derivative (shape `nx_solver`) evaluated at `t_last`.') J = property(_amici.ReturnDataPtr_J_get, _amici.ReturnDataPtr_J_set, doc='\n Jacobian of differential equation right hand side.\n\n The Jacobian of differential equation right hand side\n (shape `nx_solver` x `nx_solver`, row-major) evaluated at `t_last`.\n\n The corresponding state variable IDs can be obtained from\n `state_ids_solver()`.\n ') w = property(_amici.ReturnDataPtr_w_get, _amici.ReturnDataPtr_w_set, doc='\n Model expression values.\n\n Values of model expressions (recurring terms in xdot, for imported SBML\n models from Python, this contains, e.g., the flux vector)\n at timepoints `ReturnData::ts` (shape `nt` x `nw`, row major).\n\n The corresponding expression IDs can be obtained from\n `expression_ids`.\n ') z = property(_amici.ReturnDataPtr_z_get, _amici.ReturnDataPtr_z_set, doc='Event output (shape `nmaxevent` x `nz`, row-major)') sigmaz = property(_amici.ReturnDataPtr_sigmaz_get, _amici.ReturnDataPtr_sigmaz_set, doc='\n Event output sigma standard deviation (shape `nmaxevent` x `nz`,\n row-major)\n ') sz = property(_amici.ReturnDataPtr_sz_get, _amici.ReturnDataPtr_sz_set, doc='\n Parameter derivative of event output\n (shape `nmaxevent` x `nplist` x `nz`, row-major)\n ') ssigmaz = property(_amici.ReturnDataPtr_ssigmaz_get, _amici.ReturnDataPtr_ssigmaz_set, doc='\n Parameter derivative of event output standard deviation\n (shape `nmaxevent` x `nplist` x `nz`, row-major)\n ') rz = property(_amici.ReturnDataPtr_rz_get, _amici.ReturnDataPtr_rz_set, doc='Event trigger output (shape `nmaxevent` x `nz`, row-major)') srz = property(_amici.ReturnDataPtr_srz_get, _amici.ReturnDataPtr_srz_set, doc='\n Parameter derivative of event trigger output\n (shape `nmaxevent` x `nplist` x `nz`, row-major)\n ') s2rz = property(_amici.ReturnDataPtr_s2rz_get, _amici.ReturnDataPtr_s2rz_set, doc='\n Second-order parameter derivative of event trigger output (shape\n `nmaxevent` x `nztrue` x `nplist` x `nplist`, row-major)\n ') x = property(_amici.ReturnDataPtr_x_get, _amici.ReturnDataPtr_x_set, doc='\n Model state.\n\n The model state at timepoints `ReturnData::ts`\n (shape `nt` x `nx_rdata`, row-major).\n\n The corresponding state variable IDs can be obtained from\n `state_ids`.\n ') sx = property(_amici.ReturnDataPtr_sx_get, _amici.ReturnDataPtr_sx_set, doc='\n State sensitivities.\n\n The derivative of the model state with respect to the chosen parameters\n (see `Model::getParameterList()` or `ExpData::plist`)\n at timepoints `ReturnData::ts`\n (shape `nt` x `nplist` x `nx_rdata`, row-major).\n\n The corresponding state variable IDs can be obtained from\n `state_ids`.\n ') y = property(_amici.ReturnDataPtr_y_get, _amici.ReturnDataPtr_y_set, doc='\n Observables.\n\n The values of the observables at timepoints `ReturnData::ts`\n (shape `nt` x `ny`, row-major).\n\n The corresponding observable IDs can be obtained from\n `observable_ids`.\n ') sigmay = property(_amici.ReturnDataPtr_sigmay_get, _amici.ReturnDataPtr_sigmay_set, doc='Observable standard deviation (shape `nt` x `ny`, row-major)') sy = property(_amici.ReturnDataPtr_sy_get, _amici.ReturnDataPtr_sy_set, doc='\n Observable sensitivities.\n\n The derivative of the observables with respect to the chosen parameters\n (see `Model::getParameterList()` or `ExpData::plist`)\n at timepoints `ReturnData::ts`\n (shape `nt` x `nplist` x `ny`, row-major).\n\n The corresponding observable IDs can be obtained from\n `observable_ids`.\n ') ssigmay = property(_amici.ReturnDataPtr_ssigmay_get, _amici.ReturnDataPtr_ssigmay_set, doc='\n Parameter derivative of observable standard deviation\n (shape `nt` x `nplist` x `ny`, row-major)\n ') res = property(_amici.ReturnDataPtr_res_get, _amici.ReturnDataPtr_res_set, doc='Residuals (shape `nt*ny`, row-major)') sres = property(_amici.ReturnDataPtr_sres_get, _amici.ReturnDataPtr_sres_set, doc='Parameter derivative of residual (shape `nt*ny` x `nplist`, row-major)') FIM = property(_amici.ReturnDataPtr_FIM_get, _amici.ReturnDataPtr_FIM_set, doc='Fisher information matrix (shape `nplist` x `nplist`, row-major)') numsteps = property(_amici.ReturnDataPtr_numsteps_get, _amici.ReturnDataPtr_numsteps_set, doc='\n Number of solver steps for the forward problem.\n\n Cumulative number of integration steps for the forward problem for each\n output timepoint in `ReturnData::ts` (shape `nt`).\n ') numsteps_b = property(_amici.ReturnDataPtr_numsteps_b_get, _amici.ReturnDataPtr_numsteps_b_set, doc='\n Number of solver steps for the backward problem.\n\n Cumulative number of integration steps for the backward problem for each\n output timepoint in `ReturnData::ts` (shape `nt`).\n ') num_rhs_evals = property(_amici.ReturnDataPtr_num_rhs_evals_get, _amici.ReturnDataPtr_num_rhs_evals_set, doc='Number of right hand side evaluations forward problem (shape `nt`)') num_rhs_evals_b = property(_amici.ReturnDataPtr_num_rhs_evals_b_get, _amici.ReturnDataPtr_num_rhs_evals_b_set, doc='Number of right hand side evaluations backward problem (shape `nt`)') num_err_test_fails = property(_amici.ReturnDataPtr_num_err_test_fails_get, _amici.ReturnDataPtr_num_err_test_fails_set, doc='Number of error test failures forward problem (shape `nt`)') num_err_test_fails_b = property(_amici.ReturnDataPtr_num_err_test_fails_b_get, _amici.ReturnDataPtr_num_err_test_fails_b_set, doc='Number of error test failures backward problem (shape `nt`)') num_non_lin_solv_conv_fails = property(_amici.ReturnDataPtr_num_non_lin_solv_conv_fails_get, _amici.ReturnDataPtr_num_non_lin_solv_conv_fails_set, doc='Number of linear solver convergence failures forward problem (shape `nt`)') num_non_lin_solv_conv_fails_b = property(_amici.ReturnDataPtr_num_non_lin_solv_conv_fails_b_get, _amici.ReturnDataPtr_num_non_lin_solv_conv_fails_b_set, doc='\n Number of linear solver convergence failures backward problem (shape\n `nt`)\n ') order = property(_amici.ReturnDataPtr_order_get, _amici.ReturnDataPtr_order_set, doc='Employed order forward problem (shape `nt`)') cpu_time = property(_amici.ReturnDataPtr_cpu_time_get, _amici.ReturnDataPtr_cpu_time_set, doc='\n Computation time of forward solve [ms]\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') cpu_time_b = property(_amici.ReturnDataPtr_cpu_time_b_get, _amici.ReturnDataPtr_cpu_time_b_set, doc='\n Computation time of backward solve [ms]\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') cpu_time_total = property(_amici.ReturnDataPtr_cpu_time_total_get, _amici.ReturnDataPtr_cpu_time_total_set, doc='\n Total CPU time from entering runAmiciSimulation until exiting [ms]\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') preeq_status = property(_amici.ReturnDataPtr_preeq_status_get, _amici.ReturnDataPtr_preeq_status_set, doc='Flags indicating success of steady-state solver (preequilibration)') preeq_cpu_time = property(_amici.ReturnDataPtr_preeq_cpu_time_get, _amici.ReturnDataPtr_preeq_cpu_time_set, doc='\n Computation time of the steady state solver [ms]\n (pre-equilibration)\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') preeq_cpu_time_b = property(_amici.ReturnDataPtr_preeq_cpu_time_b_get, _amici.ReturnDataPtr_preeq_cpu_time_b_set, doc='\n Computation time of the steady state solver of the backward\n problem [ms] (pre-equilibration)\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') posteq_status = property(_amici.ReturnDataPtr_posteq_status_get, _amici.ReturnDataPtr_posteq_status_set, doc='Flags indicating success of steady-state solver (postequilibration)') posteq_cpu_time = property(_amici.ReturnDataPtr_posteq_cpu_time_get, _amici.ReturnDataPtr_posteq_cpu_time_set, doc='\n Computation time of the steady-state solver [ms]\n (postequilibration)\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') posteq_cpu_time_b = property(_amici.ReturnDataPtr_posteq_cpu_time_b_get, _amici.ReturnDataPtr_posteq_cpu_time_b_set, doc='\n Computation time of the steady-state solver of the backward\n problem [ms] (postequilibration)\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') preeq_numsteps = property(_amici.ReturnDataPtr_preeq_numsteps_get, _amici.ReturnDataPtr_preeq_numsteps_set, doc='\n Number of Newton steps for pre-equilibration.\n\n [newton, simulation, newton] (length = 3)\n ') preeq_numsteps_b = property(_amici.ReturnDataPtr_preeq_numsteps_b_get, _amici.ReturnDataPtr_preeq_numsteps_b_set, doc='\n Number of simulation steps for adjoint pre-equilibration problem\n [== 0 if analytical solution worked, > 0 otherwise]\n ') posteq_numsteps = property(_amici.ReturnDataPtr_posteq_numsteps_get, _amici.ReturnDataPtr_posteq_numsteps_set, doc='\n Number of Newton steps for post-equilibration\n [newton, simulation, newton].\n ') posteq_numsteps_b = property(_amici.ReturnDataPtr_posteq_numsteps_b_get, _amici.ReturnDataPtr_posteq_numsteps_b_set, doc='\n Number of simulation steps for the post-equilibration backward simulation\n [== 0 if analytical solution worked, > 0 otherwise]\n ') preeq_t = property(_amici.ReturnDataPtr_preeq_t_get, _amici.ReturnDataPtr_preeq_t_set, doc='\n Model time at which the pre-equilibration steady state was reached via\n simulation.\n ') preeq_wrms = property(_amici.ReturnDataPtr_preeq_wrms_get, _amici.ReturnDataPtr_preeq_wrms_set, doc='Weighted root-mean-square of the rhs at pre-equilibration steady state.') posteq_t = property(_amici.ReturnDataPtr_posteq_t_get, _amici.ReturnDataPtr_posteq_t_set, doc='\n Model time at which the post-equilibration steady state was reached via\n simulation.\n ') posteq_wrms = property(_amici.ReturnDataPtr_posteq_wrms_get, _amici.ReturnDataPtr_posteq_wrms_set, doc='Weighted root-mean-square of the rhs at post-equilibration steady state.') x0 = property(_amici.ReturnDataPtr_x0_get, _amici.ReturnDataPtr_x0_set, doc='\n Initial state of the main simulation (shape `nx_rdata`).\n\n The corresponding state variable IDs can be obtained from\n `state_ids`.\n ') x_ss = property(_amici.ReturnDataPtr_x_ss_get, _amici.ReturnDataPtr_x_ss_set, doc='\n Pre-equilibration steady state.\n\n The values of the state variables at the pre-equilibration steady state\n (shape `nx_rdata`).\n The corresponding state variable IDs can be obtained from\n `state_ids`.\n ') sx0 = property(_amici.ReturnDataPtr_sx0_get, _amici.ReturnDataPtr_sx0_set, doc='\n Initial state sensitivities for the main simulation.\n\n Shape `nplist` x `nx_rdata` (row-major). Empty if pre-equilibration\n used adjoint sensitivities, in which case these are not computed.\n ') sx_ss = property(_amici.ReturnDataPtr_sx_ss_get, _amici.ReturnDataPtr_sx_ss_set, doc='\n Pre-equilibration steady state sensitivities.\n\n Sensitivities of the pre-equilibration steady state with respect to the\n selected parameters.\n (shape `nplist` x `nx_rdata`, row-major)\n ') llh = property(_amici.ReturnDataPtr_llh_get, _amici.ReturnDataPtr_llh_set, doc='Log-likelihood value') chi2 = property(_amici.ReturnDataPtr_chi2_get, _amici.ReturnDataPtr_chi2_set, doc=':math:`\\chi^2` value') sllh = property(_amici.ReturnDataPtr_sllh_get, _amici.ReturnDataPtr_sllh_set, doc='Parameter derivative of log-likelihood (shape `nplist`)') s2llh = property(_amici.ReturnDataPtr_s2llh_get, _amici.ReturnDataPtr_s2llh_set, doc='\n Second-order parameter derivative of log-likelihood\n (shape `nJ-1` x `nplist`, row-major)\n ') status = property(_amici.ReturnDataPtr_status_get, _amici.ReturnDataPtr_status_set, doc='\n Simulation status code.\n\n One of:\n\n * AMICI_SUCCESS, indicating successful simulation\n * AMICI_MAX_TIME_EXCEEDED, indicating that the simulation did not finish\n within the allowed time (see Solver.{set,get}MaxTime)\n * AMICI_ERROR, indicating that some error occurred during simulation\n (a more detailed error message will have been printed).\n * AMICI_NOT_RUN, if no simulation was started\n ') nplist = property(_amici.ReturnDataPtr_nplist_get, _amici.ReturnDataPtr_nplist_set, doc='Number of parameters w.r.t. which sensitivities were requested') nmaxevent = property(_amici.ReturnDataPtr_nmaxevent_get, _amici.ReturnDataPtr_nmaxevent_set, doc='Maximal number of occurring events (for every event type)') nt = property(_amici.ReturnDataPtr_nt_get, _amici.ReturnDataPtr_nt_set, doc='Number of output timepoints (length of `ReturnData::ts`).') newton_maxsteps = property(_amici.ReturnDataPtr_newton_maxsteps_get, _amici.ReturnDataPtr_newton_maxsteps_set, doc='maximal number of newton iterations for steady state calculation') pscale = property(_amici.ReturnDataPtr_pscale_get, _amici.ReturnDataPtr_pscale_set, doc='Scaling of model parameters.') o2mode = property(_amici.ReturnDataPtr_o2mode_get, _amici.ReturnDataPtr_o2mode_set, doc='Flag indicating whether second-order sensitivities were requested.') sensi = property(_amici.ReturnDataPtr_sensi_get, _amici.ReturnDataPtr_sensi_set, doc='Sensitivity order.') sensi_meth = property(_amici.ReturnDataPtr_sensi_meth_get, _amici.ReturnDataPtr_sensi_meth_set, doc='Sensitivity method.') rdata_reporting = property(_amici.ReturnDataPtr_rdata_reporting_get, _amici.ReturnDataPtr_rdata_reporting_set, doc='Reporting mode.') sigma_res = property(_amici.ReturnDataPtr_sigma_res_get, _amici.ReturnDataPtr_sigma_res_set, doc='\n Boolean indicating whether residuals for standard deviations have been\n added.\n ') messages = property(_amici.ReturnDataPtr_messages_get, _amici.ReturnDataPtr_messages_set, doc='Log messages.') t_last = property(_amici.ReturnDataPtr_t_last_get, _amici.ReturnDataPtr_t_last_set, doc='The final internal time of the solver.') plist = property(_amici.ReturnDataPtr_plist_get, _amici.ReturnDataPtr_plist_set, doc='\n Indices of the parameters w.r.t. which sensitivities were\n computed.\n\n The indices refer to parameter IDs in `free_parameter_ids`.\n ') free_parameter_ids = property(_amici.ReturnDataPtr_free_parameter_ids_get, _amici.ReturnDataPtr_free_parameter_ids_set, doc='IDs of the free parameters') free_parameter_names = property(_amici.ReturnDataPtr_free_parameter_names_get, _amici.ReturnDataPtr_free_parameter_names_set, doc='Names of the free parameters') fixed_parameter_ids = property(_amici.ReturnDataPtr_fixed_parameter_ids_get, _amici.ReturnDataPtr_fixed_parameter_ids_set, doc='IDs of the fixed parameters') fixed_parameter_names = property(_amici.ReturnDataPtr_fixed_parameter_names_get, _amici.ReturnDataPtr_fixed_parameter_names_set, doc='Names of the fixed parameters') state_ids = property(_amici.ReturnDataPtr_state_ids_get, _amici.ReturnDataPtr_state_ids_set, doc='IDs of state variables') state_names = property(_amici.ReturnDataPtr_state_names_get, _amici.ReturnDataPtr_state_names_set, doc='Names of state variables') state_ids_solver = property(_amici.ReturnDataPtr_state_ids_solver_get, _amici.ReturnDataPtr_state_ids_solver_set, doc='IDs of solver state variables') state_names_solver = property(_amici.ReturnDataPtr_state_names_solver_get, _amici.ReturnDataPtr_state_names_solver_set, doc='Names of solver state variables') observable_ids = property(_amici.ReturnDataPtr_observable_ids_get, _amici.ReturnDataPtr_observable_ids_set, doc='IDs of observables') observable_names = property(_amici.ReturnDataPtr_observable_names_get, _amici.ReturnDataPtr_observable_names_set, doc='Names of observables') expression_ids = property(_amici.ReturnDataPtr_expression_ids_get, _amici.ReturnDataPtr_expression_ids_set, doc='IDs of expressions') expression_names = property(_amici.ReturnDataPtr_expression_names_get, _amici.ReturnDataPtr_expression_names_set, doc='Names of expressions') def validate(self): """Validate dimensions.""" return _amici.ReturnDataPtr_validate(self) nx_rdata = property(_amici.ReturnDataPtr_nx_rdata_get, _amici.ReturnDataPtr_nx_rdata_set, doc='Number of state variables') nxtrue_rdata = property(_amici.ReturnDataPtr_nxtrue_rdata_get, _amici.ReturnDataPtr_nxtrue_rdata_set, doc='Number of state variables in the unaugmented system') nx_solver = property(_amici.ReturnDataPtr_nx_solver_get, _amici.ReturnDataPtr_nx_solver_set, doc='Number of state variables with conservation laws applied') nxtrue_solver = property(_amici.ReturnDataPtr_nxtrue_solver_get, _amici.ReturnDataPtr_nxtrue_solver_set, doc='\n Number of state variables in the unaugmented system with conservation\n laws applied\n ') nx_reinit = property(_amici.ReturnDataPtr_nx_reinit_get, _amici.ReturnDataPtr_nx_reinit_set, doc='Number of non-constant state variables subject to reinitialization') np = property(_amici.ReturnDataPtr_np_get, _amici.ReturnDataPtr_np_set, doc='Number of parameters') nk = property(_amici.ReturnDataPtr_nk_get, _amici.ReturnDataPtr_nk_set, doc='Number of constants') ny = property(_amici.ReturnDataPtr_ny_get, _amici.ReturnDataPtr_ny_set, doc='Number of observables') nytrue = property(_amici.ReturnDataPtr_nytrue_get, _amici.ReturnDataPtr_nytrue_set, doc='Number of observables in the unaugmented system') nz = property(_amici.ReturnDataPtr_nz_get, _amici.ReturnDataPtr_nz_set, doc='Number of event outputs') nztrue = property(_amici.ReturnDataPtr_nztrue_get, _amici.ReturnDataPtr_nztrue_set, doc='Number of event outputs in the unaugmented system') ne = property(_amici.ReturnDataPtr_ne_get, _amici.ReturnDataPtr_ne_set, doc='Number of events') ne_solver = property(_amici.ReturnDataPtr_ne_solver_get, _amici.ReturnDataPtr_ne_solver_set, doc='Number of events that require root-finding') nspl = property(_amici.ReturnDataPtr_nspl_get, _amici.ReturnDataPtr_nspl_set, doc='Number of spline functions in the model') nw = property(_amici.ReturnDataPtr_nw_get, _amici.ReturnDataPtr_nw_set, doc='Number of common expressions') ndwdx = property(_amici.ReturnDataPtr_ndwdx_get, _amici.ReturnDataPtr_ndwdx_set, doc='\n Number of nonzero elements in the `x` derivative of the\n repeating elements\n ') ndwdp = property(_amici.ReturnDataPtr_ndwdp_get, _amici.ReturnDataPtr_ndwdp_set, doc='\n Number of nonzero elements in the `p` derivative of the\n repeating elements\n ') ndwdw = property(_amici.ReturnDataPtr_ndwdw_get, _amici.ReturnDataPtr_ndwdw_set, doc='\n Number of nonzero elements in the `w` derivative of the\n repeating elements\n ') ndxdotdw = property(_amici.ReturnDataPtr_ndxdotdw_get, _amici.ReturnDataPtr_ndxdotdw_set, doc='Number of nonzero elements in the :math:`w` derivative of :math:`xdot`') ndJydy = property(_amici.ReturnDataPtr_ndJydy_get, _amici.ReturnDataPtr_ndJydy_set, doc='\n Number of nonzero elements in the :math:`y` derivative of\n :math:`dJy` (dimension `nytrue`)\n ') ndxrdatadxsolver = property(_amici.ReturnDataPtr_ndxrdatadxsolver_get, _amici.ReturnDataPtr_ndxrdatadxsolver_set, doc='Number of nonzero elements in the :math:`x` derivative of :math:`x\\_rdata`') ndxrdatadtcl = property(_amici.ReturnDataPtr_ndxrdatadtcl_get, _amici.ReturnDataPtr_ndxrdatadtcl_set, doc='Number of nonzero elements in the :math:`tcl` derivative of :math:`x\\_rdata`') ndtotal_cldx_rdata = property(_amici.ReturnDataPtr_ndtotal_cldx_rdata_get, _amici.ReturnDataPtr_ndtotal_cldx_rdata_set, doc='\n Number of nonzero elements in the :math:`x\\_rdata` derivative of\n :math:`total\\_cl`\n ') nnz = property(_amici.ReturnDataPtr_nnz_get, _amici.ReturnDataPtr_nnz_set, doc='Number of nonzero entries in Jacobian') nJ = property(_amici.ReturnDataPtr_nJ_get, _amici.ReturnDataPtr_nJ_set, doc='Dimension of the augmented objective function for 2nd order ASA') ubw = property(_amici.ReturnDataPtr_ubw_get, _amici.ReturnDataPtr_ubw_set, doc='Upper bandwidth of the Jacobian') lbw = property(_amici.ReturnDataPtr_lbw_get, _amici.ReturnDataPtr_lbw_set, doc='Lower bandwidth of the Jacobian') ndxdotdp_explicit = property(_amici.ReturnDataPtr_ndxdotdp_explicit_get, _amici.ReturnDataPtr_ndxdotdp_explicit_set, doc='Number of nonzero elements in `dxdotdp_explicit`') ndxdotdx_explicit = property(_amici.ReturnDataPtr_ndxdotdx_explicit_get, _amici.ReturnDataPtr_ndxdotdx_explicit_set, doc='Number of nonzero elements in `dxdotdx_explicit`') w_recursion_depth = property(_amici.ReturnDataPtr_w_recursion_depth_get, _amici.ReturnDataPtr_w_recursion_depth_set, doc='Recursion depth of fw')
_amici.ReturnDataPtr_swigregister(ReturnDataPtr)
[docs] class ModelPtr(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): _amici.ModelPtr_swiginit(self, _amici.new_ModelPtr(*args)) def __deref__(self): return _amici.ModelPtr___deref__(self) def release(self): return _amici.ModelPtr_release(self) def reset(self, *args): return _amici.ModelPtr_reset(self, *args) def swap(self, __u): return _amici.ModelPtr_swap(self, __u) def get(self): return _amici.ModelPtr_get(self) def __bool__(self): return _amici.ModelPtr___bool__(self) __swig_destroy__ = _amici.delete_ModelPtr def clone(self): """Clone the model instance.""" return _model_clone_impl(self) def __deepcopy__(self, memo): return self.clone() def __reduce__(self): return _model_reduce_impl(self) @overload def simulate(self: AmiciModel, *, solver: Solver | None=None, edata: AmiciExpData | None=None, sensi_method: SensitivityMethod | str=None, sensi_order: SensitivityOrder | str=None) -> ReturnDataView: ... @overload def simulate(self: AmiciModel, *, solver: Solver | None=None, edata: AmiciExpDataVector | None=None, failfast: bool=True, num_threads: int=1, sensi_method: SensitivityMethod | str=None, sensi_order: SensitivityOrder | str=None) -> list[ReturnDataView]: ... def simulate(self: AmiciModel, *, solver: Solver | None=None, edata: AmiciExpData | AmiciExpDataVector | None=None, failfast: bool=True, num_threads: int=1, sensi_method: SensitivityMethod | str=None, sensi_order: SensitivityOrder | str=None) -> ReturnDataView | list[ReturnDataView]: """Simulate model with given solver and experimental data. :param 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. If `None`, no experimental data is used and the model is simulated as is. :param sensi_method: Sensitivity method to use for simulation. If `None`, the solver's current sensitivity method is used. :param sensi_order: Sensitivity order to use for simulation. If `None`, the solvers's current sensitivity order is used. :param failfast: Whether to stop simulations on first failure. Only relevant if `edata` is a sequence of :class:`ExpData` instances. :param num_threads: Number of threads to use for simulation. Only relevant if `edata` is a sequence of :class:`ExpData` instances. :return: A single :class:`ReturnDataView` instance containing the simulation results if `edata` is a single :class:`ExpData` instance or `None`. If `edata` is a sequence of :class:`ExpData` instances, a list of :class:`ReturnDataView` instances is returned. """ return _model_simulate_impl(self, solver=solver, edata=edata, failfast=failfast, num_threads=num_threads, sensi_method=sensi_method, sensi_order=sensi_order) def _cpp_model_clone(self) -> Model: """ Clone this instance. :return: The clone """ return _amici.ModelPtr__cpp_model_clone(self) def nplist(self) -> int: """ Get number of parameters wrt to which sensitivities are computed. :return: Length of sensitivity index vector """ return _amici.ModelPtr_nplist(self) def np(self) -> int: """ Get total number of model parameters. :return: Length of parameter vector """ return _amici.ModelPtr_np(self) def nk(self) -> int: """ Get number of fixed parameters. :return: Number of fixed parameters. """ return _amici.ModelPtr_nk(self) def ncl(self) -> int: """ Get number of conservation laws. :return: Number of conservation laws (i.e., difference between `nx_rdata` and `nx_solver`). """ return _amici.ModelPtr_ncl(self) def nx_reinit(self) -> int: """ Get number of non-constant states subject to reinitialization. :return: Model member `nx_reinit` """ return _amici.ModelPtr_nx_reinit(self) def k(self) -> float: """ Get fixed parameters. :return: Pointer to constants array """ return _amici.ModelPtr_k(self) def n_max_event(self) -> int: """ Get maximum number of events that may occur for each type. :return: Maximum number of events that may occur for each type """ return _amici.ModelPtr_n_max_event(self) def set_n_max_event(self, nmaxevent: int): """ Set maximum number of events that may occur for each type. :param nmaxevent: Maximum number of events that may occur for each type """ return _amici.ModelPtr_set_n_max_event(self, nmaxevent) def nt(self) -> int: """ Get number of timepoints. :return: Number of timepoints """ return _amici.ModelPtr_nt(self) def get_parameter_scale(self) -> ParameterScalingVector: """ Get parameter scale for each parameter. :return: Vector of parameter scales """ return _amici.ModelPtr_get_parameter_scale(self) def set_parameter_scale(self, *args): """ *Overload 1:* Set parameter scale for each parameter. NOTE: Resets initial state sensitivities. :type pscale: int :param pscale: Scalar parameter scale to be set for all parameters | *Overload 2:* Set parameter scale for each parameter. NOTE: Resets initial state sensitivities. :type pscaleVec: ParameterScalingVector :param pscaleVec: Vector of parameter scales """ return _amici.ModelPtr_set_parameter_scale(self, *args) def get_unscaled_parameters(self) -> Sequence[float]: """ Get parameters with transformation according to parameter scale applied. :return: Unscaled parameters """ return _amici.ModelPtr_get_unscaled_parameters(self) def get_free_parameters(self) -> Sequence[float]: """ Get parameter vector. :return: The user-set parameters (see also `Model::getUnscaledParameters`) """ return _amici.ModelPtr_get_free_parameters(self) def get_free_parameter_by_id(self, par_id: str) -> float: """ Get value of first model parameter with the specified ID. :param par_id: Parameter ID :return: Parameter value """ return _amici.ModelPtr_get_free_parameter_by_id(self, par_id) def get_free_parameter_by_name(self, par_name: str) -> float: """ Get value of first model parameter with the specified name. :param par_name: Parameter name :return: Parameter value """ return _amici.ModelPtr_get_free_parameter_by_name(self, par_name) def set_free_parameters(self, p: Sequence[float]): """ Set the parameter vector. :param p: Vector of parameters """ return _amici.ModelPtr_set_free_parameters(self, p) def set_free_parameter_by_id(self, *args): """ *Overload 1:* Set model parameters according to the parameter IDs and mapped values. :type p: StringDoubleMap :param p: Map of parameters IDs and values :type ignoreErrors: boolean, optional :param ignoreErrors: Ignore errors such as parameter IDs in p which are not model parameters | *Overload 2:* Set value of first model parameter with the specified ID. :type par_id: str :param par_id: Parameter ID :type value: float :param value: Parameter value """ return _amici.ModelPtr_set_free_parameter_by_id(self, *args) def set_free_parameters_by_id_regex(self, par_id_regex: str, value: float) -> int: """ Set all values of model parameters with IDs matching the specified regular expression. :param par_id_regex: Parameter ID regex :param value: Parameter value :return: Number of parameter IDs that matched the regex """ return _amici.ModelPtr_set_free_parameters_by_id_regex(self, par_id_regex, value) def set_free_parameter_by_name(self, *args): """ *Overload 1:* Set value of first model parameter with the specified name. :type par_name: str :param par_name: Parameter name :type value: float :param value: Parameter value | *Overload 2:* Set model parameters according to the parameter name and mapped values. :type p: StringDoubleMap :param p: Map of parameters names and values :type ignoreErrors: boolean, optional :param ignoreErrors: Ignore errors such as parameter names in p which are not model parameters | *Overload 3:* Set model parameters according to the parameter name and mapped values. :type p: StringDoubleMap :param p: Map of parameters names and values :param ignoreErrors: Ignore errors such as parameter names in p which are not model parameters """ return _amici.ModelPtr_set_free_parameter_by_name(self, *args) def set_free_parameters_by_name_regex(self, par_name_regex: str, value: float) -> int: """ Set all values of all model parameters with names matching the specified regex. :param par_name_regex: Parameter name regex :param value: Parameter value :return: Number of fixed parameter names that matched the regex """ return _amici.ModelPtr_set_free_parameters_by_name_regex(self, par_name_regex, value) def get_fixed_parameters(self) -> Sequence[float]: """ Get values of fixed parameters. :return: Vector of fixed parameters with same ordering as in Model::getFixedParameterIds """ return _amici.ModelPtr_get_fixed_parameters(self) def get_fixed_parameter_by_id(self, par_id: str) -> float: """ Get value of fixed parameter with the specified ID. :param par_id: Parameter ID :return: Parameter value """ return _amici.ModelPtr_get_fixed_parameter_by_id(self, par_id) def get_fixed_parameter_by_name(self, par_name: str) -> float: """ Get value of fixed parameter with the specified name. If multiple parameters have the same name, the first parameter with matching name is returned. :param par_name: Parameter name :return: Parameter value """ return _amici.ModelPtr_get_fixed_parameter_by_name(self, par_name) def set_fixed_parameters(self, k: Sequence[float]): """ Set values for constants. :param k: Vector of fixed parameters """ return _amici.ModelPtr_set_fixed_parameters(self, k) def set_fixed_parameter_by_id(self, par_id: str, value: float): """ Set value of first fixed parameter with the specified ID. :param par_id: Fixed parameter id :param value: Fixed parameter value """ return _amici.ModelPtr_set_fixed_parameter_by_id(self, par_id, value) def set_fixed_parameters_by_id_regex(self, par_id_regex: str, value: float) -> int: """ Set values of all fixed parameters with the ID matching the specified regex. :param par_id_regex: Fixed parameter name regex :param value: Fixed parameter value :return: Number of fixed parameter IDs that matched the regex """ return _amici.ModelPtr_set_fixed_parameters_by_id_regex(self, par_id_regex, value) def set_fixed_parameter_by_name(self, par_name: str, value: float): """ Set value of first fixed parameter with the specified name. :param par_name: Fixed parameter ID :param value: Fixed parameter value """ return _amici.ModelPtr_set_fixed_parameter_by_name(self, par_name, value) def set_fixed_parameters_by_name_regex(self, par_name_regex: str, value: float) -> int: """ Set value of all fixed parameters with name matching the specified regex. :param par_name_regex: Fixed parameter name regex :param value: Fixed parameter value :return: Number of fixed parameter names that matched the regex """ return _amici.ModelPtr_set_fixed_parameters_by_name_regex(self, par_name_regex, value) def get_name(self) -> str: """ Get the model name. :return: Model name """ return _amici.ModelPtr_get_name(self) def has_free_parameter_names(self) -> bool: """ Report whether the model has free parameter names set. :return: Boolean indicating whether free parameter names were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.ModelPtr_has_free_parameter_names(self) def get_free_parameter_names(self) -> Sequence[str]: """ Get names of the free model parameters. :return: The parameter names """ return _amici.ModelPtr_get_free_parameter_names(self) def has_state_names(self) -> bool: """ Report whether the model has state names set. :return: Boolean indicating whether state names were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.ModelPtr_has_state_names(self) def get_state_names(self) -> Sequence[str]: """ Get names of the model states. :return: State names """ return _amici.ModelPtr_get_state_names(self) def get_state_names_solver(self) -> Sequence[str]: """ Get names of the solver states. :return: State names """ return _amici.ModelPtr_get_state_names_solver(self) def has_fixed_parameter_names(self) -> bool: """ Report whether the model has fixed parameter names set. :return: Boolean indicating whether fixed parameter names were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.ModelPtr_has_fixed_parameter_names(self) def get_fixed_parameter_names(self) -> Sequence[str]: """ Get names of the fixed model parameters. :return: Fixed parameter names """ return _amici.ModelPtr_get_fixed_parameter_names(self) def has_observable_names(self) -> bool: """ Report whether the model has observable names set. :return: Boolean indicating whether observable names were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.ModelPtr_has_observable_names(self) def get_observable_names(self) -> Sequence[str]: """ Get names of the observables. :return: Observable names """ return _amici.ModelPtr_get_observable_names(self) def has_expression_names(self) -> bool: """ Report whether the model has expression names set. :return: Boolean indicating whether expression names were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.ModelPtr_has_expression_names(self) def get_expression_names(self) -> Sequence[str]: """ Get names of the expressions. :return: Expression names """ return _amici.ModelPtr_get_expression_names(self) def has_free_parameter_ids(self) -> bool: """ Report whether the model has parameter IDs set. :return: Boolean indicating whether parameter IDs were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.ModelPtr_has_free_parameter_ids(self) def get_free_parameter_ids(self) -> Sequence[str]: """ Get IDs of the model parameters. :return: Parameter IDs """ return _amici.ModelPtr_get_free_parameter_ids(self) def has_state_ids(self) -> bool: """ Report whether the model has state IDs set. :return: Boolean indicating whether state IDs were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.ModelPtr_has_state_ids(self) def get_state_ids(self) -> Sequence[str]: """ Get IDs of the model states. :return: State IDs """ return _amici.ModelPtr_get_state_ids(self) def get_state_ids_solver(self) -> Sequence[str]: """ Get IDs of the solver states. :return: State IDs """ return _amici.ModelPtr_get_state_ids_solver(self) def has_fixed_parameter_ids(self) -> bool: """ Report whether the model has fixed parameter IDs set. :return: Boolean indicating whether fixed parameter IDs were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.ModelPtr_has_fixed_parameter_ids(self) def get_fixed_parameter_ids(self) -> Sequence[str]: """ Get IDs of the fixed model parameters. :return: Fixed parameter IDs """ return _amici.ModelPtr_get_fixed_parameter_ids(self) def has_observable_ids(self) -> bool: """ Report whether the model has observable IDs set. :return: Boolean indicating whether observable ids were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.ModelPtr_has_observable_ids(self) def get_observable_ids(self) -> Sequence[str]: """ Get IDs of the observables. :return: Observable IDs """ return _amici.ModelPtr_get_observable_ids(self) def has_expression_ids(self) -> bool: """ Report whether the model has expression IDs set. :return: Boolean indicating whether expression ids were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.ModelPtr_has_expression_ids(self) def get_expression_ids(self) -> Sequence[str]: """ Get IDs of the expression. :return: Expression IDs """ return _amici.ModelPtr_get_expression_ids(self) def has_quadratic_llh(self) -> bool: """ Checks whether the defined noise model is Gaussian, i.e., the nllh is quadratic :return: boolean flag """ return _amici.ModelPtr_has_quadratic_llh(self) def get_timepoints(self) -> Sequence[float]: """ Get the timepoint vector. :return: Timepoint vector """ return _amici.ModelPtr_get_timepoints(self) def get_timepoint(self, it: int) -> float: """ Get simulation timepoint for time index `it`. :param it: Time index :return: Timepoint """ return _amici.ModelPtr_get_timepoint(self, it) def set_timepoints(self, ts: Sequence[float]): """ Set the timepoint vector. :param ts: New timepoint vector """ return _amici.ModelPtr_set_timepoints(self, ts) def t0(self) -> float: """ Get simulation start time. :return: Simulation start time """ return _amici.ModelPtr_t0(self) def set_t0(self, t0: float): """ Set simulation start time. Output timepoints are absolute timepoints, independent of :math:`t_{0}`. For output timepoints :math:`t < t_{0}`, the initial state will be returned. :param t0: Simulation start time """ return _amici.ModelPtr_set_t0(self, t0) def t0_preeq(self) -> float: """ Get the initial time to use for pre-equilibration. Deprecated: Use ExpData::t_start_preeq. :return: Initial time, or NAN if not set. """ return _amici.ModelPtr_t0_preeq(self) def set_t0_preeq(self, t0_preeq: float): """ Set the initial time to use for pre-equilibration. Only used if ExpData::t_start_preeq is NAN. Deprecated: Use ExpData::t_start_preeq. :param t0_preeq: The initial time for pre-equilibration or NAN to unset. """ if not np.isnan(t0_preeq): import warnings warnings.warn('`Model.set_t0_preeq` is deprecated, set `ExpData.t_start_preeq` instead.', DeprecationWarning, stacklevel=2) return _amici.ModelPtr_set_t0_preeq(self, t0_preeq) def get_state_is_non_negative(self) -> Sequence[bool]: """ Get flags indicating whether states should be treated as non-negative. :return: Vector of flags """ return _amici.ModelPtr_get_state_is_non_negative(self) def set_state_is_non_negative(self, stateIsNonNegative: Sequence[bool]): """ Set flags indicating whether states should be treated as non-negative. :param stateIsNonNegative: Vector of flags """ return _amici.ModelPtr_set_state_is_non_negative(self, stateIsNonNegative) def set_all_states_non_negative(self): """ Set flags indicating that all states should be treated as non-negative. """ return _amici.ModelPtr_set_all_states_non_negative(self) def set_minimum_sigma_residuals(self, min_sigma: float): """ Sets the estimated lower boundary for sigma_y. When :meth:`set_add_sigma_residuals` is activated, this lower boundary must ensure that log(sigma) + min_sigma > 0. :param min_sigma: lower boundary """ return _amici.ModelPtr_set_minimum_sigma_residuals(self, min_sigma) def get_minimum_sigma_residuals(self) -> float: """ Gets the specified estimated lower boundary for sigma_y. :return: lower boundary """ return _amici.ModelPtr_get_minimum_sigma_residuals(self) def set_add_sigma_residuals(self, sigma_res: bool): """ Specifies whether residuals should be added to account for parameter dependent sigma. If set to true, additional residuals of the form :math:`\\sqrt{\\log(\\sigma) +C}` will be added. This enables least-squares optimization for variables with Gaussian noise assumption and parameter dependent standard deviation sigma. The constant :math:`C` can be set via :meth:`set_minimum_sigma_residuals`. :param sigma_res: if true, additional residuals are added """ return _amici.ModelPtr_set_add_sigma_residuals(self, sigma_res) def get_add_sigma_residuals(self) -> bool: """ Checks whether residuals should be added to account for parameter dependent sigma. :return: sigma_res """ return _amici.ModelPtr_get_add_sigma_residuals(self) def get_parameter_list(self) -> Sequence[int]: """ Get the list of parameters for which sensitivities are computed. :return: List of parameter indices """ return _amici.ModelPtr_get_parameter_list(self) def plist(self, pos: int) -> int: """ Get entry in parameter list by index. :param pos: Index in sensitivity parameter list :return: Index in parameter list """ return _amici.ModelPtr_plist(self, pos) def set_parameter_list(self, plist: Sequence[int]): """ Set the list of parameters for which sensitivities are to be computed. NOTE: Resets initial state sensitivities. :param plist: List of parameter indices """ return _amici.ModelPtr_set_parameter_list(self, plist) def get_initial_state(self, *args): """ *Overload 1:* Get the initial state. :type t0: float :param t0: Custom t0 for which to get initial states. :rtype: DoubleVector :return: Initial state vector, before any events are executed. | *Overload 2:* Get the initial state for Model::t0()`. :rtype: DoubleVector :return: Initial state vector, before any events are executed. """ return _amici.ModelPtr_get_initial_state(self, *args) def set_initial_state(self, x0: Sequence[float]): """ Set the pre-event initial state. :param x0: Initial state vector """ return _amici.ModelPtr_set_initial_state(self, x0) def has_custom_initial_state(self) -> bool: """ Return whether custom initial state have been set. :return: `true` if has custom initial state, otherwise `false` """ return _amici.ModelPtr_has_custom_initial_state(self) def get_initial_state_sensitivities(self, *args): """ *Overload 1:* Get the initial state sensitivities. Sensitivities are with respect to the unscaled parameters, i.e., without the chain rule for parameter scaling applied (see set_unscaled_initial_state_sensitivities()). :rtype: DoubleVector :return: vector of initial state sensitivities | *Overload 2:* Get the initial states sensitivities. Sensitivities are with respect to the unscaled parameters, i.e., without the chain rule for parameter scaling applied (see set_unscaled_initial_state_sensitivities()). :type t0: float :param t0: Custom t0 for which to get initial states. :rtype: DoubleVector :return: vector of initial state sensitivities """ return _amici.ModelPtr_get_initial_state_sensitivities(self, *args) def set_initial_state_sensitivities(self, sx0: Sequence[float]): """ Set the initial state sensitivities. :param sx0: vector of initial state sensitivities with chain rule applied. This could be a slice of ReturnData::sx or ReturnData::sx0 """ return _amici.ModelPtr_set_initial_state_sensitivities(self, sx0) def has_custom_initial_state_sensitivities(self) -> bool: """ Return whether custom initial state sensitivities have been set. :return: `true` if has custom initial state sensitivities, otherwise `false`. """ return _amici.ModelPtr_has_custom_initial_state_sensitivities(self) def set_unscaled_initial_state_sensitivities(self, sx0: Sequence[float]): """ Set the initial state sensitivities. :param sx0: Vector of initial state sensitivities without chain rule applied. This could be the read-in from a `model.sx0data` saved to HDF5. """ return _amici.ModelPtr_set_unscaled_initial_state_sensitivities(self, sx0) def set_steady_state_computation_mode(self, mode: int): """ Set the mode how steady state is computed in the steady state simulation. :param mode: Steady state computation mode """ return _amici.ModelPtr_set_steady_state_computation_mode(self, mode) def get_steady_state_computation_mode(self) -> int: """ Gets the mode how steady state is computed in the steadystate simulation. :return: Mode """ return _amici.ModelPtr_get_steady_state_computation_mode(self) def set_steady_state_sensitivity_mode(self, mode: SteadyStateSensitivityMode): """ Set the mode how sensitivities are computed in the steady-state simulation. :param mode: Steady-state sensitivity mode """ return _amici.ModelPtr_set_steady_state_sensitivity_mode(self, mode) def get_steady_state_sensitivity_mode(self) -> SteadyStateSensitivityMode: """ Gets the mode how sensitivities are computed in the steady-state simulation. :return: Mode """ return _amici.ModelPtr_get_steady_state_sensitivity_mode(self) def set_reinitialize_fixed_parameter_initial_states(self, flag: bool): """ Set whether initial states depending on fixed parameters are to be reinitialized after preequilibration and presimulation. :param flag: Fixed parameters reinitialized? """ return _amici.ModelPtr_set_reinitialize_fixed_parameter_initial_states(self, flag) def get_reinitialize_fixed_parameter_initial_states(self) -> bool: """ Get whether initial states depending on fixedParameters are to be reinitialized after preequilibration and presimulation. :return: flag `true` / `false` """ return _amici.ModelPtr_get_reinitialize_fixed_parameter_initial_states(self) def require_sensitivities_for_all_parameters(self): """ Require computation of sensitivities for all parameters p [0..np[ in natural order. NOTE: Resets initial state sensitivities. """ return _amici.ModelPtr_require_sensitivities_for_all_parameters(self) def get_observable_scaling(self, iy: int) -> int: """ Get scaling type for observable :param iy: observable index :return: scaling type """ return _amici.ModelPtr_get_observable_scaling(self, iy) def set_always_check_finite(self, alwaysCheck: bool): """ Set whether the result of every call to `Model::f*` should be checked for finiteness. :param alwaysCheck: """ return _amici.ModelPtr_set_always_check_finite(self, alwaysCheck) def get_always_check_finite(self) -> bool: """ Get setting of whether the result of every call to `Model::f*` should be checked for finiteness. :return: that """ return _amici.ModelPtr_get_always_check_finite(self) def set_reinitialization_state_idxs(self, idxs: Sequence[int]): """ Set indices of states to be reinitialized based on provided fixed parameters :param idxs: Array of state indices """ return _amici.ModelPtr_set_reinitialization_state_idxs(self, idxs) def get_reinitialization_state_idxs(self) -> Sequence[int]: """ Return indices of states to be reinitialized based on provided fixed parameters :return: Those indices. """ return _amici.ModelPtr_get_reinitialization_state_idxs(self) def get_trigger_timepoints(self) -> Sequence[float]: """ Get trigger times for events that don't require root-finding. To be called only after Model::initialize. The trigger times may change at events, see Model::reinit_explicit_roots. :return: List of unique trigger points for events that don't require root-finding (i.e. that trigger at predetermined timepoints), in ascending order. """ return _amici.ModelPtr_get_trigger_timepoints(self) def get_steadystate_mask(self) -> Sequence[float]: """ Get steady-state mask as std::vector. See `set_steadystate_mask` for details. :return: Steady-state mask """ return _amici.ModelPtr_get_steadystate_mask(self) def set_steadystate_mask(self, mask: Sequence[float]): """ Set steady-state mask. The mask is used to exclude certain state variables from the steady-state convergence check. Positive values indicate that the corresponding state variable should be included in the convergence check, while non-positive values indicate that the corresponding state variable should be excluded. An empty mask is interpreted as including all state variables. :param mask: Mask of length `nx_solver`. """ return _amici.ModelPtr_set_steadystate_mask(self, mask) def get_any_state_nonnegative(self) -> bool: """ Whether there is at least one state variable for which non-negativity is to be enforced. :return: Vector of all events. """ return _amici.ModelPtr_get_any_state_nonnegative(self) def get_id_list(self) -> Sequence[float]: """ Get flag array for DAE equations :return: Flag array for DAE equations """ return _amici.ModelPtr_get_id_list(self) def has_algebraic_states(self) -> bool: """ Check whether the model has algebraic states. :return: `true` if any state is algebraic (DAE models only) """ return _amici.ModelPtr_has_algebraic_states(self) def get_second_order_mode(self) -> int: """ Get second-order sensitivity mode. :return: Flag indicating whether for `SensitivityOrder::second` directional or full second order derivative will be computed """ return _amici.ModelPtr_get_second_order_mode(self) def create_solver(self) -> 'SolverPtr': """ Creates a solver instance to simulate this model. :return: The Solver instance """ return _amici.ModelPtr_create_solver(self) def get_amici_version(self) -> str: """ Returns the AMICI version that was used to generate the model :return: AMICI version string """ return _amici.ModelPtr_get_amici_version(self) def get_amici_commit(self) -> str: """ Returns the AMICI commit that was used to generate the model :return: AMICI commit string """ return _amici.ModelPtr_get_amici_commit(self) def is_fixed_parameter_state_reinitialization_allowed(self) -> bool: """ Function indicating whether reinitialization of states depending on fixed parameters is permissible :return: flag indicating whether reinitialization of states depending on fixed parameters is permissible """ return _amici.ModelPtr_is_fixed_parameter_state_reinitialization_allowed(self) def validate(self): """Validate dimensions.""" return _amici.ModelPtr_validate(self) nx_rdata = property(_amici.ModelPtr_nx_rdata_get, _amici.ModelPtr_nx_rdata_set, doc='Number of state variables') nxtrue_rdata = property(_amici.ModelPtr_nxtrue_rdata_get, _amici.ModelPtr_nxtrue_rdata_set, doc='Number of state variables in the unaugmented system') nx_solver = property(_amici.ModelPtr_nx_solver_get, _amici.ModelPtr_nx_solver_set, doc='Number of state variables with conservation laws applied') nxtrue_solver = property(_amici.ModelPtr_nxtrue_solver_get, _amici.ModelPtr_nxtrue_solver_set, doc='\n Number of state variables in the unaugmented system with conservation\n laws applied\n ') ny = property(_amici.ModelPtr_ny_get, _amici.ModelPtr_ny_set, doc='Number of observables') nytrue = property(_amici.ModelPtr_nytrue_get, _amici.ModelPtr_nytrue_set, doc='Number of observables in the unaugmented system') nz = property(_amici.ModelPtr_nz_get, _amici.ModelPtr_nz_set, doc='Number of event outputs') nztrue = property(_amici.ModelPtr_nztrue_get, _amici.ModelPtr_nztrue_set, doc='Number of event outputs in the unaugmented system') ne = property(_amici.ModelPtr_ne_get, _amici.ModelPtr_ne_set, doc='Number of events') ne_solver = property(_amici.ModelPtr_ne_solver_get, _amici.ModelPtr_ne_solver_set, doc='Number of events that require root-finding') nspl = property(_amici.ModelPtr_nspl_get, _amici.ModelPtr_nspl_set, doc='Number of spline functions in the model') nw = property(_amici.ModelPtr_nw_get, _amici.ModelPtr_nw_set, doc='Number of common expressions') ndwdx = property(_amici.ModelPtr_ndwdx_get, _amici.ModelPtr_ndwdx_set, doc='\n Number of nonzero elements in the `x` derivative of the\n repeating elements\n ') ndwdp = property(_amici.ModelPtr_ndwdp_get, _amici.ModelPtr_ndwdp_set, doc='\n Number of nonzero elements in the `p` derivative of the\n repeating elements\n ') ndwdw = property(_amici.ModelPtr_ndwdw_get, _amici.ModelPtr_ndwdw_set, doc='\n Number of nonzero elements in the `w` derivative of the\n repeating elements\n ') ndxdotdw = property(_amici.ModelPtr_ndxdotdw_get, _amici.ModelPtr_ndxdotdw_set, doc='Number of nonzero elements in the :math:`w` derivative of :math:`xdot`') ndJydy = property(_amici.ModelPtr_ndJydy_get, _amici.ModelPtr_ndJydy_set, doc='\n Number of nonzero elements in the :math:`y` derivative of\n :math:`dJy` (dimension `nytrue`)\n ') ndxrdatadxsolver = property(_amici.ModelPtr_ndxrdatadxsolver_get, _amici.ModelPtr_ndxrdatadxsolver_set, doc='Number of nonzero elements in the :math:`x` derivative of :math:`x\\_rdata`') ndxrdatadtcl = property(_amici.ModelPtr_ndxrdatadtcl_get, _amici.ModelPtr_ndxrdatadtcl_set, doc='Number of nonzero elements in the :math:`tcl` derivative of :math:`x\\_rdata`') ndtotal_cldx_rdata = property(_amici.ModelPtr_ndtotal_cldx_rdata_get, _amici.ModelPtr_ndtotal_cldx_rdata_set, doc='\n Number of nonzero elements in the :math:`x\\_rdata` derivative of\n :math:`total\\_cl`\n ') nnz = property(_amici.ModelPtr_nnz_get, _amici.ModelPtr_nnz_set, doc='Number of nonzero entries in Jacobian') nJ = property(_amici.ModelPtr_nJ_get, _amici.ModelPtr_nJ_set, doc='Dimension of the augmented objective function for 2nd order ASA') ubw = property(_amici.ModelPtr_ubw_get, _amici.ModelPtr_ubw_set, doc='Upper bandwidth of the Jacobian') lbw = property(_amici.ModelPtr_lbw_get, _amici.ModelPtr_lbw_set, doc='Lower bandwidth of the Jacobian') ndxdotdp_explicit = property(_amici.ModelPtr_ndxdotdp_explicit_get, _amici.ModelPtr_ndxdotdp_explicit_set, doc='Number of nonzero elements in `dxdotdp_explicit`') ndxdotdx_explicit = property(_amici.ModelPtr_ndxdotdx_explicit_get, _amici.ModelPtr_ndxdotdx_explicit_set, doc='Number of nonzero elements in `dxdotdx_explicit`') w_recursion_depth = property(_amici.ModelPtr_w_recursion_depth_get, _amici.ModelPtr_w_recursion_depth_set, doc='Recursion depth of fw')
_amici.ModelPtr_swigregister(ModelPtr)
[docs] class ExpDataPtr(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): _amici.ExpDataPtr_swiginit(self, _amici.new_ExpDataPtr(*args)) def __deref__(self): return _amici.ExpDataPtr___deref__(self) def release(self): return _amici.ExpDataPtr_release(self) def reset(self, *args): return _amici.ExpDataPtr_reset(self, *args) def swap(self, __u): return _amici.ExpDataPtr_swap(self, __u) def get(self): return _amici.ExpDataPtr_get(self) def __bool__(self): return _amici.ExpDataPtr___bool__(self) __swig_destroy__ = _amici.delete_ExpDataPtr def __repr__(self): return _edata_repr(self) def nytrue(self) -> int: """ number of observables of the non-augmented model :return: number of observables of the non-augmented model """ return _amici.ExpDataPtr_nytrue(self) def nztrue(self) -> int: """ number of event observables of the non-augmented model :return: number of event observables of the non-augmented model """ return _amici.ExpDataPtr_nztrue(self) def nmaxevent(self) -> int: """ maximal number of events to track :return: maximal number of events to track """ return _amici.ExpDataPtr_nmaxevent(self) def nt(self) -> int: """ number of timepoints :return: number of timepoints """ return _amici.ExpDataPtr_nt(self) def set_timepoints(self, ts: Sequence[float]): """ Set output ts. If the number of timepoint increases, this will grow the observation/sigma matrices and fill new entries with NaN. If the number of ts decreases, this will shrink the observation/sigma matrices. Note that the mapping from ts to measurements will not be preserved. E.g., say there are measurements at t = 2, and this function is called with [1, 2], then the old measurements will belong to t = 1. :param ts: ts """ return _amici.ExpDataPtr_set_timepoints(self, ts) def get_timepoints(self) -> Sequence[float]: """ Get output timepoints. :return: ExpData::ts """ return _amici.ExpDataPtr_get_timepoints(self) def get_timepoint(self, it: int) -> float: """ Get timepoint for a specific index. :param it: timepoint index :return: timepoint timepoint at index """ return _amici.ExpDataPtr_get_timepoint(self, it) def set_measurements(self, *args): """ *Overload 1:* Set all measurements. :type my: DoubleVector :param my: measurements (dimension: nt x nytrue, row-major) | *Overload 2:* Set measurements for a specific observable. :type my: DoubleVector :param my: measurements (dimension: nt) :type iy: int :param iy: observable index """ return _amici.ExpDataPtr_set_measurements(self, *args) def is_set_measurement(self, it: int, iy: int) -> bool: """ Check whether a measurement is defined at the given indices. :param it: time index :param iy: observable index :return: true if a value is set for the specified indices; otherwise false """ return _amici.ExpDataPtr_is_set_measurement(self, it, iy) def get_measurements(self) -> Sequence[float]: """ Get all measurements. :return: measurements (dimension: nt x nytrue, row-major) """ return _amici.ExpDataPtr_get_measurements(self) def set_noise_scales(self, *args): """ *Overload 1:* Set noise scales for all measurements. :type sigma: DoubleVector :param sigma: noise scales (dimension: nt x nytrue, row-major) | *Overload 2:* Set identical noise scales for all measurements. :type sigma: float :param sigma: noise scale (dimension: scalar) | *Overload 3:* Set measurement noise scales of for a observable. :type sigma: DoubleVector :param sigma: noise scales (dimension: nt) :type iy: int :param iy: observable index | *Overload 4:* Set all noise scales for a specific observable to the input value. :type sigma: float :param sigma: noise scale (dimension: scalar) :type iy: int :param iy: observable index """ return _amici.ExpDataPtr_set_noise_scales(self, *args) def is_set_noise_scale(self, it: int, iy: int) -> bool: """ Check whether a noise scale is defined at the given indices. :param it: time index :param iy: observable index :return: true if a value is set for the specified indices; otherwise false """ return _amici.ExpDataPtr_is_set_noise_scale(self, it, iy) def get_noise_scales(self) -> Sequence[float]: """ Get measurement noise scales. :return: noise scales of measurements """ return _amici.ExpDataPtr_get_noise_scales(self) def set_event_measurements(self, *args): """ *Overload 1:* Set event measurements. :type mz: DoubleVector :param mz: event measurements (dimension: nmaxevent x nztrue, row-major) | *Overload 2:* Set event measurements for a specific event observable. :type mz: DoubleVector :param mz: event measurements (dimension: nmaxevent) :type iz: int :param iz: event observable index """ return _amici.ExpDataPtr_set_event_measurements(self, *args) def is_set_event_measurement(self, ie: int, iz: int) -> bool: """ Check whether an event measurement is defined at the given indices. :param ie: event index :param iz: event observable index :return: true if a value is set for the specified indices; otherwise false """ return _amici.ExpDataPtr_is_set_event_measurement(self, ie, iz) def get_event_measurements(self) -> Sequence[float]: """ Get all event measurements. :return: event measurements """ return _amici.ExpDataPtr_get_event_measurements(self) def get_event_measurements_ptr(self, ie: int) -> float: """ Get pointer to event measurements at ie-th occurrence. :param ie: event occurrence :return: pointer to event measurements at ie-th occurrence """ return _amici.ExpDataPtr_get_event_measurements_ptr(self, ie) def set_event_noise_scales(self, *args): """ *Overload 1:* Set noise scales of event measurements. :type sigma: DoubleVector :param sigma: noise scales of event measurements | *Overload 2:* Set noise scales of all event measurements. :type sigma: float :param sigma: noise scale (dimension: scalar) | *Overload 3:* Set noise scales for a specific event observable. :type sigma: DoubleVector :param sigma: noise scales of observed data (dimension: nmaxevent) :type iz: int :param iz: event observable index | *Overload 4:* Set all noise scales for a specific event observable. :type sigma: float :param sigma: noise scale (dimension: scalar) :type iz: int :param iz: event observable index """ return _amici.ExpDataPtr_set_event_noise_scales(self, *args) def is_set_event_noise_scale(self, ie: int, iz: int) -> bool: """ Check whether an event noise scale is defined at the given indices. :param ie: event occurence :param iz: event observable index :return: true if a value is set for the specified indices; otherwise false """ return _amici.ExpDataPtr_is_set_event_noise_scale(self, ie, iz) def get_event_noise_scales(self) -> Sequence[float]: """ Get noise scale of observed event data. :return: noise scale of observed event data """ return _amici.ExpDataPtr_get_event_noise_scales(self) def get_event_noise_scales_ptr(self, ie: int) -> float: """ Get pointer to noise scale of observed event data at ie-th occurrence. :param ie: event occurrence :return: pointer to noise scale of observed event data at ie-th occurrence """ return _amici.ExpDataPtr_get_event_noise_scales_ptr(self, ie) def clear_observations(self): """ Set all observations and their noise scales to NaN. Useful, e.g., after calling ExpData::setTimepoints. """ return _amici.ExpDataPtr_clear_observations(self) id = property(_amici.ExpDataPtr_id_get, _amici.ExpDataPtr_id_set, doc='Arbitrary (not necessarily unique) identifier.') def reinitialize_all_fixed_parameter_dependent_initial_states_for_presimulation(self, nx_rdata: int): """ Set reinitialization of all states based on model constants for presimulation (only meaningful if preequilibration is performed). Convenience function to populate `reinitialization_state_idxs_presim` and `reinitialization_state_idxs_sim` :param nx_rdata: Number of states (Model::nx_rdata) """ return _amici.ExpDataPtr_reinitialize_all_fixed_parameter_dependent_initial_states_for_presimulation(self, nx_rdata) def reinitialize_all_fixed_parameter_dependent_initial_states_for_simulation(self, nx_rdata: int): """ Set reinitialization of all states based on model constants for the 'main' simulation (only meaningful if presimulation or preequilibration is performed). Convenience function to populate `reinitialization_state_idxs_presim` and `reinitialization_state_idxs_sim` :param nx_rdata: Number of states (Model::nx_rdata) """ return _amici.ExpDataPtr_reinitialize_all_fixed_parameter_dependent_initial_states_for_simulation(self, nx_rdata) def reinitialize_all_fixed_parameter_dependent_initial_states(self, nx_rdata: int): """ Set reinitialization of all states based on model constants for all simulation phases. Convenience function to populate `reinitialization_state_idxs_presim` and `reinitialization_state_idxs_sim` :param nx_rdata: Number of states (Model::nx_rdata) """ return _amici.ExpDataPtr_reinitialize_all_fixed_parameter_dependent_initial_states(self, nx_rdata) fixed_parameters = property(_amici.ExpDataPtr_fixed_parameters_get, _amici.ExpDataPtr_fixed_parameters_set, doc='\n Model constants\n\n Vector of size Model::nk() or empty\n ') fixed_parameters_pre_equilibration = property(_amici.ExpDataPtr_fixed_parameters_pre_equilibration_get, _amici.ExpDataPtr_fixed_parameters_pre_equilibration_set, doc='\n Model constants for pre-equilibration\n\n Vector of size Model::nk() or empty.\n ') fixed_parameters_presimulation = property(_amici.ExpDataPtr_fixed_parameters_presimulation_get, _amici.ExpDataPtr_fixed_parameters_presimulation_set, doc='\n Model constants for pre-simulation\n\n Vector of size Model::nk() or empty.\n ') free_parameters = property(_amici.ExpDataPtr_free_parameters_get, _amici.ExpDataPtr_free_parameters_set, doc='\n Model free_parameters\n\n Vector of size Model::np() or empty with parameter scaled according to\n SimulationParameter::pscale.\n ') x0 = property(_amici.ExpDataPtr_x0_get, _amici.ExpDataPtr_x0_set, doc='\n Initial state\n\n Vector of size Model::nx() or empty\n ') sx0 = property(_amici.ExpDataPtr_sx0_get, _amici.ExpDataPtr_sx0_set, doc='\n Initial state sensitivities\n\n Dimensions:\n Model::nx() * Model::nplist(), Model::nx() * ExpData::plist.size(), if\n ExpData::plist is not empty, or empty\n ') pscale = property(_amici.ExpDataPtr_pscale_get, _amici.ExpDataPtr_pscale_set, doc='\n Parameter scales\n\n Vector of parameter scale of size Model::np(), indicating how/if each\n parameter is to be scaled.\n ') plist = property(_amici.ExpDataPtr_plist_get, _amici.ExpDataPtr_plist_set, doc='Parameter indices w.r.t. which to compute sensitivities') t_start_preeq = property(_amici.ExpDataPtr_t_start_preeq_get, _amici.ExpDataPtr_t_start_preeq_set, doc='\n The initial time for pre-equilibration.\n\n NAN indicates that it is not set. Then, pre-equilibration starts at\n `t_start` (or at the deprecated Model::t0_preeq() if that is set).\n ') t_start = property(_amici.ExpDataPtr_t_start_get, _amici.ExpDataPtr_t_start_set, doc='\n Starting time of the simulation.\n\n Output timepoints are absolute timepoints, independent of\n :math:`t_{start}`.\n For output timepoints :math:`t < t_{start}`, the initial state will be\n returned.\n ') t_presim = property(_amici.ExpDataPtr_t_presim_get, _amici.ExpDataPtr_t_presim_set, doc='\n Duration of pre-simulation.\n\n If this is > 0, presimulation will be performed from\n (model->t0 - t_presim) to model->t0 using the fixed_parameters in\n fixed_parameters_presimulation\n ') timepoints = property(_amici.ExpDataPtr_timepoints_get, _amici.ExpDataPtr_timepoints_set, doc='\n Timepoints for which model state/outputs/... are requested\n\n Vector of timepoints.\n ') reinitialize_fixed_parameter_initial_states = property(_amici.ExpDataPtr_reinitialize_fixed_parameter_initial_states_get, _amici.ExpDataPtr_reinitialize_fixed_parameter_initial_states_set, doc='\n Flag indicating whether reinitialization of states depending on\n fixed parameters is activated\n ') reinitialization_state_idxs_presim = property(_amici.ExpDataPtr_reinitialization_state_idxs_presim_get, _amici.ExpDataPtr_reinitialization_state_idxs_presim_set, doc='\n Indices of states to be reinitialized based on provided\n presimulation constants / fixed parameters.\n ') reinitialization_state_idxs_sim = property(_amici.ExpDataPtr_reinitialization_state_idxs_sim_get, _amici.ExpDataPtr_reinitialization_state_idxs_sim_set, doc='\n Indices of states to be reinitialized based on provided\n constants / fixed parameters.\n ')
_amici.ExpDataPtr_swigregister(ExpDataPtr) M_E = _amici.M_E M_LOG2E = _amici.M_LOG2E M_LOG10E = _amici.M_LOG10E M_LN2 = _amici.M_LN2 M_LN10 = _amici.M_LN10 M_PI = _amici.M_PI M_PI_2 = _amici.M_PI_2 M_PI_4 = _amici.M_PI_4 M_1_PI = _amici.M_1_PI M_2_PI = _amici.M_2_PI M_2_SQRTPI = _amici.M_2_SQRTPI M_SQRT2 = _amici.M_SQRT2 M_SQRT1_2 = _amici.M_SQRT1_2 BLASTranspose_noTrans = _amici.BLASTranspose_noTrans BLASTranspose_trans = _amici.BLASTranspose_trans BLASTranspose_conjTrans = _amici.BLASTranspose_conjTrans ParameterScaling_none = _amici.ParameterScaling_none ParameterScaling_ln = _amici.ParameterScaling_ln ParameterScaling_log10 = _amici.ParameterScaling_log10 ObservableScaling_lin = _amici.ObservableScaling_lin ObservableScaling_log = _amici.ObservableScaling_log ObservableScaling_log10 = _amici.ObservableScaling_log10 SecondOrderMode_none = _amici.SecondOrderMode_none SecondOrderMode_full = _amici.SecondOrderMode_full SecondOrderMode_directional = _amici.SecondOrderMode_directional SensitivityOrder_none = _amici.SensitivityOrder_none "Don't compute sensitivities." SensitivityOrder_first = _amici.SensitivityOrder_first 'First-order sensitivities.' SensitivityOrder_second = _amici.SensitivityOrder_second 'Second-order sensitivities.' SensitivityMethod_none = _amici.SensitivityMethod_none "Don't compute sensitivities." SensitivityMethod_forward = _amici.SensitivityMethod_forward 'Forward sensitivity analysis.' SensitivityMethod_adjoint = _amici.SensitivityMethod_adjoint 'Adjoint sensitivity analysis.' LinearSolver_dense = _amici.LinearSolver_dense LinearSolver_band = _amici.LinearSolver_band LinearSolver_LAPACKDense = _amici.LinearSolver_LAPACKDense LinearSolver_LAPACKBand = _amici.LinearSolver_LAPACKBand LinearSolver_diag = _amici.LinearSolver_diag LinearSolver_SPGMR = _amici.LinearSolver_SPGMR LinearSolver_SPBCG = _amici.LinearSolver_SPBCG LinearSolver_SPTFQMR = _amici.LinearSolver_SPTFQMR LinearSolver_KLU = _amici.LinearSolver_KLU LinearSolver_SuperLUMT = _amici.LinearSolver_SuperLUMT InternalSensitivityMethod_simultaneous = _amici.InternalSensitivityMethod_simultaneous InternalSensitivityMethod_staggered = _amici.InternalSensitivityMethod_staggered InternalSensitivityMethod_staggered1 = _amici.InternalSensitivityMethod_staggered1 InterpolationType_hermite = _amici.InterpolationType_hermite InterpolationType_polynomial = _amici.InterpolationType_polynomial LinearMultistepMethod_adams = _amici.LinearMultistepMethod_adams LinearMultistepMethod_BDF = _amici.LinearMultistepMethod_BDF NonlinearSolverIteration_fixedpoint = _amici.NonlinearSolverIteration_fixedpoint NonlinearSolverIteration_newton = _amici.NonlinearSolverIteration_newton SteadyStateComputationMode_newtonOnly = _amici.SteadyStateComputationMode_newtonOnly SteadyStateComputationMode_integrationOnly = _amici.SteadyStateComputationMode_integrationOnly SteadyStateComputationMode_integrateIfNewtonFails = _amici.SteadyStateComputationMode_integrateIfNewtonFails SteadyStateSensitivityMode_newtonOnly = _amici.SteadyStateSensitivityMode_newtonOnly SteadyStateSensitivityMode_integrationOnly = _amici.SteadyStateSensitivityMode_integrationOnly SteadyStateSensitivityMode_integrateIfNewtonFails = _amici.SteadyStateSensitivityMode_integrateIfNewtonFails SteadyStateStatus_failed_too_long_simulation = _amici.SteadyStateStatus_failed_too_long_simulation SteadyStateStatus_failed_damping = _amici.SteadyStateStatus_failed_damping SteadyStateStatus_failed_factorization = _amici.SteadyStateStatus_failed_factorization SteadyStateStatus_failed_convergence = _amici.SteadyStateStatus_failed_convergence SteadyStateStatus_failed = _amici.SteadyStateStatus_failed SteadyStateStatus_not_run = _amici.SteadyStateStatus_not_run SteadyStateStatus_success = _amici.SteadyStateStatus_success NewtonDampingFactorMode_off = _amici.NewtonDampingFactorMode_off NewtonDampingFactorMode_on = _amici.NewtonDampingFactorMode_on FixedParameterContext_simulation = _amici.FixedParameterContext_simulation FixedParameterContext_preequilibration = _amici.FixedParameterContext_preequilibration FixedParameterContext_presimulation = _amici.FixedParameterContext_presimulation RDataReporting_full = _amici.RDataReporting_full RDataReporting_residuals = _amici.RDataReporting_residuals RDataReporting_likelihood = _amici.RDataReporting_likelihood RDataReporting_observables_likelihood = _amici.RDataReporting_observables_likelihood SplineBoundaryCondition_given = _amici.SplineBoundaryCondition_given SplineBoundaryCondition_zeroDerivative = _amici.SplineBoundaryCondition_zeroDerivative SplineBoundaryCondition_natural = _amici.SplineBoundaryCondition_natural SplineBoundaryCondition_naturalZeroDerivative = _amici.SplineBoundaryCondition_naturalZeroDerivative SplineBoundaryCondition_periodic = _amici.SplineBoundaryCondition_periodic SplineExtrapolation_noExtrapolation = _amici.SplineExtrapolation_noExtrapolation SplineExtrapolation_constant = _amici.SplineExtrapolation_constant SplineExtrapolation_linear = _amici.SplineExtrapolation_linear SplineExtrapolation_polynomial = _amici.SplineExtrapolation_polynomial SplineExtrapolation_periodic = _amici.SplineExtrapolation_periodic Constraint_none = _amici.Constraint_none Constraint_non_negative = _amici.Constraint_non_negative Constraint_non_positive = _amici.Constraint_non_positive Constraint_positive = _amici.Constraint_positive Constraint_negative = _amici.Constraint_negative
[docs] class ModelDimensions(object): """ Container for model dimensions. Holds number of state variables, observables, etc. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr
[docs] def validate(self): """Validate dimensions.""" return _amici.ModelDimensions_validate(self)
nx_rdata = property(_amici.ModelDimensions_nx_rdata_get, _amici.ModelDimensions_nx_rdata_set, doc='Number of state variables') nxtrue_rdata = property(_amici.ModelDimensions_nxtrue_rdata_get, _amici.ModelDimensions_nxtrue_rdata_set, doc='Number of state variables in the unaugmented system') nx_solver = property(_amici.ModelDimensions_nx_solver_get, _amici.ModelDimensions_nx_solver_set, doc='Number of state variables with conservation laws applied') nxtrue_solver = property(_amici.ModelDimensions_nxtrue_solver_get, _amici.ModelDimensions_nxtrue_solver_set, doc='\n Number of state variables in the unaugmented system with conservation\n laws applied\n ') nx_reinit = property(_amici.ModelDimensions_nx_reinit_get, _amici.ModelDimensions_nx_reinit_set, doc='Number of non-constant state variables subject to reinitialization') np = property(_amici.ModelDimensions_np_get, _amici.ModelDimensions_np_set, doc='Number of parameters') nk = property(_amici.ModelDimensions_nk_get, _amici.ModelDimensions_nk_set, doc='Number of constants') ny = property(_amici.ModelDimensions_ny_get, _amici.ModelDimensions_ny_set, doc='Number of observables') nytrue = property(_amici.ModelDimensions_nytrue_get, _amici.ModelDimensions_nytrue_set, doc='Number of observables in the unaugmented system') nz = property(_amici.ModelDimensions_nz_get, _amici.ModelDimensions_nz_set, doc='Number of event outputs') nztrue = property(_amici.ModelDimensions_nztrue_get, _amici.ModelDimensions_nztrue_set, doc='Number of event outputs in the unaugmented system') ne = property(_amici.ModelDimensions_ne_get, _amici.ModelDimensions_ne_set, doc='Number of events') ne_solver = property(_amici.ModelDimensions_ne_solver_get, _amici.ModelDimensions_ne_solver_set, doc='Number of events that require root-finding') nspl = property(_amici.ModelDimensions_nspl_get, _amici.ModelDimensions_nspl_set, doc='Number of spline functions in the model') nw = property(_amici.ModelDimensions_nw_get, _amici.ModelDimensions_nw_set, doc='Number of common expressions') ndwdx = property(_amici.ModelDimensions_ndwdx_get, _amici.ModelDimensions_ndwdx_set, doc='\n Number of nonzero elements in the `x` derivative of the\n repeating elements\n ') ndwdp = property(_amici.ModelDimensions_ndwdp_get, _amici.ModelDimensions_ndwdp_set, doc='\n Number of nonzero elements in the `p` derivative of the\n repeating elements\n ') ndwdw = property(_amici.ModelDimensions_ndwdw_get, _amici.ModelDimensions_ndwdw_set, doc='\n Number of nonzero elements in the `w` derivative of the\n repeating elements\n ') ndxdotdw = property(_amici.ModelDimensions_ndxdotdw_get, _amici.ModelDimensions_ndxdotdw_set, doc='Number of nonzero elements in the :math:`w` derivative of :math:`xdot`') ndJydy = property(_amici.ModelDimensions_ndJydy_get, _amici.ModelDimensions_ndJydy_set, doc='\n Number of nonzero elements in the :math:`y` derivative of\n :math:`dJy` (dimension `nytrue`)\n ') ndxrdatadxsolver = property(_amici.ModelDimensions_ndxrdatadxsolver_get, _amici.ModelDimensions_ndxrdatadxsolver_set, doc='Number of nonzero elements in the :math:`x` derivative of :math:`x\\_rdata`') ndxrdatadtcl = property(_amici.ModelDimensions_ndxrdatadtcl_get, _amici.ModelDimensions_ndxrdatadtcl_set, doc='Number of nonzero elements in the :math:`tcl` derivative of :math:`x\\_rdata`') ndtotal_cldx_rdata = property(_amici.ModelDimensions_ndtotal_cldx_rdata_get, _amici.ModelDimensions_ndtotal_cldx_rdata_set, doc='\n Number of nonzero elements in the :math:`x\\_rdata` derivative of\n :math:`total\\_cl`\n ') nnz = property(_amici.ModelDimensions_nnz_get, _amici.ModelDimensions_nnz_set, doc='Number of nonzero entries in Jacobian') nJ = property(_amici.ModelDimensions_nJ_get, _amici.ModelDimensions_nJ_set, doc='Dimension of the augmented objective function for 2nd order ASA') ubw = property(_amici.ModelDimensions_ubw_get, _amici.ModelDimensions_ubw_set, doc='Upper bandwidth of the Jacobian') lbw = property(_amici.ModelDimensions_lbw_get, _amici.ModelDimensions_lbw_set, doc='Lower bandwidth of the Jacobian') ndxdotdp_explicit = property(_amici.ModelDimensions_ndxdotdp_explicit_get, _amici.ModelDimensions_ndxdotdp_explicit_set, doc='Number of nonzero elements in `dxdotdp_explicit`') ndxdotdx_explicit = property(_amici.ModelDimensions_ndxdotdx_explicit_get, _amici.ModelDimensions_ndxdotdx_explicit_set, doc='Number of nonzero elements in `dxdotdx_explicit`') w_recursion_depth = property(_amici.ModelDimensions_w_recursion_depth_get, _amici.ModelDimensions_w_recursion_depth_set, doc='Recursion depth of fw')
[docs] def __init__(self): _amici.ModelDimensions_swiginit(self, _amici.new_ModelDimensions())
__swig_destroy__ = _amici.delete_ModelDimensions
_amici.ModelDimensions_swigregister(ModelDimensions) cvar = _amici.cvar pi = cvar.pi AMICI_WARNING = cvar.AMICI_WARNING AMICI_RECOVERABLE_ERROR = cvar.AMICI_RECOVERABLE_ERROR AMICI_UNRECOVERABLE_ERROR = cvar.AMICI_UNRECOVERABLE_ERROR AMICI_TOO_MUCH_WORK = cvar.AMICI_TOO_MUCH_WORK AMICI_TOO_MUCH_ACC = cvar.AMICI_TOO_MUCH_ACC AMICI_ERR_FAILURE = cvar.AMICI_ERR_FAILURE AMICI_CONV_FAILURE = cvar.AMICI_CONV_FAILURE AMICI_LSETUP_FAIL = cvar.AMICI_LSETUP_FAIL AMICI_RHSFUNC_FAIL = cvar.AMICI_RHSFUNC_FAIL AMICI_FIRST_RHSFUNC_ERR = cvar.AMICI_FIRST_RHSFUNC_ERR AMICI_RTFUNC_FAIL = cvar.AMICI_RTFUNC_FAIL AMICI_LINESEARCH_FAIL = cvar.AMICI_LINESEARCH_FAIL AMICI_CONSTR_FAIL = cvar.AMICI_CONSTR_FAIL AMICI_CVODES_CONSTR_FAIL = cvar.AMICI_CVODES_CONSTR_FAIL AMICI_IDAS_CONSTR_FAIL = cvar.AMICI_IDAS_CONSTR_FAIL AMICI_ILL_INPUT = cvar.AMICI_ILL_INPUT AMICI_BAD_T = cvar.AMICI_BAD_T AMICI_BAD_DKY = cvar.AMICI_BAD_DKY AMICI_FIRST_QRHSFUNC_ERR = cvar.AMICI_FIRST_QRHSFUNC_ERR AMICI_SRHSFUNC_FAIL = cvar.AMICI_SRHSFUNC_FAIL AMICI_FIRST_SRHSFUNC_ERR = cvar.AMICI_FIRST_SRHSFUNC_ERR AMICI_REPTD_SRHSFUNC_ERR = cvar.AMICI_REPTD_SRHSFUNC_ERR AMICI_UNREC_SRHSFUNC_ERR = cvar.AMICI_UNREC_SRHSFUNC_ERR AMICI_ERROR = cvar.AMICI_ERROR AMICI_NO_STEADY_STATE = cvar.AMICI_NO_STEADY_STATE AMICI_DAMPING_FACTOR_ERROR = cvar.AMICI_DAMPING_FACTOR_ERROR AMICI_SINGULAR_JACOBIAN = cvar.AMICI_SINGULAR_JACOBIAN AMICI_NOT_IMPLEMENTED = cvar.AMICI_NOT_IMPLEMENTED AMICI_MAX_TIME_EXCEEDED = cvar.AMICI_MAX_TIME_EXCEEDED AMICI_NOT_RUN = cvar.AMICI_NOT_RUN AMICI_T_OVERFLOW = cvar.AMICI_T_OVERFLOW AMICI_SUCCESS = cvar.AMICI_SUCCESS AMICI_DATA_RETURN = cvar.AMICI_DATA_RETURN AMICI_ROOT_RETURN = cvar.AMICI_ROOT_RETURN AMICI_NORMAL = cvar.AMICI_NORMAL AMICI_ONE_STEP = cvar.AMICI_ONE_STEP AMICI_PREEQUILIBRATE = cvar.AMICI_PREEQUILIBRATE
[docs] class SimulationParameters(object): """Container for various simulation parameters.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr
[docs] def __init__(self, *args): """ *Overload 1:* Constructor :type timepoints: DoubleVector :param timepoints: Timepoints for which simulation results are requested | *Overload 2:* Constructor :type fixed_parameters: DoubleVector :param fixed_parameters: Model parameters excluded from sensitivity analysis :type free_parameters: DoubleVector :param free_parameters: Model parameters included in sensitivity analysis """ _amici.SimulationParameters_swiginit(self, _amici.new_SimulationParameters(*args))
[docs] def reinitialize_all_fixed_parameter_dependent_initial_states_for_presimulation(self, nx_rdata: int): """ Set reinitialization of all states based on model constants for presimulation (only meaningful if preequilibration is performed). Convenience function to populate `reinitialization_state_idxs_presim` and `reinitialization_state_idxs_sim` :param nx_rdata: Number of states (Model::nx_rdata) """ return _amici.SimulationParameters_reinitialize_all_fixed_parameter_dependent_initial_states_for_presimulation(self, nx_rdata)
[docs] def reinitialize_all_fixed_parameter_dependent_initial_states_for_simulation(self, nx_rdata: int): """ Set reinitialization of all states based on model constants for the 'main' simulation (only meaningful if presimulation or preequilibration is performed). Convenience function to populate `reinitialization_state_idxs_presim` and `reinitialization_state_idxs_sim` :param nx_rdata: Number of states (Model::nx_rdata) """ return _amici.SimulationParameters_reinitialize_all_fixed_parameter_dependent_initial_states_for_simulation(self, nx_rdata)
[docs] def reinitialize_all_fixed_parameter_dependent_initial_states(self, nx_rdata: int): """ Set reinitialization of all states based on model constants for all simulation phases. Convenience function to populate `reinitialization_state_idxs_presim` and `reinitialization_state_idxs_sim` :param nx_rdata: Number of states (Model::nx_rdata) """ return _amici.SimulationParameters_reinitialize_all_fixed_parameter_dependent_initial_states(self, nx_rdata)
fixed_parameters = property(_amici.SimulationParameters_fixed_parameters_get, _amici.SimulationParameters_fixed_parameters_set, doc='\n Model constants\n\n Vector of size Model::nk() or empty\n ') fixed_parameters_pre_equilibration = property(_amici.SimulationParameters_fixed_parameters_pre_equilibration_get, _amici.SimulationParameters_fixed_parameters_pre_equilibration_set, doc='\n Model constants for pre-equilibration\n\n Vector of size Model::nk() or empty.\n ') fixed_parameters_presimulation = property(_amici.SimulationParameters_fixed_parameters_presimulation_get, _amici.SimulationParameters_fixed_parameters_presimulation_set, doc='\n Model constants for pre-simulation\n\n Vector of size Model::nk() or empty.\n ') free_parameters = property(_amici.SimulationParameters_free_parameters_get, _amici.SimulationParameters_free_parameters_set, doc='\n Model free_parameters\n\n Vector of size Model::np() or empty with parameter scaled according to\n SimulationParameter::pscale.\n ') x0 = property(_amici.SimulationParameters_x0_get, _amici.SimulationParameters_x0_set, doc='\n Initial state\n\n Vector of size Model::nx() or empty\n ') sx0 = property(_amici.SimulationParameters_sx0_get, _amici.SimulationParameters_sx0_set, doc='\n Initial state sensitivities\n\n Dimensions:\n Model::nx() * Model::nplist(), Model::nx() * ExpData::plist.size(), if\n ExpData::plist is not empty, or empty\n ') pscale = property(_amici.SimulationParameters_pscale_get, _amici.SimulationParameters_pscale_set, doc='\n Parameter scales\n\n Vector of parameter scale of size Model::np(), indicating how/if each\n parameter is to be scaled.\n ') plist = property(_amici.SimulationParameters_plist_get, _amici.SimulationParameters_plist_set, doc='Parameter indices w.r.t. which to compute sensitivities') t_start_preeq = property(_amici.SimulationParameters_t_start_preeq_get, _amici.SimulationParameters_t_start_preeq_set, doc='\n The initial time for pre-equilibration.\n\n NAN indicates that it is not set. Then, pre-equilibration starts at\n `t_start` (or at the deprecated Model::t0_preeq() if that is set).\n ') t_start = property(_amici.SimulationParameters_t_start_get, _amici.SimulationParameters_t_start_set, doc='\n Starting time of the simulation.\n\n Output timepoints are absolute timepoints, independent of\n :math:`t_{start}`.\n For output timepoints :math:`t < t_{start}`, the initial state will be\n returned.\n ') t_presim = property(_amici.SimulationParameters_t_presim_get, _amici.SimulationParameters_t_presim_set, doc='\n Duration of pre-simulation.\n\n If this is > 0, presimulation will be performed from\n (model->t0 - t_presim) to model->t0 using the fixed_parameters in\n fixed_parameters_presimulation\n ') timepoints = property(_amici.SimulationParameters_timepoints_get, _amici.SimulationParameters_timepoints_set, doc='\n Timepoints for which model state/outputs/... are requested\n\n Vector of timepoints.\n ') reinitialize_fixed_parameter_initial_states = property(_amici.SimulationParameters_reinitialize_fixed_parameter_initial_states_get, _amici.SimulationParameters_reinitialize_fixed_parameter_initial_states_set, doc='\n Flag indicating whether reinitialization of states depending on\n fixed parameters is activated\n ') reinitialization_state_idxs_presim = property(_amici.SimulationParameters_reinitialization_state_idxs_presim_get, _amici.SimulationParameters_reinitialization_state_idxs_presim_set, doc='\n Indices of states to be reinitialized based on provided\n presimulation constants / fixed parameters.\n ') reinitialization_state_idxs_sim = property(_amici.SimulationParameters_reinitialization_state_idxs_sim_get, _amici.SimulationParameters_reinitialization_state_idxs_sim_set, doc='\n Indices of states to be reinitialized based on provided\n constants / fixed parameters.\n ') def __iter__(self): for attr_name in dir(self): if not attr_name.startswith('_') and attr_name not in ('this', 'thisown') and (not callable((attr_val := getattr(self, attr_name)))): if isinstance(attr_val, (DoubleVector, ParameterScalingVector)): yield (attr_name, tuple(attr_val)) else: yield (attr_name, attr_val) __swig_destroy__ = _amici.delete_SimulationParameters
_amici.SimulationParameters_swigregister(SimulationParameters) class AbstractModel(object): """ Abstract base class of amici::Model defining functions that need to be implemented in an AMICI model. Some functions have empty default implementations or throw. This class shall not have any data members. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError('No constructor defined - class is abstract') __repr__ = _swig_repr __swig_destroy__ = _amici.delete_AbstractModel def create_solver(self) -> 'SolverPtr': """ Creates a solver instance to simulate this model. :return: The Solver instance """ return _amici.AbstractModel_create_solver(self) def get_amici_version(self) -> str: """ Returns the AMICI version that was used to generate the model :return: AMICI version string """ return _amici.AbstractModel_get_amici_version(self) def get_amici_commit(self) -> str: """ Returns the AMICI commit that was used to generate the model :return: AMICI commit string """ return _amici.AbstractModel_get_amici_commit(self) def is_fixed_parameter_state_reinitialization_allowed(self) -> bool: """ Function indicating whether reinitialization of states depending on fixed parameters is permissible :return: flag indicating whether reinitialization of states depending on fixed parameters is permissible """ return _amici.AbstractModel_is_fixed_parameter_state_reinitialization_allowed(self) _amici.AbstractModel_swigregister(AbstractModel)
[docs] def unscale_parameter(scaledParameter: float, scaling: int) -> float: """ Remove parameter scaling according to `scaling` :param scaledParameter: scaled parameter :param scaling: parameter scaling :return: Unscaled parameter """ return _amici.unscale_parameter(scaledParameter, scaling)
[docs] def scale_parameter(unscaledParameter: float, scaling: int) -> float: """ Apply parameter scaling according to `scaling` :param unscaledParameter: :param scaling: parameter scaling :return: Scaled parameter """ return _amici.scale_parameter(unscaledParameter, scaling)
[docs] def get_backtrace_string(maxFrames: int, first_frame: int=0) -> str: """ Returns the current backtrace as std::string :param maxFrames: Number of frames to include :param first_frame: Index of first frame to include :return: Backtrace """ return _amici.get_backtrace_string(maxFrames, first_frame)
[docs] class CpuTimer(object): """ Tracks elapsed CPU time of the calling thread. On platforms without a precise per-thread CPU clock, such as Windows, this uses std::clock instead, which tracks the CPU time of the whole process, or on Windows, the wall time (see CpuTimer::uses_thread_clock). """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr
[docs] def __init__(self): """Constructor""" _amici.CpuTimer_swiginit(self, _amici.new_CpuTimer())
[docs] def reset(self): """Reset the timer""" return _amici.CpuTimer_reset(self)
[docs] def elapsed_seconds(self) -> float: """ Get elapsed CPU time in seconds since initialization or last reset :return: CPU time in seconds """ return _amici.CpuTimer_elapsed_seconds(self)
[docs] def elapsed_milliseconds(self) -> float: """ Get elapsed CPU time in milliseconds since initialization or last reset :return: CPU time in milliseconds """ return _amici.CpuTimer_elapsed_milliseconds(self)
__swig_destroy__ = _amici.delete_CpuTimer
_amici.CpuTimer_swigregister(CpuTimer) CpuTimer.uses_thread_clock = _amici.cvar.CpuTimer_uses_thread_clock def _edata_repr(self: ExpData): n_data_y = sum((self.is_set_measurement(it, iy) for it in range(self.nt()) for iy in range(self.nytrue()))) n_sigma_y = sum((self.is_set_noise_scale(it, iy) for it in range(self.nt()) for iy in range(self.nytrue()))) n_data_z = sum((self.is_set_event_measurement(ie, iz) for ie in range(self.nmaxevent()) for iz in range(self.nztrue()))) n_sigma_z = sum((self.is_set_event_noise_scale(ie, iz) for ie in range(self.nmaxevent()) for iz in range(self.nztrue()))) custom_simulation_settings = [] if self.pscale: custom_simulation_settings.append(f'parameter scales') if self.fixed_parameters: custom_simulation_settings.append(f'fixed parameters') if self.fixed_parameters_pre_equilibration: custom_simulation_settings.append(f'pre-equilibration condition') if self.t_presim: tmp = f'pre-simulation condition (t={self.t_presim})' if self.fixed_parameters_presimulation: tmp += ' with custom fixed parameters' custom_simulation_settings.append(tmp) if self.reinitialize_fixed_parameter_initial_states and self.reinitialization_state_idxs_sim: custom_simulation_settings.append(f'{len(self.reinitialization_state_idxs_sim)} reinitialized states (simulation)') if self.reinitialize_fixed_parameter_initial_states and self.reinitialization_state_idxs_presim: custom_simulation_settings.append(f'{len(self.reinitialization_state_idxs_presim)} reinitialized states (presimulation)') if self.free_parameters: custom_simulation_settings.append(f'free parameters') if self.x0: custom_simulation_settings.append(f'initial states') if self.sx0: custom_simulation_settings.append(f'initial state sensitivities') if custom_simulation_settings: custom_simulation_settings = ' with custom ' + ', '.join(custom_simulation_settings) else: custom_simulation_settings = ' without custom settings' return '\n'.join([self.this.__repr__()[:-1], f" condition '{self.id}' starting at t={self.t_start}" + custom_simulation_settings, f' {self.nt()}x{self.nytrue()} time-resolved datapoints', f' ({n_data_y}/{self.nt() * self.nytrue()} measurements & {n_sigma_y}/{self.nt() * self.nytrue()} sigmas set)', f' {self.nmaxevent()}x{self.nztrue()} event-resolved datapoints', f' ({n_data_z}/{self.nmaxevent() * self.nztrue()} measurements & {n_sigma_z}/{self.nmaxevent() * self.nztrue()} sigmas set)', '>'])
[docs] class ExpData(SimulationParameters): """ ExpData carries all information about experimental or condition-specific data. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr
[docs] def __init__(self, *args): """ *Overload 1:* Default constructor. | *Overload 2:* Copy constructor. | *Overload 3:* Constructor that only initializes dimensions. :type nytrue: int :param nytrue: Number of observables :type nztrue: int :param nztrue: Number of event outputs :type nmaxevent: int :param nmaxevent: Maximal number of events to track | *Overload 4:* constructor that initializes timepoints from vectors :type nytrue: int :param nytrue: Number of observables :type nztrue: int :param nztrue: Number of event outputs :type nmaxevent: int :param nmaxevent: Maximal number of events to track :type ts: DoubleVector :param ts: Timepoints (dimension: nt) | *Overload 5:* constructor that initializes timepoints and fixed parameters from vectors :type nytrue: int :param nytrue: Number of observables :type nztrue: int :param nztrue: Number of event outputs :type nmaxevent: int :param nmaxevent: Maximal number of events to track :type ts: DoubleVector :param ts: Timepoints (dimension: nt) :type fixed_parameters: DoubleVector :param fixed_parameters: Model variables excluded from sensitivity analysis (dimension: nk) | *Overload 6:* constructor that initializes timepoints and data from vectors :type nytrue: int :param nytrue: Number of observables :type nztrue: int :param nztrue: Number of event outputs :type nmaxevent: int :param nmaxevent: Maximal number of events to track :type ts: DoubleVector :param ts: Timepoints (dimension: nt) :type my: DoubleVector :param my: measurements (dimension: nt x nytrue, row-major) :type sigma_y: DoubleVector :param sigma_y: noise scale of measurements (dimension: nt x nytrue, row-major) :type mz: DoubleVector :param mz: event measurements (dimension: nmaxevents x nztrue, row-major) :type sigma_z: DoubleVector :param sigma_z: noise scale of event measurements (dimension: nmaxevents x nztrue, row-major) | *Overload 7:* constructor that initializes with Model :type model: :py:class:`Model` :param model: pointer to model specification object | *Overload 8:* Constructor that initializes with ReturnData, adds normally distributed noise according to specified sigmas. :type rdata: :py:class:`ReturnData` :param rdata: return data pointer with stored simulation results :type sigma_y: float :param sigma_y: scalar noise scales for all observables :type sigma_z: float :param sigma_z: scalar noise scales for all event observables :type seed: int, optional :param seed: Seed for the random number generator. If a negative number is passed, a random seed is used. | *Overload 9:* Constructor that initializes with ReturnData, adds normally distributed noise according to specified sigmas. :type rdata: :py:class:`ReturnData` :param rdata: return data pointer with stored simulation results :type sigma_y: float :param sigma_y: scalar noise scales for all observables :type sigma_z: float :param sigma_z: scalar noise scales for all event observables :param seed: Seed for the random number generator. If a negative number is passed, a random seed is used. | *Overload 10:* Constructor that initializes with ReturnData, adds normally distributed noise according to specified sigmas. :type rdata: :py:class:`ReturnData` :param rdata: return data pointer with stored simulation results :type sigma_y: DoubleVector :param sigma_y: vector of noise scales for observables (dimension: nytrue or nt x nytrue, row-major) :type sigma_z: DoubleVector :param sigma_z: vector of noise scales for event observables (dimension: nztrue or nmaxevent x nztrue, row-major) :type seed: int, optional :param seed: Seed for the random number generator. If a negative number is passed, a random seed is used. | *Overload 11:* Constructor that initializes with ReturnData, adds normally distributed noise according to specified sigmas. :type rdata: :py:class:`ReturnData` :param rdata: return data pointer with stored simulation results :type sigma_y: DoubleVector :param sigma_y: vector of noise scales for observables (dimension: nytrue or nt x nytrue, row-major) :type sigma_z: DoubleVector :param sigma_z: vector of noise scales for event observables (dimension: nztrue or nmaxevent x nztrue, row-major) :param seed: Seed for the random number generator. If a negative number is passed, a random seed is used. """ '\n Convenience wrapper for :py:class:`amici.amici.ExpData` constructors\n\n :param args: arguments\n\n :returns: ExpData Instance\n ' if args: from amici.sim.sundials._numpy import ReturnDataView if isinstance(args[0], (ExpData, ExpDataPtr, Model, ModelPtr)): args = (_get_ptr(args[0]), *args[1:]) elif isinstance(args[0], ReturnDataView): args = (_get_ptr(args[0]['ptr']), *args[1:]) _amici.ExpData_swiginit(self, _amici.new_ExpData(*args))
__swig_destroy__ = _amici.delete_ExpData
[docs] def nytrue(self) -> int: """ number of observables of the non-augmented model :return: number of observables of the non-augmented model """ return _amici.ExpData_nytrue(self)
[docs] def nztrue(self) -> int: """ number of event observables of the non-augmented model :return: number of event observables of the non-augmented model """ return _amici.ExpData_nztrue(self)
[docs] def nmaxevent(self) -> int: """ maximal number of events to track :return: maximal number of events to track """ return _amici.ExpData_nmaxevent(self)
[docs] def nt(self) -> int: """ number of timepoints :return: number of timepoints """ return _amici.ExpData_nt(self)
[docs] def set_timepoints(self, ts: Sequence[float]): """ Set output ts. If the number of timepoint increases, this will grow the observation/sigma matrices and fill new entries with NaN. If the number of ts decreases, this will shrink the observation/sigma matrices. Note that the mapping from ts to measurements will not be preserved. E.g., say there are measurements at t = 2, and this function is called with [1, 2], then the old measurements will belong to t = 1. :param ts: ts """ return _amici.ExpData_set_timepoints(self, ts)
[docs] def get_timepoints(self) -> Sequence[float]: """ Get output timepoints. :return: ExpData::ts """ return _amici.ExpData_get_timepoints(self)
[docs] def get_timepoint(self, it: int) -> float: """ Get timepoint for a specific index. :param it: timepoint index :return: timepoint timepoint at index """ return _amici.ExpData_get_timepoint(self, it)
[docs] def set_measurements(self, *args): """ *Overload 1:* Set all measurements. :type my: DoubleVector :param my: measurements (dimension: nt x nytrue, row-major) | *Overload 2:* Set measurements for a specific observable. :type my: DoubleVector :param my: measurements (dimension: nt) :type iy: int :param iy: observable index """ return _amici.ExpData_set_measurements(self, *args)
[docs] def is_set_measurement(self, it: int, iy: int) -> bool: """ Check whether a measurement is defined at the given indices. :param it: time index :param iy: observable index :return: true if a value is set for the specified indices; otherwise false """ return _amici.ExpData_is_set_measurement(self, it, iy)
[docs] def get_measurements(self) -> Sequence[float]: """ Get all measurements. :return: measurements (dimension: nt x nytrue, row-major) """ return _amici.ExpData_get_measurements(self)
[docs] def set_noise_scales(self, *args): """ *Overload 1:* Set noise scales for all measurements. :type sigma: DoubleVector :param sigma: noise scales (dimension: nt x nytrue, row-major) | *Overload 2:* Set identical noise scales for all measurements. :type sigma: float :param sigma: noise scale (dimension: scalar) | *Overload 3:* Set measurement noise scales of for a observable. :type sigma: DoubleVector :param sigma: noise scales (dimension: nt) :type iy: int :param iy: observable index | *Overload 4:* Set all noise scales for a specific observable to the input value. :type sigma: float :param sigma: noise scale (dimension: scalar) :type iy: int :param iy: observable index """ return _amici.ExpData_set_noise_scales(self, *args)
[docs] def is_set_noise_scale(self, it: int, iy: int) -> bool: """ Check whether a noise scale is defined at the given indices. :param it: time index :param iy: observable index :return: true if a value is set for the specified indices; otherwise false """ return _amici.ExpData_is_set_noise_scale(self, it, iy)
[docs] def get_noise_scales(self) -> Sequence[float]: """ Get measurement noise scales. :return: noise scales of measurements """ return _amici.ExpData_get_noise_scales(self)
[docs] def set_event_measurements(self, *args): """ *Overload 1:* Set event measurements. :type mz: DoubleVector :param mz: event measurements (dimension: nmaxevent x nztrue, row-major) | *Overload 2:* Set event measurements for a specific event observable. :type mz: DoubleVector :param mz: event measurements (dimension: nmaxevent) :type iz: int :param iz: event observable index """ return _amici.ExpData_set_event_measurements(self, *args)
[docs] def is_set_event_measurement(self, ie: int, iz: int) -> bool: """ Check whether an event measurement is defined at the given indices. :param ie: event index :param iz: event observable index :return: true if a value is set for the specified indices; otherwise false """ return _amici.ExpData_is_set_event_measurement(self, ie, iz)
[docs] def get_event_measurements(self) -> Sequence[float]: """ Get all event measurements. :return: event measurements """ return _amici.ExpData_get_event_measurements(self)
[docs] def get_event_measurements_ptr(self, ie: int) -> float: """ Get pointer to event measurements at ie-th occurrence. :param ie: event occurrence :return: pointer to event measurements at ie-th occurrence """ return _amici.ExpData_get_event_measurements_ptr(self, ie)
[docs] def set_event_noise_scales(self, *args): """ *Overload 1:* Set noise scales of event measurements. :type sigma: DoubleVector :param sigma: noise scales of event measurements | *Overload 2:* Set noise scales of all event measurements. :type sigma: float :param sigma: noise scale (dimension: scalar) | *Overload 3:* Set noise scales for a specific event observable. :type sigma: DoubleVector :param sigma: noise scales of observed data (dimension: nmaxevent) :type iz: int :param iz: event observable index | *Overload 4:* Set all noise scales for a specific event observable. :type sigma: float :param sigma: noise scale (dimension: scalar) :type iz: int :param iz: event observable index """ return _amici.ExpData_set_event_noise_scales(self, *args)
[docs] def is_set_event_noise_scale(self, ie: int, iz: int) -> bool: """ Check whether an event noise scale is defined at the given indices. :param ie: event occurence :param iz: event observable index :return: true if a value is set for the specified indices; otherwise false """ return _amici.ExpData_is_set_event_noise_scale(self, ie, iz)
[docs] def get_event_noise_scales(self) -> Sequence[float]: """ Get noise scale of observed event data. :return: noise scale of observed event data """ return _amici.ExpData_get_event_noise_scales(self)
[docs] def get_event_noise_scales_ptr(self, ie: int) -> float: """ Get pointer to noise scale of observed event data at ie-th occurrence. :param ie: event occurrence :return: pointer to noise scale of observed event data at ie-th occurrence """ return _amici.ExpData_get_event_noise_scales_ptr(self, ie)
[docs] def clear_observations(self): """ Set all observations and their noise scales to NaN. Useful, e.g., after calling ExpData::setTimepoints. """ return _amici.ExpData_clear_observations(self)
id = property(_amici.ExpData_id_get, _amici.ExpData_id_set, doc='Arbitrary (not necessarily unique) identifier.') def __repr__(self): return _edata_repr(self) def __eq__(self, other): return other.__class__ == self.__class__ and __eq__(self, other) def __deepcopy__(self, memo): return type(self)(self) def __reduce__(self): from amici.sim.sundials._swig_wrappers import restore_edata return (restore_edata, ((self.nytrue(), self.nztrue(), self.nmaxevent(), self.get_timepoints(), self.get_measurements(), self.get_noise_scales(), self.get_event_measurements(), self.get_event_noise_scales()), dict(self)), {})
_amici.ExpData_swigregister(ExpData) def _solver_repr(self: Solver): return '\n'.join([self.this.__repr__()[:-1], f' reporting_mode: {RDataReporting(self.get_return_data_reporting_mode())!r}', f' sens_meth: {SensitivityMethod(self.get_sensitivity_method())!r}', f' sens_order: {SensitivityOrder(self.get_sensitivity_order())!r}', f' sens_meth_preeq: {SensitivityMethod(self.get_sensitivity_method_pre_equilibration())!r}', f' maxsteps: {self.get_max_steps()}', f' maxtime: {self.get_max_time()}s', f' abs_tol: {self.get_absolute_tolerance()}', f' rel_tol: {self.get_relative_tolerance()}', f' abs_tol_b: {self.get_absolute_tolerance_b()}', f' rel_tol_b: {self.get_relative_tolerance_b()}', f' abs_tol_fsa: {self.get_absolute_tolerance_fsa()}', f' rel_tol_fsa: {self.get_relative_tolerance_fsa()}', f' abs_tol_quad: {self.get_absolute_tolerance_quadratures()}', f' rel_tol_quad: {self.get_relative_tolerance_quadratures()}', f' abs_tol_ss: {self.get_absolute_tolerance_steady_state()}', f' rel_tol_ss: {self.get_relative_tolerance_steady_state()}', f' abs_tol_sss: {self.get_absolute_tolerance_steady_state_sensi()}', f' rel_tol_sss: {self.get_relative_tolerance_steady_state_sensi()}', f' int_sens_meth: {InternalSensitivityMethod(self.get_internal_sensitivity_method())!r}', f' int_type: {InterpolationType(self.get_interpolation_type())!r}', f' linsol: {LinearSolver(self.get_linear_solver())!r}', f' lmm: {LinearMultistepMethod(self.get_linear_multistep_method())!r}', f' newton_damp_mode: {NewtonDampingFactorMode(self.get_newton_damping_factor_mode())!r}', f' newton_damp_lb: {self.get_newton_damping_factor_lower_bound()}', f' newton_maxsteps: {self.get_newton_max_steps()}', f' newton_ss_check: {self.get_newton_step_steady_state_check()}', f' sens_ss_check: {self.get_sensi_steady_state_check()}', f' interpolation_type: {InterpolationType(self.get_interpolation_type())!r}', f' nlsol_iter: {NonlinearSolverIteration(self.get_non_linear_solver_iteration())!r}', f' stability_limit: {self.get_stability_limit_flag()}', f' state_ordering: {self.get_state_ordering()}', '>']) def _solver_reduce(self: Solver): """Pickle a solver via its settings (see `get_solver_settings`).""" from amici.sim.sundials._swig_wrappers import get_solver_settings, restore_solver return (restore_solver, (self.__class__, self.get_class_name(), get_solver_settings(self)))
[docs] class Solver(object): """ The Solver class provides a generic interface to CVODES and IDAS solvers, individual realizations are realized in the CVodeSolver and the IDASolver class. All transient private/protected members (CVODES/IDAS memory, interface variables and status flags) are specified as mutable and not included in serialization or equality checks. No solver setting parameter should be marked mutable. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
[docs] def __init__(self, *args, **kwargs): raise AttributeError('No constructor defined - class is abstract')
__repr__ = _swig_repr __swig_destroy__ = _amici.delete_Solver
[docs] def clone(self) -> Solver: """ Clone this instance :return: The clone """ return _amici.Solver_clone(self)
[docs] def get_class_name(self) -> str: """ Get the name of this class. :return: Class name. """ return _amici.Solver_get_class_name(self)
[docs] def get_sensitivity_method(self) -> SensitivityMethod: """ Return current sensitivity method :return: method enum """ return _amici.Solver_get_sensitivity_method(self)
[docs] def set_sensitivity_method(self, sensi_meth: SensitivityMethod): """ Set sensitivity method :param sensi_meth: """ return _amici.Solver_set_sensitivity_method(self, sensi_meth)
[docs] def get_sensitivity_method_pre_equilibration(self) -> SensitivityMethod: """ Return current sensitivity method during preequilibration :return: method enum """ return _amici.Solver_get_sensitivity_method_pre_equilibration(self)
[docs] def set_sensitivity_method_pre_equilibration(self, sensi_meth_preeq: SensitivityMethod): """ Set sensitivity method for preequilibration :param sensi_meth_preeq: """ return _amici.Solver_set_sensitivity_method_pre_equilibration(self, sensi_meth_preeq)
[docs] def get_newton_max_steps(self) -> int: """ Get maximum number of allowed Newton steps for steady state computation :return: """ return _amici.Solver_get_newton_max_steps(self)
[docs] def set_newton_max_steps(self, newton_maxsteps: int): """ Set maximum number of allowed Newton steps for steady state computation :param newton_maxsteps: """ return _amici.Solver_set_newton_max_steps(self, newton_maxsteps)
[docs] def get_newton_damping_factor_mode(self) -> NewtonDampingFactorMode: """ Get a state of the damping factor used in the Newton solver :return: """ return _amici.Solver_get_newton_damping_factor_mode(self)
[docs] def set_newton_damping_factor_mode(self, dampingFactorMode: NewtonDampingFactorMode): """ Turn on/off a damping factor in the Newton method :param dampingFactorMode: """ return _amici.Solver_set_newton_damping_factor_mode(self, dampingFactorMode)
[docs] def get_newton_damping_factor_lower_bound(self) -> float: """ Get a lower bound of the damping factor used in the Newton solver :return: """ return _amici.Solver_get_newton_damping_factor_lower_bound(self)
[docs] def set_newton_damping_factor_lower_bound(self, dampingFactorLowerBound: float): """ Set a lower bound of the damping factor in the Newton solver :param dampingFactorLowerBound: """ return _amici.Solver_set_newton_damping_factor_lower_bound(self, dampingFactorLowerBound)
[docs] def get_sensitivity_order(self) -> SensitivityOrder: """ Get sensitivity order :return: sensitivity order """ return _amici.Solver_get_sensitivity_order(self)
[docs] def set_sensitivity_order(self, sensi: SensitivityOrder): """ Set the sensitivity order :param sensi: sensitivity order """ return _amici.Solver_set_sensitivity_order(self, sensi)
[docs] def get_relative_tolerance(self) -> float: """ Get the relative tolerances for the forward problem Same tolerance is used for the backward problem if not specified differently via 'Solver::set_relative_tolerance_b'. :return: relative tolerances """ return _amici.Solver_get_relative_tolerance(self)
[docs] def set_relative_tolerance(self, rtol: float): """ Sets the relative tolerances for the forward problem Same tolerance is used for the backward problem if not specified differently via 'Solver::set_relative_tolerance_b'. :param rtol: relative tolerance (non-negative number) """ return _amici.Solver_set_relative_tolerance(self, rtol)
[docs] def get_absolute_tolerance(self) -> float: """ Get the absolute tolerances for the forward problem Same tolerance is used for the backward problem if not specified differently via 'Solver::set_absolute_tolerance_b'. :return: absolute tolerances """ return _amici.Solver_get_absolute_tolerance(self)
[docs] def set_absolute_tolerance(self, atol: float): """ Sets the absolute tolerances for the forward problem Same tolerance is used for the backward problem if not specified differently via 'Solver::set_absolute_tolerance_b'. :param atol: absolute tolerance (non-negative number) """ return _amici.Solver_set_absolute_tolerance(self, atol)
[docs] def get_relative_tolerance_fsa(self) -> float: """ Returns the relative tolerances for the forward sensitivity problem :return: relative tolerances """ return _amici.Solver_get_relative_tolerance_fsa(self)
[docs] def set_relative_tolerance_fsa(self, rtol: float): """ Sets the relative tolerances for the forward sensitivity problem :param rtol: relative tolerance (non-negative number) """ return _amici.Solver_set_relative_tolerance_fsa(self, rtol)
[docs] def get_absolute_tolerance_fsa(self) -> float: """ Returns the absolute tolerances for the forward sensitivity problem :return: absolute tolerances """ return _amici.Solver_get_absolute_tolerance_fsa(self)
[docs] def set_absolute_tolerance_fsa(self, atol: float): """ Sets the absolute tolerances for the forward sensitivity problem :param atol: absolute tolerance (non-negative number) """ return _amici.Solver_set_absolute_tolerance_fsa(self, atol)
[docs] def get_relative_tolerance_b(self) -> float: """ Returns the relative tolerances for the adjoint sensitivity problem :return: relative tolerances """ return _amici.Solver_get_relative_tolerance_b(self)
[docs] def set_relative_tolerance_b(self, rtol: float): """ Sets the relative tolerances for the adjoint sensitivity problem :param rtol: relative tolerance (non-negative number) """ return _amici.Solver_set_relative_tolerance_b(self, rtol)
[docs] def get_absolute_tolerance_b(self) -> float: """ Returns the absolute tolerances for the backward problem for adjoint sensitivity analysis :return: absolute tolerances """ return _amici.Solver_get_absolute_tolerance_b(self)
[docs] def set_absolute_tolerance_b(self, atol: float): """ Sets the absolute tolerances for the backward problem for adjoint sensitivity analysis :param atol: absolute tolerance (non-negative number) """ return _amici.Solver_set_absolute_tolerance_b(self, atol)
[docs] def get_relative_tolerance_quadratures(self) -> float: """ Returns the relative tolerance for the quadrature problem :return: relative tolerance """ return _amici.Solver_get_relative_tolerance_quadratures(self)
[docs] def set_relative_tolerance_quadratures(self, rtol: float): """ sets the relative tolerance for the quadrature problem :param rtol: relative tolerance (non-negative number) """ return _amici.Solver_set_relative_tolerance_quadratures(self, rtol)
[docs] def get_absolute_tolerance_quadratures(self) -> float: """ returns the absolute tolerance for the quadrature problem :return: absolute tolerance """ return _amici.Solver_get_absolute_tolerance_quadratures(self)
[docs] def set_absolute_tolerance_quadratures(self, atol: float): """ sets the absolute tolerance for the quadrature problem :param atol: absolute tolerance (non-negative number) """ return _amici.Solver_set_absolute_tolerance_quadratures(self, atol)
[docs] def get_steady_state_tolerance_factor(self) -> float: """ returns the steady state simulation tolerance factor. Steady state simulation tolerances are the product of the simulation tolerances and this factor, unless manually set with `set_relative_tolerance_steady_state()` / `set_absolute_tolerance_steady_state()`. :return: steady state simulation tolerance factor """ return _amici.Solver_get_steady_state_tolerance_factor(self)
[docs] def set_steady_state_tolerance_factor(self, factor: float): """ set the steady state simulation tolerance factor. Steady state simulation tolerances are the product of the simulation tolerances and this factor, unless manually set with `set_relative_tolerance_steady_state()` / `set_absolute_tolerance_steady_state()`. :param factor: tolerance factor (non-negative number) """ return _amici.Solver_set_steady_state_tolerance_factor(self, factor)
[docs] def get_relative_tolerance_steady_state(self) -> float: """ returns the relative tolerance for the steady state problem :return: relative tolerance """ return _amici.Solver_get_relative_tolerance_steady_state(self)
[docs] def set_relative_tolerance_steady_state(self, rtol: float): """ sets the relative tolerance for the steady state problem :param rtol: relative tolerance (non-negative number) """ return _amici.Solver_set_relative_tolerance_steady_state(self, rtol)
[docs] def get_absolute_tolerance_steady_state(self) -> float: """ returns the absolute tolerance for the steady state problem :return: absolute tolerance """ return _amici.Solver_get_absolute_tolerance_steady_state(self)
[docs] def set_absolute_tolerance_steady_state(self, atol: float): """ sets the absolute tolerance for the steady state problem :param atol: absolute tolerance (non-negative number) """ return _amici.Solver_set_absolute_tolerance_steady_state(self, atol)
[docs] def get_steady_state_sensi_tolerance_factor(self) -> float: """ returns the steady state sensitivity simulation tolerance factor. Steady state sensitivity simulation tolerances are the product of the sensitivity simulation tolerances and this factor, unless manually set with `set_{absolute,relative}_tolerance_steady_state_sensi()`. :return: steady state simulation tolerance factor """ return _amici.Solver_get_steady_state_sensi_tolerance_factor(self)
[docs] def set_steady_state_sensi_tolerance_factor(self, factor: float): """ set the steady state sensitivity simulation tolerance factor. Steady state sensitivity simulation tolerances are the product of the sensitivity simulation tolerances and this factor, unless manually set with `set_{absolute,relative}_tolerance_steady_state_sensi()`. :param factor: tolerance factor (non-negative number) """ return _amici.Solver_set_steady_state_sensi_tolerance_factor(self, factor)
[docs] def get_relative_tolerance_steady_state_sensi(self) -> float: """ returns the relative tolerance for the sensitivities of the steady state problem :return: relative tolerance """ return _amici.Solver_get_relative_tolerance_steady_state_sensi(self)
[docs] def set_relative_tolerance_steady_state_sensi(self, rtol: float): """ sets the relative tolerance for the sensitivities of the steady state problem :param rtol: relative tolerance (non-negative number) """ return _amici.Solver_set_relative_tolerance_steady_state_sensi(self, rtol)
[docs] def get_absolute_tolerance_steady_state_sensi(self) -> float: """ returns the absolute tolerance for the sensitivities of the steady state problem :return: absolute tolerance """ return _amici.Solver_get_absolute_tolerance_steady_state_sensi(self)
[docs] def set_absolute_tolerance_steady_state_sensi(self, atol: float): """ sets the absolute tolerance for the sensitivities of the steady state problem :param atol: absolute tolerance (non-negative number) """ return _amici.Solver_set_absolute_tolerance_steady_state_sensi(self, atol)
[docs] def get_max_steps(self) -> int: """ returns the maximum number of solver steps for the forward problem :return: maximum number of solver steps """ return _amici.Solver_get_max_steps(self)
[docs] def set_max_steps(self, maxsteps: int): """ sets the maximum number of solver steps for the forward problem :param maxsteps: maximum number of solver steps (positive number) """ return _amici.Solver_set_max_steps(self, maxsteps)
[docs] def get_max_time(self) -> float: """ Returns the maximum time allowed for integration :return: Time in seconds """ return _amici.Solver_get_max_time(self)
[docs] def set_max_time(self, maxtime: float): """ Set the maximum CPU time allowed for integration :param maxtime: Time in seconds. Zero means infinite time. """ return _amici.Solver_set_max_time(self, maxtime)
[docs] def get_max_steps_backward_problem(self) -> int: """ returns the maximum number of solver steps for the backward problem :return: maximum number of solver steps """ return _amici.Solver_get_max_steps_backward_problem(self)
[docs] def set_max_steps_backward_problem(self, maxsteps: int): """ sets the maximum number of solver steps for the backward problem :param maxsteps: maximum number of solver steps (non-negative number) Notes: default behaviour (100 times the value for the forward problem) can be restored by passing maxsteps=0 """ return _amici.Solver_set_max_steps_backward_problem(self, maxsteps)
[docs] def get_linear_multistep_method(self) -> LinearMultistepMethod: """ returns the linear system multistep method :return: linear system multistep method """ return _amici.Solver_get_linear_multistep_method(self)
[docs] def set_linear_multistep_method(self, lmm: LinearMultistepMethod): """ sets the linear system multistep method :param lmm: linear system multistep method """ return _amici.Solver_set_linear_multistep_method(self, lmm)
[docs] def get_non_linear_solver_iteration(self) -> NonlinearSolverIteration: """ returns the nonlinear system solution method :return: """ return _amici.Solver_get_non_linear_solver_iteration(self)
[docs] def set_non_linear_solver_iteration(self, iter: NonlinearSolverIteration): """ sets the nonlinear system solution method :param iter: nonlinear system solution method """ return _amici.Solver_set_non_linear_solver_iteration(self, iter)
[docs] def get_interpolation_type(self) -> InterpolationType: """ get_interpolation_type :return: """ return _amici.Solver_get_interpolation_type(self)
[docs] def set_interpolation_type(self, interpType: InterpolationType): """ sets the interpolation of the forward solution that is used for the backwards problem :param interpType: interpolation type """ return _amici.Solver_set_interpolation_type(self, interpType)
[docs] def get_state_ordering(self) -> int: """ Gets KLU / SuperLUMT state ordering mode :return: State-ordering as integer according to `SUNLinSolKLU::StateOrdering` or `SUNLinSolSuperLUMT::StateOrdering` (which differ). """ return _amici.Solver_get_state_ordering(self)
[docs] def set_state_ordering(self, ordering: int): """ Sets KLU / SuperLUMT state ordering mode This only applies when the linear solver is set to `LinearSolver::KLU` or `LinearSolver::SuperLUMT`. Mind the difference between `SUNLinSolKLU::StateOrdering` and `SUNLinSolSuperLUMT::StateOrdering`. :param ordering: state ordering """ return _amici.Solver_set_state_ordering(self, ordering)
[docs] def get_stability_limit_flag(self) -> bool: """ returns stability limit detection mode :return: stldet can be false (deactivated) or true (activated) """ return _amici.Solver_get_stability_limit_flag(self)
[docs] def set_stability_limit_flag(self, stldet: bool): """ set stability limit detection mode :param stldet: can be false (deactivated) or true (activated) """ return _amici.Solver_set_stability_limit_flag(self, stldet)
[docs] def get_linear_solver(self) -> LinearSolver: """ get_linear_solver :return: """ return _amici.Solver_get_linear_solver(self)
[docs] def set_linear_solver(self, linsol: LinearSolver): """ set_linear_solver :param linsol: """ return _amici.Solver_set_linear_solver(self, linsol)
[docs] def get_internal_sensitivity_method(self) -> InternalSensitivityMethod: """ returns the internal sensitivity method :return: internal sensitivity method """ return _amici.Solver_get_internal_sensitivity_method(self)
[docs] def set_internal_sensitivity_method(self, ism: InternalSensitivityMethod): """ sets the internal sensitivity method `InternalSensitivityMethod::staggered1` is only supported by CVODES. :param ism: internal sensitivity method """ return _amici.Solver_set_internal_sensitivity_method(self, ism)
[docs] def get_return_data_reporting_mode(self) -> RDataReporting: """ returns the ReturnData reporting mode :return: ReturnData reporting mode """ return _amici.Solver_get_return_data_reporting_mode(self)
[docs] def set_return_data_reporting_mode(self, rdrm: RDataReporting): """ sets the ReturnData reporting mode :param rdrm: ReturnData reporting mode """ return _amici.Solver_set_return_data_reporting_mode(self, rdrm)
[docs] def ignore_roots_after_reinit(self, root_directions: Sequence[int]): """ Records the roots of the discontinuity just handled. This information allows recognizing a spurious re-detection of exactly the same root, immediately following reinit(). :param root_directions: per-root bitmask of the crossing directions (see root_direction_bit()) seen during the discontinuity just handled, whether or not they triggered a state update """ return _amici.Solver_ignore_roots_after_reinit(self, root_directions)
[docs] @staticmethod def root_direction_bit(direction: int) -> int: """ Bit representing a root crossing direction. Used for the per-root bitmasks passed to ignore_roots_after_reinit(), where the same root may have crossed in both directions within one discontinuity, e.g. when an event assignment moves the state back across the event's own trigger. :param direction: root direction as reported by the solver (1: up-crossing, -1: down-crossing, 0: no crossing) :return: 1 for an up-crossing, 2 for a down-crossing, 0 otherwise """ return _amici.Solver_root_direction_bit(direction)
[docs] def nx(self) -> int: """ number of state variables with which the solver was initialized :return: Number of solver state variables. """ return _amici.Solver_nx(self)
[docs] def nplist(self) -> int: """ number of parameters with which the solver was initialized :return: Number of parameters w.r.t. which sensitivities are computed. """ return _amici.Solver_nplist(self)
[docs] def nquad(self) -> int: """ number of quadratures with which the solver was initialized :return: Number of quadratures with which the solver was initialized. """ return _amici.Solver_nquad(self)
[docs] def computing_fsa(self) -> bool: """ check if FSA is being computed :return: flag """ return _amici.Solver_computing_fsa(self)
[docs] def computing_asa(self) -> bool: """ check if ASA is being computed :return: flag """ return _amici.Solver_computing_asa(self)
[docs] def get_newton_step_steady_state_check(self) -> bool: """ Returns how convergence checks for steadystate computation are performed. If activated, convergence checks are limited to every 25 steps in the simulation solver to limit performance impact. :return: boolean flag indicating newton step (true) or the right hand side (false) """ return _amici.Solver_get_newton_step_steady_state_check(self)
[docs] def get_sensi_steady_state_check(self) -> bool: """ Returns how convergence checks for steadystate computation are performed. :return: boolean flag indicating state and sensitivity equations (true) or only state variables (false). """ return _amici.Solver_get_sensi_steady_state_check(self)
[docs] def set_newton_step_steady_state_check(self, flag: bool): """ Sets how convergence checks for steadystate computation are performed. :param flag: boolean flag to pick newton step (true) or the right hand side (false, default) """ return _amici.Solver_set_newton_step_steady_state_check(self, flag)
[docs] def set_sensi_steady_state_check(self, flag: bool): """ Sets for which variables convergence checks for steadystate computation are performed. :param flag: boolean flag to pick state and sensitivity equations (true, default) or only state variables (false). """ return _amici.Solver_set_sensi_steady_state_check(self, flag)
[docs] def set_max_nonlin_iters(self, max_nonlin_iters: int): """ Set the maximum number of nonlinear solver iterations permitted per step. :param max_nonlin_iters: maximum number of nonlinear solver iterations """ return _amici.Solver_set_max_nonlin_iters(self, max_nonlin_iters)
[docs] def get_max_nonlin_iters(self) -> int: """ Get the maximum number of nonlinear solver iterations permitted per step. :return: maximum number of nonlinear solver iterations """ return _amici.Solver_get_max_nonlin_iters(self)
[docs] def set_max_conv_fails(self, max_conv_fails: int): """ Set the maximum number of nonlinear solver convergence failures permitted per step. :param max_conv_fails: maximum number of nonlinear solver convergence """ return _amici.Solver_set_max_conv_fails(self, max_conv_fails)
[docs] def get_max_conv_fails(self) -> int: """ Get the maximum number of nonlinear solver convergence failures permitted per step. :return: maximum number of nonlinear solver convergence """ return _amici.Solver_get_max_conv_fails(self)
[docs] def set_constraints(self, constraints: Sequence[float]): """ Set constraints on the model state. See https://sundials.readthedocs.io/en/latest/cvode/Usage/index.html#c.CVodeSetConstraints. :param constraints: """ return _amici.Solver_set_constraints(self, constraints)
[docs] def get_constraints(self) -> Sequence[float]: """ Get constraints on the model state. :return: constraints """ return _amici.Solver_get_constraints(self)
[docs] def set_max_step_size(self, max_step_size: float): """ Set the maximum step size :param max_step_size: maximum step size. `0.0` means no limit. """ return _amici.Solver_set_max_step_size(self, max_step_size)
[docs] def get_max_step_size(self) -> float: """ Get the maximum step size :return: maximum step size """ return _amici.Solver_get_max_step_size(self)
def __deepcopy__(self, memo): return self.clone() def __reduce__(self): return _solver_reduce(self)
_amici.Solver_swigregister(Solver) class IDASolver(Solver): """The IDASolver class is a wrapper around the SUNDIALS IDAS solver.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr __swig_destroy__ = _amici.delete_IDASolver def clone(self) -> Solver: """ Clone this instance :return: The clone """ return _amici.IDASolver_clone(self) def get_class_name(self): return _amici.IDASolver_get_class_name(self) def set_internal_sensitivity_method(self, ism: InternalSensitivityMethod): """ sets the internal sensitivity method :param ism: internal sensitivity method :raises: AmiException for `InternalSensitivityMethod::staggered1`, which is not supported by IDAS """ return _amici.IDASolver_set_internal_sensitivity_method(self, ism) def set_stop_time(self, tstop): return _amici.IDASolver_set_stop_time(self, tstop) def get_model(self): return _amici.IDASolver_get_model(self) def set_linear_solver(self, *args): """ set_linear_solver :type linsol: LinearSolver :param linsol: """ return _amici.IDASolver_set_linear_solver(self, *args) def set_linear_solver_b(self, which): return _amici.IDASolver_set_linear_solver_b(self, which) def set_non_linear_solver(self): return _amici.IDASolver_set_non_linear_solver(self) def set_non_linear_solver_sens(self): return _amici.IDASolver_set_non_linear_solver_sens(self) def set_non_linear_solver_b(self, which): return _amici.IDASolver_set_non_linear_solver_b(self, which) def __repr__(self): return _solver_repr(self) def __reduce__(self): return _solver_reduce(self) def __init__(self, *args): _amici.IDASolver_swiginit(self, _amici.new_IDASolver(*args)) _amici.IDASolver_swigregister(IDASolver) class CVodeSolver(Solver): """The CVodeSolver class is a wrapper around the SUNDIALS CVODES solver.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr __swig_destroy__ = _amici.delete_CVodeSolver def clone(self) -> Solver: """ Clone this instance :return: The clone """ return _amici.CVodeSolver_clone(self) def get_class_name(self): return _amici.CVodeSolver_get_class_name(self) def set_stop_time(self, tstop): return _amici.CVodeSolver_set_stop_time(self, tstop) def get_model(self): return _amici.CVodeSolver_get_model(self) def set_linear_solver(self, *args): """ set_linear_solver :type linsol: LinearSolver :param linsol: """ return _amici.CVodeSolver_set_linear_solver(self, *args) def set_linear_solver_b(self, which): return _amici.CVodeSolver_set_linear_solver_b(self, which) def set_non_linear_solver(self): return _amici.CVodeSolver_set_non_linear_solver(self) def set_non_linear_solver_sens(self): return _amici.CVodeSolver_set_non_linear_solver_sens(self) def set_non_linear_solver_b(self, which): return _amici.CVodeSolver_set_non_linear_solver_b(self, which) def __repr__(self): return _solver_repr(self) def __reduce__(self): return _solver_reduce(self) def __init__(self, *args): _amici.CVodeSolver_swiginit(self, _amici.new_CVodeSolver(*args)) _amici.CVodeSolver_swigregister(CVodeSolver) def _model_clone_impl(self): clone = self._cpp_model_clone() try: clone.module = self.module except Exception: pass return clone def _model_reduce_impl(self): from amici.sim.sundials._swig_wrappers import restore_model, get_model_settings, file_checksum return (restore_model, (self.get_name(), Path(self.module.__spec__.origin).parent, get_model_settings(self), file_checksum(self.module.extension_path)), {}) def _model_simulate_impl(self, *, solver=None, edata=None, failfast=True, num_threads=1, sensi_method=None, sensi_order=None): from amici.sim.sundials._swig_wrappers import _Model__simulate return _Model__simulate(self, solver=solver, edata=edata, failfast=failfast, num_threads=num_threads, sensi_method=sensi_method, sensi_order=sensi_order)
[docs] class Model(AbstractModel, ModelDimensions): """ The Model class represents an AMICI ODE/DAE model. The model can compute various model related quantities based on symbolically generated code. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
[docs] def __init__(self, *args, **kwargs): raise AttributeError('No constructor defined - class is abstract')
__repr__ = _swig_repr __swig_destroy__ = _amici.delete_Model def _cpp_model_clone(self) -> Model: """ Clone this instance. :return: The clone """ return _amici.Model__cpp_model_clone(self)
[docs] def nplist(self) -> int: """ Get number of parameters wrt to which sensitivities are computed. :return: Length of sensitivity index vector """ return _amici.Model_nplist(self)
[docs] def np(self) -> int: """ Get total number of model parameters. :return: Length of parameter vector """ return _amici.Model_np(self)
[docs] def nk(self) -> int: """ Get number of fixed parameters. :return: Number of fixed parameters. """ return _amici.Model_nk(self)
[docs] def ncl(self) -> int: """ Get number of conservation laws. :return: Number of conservation laws (i.e., difference between `nx_rdata` and `nx_solver`). """ return _amici.Model_ncl(self)
[docs] def nx_reinit(self) -> int: """ Get number of non-constant states subject to reinitialization. :return: Model member `nx_reinit` """ return _amici.Model_nx_reinit(self)
[docs] def k(self) -> float: """ Get fixed parameters. :return: Pointer to constants array """ return _amici.Model_k(self)
[docs] def n_max_event(self) -> int: """ Get maximum number of events that may occur for each type. :return: Maximum number of events that may occur for each type """ return _amici.Model_n_max_event(self)
[docs] def set_n_max_event(self, nmaxevent: int): """ Set maximum number of events that may occur for each type. :param nmaxevent: Maximum number of events that may occur for each type """ return _amici.Model_set_n_max_event(self, nmaxevent)
[docs] def nt(self) -> int: """ Get number of timepoints. :return: Number of timepoints """ return _amici.Model_nt(self)
[docs] def get_parameter_scale(self) -> ParameterScalingVector: """ Get parameter scale for each parameter. :return: Vector of parameter scales """ return _amici.Model_get_parameter_scale(self)
[docs] def get_unscaled_parameters(self) -> Sequence[float]: """ Get parameters with transformation according to parameter scale applied. :return: Unscaled parameters """ return _amici.Model_get_unscaled_parameters(self)
[docs] def get_free_parameters(self) -> Sequence[float]: """ Get parameter vector. :return: The user-set parameters (see also `Model::getUnscaledParameters`) """ return _amici.Model_get_free_parameters(self)
[docs] def get_free_parameter_by_id(self, par_id: str) -> float: """ Get value of first model parameter with the specified ID. :param par_id: Parameter ID :return: Parameter value """ return _amici.Model_get_free_parameter_by_id(self, par_id)
[docs] def get_free_parameter_by_name(self, par_name: str) -> float: """ Get value of first model parameter with the specified name. :param par_name: Parameter name :return: Parameter value """ return _amici.Model_get_free_parameter_by_name(self, par_name)
[docs] def set_free_parameters(self, p: Sequence[float]): """ Set the parameter vector. :param p: Vector of parameters """ return _amici.Model_set_free_parameters(self, p)
[docs] def set_free_parameter_by_id(self, *args): """ *Overload 1:* Set model parameters according to the parameter IDs and mapped values. :type p: StringDoubleMap :param p: Map of parameters IDs and values :type ignoreErrors: boolean, optional :param ignoreErrors: Ignore errors such as parameter IDs in p which are not model parameters | *Overload 2:* Set value of first model parameter with the specified ID. :type par_id: str :param par_id: Parameter ID :type value: float :param value: Parameter value """ return _amici.Model_set_free_parameter_by_id(self, *args)
[docs] def set_free_parameters_by_id_regex(self, par_id_regex: str, value: float) -> int: """ Set all values of model parameters with IDs matching the specified regular expression. :param par_id_regex: Parameter ID regex :param value: Parameter value :return: Number of parameter IDs that matched the regex """ return _amici.Model_set_free_parameters_by_id_regex(self, par_id_regex, value)
[docs] def set_free_parameter_by_name(self, *args): """ *Overload 1:* Set value of first model parameter with the specified name. :type par_name: str :param par_name: Parameter name :type value: float :param value: Parameter value | *Overload 2:* Set model parameters according to the parameter name and mapped values. :type p: StringDoubleMap :param p: Map of parameters names and values :type ignoreErrors: boolean, optional :param ignoreErrors: Ignore errors such as parameter names in p which are not model parameters | *Overload 3:* Set model parameters according to the parameter name and mapped values. :type p: StringDoubleMap :param p: Map of parameters names and values :param ignoreErrors: Ignore errors such as parameter names in p which are not model parameters """ return _amici.Model_set_free_parameter_by_name(self, *args)
[docs] def set_free_parameters_by_name_regex(self, par_name_regex: str, value: float) -> int: """ Set all values of all model parameters with names matching the specified regex. :param par_name_regex: Parameter name regex :param value: Parameter value :return: Number of fixed parameter names that matched the regex """ return _amici.Model_set_free_parameters_by_name_regex(self, par_name_regex, value)
[docs] def get_fixed_parameters(self) -> Sequence[float]: """ Get values of fixed parameters. :return: Vector of fixed parameters with same ordering as in Model::getFixedParameterIds """ return _amici.Model_get_fixed_parameters(self)
[docs] def get_fixed_parameter_by_id(self, par_id: str) -> float: """ Get value of fixed parameter with the specified ID. :param par_id: Parameter ID :return: Parameter value """ return _amici.Model_get_fixed_parameter_by_id(self, par_id)
[docs] def get_fixed_parameter_by_name(self, par_name: str) -> float: """ Get value of fixed parameter with the specified name. If multiple parameters have the same name, the first parameter with matching name is returned. :param par_name: Parameter name :return: Parameter value """ return _amici.Model_get_fixed_parameter_by_name(self, par_name)
[docs] def set_fixed_parameters(self, k: Sequence[float]): """ Set values for constants. :param k: Vector of fixed parameters """ return _amici.Model_set_fixed_parameters(self, k)
[docs] def set_fixed_parameter_by_id(self, par_id: str, value: float): """ Set value of first fixed parameter with the specified ID. :param par_id: Fixed parameter id :param value: Fixed parameter value """ return _amici.Model_set_fixed_parameter_by_id(self, par_id, value)
[docs] def set_fixed_parameters_by_id_regex(self, par_id_regex: str, value: float) -> int: """ Set values of all fixed parameters with the ID matching the specified regex. :param par_id_regex: Fixed parameter name regex :param value: Fixed parameter value :return: Number of fixed parameter IDs that matched the regex """ return _amici.Model_set_fixed_parameters_by_id_regex(self, par_id_regex, value)
[docs] def set_fixed_parameter_by_name(self, par_name: str, value: float): """ Set value of first fixed parameter with the specified name. :param par_name: Fixed parameter ID :param value: Fixed parameter value """ return _amici.Model_set_fixed_parameter_by_name(self, par_name, value)
[docs] def set_fixed_parameters_by_name_regex(self, par_name_regex: str, value: float) -> int: """ Set value of all fixed parameters with name matching the specified regex. :param par_name_regex: Fixed parameter name regex :param value: Fixed parameter value :return: Number of fixed parameter names that matched the regex """ return _amici.Model_set_fixed_parameters_by_name_regex(self, par_name_regex, value)
[docs] def get_name(self) -> str: """ Get the model name. :return: Model name """ return _amici.Model_get_name(self)
[docs] def has_free_parameter_names(self) -> bool: """ Report whether the model has free parameter names set. :return: Boolean indicating whether free parameter names were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.Model_has_free_parameter_names(self)
[docs] def get_free_parameter_names(self) -> Sequence[str]: """ Get names of the free model parameters. :return: The parameter names """ return _amici.Model_get_free_parameter_names(self)
[docs] def has_state_names(self) -> bool: """ Report whether the model has state names set. :return: Boolean indicating whether state names were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.Model_has_state_names(self)
[docs] def get_state_names(self) -> Sequence[str]: """ Get names of the model states. :return: State names """ return _amici.Model_get_state_names(self)
[docs] def get_state_names_solver(self) -> Sequence[str]: """ Get names of the solver states. :return: State names """ return _amici.Model_get_state_names_solver(self)
[docs] def has_fixed_parameter_names(self) -> bool: """ Report whether the model has fixed parameter names set. :return: Boolean indicating whether fixed parameter names were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.Model_has_fixed_parameter_names(self)
[docs] def get_fixed_parameter_names(self) -> Sequence[str]: """ Get names of the fixed model parameters. :return: Fixed parameter names """ return _amici.Model_get_fixed_parameter_names(self)
[docs] def has_observable_names(self) -> bool: """ Report whether the model has observable names set. :return: Boolean indicating whether observable names were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.Model_has_observable_names(self)
[docs] def get_observable_names(self) -> Sequence[str]: """ Get names of the observables. :return: Observable names """ return _amici.Model_get_observable_names(self)
[docs] def has_expression_names(self) -> bool: """ Report whether the model has expression names set. :return: Boolean indicating whether expression names were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.Model_has_expression_names(self)
[docs] def get_expression_names(self) -> Sequence[str]: """ Get names of the expressions. :return: Expression names """ return _amici.Model_get_expression_names(self)
[docs] def has_free_parameter_ids(self) -> bool: """ Report whether the model has parameter IDs set. :return: Boolean indicating whether parameter IDs were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.Model_has_free_parameter_ids(self)
[docs] def get_free_parameter_ids(self) -> Sequence[str]: """ Get IDs of the model parameters. :return: Parameter IDs """ return _amici.Model_get_free_parameter_ids(self)
[docs] def has_state_ids(self) -> bool: """ Report whether the model has state IDs set. :return: Boolean indicating whether state IDs were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.Model_has_state_ids(self)
[docs] def get_state_ids(self) -> Sequence[str]: """ Get IDs of the model states. :return: State IDs """ return _amici.Model_get_state_ids(self)
[docs] def get_state_ids_solver(self) -> Sequence[str]: """ Get IDs of the solver states. :return: State IDs """ return _amici.Model_get_state_ids_solver(self)
[docs] def has_fixed_parameter_ids(self) -> bool: """ Report whether the model has fixed parameter IDs set. :return: Boolean indicating whether fixed parameter IDs were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.Model_has_fixed_parameter_ids(self)
[docs] def get_fixed_parameter_ids(self) -> Sequence[str]: """ Get IDs of the fixed model parameters. :return: Fixed parameter IDs """ return _amici.Model_get_fixed_parameter_ids(self)
[docs] def has_observable_ids(self) -> bool: """ Report whether the model has observable IDs set. :return: Boolean indicating whether observable ids were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.Model_has_observable_ids(self)
[docs] def get_observable_ids(self) -> Sequence[str]: """ Get IDs of the observables. :return: Observable IDs """ return _amici.Model_get_observable_ids(self)
[docs] def has_expression_ids(self) -> bool: """ Report whether the model has expression IDs set. :return: Boolean indicating whether expression ids were set. Also returns `true` if the number of corresponding variables is just zero. """ return _amici.Model_has_expression_ids(self)
[docs] def get_expression_ids(self) -> Sequence[str]: """ Get IDs of the expression. :return: Expression IDs """ return _amici.Model_get_expression_ids(self)
[docs] def has_quadratic_llh(self) -> bool: """ Checks whether the defined noise model is Gaussian, i.e., the nllh is quadratic :return: boolean flag """ return _amici.Model_has_quadratic_llh(self)
[docs] def get_timepoints(self) -> Sequence[float]: """ Get the timepoint vector. :return: Timepoint vector """ return _amici.Model_get_timepoints(self)
[docs] def get_timepoint(self, it: int) -> float: """ Get simulation timepoint for time index `it`. :param it: Time index :return: Timepoint """ return _amici.Model_get_timepoint(self, it)
[docs] def set_timepoints(self, ts: Sequence[float]): """ Set the timepoint vector. :param ts: New timepoint vector """ return _amici.Model_set_timepoints(self, ts)
[docs] def t0(self) -> float: """ Get simulation start time. :return: Simulation start time """ return _amici.Model_t0(self)
[docs] def set_t0(self, t0: float): """ Set simulation start time. Output timepoints are absolute timepoints, independent of :math:`t_{0}`. For output timepoints :math:`t < t_{0}`, the initial state will be returned. :param t0: Simulation start time """ return _amici.Model_set_t0(self, t0)
[docs] def t0_preeq(self) -> float: """ Get the initial time to use for pre-equilibration. Deprecated: Use ExpData::t_start_preeq. :return: Initial time, or NAN if not set. """ return _amici.Model_t0_preeq(self)
[docs] def set_t0_preeq(self, t0_preeq: float): """ Set the initial time to use for pre-equilibration. Only used if ExpData::t_start_preeq is NAN. Deprecated: Use ExpData::t_start_preeq. :param t0_preeq: The initial time for pre-equilibration or NAN to unset. """ if not np.isnan(t0_preeq): import warnings warnings.warn('`Model.set_t0_preeq` is deprecated, set `ExpData.t_start_preeq` instead.', DeprecationWarning, stacklevel=2) return _amici.Model_set_t0_preeq(self, t0_preeq)
[docs] def get_state_is_non_negative(self) -> Sequence[bool]: """ Get flags indicating whether states should be treated as non-negative. :return: Vector of flags """ return _amici.Model_get_state_is_non_negative(self)
[docs] def set_state_is_non_negative(self, stateIsNonNegative: Sequence[bool]): """ Set flags indicating whether states should be treated as non-negative. :param stateIsNonNegative: Vector of flags """ return _amici.Model_set_state_is_non_negative(self, stateIsNonNegative)
[docs] def set_all_states_non_negative(self): """ Set flags indicating that all states should be treated as non-negative. """ return _amici.Model_set_all_states_non_negative(self)
[docs] def set_minimum_sigma_residuals(self, min_sigma: float): """ Sets the estimated lower boundary for sigma_y. When :meth:`set_add_sigma_residuals` is activated, this lower boundary must ensure that log(sigma) + min_sigma > 0. :param min_sigma: lower boundary """ return _amici.Model_set_minimum_sigma_residuals(self, min_sigma)
[docs] def get_minimum_sigma_residuals(self) -> float: """ Gets the specified estimated lower boundary for sigma_y. :return: lower boundary """ return _amici.Model_get_minimum_sigma_residuals(self)
[docs] def set_add_sigma_residuals(self, sigma_res: bool): """ Specifies whether residuals should be added to account for parameter dependent sigma. If set to true, additional residuals of the form :math:`\\sqrt{\\log(\\sigma) +C}` will be added. This enables least-squares optimization for variables with Gaussian noise assumption and parameter dependent standard deviation sigma. The constant :math:`C` can be set via :meth:`set_minimum_sigma_residuals`. :param sigma_res: if true, additional residuals are added """ return _amici.Model_set_add_sigma_residuals(self, sigma_res)
[docs] def get_add_sigma_residuals(self) -> bool: """ Checks whether residuals should be added to account for parameter dependent sigma. :return: sigma_res """ return _amici.Model_get_add_sigma_residuals(self)
[docs] def get_parameter_list(self) -> Sequence[int]: """ Get the list of parameters for which sensitivities are computed. :return: List of parameter indices """ return _amici.Model_get_parameter_list(self)
[docs] def plist(self, pos: int) -> int: """ Get entry in parameter list by index. :param pos: Index in sensitivity parameter list :return: Index in parameter list """ return _amici.Model_plist(self, pos)
[docs] def set_parameter_list(self, plist: Sequence[int]): """ Set the list of parameters for which sensitivities are to be computed. NOTE: Resets initial state sensitivities. :param plist: List of parameter indices """ return _amici.Model_set_parameter_list(self, plist)
[docs] def get_initial_state(self, *args): """ *Overload 1:* Get the initial state. :type t0: float :param t0: Custom t0 for which to get initial states. :rtype: DoubleVector :return: Initial state vector, before any events are executed. | *Overload 2:* Get the initial state for Model::t0()`. :rtype: DoubleVector :return: Initial state vector, before any events are executed. """ return _amici.Model_get_initial_state(self, *args)
[docs] def set_initial_state(self, x0: Sequence[float]): """ Set the pre-event initial state. :param x0: Initial state vector """ return _amici.Model_set_initial_state(self, x0)
[docs] def has_custom_initial_state(self) -> bool: """ Return whether custom initial state have been set. :return: `true` if has custom initial state, otherwise `false` """ return _amici.Model_has_custom_initial_state(self)
[docs] def get_initial_state_sensitivities(self, *args): """ *Overload 1:* Get the initial state sensitivities. Sensitivities are with respect to the unscaled parameters, i.e., without the chain rule for parameter scaling applied (see set_unscaled_initial_state_sensitivities()). :rtype: DoubleVector :return: vector of initial state sensitivities | *Overload 2:* Get the initial states sensitivities. Sensitivities are with respect to the unscaled parameters, i.e., without the chain rule for parameter scaling applied (see set_unscaled_initial_state_sensitivities()). :type t0: float :param t0: Custom t0 for which to get initial states. :rtype: DoubleVector :return: vector of initial state sensitivities """ return _amici.Model_get_initial_state_sensitivities(self, *args)
[docs] def set_initial_state_sensitivities(self, sx0: Sequence[float]): """ Set the initial state sensitivities. :param sx0: vector of initial state sensitivities with chain rule applied. This could be a slice of ReturnData::sx or ReturnData::sx0 """ return _amici.Model_set_initial_state_sensitivities(self, sx0)
[docs] def has_custom_initial_state_sensitivities(self) -> bool: """ Return whether custom initial state sensitivities have been set. :return: `true` if has custom initial state sensitivities, otherwise `false`. """ return _amici.Model_has_custom_initial_state_sensitivities(self)
[docs] def set_unscaled_initial_state_sensitivities(self, sx0: Sequence[float]): """ Set the initial state sensitivities. :param sx0: Vector of initial state sensitivities without chain rule applied. This could be the read-in from a `model.sx0data` saved to HDF5. """ return _amici.Model_set_unscaled_initial_state_sensitivities(self, sx0)
[docs] def set_steady_state_computation_mode(self, mode: int): """ Set the mode how steady state is computed in the steady state simulation. :param mode: Steady state computation mode """ return _amici.Model_set_steady_state_computation_mode(self, mode)
[docs] def get_steady_state_computation_mode(self) -> int: """ Gets the mode how steady state is computed in the steadystate simulation. :return: Mode """ return _amici.Model_get_steady_state_computation_mode(self)
[docs] def set_steady_state_sensitivity_mode(self, mode: SteadyStateSensitivityMode): """ Set the mode how sensitivities are computed in the steady-state simulation. :param mode: Steady-state sensitivity mode """ return _amici.Model_set_steady_state_sensitivity_mode(self, mode)
[docs] def get_steady_state_sensitivity_mode(self) -> SteadyStateSensitivityMode: """ Gets the mode how sensitivities are computed in the steady-state simulation. :return: Mode """ return _amici.Model_get_steady_state_sensitivity_mode(self)
[docs] def set_reinitialize_fixed_parameter_initial_states(self, flag: bool): """ Set whether initial states depending on fixed parameters are to be reinitialized after preequilibration and presimulation. :param flag: Fixed parameters reinitialized? """ return _amici.Model_set_reinitialize_fixed_parameter_initial_states(self, flag)
[docs] def get_reinitialize_fixed_parameter_initial_states(self) -> bool: """ Get whether initial states depending on fixedParameters are to be reinitialized after preequilibration and presimulation. :return: flag `true` / `false` """ return _amici.Model_get_reinitialize_fixed_parameter_initial_states(self)
[docs] def require_sensitivities_for_all_parameters(self): """ Require computation of sensitivities for all parameters p [0..np[ in natural order. NOTE: Resets initial state sensitivities. """ return _amici.Model_require_sensitivities_for_all_parameters(self)
[docs] def get_observable_scaling(self, iy: int) -> int: """ Get scaling type for observable :param iy: observable index :return: scaling type """ return _amici.Model_get_observable_scaling(self, iy)
[docs] def set_always_check_finite(self, alwaysCheck: bool): """ Set whether the result of every call to `Model::f*` should be checked for finiteness. :param alwaysCheck: """ return _amici.Model_set_always_check_finite(self, alwaysCheck)
[docs] def get_always_check_finite(self) -> bool: """ Get setting of whether the result of every call to `Model::f*` should be checked for finiteness. :return: that """ return _amici.Model_get_always_check_finite(self)
[docs] def set_reinitialization_state_idxs(self, idxs: Sequence[int]): """ Set indices of states to be reinitialized based on provided fixed parameters :param idxs: Array of state indices """ return _amici.Model_set_reinitialization_state_idxs(self, idxs)
[docs] def get_reinitialization_state_idxs(self) -> Sequence[int]: """ Return indices of states to be reinitialized based on provided fixed parameters :return: Those indices. """ return _amici.Model_get_reinitialization_state_idxs(self)
[docs] def get_trigger_timepoints(self) -> Sequence[float]: """ Get trigger times for events that don't require root-finding. To be called only after Model::initialize. The trigger times may change at events, see Model::reinit_explicit_roots. :return: List of unique trigger points for events that don't require root-finding (i.e. that trigger at predetermined timepoints), in ascending order. """ return _amici.Model_get_trigger_timepoints(self)
[docs] def get_steadystate_mask(self) -> Sequence[float]: """ Get steady-state mask as std::vector. See `set_steadystate_mask` for details. :return: Steady-state mask """ return _amici.Model_get_steadystate_mask(self)
[docs] def set_steadystate_mask(self, mask: Sequence[float]): """ Set steady-state mask. The mask is used to exclude certain state variables from the steady-state convergence check. Positive values indicate that the corresponding state variable should be included in the convergence check, while non-positive values indicate that the corresponding state variable should be excluded. An empty mask is interpreted as including all state variables. :param mask: Mask of length `nx_solver`. """ return _amici.Model_set_steadystate_mask(self, mask)
[docs] def get_any_state_nonnegative(self) -> bool: """ Whether there is at least one state variable for which non-negativity is to be enforced. :return: Vector of all events. """ return _amici.Model_get_any_state_nonnegative(self)
[docs] def get_id_list(self) -> Sequence[float]: """ Get flag array for DAE equations :return: Flag array for DAE equations """ return _amici.Model_get_id_list(self)
[docs] def has_algebraic_states(self) -> bool: """ Check whether the model has algebraic states. :return: `true` if any state is algebraic (DAE models only) """ return _amici.Model_has_algebraic_states(self)
[docs] def get_second_order_mode(self) -> int: """ Get second-order sensitivity mode. :return: Flag indicating whether for `SensitivityOrder::second` directional or full second order derivative will be computed """ return _amici.Model_get_second_order_mode(self)
[docs] def clone(self): """Clone the model instance.""" return _model_clone_impl(self)
def __deepcopy__(self, memo): return self.clone() def __reduce__(self): return _model_reduce_impl(self) @overload def simulate(self: AmiciModel, *, solver: Solver | None=None, edata: AmiciExpData | None=None, sensi_method: SensitivityMethod | str=None, sensi_order: SensitivityOrder | str=None) -> ReturnDataView: ... @overload def simulate(self: AmiciModel, *, solver: Solver | None=None, edata: AmiciExpDataVector | None=None, failfast: bool=True, num_threads: int=1, sensi_method: SensitivityMethod | str=None, sensi_order: SensitivityOrder | str=None) -> list[ReturnDataView]: ...
[docs] def simulate(self: AmiciModel, *, solver: Solver | None=None, edata: AmiciExpData | AmiciExpDataVector | None=None, failfast: bool=True, num_threads: int=1, sensi_method: SensitivityMethod | str=None, sensi_order: SensitivityOrder | str=None) -> ReturnDataView | list[ReturnDataView]: """Simulate model with given solver and experimental data. :param 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. If `None`, no experimental data is used and the model is simulated as is. :param sensi_method: Sensitivity method to use for simulation. If `None`, the solver's current sensitivity method is used. :param sensi_order: Sensitivity order to use for simulation. If `None`, the solvers's current sensitivity order is used. :param failfast: Whether to stop simulations on first failure. Only relevant if `edata` is a sequence of :class:`ExpData` instances. :param num_threads: Number of threads to use for simulation. Only relevant if `edata` is a sequence of :class:`ExpData` instances. :return: A single :class:`ReturnDataView` instance containing the simulation results if `edata` is a single :class:`ExpData` instance or `None`. If `edata` is a sequence of :class:`ExpData` instances, a list of :class:`ReturnDataView` instances is returned. """ return _model_simulate_impl(self, solver=solver, edata=edata, failfast=failfast, num_threads=num_threads, sensi_method=sensi_method, sensi_order=sensi_order)
[docs] def set_parameter_scale(self, *args): """ *Overload 1:* Set parameter scale for each parameter. NOTE: Resets initial state sensitivities. :type pscale: int :param pscale: Scalar parameter scale to be set for all parameters | *Overload 2:* Set parameter scale for each parameter. NOTE: Resets initial state sensitivities. :type pscaleVec: ParameterScalingVector :param pscaleVec: Vector of parameter scales """ return _amici.Model_set_parameter_scale(self, *args)
_amici.Model_swigregister(Model) model_quantity_to_str = cvar.model_quantity_to_str def __eq__(*args): """ *Overload 1:* Check equality of data members excluding solver memory :type a: :py:class:`Solver` :param a: :type b: :py:class:`Solver` :param b: :rtype: boolean :return: | *Overload 2:* Equality operator :type a: :py:class:`CVodeSolver` :param a: :type b: :py:class:`CVodeSolver` :param b: :rtype: boolean :return: Whether a and b are equal | *Overload 3:* Check equality of data members. :type a: :py:class:`Model` :param a: First model instance :type b: :py:class:`Model` :param b: Second model instance :rtype: boolean :return: Equality """ return _amici.__eq__(*args) class Model_ODE(Model): """ The Model class represents an AMICI ODE model. The model does not contain any data, but represents the state of the model at a specific time t. The states must not always be in sync, but may be updated asynchronously. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError('No constructor defined - class is abstract') __repr__ = _swig_repr def create_solver(self): return _amici.Model_ODE_create_solver(self) __swig_destroy__ = _amici.delete_Model_ODE _amici.Model_ODE_swigregister(Model_ODE) class Model_DAE(Model): """ The Model class represents an AMICI DAE model. The model does not contain any data, but represents the state of the model at a specific time t. The states must not always be in sync, but may be updated asynchronously. """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError('No constructor defined - class is abstract') __repr__ = _swig_repr def create_solver(self): return _amici.Model_DAE_create_solver(self) __swig_destroy__ = _amici.delete_Model_DAE _amici.Model_DAE_swigregister(Model_DAE) LogSeverity_error = _amici.LogSeverity_error LogSeverity_warning = _amici.LogSeverity_warning LogSeverity_debug = _amici.LogSeverity_debug
[docs] class LogItem(object): """A log item.""" thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr
[docs] def __init__(self, *args): """ *Overload 1:* Default ctor. | *Overload 2:* Construct a LogItem :type severity: int :param severity: :type identifier: str :param identifier: :type message: str :param message: """ _amici.LogItem_swiginit(self, _amici.new_LogItem(*args))
severity = property(_amici.LogItem_severity_get, _amici.LogItem_severity_set, doc='Severity level') identifier = property(_amici.LogItem_identifier_get, _amici.LogItem_identifier_set, doc='Short identifier for the logged event') message = property(_amici.LogItem_message_get, _amici.LogItem_message_set, doc='A more detailed and readable message') def __repr__(self): return f'{self.__class__.__name__}(severity={self.severity}, identifier={self.identifier!r}, message={self.message!r})' __swig_destroy__ = _amici.delete_LogItem
_amici.LogItem_swigregister(LogItem)
[docs] class ReturnData(ModelDimensions): """ Stores all data to be returned by amici::run_simulation. NOTE: multi-dimensional arrays are stored in row-major order (C-style) """ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr
[docs] def __init__(self, *args): """ *Overload 1:* Default constructor | *Overload 2:* Constructor :type ts_: DoubleVector :param ts_: see amici::SimulationParameters::ts :type model_dimensions_: :py:class:`ModelDimensions` :param model_dimensions_: Model dimensions :type nmaxevent_: int :param nmaxevent_: see amici::ModelDimensions::nmaxevent :type newton_maxsteps_: int :param newton_maxsteps_: see amici::Solver::newton_maxsteps :type plist_: IntVector :param plist_: see amici::Model::getParameterList :type pscale_: ParameterScalingVector :param pscale_: see amici::SimulationParameters::pscale :type o2mode_: int :param o2mode_: see amici::SimulationParameters::o2mode :type sensi_: SensitivityOrder :param sensi_: see amici::Solver::sensi :type sensi_meth_: SensitivityMethod :param sensi_meth_: see amici::Solver::sensi_meth :type rdrm_: RDataReporting :param rdrm_: see amici::Solver::rdata_reporting :type quadratic_llh_: boolean :param quadratic_llh_: whether model defines a quadratic nllh and computing res, sres and FIM makes sense :type sigma_res_: boolean :param sigma_res_: indicates whether additional residuals are to be added for each sigma :type sigma_offset_: float :param sigma_offset_: offset to ensure real-valuedness of sigma residuals :type free_parameter_ids_: std::span< std::string_view const > :param free_parameter_ids_: IDs of the free parameters :type free_parameter_names_: std::span< std::string_view const > :param free_parameter_names_: Names of the free parameters :type fixed_parameter_ids_: std::span< std::string_view const > :param fixed_parameter_ids_: IDs of the fixed parameters :type fixed_parameter_names_: std::span< std::string_view const > :param fixed_parameter_names_: Names of the fixed parameters :type state_ids_: std::span< std::string_view const > :param state_ids_: IDs of state variables :type state_names_: std::span< std::string_view const > :param state_names_: Names of state variables :type state_ids_solver_: std::span< std::string_view const > :param state_ids_solver_: IDs of solver state variables :type state_names_solver_: std::span< std::string_view const > :param state_names_solver_: Names of solver state variables :type observable_ids_: std::span< std::string_view const > :param observable_ids_: IDs of observables :type observable_names_: std::span< std::string_view const > :param observable_names_: Names of observables :type expression_ids_: std::span< std::string_view const > :param expression_ids_: IDs of expressions :type expression_names_: std::span< std::string_view const > :param expression_names_: Names of expressions | *Overload 3:* constructor that uses information from model and solver to appropriately initialize fields :type solver: :py:class:`Solver` :param solver: solver instance :type model: :py:class:`Model` :param model: model instance """ _amici.ReturnData_swiginit(self, _amici.new_ReturnData(*args))
__swig_destroy__ = _amici.delete_ReturnData id = property(_amici.ReturnData_id_get, _amici.ReturnData_id_set, doc='Arbitrary (not necessarily unique) identifier.') ts = property(_amici.ReturnData_ts_get, _amici.ReturnData_ts_set, doc='Output or measurement timepoints (shape `nt`)') xdot = property(_amici.ReturnData_xdot_get, _amici.ReturnData_xdot_set, doc='time derivative (shape `nx_solver`) evaluated at `t_last`.') J = property(_amici.ReturnData_J_get, _amici.ReturnData_J_set, doc='\n Jacobian of differential equation right hand side.\n\n The Jacobian of differential equation right hand side\n (shape `nx_solver` x `nx_solver`, row-major) evaluated at `t_last`.\n\n The corresponding state variable IDs can be obtained from\n `state_ids_solver()`.\n ') w = property(_amici.ReturnData_w_get, _amici.ReturnData_w_set, doc='\n Model expression values.\n\n Values of model expressions (recurring terms in xdot, for imported SBML\n models from Python, this contains, e.g., the flux vector)\n at timepoints `ReturnData::ts` (shape `nt` x `nw`, row major).\n\n The corresponding expression IDs can be obtained from\n `expression_ids`.\n ') z = property(_amici.ReturnData_z_get, _amici.ReturnData_z_set, doc='Event output (shape `nmaxevent` x `nz`, row-major)') sigmaz = property(_amici.ReturnData_sigmaz_get, _amici.ReturnData_sigmaz_set, doc='\n Event output sigma standard deviation (shape `nmaxevent` x `nz`,\n row-major)\n ') sz = property(_amici.ReturnData_sz_get, _amici.ReturnData_sz_set, doc='\n Parameter derivative of event output\n (shape `nmaxevent` x `nplist` x `nz`, row-major)\n ') ssigmaz = property(_amici.ReturnData_ssigmaz_get, _amici.ReturnData_ssigmaz_set, doc='\n Parameter derivative of event output standard deviation\n (shape `nmaxevent` x `nplist` x `nz`, row-major)\n ') rz = property(_amici.ReturnData_rz_get, _amici.ReturnData_rz_set, doc='Event trigger output (shape `nmaxevent` x `nz`, row-major)') srz = property(_amici.ReturnData_srz_get, _amici.ReturnData_srz_set, doc='\n Parameter derivative of event trigger output\n (shape `nmaxevent` x `nplist` x `nz`, row-major)\n ') s2rz = property(_amici.ReturnData_s2rz_get, _amici.ReturnData_s2rz_set, doc='\n Second-order parameter derivative of event trigger output (shape\n `nmaxevent` x `nztrue` x `nplist` x `nplist`, row-major)\n ') x = property(_amici.ReturnData_x_get, _amici.ReturnData_x_set, doc='\n Model state.\n\n The model state at timepoints `ReturnData::ts`\n (shape `nt` x `nx_rdata`, row-major).\n\n The corresponding state variable IDs can be obtained from\n `state_ids`.\n ') sx = property(_amici.ReturnData_sx_get, _amici.ReturnData_sx_set, doc='\n State sensitivities.\n\n The derivative of the model state with respect to the chosen parameters\n (see `Model::getParameterList()` or `ExpData::plist`)\n at timepoints `ReturnData::ts`\n (shape `nt` x `nplist` x `nx_rdata`, row-major).\n\n The corresponding state variable IDs can be obtained from\n `state_ids`.\n ') y = property(_amici.ReturnData_y_get, _amici.ReturnData_y_set, doc='\n Observables.\n\n The values of the observables at timepoints `ReturnData::ts`\n (shape `nt` x `ny`, row-major).\n\n The corresponding observable IDs can be obtained from\n `observable_ids`.\n ') sigmay = property(_amici.ReturnData_sigmay_get, _amici.ReturnData_sigmay_set, doc='Observable standard deviation (shape `nt` x `ny`, row-major)') sy = property(_amici.ReturnData_sy_get, _amici.ReturnData_sy_set, doc='\n Observable sensitivities.\n\n The derivative of the observables with respect to the chosen parameters\n (see `Model::getParameterList()` or `ExpData::plist`)\n at timepoints `ReturnData::ts`\n (shape `nt` x `nplist` x `ny`, row-major).\n\n The corresponding observable IDs can be obtained from\n `observable_ids`.\n ') ssigmay = property(_amici.ReturnData_ssigmay_get, _amici.ReturnData_ssigmay_set, doc='\n Parameter derivative of observable standard deviation\n (shape `nt` x `nplist` x `ny`, row-major)\n ') res = property(_amici.ReturnData_res_get, _amici.ReturnData_res_set, doc='Residuals (shape `nt*ny`, row-major)') sres = property(_amici.ReturnData_sres_get, _amici.ReturnData_sres_set, doc='Parameter derivative of residual (shape `nt*ny` x `nplist`, row-major)') FIM = property(_amici.ReturnData_FIM_get, _amici.ReturnData_FIM_set, doc='Fisher information matrix (shape `nplist` x `nplist`, row-major)') numsteps = property(_amici.ReturnData_numsteps_get, _amici.ReturnData_numsteps_set, doc='\n Number of solver steps for the forward problem.\n\n Cumulative number of integration steps for the forward problem for each\n output timepoint in `ReturnData::ts` (shape `nt`).\n ') numsteps_b = property(_amici.ReturnData_numsteps_b_get, _amici.ReturnData_numsteps_b_set, doc='\n Number of solver steps for the backward problem.\n\n Cumulative number of integration steps for the backward problem for each\n output timepoint in `ReturnData::ts` (shape `nt`).\n ') num_rhs_evals = property(_amici.ReturnData_num_rhs_evals_get, _amici.ReturnData_num_rhs_evals_set, doc='Number of right hand side evaluations forward problem (shape `nt`)') num_rhs_evals_b = property(_amici.ReturnData_num_rhs_evals_b_get, _amici.ReturnData_num_rhs_evals_b_set, doc='Number of right hand side evaluations backward problem (shape `nt`)') num_err_test_fails = property(_amici.ReturnData_num_err_test_fails_get, _amici.ReturnData_num_err_test_fails_set, doc='Number of error test failures forward problem (shape `nt`)') num_err_test_fails_b = property(_amici.ReturnData_num_err_test_fails_b_get, _amici.ReturnData_num_err_test_fails_b_set, doc='Number of error test failures backward problem (shape `nt`)') num_non_lin_solv_conv_fails = property(_amici.ReturnData_num_non_lin_solv_conv_fails_get, _amici.ReturnData_num_non_lin_solv_conv_fails_set, doc='Number of linear solver convergence failures forward problem (shape `nt`)') num_non_lin_solv_conv_fails_b = property(_amici.ReturnData_num_non_lin_solv_conv_fails_b_get, _amici.ReturnData_num_non_lin_solv_conv_fails_b_set, doc='\n Number of linear solver convergence failures backward problem (shape\n `nt`)\n ') order = property(_amici.ReturnData_order_get, _amici.ReturnData_order_set, doc='Employed order forward problem (shape `nt`)') cpu_time = property(_amici.ReturnData_cpu_time_get, _amici.ReturnData_cpu_time_set, doc='\n Computation time of forward solve [ms]\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') cpu_time_b = property(_amici.ReturnData_cpu_time_b_get, _amici.ReturnData_cpu_time_b_set, doc='\n Computation time of backward solve [ms]\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') cpu_time_total = property(_amici.ReturnData_cpu_time_total_get, _amici.ReturnData_cpu_time_total_set, doc='\n Total CPU time from entering runAmiciSimulation until exiting [ms]\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') preeq_status = property(_amici.ReturnData_preeq_status_get, _amici.ReturnData_preeq_status_set, doc='Flags indicating success of steady-state solver (preequilibration)') preeq_cpu_time = property(_amici.ReturnData_preeq_cpu_time_get, _amici.ReturnData_preeq_cpu_time_set, doc='\n Computation time of the steady state solver [ms]\n (pre-equilibration)\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') preeq_cpu_time_b = property(_amici.ReturnData_preeq_cpu_time_b_get, _amici.ReturnData_preeq_cpu_time_b_set, doc='\n Computation time of the steady state solver of the backward\n problem [ms] (pre-equilibration)\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') posteq_status = property(_amici.ReturnData_posteq_status_get, _amici.ReturnData_posteq_status_set, doc='Flags indicating success of steady-state solver (postequilibration)') posteq_cpu_time = property(_amici.ReturnData_posteq_cpu_time_get, _amici.ReturnData_posteq_cpu_time_set, doc='\n Computation time of the steady-state solver [ms]\n (postequilibration)\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') posteq_cpu_time_b = property(_amici.ReturnData_posteq_cpu_time_b_get, _amici.ReturnData_posteq_cpu_time_b_set, doc='\n Computation time of the steady-state solver of the backward\n problem [ms] (postequilibration)\n\n This is the CPU time of the simulating thread, except on platforms\n without a precise per-thread CPU clock, such as Windows (see\n CpuTimer::uses_thread_clock). There, it is measured with std::clock,\n so in a multi-threaded context, this value may be incorrect.\n ') preeq_numsteps = property(_amici.ReturnData_preeq_numsteps_get, _amici.ReturnData_preeq_numsteps_set, doc='\n Number of Newton steps for pre-equilibration.\n\n [newton, simulation, newton] (length = 3)\n ') preeq_numsteps_b = property(_amici.ReturnData_preeq_numsteps_b_get, _amici.ReturnData_preeq_numsteps_b_set, doc='\n Number of simulation steps for adjoint pre-equilibration problem\n [== 0 if analytical solution worked, > 0 otherwise]\n ') posteq_numsteps = property(_amici.ReturnData_posteq_numsteps_get, _amici.ReturnData_posteq_numsteps_set, doc='\n Number of Newton steps for post-equilibration\n [newton, simulation, newton].\n ') posteq_numsteps_b = property(_amici.ReturnData_posteq_numsteps_b_get, _amici.ReturnData_posteq_numsteps_b_set, doc='\n Number of simulation steps for the post-equilibration backward simulation\n [== 0 if analytical solution worked, > 0 otherwise]\n ') preeq_t = property(_amici.ReturnData_preeq_t_get, _amici.ReturnData_preeq_t_set, doc='\n Model time at which the pre-equilibration steady state was reached via\n simulation.\n ') preeq_wrms = property(_amici.ReturnData_preeq_wrms_get, _amici.ReturnData_preeq_wrms_set, doc='Weighted root-mean-square of the rhs at pre-equilibration steady state.') posteq_t = property(_amici.ReturnData_posteq_t_get, _amici.ReturnData_posteq_t_set, doc='\n Model time at which the post-equilibration steady state was reached via\n simulation.\n ') posteq_wrms = property(_amici.ReturnData_posteq_wrms_get, _amici.ReturnData_posteq_wrms_set, doc='Weighted root-mean-square of the rhs at post-equilibration steady state.') x0 = property(_amici.ReturnData_x0_get, _amici.ReturnData_x0_set, doc='\n Initial state of the main simulation (shape `nx_rdata`).\n\n The corresponding state variable IDs can be obtained from\n `state_ids`.\n ') x_ss = property(_amici.ReturnData_x_ss_get, _amici.ReturnData_x_ss_set, doc='\n Pre-equilibration steady state.\n\n The values of the state variables at the pre-equilibration steady state\n (shape `nx_rdata`).\n The corresponding state variable IDs can be obtained from\n `state_ids`.\n ') sx0 = property(_amici.ReturnData_sx0_get, _amici.ReturnData_sx0_set, doc='\n Initial state sensitivities for the main simulation.\n\n Shape `nplist` x `nx_rdata` (row-major). Empty if pre-equilibration\n used adjoint sensitivities, in which case these are not computed.\n ') sx_ss = property(_amici.ReturnData_sx_ss_get, _amici.ReturnData_sx_ss_set, doc='\n Pre-equilibration steady state sensitivities.\n\n Sensitivities of the pre-equilibration steady state with respect to the\n selected parameters.\n (shape `nplist` x `nx_rdata`, row-major)\n ') llh = property(_amici.ReturnData_llh_get, _amici.ReturnData_llh_set, doc='Log-likelihood value') chi2 = property(_amici.ReturnData_chi2_get, _amici.ReturnData_chi2_set, doc=':math:`\\chi^2` value') sllh = property(_amici.ReturnData_sllh_get, _amici.ReturnData_sllh_set, doc='Parameter derivative of log-likelihood (shape `nplist`)') s2llh = property(_amici.ReturnData_s2llh_get, _amici.ReturnData_s2llh_set, doc='\n Second-order parameter derivative of log-likelihood\n (shape `nJ-1` x `nplist`, row-major)\n ') status = property(_amici.ReturnData_status_get, _amici.ReturnData_status_set, doc='\n Simulation status code.\n\n One of:\n\n * AMICI_SUCCESS, indicating successful simulation\n * AMICI_MAX_TIME_EXCEEDED, indicating that the simulation did not finish\n within the allowed time (see Solver.{set,get}MaxTime)\n * AMICI_ERROR, indicating that some error occurred during simulation\n (a more detailed error message will have been printed).\n * AMICI_NOT_RUN, if no simulation was started\n ') nplist = property(_amici.ReturnData_nplist_get, _amici.ReturnData_nplist_set, doc='Number of parameters w.r.t. which sensitivities were requested') nmaxevent = property(_amici.ReturnData_nmaxevent_get, _amici.ReturnData_nmaxevent_set, doc='Maximal number of occurring events (for every event type)') nt = property(_amici.ReturnData_nt_get, _amici.ReturnData_nt_set, doc='Number of output timepoints (length of `ReturnData::ts`).') newton_maxsteps = property(_amici.ReturnData_newton_maxsteps_get, _amici.ReturnData_newton_maxsteps_set, doc='maximal number of newton iterations for steady state calculation') pscale = property(_amici.ReturnData_pscale_get, _amici.ReturnData_pscale_set, doc='Scaling of model parameters.') o2mode = property(_amici.ReturnData_o2mode_get, _amici.ReturnData_o2mode_set, doc='Flag indicating whether second-order sensitivities were requested.') sensi = property(_amici.ReturnData_sensi_get, _amici.ReturnData_sensi_set, doc='Sensitivity order.') sensi_meth = property(_amici.ReturnData_sensi_meth_get, _amici.ReturnData_sensi_meth_set, doc='Sensitivity method.') rdata_reporting = property(_amici.ReturnData_rdata_reporting_get, _amici.ReturnData_rdata_reporting_set, doc='Reporting mode.') sigma_res = property(_amici.ReturnData_sigma_res_get, _amici.ReturnData_sigma_res_set, doc='\n Boolean indicating whether residuals for standard deviations have been\n added.\n ') messages = property(_amici.ReturnData_messages_get, _amici.ReturnData_messages_set, doc='Log messages.') t_last = property(_amici.ReturnData_t_last_get, _amici.ReturnData_t_last_set, doc='The final internal time of the solver.') plist = property(_amici.ReturnData_plist_get, _amici.ReturnData_plist_set, doc='\n Indices of the parameters w.r.t. which sensitivities were\n computed.\n\n The indices refer to parameter IDs in `free_parameter_ids`.\n ') free_parameter_ids = property(_amici.ReturnData_free_parameter_ids_get, _amici.ReturnData_free_parameter_ids_set, doc='IDs of the free parameters') free_parameter_names = property(_amici.ReturnData_free_parameter_names_get, _amici.ReturnData_free_parameter_names_set, doc='Names of the free parameters') fixed_parameter_ids = property(_amici.ReturnData_fixed_parameter_ids_get, _amici.ReturnData_fixed_parameter_ids_set, doc='IDs of the fixed parameters') fixed_parameter_names = property(_amici.ReturnData_fixed_parameter_names_get, _amici.ReturnData_fixed_parameter_names_set, doc='Names of the fixed parameters') state_ids = property(_amici.ReturnData_state_ids_get, _amici.ReturnData_state_ids_set, doc='IDs of state variables') state_names = property(_amici.ReturnData_state_names_get, _amici.ReturnData_state_names_set, doc='Names of state variables') state_ids_solver = property(_amici.ReturnData_state_ids_solver_get, _amici.ReturnData_state_ids_solver_set, doc='IDs of solver state variables') state_names_solver = property(_amici.ReturnData_state_names_solver_get, _amici.ReturnData_state_names_solver_set, doc='Names of solver state variables') observable_ids = property(_amici.ReturnData_observable_ids_get, _amici.ReturnData_observable_ids_set, doc='IDs of observables') observable_names = property(_amici.ReturnData_observable_names_get, _amici.ReturnData_observable_names_set, doc='Names of observables') expression_ids = property(_amici.ReturnData_expression_ids_get, _amici.ReturnData_expression_ids_set, doc='IDs of expressions') expression_names = property(_amici.ReturnData_expression_names_get, _amici.ReturnData_expression_names_set, doc='Names of expressions')
_amici.ReturnData_swigregister(ReturnData) def write_solver_settings_to_hdf5(*args): """ *Overload 1:* Write solver options to HDF5 file. :type hdf5Filename: str :param hdf5Filename: Name of HDF5 file to write to :type solver: :py:class:`Solver` :param solver: Solver to write options from :type hdf5Location: str :param hdf5Location: Path inside the HDF5 file | *Overload 2:* Write solver options to HDF5 file. :type file: H5::H5File :param file: File to read from :type solver: :py:class:`Solver` :param solver: Solver to write options from :type hdf5Location: str :param hdf5Location: Path inside the HDF5 file """ return _amici.write_solver_settings_to_hdf5(*args) def read_solver_settings_from_hdf5(*args): """ *Overload 1:* Read solver options from HDF5 file. :type file: H5::H5File :param file: HDF5 file to read from :type solver: :py:class:`Solver` :param solver: Solver to set options on :type datasetPath: str :param datasetPath: Path inside the HDF5 file | *Overload 2:* Read solver options from HDF5 file. :type hdffile: str :param hdffile: Name of HDF5 file :type solver: :py:class:`Solver` :param solver: Solver to set options on :type datasetPath: str :param datasetPath: Path inside the HDF5 file """ return _amici.read_solver_settings_from_hdf5(*args)
[docs] def read_model_data_from_hdf5(*args): """ *Overload 1:* Read model data from HDF5 file. :type hdffile: str :param hdffile: Name of HDF5 file :type model: :py:class:`Model` :param model: Model to set data on :type datasetPath: str :param datasetPath: Path inside the HDF5 file | *Overload 2:* Read model data from HDF5 file. :type file: H5::H5File :param file: HDF5 file handle to read from :type model: :py:class:`Model` :param model: Model to set data on :type datasetPath: str :param datasetPath: Path inside the HDF5 file """ return _amici.read_model_data_from_hdf5(*args)
[docs] def write_return_data_to_hdf5(*args): """ *Overload 1:* Write ReturnData to HDF5 file. :type rdata: :py:class:`ReturnData` :param rdata: Data to write :type file: H5::H5File :param file: HDF5 file to write to :type hdf5Location: str :param hdf5Location: Full dataset path inside the HDF5 file (will be created) | *Overload 2:* Write ReturnData to HDF5 file. :type rdata: :py:class:`ReturnData` :param rdata: Data to write :type hdf5Filename: str :param hdf5Filename: Filename of HDF5 file :type hdf5Location: str :param hdf5Location: Full dataset path inside the HDF5 file (will be created) """ return _amici.write_return_data_to_hdf5(*args)
[docs] def read_exp_data_from_hdf5(hdf5Filename: str, hdf5Root: str, model: Model) -> ExpData: """ Read AMICI ExpData data from HDF5 file. :param hdf5Filename: Name of HDF5 file :param hdf5Root: Path inside the HDF5 file to object having ExpData :param model: The model for which data is to be read :return: ExpData created from data in the given location """ return _amici.read_exp_data_from_hdf5(hdf5Filename, hdf5Root, model)
[docs] def write_exp_data_to_hdf5(*args): """ *Overload 1:* Write AMICI experimental data to HDF5 file. :type edata: :py:class:`ExpData` :param edata: The experimental data which is to be written :type file: H5::H5File :param file: HDF5 file :type hdf5Location: str :param hdf5Location: Path inside the HDF5 file | *Overload 2:* Write AMICI experimental data to HDF5 file. :type edata: :py:class:`ExpData` :param edata: The experimental data which is to be written :type filepath: str :param filepath: Name of HDF5 file :type hdf5Location: str :param hdf5Location: Path inside the HDF5 file """ return _amici.write_exp_data_to_hdf5(*args)
def run_simulation(solver: Solver, edata: ExpData, model: Model, rethrow: bool=False) -> ReturnData: """ Core integration routine. Initializes the solver and runs the forward and backward problem. :param solver: Solver instance :param edata: pointer to experimental data object :param model: model specification object :param rethrow: rethrow integration exceptions? :return: rdata pointer to return data object """ return _amici.run_simulation(solver, edata, model, rethrow) def run_simulations(solver: Solver, edatas: ExpDataPtrVector, model: Model, failfast: bool, num_threads: int) -> 'Iterable[ReturnData]': """ Same as run_simulation, but for multiple ExpData instances, optionally running multiple simulations in parallel. Each simulation uses its own copy of `solver` and `model`. :param solver: Solver instance :param edatas: experimental data objects :param model: model specification object :param failfast: If true, simulations that start after a simulation has failed are skipped and return empty results. :param num_threads: Number of threads for parallel execution. Values smaller than 1 are treated as 1. :return: vector of pointers to return data objects """ return _amici.run_simulations(solver, edatas, model, failfast, num_threads)
[docs] def simulation_status_to_str(status: int) -> str: """ Get the string representation of the given simulation status code (see ReturnData::status). :param status: Status code :return: Name of the variable representing this status code. """ return _amici.simulation_status_to_str(status)
[docs] class ExpDataPtrVector(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def iterator(self): return _amici.ExpDataPtrVector_iterator(self) def __iter__(self): return self.iterator() def __bool__(self): return _amici.ExpDataPtrVector___bool__(self) def __len__(self): return _amici.ExpDataPtrVector___len__(self) def __delitem__(self, *args): return _amici.ExpDataPtrVector___delitem__(self, *args) def __getitem__(self, *args): return _amici.ExpDataPtrVector___getitem__(self, *args) def __setitem__(self, *args): return _amici.ExpDataPtrVector___setitem__(self, *args) def pop(self): return _amici.ExpDataPtrVector_pop(self) def append(self, x): return _amici.ExpDataPtrVector_append(self, x) def empty(self): return _amici.ExpDataPtrVector_empty(self) def size(self): return _amici.ExpDataPtrVector_size(self) def swap(self, v): return _amici.ExpDataPtrVector_swap(self, v) def begin(self): return _amici.ExpDataPtrVector_begin(self) def end(self): return _amici.ExpDataPtrVector_end(self) def rbegin(self): return _amici.ExpDataPtrVector_rbegin(self) def rend(self): return _amici.ExpDataPtrVector_rend(self) def clear(self): return _amici.ExpDataPtrVector_clear(self) def get_allocator(self): return _amici.ExpDataPtrVector_get_allocator(self) def pop_back(self): return _amici.ExpDataPtrVector_pop_back(self) def erase(self, *args): return _amici.ExpDataPtrVector_erase(self, *args) def __init__(self, *args): _amici.ExpDataPtrVector_swiginit(self, _amici.new_ExpDataPtrVector(*args)) def push_back(self, x): return _amici.ExpDataPtrVector_push_back(self, x) def front(self): return _amici.ExpDataPtrVector_front(self) def back(self): return _amici.ExpDataPtrVector_back(self) def assign(self, n, x): return _amici.ExpDataPtrVector_assign(self, n, x) def resize(self, *args): return _amici.ExpDataPtrVector_resize(self, *args) def insert(self, *args): return _amici.ExpDataPtrVector_insert(self, *args) def reserve(self, n): return _amici.ExpDataPtrVector_reserve(self, n) def capacity(self): return _amici.ExpDataPtrVector_capacity(self) def __repr__(self): return self.this.__repr__()[:-1] + '; ' + repr(list(self)) + ' >' __swig_destroy__ = _amici.delete_ExpDataPtrVector
_amici.ExpDataPtrVector_swigregister(ExpDataPtrVector)
[docs] class LogItemVector(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def iterator(self): return _amici.LogItemVector_iterator(self) def __iter__(self): return self.iterator() def __bool__(self): return _amici.LogItemVector___bool__(self) def __len__(self): return _amici.LogItemVector___len__(self) def __delitem__(self, *args): return _amici.LogItemVector___delitem__(self, *args) def __getitem__(self, *args): return _amici.LogItemVector___getitem__(self, *args) def __setitem__(self, *args): return _amici.LogItemVector___setitem__(self, *args) def pop(self): return _amici.LogItemVector_pop(self) def append(self, x): return _amici.LogItemVector_append(self, x) def empty(self): return _amici.LogItemVector_empty(self) def size(self): return _amici.LogItemVector_size(self) def swap(self, v): return _amici.LogItemVector_swap(self, v) def begin(self): return _amici.LogItemVector_begin(self) def end(self): return _amici.LogItemVector_end(self) def rbegin(self): return _amici.LogItemVector_rbegin(self) def rend(self): return _amici.LogItemVector_rend(self) def clear(self): return _amici.LogItemVector_clear(self) def get_allocator(self): return _amici.LogItemVector_get_allocator(self) def pop_back(self): return _amici.LogItemVector_pop_back(self) def erase(self, *args): return _amici.LogItemVector_erase(self, *args) def __init__(self, *args): _amici.LogItemVector_swiginit(self, _amici.new_LogItemVector(*args)) def push_back(self, x): return _amici.LogItemVector_push_back(self, x) def front(self): return _amici.LogItemVector_front(self) def back(self): return _amici.LogItemVector_back(self) def assign(self, n, x): return _amici.LogItemVector_assign(self, n, x) def resize(self, *args): return _amici.LogItemVector_resize(self, *args) def insert(self, *args): return _amici.LogItemVector_insert(self, *args) def reserve(self, n): return _amici.LogItemVector_reserve(self, n) def capacity(self): return _amici.LogItemVector_capacity(self) def __repr__(self): return self.this.__repr__()[:-1] + '; ' + repr(list(self)) + ' >' __swig_destroy__ = _amici.delete_LogItemVector
_amici.LogItemVector_swigregister(LogItemVector)
[docs] def parameter_scaling_from_int_vector(int_vec): """ 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:`parameter_scaling_from_int_vector` """ return _amici.parameter_scaling_from_int_vector(int_vec)
[docs] class ParameterScalingVector(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def iterator(self): return _amici.ParameterScalingVector_iterator(self) def __iter__(self): return self.iterator() def __bool__(self): return _amici.ParameterScalingVector___bool__(self) def __len__(self): return _amici.ParameterScalingVector___len__(self) def __delitem__(self, *args): return _amici.ParameterScalingVector___delitem__(self, *args) def __getitem__(self, *args): return _amici.ParameterScalingVector___getitem__(self, *args) def __setitem__(self, *args): return _amici.ParameterScalingVector___setitem__(self, *args) def pop(self): return _amici.ParameterScalingVector_pop(self) def append(self, x): return _amici.ParameterScalingVector_append(self, x) def empty(self): return _amici.ParameterScalingVector_empty(self) def size(self): return _amici.ParameterScalingVector_size(self) def swap(self, v): return _amici.ParameterScalingVector_swap(self, v) def begin(self): return _amici.ParameterScalingVector_begin(self) def end(self): return _amici.ParameterScalingVector_end(self) def rbegin(self): return _amici.ParameterScalingVector_rbegin(self) def rend(self): return _amici.ParameterScalingVector_rend(self) def clear(self): return _amici.ParameterScalingVector_clear(self) def get_allocator(self): return _amici.ParameterScalingVector_get_allocator(self) def pop_back(self): return _amici.ParameterScalingVector_pop_back(self) def erase(self, *args): return _amici.ParameterScalingVector_erase(self, *args) def __init__(self, *args): _amici.ParameterScalingVector_swiginit(self, _amici.new_ParameterScalingVector(*args)) def push_back(self, x): return _amici.ParameterScalingVector_push_back(self, x) def front(self): return _amici.ParameterScalingVector_front(self) def back(self): return _amici.ParameterScalingVector_back(self) def assign(self, n, x): return _amici.ParameterScalingVector_assign(self, n, x) def resize(self, *args): return _amici.ParameterScalingVector_resize(self, *args) def insert(self, *args): return _amici.ParameterScalingVector_insert(self, *args) def reserve(self, n): return _amici.ParameterScalingVector_reserve(self, n) def capacity(self): return _amici.ParameterScalingVector_capacity(self) def __repr__(self): return self.this.__repr__()[:-1] + '; ' + repr(list(self)) + ' >' __swig_destroy__ = _amici.delete_ParameterScalingVector
_amici.ParameterScalingVector_swigregister(ParameterScalingVector) from enum import IntEnum def enum(prefix): values = {k: v for k, v in globals().items() if k.startswith(prefix + '_')} values = {k[len(prefix) + 1:]: v for k, v in values.items()} return IntEnum(prefix, values) ParameterScaling = enum('ParameterScaling') ObservableScaling = enum('ObservableScaling') SecondOrderMode = enum('SecondOrderMode') SensitivityOrder = enum('SensitivityOrder') SensitivityMethod = enum('SensitivityMethod') LinearSolver = enum('LinearSolver') InternalSensitivityMethod = enum('InternalSensitivityMethod') InterpolationType = enum('InterpolationType') LinearMultistepMethod = enum('LinearMultistepMethod') NonlinearSolverIteration = enum('NonlinearSolverIteration') SteadyStateComputationMode = enum('SteadyStateComputationMode') SteadyStateSensitivityMode = enum('SteadyStateSensitivityMode') SteadyStateStatus = enum('SteadyStateStatus') NewtonDampingFactorMode = enum('NewtonDampingFactorMode') FixedParameterContext = enum('FixedParameterContext') RDataReporting = enum('RDataReporting') Constraint = enum('Constraint') LogSeverity = enum('LogSeverity')
[docs] class SteadyStateStatusVector(object): thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def iterator(self): return _amici.SteadyStateStatusVector_iterator(self) def __iter__(self): return self.iterator() def __bool__(self): return _amici.SteadyStateStatusVector___bool__(self) def __len__(self): return _amici.SteadyStateStatusVector___len__(self) def __delitem__(self, *args): return _amici.SteadyStateStatusVector___delitem__(self, *args) def __getitem__(self, *args): return _amici.SteadyStateStatusVector___getitem__(self, *args) def __setitem__(self, *args): return _amici.SteadyStateStatusVector___setitem__(self, *args) def pop(self): return _amici.SteadyStateStatusVector_pop(self) def append(self, x): return _amici.SteadyStateStatusVector_append(self, x) def empty(self): return _amici.SteadyStateStatusVector_empty(self) def size(self): return _amici.SteadyStateStatusVector_size(self) def swap(self, v): return _amici.SteadyStateStatusVector_swap(self, v) def begin(self): return _amici.SteadyStateStatusVector_begin(self) def end(self): return _amici.SteadyStateStatusVector_end(self) def rbegin(self): return _amici.SteadyStateStatusVector_rbegin(self) def rend(self): return _amici.SteadyStateStatusVector_rend(self) def clear(self): return _amici.SteadyStateStatusVector_clear(self) def get_allocator(self): return _amici.SteadyStateStatusVector_get_allocator(self) def pop_back(self): return _amici.SteadyStateStatusVector_pop_back(self) def erase(self, *args): return _amici.SteadyStateStatusVector_erase(self, *args) def __init__(self, *args): _amici.SteadyStateStatusVector_swiginit(self, _amici.new_SteadyStateStatusVector(*args)) def push_back(self, x): return _amici.SteadyStateStatusVector_push_back(self, x) def front(self): return _amici.SteadyStateStatusVector_front(self) def back(self): return _amici.SteadyStateStatusVector_back(self) def assign(self, n, x): return _amici.SteadyStateStatusVector_assign(self, n, x) def resize(self, *args): return _amici.SteadyStateStatusVector_resize(self, *args) def insert(self, *args): return _amici.SteadyStateStatusVector_insert(self, *args) def reserve(self, n): return _amici.SteadyStateStatusVector_reserve(self, n) def capacity(self): return _amici.SteadyStateStatusVector_capacity(self) def __repr__(self): return self.this.__repr__()[:-1] + '; ' + repr(list(self)) + ' >' __swig_destroy__ = _amici.delete_SteadyStateStatusVector
_amici.SteadyStateStatusVector_swigregister(SteadyStateStatusVector) AmiciModel = Union[Model, ModelPtr] AmiciSolver = Union[Solver, SolverPtr] AmiciExpData = Union[ExpData, ExpDataPtr] AmiciReturnData = Union[ReturnData, ReturnDataPtr] AmiciExpDataVector = Union[ExpDataPtrVector, Sequence[AmiciExpData]] def _get_ptr(obj: AmiciModel | AmiciExpData | AmiciSolver | AmiciReturnData) -> Model | ExpData | Solver | ReturnData: """ Convenience wrapper that returns the smart pointer pointee, if applicable :param obj: Potential smart pointer :returns: Non-smart pointer """ if isinstance(obj, (ModelPtr, ExpDataPtr, SolverPtr, ReturnDataPtr)): return obj.get() return obj __all__ = [x for x in dir(sys.modules[__name__]) if not x.startswith('_') and x not in {'np', 'sys', 'os', 'numpy', 'IntEnum', 'enum', 'pi', 'TYPE_CHECKING', 'Iterable', 'Sequence', 'Path', 'Union', 'overload'}]