amici.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., 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.

Module Attributes

SensitivityOrder_none

Don't compute sensitivities.

SensitivityOrder_first

First-order sensitivities.

SensitivityOrder_second

Second-order sensitivities.

SensitivityMethod_none

Don't compute sensitivities.

SensitivityMethod_forward

Forward sensitivity analysis.

SensitivityMethod_adjoint

Adjoint sensitivity analysis.

NonlinearSolverIteration_fixedpoint

deprecated

Functions

compiledWithOpenMP()

AMICI extension was compiled with OpenMP?

enum(prefix)

getScaledParameter(unscaledParameter, scaling)

Apply parameter scaling according to scaling

getUnscaledParameter(scaledParameter, scaling)

Remove parameter scaling according to scaling

parameterScalingFromIntVector(intVec)

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 amici.amici.parameterScalingFromIntVector()

runAmiciSimulation(solver, edata, model[, ...])

Core integration routine.

runAmiciSimulations(solver, edatas, model, ...)

Same as runAmiciSimulation, but for multiple ExpData instances.

scaleParameters(bufferUnscaled, pscale, ...)

Apply parameter scaling according to scaling

simulation_status_to_str(status)

Get the string representation of the given simulation status code (see ReturnData::status).

unscaleParameters(bufferScaled, pscale, ...)

Remove parameter scaling according to the parameter scaling in pscale

Classes

BoolVector(*args)

Swig-Generated class templating common python types including Iterable [bool] and numpy.array [bool] to facilitate interfacing with C++ bindings.

DoubleVector(*args)

Swig-Generated class templating common python types including Iterable [float] and numpy.array [float] to facilitate interfacing with C++ bindings.

ExpData(*args)

ExpData carries all information about experimental or condition-specific data

ExpDataPtr(*args)

Swig-Generated class that implements smart pointers to ExpData as objects.

ExpDataPtrVector(*args)

Swig-Generated class templating common python types including Iterable [amici.amici.ExpData] and numpy.array [amici.amici.ExpData] to facilitate interfacing with C++ bindings.

FixedParameterContext(value)

An enumeration.

IntVector(*args)

Swig-Generated class templating common python types including Iterable [int] and numpy.array [int] to facilitate interfacing with C++ bindings.

InternalSensitivityMethod(value)

An enumeration.

InterpolationType(value)

An enumeration.

LinearMultistepMethod(value)

An enumeration.

LinearSolver(value)

An enumeration.

LogItem(*args)

A log item.

LogItemVector(*args)

Logger()

A logger, holding a list of error messages.

Model(*args, **kwargs)

The Model class represents an AMICI ODE/DAE model.

ModelDimensions(*args)

Container for model dimensions.

ModelPtr(*args)

Swig-Generated class that implements smart pointers to Model as objects.

NewtonDampingFactorMode(value)

An enumeration.

NonlinearSolverIteration(value)

An enumeration.

ObservableScaling(value)

An enumeration.

ParameterScaling(value)

An enumeration.

ParameterScalingVector(*args)

RDataReporting(value)

An enumeration.

ReturnData(*args)

Stores all data to be returned by amici.amici.runAmiciSimulation().

ReturnDataPtr(*args)

Swig-Generated class that implements smart pointers to ReturnData as objects.

SecondOrderMode(value)

An enumeration.

SensitivityMethod(value)

An enumeration.

SensitivityOrder(value)

An enumeration.

SimulationParameters(*args)

Container for various simulation parameters.

SimulationState()

implements an exchange format to store and transfer the state of a simulation at a specific timepoint.

Solver(*args, **kwargs)

The Solver class provides a generic interface to CVODES and IDAS solvers, individual realizations are realized in the CVodeSolver and the IDASolver class.

SolverPtr(*args)

Swig-Generated class that implements smart pointers to Solver as objects.

SteadyStateSensitivityMode(value)

An enumeration.

SteadyStateStatus(value)

An enumeration.

SteadyStateStatusVector(*args)

StringDoubleMap(*args)

Swig-Generated class templating Dict [str, float] to facilitate interfacing with C++ bindings.

StringVector(*args)

Swig-Generated class templating common python types including Iterable [str] and numpy.array [str] to facilitate interfacing with C++ bindings.

class amici.amici.BoolVector(*args)[source]

Swig-Generated class templating common python types including Iterable [bool] and numpy.array [bool] to facilitate interfacing with C++ bindings.

class amici.amici.DoubleVector(*args)[source]

Swig-Generated class templating common python types including Iterable [float] and numpy.array [float] to facilitate interfacing with C++ bindings.

class amici.amici.ExpData(*args)[source]

ExpData carries all information about experimental or condition-specific data

getObservedData() std::vector< amici::realtype,std::allocator< amici::realtype > > const &[source]

Get all measurements.

Return type

DoubleVector

Returns

observed data (dimension: nt x nytrue, row-major)

getObservedDataPtr(it: int) amici::realtype const *[source]

Get measurements for a given timepoint index.

Parameters

it (int) – timepoint index

Return type

float

Returns

pointer to observed data at index (dimension: nytrue)

getObservedDataStdDev() std::vector< amici::realtype,std::allocator< amici::realtype > > const &[source]

Get measurement standard deviations.

Return type

DoubleVector

Returns

standard deviation of observed data

getObservedDataStdDevPtr(it: int) amici::realtype const *[source]

Get pointer to measurement standard deviations.

Parameters

it (int) – timepoint index

Return type

float

Returns

pointer to standard deviation of observed data at index

getObservedEvents() std::vector< amici::realtype,std::allocator< amici::realtype > > const &[source]

get function that copies data from ExpData::mz to output

Return type

DoubleVector

Returns

observed event data

getObservedEventsPtr(ie: int) amici::realtype const *[source]

get function that returns a pointer to observed data at ieth occurrence

Parameters

ie (int) – event occurrence

Return type

float

Returns

pointer to observed event data at ieth occurrence

getObservedEventsStdDev() std::vector< amici::realtype,std::allocator< amici::realtype > > const &[source]

get function that copies data from ExpData::observedEventsStdDev to output

Return type

DoubleVector

Returns

standard deviation of observed event data

getObservedEventsStdDevPtr(ie: int) amici::realtype const *[source]

get function that returns a pointer to standard deviation of observed event data at ie-th occurrence

Parameters

ie (int) – event occurrence

Return type

float

Returns

pointer to standard deviation of observed event data at ie-th occurrence

getTimepoint(it: int) amici::realtype[source]

Get timepoint for the given index

Parameters

it (int) – timepoint index

Return type

float

Returns

timepoint timepoint at index

getTimepoints() std::vector< amici::realtype,std::allocator< amici::realtype > > const &[source]

Get output timepoints.

Return type

DoubleVector

Returns

ExpData::ts

property id

Arbitrary (not necessarily unique) identifier.

isSetObservedData(it: int, iy: int) bool[source]

Whether there is a measurement for the given time- and observable- index.

Parameters
  • it (int) – time index

  • iy (int) – observable index

Return type

boolean

Returns

boolean specifying if data was set

isSetObservedDataStdDev(it: int, iy: int) bool[source]

Whether standard deviation for a measurement at specified timepoint- and observable index has been set.

Parameters
  • it (int) – time index

  • iy (int) – observable index

Return type

boolean

Returns

boolean specifying if standard deviation of data was set

isSetObservedEvents(ie: int, iz: int) bool[source]

get function that checks whether event data at specified indices has been set

Parameters
  • ie (int) – event index

  • iz (int) – event observable index

Return type

boolean

Returns

boolean specifying if data was set

isSetObservedEventsStdDev(ie: int, iz: int) bool[source]

get function that checks whether standard deviation of even data at specified indices has been set

Parameters
  • ie (int) – event index

  • iz (int) – event observable index

Return type

boolean

Returns

boolean specifying if standard deviation of event data was set

nmaxevent() int[source]

maximal number of events to track

Return type

int

Returns

maximal number of events to track

nt() int[source]

number of timepoints

Return type

int

Returns

number of timepoints

nytrue() int[source]

number of observables of the non-augmented model

Return type

int

Returns

number of observables of the non-augmented model

nztrue() int[source]

number of event observables of the non-augmented model

Return type

int

Returns

number of event observables of the non-augmented model

setObservedData(*args) void[source]

Overload 1:

Set all measurements.

Parameters

observedData (DoubleVector) – observed data (dimension: nt x nytrue, row-major)


Overload 2:

Set measurements for a given observable index

Parameters
  • observedData (DoubleVector) – observed data (dimension: nt)

  • iy (int) – observed data index

Return type

None

setObservedDataStdDev(*args) void[source]

Overload 1:

Set standard deviations for measurements.

Parameters

