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:
objectMetric/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]orNone) – Optional lower and upper limits in metric units.metric_cmap (
strorNone) – 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.metric_label (
strorNone) – 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]orNone, optional) – Zero-based indices keyed by result axis; omitted axes follow the operation’s defaults.output (
EMetricOutorNone, optional) – Metric output to select. Use None to infer a single available output.point_idxs (
tuple[int,]orNone, optional) – Original point indices to draw. None draws all points.sim_data (
SimDataorNone, optional) – Optional simulation mesh and nodal fields for the background.sim_field (
strorndarrayorNone, optional) – Name of a nodal variable, or values of shape (n_nodes,) for the supplied mesh.sim_time_idx (
intorNone, optional) – Zero-based background time index when required by the selected field and observable.descriptor (
SensorDescriptororNone, 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]orNone, 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 (
VisOptsSimSensorsorNone, optional) – PyVista scene settings. None uses validation defaults.metric_opts (
MetricVisOptsorNone, optional) – Metric overlay appearance. None uses default values.plotter (
pyvista.PlotterorNone, 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).