pynaviz.audiovideo.video_plot.PlotTsdTensor#

class pynaviz.audiovideo.video_plot.PlotTsdTensor(data, index=None, parent=None)[source]#

Bases: PlotBaseVideoTensor

Visualization for 3-dimensional time series (nap.TsdTensor) displayed as movies.

Parameters:

data (TsdTensor)

__init__(data, index=None, parent=None)[source]#

Initialize the base video tensor plot.

Parameters:
  • data (Any) – The data source, such as a TsdTensor or a video handler.

  • index (int, optional) – Identifier for the controller.

  • parent (Any, optional) – Parent widget or container.

Methods

__init__(data[, index, parent])

Initialize the base video tensor plot.

add_interval_sets(epochs[, colors, alpha, ...])

animate()

Updates the positions of rulers and reference lines based on the current world coordinate bounds and triggers a re-render of the scene.

close()

color_by(metadata_name[, cmap_name, vmin, vmax])

Applies color mapping to plot elements based on a metadata field.

group_by(metadata_name[, spacing])

Placeholder for future metadata grouping method.

remove_interval_set(label)

Remove an interval set from the plot.

set_frame(target_time)

Set the video display to the frame closest to the target time.

show()

To show the canvas in case of GLFW context used

sort_by(metadata_name[, mode])

Placeholder for future metadata sorting method.

superpose_points(tsdframe[, color, ...])

Superpose a set of points on top of the video plot.

update_interval_set(name, colors, alpha)

Update the color and transparency of an existing interval set.

Attributes

add_interval_sets(epochs, colors=None, alpha=None, labels=None)#
Parameters:
animate()#

Updates the positions of rulers and reference lines based on the current world coordinate bounds and triggers a re-render of the scene.

This method performs the following: - Computes the visible world coordinate bounds. - Updates the horizontal (x) and vertical (y) rulers accordingly. - Repositions the center time reference line in the scene. - Re-renders the scene using the current camera and canvas settings.

Notes

This method should be called whenever the visible region of the plot changes (e.g., after zooming, panning, or resizing the canvas).

close()#
property cmap#
color_by(metadata_name, cmap_name='viridis', vmin=0.0, vmax=100.0)#

Applies color mapping to plot elements based on a metadata field.

This method retrieves values from the given metadata field and maps them to colors using the specified colormap and value range. The mapped colors are applied to each plot element’s material. If color mappings are still being computed in a background thread, the function retries after a short delay.

Parameters:
  • metadata_name (str) – Name of the metadata field used for color mapping.

  • cmap_name (str, default "viridis") – Name of the colormap to apply (e.g., “jet”, “plasma”, “viridis”).

  • vmin (float, default 0.0) – Minimum value for the colormap normalization.

  • vmax (float, default 100.0) – Maximum value for the colormap normalization.

Return type:

None

Notes

  • If the color_mapping_thread is still running, the method defers execution by 25 milliseconds and retries automatically.

  • If no appropriate color map is found for the metadata, a warning is issued.

  • Requires self.data to support get_info() for metadata retrieval.

  • Triggers a canvas redraw by calling self.animate() after updating colors.

Warning

UserWarning

Raised when the specified metadata field has no associated color mapping.

property data#
group_by(metadata_name, spacing=None)#

Placeholder for future metadata grouping method.

Parameters:
remove_interval_set(label)#

Remove an interval set from the plot.

Parameters:

label (str) – The label of the interval set to be removed.

Return type:

None

set_frame(target_time)#

Set the video display to the frame closest to the target time.

Parameters:

target_time (float) – Time in seconds to seek to.

show()#

To show the canvas in case of GLFW context used

sort_by(metadata_name, mode='ascending')#

Placeholder for future metadata sorting method.

Parameters:
  • metadata_name (str)

  • mode (str | None)

superpose_points(tsdframe, color=None, markersize=10, thickness=2, label=None)#

Superpose a set of points on top of the video plot. Argument tsdframe should be a nap.Tsdframe with multiple of 2 columns (x1, y1, x2, y2, …). The label of the columns doesn’t matter.

Parameters:
  • tsdframe (nap.TsdFrame) – Time series data to overlay.

  • color (str or rgba tuple, optional) – Color of the set of points.

  • markersize (float, default 10) – Size of the set of points.

  • thickness (float, default 2) – Thickness of the lines connecting the points.

  • label (str, optional) – Label for the set of points. If None, a default label is assigned.

update_interval_set(name, colors, alpha)#

Update the color and transparency of an existing interval set.

Parameters:
  • name (str) – The label of the interval set to be updated.

  • colors (str | Color) – The new color of the interval set.

  • alpha (float) – The new transparency level, between 0 and 1.

Return type:

None