observedDataStdDev (DoubleVector) – standard deviation of observed data (dimension: nt x nytrue, row-major)


Overload 2:

Set indentical standard deviation for all measurements.

Parameters

stdDev (float) – standard deviation (dimension: scalar)


Overload 3:

Set standard deviations of observed data for a specific observable index.

Parameters
  • observedDataStdDev (DoubleVector) – standard deviation of observed data (dimension: nt)

  • iy (int) – observed data index


Overload 4:

Set all standard deviation for a given observable index to the input value.

Parameters
  • stdDev (float) – standard deviation (dimension: scalar)

  • iy (int) – observed data index

Return type

None

setObservedEvents(*args) void[source]

Overload 1:

set function that copies observed event data from input to ExpData::observedEvents

Parameters

observedEvents (DoubleVector) – observed data (dimension: nmaxevent x nztrue, row-major)


Overload 2:

set function that copies observed event data for specific event observable

Parameters
  • observedEvents (DoubleVector) – observed data (dimension: nmaxevent)

  • iz (int) – observed event data index

Return type

None

setObservedEventsStdDev(*args) void[source]

Overload 1:

set function that copies data from input to ExpData::observedEventsStdDev

Parameters

observedEventsStdDev (DoubleVector) – standard deviation of observed event data


Overload 2:

set function that sets all ExpData::observedDataStdDev to the input value

Parameters

stdDev (float) – standard deviation (dimension: scalar)


Overload 3:

set function that copies standard deviation of observed data for specific observable

Parameters
  • observedEventsStdDev (DoubleVector) – standard deviation of observed data (dimension: nmaxevent)

  • iz (int) – observed data index


Overload 4:

set function that sets all standard deviation of a specific observable to the input value

Parameters
  • stdDev (float) – standard deviation (dimension: scalar)

  • iz (int) – observed data index

Return type

None

setTimepoints(ts: DoubleVector) void[source]

Set output timepoints.

Parameters

ts (amici.amici.DoubleVector) – timepoints

Return type

None

class amici.amici.ExpDataPtr(*args)[source]

Swig-Generated class that implements smart pointers to ExpData as objects.

property fixedParameters

Model constants

Vector of size Model::nk() or empty

property fixedParametersPreequilibration

Model constants for pre-equilibration

Vector of size Model::nk() or empty.

property fixedParametersPresimulation

Model constants for pre-simulation

Vector of size Model::nk() or empty.

property id

Arbitrary (not necessarily unique) identifier.

property parameters

Model parameters

Vector of size Model::np() or empty with parameter scaled according to SimulationParameter::pscale.

property plist

Parameter indices w.r.t. which to compute sensitivities

property pscale

Parameter scales

Vector of parameter scale of size Model::np(), indicating how/if each parameter is to be scaled.

property reinitialization_state_idxs_presim

Indices of states to be reinitialized based on provided presimulation constants / fixed parameters.

property reinitialization_state_idxs_sim

Indices of states to be reinitialized based on provided constants / fixed parameters.

property reinitializeFixedParameterInitialStates

Flag indicating whether reinitialization of states depending on fixed parameters is activated

property sx0

Initial state sensitivities

Dimensions: Model::nx() * Model::nplist(), Model::nx() * ExpData::plist.size(), if ExpData::plist is not empty, or empty

property t_presim

Duration of pre-simulation.

If this is > 0, presimulation will be performed from (model->t0 - t_presim) to model->t0 using the fixedParameters in fixedParametersPresimulation

property ts_

Timepoints for which model state/outputs/… are requested

Vector of timepoints.

property tstart_

starting time

property x0

Initial state

Vector of size Model::nx() or empty

class amici.amici.ExpDataPtrVector(*args)[source]

Swig-Generated class templating common python types including Iterable [amici.amici.ExpData] and numpy.array [amici.amici.ExpData] to facilitate interfacing with C++ bindings.

class amici.amici.FixedParameterContext(value)

An enumeration.

preequilibration = 1
presimulation = 2
simulation = 0
class amici.amici.IntVector(*args)[source]

Swig-Generated class templating common python types including Iterable [int] and numpy.array [int] to facilitate interfacing with C++ bindings.

class amici.amici.InternalSensitivityMethod(value)

An enumeration.

simultaneous = 1
staggered = 2
staggered1 = 3
class amici.amici.InterpolationType(value)

An enumeration.

hermite = 1
polynomial = 2
class amici.amici.LinearMultistepMethod(value)

An enumeration.

BDF = 2
adams = 1
class amici.amici.LinearSolver(value)

An enumeration.

KLU = 9
LAPACKBand = 4
LAPACKDense = 3
SPBCG = 7
SPGMR = 6
SPTFQMR = 8
SuperLUMT = 10
band = 2
dense = 1
diag = 5
class amici.amici.LogItem(*args)[source]

A log item.

property identifier

Short identifier for the logged event

property message

A more detailed and readable message

property severity

Severity level

class amici.amici.LogItemVector(*args)[source]
class amici.amici.Logger[source]

A logger, holding a list of error messages.

property items

The log items

log(*args) void[source]

Overload 1:

Add a log entry

Parameters
  • severity (int) – Severity level

  • identifier (str) – Short identifier for the logged event

  • message (str) – A more detailed message


Overload 2:

Add a log entry with printf-like message formatting

Parameters
  • severity (int) – Severity level

  • identifier (str) – Short identifier for the logged event

  • format (string) – printf format string

Return type

None

class amici.amici.Model(*args, **kwargs)[source]

The Model class represents an AMICI ODE/DAE model.

The model can compute various model related quantities based on symbolically generated code.

clone() amici::Model *[source]

Clone this instance.

Return type

Model

Returns

The clone

fdsigmaydy(dsigmaydy: Iterable[float], t: float const, p: Iterable[float], k: Iterable[float], y: Iterable[float]) void[source]

Model-specific implementation of fsigmay

Parameters
Return type

None

fdtotal_cldp(dtotal_cldp: Iterable[float], x_rdata: Iterable[float], p: Iterable[float], k: Iterable[float], ip: int const) void[source]

Compute dtotal_cl / dp

Parameters
Return type

None

fdtotal_cldx_rdata(dtotal_cldx_rdata: Iterable[float], x_rdata: Iterable[float], p: Iterable[float], k: Iterable[float], tcl: Iterable[float]) void[source]

Compute dtotal_cl / dx_rdata

Parameters
Return type

None

fdx_rdatadp(dx_rdatadp: Iterable[float], x: Iterable[float], tcl: Iterable[float], p: Iterable[float], k: Iterable[float], ip: int const) void[source]

Compute dx_rdata / dp

Parameters
Return type

None

fdx_rdatadtcl(dx_rdatadtcl: Iterable[float], x: Iterable[float], tcl: Iterable[float], p: Iterable[float], k: Iterable[float]) void[source]

Compute dx_rdata / dtcl

Parameters
Return type

None

fdx_rdatadx_solver(dx_rdatadx_solver: Iterable[float], x: Iterable[float], tcl: Iterable[float], p: Iterable[float], k: Iterable[float]) void[source]

Compute dx_rdata / dx_solver

Parameters
Return type

None

getAddSigmaResiduals() bool[source]

Checks whether residuals should be added to account for parameter dependent sigma.

Return type

boolean

Returns

sigma_res

getAlwaysCheckFinite() bool[source]

Get setting of whether the result of every call to Model::f* should be checked for finiteness.

Return type

boolean

Returns

that

getExpressionIds() std::vector< std::string,std::allocator< std::string > >[source]

Get IDs of the expression.

Return type

StringVector

Returns

Expression IDs

getExpressionNames() std::vector< std::string,std::allocator< std::string > >[source]

Get names of the expressions.

Return type

StringVector

Returns

Expression names

getFixedParameterById(par_id: str) amici::realtype[source]

Get value of fixed parameter with the specified ID.

Parameters

par_id (str) – Parameter ID

Return type

float

Returns

Parameter value

getFixedParameterByName(par_name: str) amici::realtype[source]

Get value of fixed parameter with the specified name.

If multiple parameters have the same name, the first parameter with matching name is returned.

Parameters

par_name (str) – Parameter name

Return type

float

Returns

Parameter value

getFixedParameterIds() std::vector< std::string,std::allocator< std::string > >[source]

Get IDs of the fixed model parameters.

Return type

StringVector

Returns

Fixed parameter IDs

getFixedParameterNames() std::vector< std::string,std::allocator< std::string > >[source]

Get names of the fixed model parameters.

Return type

StringVector

Returns

Fixed parameter names

getFixedParameters() std::vector< amici::realtype,std::allocator< amici::realtype > > const &[source]

Get values of fixed parameters.

