plaid.post.bisect

Utiliy function to plot bisect graphs comparing predictions vs. targets dataset.

Functions

prepare_datasets(→ tuple[dict, dict, list[str]])

Prepare datasets for comparison.

is_dvipng_available(→ bool)

Check if dvipng is available on the system for matplotlib figures.

plot_bisect(→ None)

Plot a bisect graph comparing predictions vs. targets dataset.

Module Contents

prepare_datasets(ref_dataset: plaid.Dataset, pred_dataset: plaid.Dataset, problem_definition: plaid.ProblemDefinition, verbose: bool = False) tuple[dict, dict, list[str]][source]

Prepare datasets for comparison.

Parameters:
  • ref_dataset (Dataset) – The reference dataset.

  • pred_dataset (Dataset) – The predicted dataset.

  • problem_definition (ProblemDefinition) – The common problem for the reference and predicted dataset

  • verbose (bool, optional) – Verbose mode. Defaults to False.

Returns:

A tuple containing dictionaries of reference and predicted scalar values, and a list of scalar names.

Return type:

tuple[dict[str, list[float]], dict[str, list[float]], list[str]]

is_dvipng_available(verbose: bool) bool[source]

Check if dvipng is available on the system for matplotlib figures.

Returns:

True if dvipng is available, False otherwise.

Return type:

bool

plot_bisect(ref_dataset: plaid.Dataset | str | pathlib.Path, pred_dataset: plaid.Dataset | str | pathlib.Path, problem_def: plaid.ProblemDefinition | str | pathlib.Path, scalar: str | int, save_file_name: str = 'bissec_plots', verbose: bool = False) None[source]

Plot a bisect graph comparing predictions vs. targets dataset.

Parameters:
  • ref_dataset (Dataset | str | Path) – The reference dataset or its file path.

  • pred_dataset (Dataset | str | Path) – The predicted dataset or its file path.

  • problem_def (ProblemDefinition | str | Path) – The common problem for the reference and predicted dataset

  • scalar (str | int) – The name of the scalar to study or its index.

  • save_file_name (str, optional) – Figure name when saving to PNG format. Defaults to “bissec_plots”.

  • verbose (bool, optional) – Verbose mode. Defaults to False.

Raises:

KeyError – If the provided scalar name is not part of the dataset.