amici.sim.sundials
Functionality for simulating AMICI models using SUNDIALS solvers.
This module provides the relevant objects for simulating AMICI models using SUNDIALS solvers such as CVODES and IDAS and for analyzing the simulation results.
Functions
|
Import Python module of an AMICI model. |
AMICI extension was compiled with OpenMP? |
|
|
Returns the current backtrace as std::string |
|
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 |
|
Read AMICI ExpData data from HDF5 file. |
|
Overload 1: |
|
Apply solver settings from an HDF5 file to a Solver instance. |
|
Simulate a model with given solver and experimental data. |
|
Convenience wrapper for loops of amici.runAmiciSimulation |
|
Apply parameter scaling according to scaling |
|
Get the string representation of the given simulation status code (see ReturnData::status). |
|
Remove parameter scaling according to scaling |
|
Overload 1: |
|
Overload 1: |
|
Write solver settings from a Solver instance to an HDF5 file. |
|
Evaluate a symbolic expression based on the given simulation outputs. |
|
Set model settings. |
|
Get model settings that are set independently of the compiled model. |
|
Get a model set-up to simulate the preequilibration condition as specified in edata. |
Classes
|
Type of AMICI-generated model modules. |
|
|
|
|
|
Tracks elapsed CPU time using std::clock. |
|
|
|
ExpData carries all information about experimental or condition-specific data. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A log item. |
|
|
|
|
|
The Model class represents an AMICI ODE/DAE model. |
Container for model dimensions. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Stores all data to be returned by amici::run_simulation. |
|
|
|
|
|
|
|
|
|
Container for various simulation parameters. |
|
The Solver class provides a generic interface to CVODES and IDAS solvers, individual realizations are realized in the CVodeSolver and the IDASolver class. |
|
|
|
|
|
|
|
|
|
|
|
Swig-Generated class templating |
|
|
|
Interface class for C++ Exp Data objects that avoids possibly costly copies of member data. |
|
Interface class for C++ |
- class amici.sim.sundials.Constraint(*values)
- __init__(*args, **kwds)
- negative = 1
- non_negative = 1
- non_positive = 1
- none = 1
- positive = 1
- class amici.sim.sundials.CpuTimer[source]
Tracks elapsed CPU time using std::clock.
- elapsed_milliseconds()[source]
Get elapsed CPU time in milliseconds since initialization or last reset
- Return type:
- Returns:
CPU time in milliseconds
- elapsed_seconds()[source]
Get elapsed CPU time in seconds since initialization or last reset
- Return type:
- Returns:
CPU time in seconds
- uses_thread_clock = <MagicMock name='mock.CpuTimer_uses_thread_clock' id='134447522233856'>
Whether the timer uses a thread clock (i.e. provides proper, thread-specific CPU time).
- class amici.sim.sundials.ExpData(*args)[source]
ExpData carries all information about experimental or condition-specific data.
- __init__(*args)[source]
Overload 1:
Default constructor.
Overload 2:
Copy constructor.
Overload 3:
Constructor that only initializes dimensions.
- Parameters:
Overload 4:
constructor that initializes timepoints from vectors
- Parameters:
nytrue (int) – Number of observables
nztrue (int) – Number of event outputs
nmaxevent (int) – Maximal number of events to track
ts (DoubleVector) – Timepoints (dimension: nt)
Overload 5:
constructor that initializes timepoints and fixed parameters from vectors
- Parameters:
nytrue (int) – Number of observables
nztrue (int) – Number of event outputs
nmaxevent (int) – Maximal number of events to track
ts (DoubleVector) – Timepoints (dimension: nt)
fixed_parameters (DoubleVector) – Model variables excluded from sensitivity analysis (dimension: nk)
Overload 6:
constructor that initializes timepoints and data from vectors
- Parameters:
nytrue (int) – Number of observables
nztrue (int) – Number of event outputs
nmaxevent (int) – Maximal number of events to track
ts (DoubleVector) – Timepoints (dimension: nt)
my (DoubleVector) – measurements (dimension: nt x nytrue, row-major)
sigma_y (DoubleVector) – noise scale of measurements (dimension: nt x nytrue, row-major)
mz (DoubleVector) – event measurements (dimension: nmaxevents x nztrue, row-major)
sigma_z (DoubleVector) – noise scale of event measurements (dimension: nmaxevents x nztrue, row-major)
Overload 7:
constructor that initializes with Model
- Parameters:
model (
Model) – pointer to model specification object
Overload 8:
Constructor that initializes with ReturnData, adds normally distributed noise according to specified sigmas.
- Parameters:
rdata (
ReturnData) – return data pointer with stored simulation resultssigma_y (float) – scalar noise scales for all observables
sigma_z (float) – scalar noise scales for all event observables
seed (int, optional) – 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.
- Parameters:
rdata (
ReturnData) – return data pointer with stored simulation resultssigma_y (float) – scalar noise scales for all observables
sigma_z (float) – scalar noise scales for all event observables
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.
- Parameters:
rdata (
ReturnData) – return data pointer with stored simulation resultssigma_y (DoubleVector) – vector of noise scales for observables (dimension: nytrue or nt x nytrue, row-major)
sigma_z (DoubleVector) – vector of noise scales for event observables (dimension: nztrue or nmaxevent x nztrue, row-major)
seed (int, optional) – 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.
- Parameters:
rdata (
ReturnData) – return data pointer with stored simulation resultssigma_y (DoubleVector) – vector of noise scales for observables (dimension: nytrue or nt x nytrue, row-major)
sigma_z (DoubleVector) – vector of noise scales for event observables (dimension: nztrue or nmaxevent x nztrue, row-major)
seed – Seed for the random number generator. If a negative number is passed, a random seed is used.
- clear_observations()[source]
Set all observations and their noise scales to NaN.
Useful, e.g., after calling ExpData::setTimepoints.
- property fixed_parameters
Model constants
Vector of size Model::nk() or empty
- property fixed_parameters_pre_equilibration
Model constants for pre-equilibration
Vector of size Model::nk() or empty.
- property fixed_parameters_presimulation
Model constants for pre-simulation
Vector of size Model::nk() or empty.
- property free_parameters
Model free_parameters
Vector of size Model::np() or empty with parameter scaled according to SimulationParameter::pscale.
- get_event_measurements()[source]
Get all event measurements.
- Return type:
- Returns:
event measurements
- get_event_noise_scales()[source]
Get noise scale of observed event data.
- Return type:
- Returns:
noise scale of observed event data
- get_event_noise_scales_ptr(ie)[source]
Get pointer to noise scale of observed event data at ie-th occurrence.
- get_measurements()[source]
Get all measurements.
- Return type:
- Returns:
measurements (dimension: nt x nytrue, row-major)
- get_noise_scales()[source]
Get measurement noise scales.
- Return type:
- Returns:
noise scales of measurements
- property id
Arbitrary (not necessarily unique) identifier.
- is_set_event_measurement(ie, iz)[source]
Check whether an event measurement is defined at the given indices.
- is_set_event_noise_scale(ie, iz)[source]
Check whether an event noise scale is defined at the given indices.
- nmaxevent()[source]
maximal number of events to track
- Return type:
- Returns:
maximal number of events to track
- nytrue()[source]
number of observables of the non-augmented model
- Return type:
- Returns:
number of observables of the non-augmented model
- nztrue()[source]
number of event observables of the non-augmented model
- Return type:
- Returns:
number of event observables of the non-augmented model
- 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.
- reinitialize_all_fixed_parameter_dependent_initial_states(nx_rdata)
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)
- reinitialize_all_fixed_parameter_dependent_initial_states_for_presimulation(nx_rdata)
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)
- reinitialize_all_fixed_parameter_dependent_initial_states_for_simulation(nx_rdata)
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)
- property reinitialize_fixed_parameter_initial_states
Flag indicating whether reinitialization of states depending on fixed parameters is activated
- set_event_measurements(*args)[source]
Overload 1:
Set event measurements.
- Parameters:
mz (DoubleVector) – event measurements (dimension: nmaxevent x nztrue, row-major)
Overload 2:
Set event measurements for a specific event observable.
- Parameters:
mz (DoubleVector) – event measurements (dimension: nmaxevent)
iz (int) – event observable index
- set_event_noise_scales(*args)[source]
Overload 1:
Set noise scales of event measurements.
- Parameters:
sigma (DoubleVector) – noise scales of event measurements
Overload 2:
Set noise scales of all event measurements.
- Parameters:
sigma (float) – noise scale (dimension: scalar)
Overload 3:
Set noise scales for a specific event observable.
- Parameters:
sigma (DoubleVector) – noise scales of observed data (dimension: nmaxevent)
iz (int) – event observable index
Overload 4:
Set all noise scales for a specific event observable.
- set_measurements(*args)[source]
Overload 1:
Set all measurements.
- Parameters:
my (DoubleVector) – measurements (dimension: nt x nytrue, row-major)
Overload 2:
Set measurements for a specific observable.
- Parameters:
my (DoubleVector) – measurements (dimension: nt)
iy (int) – observable index
- set_noise_scales(*args)[source]
Overload 1:
Set noise scales for all measurements.
- Parameters:
sigma (DoubleVector) – noise scales (dimension: nt x nytrue, row-major)
Overload 2:
Set identical noise scales for all measurements.
- Parameters:
sigma (float) – noise scale (dimension: scalar)
Overload 3:
Set measurement noise scales of for a observable.
- Parameters:
sigma (DoubleVector) – noise scales (dimension: nt)
iy (int) – observable index
Overload 4:
Set all noise scales for a specific observable to the input value.
- set_timepoints(ts)[source]
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.
- Parameters:
ts (
collections.abc.Sequence[float]) – ts
- 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 fixed_parameters in fixed_parameters_presimulation
- property t_start
Starting time of the simulation.
Output timepoints are absolute timepoints, independent of \(t_{start}\). For output timepoints \(t < t_{start}\), the initial state will be returned.
- property t_start_preeq
The initial time for pre-equilibration..
NAN indicates that tstart_ should be used.
- property timepoints
Timepoints for which model state/outputs/… are requested
Vector of timepoints.
- property x0
Initial state
Vector of size Model::nx() or empty
- class amici.sim.sundials.ExpDataPtr(*args)[source]
- property fixed_parameters
Model constants
Vector of size Model::nk() or empty
- property fixed_parameters_pre_equilibration
Model constants for pre-equilibration
Vector of size Model::nk() or empty.
- property fixed_parameters_presimulation
Model constants for pre-simulation
Vector of size Model::nk() or empty.
- property free_parameters
Model free_parameters
Vector of size Model::np() or empty with parameter scaled according to SimulationParameter::pscale.
- property id
Arbitrary (not necessarily unique) identifier.
- 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 reinitialize_fixed_parameter_initial_states
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 fixed_parameters in fixed_parameters_presimulation
- property t_start
Starting time of the simulation.
Output timepoints are absolute timepoints, independent of \(t_{start}\). For output timepoints \(t < t_{start}\), the initial state will be returned.
- property t_start_preeq
The initial time for pre-equilibration..
NAN indicates that tstart_ should be used.
- property timepoints
Timepoints for which model state/outputs/… are requested
Vector of timepoints.
- property x0
Initial state
Vector of size Model::nx() or empty
- class amici.sim.sundials.ExpDataView(edata)[source]
Interface class for C++ Exp Data objects that avoids possibly costly copies of member data.
NOTE: This currently assumes that the underlying
ExpDatadoes not change after instantiating anExpDataView.- __init__(edata)[source]
Constructor
- Parameters:
edata (
amici._installation.amici.ExpDataPtr|amici._installation.amici.ExpData) – pointer to the ExpData instance
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- values() an object providing a view on D's values
- class amici.sim.sundials.FixedParameterContext(*values)
- __init__(*args, **kwds)
- preequilibration = 1
- presimulation = 1
- simulation = 1
- class amici.sim.sundials.InternalSensitivityMethod(*values)
- __init__(*args, **kwds)
- simultaneous = 1
- staggered = 1
- staggered1 = 1
- class amici.sim.sundials.InterpolationType(*values)
- __init__(*args, **kwds)
- hermite = 1
- polynomial = 1
- class amici.sim.sundials.LinearMultistepMethod(*values)
- BDF = 1
- __init__(*args, **kwds)
- adams = 1
- class amici.sim.sundials.LinearSolver(*values)
- KLU = 1
- LAPACKBand = 1
- LAPACKDense = 1
- SPBCG = 1
- SPGMR = 1
- SPTFQMR = 1
- SuperLUMT = 1
- __init__(*args, **kwds)
- band = 1
- dense = 1
- diag = 1
- class amici.sim.sundials.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.sim.sundials.LogSeverity(*values)
- __init__(*args, **kwds)
- debug = 1
- error = 1
- warning = 1
- class amici.sim.sundials.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.
- create_solver()
Creates a solver instance to simulate this model.
- Return type:
- Returns:
The Solver instance
- get_add_sigma_residuals()[source]
Checks whether residuals should be added to account for parameter dependent sigma.
- Return type:
- Returns:
sigma_res
- get_always_check_finite()[source]
Get setting of whether the result of every call to Model::f* should be checked for finiteness.
- Return type:
- Returns:
that
- get_amici_commit()
Returns the AMICI commit that was used to generate the model
- Return type:
- Returns:
AMICI commit string
- get_amici_version()
Returns the AMICI version that was used to generate the model
- Return type:
- Returns:
AMICI version string
- get_any_state_nonnegative()[source]
Whether there is at least one state variable for which non-negativity is to be enforced.
- Return type:
- Returns:
Vector of all events.
- get_expression_names()[source]
Get names of the expressions.
- Return type:
- Returns:
Expression names
- get_fixed_parameter_by_name(par_name)[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.
- get_fixed_parameter_ids()[source]
Get IDs of the fixed model parameters.
- Return type:
- Returns:
Fixed parameter IDs
- get_fixed_parameter_names()[source]
Get names of the fixed model parameters.
- Return type:
- Returns:
Fixed parameter names
- get_fixed_parameters()[source]
Get values of fixed parameters.
- Return type:
- Returns:
Vector of fixed parameters with same ordering as in Model::getFixedParameterIds
- get_free_parameter_by_name(par_name)[source]
Get value of first model parameter with the specified name.
- get_free_parameter_ids()[source]
Get IDs of the model parameters.
- Return type:
- Returns:
Parameter IDs
- get_free_parameter_names()[source]
Get names of the free model parameters.
- Return type:
- Returns:
The parameter names
- get_free_parameters()[source]
Get parameter vector.
- Return type:
- Returns:
The user-set parameters (see also Model::getUnscaledParameters)
- get_id_list()[source]
Get flag array for DAE equations
- Return type:
- Returns:
Flag array for DAE equations
- get_initial_state(*args)[source]
Overload 1:
Get the initial state.
- Parameters:
t0 (float) – Custom t0 for which to get initial states.
- Return type:
- Returns:
Initial state vector, before any events are executed.
Overload 2:
Get the initial state for Model::t0()`.
- Return type:
- Returns:
Initial state vector, before any events are executed.
- get_initial_state_sensitivities(*args)[source]
Overload 1:
Get the initial state sensitivities.
- Return type:
- Returns:
vector of initial state sensitivities
Overload 2:
Get the initial states sensitivities.
- Parameters:
t0 (float) – Custom t0 for which to get initial states.
- Return type:
- Returns:
vector of initial state sensitivities
- get_minimum_sigma_residuals()[source]
Gets the specified estimated lower boundary for sigma_y.
- Return type:
- Returns:
lower boundary
- get_observable_names()[source]
Get names of the observables.
- Return type:
- Returns:
Observable names
- get_parameter_list()[source]
Get the list of parameters for which sensitivities are computed.
- Return type:
- Returns:
List of parameter indices
- get_parameter_scale()[source]
Get parameter scale for each parameter.
- Return type:
- Returns:
Vector of parameter scales
- get_reinitialization_state_idxs()[source]
Return indices of states to be reinitialized based on provided fixed parameters
- Return type:
- Returns:
Those indices.
- get_reinitialize_fixed_parameter_initial_states()[source]
Get whether initial states depending on fixedParameters are to be reinitialized after preequilibration and presimulation.
- Return type:
- Returns:
flag true / false
- get_second_order_mode()[source]
Get second-order sensitivity mode.
- Return type:
- Returns:
Flag indicating whether for SensitivityOrder::second directional or full second order derivative will be computed
- get_state_is_non_negative()[source]
Get flags indicating whether states should be treated as non-negative.
- Return type:
- Returns:
Vector of flags
- get_steady_state_computation_mode()[source]
Gets the mode how steady state is computed in the steadystate simulation.
- Return type:
- Returns:
Mode
- get_steady_state_sensitivity_mode()[source]
Gets the mode how sensitivities are computed in the steady-state simulation.
- Return type:
- Returns:
Mode
- get_steadystate_mask()[source]
Get steady-state mask as std::vector.
See set_steadystate_mask for details.
- Return type:
- Returns:
Steady-state mask
- get_trigger_timepoints()[source]
Get trigger times for events that don’t require root-finding.
To be called only after Model::initialize.
- Return type:
- Returns:
List of unique trigger points for events that don’t require root-finding (i.e. that trigger at predetermined timepoints), in ascending order.
- get_unscaled_parameters()[source]
Get parameters with transformation according to parameter scale applied.
- Return type:
- Returns:
Unscaled parameters
- has_custom_initial_state()[source]
Return whether custom initial state have been set.
- Return type:
- Returns:
true if has custom initial state, otherwise false
- has_custom_initial_state_sensitivities()[source]
Return whether custom initial state sensitivities have been set.
- Return type:
- Returns:
true if has custom initial state sensitivities, otherwise false.
- has_expression_ids()[source]
Report whether the model has expression IDs set.
- Return type:
- Returns:
Boolean indicating whether expression ids were set. Also returns true if the number of corresponding variables is just zero.
- has_expression_names()[source]
Report whether the model has expression names set.
- Return type:
- Returns:
Boolean indicating whether expression names were set. Also returns true if the number of corresponding variables is just zero.
- has_fixed_parameter_ids()[source]
Report whether the model has fixed parameter IDs set.
- Return type:
- Returns:
Boolean indicating whether fixed parameter IDs were set. Also returns true if the number of corresponding variables is just zero.
- has_fixed_parameter_names()[source]
Report whether the model has fixed parameter names set.
- Return type:
- Returns:
Boolean indicating whether fixed parameter names were set. Also returns true if the number of corresponding variables is just zero.
- has_free_parameter_ids()[source]
Report whether the model has parameter IDs set.
- Return type:
- Returns:
Boolean indicating whether parameter IDs were set. Also returns true if the number of corresponding variables is just zero.
- has_free_parameter_names()[source]
Report whether the model has free parameter names set.
- Return type:
- Returns:
Boolean indicating whether free parameter names were set. Also returns true if the number of corresponding variables is just zero.
- has_observable_ids()[source]
Report whether the model has observable IDs set.
- Return type:
- Returns:
Boolean indicating whether observable ids were set. Also returns true if the number of corresponding variables is just zero.
- has_observable_names()[source]
Report whether the model has observable names set.
- Return type:
- Returns:
Boolean indicating whether observable names were set. Also returns true if the number of corresponding variables is just zero.
- has_quadratic_llh()[source]
Checks whether the defined noise model is Gaussian, i.e., the nllh is quadratic
- Return type:
- Returns:
boolean flag
- has_state_ids()[source]
Report whether the model has state IDs set.
- Return type:
- Returns:
Boolean indicating whether state IDs were set. Also returns true if the number of corresponding variables is just zero.
- has_state_names()[source]
Report whether the model has state names set.
- Return type:
- Returns:
Boolean indicating whether state names were set. Also returns true if the number of corresponding variables is just zero.
- is_fixed_parameter_state_reinitialization_allowed()
Function indicating whether reinitialization of states depending on fixed parameters is permissible
- Return type:
- Returns:
flag indicating whether reinitialization of states depending on fixed parameters is permissible
- property lbw
Lower bandwidth of the Jacobian
- property nJ
Dimension of the augmented objective function for 2nd order ASA
- n_max_event()[source]
Get maximum number of events that may occur for each type.
- Return type:
- Returns:
Maximum number of events that may occur for each type
- ncl()[source]
Get number of conservation laws.
- Return type:
- Returns:
Number of conservation laws (i.e., difference between nx_rdata and nx_solver).
- 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 ndxdotdp_explicit
Number of nonzero elements in dxdotdp_explicit
- property ndxdotdw
Number of nonzero elements in the \(w\) derivative of \(xdot\)
- property ndxdotdx_explicit
Number of nonzero elements in dxdotdx_explicit
- 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 ne_solver
Number of events that require root-finding
- property nnz
Number of nonzero entries in Jacobian
- np()[source]
Get total number of model parameters.
- Return type:
- Returns:
Length of parameter vector
- nplist()[source]
Get number of parameters wrt to which sensitivities are computed.
- Return type:
- Returns:
Length of sensitivity index vector
- property nspl
Number of spline functions in the model
- property nw
Number of common expressions
- property nx_rdata
Number of state variables
- nx_reinit()[source]
Get number of solver states subject to reinitialization.
- Return type:
- Returns:
Model member nx_solver_reinit
- property nx_solver
Number of state variables with conservation laws applied
- property nx_solver_reinit
Number of solver state variables subject to reinitialization
- property nxtrue_rdata
Number of state variables in the unaugmented system
- property nxtrue_solver
Number of state variables 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
- require_sensitivities_for_all_parameters()[source]
Require computation of sensitivities for all parameters p [0..np[ in natural order.
NOTE: Resets initial state sensitivities.
- set_add_sigma_residuals(sigma_res)[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
set_minimum_sigma_residuals().- Parameters:
sigma_res (
bool) – if true, additional residuals are added
- set_all_states_non_negative()[source]
Set flags indicating that all states should be treated as non-negative.
- set_always_check_finite(alwaysCheck)[source]
Set whether the result of every call to Model::f* should be checked for finiteness.
- Parameters:
alwaysCheck (
bool)
- set_fixed_parameter_by_id(par_id, value)[source]
Set value of first fixed parameter with the specified ID.
- set_fixed_parameter_by_name(par_name, value)[source]
Set value of first fixed parameter with the specified name.
- set_fixed_parameters(k)[source]
Set values for constants.
- Parameters:
k (
collections.abc.Sequence[float]) – Vector of fixed parameters
- set_fixed_parameters_by_id_regex(par_id_regex, value)[source]
Set values of all fixed parameters with the ID matching the specified regex.
- set_fixed_parameters_by_name_regex(par_name_regex, value)[source]
Set value of all fixed parameters with name matching the specified regex.
- set_free_parameter_by_id(*args)[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, optional) – 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.
- set_free_parameter_by_name(*args)[source]
Overload 1:
Set value of first model parameter with the specified name.
Overload 2:
Set model parameters according to the parameter name and mapped values.
- Parameters:
p (StringDoubleMap) – Map of parameters names and values
ignoreErrors (boolean, optional) – 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
- set_free_parameters(p)[source]
Set the parameter vector.
- Parameters:
p (
collections.abc.Sequence[float]) – Vector of parameters
- set_free_parameters_by_id_regex(par_id_regex, value)[source]
Set all values of model parameters with IDs matching the specified regular expression.
- set_free_parameters_by_name_regex(par_name_regex, value)[source]
Set all values of all model parameters with names matching the specified regex.
- set_initial_state(x0)[source]
Set the pre-event initial state.
- Parameters:
x0 (
collections.abc.Sequence[float]) – Initial state vector
- set_initial_state_sensitivities(sx0)[source]
Set the initial state sensitivities.
- Parameters:
sx0 (
collections.abc.Sequence[float]) – vector of initial state sensitivities with chain rule applied. This could be a slice of ReturnData::sx or ReturnData::sx0
- set_minimum_sigma_residuals(min_sigma)[source]
Sets the estimated lower boundary for sigma_y.
When
set_add_sigma_residuals()is activated, this lower boundary must ensure that log(sigma) + min_sigma > 0.- Parameters:
min_sigma (
float) – lower boundary
- set_n_max_event(nmaxevent)[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
- set_parameter_list(plist)[source]
Set the list of parameters for which sensitivities are to be computed.
NOTE: Resets initial state sensitivities.
- Parameters:
plist (
collections.abc.Sequence[int]) – List of parameter indices
- set_parameter_scale(*args)[source]
Overload 1:
Set parameter scale for each parameter.
NOTE: Resets initial state sensitivities.
- Parameters:
pscale (int) – Scalar parameter scale to be set for all parameters
Overload 2:
Set parameter scale for each parameter.
NOTE: Resets initial state sensitivities.
- Parameters:
pscaleVec (ParameterScalingVector) – Vector of parameter scales
- set_reinitialization_state_idxs(idxs)[source]
Set indices of states to be reinitialized based on provided fixed parameters
- Parameters:
idxs (
collections.abc.Sequence[int]) – Array of state indices
- set_reinitialize_fixed_parameter_initial_states(flag)[source]
Set whether initial states depending on fixed parameters are to be reinitialized after preequilibration and presimulation.
- Parameters:
flag (
bool) – Fixed parameters reinitialized?
- set_state_is_non_negative(stateIsNonNegative)[source]
Set flags indicating whether states should be treated as non-negative.
- Parameters:
stateIsNonNegative (
collections.abc.Sequence[bool]) – Vector of flags
- set_steady_state_computation_mode(mode)[source]
Set the mode how steady state is computed in the steady state simulation.
- Parameters:
mode (
int) – Steady state computation mode
- set_steady_state_sensitivity_mode(mode)[source]
Set the mode how sensitivities are computed in the steady-state simulation.
- Parameters:
mode (
amici._installation.amici.SteadyStateSensitivityMode) – Steady-state sensitivity mode
- set_steadystate_mask(mask)[source]
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.
- Parameters:
mask (
collections.abc.Sequence[float]) – Mask of length nx_solver.
- set_t0(t0)[source]
Set simulation start time.
Output timepoints are absolute timepoints, independent of \(t_{0}\). For output timepoints \(t < t_{0}\), the initial state will be returned.
- Parameters:
t0 (
float) – Simulation start time
- set_t0_preeq(t0_preeq)[source]
Set the initial time to use for pre-equilibration.
- Parameters:
t0_preeq (
float) – The initial time for pre-equilibration or NAN to use the model’s t0.
- set_timepoints(ts)[source]
Set the timepoint vector.
- Parameters:
ts (
collections.abc.Sequence[float]) – New timepoint vector
- set_unscaled_initial_state_sensitivities(sx0)[source]
Set the initial state sensitivities.
- Parameters:
sx0 (
collections.abc.Sequence[float]) – Vector of initial state sensitivities without chain rule applied. This could be the read-in from a model.sx0data saved to HDF5.
- simulate(*, solver=None, edata=None, failfast=True, num_threads=1, sensi_method=None, sensi_order=None)[source]
- Overloads:
self (AmiciModel), solver (Solver | None), edata (AmiciExpData | None), sensi_method (SensitivityMethod | str), sensi_order (SensitivityOrder | str) → ReturnDataView
self (AmiciModel), solver (Solver | None), edata (AmiciExpDataVector | None), failfast (bool), num_threads (int), sensi_method (SensitivityMethod | str), sensi_order (SensitivityOrder | str) → list[ReturnDataView]
Simulate model with given solver and experimental data.
- Parameters:
solver (
amici._installation.amici.Solver|None) – Solver to use for simulation. Defaults toModel.create_solver().edata (
typing.Union[amici._installation.amici.ExpData,amici._installation.amici.ExpDataPtr,amici._installation.amici.ExpDataPtrVector,collections.abc.Sequence[typing.Union[amici._installation.amici.ExpData,amici._installation.amici.ExpDataPtr]],None]) – Experimental data to use for simulation. A singleExpDatainstance or a sequence of such instances. If None, no experimental data is used and the model is simulated as is.sensi_method (
amici._installation.amici.SensitivityMethod|str) – Sensitivity method to use for simulation. If None, the solver’s current sensitivity method is used.sensi_order (
amici._installation.amici.SensitivityOrder|str) – Sensitivity order to use for simulation. If None, the solvers’s current sensitivity order is used.failfast (
bool) – Whether to stop simulations on first failure. Only relevant if edata is a sequence ofExpDatainstances.num_threads (
int) – Number of threads to use for simulation. Only relevant if AMICI was compiled with OpenMP support and if edata is a sequence ofExpDatainstances.
- Returns:
A single
ReturnDataViewinstance containing the simulation results if edata is a singleExpDatainstance or None. If edata is a sequence ofExpDatainstances, a list ofReturnDataViewinstances is returned.
- t0_preeq()[source]
Get the initial time to use for pre-equilibration.
- Return type:
- Returns:
Initial time, or NAN to use the model’s t0.
- property ubw
Upper bandwidth of the Jacobian
- validate()
Validate dimensions.
- property w_recursion_depth
Recursion depth of fw
- class amici.sim.sundials.ModelDimensions[source]
Container for model dimensions.
Holds number of state variables, 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 ndxdotdp_explicit
Number of nonzero elements in dxdotdp_explicit
- property ndxdotdw
Number of nonzero elements in the \(w\) derivative of \(xdot\)
- property ndxdotdx_explicit
Number of nonzero elements in dxdotdx_explicit
- 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 ne_solver
Number of events that require root-finding
- property nk
Number of constants
- property nnz
Number of nonzero entries in Jacobian
- property np
Number of parameters
- property nspl
Number of spline functions in the model
- property nw
Number of common expressions
- property nx_rdata
Number of state variables
- property nx_solver
Number of state variables with conservation laws applied
- property nx_solver_reinit
Number of solver state variables subject to reinitialization
- property nxtrue_rdata
Number of state variables in the unaugmented system
- property nxtrue_solver
Number of state variables 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
- property w_recursion_depth
Recursion depth of fw
- class amici.sim.sundials.ModelModule(*args, **kwargs)[source]
Type of AMICI-generated model modules.
To enable static type checking.
- __init__(*args, **kwargs)
- class amici.sim.sundials.ModelPtr(*args)[source]
- 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 ndxdotdp_explicit
Number of nonzero elements in dxdotdp_explicit
- property ndxdotdw
Number of nonzero elements in the \(w\) derivative of \(xdot\)
- property ndxdotdx_explicit
Number of nonzero elements in dxdotdx_explicit
- 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 ne_solver
Number of events that require root-finding
- property nnz
Number of nonzero entries in Jacobian
- property nspl
Number of spline functions in the model
- property nw
Number of common expressions
- property nx_rdata
Number of state variables
- property nx_solver
Number of state variables with conservation laws applied
- property nx_solver_reinit
Number of solver state variables subject to reinitialization
- property nxtrue_rdata
Number of state variables in the unaugmented system
- property nxtrue_solver
Number of state variables 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
- property w_recursion_depth
Recursion depth of fw
- class amici.sim.sundials.NewtonDampingFactorMode(*values)
- __init__(*args, **kwds)
- off = 1
- on = 1
- class amici.sim.sundials.NonlinearSolverIteration(*values)
- __init__(*args, **kwds)
- fixedpoint = 1
- newton = 1
- class amici.sim.sundials.ObservableScaling(*values)
- __init__(*args, **kwds)
- lin = 1
- log = 1
- log10 = 1
- class amici.sim.sundials.ParameterScaling(*values)
- __init__(*args, **kwds)
- ln = 1
- log10 = 1
- none = 1
- class amici.sim.sundials.RDataReporting(*values)
- __init__(*args, **kwds)
- full = 1
- likelihood = 1
- observables_likelihood = 1
- residuals = 1
- class amici.sim.sundials.ReturnData(*args)[source]
Stores all data to be returned by amici::run_simulation.
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.
The Jacobian of differential equation right hand side (shape nx_solver x nx_solver, row-major) evaluated at t_last.
The corresponding state variable IDs can be obtained from state_ids_solver().
- __init__(*args)[source]
Overload 1:
Default constructor
Overload 2:
Constructor
- Parameters:
ts (DoubleVector) – see amici::SimulationParameters::ts
model_dimensions (
ModelDimensions) – Model dimensionsnmaxevent (int) – see amici::ModelDimensions::nmaxevent
newton_maxsteps (int) – see amici::Solver::newton_maxsteps
plist (IntVector) – see amici::Model::getParameterList
pscale (ParameterScalingVector) – see amici::SimulationParameters::pscale
o2mode (int) – see amici::SimulationParameters::o2mode
sensi (SensitivityOrder) – see amici::Solver::sensi
sensi_meth (SensitivityMethod) – see amici::Solver::sensi_meth
rdrm (RDataReporting) – see amici::Solver::rdata_reporting
quadratic_llh (boolean) – whether model defines a quadratic nllh and computing res, sres and FIM makes sense
sigma_res (boolean) – indicates whether additional residuals are to be added for each sigma
sigma_offset (float) – offset to ensure real-valuedness of sigma residuals
free_parameter_ids (std::span< std::string_view const >) – IDs of the free parameters
free_parameter_names (std::span< std::string_view const >) – Names of the free parameters
fixed_parameter_ids (std::span< std::string_view const >) – IDs of the fixed parameters
fixed_parameter_names (std::span< std::string_view const >) – Names of the fixed parameters
state_ids (std::span< std::string_view const >) – IDs of state variables
state_names (std::span< std::string_view const >) – Names of state variables
state_ids_solver (std::span< std::string_view const >) – IDs of solver state variables
state_names_solver (std::span< std::string_view const >) – Names of solver state variables
observable_ids (std::span< std::string_view const >) – IDs of observables
observable_names (std::span< std::string_view const >) – Names of observables
expression_ids (std::span< std::string_view const >) – IDs of expressions
expression_names (std::span< std::string_view const >) – Names of expressions
Overload 3:
constructor that uses information from model and solver to appropriately initialize fields
- property chi2
\(\chi^2\) value
- property cpu_time
Computation time of forward solve [ms]
Warning
If AMICI was built without boost, this tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.
- property cpu_time_b
Computation time of backward solve [ms]
Warning
If AMICI was built without boost, 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
If AMICI was built without boost, this tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.
- property expression_ids
IDs of expressions
- property expression_names
Names of expressions
- property fixed_parameter_ids
IDs of the fixed parameters
- property fixed_parameter_names
Names of the fixed parameters
- property free_parameter_ids
IDs of the free parameters
- property free_parameter_names
Names of the free parameters
- 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 ndxdotdp_explicit
Number of nonzero elements in dxdotdp_explicit
- property ndxdotdw
Number of nonzero elements in the \(w\) derivative of \(xdot\)
- property ndxdotdx_explicit
Number of nonzero elements in dxdotdx_explicit
- 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 ne_solver
Number of events that require root-finding
- 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 parameters w.r.t. which sensitivities were requested
- property nspl
Number of spline functions in the model
- property nt
Number of output timepoints (length of ReturnData::ts).
- property num_err_test_fails
Number of error test failures forward problem (shape nt)
- property num_err_test_fails_b
Number of error test failures backward problem (shape nt)
- property num_non_lin_solv_conv_fails
Number of linear solver convergence failures forward problem (shape nt)
- property num_non_lin_solv_conv_fails_b
Number of linear solver convergence failures backward problem (shape nt)
- property num_rhs_evals
Number of right hand side evaluations forward problem (shape nt)
- property num_rhs_evals_b
Number of right hand side evaluations backward problem (shape nt)
- property numsteps
Number of solver steps for the forward problem.
Cumulative number of integration steps for the forward problem for each output timepoint in ReturnData::ts (shape nt).
- property numsteps_b
Number of solver steps for the backward problem.
Cumulative number of integration steps for the backward problem for each output timepoint in ReturnData::ts (shape nt).
- property nw
Number of common expressions
- property nx_rdata
Number of state variables
- property nx_solver
Number of state variables with conservation laws applied
- property nx_solver_reinit
Number of solver state variables subject to reinitialization
- property nxtrue_rdata
Number of state variables in the unaugmented system
- property nxtrue_solver
Number of state variables 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 observable_ids
IDs of observables
- property observable_names
Names of observables
- property order
Employed order forward problem (shape nt)
- property plist
Indices of the parameters w.r.t. which sensitivities were computed.
The indices refer to parameter IDs in free_parameter_ids.
- property posteq_cpu_time
Computation time of the steady-state solver [ms] (postequilibration)
Warning
If AMICI was built without boost, this tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.
- property posteq_cpu_time_b
Computation time of the steady-state solver of the backward problem [ms] (postequilibration)
Warning
If AMICI was built without boost, 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 post-equilibration [newton, simulation, newton].
- property posteq_numsteps_b
Number of simulation steps for the post-equilibration backward simulation [== 0 if analytical solution worked, > 0 otherwise]
- property posteq_status
Flags indicating success of steady-state solver (postequilibration)
- property posteq_t
Model time at which the post-equilibration steady state was reached via simulation.
- property posteq_wrms
Weighted root-mean-square of the rhs at post-equilibration steady state.
- property preeq_cpu_time
Computation time of the steady state solver [ms] (pre-equilibration)
Warning
If AMICI was built without boost, this tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.
- property preeq_cpu_time_b
Computation time of the steady state solver of the backward problem [ms] (pre-equilibration)
Warning
If AMICI was built without boost, 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 pre-equilibration.
[newton, simulation, newton] (length = 3)
- property preeq_numsteps_b
Number of simulation steps for adjoint pre-equilibration problem [== 0 if analytical solution worked, > 0 otherwise]
- property preeq_status
Flags indicating success of steady-state solver (preequilibration)
- property preeq_t
Model time at which the pre-equilibration steady state was reached via simulation.
- property preeq_wrms
Weighted root-mean-square of the rhs at pre-equilibration steady state.
- property pscale
Scaling of model parameters.
- property rdata_reporting
Reporting mode.
- property res
Residuals (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 state_ids
IDs of state variables
- property state_ids_solver
IDs of solver state variables
- property state_names
Names of state variables
- property state_names_solver
Names of solver state variables
- 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
State sensitivities.
The derivative of the model state with respect to the chosen parameters (see Model::getParameterList() or ExpData::plist) at timepoints ReturnData::ts (shape nt x nplist x nx_rdata, row-major).
The corresponding state variable IDs can be obtained from state_ids.
- property sx0
Initial state sensitivities for the main simulation.
(shape nplist x nx_rdata, row-major).
- property sx_ss
Pre-equilibration steady state sensitivities.
Sensitivities of the pre-equilibration steady state with respect to the selected parameters. (shape nplist x nx_rdata, row-major)
- property sy
Observable sensitivities.
The derivative of the observables with respect to the chosen parameters (see Model::getParameterList() or ExpData::plist) at timepoints ReturnData::ts (shape nt x nplist x ny, row-major).
The corresponding observable IDs can be obtained from observable_ids.
- property sz
Parameter derivative of event output (shape nmaxevent x nplist x nz, row-major)
- property t_last
The final internal time of the solver.
- property ts
Output or measurement timepoints (shape nt)
- property ubw
Upper bandwidth of the Jacobian
- validate()
Validate dimensions.
- property w
Model expression values.
Values of model expressions (recurring terms in xdot, for imported SBML models from Python, this contains, e.g., the flux vector) at timepoints ReturnData::ts (shape nt x nw, row major).
The corresponding expression IDs can be obtained from expression_ids.
- property w_recursion_depth
Recursion depth of fw
- property x
Model state.
The model state at timepoints ReturnData::ts (shape nt x nx_rdata, row-major).
The corresponding state variable IDs can be obtained from state_ids.
- property x0
Initial state of the main simulation (shape nx_rdata).
The corresponding state variable IDs can be obtained from state_ids.
- property x_ss
Pre-equilibration steady state.
The values of the state variables at the pre-equilibration steady state (shape nx_rdata). The corresponding state variable IDs can be obtained from state_ids.
- property xdot
time derivative (shape nx_solver) evaluated at t_last.
- property y
Observables.
The values of the observables at timepoints ReturnData::ts (shape nt x ny, row-major).
The corresponding observable IDs can be obtained from observable_ids.
- property z
Event output (shape nmaxevent x nz, row-major)
- class amici.sim.sundials.ReturnDataPtr(*args)[source]
- property FIM
Fisher information matrix (shape nplist x nplist, row-major)
- property J
Jacobian of differential equation right hand side.
The Jacobian of differential equation right hand side (shape nx_solver x nx_solver, row-major) evaluated at t_last.
The corresponding state variable IDs can be obtained from state_ids_solver().
- property chi2
\(\chi^2\) value
- property cpu_time
Computation time of forward solve [ms]
Warning
If AMICI was built without boost, this tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.
- property cpu_time_b
Computation time of backward solve [ms]
Warning
If AMICI was built without boost, 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
If AMICI was built without boost, this tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.
- property expression_ids
IDs of expressions
- property expression_names
Names of expressions
- property fixed_parameter_ids
IDs of the fixed parameters
- property fixed_parameter_names
Names of the fixed parameters
- property free_parameter_ids
IDs of the free parameters
- property free_parameter_names
Names of the free parameters
- 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 ndxdotdp_explicit
Number of nonzero elements in dxdotdp_explicit
- property ndxdotdw
Number of nonzero elements in the \(w\) derivative of \(xdot\)
- property ndxdotdx_explicit
Number of nonzero elements in dxdotdx_explicit
- 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 ne_solver
Number of events that require root-finding
- 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 parameters w.r.t. which sensitivities were requested
- property nspl
Number of spline functions in the model
- property nt
Number of output timepoints (length of ReturnData::ts).
- property num_err_test_fails
Number of error test failures forward problem (shape nt)
- property num_err_test_fails_b
Number of error test failures backward problem (shape nt)
- property num_non_lin_solv_conv_fails
Number of linear solver convergence failures forward problem (shape nt)
- property num_non_lin_solv_conv_fails_b
Number of linear solver convergence failures backward problem (shape nt)
- property num_rhs_evals
Number of right hand side evaluations forward problem (shape nt)
- property num_rhs_evals_b
Number of right hand side evaluations backward problem (shape nt)
- property numsteps
Number of solver steps for the forward problem.
Cumulative number of integration steps for the forward problem for each output timepoint in ReturnData::ts (shape nt).
- property numsteps_b
Number of solver steps for the backward problem.
Cumulative number of integration steps for the backward problem for each output timepoint in ReturnData::ts (shape nt).
- property nw
Number of common expressions
- property nx_rdata
Number of state variables
- property nx_solver
Number of state variables with conservation laws applied
- property nx_solver_reinit
Number of solver state variables subject to reinitialization
- property nxtrue_rdata
Number of state variables in the unaugmented system
- property nxtrue_solver
Number of state variables 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 observable_ids
IDs of observables
- property observable_names
Names of observables
- property order
Employed order forward problem (shape nt)
- property plist
Indices of the parameters w.r.t. which sensitivities were computed.
The indices refer to parameter IDs in free_parameter_ids.
- property posteq_cpu_time
Computation time of the steady-state solver [ms] (postequilibration)
Warning
If AMICI was built without boost, this tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.
- property posteq_cpu_time_b
Computation time of the steady-state solver of the backward problem [ms] (postequilibration)
Warning
If AMICI was built without boost, 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 post-equilibration [newton, simulation, newton].
- property posteq_numsteps_b
Number of simulation steps for the post-equilibration backward simulation [== 0 if analytical solution worked, > 0 otherwise]
- property posteq_status
Flags indicating success of steady-state solver (postequilibration)
- property posteq_t
Model time at which the post-equilibration steady state was reached via simulation.
- property posteq_wrms
Weighted root-mean-square of the rhs at post-equilibration steady state.
- property preeq_cpu_time
Computation time of the steady state solver [ms] (pre-equilibration)
Warning
If AMICI was built without boost, this tracks the CPU-time of the current process. Therefore, in a multi-threaded context, this value may be incorrect.
- property preeq_cpu_time_b
Computation time of the steady state solver of the backward problem [ms] (pre-equilibration)
Warning
If AMICI was built without boost, 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 pre-equilibration.
[newton, simulation, newton] (length = 3)
- property preeq_numsteps_b
Number of simulation steps for adjoint pre-equilibration problem [== 0 if analytical solution worked, > 0 otherwise]
- property preeq_status
Flags indicating success of steady-state solver (preequilibration)
- property preeq_t
Model time at which the pre-equilibration steady state was reached via simulation.
- property preeq_wrms
Weighted root-mean-square of the rhs at pre-equilibration steady state.
- property pscale
Scaling of model parameters.
- property rdata_reporting
Reporting mode.
- property res
Residuals (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 state_ids
IDs of state variables
- property state_ids_solver
IDs of solver state variables
- property state_names
Names of state variables
- property state_names_solver
Names of solver state variables
- 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
State sensitivities.
The derivative of the model state with respect to the chosen parameters (see Model::getParameterList() or ExpData::plist) at timepoints ReturnData::ts (shape nt x nplist x nx_rdata, row-major).
The corresponding state variable IDs can be obtained from state_ids.
- property sx0
Initial state sensitivities for the main simulation.
(shape nplist x nx_rdata, row-major).
- property sx_ss
Pre-equilibration steady state sensitivities.
Sensitivities of the pre-equilibration steady state with respect to the selected parameters. (shape nplist x nx_rdata, row-major)
- property sy
Observable sensitivities.
The derivative of the observables with respect to the chosen parameters (see Model::getParameterList() or ExpData::plist) at timepoints ReturnData::ts (shape nt x nplist x ny, row-major).
The corresponding observable IDs can be obtained from observable_ids.
- property sz
Parameter derivative of event output (shape nmaxevent x nplist x nz, row-major)
- property t_last
The final internal time of the solver.
- property ts
Output or measurement timepoints (shape nt)
- property ubw
Upper bandwidth of the Jacobian
- property w
Model expression values.
Values of model expressions (recurring terms in xdot, for imported SBML models from Python, this contains, e.g., the flux vector) at timepoints ReturnData::ts (shape nt x nw, row major).
The corresponding expression IDs can be obtained from expression_ids.
- property w_recursion_depth
Recursion depth of fw
- property x
Model state.
The model state at timepoints ReturnData::ts (shape nt x nx_rdata, row-major).
The corresponding state variable IDs can be obtained from state_ids.
- property x0
Initial state of the main simulation (shape nx_rdata).
The corresponding state variable IDs can be obtained from state_ids.
- property x_ss
Pre-equilibration steady state.
The values of the state variables at the pre-equilibration steady state (shape nx_rdata). The corresponding state variable IDs can be obtained from state_ids.
- property xdot
time derivative (shape nx_solver) evaluated at t_last.
- property y
Observables.
The values of the observables at timepoints ReturnData::ts (shape nt x ny, row-major).
The corresponding observable IDs can be obtained from observable_ids.
- property z
Event output (shape nmaxevent x nz, row-major)
- class amici.sim.sundials.ReturnDataView(rdata)[source]
Interface class for C++
ReturnDataobjects that avoids possibly costly copies of member data.- __init__(rdata)[source]
Constructor
- Parameters:
rdata (
amici._installation.amici.ReturnDataPtr|amici._installation.amici.ReturnData) – pointer to theReturnDatainstance
- by_id(entity_id, field=None)[source]
Get the value of a given field for a named entity.
- Parameters:
- Return type:
- get(k[, d]) D[k] if k in D, else d. d defaults to None.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- values() an object providing a view on D's values
- class amici.sim.sundials.SecondOrderMode(*values)
- __init__(*args, **kwds)
- directional = 1
- full = 1
- none = 1
- class amici.sim.sundials.SensitivityMethod(*values)
- __init__(*args, **kwds)
- adjoint = 1
- forward = 1
- none = 1
- class amici.sim.sundials.SensitivityOrder(*values)
- __init__(*args, **kwds)
- first = 1
- none = 1
- second = 1
- class amici.sim.sundials.SimulationParameters(*args)[source]
Container for various simulation parameters.
- __init__(*args)[source]
Overload 1:
Constructor
- Parameters:
timepoints (DoubleVector) – Timepoints for which simulation results are requested
Overload 2:
Constructor
- Parameters:
fixed_parameters (DoubleVector) – Model parameters excluded from sensitivity analysis
free_parameters (DoubleVector) – Model parameters included in sensitivity analysis
- property fixed_parameters
Model constants
Vector of size Model::nk() or empty
- property fixed_parameters_pre_equilibration
Model constants for pre-equilibration
Vector of size Model::nk() or empty.
- property fixed_parameters_presimulation
Model constants for pre-simulation
Vector of size Model::nk() or empty.
- property free_parameters
Model free_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.
- reinitialize_all_fixed_parameter_dependent_initial_states(nx_rdata)[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)
- reinitialize_all_fixed_parameter_dependent_initial_states_for_presimulation(nx_rdata)[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)
- reinitialize_all_fixed_parameter_dependent_initial_states_for_simulation(nx_rdata)[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)
- property reinitialize_fixed_parameter_initial_states
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 fixed_parameters in fixed_parameters_presimulation
- property t_start
Starting time of the simulation.
Output timepoints are absolute timepoints, independent of \(t_{start}\). For output timepoints \(t < t_{start}\), the initial state will be returned.
- property t_start_preeq
The initial time for pre-equilibration..
NAN indicates that tstart_ should be used.
- property timepoints
Timepoints for which model state/outputs/… are requested
Vector of timepoints.
- property x0
Initial state
Vector of size Model::nx() or empty
- class amici.sim.sundials.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.
- get_absolute_tolerance()[source]
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 type:
- Returns:
absolute tolerances
- get_absolute_tolerance_b()[source]
Returns the absolute tolerances for the backward problem for adjoint sensitivity analysis
- Return type:
- Returns:
absolute tolerances
- get_absolute_tolerance_fsa()[source]
Returns the absolute tolerances for the forward sensitivity problem
- Return type:
- Returns:
absolute tolerances
- get_absolute_tolerance_quadratures()[source]
returns the absolute tolerance for the quadrature problem
- Return type:
- Returns:
absolute tolerance
- get_absolute_tolerance_steady_state()[source]
returns the absolute tolerance for the steady state problem
- Return type:
- Returns:
absolute tolerance
- get_absolute_tolerance_steady_state_sensi()[source]
returns the absolute tolerance for the sensitivities of the steady state problem
- Return type:
- Returns:
absolute tolerance
- get_internal_sensitivity_method()[source]
returns the internal sensitivity method
- Return type:
- Returns:
internal sensitivity method
- get_linear_multistep_method()[source]
returns the linear system multistep method
- Return type:
- Returns:
linear system multistep method
- get_max_conv_fails()[source]
Get the maximum number of nonlinear solver convergence failures permitted per step.
- Return type:
- Returns:
maximum number of nonlinear solver convergence
- get_max_nonlin_iters()[source]
Get the maximum number of nonlinear solver iterations permitted per step.
- Return type:
- Returns:
maximum number of nonlinear solver iterations
- get_max_steps()[source]
returns the maximum number of solver steps for the forward problem
- Return type:
- Returns:
maximum number of solver steps
- get_max_steps_backward_problem()[source]
returns the maximum number of solver steps for the backward problem
- Return type:
- Returns:
maximum number of solver steps
- get_max_time()[source]
Returns the maximum time allowed for integration
- Return type:
- Returns:
Time in seconds
- get_newton_damping_factor_lower_bound()[source]
Get a lower bound of the damping factor used in the Newton solver
- Return type:
- Returns:
- get_newton_damping_factor_mode()[source]
Get a state of the damping factor used in the Newton solver
- Return type:
- Returns:
- get_newton_max_steps()[source]
Get maximum number of allowed Newton steps for steady state computation
- Return type:
- Returns:
- get_newton_step_steady_state_check()[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:
- Returns:
boolean flag indicating newton step (true) or the right hand side (false)
- get_non_linear_solver_iteration()[source]
returns the nonlinear system solution method
- Return type:
- Returns:
- get_relative_tolerance()[source]
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 type:
- Returns:
relative tolerances
- get_relative_tolerance_b()[source]
Returns the relative tolerances for the adjoint sensitivity problem
- Return type:
- Returns:
relative tolerances
- get_relative_tolerance_fsa()[source]
Returns the relative tolerances for the forward sensitivity problem
- Return type:
- Returns:
relative tolerances
- get_relative_tolerance_quadratures()[source]
Returns the relative tolerance for the quadrature problem
- Return type:
- Returns:
relative tolerance
- get_relative_tolerance_steady_state()[source]
returns the relative tolerance for the steady state problem
- Return type:
- Returns:
relative tolerance
- get_relative_tolerance_steady_state_sensi()[source]
returns the relative tolerance for the sensitivities of the steady state problem
- Return type:
- Returns:
relative tolerance
- get_return_data_reporting_mode()[source]
returns the ReturnData reporting mode
- Return type:
- Returns:
ReturnData reporting mode
- get_sensi_steady_state_check()[source]
Returns how convergence checks for steadystate computation are performed.
- Return type:
- Returns:
boolean flag indicating state and sensitivity equations (true) or only state variables (false).
- get_sensitivity_method()[source]
Return current sensitivity method
- Return type:
- Returns:
method enum
- get_sensitivity_method_pre_equilibration()[source]
Return current sensitivity method during preequilibration
- Return type:
- Returns:
method enum
- get_stability_limit_flag()[source]
returns stability limit detection mode
- Return type:
- Returns:
stldet can be false (deactivated) or true (activated)
- get_state_ordering()[source]
Gets KLU / SuperLUMT state ordering mode
- Return type:
- Returns:
State-ordering as integer according to SUNLinSolKLU::StateOrdering or SUNLinSolSuperLUMT::StateOrdering (which differ).
- get_steady_state_sensi_tolerance_factor()[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}_tolerance_steady_state_sensi().
- Return type:
- Returns:
steady state simulation tolerance factor
- get_steady_state_tolerance_factor()[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:
- Returns:
steady state simulation tolerance factor
- nplist()[source]
number of parameters with which the solver was initialized
- Return type:
- Returns:
sx.getLength()
- nquad()[source]
number of quadratures with which the solver was initialized
- Return type:
- Returns:
xQB.getLength()
- nx()[source]
number of state variables with which the solver was initialized
- Return type:
- Returns:
x.getLength()
- set_absolute_tolerance(atol)[source]
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’.
- Parameters:
atol (
float) – absolute tolerance (non-negative number)
- set_absolute_tolerance_b(atol)[source]
Sets the absolute tolerances for the backward problem for adjoint sensitivity analysis
- Parameters:
atol (
float) – absolute tolerance (non-negative number)
- set_absolute_tolerance_fsa(atol)[source]
Sets the absolute tolerances for the forward sensitivity problem
- Parameters:
atol (
float) – absolute tolerance (non-negative number)
- set_absolute_tolerance_quadratures(atol)[source]
sets the absolute tolerance for the quadrature problem
- Parameters:
atol (
float) – absolute tolerance (non-negative number)
- set_absolute_tolerance_steady_state(atol)[source]
sets the absolute tolerance for the steady state problem
- Parameters:
atol (
float) – absolute tolerance (non-negative number)
- set_absolute_tolerance_steady_state_sensi(atol)[source]
sets the absolute tolerance for the sensitivities of the steady state problem
- Parameters:
atol (
float) – absolute tolerance (non-negative number)
- set_constraints(constraints)[source]
Set constraints on the model state.
See https://sundials.readthedocs.io/en/latest/cvode/Usage/index.html#c.CVodeSetConstraints.
- Parameters:
constraints (
collections.abc.Sequence[float])
- set_internal_sensitivity_method(ism)[source]
sets the internal sensitivity method
- Parameters:
ism (
amici._installation.amici.InternalSensitivityMethod) – internal sensitivity method
- set_interpolation_type(interpType)[source]
sets the interpolation of the forward solution that is used for the backwards problem
- Parameters:
interpType (
amici._installation.amici.InterpolationType) – interpolation type
- set_linear_multistep_method(lmm)[source]
sets the linear system multistep method
- Parameters:
lmm (
amici._installation.amici.LinearMultistepMethod) – linear system multistep method
- set_max_conv_fails(max_conv_fails)[source]
Set the maximum number of nonlinear solver convergence failures permitted per step.
- Parameters:
max_conv_fails (
int) – maximum number of nonlinear solver convergence
- set_max_nonlin_iters(max_nonlin_iters)[source]
Set the maximum number of nonlinear solver iterations permitted per step.
- Parameters:
max_nonlin_iters (
int) – maximum number of nonlinear solver iterations
- set_max_step_size(max_step_size)[source]
Set the maximum step size
- Parameters:
max_step_size (
float) – maximum step size. 0.0 means no limit.
- set_max_steps(maxsteps)[source]
sets the maximum number of solver steps for the forward problem
- Parameters:
maxsteps (
int) – maximum number of solver steps (positive number)
- set_max_steps_backward_problem(maxsteps)[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
- set_max_time(maxtime)[source]
Set the maximum CPU time allowed for integration
- Parameters:
maxtime (
float) – Time in seconds. Zero means infinite time.
- set_newton_damping_factor_lower_bound(dampingFactorLowerBound)[source]
Set a lower bound of the damping factor in the Newton solver
- Parameters:
dampingFactorLowerBound (
float)
- set_newton_damping_factor_mode(dampingFactorMode)[source]
Turn on/off a damping factor in the Newton method
- Parameters:
dampingFactorMode (
amici._installation.amici.NewtonDampingFactorMode)
- set_newton_max_steps(newton_maxsteps)[source]
Set maximum number of allowed Newton steps for steady state computation
- Parameters:
newton_maxsteps (
int)
- set_newton_step_steady_state_check(flag)[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)
- set_non_linear_solver_iteration(iter)[source]
sets the nonlinear system solution method
- Parameters:
iter (
amici._installation.amici.NonlinearSolverIteration) – nonlinear system solution method
- set_relative_tolerance(rtol)[source]
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’.
- Parameters:
rtol (
float) – relative tolerance (non-negative number)
- set_relative_tolerance_b(rtol)[source]
Sets the relative tolerances for the adjoint sensitivity problem
- Parameters:
rtol (
float) – relative tolerance (non-negative number)
- set_relative_tolerance_fsa(rtol)[source]
Sets the relative tolerances for the forward sensitivity problem
- Parameters:
rtol (
float) – relative tolerance (non-negative number)
- set_relative_tolerance_quadratures(rtol)[source]
sets the relative tolerance for the quadrature problem
- Parameters:
rtol (
float) – relative tolerance (non-negative number)
- set_relative_tolerance_steady_state(rtol)[source]
sets the relative tolerance for the steady state problem
- Parameters:
rtol (
float) – relative tolerance (non-negative number)
- set_relative_tolerance_steady_state_sensi(rtol)[source]
sets the relative tolerance for the sensitivities of the steady state problem :type rtol:
float:param rtol: relative tolerance (non-negative number)
- set_return_data_reporting_mode(rdrm)[source]
sets the ReturnData reporting mode
- Parameters:
rdrm (
amici._installation.amici.RDataReporting) – ReturnData reporting mode
- set_sensi_steady_state_check(flag)[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).
- set_sensitivity_method(sensi_meth)[source]
Set sensitivity method
- Parameters:
sensi_meth (
amici._installation.amici.SensitivityMethod)
- set_sensitivity_method_pre_equilibration(sensi_meth_preeq)[source]
Set sensitivity method for preequilibration
- Parameters:
sensi_meth_preeq (
amici._installation.amici.SensitivityMethod)
- set_sensitivity_order(sensi)[source]
Set the sensitivity order
- Parameters:
sensi (
amici._installation.amici.SensitivityOrder) – sensitivity order
- set_stability_limit_flag(stldet)[source]
set stability limit detection mode
- Parameters:
stldet (
bool) – can be false (deactivated) or true (activated)
- set_state_ordering(ordering)[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
- set_steady_state_sensi_tolerance_factor(factor)[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}_tolerance_steady_state_sensi().
- Parameters:
factor (
float) – tolerance factor (non-negative number)
- set_steady_state_tolerance_factor(factor)[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)
- switch_forward_sensis_off()[source]
Disable forward sensitivity integration (used in steady state sim)
- class amici.sim.sundials.SteadyStateComputationMode(*values)
- __init__(*args, **kwds)
- integrateIfNewtonFails = 1
- integrationOnly = 1
- newtonOnly = 1
- class amici.sim.sundials.SteadyStateSensitivityMode(*values)
- __init__(*args, **kwds)
- integrateIfNewtonFails = 1
- integrationOnly = 1
- newtonOnly = 1
- class amici.sim.sundials.SteadyStateStatus(*values)
- __init__(*args, **kwds)
- failed = 1
- failed_convergence = 1
- failed_damping = 1
- failed_factorization = 1
- failed_too_long_simulation = 1
- not_run = 1
- success = 1
- class amici.sim.sundials.StringDoubleMap(*args)[source]
Swig-Generated class templating
Dict[str,float] to facilitate interfacing with C++ bindings.
- amici.sim.sundials.evaluate(expr, rdata)[source]
Evaluate a symbolic expression based on the given simulation outputs.
- Parameters:
expr (
str|sympy.core.expr.Expr) – A symbolic expression, e.g. a sympy expression or a string that can be sympified. Can include state variable, expression, and observable IDs, depending on whether the respective data is available in the simulation results. Parameters are not yet supported.rdata (
amici.sim.sundials._numpy.ReturnDataView) – The simulation results.
- Return type:
- Returns:
The evaluated expression for the simulation output timepoints.
- amici.sim.sundials.get_backtrace_string(maxFrames, first_frame=0)[source]
Returns the current backtrace as std::string
- amici.sim.sundials.get_model_for_preeq(model, edata)[source]
Get a model set-up to simulate the preequilibration condition as specified in edata.
Useful for analyzing simulation errors during preequilibration. Simulating the returned model will reproduce the behavior of simulation-based preequilibration.
Note that for models with events, the simulation results may differ. During preequilibration, event-handling is disabled. However, when simulating the returned model, event-handling will be enabled. For events triggered at fixed timepoints, this can be avoided by setting
t0to a timepoints after the last trigger timepoint.- Parameters:
model (
amici._installation.amici.Model) – The model for which edata was generated.edata (
amici._installation.amici.ExpData) – The experimental data object with a preequilibration condition specified.
- Returns:
A copy of model with the same parameters, initial states, … as amici_model for the preequilibration condition. Output timepoints are set to
[inf]and will have to be adjusted.
- amici.sim.sundials.get_model_settings(model)[source]
Get model settings that are set independently of the compiled model.
This function is used for serialization of model settings. It must only be used in combination with
set_model_settings().- Parameters:
model (
typing.Union[amici._installation.amici.Model,amici._installation.amici.ModelPtr]) – The AMICI model instance.- Return type:
- Returns:
Value to be passed to
set_model_settings()to restore the model settings. Keys are AMICI model attributes, values are attribute values.
- amici.sim.sundials.import_model_module(module_name, module_path)[source]
Import Python module of an AMICI model.
- Parameters:
module_name (
str) – Name of the python package of the modelmodule_path (
pathlib.Path|str) – Absolute or relative path of the package directory
- Return type:
- Returns:
The model module
- amici.sim.sundials.parameter_scaling_from_int_vector(int_vec)[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
parameter_scaling_from_int_vector()
- amici.sim.sundials.read_exp_data_from_hdf5(hdf5Filename, hdf5Root, model)[source]
Read AMICI ExpData data from HDF5 file.
- Parameters:
hdf5Filename (
str) – Name of HDF5 filehdf5Root (
str) – Path inside the HDF5 file to object having ExpDatamodel (
amici._installation.amici.Model) – The model for which data is to be read
- Return type:
- Returns:
ExpData created from data in the given location
- amici.sim.sundials.read_model_data_from_hdf5(*args)[source]
Overload 1:
Read model data from HDF5 file.
- Parameters:
Overload 2:
Read model data from HDF5 file.
- amici.sim.sundials.read_solver_settings_from_hdf5(file, solver, location='solverSettings')[source]
Apply solver settings from an HDF5 file to a Solver instance.
- Parameters:
file (
str) – hdf5 filenamesolver (
typing.Union[amici._installation.amici.Solver,amici._installation.amici.SolverPtr]) – Solver instance to which settings will be transferredlocation (
str|None) – location of solver settings in hdf5 file
- Return type:
- amici.sim.sundials.run_simulation(model, solver, edata=None)[source]
Simulate a model with given solver and experimental data.
- Parameters:
model (
typing.Union[amici._installation.amici.Model,amici._installation.amici.ModelPtr]) – Model instancesolver (
typing.Union[amici._installation.amici.Solver,amici._installation.amici.SolverPtr]) – Solver instance, must be generated fromamici.amici.Model.create_solver()edata (
typing.Union[amici._installation.amici.ExpData,amici._installation.amici.ExpDataPtr,None]) – ExpData instance (optional)
- Return type:
- Returns:
ReturnData object with simulation results
- amici.sim.sundials.run_simulations(model, solver, edata_list, failfast=True, num_threads=1)[source]
Convenience wrapper for loops of amici.runAmiciSimulation
- Parameters:
model (
typing.Union[amici._installation.amici.Model,amici._installation.amici.ModelPtr]) – Model instancesolver (
typing.Union[amici._installation.amici.Solver,amici._installation.amici.SolverPtr]) – Solver instance, must be generated from Model.getSolver()edata_list (
typing.Union[amici._installation.amici.ExpDataPtrVector,collections.abc.Sequence[typing.Union[amici._installation.amici.ExpData,amici._installation.amici.ExpDataPtr]]]) – list of ExpData instancesfailfast (
bool) – returns as soon as an integration failure is encounterednum_threads (
int) – number of threads to use (only used if compiled with openmp)
- Return type:
- Returns:
list of simulation results
- amici.sim.sundials.scale_parameter(unscaledParameter, scaling)[source]
Apply parameter scaling according to scaling
- amici.sim.sundials.set_model_settings(model, settings)[source]
Set model settings.
This function is used for deserialization of model settings. It must only be used in combination with
get_model_settings().- Parameters:
model (
typing.Union[amici._installation.amici.Model,amici._installation.amici.ModelPtr]) – The AMICI model instance.settings (
dict[str,typing.Any]) – The return value ofget_model_settings(). Keys are callable attributes (setters) of an AMICI model, values are provided to the setters.
- Return type:
- amici.sim.sundials.simulation_status_to_str(status)[source]
Get the string representation of the given simulation status code (see ReturnData::status).
- amici.sim.sundials.unscale_parameter(scaledParameter, scaling)[source]
Remove parameter scaling according to scaling
- amici.sim.sundials.write_exp_data_to_hdf5(*args)[source]
Overload 1:
Write AMICI experimental data to HDF5 file.
- Parameters:
Overload 2:
Write AMICI experimental data to HDF5 file.
- amici.sim.sundials.write_return_data_to_hdf5(*args)[source]
Overload 1:
Write ReturnData to HDF5 file.
- Parameters:
rdata (
ReturnData) – Data to writefile (H5::H5File) – HDF5 file to write to
hdf5Location (str) – Full dataset path inside the HDF5 file (will be created)
Overload 2:
Write ReturnData to HDF5 file.
- Parameters:
rdata (
ReturnData) – Data to writehdf5Filename (str) – Filename of HDF5 file
hdf5Location (str) – Full dataset path inside the HDF5 file (will be created)
- amici.sim.sundials.write_solver_settings_to_hdf5(solver, file, location='solverSettings')[source]
Write solver settings from a Solver instance to an HDF5 file.
- Parameters:
solver (
typing.Union[amici._installation.amici.Solver,amici._installation.amici.SolverPtr]) – Solver instance from which settings will be storedlocation (
str|None) – location of solver settings in hdf5 file
- Return type: