amici.petab_import
PEtab Import
Import a model in the petab
(https://github.com/PEtab-dev/PEtab) format
into AMICI.
Deprecated since version 0.21.0: Use amici.petab
instead.
- amici.petab_import.check_model(amici_model, petab_problem)[source]
Check that the model is consistent with the PEtab problem.
- Return type:
- amici.petab_import.get_fixed_parameters(petab_problem, non_estimated_parameters_as_constants=True)
Determine, set and return fixed model parameters.
Non-estimated parameters and parameters specified in the condition table are turned into constants (unless they are overridden). Only global SBML parameters are considered. Local parameters are ignored.
- Parameters:
petab_problem (
petab.v1.problem.Problem
) – The PEtab problem instancenon_estimated_parameters_as_constants – Whether parameters marked as non-estimated in PEtab should be considered constant in AMICI. Setting this to
True
will reduce model size and simulation times. If sensitivities with respect to those parameters are required, this should be set toFalse
.
- Return type:
- Returns:
list of IDs of parameters which are to be considered constant.
- amici.petab_import.get_observation_model(observable_df)[source]
Get observables, sigmas, and noise distributions from PEtab observation table in a format suitable for
amici.sbml_import.SbmlImporter.sbml2amici()
.
- amici.petab_import.import_model(sbml_model=None, petab_problem=None, model_name=None, model_output_dir=None, verbose=True, allow_reinit_fixpar_initcond=True, validate=True, non_estimated_parameters_as_constants=True, output_parameter_defaults=None, discard_sbml_annotations=False, jax=False, **kwargs)
Create AMICI model from PEtab problem
- Parameters:
sbml_model (
typing.Union
[str
,pathlib.Path
,libsbml.Model
]) – PEtab SBML model or SBML file name. Deprecated, passpetab_problem
instead.petab_problem (
petab.v1.problem.Problem
) – PEtab problem.model_name (
str
|None
) – Name of the generated model. If model file name was provided, this defaults to the file name without extension, otherwise the SBML model ID will be used.model_output_dir (
str
|pathlib.Path
|None
) – Directory to write the model code to. Will be created if doesn’t exist. Defaults to current directory.allow_reinit_fixpar_initcond (
bool
) – Seeamici.de_export.ODEExporter
. Must be enabled if initial states are to be reset after preequilibration.validate (
bool
) – Whether to validate the PEtab problemnon_estimated_parameters_as_constants – Whether parameters marked as non-estimated in PEtab should be considered constant in AMICI. Setting this to
True
will reduce model size and simulation times. If sensitivities with respect to those parameters are required, this should be set toFalse
.output_parameter_defaults (
dict
[str
,float
] |None
) – Optional default parameter values for output parameters introduced in the PEtab observables table, in particular for placeholder parameters. dictionary mapping parameter IDs to default values.discard_sbml_annotations (
bool
) – Discard information contained in AMICI SBML annotations (debug).jax (
bool
) – Whether to generate JAX code instead of C++ code.kwargs – Additional keyword arguments to be passed to
amici.sbml_import.SbmlImporter.sbml2amici()
.
- Return type:
- Returns:
The created
amici.sbml_import.SbmlImporter
instance.
- amici.petab_import.import_model_sbml(sbml_model=None, petab_problem=None, model_name=None, model_output_dir=None, verbose=True, allow_reinit_fixpar_initcond=True, validate=True, non_estimated_parameters_as_constants=True, output_parameter_defaults=None, discard_sbml_annotations=False, jax=False, **kwargs)[source]
Create AMICI model from PEtab problem
- Parameters:
sbml_model (
typing.Union
[str
,pathlib.Path
,libsbml.Model
]) – PEtab SBML model or SBML file name. Deprecated, passpetab_problem
instead.petab_problem (
petab.v1.problem.Problem
) – PEtab problem.model_name (
str
|None
) – Name of the generated model. If model file name was provided, this defaults to the file name without extension, otherwise the SBML model ID will be used.model_output_dir (
str
|pathlib.Path
|None
) – Directory to write the model code to. Will be created if doesn’t exist. Defaults to current directory.allow_reinit_fixpar_initcond (
bool
) – Seeamici.de_export.ODEExporter
. Must be enabled if initial states are to be reset after preequilibration.validate (
bool
) – Whether to validate the PEtab problemnon_estimated_parameters_as_constants – Whether parameters marked as non-estimated in PEtab should be considered constant in AMICI. Setting this to
True
will reduce model size and simulation times. If sensitivities with respect to those parameters are required, this should be set toFalse
.output_parameter_defaults (
dict
[str
,float
] |None
) – Optional default parameter values for output parameters introduced in the PEtab observables table, in particular for placeholder parameters. dictionary mapping parameter IDs to default values.discard_sbml_annotations (
bool
) – Discard information contained in AMICI SBML annotations (debug).jax (
bool
) – Whether to generate JAX code instead of C++ code.kwargs – Additional keyword arguments to be passed to
amici.sbml_import.SbmlImporter.sbml2amici()
.
- Return type:
- Returns:
The created
amici.sbml_import.SbmlImporter
instance.
- amici.petab_import.import_petab_problem(petab_problem, model_output_dir=None, model_name=None, compile_=None, non_estimated_parameters_as_constants=True, jax=False, **kwargs)[source]
Create an AMICI model for a PEtab problem.
- Parameters:
petab_problem (
petab.v1.problem.Problem
) – A petab problem containing all relevant information on the model.model_output_dir (
str
|pathlib.Path
|None
) – Directory to write the model code to. It will be created if it doesn’t exist. Defaults to current directory.model_name (
str
) – Name of the generated model module. Defaults to the ID of the model or the model file name without the extension.compile – If
True
, the model will be compiled. IfFalse
, the model will not be compiled. IfNone
, the model will be compiled if it cannot be imported.non_estimated_parameters_as_constants – Whether parameters marked as non-estimated in PEtab should be considered constant in AMICI. Setting this to
True
will reduce model size and simulation times. If sensitivities with respect to those parameters are required, this should be set toFalse
.jax – Whether to load the jax version of the model. Note that this disables compilation of the model module unless compile is set to True.
kwargs – Additional keyword arguments to be passed to
amici.sbml_import.SbmlImporter.sbml2amici()
oramici.pysb_import.pysb2amici()
, depending on the model type.
- Return type:
- Returns:
The imported model.
- amici.petab_import.petab_noise_distributions_to_amici(observable_df)[source]
Map from the petab to the amici format of noise distribution identifiers.
- Parameters:
observable_df (
pandas.core.frame.DataFrame
) – PEtab observable table- Return type:
- Returns:
dictionary of observable_id => AMICI noise-distributions
- amici.petab_import.petab_scale_to_amici_scale(scale_str)[source]
Convert PEtab parameter scaling string to AMICI scaling integer
- Return type: