visualtools.py¶
This module contains utility functions used for creating pyvale visualisations.
- create_pv_plotter(vis_opts)[source]¶
Creates a pyvista plotter based on the input options.
- Parameters:
vis_opts (
VisOptsSimSensors
) – Dataclass containing the visualisation options for creating the plotter.- Returns:
pv.Plotter
– Blank pyvista plotter object with the given settings.
- get_colour_lims(component_data, colour_bar_lims)[source]¶
Gets the colourbar limits based on the input component data array.
- Parameters:
component_data (
np.ndarray
) – Array of data for the field component of interest. Can be any shape as the array is flattened for the limit calculationscolour_bar_lims (
tuple[float,float] | None
) – Forces the colourbar limits to be the values give in the tuple. If None then the colorbar limits are calculated based on the input data array.
- Returns:
tuple[float,float]
– Colourbar limits in the form: (min,max).
- save_pv_image(pv_plot, image_save_opts)[source]¶
Saves an image of a pyvista visualisation to disk based on the input options.
- Parameters:
pv_plot (
pv.Plotter
) – Pyvista plotter object to save the image from.image_save_opts (
VisOptsImageSave
) – Dataclass containing the options to save the image.
- set_animation_writer(pv_plot, anim_opts)[source]¶
Sets the animation writer and output path for a virtual sensor simulation visualisation.
- Parameters:
pv_plot (
pv.Plotter
) – Pyvistas plot object which will be used to create the animation.anim_opts (
VisOptsAnimation
) – Dataclass containing the options for creating the animation.
- Returns:
pv.Plotter
– Pyvista plotter with the given animation writer opened.