pyvale.validation.validvis module

Visualisation options and PyVista views for validation results.

class MetricVisOpts(metric_colour_lims=None, metric_cmap=None, mesh_opacity=0.6, labels_always_visible=False, title=None, metric_label=None, metric_labels=<factory>)[source]

Bases: object

Metric/mesh appearance; camera, fonts and marker sizes use SensorSim options.

Point labels are generated by the plot function from its descriptor.

Variables:
  • metric_colour_lims (tuple[float, float] or None) – Optional lower and upper limits in metric units.

  • metric_cmap (str or None) – Optional PyVista colour map override for metric values.

  • mesh_opacity (float) – Opacity of the simulation background mesh, in [0, 1].

  • labels_always_visible (bool) – Show point labels even when occluded.

  • title (str or None) – Optional scene title override.

  • metric_label (str or None) – Optional label for the selected metric.

  • metric_labels (dict[EMetricType, str]) – Label overrides keyed by metric type.

metric_colour_lims
metric_cmap
mesh_opacity
labels_always_visible
title
metric_label
metric_labels
__init__(metric_colour_lims=None, metric_cmap=None, mesh_opacity=0.6, labels_always_visible=False, title=None, metric_label=None, metric_labels=<factory>)
create_valid_scene_opts(*, interactive=False)[source]

Create validation scene defaults with independently labelled colourbars.

Parameters:

interactive (bool, optional) – Enable an interactive display. False creates off-screen defaults.

Returns:

VisOptsSimSensors – SensorSim plotting settings with validation scene defaults.

plot_metric_on_sim(result, observable, metric, *, selectors=None, output=None, point_idxs=None, sim_data=None, sim_field=None, sim_time_idx=None, descriptor=None, sim_cmap='viridis', sim_colour_lims=None, sim_coord_units='', sim_coord_frame='', vis_opts=None, metric_opts=None, plotter=None)[source]

Colour xyz validation points, optionally over an independently coloured mesh.

The caller supplies the background run and declares its coordinate units and coord_frame; both must match the observable geometry. A time-resolved result must match the supplied background step exactly. No nearest-time selection, coordinate transformation, epistemic reduction or mesh interpolation occurs. NaN metrics remain grey points. Each numerical output is selected explicitly. A newly constructed plotter is off-screen by default; showing/saving is explicit.

sim_field selects a nodal variable key or supplies derived values shaped (n_nodes,) at sim_time_idx. The descriptor labels the background colourbar and generates tags for all validation points before applying point_idxs. Without a descriptor, points are unlabelled and the background uses its key (or “Sim. field” for an array) as the colourbar label.

Parameters:
  • result (ValidResult) – Validation results containing the requested observable and metric.

  • observable (str) – Observable tag identifying matching metadata and observations.

  • metric (EMetricType) – Metric to select or evaluate.

  • 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.

  • point_idxs (tuple[int, ] or None, optional) – Original point indices to draw. None draws all points.

  • sim_data (SimData or None, optional) – Optional simulation mesh and nodal fields for the background.

  • sim_field (str or ndarray or None, optional) – Name of a nodal variable, or values of shape (n_nodes,) for the supplied mesh.

  • sim_time_idx (int or None, optional) – Zero-based background time index when required by the selected field and observable.

  • descriptor (SensorDescriptor or None, optional) – Optional SensorSim descriptor used for point and background labels.

  • sim_cmap (str, optional) – Colour map for the background nodal values.

  • sim_colour_lims (tuple[float, float] or None, optional) – Optional lower and upper background colour limits.

  • sim_coord_units (str, optional) – Coordinate units of the simulation mesh, matching the observable.

  • sim_coord_frame (str, optional) – Coordinate frame of the simulation mesh, matching the observable.

  • vis_opts (VisOptsSimSensors or None, optional) – PyVista scene settings. None uses validation defaults.

  • metric_opts (MetricVisOpts or None, optional) – Metric overlay appearance. None uses default values.

  • plotter (pyvista.Plotter or None, optional) – Existing plotter to update, or None to create an off-screen plotter.

Returns:

pyvista.Plotter – PyVista scene with the selected metric values at xyz positions of shape (n_selected_points, 3).