Trigger Scope

class gpype.frontend.widgets.trigger_scope.TriggerScope[source]

Bases: Scope

Event-triggered oscilloscope widget for analyzing signal epochs.

Displays triggered signal epochs based on events detected by upstream trigger nodes. Visualizes fixed-duration signal segments around trigger events, ideal for analyzing ERPs and event-locked brain activity. Supports mathematical expressions and multi-plot overlay with legends.

class Configuration[source]

Bases: Configuration

Configuration keys for TriggerScope widget settings.

Extends the base Scope configuration with trigger-specific parameters for amplitude scaling and mathematical plot expressions.

class Keys[source]

Bases: Keys

Required configuration parameter keys.

AMPLITUDE_LIMIT = 'amplitude_limit'

Configuration key for Y-axis scale limit

PLOTS = 'plots'

Configuration key for mathematical expression list

class KeysOptional[source]

Bases: object

Optional configuration parameter keys.

HIDDEN_CHANNELS = 'hidden_channels'

Configuration key for channels to hide from display

__init__(amplitude_limit=50, plots=None, hidden_channels=None, **kwargs)[source]

Initialize the trigger scope widget.

Sets up mathematical expression parsing, input port configuration, and display parameters for event-triggered signal visualization.

Parameters:
  • amplitude_limit (float) – Y-axis scale limit in microvolts (1-5000).

  • plots (list) – List of mathematical expressions to evaluate and plot. Empty list defaults to [PORT_IN] for direct signal display.

  • 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 amplitude_limit is outside reasonable range.

setup(data, port_context_in)[source]

Initialize the widget with trigger parameters and allocate buffers.

Sets up the trigger scope based on upstream trigger node configuration including timing, sampling parameters, and channel configuration.

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 trigger timing and signal parameters.

Returns:

Updated port context for downstream components.

Return type:

dict

Raises:

ValueError – If required context parameters are missing or inconsistent across ports.

step(data)[source]

Process incoming trigger epoch data and store for visualization.

Called by the pipeline for each new trigger epoch. Accumulates trigger epochs in buffers for averaging and mathematical expression evaluation.

Parameters:

data (dict[str, ndarray]) – Dictionary containing trigger epoch arrays from connected ports. Each array has shape (frame_size, channels) representing the pre/post trigger signal segment.

Returns:

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

Return type:

dict