Time Series Scope

class gpype.frontend.widgets.time_series_scope.TimeSeriesScope[source]

Bases: Scope

Real-time oscilloscope widget for multi-channel time series.

Displays continuous time-series data from BCI pipelines with configurable time windows, amplitude scaling, channel hiding, and event markers.

DEFAULT_TIME_WINDOW = 10

Default display window duration in seconds

DEFAULT_AMPLITUDE_LIMIT = 50

Default amplitude scale limit in microvolts

class Markers[source]

Bases: dict

Container for event marker configuration.

Stores marker properties including color, label, channel association, and trigger value for event-based visualization.

Parameters:
  • color (str) – Hex color code or color name for marker visualization.

  • label (str) – Text label for marker identification.

  • channel (int) – Channel index where marker should be displayed.

  • value (int) – Trigger value that activates the marker.

__init__(color, label, channel, value)[source]

Initialize marker configuration with display properties.

class Configuration[source]

Bases: Configuration

Configuration keys for TimeSeriesScope widget settings.

Extends the base Scope configuration with time series specific parameters for display window, amplitude scaling, event markers, and channel visibility management.

class Keys[source]

Bases: Keys

Required configuration parameter keys.

TIME_WINDOW = 'time_window'

Configuration key for display duration in seconds

AMPLITUDE_LIMIT = 'amplitude_limit'

Configuration key for Y-axis scale in microvolts

class KeysOptional[source]

Bases: object

Optional configuration parameter keys.

MARKERS = 'markers'

Configuration key for event marker configurations

HIDDEN_CHANNELS = 'hidden_channels'

Configuration key for channels to hide from display

class KeyPressFilter[source]

Bases: QObject

Event filter for keyboard shortcuts in the time series scope.

Captures keyboard events to provide interactive functionality. Currently handles Alt+R for performance monitoring toggle.

Parameters:

callback – Function to call when target key combination is pressed.

__init__(callback)[source]

Initialize key press filter with callback function.

eventFilter(obj, event)[source]

Filter keyboard events and trigger callbacks for shortcuts.

Parameters:
  • obj – Qt object that received the event.

  • event – Qt event to process.

Returns:

False to allow event propagation, True to consume event.

Return type:

bool

__init__(time_window=None, amplitude_limit=None, markers=None, hidden_channels=None, name=None, **kwargs)[source]

Initialize the time series oscilloscope widget.

Parameters:
  • time_window (int) – Display window duration in seconds (1-120). Uses DEFAULT_TIME_WINDOW if None.

  • amplitude_limit (float) – Y-axis scale limit in microvolts (1-5000). Uses DEFAULT_AMPLITUDE_LIMIT if None.

  • markers (list) – List of marker configurations for event visualization. Empty list if None.

  • hidden_channels (list) – List of channel indices to hide from display. Empty list if None.

  • **kwargs – Additional arguments passed to parent Scope class.

Raises:
  • ValueError – If time_window is outside valid range (1-120).

  • ValueError – If amplitude_limit is outside reasonable range.

setup(data, port_context_in)[source]

Initialize the widget with data stream parameters and buffers.

Parameters:
  • data (dict[str, ndarray]) – Input data dictionary (not used in setup phase).

  • port_context_in (dict[str, dict]) – Context information for input ports containing sampling rate, channel count, and frame size.

Returns:

Updated port context for downstream components.

Return type:

dict

Raises:

ValueError – If required context parameters are missing.

step(data)[source]

Process incoming data frames and store them in the circular buffer.

Called by the pipeline for each new data frame. Handles performance monitoring, circular buffer management, and thread-safe data storage.

Parameters:

data (dict[str, ndarray]) – Dictionary containing input data arrays from connected ports. Expected to have PORT_IN key with shape (frame_size, channels).

Returns:

Empty dictionary (this is a sink node with no outputs).

Return type:

dict