petab_select.model_space

The ModelSpace class and related methods.

Classes

ModelSpace(model_subspaces)

A model space, as a collection of model subspaces.

class petab_select.model_space.ModelSpace(model_subspaces)[source]

A model space, as a collection of model subspaces.

model_subspaces

List of model subspaces.

exclusions

Hashes of models that are excluded from the model space.

__init__(model_subspaces)[source]
static load(data, root_path=None)[source]

Load a model space from dataframe(s) or file(s).

Parameters:
  • data (str | Path | DataFrame | list[str | Path | DataFrame]) – The data. TSV file(s) or pandas dataframe(s).

  • root_path (str | Path) – Any paths in dataframe will be resolved relative to this path. Paths in TSV files will be resolved relative to the directory of the TSV file.

Return type:

ModelSpace

Returns:

The model space.

reset_exclusions(exclusions=None)[source]

Reset the exclusions in the model subspaces.

Return type:

None

save(filename=None)[source]

Export the model space to a dataframe (and TSV).

Parameters:

filename (str | Path | None) – If provided, the dataframe will be saved here as a TSV. Paths will be made relative to the parent directory of this filename.

Return type:

DataFrame

Returns:

The dataframe.

search(candidate_space, limit=inf, exclude=True)[source]

Search all model subspaces according to a candidate space method.

Parameters:
  • candidate_space (CandidateSpace) – The candidate space.

  • limit (int) – The maximum number of models to send to the candidate space (i.e. this limit is on the number of models considered, not necessarily approved as candidates). Note that using a limit may produce unexpected results. For example, it may bias candidate models to be chosen only from a subset of model subspaces.

  • exclude (bool) – Whether to exclude the new candidates from the model subspaces.