pyPESTO support for the PEtab data format.

class pypesto.petab.PetabImporter(petab_problem: petab.Problem, output_folder: str = None, model_name: str = None)

Bases: pypesto.objective.amici.AmiciObjectBuilder

MODEL_BASE_DIR = 'amici_models'
__init__(petab_problem: petab.Problem, output_folder: str = None, model_name: str = None)

Managing access to the model and data.


Folder to contain the amici model. Defaults to ‘./amici_models/{model_name}’.


Name of the model, which will in particular be the name of the compiled model python module.


Compile the model. If the output folder exists already, it is first deleted.


kwargs (Extra arguments passed to amici.SbmlImporter.sbml2amici.) –

create_edatas(model: amici.Model = None, simulation_conditions=None) → List[amici.ExpData]

Create list of amici.ExpData objects.

create_model(force_compile: bool = False, **kwargs) → amici.Model

Import amici model. If necessary or force_compile is True, compile first.

  • force_compile

    If False, the model is compiled only if the output folder does not exist yet. If True, the output folder is deleted and the model (re-)compiled in either case.


    If force_compile, then an existing folder of that name will be deleted.

  • kwargs (Extra arguments passed to amici.SbmlImporter.sbml2amici) –

create_objective(model: amici.Model = None, solver: amici.Solver = None, edatas: Sequence[amici.ExpData] = None, force_compile: bool = False, **kwargs) → pypesto.objective.amici.AmiciObjective

Create a pypesto.AmiciObjective.

  • model – The AMICI model.

  • solver – The AMICI solver.

  • edatas – The experimental data in AMICI format.

  • force_compile – Whether to force-compile the model if not passed.

  • **kwargs – Additional arguments passed on to the objective.


A pypesto.AmiciObjective for the model and the data.

Return type


create_prior() → pypesto.objective.priors.NegLogParameterPriors

Creates a prior from the parameter table. Returns None, if no priors are defined.

create_problem(objective: pypesto.objective.amici.AmiciObjective = None, **kwargs)pypesto.problem.Problem

Create a pypesto.Problem.

  • objective – Objective as created by create_objective.

  • **kwargs – Additional key word arguments passed on to the objective, if not provided.


A pypesto.Problem for the objective.

Return type


create_solver(model: amici.Model = None) → amici.Solver

Return model solver.

static from_yaml(yaml_config: Union[dict, str], output_folder: str = None, model_name: str = None) → pypesto.petab.importer.PetabImporter

Simplified constructor using a petab yaml file.

rdatas_to_measurement_df(rdatas: Sequence[amici.ReturnData], model: amici.Model = None) → pandas.core.frame.DataFrame

Create a measurement dataframe in the petab format from the passed rdatas and own information.

  • rdatas – A list of rdatas as produced by pypesto.AmiciObjective.__call__(x, return_dict=True)[‘rdatas’].

  • model – The amici model.


A dataframe built from the rdatas in the format as in self.petab_problem.measurement_df.

Return type


rdatas_to_simulation_df(rdatas: Sequence[amici.ReturnData], model: amici.Model = None) → pandas.core.frame.DataFrame

Same as rdatas_to_measurement_df, execpt a petab simulation dataframe is created, i.e. the measurement column label is adjusted.