pynaviz.audiovideo.video_plot#

Module for time-synchronized video plotting using pygfx and multiprocessing.

Classes

PlotBaseVideoTensor(data[, index, parent])

Abstract base class for time-synchronized video plots using pygfx.

PlotTsdTensor(data[, index, parent])

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

PlotVideo(video[, t, stream_index, index, ...])

Visualization for rendering video files synchronized with a time series.

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

Bases: _BasePlot, ABC

Abstract base class for time-synchronized video plots using pygfx.

Subclasses must implement the methods to provide video frames as 2D tensors.

Parameters:
  • data (Any)

  • index (int | None)

  • parent (Any | None)

group_by(metadata_name, spacing=None)[source]#

Placeholder for future metadata grouping method.

Parameters:
set_frame(target_time)[source]#

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

Parameters:

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

sort_by(metadata_name, mode='ascending')[source]#

Placeholder for future metadata sorting method.

Parameters:
  • metadata_name (str)

  • mode (str | None)

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

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.

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)

class pynaviz.audiovideo.video_plot.PlotVideo(video, t=None, stream_index=0, index=None, start_worker=True, parent=None)[source]#

Bases: PlotBaseVideoTensor

Visualization for rendering video files synchronized with a time series.

This class uses shared memory and multiprocessing to efficiently stream frames from disk to GPU via pygfx. It also supports real-time interaction and frame-based control.

Parameters:
animate()[source]#

Main render loop callback for pygfx.

Handles texture and text update, syncing, and redraw triggering.

close()[source]#

Cleanly close shared memory, worker, and background thread.

property data#

Read-only access to the video data handler.