Return type

DoubleVector

Returns

Vector of fixed parameters with same ordering as in Model::getFixedParameterIds

getInitialStateSensitivities() std::vector< amici::realtype,std::allocator< amici::realtype > >[source]

Get the initial states sensitivities.

Return type

DoubleVector

Returns

vector of initial state sensitivities

getInitialStates() std::vector< amici::realtype,std::allocator< amici::realtype > >[source]

Get the initial states.

Return type

DoubleVector

Returns

Initial state vector

getMinimumSigmaResiduals() amici::realtype[source]

Gets the specified estimated lower boundary for sigma_y.

Return type

float

Returns

lower boundary

getName() std::string[source]

Get the model name.

Return type

str

Returns

Model name

getObservableIds() std::vector< std::string,std::allocator< std::string > >[source]

Get IDs of the observables.

Return type

StringVector

Returns

Observable IDs

getObservableNames() std::vector< std::string,std::allocator< std::string > >[source]

Get names of the observables.

Return type

StringVector

Returns

Observable names

getObservableScaling(iy: int) amici::ObservableScaling[source]

Get scaling type for observable

Parameters

iy (int) – observable index

Return type

int

Returns

scaling type

getParameterById(par_id: str) amici::realtype[source]

Get value of first model parameter with the specified ID.

Parameters

par_id (str) – Parameter ID

Return type

float

Returns

Parameter value

getParameterByName(par_name: str) amici::realtype[source]

Get value of first model parameter with the specified name.

Parameters

par_name (str) – Parameter name

Return type

float

Returns

Parameter value

getParameterIds() std::vector< std::string,std::allocator< std::string > >[source]

Get IDs of the model parameters.

Return type

StringVector

Returns

Parameter IDs

getParameterList() std::vector< int,std::allocator< int > > const &[source]

Get the list of parameters for which sensitivities are computed.

Return type

IntVector

Returns

List of parameter indices

getParameterNames() std::vector< std::string,std::allocator< std::string > >[source]

Get names of the model parameters.

Return type

StringVector

Returns

The parameter names

getParameterScale() std::vector< amici::ParameterScaling,std::allocator< amici::ParameterScaling > > const &[source]

Get parameter scale for each parameter.

Return type

ParameterScalingVector

Returns

Vector of parameter scales

getParameters() std::vector< amici::realtype,std::allocator< amici::realtype > > const &[source]

Get parameter vector.

Return type

DoubleVector

Returns

The user-set parameters (see also Model::getUnscaledParameters)

getReinitializationStateIdxs() std::vector< int,std::allocator< int > > const &[source]

Return indices of states to be reinitialized based on provided constants / fixed parameters

Return type

IntVector

Returns

Those indices.

getReinitializeFixedParameterInitialStates() bool[source]

Get whether initial states depending on fixedParameters are to be reinitialized after preequilibration and presimulation.

Return type

boolean

Returns

flag true / false

getStateIds() std::vector< std::string,std::allocator< std::string > >[source]

Get IDs of the model states.

Return type

StringVector

Returns

State IDs

getStateIdsSolver() std::vector< std::string,std::allocator< std::string > >[source]

Get IDs of the solver states.

Return type

StringVector

Returns

State IDs

getStateIsNonNegative() std::vector< bool,std::allocator< bool > > const &[source]

Get flags indicating whether states should be treated as non-negative.

Return type

BoolVector

Returns

Vector of flags

getStateNames() std::vector< std::string,std::allocator< std::string > >[source]

Get names of the model states.

Return type

StringVector

Returns

State names

getStateNamesSolver() std::vector< std::string,std::allocator< std::string > >[source]

Get names of the solver states.

Return type

StringVector

Returns

State names

getSteadyStateSensitivityMode() amici::SteadyStateSensitivityMode[source]

Gets the mode how sensitivities are computed in the steadystate simulation.

Return type

SteadyStateSensitivityMode

Returns

Mode

getTimepoint(it: int) amici::realtype[source]

Get simulation timepoint for time index it.

Parameters

it (int) – Time index

Return type

float

Returns

Timepoint

getTimepoints() std::vector< amici::realtype,std::allocator< amici::realtype > > const &[source]

Get the timepoint vector.

Return type

DoubleVector

Returns

Timepoint vector

getUnscaledParameters() std::vector< amici::realtype,std::allocator< amici::realtype > > const &[source]

Get parameters with transformation according to parameter scale applied.

Return type

DoubleVector

Returns

Unscaled parameters

hasCustomInitialStateSensitivities() bool[source]

Return whether custom initial state sensitivities have been set.

Return type

boolean

Returns

true if has custom initial state sensitivities, otherwise false.

hasCustomInitialStates() bool[source]

Return whether custom initial states have been set.

Return type

boolean

Returns

true if has custom initial states, otherwise false

hasExpressionIds() bool[source]

Report whether the model has expression IDs set.

Return type

boolean

Returns

Boolean indicating whether expression ids were set. Also returns true if the number of corresponding variables is just zero.

hasExpressionNames() bool[source]

Report whether the model has expression names set.

Return type

boolean

Returns

Boolean indicating whether expression names were set. Also returns true if the number of corresponding variables is just zero.

hasFixedParameterIds() bool[source]

Report whether the model has fixed parameter IDs set.

Return type

boolean

Returns

Boolean indicating whether fixed parameter IDs were set. Also returns true if the number of corresponding variables is just zero.

hasFixedParameterNames() bool[source]

Report whether the model has fixed parameter names set.

Return type

boolean

Returns

Boolean indicating whether fixed parameter names were set. Also returns true if the number of corresponding variables is just zero.

hasObservableIds() bool[source]

Report whether the model has observable IDs set.

Return type

boolean

Returns

Boolean indicating whether observable ids were set. Also returns true if the number of corresponding variables is just zero.

hasObservableNames() bool[source]

Report whether the model has observable names set.

Return type

boolean

Returns

Boolean indicating whether observable names were set. Also returns true if the number of corresponding variables is just zero.

hasParameterIds() bool[source]

Report whether the model has parameter IDs set.

Return type

boolean

Returns

Boolean indicating whether parameter IDs were set. Also returns true if the number of corresponding variables is just zero.

hasParameterNames() bool[source]

Report whether the model has parameter names set.

Return type

boolean

Returns

Boolean indicating whether parameter names were set. Also returns true if the number of corresponding variables is just zero.

hasQuadraticLLH() bool[source]

Checks whether the defined noise model is gaussian, i.e., the nllh is quadratic

Return type

boolean

Returns

boolean flag

hasStateIds() bool[source]

Report whether the model has state IDs set.

Return type

boolean

Returns

Boolean indicating whether state IDs were set. Also returns true if the number of corresponding variables is just zero.

hasStateNames() bool[source]

Report whether the model has state names set.

Return type

boolean

Returns

Boolean indicating whether state names were set. Also returns true if the number of corresponding variables is just zero.

property idlist

Flag array for DAE equations

k() double const *[source]

Get fixed parameters.

Return type

float

Returns

Pointer to constants array

property logger

Logger

nMaxEvent() int[source]

Get maximum number of events that may occur for each type.

Return type

int

Returns

Maximum number of events that may occur for each type

ncl() int[source]

Get number of conservation laws.

Return type

int

Returns

Number of conservation laws (i.e., difference between nx_rdata and nx_solver).

nk() int[source]

Get number of constants

Return type

int

Returns

Length of constant vector

np() int[source]

Get total number of model parameters.

Return type

int

Returns

Length of parameter vector

nplist() int[source]

Get number of parameters wrt to which sensitivities are computed.

Return type

int

Returns

Length of sensitivity index vector

nt() int[source]

Get number of timepoints.

Return type

int

Returns

Number of timepoints

nx_reinit() int[source]

Get number of solver states subject to reinitialization.

Return type

int

Returns

Model member nx_solver_reinit

property o2mode

Flag indicating whether for amici::Solver::sensi_ == amici::SensitivityOrder::second directional or full second order derivative will be computed

plist(pos: int) int[source]

Get entry in parameter list by index.

Parameters

pos (int) – Index in sensitivity parameter list

Return type

int

Returns

Index in parameter list

property pythonGenerated

Flag indicating Matlab- or Python-based model generation

requireSensitivitiesForAllParameters() void[source]

