Skip to content

Protocols

ProtocolRunner is the standalone, user-facing class for running a model through a multi-experiment / sub-experiment protocol with given parameter values — useful for re-simulating with calibrated parameters outside the param-id loop.

protocol_runners.protocol_runner.ProtocolRunner

ProtocolRunner(
    model_path,
    inp_data_dict=None,
    solver="CVODE_myokit",
    model_type=None,
)

Standalone, user-facing runner for model protocols.

Creates its own SimulationHelper (defaulting to Myokit / CVODE) and wraps ProtocolExecutor for the multi-experiment / sub-experiment simulation loop. Useful for re-simulating a model with calibrated parameters outside the param-id loop.

Parameters:

Name Type Description Default
model_path

Path to the model file.

required
inp_data_dict

Configuration dict containing at least dt and solver_info. If None, loaded from user_run_files/user_inputs.yaml (respecting user_inputs_path_override if set).

None
solver

Solver identifier passed to get_simulation_helper, e.g. 'CVODE_myokit' or 'CVODE_opencor'.

'CVODE_myokit'
model_type

Backend family ('cellml_only' / 'python' / 'casadi_python'); falls back to inp_data_dict['model_type'].

None

get_variable_names

get_variable_names()

Return the variable names of the model (used for downstream plotting).

get_var2idx_dict

get_var2idx_dict()

Return a mapping from variable name to index in the result list.

run_protocols

run_protocols(
    model_path,
    protocol_info=None,
    id_param_names=None,
    id_param_vals=None,
)

Run the protocol defined by protocol_info and return result arrays.

Parameters:

Name Type Description Default
model_path

Path to the model. Kept for API compatibility; the model was loaded at construction time and this argument is not re-used.

required
protocol_info

Protocol descriptor. If None, read from inp_data_dict['param_id_obs_path'].

None
id_param_names

Parameter names to set (same format as param_id).

None
id_param_vals

Values to apply before each experiment (e.g. calibrated parameters).

None

Returns:

Name Type Description
tuple

(t_list, res_list, sim_times) where t_list is the time

vector per experiment (pre_time removed); res_list[exp][var] is

the full time-series for that variable concatenated across

sub-experiments; and sim_times is the sim_times from

protocol_info.