Trigger Scope

class gpype.frontend.widgets.trigger_scope.TriggerScope(amplitude_limit=50, plots=None, hidden_channels=None, **kwargs)[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.

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

  • plots (list) – Mathematical expressions to evaluate and plot. Defaults to [PORT_IN] for direct signal display.

  • hidden_channels (list) – Channel indices to hide from display.

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

class Configuration(input_ports=None, **kwargs)[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.

Parameters:

input_ports (list)

class Keys[source]

Bases: Keys

Required configuration parameter keys.

AMPLITUDE_LIMIT = 'amplitude_limit'
PLOTS = 'plots'
class KeysOptional[source]

Bases: object

Optional configuration parameter keys.

HIDDEN_CHANNELS = 'hidden_channels'
__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