Require computation of sensitivities for all parameters p [0..np[ in natural order.

NOTE: Resets initial state sensitivities.

Return type

None

setAddSigmaResiduals(sigma_res: bool) void[source]

Specifies whether residuals should be added to account for parameter dependent sigma.

If set to true, additional residuals of the form \(\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 \(C\) can be set via setMinimumSigmaResiduals().

Parameters

sigma_res (bool) – if true, additional residuals are added

Return type

None

setAllStatesNonNegative() void[source]

Set flags indicating that all states should be treated as non-negative.

Return type

None

setAlwaysCheckFinite(alwaysCheck: bool) void[source]

Set whether the result of every call to Model::f* should be checked for finiteness.

Parameters

alwaysCheck (bool) –

Return type

None

setFixedParameterById(par_id: str, value: float) void[source]

Set value of first fixed parameter with the specified ID.

Parameters
  • par_id (str) – Fixed parameter id

  • value (float) – Fixed parameter value

Return type

None

setFixedParameterByName(par_name: str, value: float) void[source]

Set value of first fixed parameter with the specified name.

Parameters
  • par_name (str) – Fixed parameter ID

  • value (float) – Fixed parameter value

Return type

None

setFixedParameters(k: DoubleVector) void[source]

Set values for constants.

Parameters

k (amici.amici.DoubleVector) – Vector of fixed parameters

Return type

None

setFixedParametersByIdRegex(par_id_regex: str, value: float) int[source]

Set values of all fixed parameters with the ID matching the specified regex.

Parameters
  • par_id_regex (str) – Fixed parameter name regex

  • value (float) – Fixed parameter value

Return type

int

Returns

Number of fixed parameter IDs that matched the regex

setFixedParametersByNameRegex(par_name_regex: str, value: float) int[source]

Set value of all fixed parameters with name matching the specified regex.

Parameters
  • par_name_regex (str) – Fixed parameter name regex

  • value (float) – Fixed parameter value

Return type

int

Returns

Number of fixed parameter names that matched the regex

setInitialStateSensitivities(sx0: DoubleVector) void[source]

Set the initial state sensitivities.

Parameters

sx0 (amici.amici.DoubleVector) – vector of initial state sensitivities with chainrule applied. This could be a slice of ReturnData::sx or ReturnData::sx0

Return type

None

setInitialStates(x0: DoubleVector) void[source]

Set the initial states.

Parameters

x0 (amici.amici.DoubleVector) – Initial state vector

Return type

None

setMinimumSigmaResiduals(min_sigma: float) void[source]

Sets the estimated lower boundary for sigma_y. When setAddSigmaResiduals() is activated, this lower boundary must ensure that log(sigma) + min_sigma > 0.

Parameters

min_sigma (float) – lower boundary

Return type

None

setNMaxEvent(nmaxevent: int) void[source]

Set maximum number of events that may occur for each type.

Parameters

nmaxevent (int) – Maximum number of events that may occur for each type

Return type

None

setParameterById(*args) void[source]

Overload 1:

Set model parameters according to the parameter IDs and mapped values.

Parameters
  • p (StringDoubleMap) – Map of parameters IDs and values

  • ignoreErrors (boolean) – 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.

Parameters
  • par_id (str) – Parameter ID

  • value (float) – Parameter value

Return type

None

setParameterByName(*args) void[source]

Overload 1:

Set value of first model parameter with the specified name.

Parameters
  • par_name (str) – Parameter name

  • value (float) – Parameter value


Overload 2:

Set model parameters according to the parameter name and mapped values.

Parameters
  • p (StringDoubleMap) – Map of parameters names and values

  • ignoreErrors (boolean) – 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.

Parameters
  • p (StringDoubleMap) – Map of parameters names and values

  • ignoreErrors – Ignore errors such as parameter names in p which are not model parameters

Return type

None

setParameterList(plist: IntVector) void[source]

Set the list of parameters for which sensitivities are to be computed.

NOTE: Resets initial state sensitivities.

Parameters

plist (amici.amici.IntVector) – List of parameter indices

Return type

None

setParameterScale(*args) void[source]
Return type

None

setParameters(p: DoubleVector) void[source]

Set the parameter vector.

Parameters

p (amici.amici.DoubleVector) – Vector of parameters

Return type

None

setParametersByIdRegex(par_id_regex: str, value: float) int[source]

Set all values of model parameters with IDs matching the specified regular expression.

Parameters
  • par_id_regex (str) – Parameter ID regex

  • value (float) – Parameter value

Return type

int

Returns

Number of parameter IDs that matched the regex

setParametersByNameRegex(par_name_regex: str, value: float) int[source]

Set all values of all model parameters with names matching the specified regex.

Parameters
  • par_name_regex (str) – Parameter name regex

  • value (float) – Parameter value

Return type

int

Returns

Number of fixed parameter names that matched the regex

setReinitializationStateIdxs(idxs: IntVector) void[source]

Set indices of states to be reinitialized based on provided constants / fixed parameters

Parameters

idxs (amici.amici.IntVector) – Array of state indices

Return type

None

setReinitializeFixedParameterInitialStates(flag: bool) void[source]

Set whether initial states depending on fixed parameters are to be reinitialized after preequilibration and presimulation.

Parameters

flag (bool) – Fixed parameters reinitialized?

Return type

None

setStateIsNonNegative(stateIsNonNegative: BoolVector) void[source]

Set flags indicating whether states should be treated as non-negative.

Parameters

stateIsNonNegative (amici.amici.BoolVector) – Vector of flags

Return type

None

setSteadyStateSensitivityMode(mode: SteadyStateSensitivityMode) void[source]

Set the mode how sensitivities are computed in the steadystate simulation.

Parameters

mode (amici.amici.SteadyStateSensitivityMode) – Steadystate sensitivity mode

Return type

None

setT0(t0: float) void[source]

Set simulation start time.

Parameters

t0 (float) – Simulation start time

Return type

None

setTimepoints(ts: DoubleVector) void[source]

Set the timepoint vector.

Parameters

ts (amici.amici.DoubleVector) – New timepoint vector

Return type

None

setUnscaledInitialStateSensitivities(sx0: DoubleVector) void[source]

Set the initial state sensitivities.

Parameters

sx0 (amici.amici.DoubleVector) – Vector of initial state sensitivities without chainrule applied. This could be the readin from a model.sx0data saved to HDF5.

Return type

None

t0() double[source]

Get simulation start time.

Return type

float

Returns

Simulation start time

class amici.amici.ModelDimensions(*args)[source]

Container for model dimensions.

Holds number of states, observables, etc.

property lbw

Lower bandwidth of the Jacobian

property nJ

Dimension of the augmented objective function for 2nd order ASA

property ndJydy

Number of nonzero elements in the \(y\) derivative of \(dJy\) (dimension nytrue)

property ndtotal_cldx_rdata

Number of nonzero elements in the \(x_rdata\) derivative of \(total_cl\)

property ndwdp

Number of nonzero elements in the p derivative of the repeating elements

property ndwdw

Number of nonzero elements in the w derivative of the repeating elements

property ndwdx

Number of nonzero elements in the x derivative of the repeating elements

property ndxdotdw

Number of nonzero elements in the \(w\) derivative of \(xdot\)

property ndxrdatadtcl

Number of nonzero elements in the \(tcl\) derivative of \(x_rdata\)

property ndxrdatadxsolver

Number of nonzero elements in the \(x\) derivative of \(x_rdata\)

property ne

Number of events

property nk

Number of constants

property nnz

Number of nonzero entries in Jacobian

property np

Number of parameters

property nw

Number of common expressions

property nx_rdata

Number of states

property nx_solver

Number of states with conservation laws applied

property nx_solver_reinit

Number of solver states subject to reinitialization

property nxtrue_rdata

Number of states in the unaugmented system

property nxtrue_solver

Number of states in the unaugmented system with conservation laws applied

property ny

Number of observables

property nytrue

Number of observables in the unaugmented system

property nz

Number of event outputs

property nztrue

Number of event outputs in the unaugmented system

property ubw

Upper bandwidth of the Jacobian

class amici.amici.ModelPtr(*args)[source]

Swig-Generated class that implements smart pointers to Model as objects.

property idlist

Flag array for DAE equations

property lbw

Lower bandwidth of the Jacobian

property logger

Logger

property nJ

Dimension of the augmented objective function for 2nd order ASA

property ndJydy

Number of nonzero elements in the \(y\) derivative of \(dJy\) (dimension nytrue)

property ndtotal_cldx_rdata

Number of nonzero elements in the \(x_rdata\) derivative of \(total_cl\)

property ndwdp

Number of nonzero elements in the p derivative of the repeating elements

property ndwdw

Number of nonzero elements in the w derivative of the repeating elements

property ndwdx

Number of nonzero elements in the x derivative of the repeating elements

property ndxdotdw

Number of nonzero elements in the \(w\) derivative of \(xdot\)

property ndxrdatadtcl

Number of nonzero elements in the \(tcl\) derivative of \(x_rdata\)

property ndxrdatadxsolver

Number of nonzero elements in the \(x\) derivative of \(x_rdata\)

property ne

Number of events

property nnz

Number of nonzero entries in Jacobian

property nw

Number of common expressions

property nx_rdata

Number of states

property nx_solver

Number of states with conservation laws applied

property nx_solver_reinit

Number of solver states subject to reinitialization

property nxtrue_rdata

Number of states in the unaugmented system

property nxtrue_solver

Number of states in the unaugmented system with conservation laws applied

property ny

Number of observables

property nytrue

Number of observables in the unaugmented system

property nz

Number of event outputs

property nztrue

Number of event outputs in the unaugmented system

property o2mode

Flag indicating whether for amici::Solver::sensi_ == amici::SensitivityOrder::second directional or full second order derivative will be computed

property pythonGenerated

Flag indicating Matlab- or Python-based model generation

property ubw

Upper bandwidth of the Jacobian

class amici.amici.NewtonDampingFactorMode(value)

An enumeration.

off = 0
on = 1
class amici.amici.NonlinearSolverIteration(value)

An enumeration.

fixedpoint = 1
functional = 1
newton = 2
amici.amici.NonlinearSolverIteration_fixedpoint = 1

deprecated

class amici.amici.ObservableScaling(value)

An enumeration.

lin = 0
log = 1
log10 = 2
class amici.amici.ParameterScaling(value)

An enumeration.

ln = 1
log10 = 2
none = 0
class amici.amici.ParameterScalingVector(*args)[source]
class amici.amici.RDataReporting(value)

An enumeration.

full = 0
likelihood = 2
residuals = 1
class amici.amici.ReturnData(*args)[source]

Stores all data to be returned by amici.amici.runAmiciSimulation().

NOTE: multi-dimensional arrays are stored in row-major order (C-style)

property FIM

fisher information matrix (shape nplist x nplist, row-major)

property J

Jacobian of differential equation right hand side (shape nx x nx, row-major)

property chi2

\(\chi^2\) value

property cpu_time

computation time of forward solve [ms]

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property cpu_timeB

computation time of backward solve [ms]

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property cpu_time_total

total CPU time from entering runAmiciSimulation until exiting [ms]

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property id

Arbitrary (not necessarily unique) identifier.

property llh

log-likelihood value

property messages

log messages

property newton_maxsteps

maximal number of newton iterations for steady state calculation

property nmaxevent

maximal number of occurring events (for every event type)

property nplist

number of parameter for which sensitivities were requested

property nt

number of considered timepoints

property numerrtestfails

number of error test failures forward problem (shape nt)

property numerrtestfailsB

number of error test failures backward problem (shape nt)

property numnonlinsolvconvfails

number of linear solver convergence failures forward problem (shape nt)

property numnonlinsolvconvfailsB

number of linear solver convergence failures backward problem (shape nt)

property numrhsevals

number of right hand side evaluations forward problem (shape nt)

property numrhsevalsB

number of right hand side evaluations backward problem (shape nt)

property numsteps

number of integration steps forward problem (shape nt)

property numstepsB

number of integration steps backward problem (shape nt)

property nx

number of states (alias nx_rdata, kept for backward compatibility)

property nxtrue

number of states in the unaugmented system (alias nxtrue_rdata, kept for backward compatibility)

property o2mode

flag indicating whether second-order sensitivities were requested

property order

employed order forward problem (shape nt)

property posteq_cpu_time

computation time of the steady state solver [ms] (postequilibration)

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property posteq_cpu_timeB

computation time of the steady state solver of the backward problem [ms] (postequilibration)

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property posteq_numsteps

number of Newton steps for steady state problem (preequilibration) [newton, simulation, newton] (shape 3) (postequilibration)

property posteq_numstepsB

number of simulation steps for adjoint steady state problem (postequilibration) [== 0 if analytical solution worked, > 0 otherwise]

property posteq_status

flags indicating success of steady state solver (postequilibration)

property posteq_t

time when steadystate was reached via simulation (postequilibration)

property posteq_wrms

weighted root-mean-square of the rhs when steadystate was reached (postequilibration)

property preeq_cpu_time

computation time of the steady state solver [ms] (preequilibration)

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property preeq_cpu_timeB

computation time of the steady state solver of the backward problem [ms] (preequilibration)

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property preeq_numsteps

number of Newton steps for steady state problem (preequilibration) [newton, simulation, newton] (length = 3)

property preeq_numstepsB

number of simulation steps for adjoint steady state problem (preequilibration) [== 0 if analytical solution worked, > 0 otherwise]

property preeq_status

flags indicating success of steady state solver (preequilibration)

property preeq_t

time when steadystate was reached via simulation (preequilibration)

property preeq_wrms

weighted root-mean-square of the rhs when steadystate was reached (preequilibration)

property pscale

scaling of parameterization

property rdata_reporting

reporting mode

property res

observable (shape nt*ny, row-major)

property rz

event trigger output (shape nmaxevent x nz, row-major)

property s2llh

second-order parameter derivative of log-likelihood (shape nJ-1 x nplist, row-major)

property s2rz

second-order parameter derivative of event trigger output (shape nmaxevent x nztrue x nplist x nplist, row-major)

property sensi

sensitivity order

property sensi_meth

sensitivity method

property sigma_res

boolean indicating whether residuals for standard deviations have been added

property sigmay

observable standard deviation (shape nt x ny, row-major)

property sigmaz

event output sigma standard deviation (shape nmaxevent x nz, row-major)

property sllh

parameter derivative of log-likelihood (shape nplist)

property sres

parameter derivative of residual (shape nt*ny x nplist, row-major)

property srz

parameter derivative of event trigger output (shape nmaxevent x nplist x nz, row-major)

property ssigmay

parameter derivative of observable standard deviation (shape nt x nplist x ny, row-major)

property ssigmaz

parameter derivative of event output standard deviation (shape nmaxevent x nplist x nz, row-major)

property status

Simulation status code.

One of:

  • AMICI_SUCCESS, indicating successful simulation

  • AMICI_MAX_TIME_EXCEEDED, indicating that the simulation did not finish within the allowed time (see Solver.{set,get}MaxTime)

  • AMICI_ERROR, indicating that some error occurred during simulation (a more detailed error message will have been printed).

  • AMICI_NOT_RUN, if no simulation was started

property sx

parameter derivative of state (shape nt x nplist x nx, row-major)

property sx0

initial sensitivities (shape nplist x nx, row-major)

property sx_ss

preequilibration sensitivities found by Newton solver (shape nplist x nx, row-major)

property sy

parameter derivative of observable (shape nt x nplist x ny, row-major)

property sz

parameter derivative of event output (shape nmaxevent x nplist x nz, row-major)

property ts

timepoints (shape nt)

property w

w data from the model (recurring terms in xdot, for imported SBML models from python, this contains the flux vector) (shape nt x nw, row major)

property x

state (shape nt x nx, row-major)

property x0

initial state (shape nx)

property x_ss

preequilibration steady state found by Newton solver (shape nx)

property xdot

time derivative (shape nx)

property y

observable (shape nt x ny, row-major)

property z

event output (shape nmaxevent x nz, row-major)

class amici.amici.ReturnDataPtr(*args)[source]

Swig-Generated class that implements smart pointers to ReturnData as objects.

property FIM

fisher information matrix (shape nplist x nplist, row-major)

property J

Jacobian of differential equation right hand side (shape nx x nx, row-major)

property chi2

\(\chi^2\) value

property cpu_time

computation time of forward solve [ms]

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property cpu_timeB

computation time of backward solve [ms]

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property cpu_time_total

total CPU time from entering runAmiciSimulation until exiting [ms]

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property id

Arbitrary (not necessarily unique) identifier.

property lbw

Lower bandwidth of the Jacobian

property llh

log-likelihood value

property messages

log messages

property nJ

Dimension of the augmented objective function for 2nd order ASA

property ndJydy

Number of nonzero elements in the \(y\) derivative of \(dJy\) (dimension nytrue)

property ndtotal_cldx_rdata

Number of nonzero elements in the \(x_rdata\) derivative of \(total_cl\)

property ndwdp

Number of nonzero elements in the p derivative of the repeating elements

property ndwdw

Number of nonzero elements in the w derivative of the repeating elements

property ndwdx

Number of nonzero elements in the x derivative of the repeating elements

property ndxdotdw

Number of nonzero elements in the \(w\) derivative of \(xdot\)

property ndxrdatadtcl

Number of nonzero elements in the \(tcl\) derivative of \(x_rdata\)

property ndxrdatadxsolver

Number of nonzero elements in the \(x\) derivative of \(x_rdata\)

property ne

Number of events

property newton_maxsteps

maximal number of newton iterations for steady state calculation

property nk

Number of constants

property nmaxevent

maximal number of occurring events (for every event type)

property nnz

Number of nonzero entries in Jacobian

property np

Number of parameters

property nplist

number of parameter for which sensitivities were requested

property nt

number of considered timepoints

property numerrtestfails

number of error test failures forward problem (shape nt)

property numerrtestfailsB

number of error test failures backward problem (shape nt)

property numnonlinsolvconvfails

number of linear solver convergence failures forward problem (shape nt)

property numnonlinsolvconvfailsB

number of linear solver convergence failures backward problem (shape nt)

property numrhsevals

number of right hand side evaluations forward problem (shape nt)

property numrhsevalsB

number of right hand side evaluations backward problem (shape nt)

property numsteps

number of integration steps forward problem (shape nt)

property numstepsB

number of integration steps backward problem (shape nt)

property nw

Number of common expressions

property nx

number of states (alias nx_rdata, kept for backward compatibility)

property nx_rdata

Number of states

property nx_solver

Number of states with conservation laws applied

property nx_solver_reinit

Number of solver states subject to reinitialization

property nxtrue

number of states in the unaugmented system (alias nxtrue_rdata, kept for backward compatibility)

property nxtrue_rdata

Number of states in the unaugmented system

property nxtrue_solver

Number of states in the unaugmented system with conservation laws applied

property ny

Number of observables

property nytrue

Number of observables in the unaugmented system

property nz

Number of event outputs

property nztrue

Number of event outputs in the unaugmented system

property o2mode

flag indicating whether second-order sensitivities were requested

property order

employed order forward problem (shape nt)

property posteq_cpu_time

computation time of the steady state solver [ms] (postequilibration)

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property posteq_cpu_timeB

computation time of the steady state solver of the backward problem [ms] (postequilibration)

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property posteq_numsteps

number of Newton steps for steady state problem (preequilibration) [newton, simulation, newton] (shape 3) (postequilibration)

property posteq_numstepsB

number of simulation steps for adjoint steady state problem (postequilibration) [== 0 if analytical solution worked, > 0 otherwise]

property posteq_status

flags indicating success of steady state solver (postequilibration)

property posteq_t

time when steadystate was reached via simulation (postequilibration)

property posteq_wrms

weighted root-mean-square of the rhs when steadystate was reached (postequilibration)

property preeq_cpu_time

computation time of the steady state solver [ms] (preequilibration)

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property preeq_cpu_timeB

computation time of the steady state solver of the backward problem [ms] (preequilibration)

Warning

This tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.

property preeq_numsteps

number of Newton steps for steady state problem (preequilibration) [newton, simulation, newton] (length = 3)

property preeq_numstepsB

number of simulation steps for adjoint steady state problem (preequilibration) [== 0 if analytical solution worked, > 0 otherwise]

property preeq_status

flags indicating success of steady state solver (preequilibration)

property preeq_t

time when steadystate was reached via simulation (preequilibration)

property preeq_wrms

weighted root-mean-square of the rhs when steadystate was reached (preequilibration)

property pscale

scaling of parameterization

property rdata_reporting

reporting mode

property res

observable (shape nt*ny, row-major)

property rz

event trigger output (shape nmaxevent x nz, row-major)

property s2llh

second-order parameter derivative of log-likelihood (shape nJ-1 x nplist, row-major)

property s2rz

second-order parameter derivative of event trigger output (shape nmaxevent x nztrue x nplist x nplist, row-major)

property sensi

sensitivity order

property sensi_meth

sensitivity method

property sigma_res

boolean indicating whether residuals for standard deviations have been added

property sigmay

observable standard deviation (shape nt x ny, row-major)

property sigmaz

event output sigma standard deviation (shape nmaxevent x nz, row-major)

property sllh

parameter derivative of log-likelihood (shape nplist)

property sres

parameter derivative of residual (shape nt*ny x nplist, row-major)

property srz

parameter derivative of event trigger output (shape nmaxevent x nplist x nz, row-major)

property ssigmay

parameter derivative of observable standard deviation (shape nt x nplist x ny, row-major)

property ssigmaz

parameter derivative of event output standard deviation (shape nmaxevent x nplist x nz, row-major)

property status

Simulation status code.

One of:

  • AMICI_SUCCESS, indicating successful simulation

  • AMICI_MAX_TIME_EXCEEDED, indicating that the simulation did not finish within the allowed time (see Solver.{set,get}MaxTime)

  • AMICI_ERROR, indicating that some error occurred during simulation (a more detailed error message will have been printed).

  • AMICI_NOT_RUN, if no simulation was started

property sx

parameter derivative of state (shape nt x nplist x nx, row-major)

property sx0

initial sensitivities (shape nplist x nx, row-major)

property sx_ss

preequilibration sensitivities found by Newton solver (shape nplist x nx, row-major)

property sy

parameter derivative of observable (shape nt x nplist x ny, row-major)

property sz

parameter derivative of event output (shape nmaxevent x nplist x nz, row-major)

property ts

timepoints (shape nt)

property ubw

Upper bandwidth of the Jacobian

property w

w data from the model (recurring terms in xdot, for imported SBML models from python, this contains the flux vector) (shape nt x nw, row major)

property x

state (shape nt x nx, row-major)

property x0

initial state (shape nx)

property x_ss

preequilibration steady state found by Newton solver (shape nx)

property xdot

time derivative (shape nx)

property y

observable (shape nt x ny, row-major)

property z

event output (shape nmaxevent x nz, row-major)

class amici.amici.SecondOrderMode(value)

An enumeration.

directional = 2
full = 1
none = 0
class amici.amici.SensitivityMethod(value)

An enumeration.

adjoint = 2
forward = 1
none = 0
amici.amici.SensitivityMethod_adjoint = 2

Adjoint sensitivity analysis.

amici.amici.SensitivityMethod_forward = 1

Forward sensitivity analysis.

amici.amici.SensitivityMethod_none = 0

Don’t compute sensitivities.

class amici.amici.SensitivityOrder(value)

An enumeration.

first = 1
none = 0
second = 2
amici.amici.SensitivityOrder_first = 1

First-order sensitivities.

amici.amici.SensitivityOrder_none = 0

Don’t compute sensitivities.

amici.amici.SensitivityOrder_second = 2

Second-order sensitivities.

class amici.amici.SimulationParameters(*args)[source]

Container for various simulation parameters.

property fixedParameters

Model constants

Vector of size Model::nk() or empty

property fixedParametersPreequilibration

Model constants for pre-equilibration

Vector of size Model::nk() or empty.

property fixedParametersPresimulation

Model constants for pre-simulation

Vector of size Model::nk() or empty.

property parameters

Model parameters

Vector of size Model::np() or empty with parameter scaled according to SimulationParameter::pscale.

property plist

Parameter indices w.r.t. which to compute sensitivities

property pscale

Parameter scales

Vector of parameter scale of size Model::np(), indicating how/if each parameter is to be scaled.

property reinitialization_state_idxs_presim

Indices of states to be reinitialized based on provided presimulation constants / fixed parameters.

property reinitialization_state_idxs_sim

Indices of states to be reinitialized based on provided constants / fixed parameters.

reinitializeAllFixedParameterDependentInitialStates(nx_rdata: int) void[source]

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

Parameters

nx_rdata (int) – Number of states (Model::nx_rdata)

Return type

None

reinitializeAllFixedParameterDependentInitialStatesForPresimulation(nx_rdata: int) void[source]

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

Parameters

nx_rdata (int) – Number of states (Model::nx_rdata)

Return type

None

reinitializeAllFixedParameterDependentInitialStatesForSimulation(nx_rdata: int) void[source]

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

Parameters

nx_rdata (int) – Number of states (Model::nx_rdata)

Return type

None

property reinitializeFixedParameterInitialStates

Flag indicating whether reinitialization of states depending on fixed parameters is activated

property sx0

Initial state sensitivities

Dimensions: Model::nx() * Model::nplist(), Model::nx() * ExpData::plist.size(), if ExpData::plist is not empty, or empty

property t_presim

Duration of pre-simulation.

If this is > 0, presimulation will be performed from (model->t0 - t_presim) to model->t0 using the fixedParameters in fixedParametersPresimulation

property ts_

Timepoints for which model state/outputs/… are requested

Vector of timepoints.

property tstart_

starting time

property x0

Initial state

Vector of size Model::nx() or empty

class amici.amici.SimulationState[source]

implements an exchange format to store and transfer the state of a simulation at a specific timepoint.

property dx

state variables

property state

state of the model that was used for simulation

property sx

state variable sensitivity

property t

timepoint

property x

state variables

class amici.amici.Solver(*args, **kwargs)[source]

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.

NOTE: Any changes in data members here must be propagated to copy ctor, equality operator, serialization functions in serialization.h, and amici::hdf5::(read/write)SolverSettings(From/To)HDF5 in hdf5.cpp.

clone() amici::Solver *[source]

Clone this instance

Return type

Solver

Returns

The clone

computingASA() bool[source]

check if ASA is being computed

Return type

boolean

Returns

flag

computingFSA() bool[source]

check if FSA is being computed

Return type

boolean

Returns

flag

getAbsoluteTolerance() double[source]

Get the absolute tolerances for the forward problem

Same tolerance is used for the backward problem if not specified differently via setAbsoluteToleranceASA.

Return type

float

Returns

absolute tolerances

getAbsoluteToleranceB() double[source]

Returns the absolute tolerances for the backward problem for adjoint sensitivity analysis

Return type

float

Returns

absolute tolerances

getAbsoluteToleranceFSA() double[source]

Returns the absolute tolerances for the forward sensitivity problem

Return type

float

Returns

absolute tolerances

getAbsoluteToleranceQuadratures() double[source]

returns the absolute tolerance for the quadrature problem

Return type

float

Returns

absolute tolerance

getAbsoluteToleranceSteadyState() double[source]

returns the absolute tolerance for the steady state problem

Return type

float

Returns

absolute tolerance

getAbsoluteToleranceSteadyStateSensi() double[source]

returns the absolute tolerance for the sensitivities of the steady state problem

Return type

float

Returns

absolute tolerance

getCpuTime() amici::realtype[source]

Reads out the CPU time needed for forward solve

Return type

float

Returns

cpu_time

getCpuTimeB() amici::realtype[source]

Reads out the CPU time needed for backward solve

Return type

float

Returns

cpu_timeB

getInternalSensitivityMethod() amici::InternalSensitivityMethod[source]

returns the internal sensitivity method

Return type

InternalSensitivityMethod

Returns

internal sensitivity method

getInterpolationType() amici::InterpolationType[source]
Return type

InterpolationType

Returns

getLastOrder() std::vector< int,std::allocator< int > > const &[source]

Accessor order

Return type

IntVector

Returns

order

getLinearMultistepMethod() amici::LinearMultistepMethod[source]

returns the linear system multistep method

Return type

LinearMultistepMethod

Returns

linear system multistep method

getLinearSolver() amici::LinearSolver[source]
Return type

LinearSolver

Returns

getMaxSteps() long[source]

returns the maximum number of solver steps for the forward problem

Return type

int

Returns

maximum number of solver steps

getMaxStepsBackwardProblem() long[source]

returns the maximum number of solver steps for the backward problem

Return type

int

Returns

maximum number of solver steps

getMaxTime() double[source]

Returns the maximum time allowed for integration

Return type

float

Returns

Time in seconds

getNewtonDampingFactorLowerBound() double[source]

Get a lower bound of the damping factor used in the Newton solver

Return type

float

Returns

getNewtonDampingFactorMode() amici::NewtonDampingFactorMode[source]

Get a state of the damping factor used in the Newton solver

Return type

NewtonDampingFactorMode

Returns

getNewtonMaxSteps() int[source]

Get maximum number of allowed Newton steps for steady state computation

Return type

int

Returns

getNewtonStepSteadyStateCheck() bool[source]

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 type

boolean

Returns

boolean flag indicating newton step (true) or the right hand side (false)

getNonlinearSolverIteration() amici::NonlinearSolverIteration[source]

returns the nonlinear system solution method

Return type

NonlinearSolverIteration

Returns

getNumErrTestFails() std::vector< int,std::allocator< int > > const &[source]

Accessor netf

Return type

IntVector

Returns

netf

getNumErrTestFailsB() std::vector< int,std::allocator< int > > const &[source]

Accessor netfB

Return type

IntVector

Returns

netfB

getNumNonlinSolvConvFails() std::vector< int,std::allocator< int > > const &[source]

Accessor nnlscf

Return type

IntVector

Returns

nnlscf

getNumNonlinSolvConvFailsB() std::vector< int,std::allocator< int > > const &[source]

Accessor nnlscfB

Return type

IntVector

Returns

nnlscfB

getNumRhsEvals() std::vector< int,std::allocator< int > > const &[source]

Accessor nrhs

Return type

IntVector

Returns

nrhs

getNumRhsEvalsB() std::vector< int,std::allocator< int > > const &[source]

Accessor nrhsB

Return type

IntVector

Returns

nrhsB

getNumSteps() std::vector< int,std::allocator< int > > const &[source]

Accessor ns

Return type

IntVector

Returns

ns

getNumStepsB() std::vector< int,std::allocator< int > > const &[source]

Accessor nsB

Return type

IntVector

Returns

nsB

getRelativeTolerance() double[source]

Get the relative tolerances for the forward problem

Same tolerance is used for the backward problem if not specified differently via setRelativeToleranceASA.

Return type

float

Returns

relative tolerances

getRelativeToleranceB() double[source]

Returns the relative tolerances for the adjoint sensitivity problem

Return type

float

Returns

relative tolerances

getRelativeToleranceFSA() double[source]

Returns the relative tolerances for the forward sensitivity problem

Return type

float

Returns

relative tolerances

getRelativeToleranceQuadratures() double[source]

Returns the relative tolerance for the quadrature problem

Return type

float

Returns

relative tolerance

getRelativeToleranceSteadyState() double[source]

returns the relative tolerance for the steady state problem

Return type

float

Returns

relative tolerance

getRelativeToleranceSteadyStateSensi() double[source]

returns the relative tolerance for the sensitivities of the steady state problem

Return type

float

Returns

relative tolerance

getReturnDataReportingMode() amici::RDataReporting[source]

returns the ReturnData reporting mode

Return type

RDataReporting

Returns

ReturnData reporting mode

getSensiSteadyStateCheck() bool[source]

Returns how convergence checks for steadystate computation are performed.

Return type

boolean

Returns

boolean flag indicating state and sensitivity equations (true) or only state variables (false).

getSensitivityMethod() amici::SensitivityMethod[source]

Return current sensitivity method

Return type

SensitivityMethod

Returns

method enum

getSensitivityMethodPreequilibration() amici::SensitivityMethod[source]

Return current sensitivity method during preequilibration

Return type

SensitivityMethod

Returns

method enum

getSensitivityOrder() amici::SensitivityOrder[source]

Get sensitivity order

Return type

SensitivityOrder

Returns

sensitivity order

getStabilityLimitFlag() bool[source]

returns stability limit detection mode

Return type

boolean

Returns

stldet can be false (deactivated) or true (activated)

getStateOrdering() int[source]

Gets KLU / SuperLUMT state ordering mode

Return type

int

Returns

State-ordering as integer according to SUNLinSolKLU::StateOrdering or SUNLinSolSuperLUMT::StateOrdering (which differ).

getSteadyStateSensiToleranceFactor() double[source]

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)ToleranceSteadyStateSensi().

Return type

float

Returns

steady state simulation tolerance factor

getSteadyStateToleranceFactor() double[source]

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(Absolute/Relative)ToleranceSteadyState().

Return type

float

Returns

steady state simulation tolerance factor

gett() amici::realtype[source]

current solver timepoint

Return type

float

Returns

t

property logger
nplist() int[source]

number of parameters with which the solver was initialized

Return type

int

Returns

sx.getLength()

nquad() int[source]

number of quadratures with which the solver was initialized

Return type

int

Returns

xQB.getLength()

nx() int[source]

number of states with which the solver was initialized

Return type

int

Returns

x.getLength()

setAbsoluteTolerance(atol: float) void[source]

Sets the absolute tolerances for the forward problem

Same tolerance is used for the backward problem if not specified differently via setAbsoluteToleranceASA.

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setAbsoluteToleranceB(atol: float) void[source]

Sets the absolute tolerances for the backward problem for adjoint sensitivity analysis

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setAbsoluteToleranceFSA(atol: float) void[source]

Sets the absolute tolerances for the forward sensitivity problem

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setAbsoluteToleranceQuadratures(atol: float) void[source]

sets the absolute tolerance for the quadrature problem

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setAbsoluteToleranceSteadyState(atol: float) void[source]

sets the absolute tolerance for the steady state problem

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setAbsoluteToleranceSteadyStateSensi(atol: float) void[source]

sets the absolute tolerance for the sensitivities of the steady state problem

Parameters

atol (float) – absolute tolerance (non-negative number)

Return type

None

setInternalSensitivityMethod(ism: InternalSensitivityMethod) void[source]

sets the internal sensitivity method

Parameters

ism (amici.amici.InternalSensitivityMethod) – internal sensitivity method

Return type

None

setInterpolationType(interpType: InterpolationType) void[source]

sets the interpolation of the forward solution that is used for the backwards problem

Parameters

interpType (amici.amici.InterpolationType) – interpolation type

Return type

None

setLinearMultistepMethod(lmm: LinearMultistepMethod) void[source]

sets the linear system multistep method

Parameters

lmm (amici.amici.LinearMultistepMethod) – linear system multistep method

Return type

None

setLinearSolver(linsol: LinearSolver) void[source]
Parameters

linsol (amici.amici.LinearSolver) –

Return type

None

setMaxSteps(maxsteps: int) void[source]

sets the maximum number of solver steps for the forward problem

Parameters

maxsteps (int) – maximum number of solver steps (positive number)

Return type

None

setMaxStepsBackwardProblem(maxsteps: int) void[source]

sets the maximum number of solver steps for the backward problem

Parameters

maxsteps (int) – 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 type

None

setMaxTime(maxtime: float) void[source]

Set the maximum CPU time allowed for integration

Parameters

maxtime (float) – Time in seconds. Zero means infinite time.

Return type

None

setNewtonDampingFactorLowerBound(dampingFactorLowerBound: float) void[source]

Set a lower bound of the damping factor in the Newton solver

Parameters

dampingFactorLowerBound (float) –

Return type

None

setNewtonDampingFactorMode(dampingFactorMode: NewtonDampingFactorMode) void[source]

Turn on/off a damping factor in the Newton method

Parameters

dampingFactorMode (amici.amici.NewtonDampingFactorMode) –

Return type

None

setNewtonMaxSteps(newton_maxsteps: int) void[source]

Set maximum number of allowed Newton steps for steady state computation

Parameters

newton_maxsteps (int) –

Return type

None

setNewtonStepSteadyStateCheck(flag: bool) void[source]

Sets how convergence checks for steadystate computation are performed.

Parameters

flag (bool) – boolean flag to pick newton step (true) or the right hand side (false, default)

Return type

None

setNonlinearSolverIteration(iter: NonlinearSolverIteration) void[source]

sets the nonlinear system solution method

Parameters

iter (amici.amici.NonlinearSolverIteration) – nonlinear system solution method

Return type

None

setRelativeTolerance(rtol: float) void[source]

Sets the relative tolerances for the forward problem

Same tolerance is used for the backward problem if not specified differently via setRelativeToleranceASA.

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setRelativeToleranceB(rtol: float) void[source]

Sets the relative tolerances for the adjoint sensitivity problem

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setRelativeToleranceFSA(rtol: float) void[source]

Sets the relative tolerances for the forward sensitivity problem

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setRelativeToleranceQuadratures(rtol: float) void[source]

sets the relative tolerance for the quadrature problem

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setRelativeToleranceSteadyState(rtol: float) void[source]

sets the relative tolerance for the steady state problem

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setRelativeToleranceSteadyStateSensi(rtol: float) void[source]

sets the relative tolerance for the sensitivities of the steady state problem

Parameters

rtol (float) – relative tolerance (non-negative number)

Return type

None

setReturnDataReportingMode(rdrm: RDataReporting) void[source]

sets the ReturnData reporting mode

Parameters

rdrm (amici.amici.RDataReporting) – ReturnData reporting mode

Return type

None

setSensiSteadyStateCheck(flag: bool) void[source]

Sets for which variables convergence checks for steadystate computation are performed.

Parameters

flag (bool) – boolean flag to pick state and sensitivity equations (true, default) or only state variables (false).

Return type

None

setSensitivityMethod(sensi_meth: SensitivityMethod) void[source]

Set sensitivity method

Parameters

sensi_meth (amici.amici.SensitivityMethod) –

Return type

None

setSensitivityMethodPreequilibration(sensi_meth_preeq: SensitivityMethod) void[source]

Set sensitivity method for preequilibration

Parameters

sensi_meth_preeq (amici.amici.SensitivityMethod) –

Return type

None

setSensitivityOrder(sensi: SensitivityOrder) void[source]

Set the sensitivity order

Parameters

sensi (amici.amici.SensitivityOrder) – sensitivity order

Return type

None

setStabilityLimitFlag(stldet: bool) void[source]

set stability limit detection mode

Parameters

stldet (bool) – can be false (deactivated) or true (activated)

Return type

None

setStateOrdering(ordering: int) void[source]

Sets KLU / SuperLUMT state ordering mode

This only applies when linsol is set to LinearSolver::KLU or LinearSolver::SuperLUMT. Mind the difference between SUNLinSolKLU::StateOrdering and SUNLinSolSuperLUMT::StateOrdering.

Parameters

ordering (int) – state ordering

Return type

None

setSteadyStateSensiToleranceFactor(factor: float) void[source]

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)ToleranceSteadyStateSensi().

Parameters

factor (float) – tolerance factor (non-negative number)

Return type

None

setSteadyStateToleranceFactor(factor: float) void[source]

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(Absolute/Relative)ToleranceSteadyState().

Parameters

factor (float) – tolerance factor (non-negative number)

Return type

None

startTimer() void[source]

Start timer for tracking integration time

Return type

None

switchForwardSensisOff() void[source]

Disable forward sensitivity integration (used in steady state sim)

Return type

None

timeExceeded(interval: int = 1) bool[source]

Check whether maximum integration time was exceeded

Parameters

interval (int) – Only check the time every interval ths call to avoid potentially relatively expensive syscalls

Return type

boolean

Returns

True if the maximum integration time was exceeded, false otherwise.

class amici.amici.SolverPtr(*args)[source]

Swig-Generated class that implements smart pointers to Solver as objects.

property logger
class amici.amici.SteadyStateSensitivityMode(value)

An enumeration.

integrateIfNewtonFails = 2
integrationOnly = 1
newtonOnly = 0
class amici.amici.SteadyStateStatus(value)

An enumeration.

failed = -1
failed_convergence = -2
failed_damping = -4
failed_factorization = -3
failed_too_long_simulation = -5
not_run = 0
success = 1
class amici.amici.SteadyStateStatusVector(*args)[source]
class amici.amici.StringDoubleMap(*args)[source]

Swig-Generated class templating Dict [str, float] to facilitate interfacing with C++ bindings.

class amici.amici.StringVector(*args)[source]

Swig-Generated class templating common python types including Iterable [str] and numpy.array [str] to facilitate interfacing with C++ bindings.

amici.amici.compiledWithOpenMP() bool[source]

AMICI extension was compiled with OpenMP?

Return type

bool

amici.amici.enum(prefix)[source]
amici.amici.getScaledParameter(unscaledParameter: float, scaling: ParameterScaling) double[source]

Apply parameter scaling according to scaling

Parameters
Return type

float

Returns

Scaled parameter

amici.amici.getUnscaledParameter(scaledParameter: float, scaling: ParameterScaling) double[source]

Remove parameter scaling according to scaling

Parameters
Return type

float

Returns

Unscaled parameter

amici.amici.parameterScalingFromIntVector(intVec: IntVector) std::vector< amici::ParameterScaling,std::allocator< amici::ParameterScaling > >[source]

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 amici.amici.parameterScalingFromIntVector()

Return type

amici.amici.ParameterScalingVector

amici.amici.runAmiciSimulation(solver: Solver, edata: ExpData, model: Model, rethrow: bool = False) std::unique_ptr< amici::ReturnData >[source]

Core integration routine. Initializes the solver and runs the forward and backward problem.

Parameters
Return type

ReturnData

Returns

rdata pointer to return data object

amici.amici.runAmiciSimulations(solver: Solver, edatas: ExpDataPtrVector, model: Model, failfast: bool, num_threads: int) std::vector< std::unique_ptr< amici::ReturnData >,std::allocator< std::unique_ptr< amici::ReturnData > > >[source]

Same as runAmiciSimulation, but for multiple ExpData instances. When compiled with OpenMP support, this function runs multi-threaded.

Parameters
Return type

Iterable[ReturnData]

Returns

vector of pointers to return data objects

amici.amici.scaleParameters(bufferUnscaled: Iterable[float], pscale: Iterable[ParameterScaling], bufferScaled: Iterable[float]) void[source]

Apply parameter scaling according to scaling

Parameters
Return type

None

amici.amici.simulation_status_to_str(status: int) std::string[source]

Get the string representation of the given simulation status code (see ReturnData::status).

Parameters

status (int) – Status code

Return type

str

Returns

Name of the variable representing this status code.

amici.amici.unscaleParameters(bufferScaled: Iterable[float], pscale: Iterable[ParameterScaling], bufferUnscaled: Iterable[float]) void[source]

Remove parameter scaling according to the parameter scaling in pscale

All vectors must be of same length.

Parameters
Return type

None