Scope

class gpype.frontend.widgets.base.scope.Scope[source]

Bases: INode, Widget

Base class for oscilloscope-style visualization widgets.

Combines INode data processing with Widget visualization for real-time plotting of BCI signals. Uses PyQtGraph for high-performance plotting with configurable appearance and multiple curve support. Note that subclasses must implement the _update() method.

Public as gp.Scope: subclass it for a plot of your own, and the pipeline builds the chain a widget needs.

class Configuration[source]

Bases: Configuration

Configuration class for Scope parameters.

class Keys[source]

Bases: Keys

Configuration key constants for the Scope.

LINE_COLOR = 'line_color'

Configuration key for plot line color

AXIS_COLOR = 'axis_color'

Configuration key for plot axis/background color

DEFAULT_HEADLESS_LINE_COLOR = (200, 200, 200)

Colours a headless scope records when the author named none.

Normally taken from the running Qt palette. A SERVER has none, and a scope constructed there is describing a display on another process – which, if it was authored on an edge, carries the real pair in the document anyway. Mid grey on near-black: legible if it is ever actually drawn, and obviously a default if it is not.

DEFAULT_HEADLESS_AXIS_COLOR = (30, 30, 30)
CAPTION = 'Scope'

Group box caption when the author names the scope nothing.

__init__(input_ports=None, line_color=None, axis_color=None, name=None, refresh_rate=None, **kwargs)[source]

Initialize the Scope widget with plot setup and color configuration.

Parameters:
  • input_ports (list[Configuration]) – Input port configurations for pipeline connections.

  • line_color (tuple[int, int, int]) – RGB values for plot line color. Uses system text color if None.

  • axis_color (tuple[int, int, int]) – RGB values for plot background color. Uses system window color if None.

  • name (str) – The node’s name, and the group box caption. With none the node takes its class name and the box says CAPTION.

  • refresh_rate (float) – Repaints per second.

  • **kwargs – Additional configuration passed to parent classes.

set_labels(x_label, y_label)[source]

Set axis labels for the plot.

Parameters:
  • x_label (str) – Label text for the x-axis (horizontal).

  • y_label (str) – Label text for the y-axis (vertical).

add_curve(pen=None)[source]

Add a new plot curve for displaying data.

Parameters:

pen – PyQtGraph pen object for curve styling. Uses default pen if None.

Returns:

The newly created curve item for data updates.

Return type:

pg.PlotCurveItem

setup(data, port_context_in)[source]

Set up the scope widget and make the plot visible.

Parameters:
  • data (dict) – Initial data dictionary for setup.

  • port_context_in (dict) – Input port context information.

Returns:

Output port context from parent setup.

Return type:

dict