amici.petab_simulate.PetabSimulator

class amici.petab_simulate.PetabSimulator(*args, amici_model=None, **kwargs)[source]

Implementation of the PEtab Simulator class that uses AMICI.

__init__(*args, amici_model=None, **kwargs)[source]

Initialize the simulator.

Initialize the simulator with sufficient information to perform a simulation. If no working directory is specified, a temporary one is created.

Parameters
  • petab_problem – A PEtab problem.

  • working_dir – All simulator-specific output files will be saved here. This directory and its contents may be modified and deleted, and should be considered ephemeral.

Methods Summary

__init__(*args[, amici_model])

Initialize the simulator.

add_noise(simulation_df[, noise_scaling_factor])

Add noise to simulated data.

remove_working_dir([force])

Remove the simulator working directory, and all files within.

simulate([noise, noise_scaling_factor])

Simulate a PEtab problem, optionally with noise.

simulate_without_noise(**kwargs)

See petab.simulate.Simulator.simulate() docstring.

Methods

__init__(*args, amici_model=None, **kwargs)[source]

Initialize the simulator.

Initialize the simulator with sufficient information to perform a simulation. If no working directory is specified, a temporary one is created.

Parameters
  • petab_problem – A PEtab problem.

  • working_dir – All simulator-specific output files will be saved here. This directory and its contents may be modified and deleted, and should be considered ephemeral.

add_noise(simulation_df, noise_scaling_factor=1, **kwargs)

Add noise to simulated data.

Parameters
  • simulation_df (pandas.core.frame.DataFrame) – A PEtab measurements table that contains simulated data.

  • noise_scaling_factor (float) – A multiplier of the scale of the noise distribution.

  • **kwargs – Additional keyword arguments are passed to sample_noise.

Return type

pandas.core.frame.DataFrame

Returns

Simulated data with noise, as a PEtab measurements table.

remove_working_dir(force=False, **kwargs)

Remove the simulator working directory, and all files within.

See the __init__ method arguments.

Parameters
  • force (bool) – If True, the working directory is removed regardless of whether it is a temporary directory.

  • **kwargs – Additional keyword arguments are passed to shutil.rmtree.

Return type

None

simulate(noise=False, noise_scaling_factor=1, **kwargs)

Simulate a PEtab problem, optionally with noise.

Parameters
  • noise (bool) – If True, noise is added to simulated data.

  • noise_scaling_factor (float) – A multiplier of the scale of the noise distribution.

  • **kwargs – Additional keyword arguments are passed to simulate_without_noise.

Return type

pandas.core.frame.DataFrame

Returns

Simulated data, as a PEtab measurements table.

simulate_without_noise(**kwargs)[source]

See petab.simulate.Simulator.simulate() docstring.

Additional keyword arguments can be supplied to specify arguments for the AMICI PEtab import, simulate, and export methods. See the docstrings for the respective methods for argument options: - amici.petab_import.import_petab_problem(), and - amici.petab_objective.simulate_petab().

Note that some arguments are expected to have already been specified in the Simulator constructor (including the PEtab problem).

Return type

pandas.core.frame.DataFrame