Skip to main content

Trials

MethodDescription
list_trialsList trials.
iter_trialsIterate over trials.
get_trialGet a trial by SID.
create_trialCreate a trial from a model and optional related project items.
create_trial_from_jsonCreate a trial from a raw JSON payload.

list_trials​

list_trials(
*,
name: str | None = None,
folder: Folder | str | None = None,
limit: int | None = None,
deleted: bool = False,
after: str | None = None
) -> Page[Trial]

List trials.

Parameters:

NameTypeDescriptionDefault
namestr | NoneOptional name filter.None
folderFolder | str | NoneOptional folder filter.None
limitint | NoneMaximum number of results to return.None
deletedboolWhether to include deleted trials.False
afterstr | NonePagination cursor.None

Returns:

  • Page[Trial]: A page of Trial objects.

iter_trials​

iter_trials(
*,
name: str | None = None,
folder: Folder | str | None = None,
deleted: bool = False
) -> Iterator[Trial]

Iterate over trials.

Parameters:

NameTypeDescriptionDefault
namestr | NoneOptional name filter.None
folderFolder | str | NoneOptional folder filter.None
deletedboolWhether to include deleted trials.False

Yields:

get_trial​

get_trial(
sid: str, *, revision: int | None = None, allow_deleted: bool = False
) -> Trial

Get a trial by SID.

Parameters:

NameTypeDescriptionDefault
sidstrThe SID of the trial.
revisionint | NoneOptional revision number.None
allow_deletedboolWhether to allow retrieving deleted trials.False

Returns:

  • Trial: The requested Trial.

create_trial​

create_trial(
model: Model,
*,
data_tables: Sequence[DataTable | dict[str, Any]] | None = None,
vpop: Vpop | None = None,
protocol: ProtocolDesign | None = None,
simple_output_set: SimpleOutputSet | None = None,
advanced_output_set: AdvancedOutputSet | None = None,
folder: Folder | str | None = None,
name: str | None = None,
description: str | None = None,
version: str | dict | None = None,
solving_allow_varying_stoichiometry: bool | None = None,
solving_discontinuity_events: Any = None,
solving_evaluator: Any = None,
solving_extent_units: str | None = None,
solving_inline_limit: int | None = None,
solving_max_events: int | None = None,
solving_mute_phenomena: Any = None,
solving_mute_variables: Any = None,
solving_ode_solver_absolute_tolerance: float | None = None,
solving_ode_solver_initial_step: float | None = None,
solving_ode_solver_maximum_step: float | None = None,
solving_ode_solver_relative_tolerance: float | None = None,
solving_output_compartments: Any = None,
solving_output_parameters: Any = None,
solving_output_rates: Any = None,
solving_output_variables: Any = None,
solving_scoring_mode: Any = None,
solving_solver: Any = None,
solving_solving_times: list[Any] | None = None,
solving_unit_check: Any = None
) -> Trial

Create a trial from a model and optional related project items.

Can also be accessed through Model.create_trial() for convenience.

data_tables is optional. Each entry represents one experimental data table to attach to the trial. You can pass either:

  • a DataTable object, which uses the default settings
  • a dict with a DataTable object when you need custom inclusion or weighting behavior
  • a fully explicit dict using id fields instead of objects

A plain DataTable object is converted from the Python-side shorthand equivalent of: {"data_table": <that table>, "include": True, "options": {"weight": 1.0}}.

A custom dict entry should contain:

  • either data_table or data_table_id: required. data_table should be a DataTable object. data_table_id should be an explicit id mapping {"core_item_id": ..., "snapshot_id": ...}.
  • include: required boolean. Whether this table is included in the trial's generated data-table design.
  • options: required dict of generator options.

Supported options keys are:

  • weight: numeric weight for this table when combined with others.
  • label: custom label for the generated fitness contribution.
  • time_tolerance: parameter that lets calibrated time series match the source data within a time window around the data-table time points.
  • log_transform_wide_bounds: list of observable ids for which wide bounds are derived from the narrow bounds, using 50% of the left narrow bound and 200% of the right narrow bound unless explicit wide bounds are already defined in the data table.

Solving options are exposed as flattened solving_* keyword arguments only when you need to supply a complete option set. Omit every solving_* argument to inherit the model's solving options. Supplying only some values raises ValueError; the exact required set depends on the selected solver and model configuration.

Commonly useful solving arguments include:

  • solving_solver: numerical solver choice.
  • solving_solving_times: output sampling definition; each entry may be an ISO 8601 duration string such as "P42D" or "PT10H5M", a datetime.timedelta, or a regularly spaced time-span mapping using either representation for its duration fields.
  • solving_unit_check: unit-checking mode.
  • solving_extent_units: unit to which species are converted.
  • solving_ode_solver_absolute_tolerance and solving_ode_solver_relative_tolerance: numerical tolerances.

Example:

from datetime import timedelta

client.create_trial(
model,
solving_solver="BDF",
solving_solving_times=[
"P42D",
timedelta(hours=10, minutes=5),
{
"tMin": timedelta(0),
"tMax": "P7D",
"tStep": timedelta(hours=12),
},
],
)

create_trial_from_json​

create_trial_from_json(
*,
json_content: dict[str, Any] | bytes | str | None = None,
json_file_path: str | Path | None = None,
name: str | None = None,
folder: Folder | str | None = None,
description: str | None = None,
version: str | dict | None = None
) -> Trial

Create a trial from a raw JSON payload.

Exactly one of json_content or json_file_path must be provided.

Parameters:

NameTypeDescriptionDefault
json_contentdict[str, Any] | bytes | str | NoneThe trial payload as a dict, JSON bytes, or JSON string. When the dict payload contains solvingOptions.solvingTimes, duration entries may be ISO 8601 strings such as "P42D" or "PT10H5M" or datetime.timedelta objects; timedeltas are normalized before upload.None
json_file_pathstr | Path | NonePath to a JSON file containing the trial payload.None
namestr | NoneOptional name for the new project item.None
folderFolder | str | NoneOptional destination folder.None
descriptionstr | NoneOptional description for the new project item.None
versionstr | dict | NoneOptional version name str. Can also be a dict with the keys name and description to set a version description.None

Returns:

  • Trial: The created Trial.