treble_tsdk.results.plot

Results plotting and visualization utilities.

Provides functions for creating interactive plots of acoustic parameters, directivity patterns, and other simulation results.

Functions

create_2d_directivity_figure(index, angles, ...)

Create a 2D polar plot of directivity pattern at a specific frequency.

create_3d_directivity_figure(index, ...)

Create a 3D mesh plot of directivity pattern at a specific frequency.

get_directivity_layout(frequency, name)

Create layout components for directivity visualization widget.

get_latest_button(timestamps)

Get the button ID with the most recent timestamp.

multiresults_parameter_plot_widget(results)

A widget which can plot acoustic parameters for multiple sources and receivers at a time

plot_device(device)

A widget to plot device information.

plot_directive_source(directivity_data, name)

Plot directivity pattern of a directive source.

plot_mono_ir(impulse_response[, comparison, ...])

Plot a mono impulse response with interactive visualization.

plot_multichannel_data(device[, comparison, ...])

Plot multi-channel impulse response data with interactive visualization.

plot_resolution_of_ambisonics_orders()

Plots the resolution of ambisonics orders

plot_spatial_ir(impulse_response[, ...])

Plot a spatial (ambisonics) impulse response with interactive visualization.

result_plot_widget(results)

A widget where results of a simulation can be plotted in an interactive widget with loading feedback for data streaming

results_parameters_plot_widget(parameter_data)

Create an interactive widget for plotting acoustic parameters.

spherical_mesh(input_points)

Creates a spherical mesh from a set of points

Classes

DirectivityPatternForPlotting

Data container for directivity pattern visualization.

treble_tsdk.results.plot.multiresults_parameter_plot_widget(results: Results)

A widget which can plot acoustic parameters for multiple sources and receivers at a time

Parameters:

results (Results) – Results object with the relevant information

treble_tsdk.results.plot.results_parameters_plot_widget(parameter_data: AcousticParameters)

Create an interactive widget for plotting acoustic parameters.

Parameters:

parameter_data (AcousticParameters) – Acoustic parameters data to visualize.

treble_tsdk.results.plot.plot_multichannel_data(device: DeviceIR | AudioSignal, comparison: dict[str, 'DeviceIR | AudioSignal'] = None, title: str = 'Device Impulse Response', channel_label: str = 'Device mic ', label: str = None)

Plot multi-channel impulse response data with interactive visualization.

Parameters:
  • device (DeviceIR | AudioSignal) – Device impulse response or audio signal to plot.

  • comparison (dict[str, DeviceIR | AudioSignal]) – Optional comparison data with labels.

  • title (str) – Plot title, defaults to “Device Impulse Response”.

  • channel_label (str) – Label prefix for channels, defaults to “Device mic “.

  • label (str) – Optional label for the device data.

treble_tsdk.results.plot.plot_spatial_ir(impulse_response: SpatialIR, channel_range: tuple[int, int] = (0, 8))

Plot a spatial (ambisonics) impulse response with interactive visualization.

Parameters:
  • impulse_response (SpatialIR) – Spatial impulse response to plot.

  • channel_range (tuple[int, int]) – Range of channels to display, defaults to (0, 8).

treble_tsdk.results.plot.plot_mono_ir(impulse_response: MonoIR, comparison: dict[str, 'MonoIR'] = None, label=None)

Plot a mono impulse response with interactive visualization.

Parameters:
  • impulse_response (MonoIR) – Mono impulse response to plot.

  • comparison (dict[str, MonoIR]) – Optional comparison impulse responses with labels.

  • label (str) – Optional label for the impulse response.

treble_tsdk.results.plot.create_2d_directivity_figure(index: int, angles: ndarray, sel_indices: ndarray, directivity_data: DirectivityPatternForPlotting) Figure

Create a 2D polar plot of directivity pattern at a specific frequency.

Parameters:
  • index (int) – Frequency index to plot.

  • angles (np.ndarray) – Angular positions for the plot.

  • sel_indices (np.ndarray) – Selected indices for the directivity data.

  • directivity_data (DirectivityPatternForPlotting) – Directivity pattern data.

Returns go.Figure:

Plotly figure with 2D polar directivity plot.

treble_tsdk.results.plot.create_3d_directivity_figure(index: int, pattern_name: str, directivity_data: DirectivityPatternForPlotting) Figure

Create a 3D mesh plot of directivity pattern at a specific frequency.

Parameters:
  • index (int) – Frequency index to plot.

  • pattern_name (str) – Pattern type (‘exact-pattern’ or ‘wavebased-pattern’).

  • directivity_data (DirectivityPatternForPlotting) – Directivity pattern data.

Returns go.Figure:

Plotly figure with 3D mesh directivity plot.

treble_tsdk.results.plot.get_directivity_layout(frequency, name)

Create layout components for directivity visualization widget.

Parameters:
  • frequency – Array of frequencies for the slider.

  • name – Name of the source for display.

Returns:

List of Dash layout components.

treble_tsdk.results.plot.plot_resolution_of_ambisonics_orders()

Plots the resolution of ambisonics orders

treble_tsdk.results.plot.plot_directive_source(directivity_data: DirectivityPatternForPlotting, name: str)

Plot directivity pattern of a directive source.

Parameters:
treble_tsdk.results.plot.plot_device(device: DeviceObj)

A widget to plot device information.

Here we will be able to plot 1. Transfer functions for any angle 2. Spherical harmonics graph 3. Polar directivity pattern for microphones 4. Directivity balloons of microphones

Parameters:

device (DeviceObj) – The device in question

treble_tsdk.results.plot.get_latest_button(timestamps: dict[str, int])

Get the button ID with the most recent timestamp.

Parameters:

timestamps (dict[str, int]) – Dictionary mapping button IDs to timestamps.

Returns str:

Button ID with the latest timestamp.

treble_tsdk.results.plot.spherical_mesh(input_points: ndarray) pyvista.PolyData

Creates a spherical mesh from a set of points

Parameters:

input_points (np.ndarray) – The points to create the mesh from

Return pv.PolyData:

The mesh

class treble_tsdk.results.plot.DirectivityPatternForPlotting

Data container for directivity pattern visualization.

Holds frequency-dependent directivity data and surface mesh information for plotting.

frequencies: ndarray
surface_points: ndarray
surface_faces: ndarray
exact_pattern_data: ndarray | None = None
wavebased_pattern_data: ndarray | None = None
geometry_verts: ndarray | None = None
geometry_faces: ndarray | None = None
__init__(frequencies: ndarray, surface_points: ndarray, surface_faces: ndarray, exact_pattern_data: ndarray | None = None, wavebased_pattern_data: ndarray | None = None, geometry_verts: ndarray | None = None, geometry_faces: ndarray | None = None) None
treble_tsdk.results.plot.result_plot_widget(results: Results)

A widget where results of a simulation can be plotted in an interactive widget with loading feedback for data streaming