amici.ode_export.ODEExporter
- class amici.ode_export.ODEExporter(ode_model, outdir=None, verbose=False, assume_pow_positivity=False, compiler=None, allow_reinit_fixpar_initcond=True, generate_sensitivity_code=True, model_name='model')[source]
The ODEExporter class generates AMICI C++ files for ODE model as defined in symbolic expressions.
- Variables
model – ODE definition
verbose – more verbose output if True
assume_pow_positivity – if set to true, a special pow function is used to avoid problems with state variables that may become negative due to numerical errors
compiler – distutils/setuptools compiler selection to build the Python extension
functions – carries C++ function signatures and other specifications
model_name – name of the model that will be used for compilation
model_path – path to the generated model specific files
model_swig_path – path to the generated swig files
allow_reinit_fixpar_initcond – indicates whether reinitialization of initial states depending on fixedParameters is allowed for this model
_build_hints – If the given model uses special functions, this set contains hints for model building.
generate_sensitivity_code – Specifies whether code for sensitivity computation is to be generated
Note
When importing large models (several hundreds of species or parameters), import time can potentially be reduced by using multiple CPU cores. This is controlled by setting the
AMICI_IMPORT_NPROCS
environment variable to the number of parallel processes that are to be used (default: 1). Note that for small models this may (slightly) increase import times.- __init__(ode_model, outdir=None, verbose=False, assume_pow_positivity=False, compiler=None, allow_reinit_fixpar_initcond=True, generate_sensitivity_code=True, model_name='model')[source]
Generate AMICI C++ files for the ODE provided to the constructor.
- Parameters
ode_model (
amici.ode_export.ODEModel
) – ODE definitionoutdir (
typing.Union
[pathlib.Path
,str
,None
]) – seeamici.ode_export.ODEExporter.set_paths()
verbose (
typing.Union
[bool
,int
,None
]) – verbosity level for logging,True
/False
default tologging.Error
/logging.DEBUG
assume_pow_positivity (
typing.Optional
[bool
]) – if set to true, a special pow function is used to avoid problems with state variables that may become negative due to numerical errorscompiler (
typing.Optional
[str
]) – distutils/setuptools compiler selection to build the python extensionallow_reinit_fixpar_initcond (
typing.Optional
[bool
]) – seeamici.ode_export.ODEExporter
generate_sensitivity_code (
typing.Optional
[bool
]) – specifies whether code required for sensitivity computation will be generatedmodel_name (
typing.Optional
[str
]) – name of the model to be used during code generation
Methods Summary
__init__
(ode_model[, outdir, verbose, ...])Generate AMICI C++ files for the ODE provided to the constructor.
Compiles the generated code it into a simulatable module
Generates the native C++ code for the loaded model and a Matlab script that can be run to compile a mex file from the C++ code
set_name
(model_name)Sets the model name
set_paths
([output_dir])Set output paths for the model and create if necessary
Methods
- __init__(ode_model, outdir=None, verbose=False, assume_pow_positivity=False, compiler=None, allow_reinit_fixpar_initcond=True, generate_sensitivity_code=True, model_name='model')[source]
Generate AMICI C++ files for the ODE provided to the constructor.
- Parameters
ode_model (
amici.ode_export.ODEModel
) – ODE definitionoutdir (
typing.Union
[pathlib.Path
,str
,None
]) – seeamici.ode_export.ODEExporter.set_paths()
verbose (
typing.Union
[bool
,int
,None
]) – verbosity level for logging,True
/False
default tologging.Error
/logging.DEBUG
assume_pow_positivity (
typing.Optional
[bool
]) – if set to true, a special pow function is used to avoid problems with state variables that may become negative due to numerical errorscompiler (
typing.Optional
[str
]) – distutils/setuptools compiler selection to build the python extensionallow_reinit_fixpar_initcond (
typing.Optional
[bool
]) – seeamici.ode_export.ODEExporter
generate_sensitivity_code (
typing.Optional
[bool
]) – specifies whether code required for sensitivity computation will be generatedmodel_name (
typing.Optional
[str
]) – name of the model to be used during code generation
- generate_model_code()[source]
Generates the native C++ code for the loaded model and a Matlab script that can be run to compile a mex file from the C++ code
- Return type
- set_paths(output_dir=None)[source]
Set output paths for the model and create if necessary
- Parameters
output_dir (
typing.Union
[pathlib.Path
,str
,None
]) – relative or absolute path where the generated model code is to be placed. IfNone
, this will default toamici-{self.model_name}
in the current working directory. will be created if it does not exist.- Return type