pyvale.validation.validtools module

Select labelled metric arrays and construct metric labels.

select_metric_output(field, output=None, *, selection_idxs=())[source]

Borrow an explicit output, or the sole output when no choice is supplied.

Parameters:
  • field (MetricField) – Metric field with arrays in named result-axis order.

  • output (EMetricOut or None, optional) – Metric output to select. Use None to infer a single available output.

  • selection_idxs (tuple[int or slice, ], optional) – Index tuple in field axis order. The default selects the complete stored array.

Returns:

ndarray – Selected metric values, borrowing the stored array for basic slicing. Shape follows the unsliced dimensions.

extract_metric_values(field, *, keep=EValidResAxis.POINT, selectors=None, output=None)[source]

Retain one axis and select every other non-singleton result axis.

Parameters:
  • field (MetricField) – Metric field with arrays in named result-axis order.

  • keep (EValidResAxis, optional) – Result axis left as a full slice; other non-singleton dimensions need selectors.

  • selectors (dict[EValidResAxis, int] or None, optional) – Zero-based indices keyed by result axis; omitted axes follow the operation’s defaults.

  • output (EMetricOut or None, optional) – Metric output to select. Use None to infer a single available output.

Returns:

ndarray – One-dimensional metric values of shape (n_kept,), in the retained axis order.