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

Methods Summary

__init__(ode_model[, outdir, verbose, ...])

Generate AMICI C++ files for the ODE provided to the constructor.

compile_model()

Compiles the generated code it into a simulatable module

generate_model_code()

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
compile_model()[source]

Compiles the generated code it into a simulatable module

Return type

None

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

None

set_name(model_name)[source]

Sets the model name

Parameters

model_name (str) – name of the model (may only contain upper and lower case letters, digits and underscores, and must not start with a digit)

Return type

None

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. If None, this will default to amici-{self.model_name} in the current working directory. will be created if it does not exist.

Return type

None