amici.adapters.fiddy
Adapters for using AMICI with the fiddy package for finite difference checks.
NOTE: Like fiddy, this module is experimental and subject to change.
Functions
|
|
|
|
|
|
|
|
|
Convert amici.run_simulation to fiddy functions. |
|
Convert |
|
Create fiddy functions for PetabSimulator. |
|
|
|
|
|
- amici.adapters.fiddy.run_simulation_to_cached_functions(amici_model, *, cache=True, parameter_ids=None, amici_solver=None, amici_edata=None, derivative_variables=None)[source]
Convert amici.run_simulation to fiddy functions.
- Parameters:
amici_model (
amici.amici.Model|amici.amici.ModelPtr) – The AMICI model to simulate.amici_solver (
typing.Union[amici.amici.Solver,amici.amici.SolverPtr]) – The AMICI solver to use. If None, a new solver will be created from the model.amici_edata (
typing.Union[amici.amici.ExpData,amici.amici.ExpDataPtr]) – The AMICI ExpData to use. If None, no data will be used.derivative_variables (
list[str]) – The variables that derivatives will be computed or approximated for. See the keys of all_rdata_derivatives for options.parameter_ids (
list[str]) – The IDs that correspond to the values in the parameter vector that is simulated.cache (
bool) – Whether to cache the function calls.
- Returns:
function, derivatives and structure
- amici.adapters.fiddy.simulate_petab_to_cached_functions(petab_problem, amici_model, parameter_ids=None, cache=True, precreate_edatas=True, precreate_parameter_mapping=True, simulate_petab=None, **kwargs)[source]
Convert
amici.petab.simulations.simulate_petab()(PEtab v1 simulations) to fiddy functions.Note that all gradients are provided on linear scale. The correction from ‘log10’ scale is automatically done.
- Parameters:
amici_model (
amici.amici.Model) – The AMICI model to simulate.simulate_petab (
collections.abc.Callable[[typing.Any],str]) – A method to simulate PEtab problems with AMICI, e.g. amici.petab_objective.simulate_petab.parameter_ids (
list[str]) – The IDs of the parameters, in the order that parameter values will be supplied. Defaults to petab_problem.parameter_df.index.petab_problem (
petab.v1.problem.Problem) – The PEtab problem.cache (
bool) – Whether to cache the function call.precreate_edatas (
bool) – Whether to create the AMICI measurements object in advance, to save time.precreate_parameter_mapping (
bool) – Whether to create the AMICI parameter mapping object in advance, to save time.kwargs – Passed to simulate_petab.
- Return type:
tuple[collections.abc.Callable[[numpy.ndarray[tuple[typing.Any,...],numpy.dtype[numpy.float64]]],numpy.ndarray[tuple[typing.Any,...],numpy.dtype[numpy.float64]]],collections.abc.Callable[[numpy.ndarray[tuple[typing.Any,...],numpy.dtype[numpy.float64]]],numpy.ndarray[tuple[typing.Any,...],numpy.dtype[numpy.float64]]]]- Returns:
A tuple of:
1: A method to compute the function at a point.
2: A method to compute the gradient at a point.