visualtools

This module contains utility functions used for creating pyvale visualisations.

pyvale.visualtools.create_pv_plotter(vis_opts: VisOptsSimSensors) Plotter[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.

pyvale.visualtools.get_colour_lims(component_data: ndarray, colour_bar_lims: tuple[float, float] | None) tuple[float, float][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 calculations

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

pyvale.visualtools.save_pv_image(pv_plot: Plotter, image_save_opts: VisOptsImageSave) None[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.

pyvale.visualtools.set_animation_writer(pv_plot: Plotter, anim_opts: VisOptsAnimation) Plotter[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.