pypesto.objective.roadrunner
RoadRunner objective
- class pypesto.objective.roadrunner.ExpData[source]
Bases:
objectClass for managing experimental data for a single condition.
- __init__(condition_id, measurements, observable_ids, noise_distributions, noise_formulae)[source]
Initialize the ExpData object.
- Parameters:
condition_id (
str) – Identifier of the condition.measurements (
ndarray) – Numpy Array containing the measurement data. It is a 2D array of dimension (n_timepoints, n_observables + 1). The first column is the timepoints, the remaining columns are the observable values. Observables not measured at a given timepoint should be NaN.timepoints – Timepoints of the measurement data.
observable_ids (
Sequence[str]) – Observable ids of the measurement data. Order must match the columns of the measurements array (-time).noise_distributions (
ndarray) – Numpy Array describing noise distributions of the measurement data. Dimension: (n_timepoints, n_observables). Each entry is a string describing scale and type of noise distribution, the name is “scale_type”. E.g. “lin_normal”, “log_normal”, “log10_normal”.noise_formulae (
ndarray) – Numpy Array describing noise formulae of the measurement data. Dimension: (n_timepoints, n_observables). Each entry is a string describing the noise formula, either a parameter name or a constant.
- static from_petab_problem(petab_problem)[source]
Create a list of ExpData object from a petab problem.
- static from_petab_single_condition(condition_id, petab_problem)[source]
Create an ExpData object from a single condition of a petab problem.
- get_observable_ids()[source]
Get the observable ids of the measurement data.
- Returns:
observable_ids – Observable ids of the measurement data.
- property timepoints
Timepoints of the measurement data.
- class pypesto.objective.roadrunner.PetabImporterRR[source]
Bases:
objectImporter for PEtab problems using RoadRunner.
Create a
roadrunner.RoadRunnerinstance, apypesto.objective.RoadRunnerObjectiveor apypesto.problem.Problemfrom PEtab files. The actual form of the likelihood depends on the noise model specified in the provided PEtab problem. For more information, see the PEtab documentation.- create_objective(rr=None, edatas=None)[source]
Create a
pypesto.objective.RoadRunnerObjective.- Parameters:
- Return type:
- create_prior()[source]
Create a prior from the parameter table.
Returns None, if no priors are defined.
- Return type:
- create_problem(objective=None, x_guesses=None, problem_kwargs=None, startpoint_kwargs=None, **kwargs)[source]
Create a
pypesto.problem.Problem.- Parameters:
objective (
RoadRunnerObjective|None) – Objective as created bycreate_objective().x_guesses (
Iterable[float] |None) – Guesses for the parameter values, shape (g, dim), where g denotes the number of guesses. These are used as start points in the optimization.problem_kwargs (
dict[str,Any] |None) – Passed topypesto.problem.Problem.__init__().startpoint_kwargs (
dict[str,Any] |None) – Keyword arguments forwarded toPetabImporter.create_startpoint_method().**kwargs – Additional key word arguments passed on to the objective, if not provided.
- Return type:
- Returns:
A
pypesto.problem.Probleminstance.
- create_startpoint_method(**kwargs)[source]
Create a startpoint method.
- Parameters:
**kwargs – Additional keyword arguments passed on to
pypesto.startpoint.FunctionStartpoints.__init__().- Return type:
- fill_model()[source]
Fill the RoadRunner model inplace from the PEtab problem.
- Parameters:
return_model – Flag indicating if the model should be returned.
- class pypesto.objective.roadrunner.RoadRunnerCalculator[source]
Bases:
objectClass to handle RoadRunner simulation and obtain objective value.
- __call__(x_dct, mode, roadrunner_instance, edatas, x_ids, parameter_mapping, petab_problem, solver_options=None)[source]
Perform the RoadRunner call and obtain objective function values.
- Parameters:
x_dct (
dict) – Parameter dictionary.mode (
Literal['mode_fun','mode_res']) – Mode of the call.roadrunner_instance (
RoadRunner) – RoadRunner instance.parameter_mapping (
list[tuple[dict[str,str|Number],dict[str,str|Number],dict[str,str],dict[str,str]]]) – Parameter parameter_mapping.petab_problem (
Problem) – PEtab problem.solver_options (
SolverOptions|None) – Solver options of the roadrunner instance Integrator. These will modify the roadrunner instance inplace.
- Returns:
Tuple of objective function values.
- fill_in_parameters(problem_parameters, roadrunner_instance=None, parameter_mapping=None, preeq=False, filling_mode=None)[source]
Fill in parameters into the roadrunner instance.
- Parameters:
roadrunner_instance (
RoadRunner|None) – RoadRunner instance to fill in parametersproblem_parameters (
dict) – Problem parameters as parameterId=>value dict. Only parameters included here will be set. Remaining parameters will be used as already set in amici_model and edata.parameter_mapping (
tuple[dict[str,str|Number],dict[str,str|Number],dict[str,str],dict[str,str]] |None) – Parameter mapping for current condition. Quadruple of dicts, where the first dict contains the parameter mapping for pre- equilibration, the second dict contains the parameter mapping for the simulation, the third and fourth dict contain the scaling factors for the pre-equilibration and simulation, respectively.preeq (
bool) – Whether to fill in parameters for pre-equilibration.filling_mode (
str|None) – Which parameters to fill in. If None or “all”, all parameters are filled in. Other options are “only_parameters” and “only_species”.
- Return type:
- Returns:
dict – Mapping of parameter IDs to values.
- simulate_per_condition(x_dct, roadrunner_instance, edata, parameter_mapping_per_condition)[source]
Simulate the model for a single condition.
- Parameters:
x_dct (
dict) – Parameter dictionary.roadrunner_instance (
RoadRunner) – RoadRunner instance.edata (
ExpData) – ExpData of a single condition.parameter_mapping_per_condition (
tuple[dict[str,str|Number],dict[str,str|Number],dict[str,str],dict[str,str]]) – Parameter parameter_mapping for a single condition.
- Return type:
- Returns:
Tuple of simulation results in form of a numpy array and the
negative log-likelihood.
- class pypesto.objective.roadrunner.SolverOptions[source]
Bases:
dictClass for managing solver options of roadrunner.