visualsimsensors¶
This module contains functions for visualising virtual sensors on a simulation mesh with simulated fields using pyvista.
- pyvale.visualsimsensors.add_sensor_points_nom(pv_plot: Plotter, sensor_array: SensorArrayPoint, vis_opts: VisOptsSimSensors) Plotter [source]¶
Adds points and tagged labels showing the virtual sensor locations on the simulation mesh in the given pyvista plot object.
- Parameters:
pv_plot (pv.Plotter) -- Pyvista plotter used to display the virtual sensor locations.
sensor_array (SensorArrayPoint) -- Sensor array for which the virtual sensor location will be shown.
vis_opts (VisOptsSimSensors) -- Dataclass containing options for controlling the appearance of the virtual sensors.
- Returns:
pv.Plotter -- Pyvista plotter which has had the virtual sensor locations added.
- pyvale.visualsimsensors.add_sensor_points_pert(pv_plot: Plotter, sensor_array: SensorArrayPoint, vis_opts: VisOptsSimSensors) Plotter [source]¶
Adds points showing the perturbed virtual sensor locations on the simulation mesh in the given pyvista plot object. Note that this will only work if field errors are added perturbing the sensor locations.
- Parameters:
pv_plot (pv.Plotter) -- Pyvista plotter used to display the virtual sensor locations.
sensor_array (SensorArrayPoint) -- Sensor array for which the virtual sensor location will be shown.
vis_opts (VisOptsSimSensors) -- Dataclass containing options for controlling the appearance of the virtual sensors.
- Returns:
pv.Plotter -- Pyvista plotter which has had the virtual sensor locations added.
- pyvale.visualsimsensors.add_sim_field(pv_plot: Plotter, sensor_array: SensorArrayPoint, component: str, time_step: int, vis_opts: VisOptsSimSensors) tuple[Plotter, UnstructuredGrid] [source]¶
Adds a simulation field to a pyvista plot object which is visualised on the mesh using a colormap.
- Parameters:
pv_plot (pv.Plotter) -- Handle to the pyvista plot object to add the simulation field to.
sensor_array (SensorArrayPoint) -- Sensor array associated with the field to be plotted.
component (str) -- String key for the field component to be shown.
time_step (int) -- Time step to plot based on the time steps in the underlying simulation data object.
vis_opts (VisOptsSimSensors) -- Dataclass containing options for controlling the appearance of the virtual sensors.
- Returns:
tuple[pv.Plotter,pv.UnstructuredGrid] -- Tuple containing a handle to the pyvista plotter which has had the field visualisation added and the pyvistas unstructured grid that was used to plot the field.
- pyvale.visualsimsensors.plot_point_sensors_on_sim(sensor_array: SensorArrayPoint, component: str, time_step: int = -1, vis_opts: VisOptsSimSensors | None = None, image_save_opts: VisOptsImageSave | None = None) Plotter [source]¶
Creates a visualisation of the virtual sensor locations on the simulation mesh showing the underlying field the sensors are sampling at the specified time step.
- Parameters:
sensor_array (SensorArrayPoint) -- Sensor array containing the sensors to plot and the field to display.
component (str) -- String key for accessing the nodal field to visualise in the sim data object.
time_step (int, optional) -- Simulation time step number to plot, by default -1 (the last time step).
vis_opts (VisOptsSimSensors | None, optional) -- Dataclass containing options for controlling the appearance of the virtual sensors, by default None. If None then a default options dataclass is created.
image_save_opts (VisOptsImageSave | None, optional) -- Dataclass containing options for saving image of the virtual sensor visualisation, by default None. If None a default options dataclass is created.
- Returns:
pv.Plotter -- Handle to the pyvista plotter showing the sensor locations.
- pyvale.visualsimsensors.plot_sim_data(sim_data: SimData, component: str, elem_dims: int, time_step: int = -1, vis_opts: VisOptsSimSensors | None = None) Plotter [source]¶
Plots the simulation mesh showing the specified phyiscal field at the time step specified.
- Parameters:
sim_data (mh.SimData) -- simulation data object containing the mesh and field data to show.
component (str) -- String key for accessing the nodal field to visualise in the sim data object.
elem_dims (int) -- Number of dimensions for the elements to be plotted.
time_step (int, optional) -- Simulation time step number to plot, by default -1 (the last time step).
vis_opts (VisOptsSimSensors | None, optional) -- Dataclass containing options for controlling the appearance of the virtual sensors, by default None. If None then a default options dataclass is created.
- Returns:
pv.Plotter -- Handle to the pyvista plotter showing the simulation mesh and field.
- pyvale.visualsimsensors.plot_sim_mesh(sim_data: SimData, elem_dims: int, vis_opts: VisOptsSimSensors | None = None) Plotter [source]¶
Plots the simulation mesh without any fields. Useful for visualising mesh geometry.
- Parameters:
sim_data (mh.SimData) -- Sim data object containing the mesh to plot.
elem_dims (int) -- Number of dimensions for the elements to be plotted.
vis_opts (VisOptsSimSensors | None, optional) -- Dataclass containing options for controlling the appearance of the virtual sensors, by default None. If None then a default options dataclass is created.
- Returns:
pv.Plotter -- Handle to the pyvista plotter that is showing the mesh.