Trigger Scope

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

Bases: Scope

Event-triggered oscilloscope widget for analyzing signal epochs.

Displays the epochs cut by an upstream Trigger as their average: every epoch received since the pipeline started, not each epoch on its own. One input port per free variable of the plot expressions, each bridged on its own stream where the pipeline is distributed.

DEFAULT_AMPLITUDE_LIMIT = 50.0

Default Y-axis scale limit in microvolts.

INPUT_PORTS_FROM = 'plots'

One input per plot expression, so the names come from plots.

CAPTION = 'Trigger Scope'

Caption when the author names the scope nothing.

MIN_AMPLITUDE_LIMIT = 1.0

Accepted range for amplitude_limit, in microvolts. Named so that a form can offer a slider with the right bounds.

MAX_AMPLITUDE_LIMIT = 5000.0
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 EmptyableKeys[source]

Bases: object

Optional keys that may also be empty.

Deliberately not OptionalKeys. That name means one specific thing to ioiocore – may be absent, but must not be empty when present (Configuration.__init__) – and an empty list is a legitimate value for every key declared here: no markers, no hidden channels. Declaring them under the name the validator reads makes markers=[] raise.

Measured, so that nobody has to rediscover it:

OptionalKeys   markers=[]  -> ValueError, must not be empty
EmptyableKeys  markers=[]  -> accepted

The name is still the declaration a reader and a catalog generator look for; it is only kept out of the validator’s emptiness rule. The underlying gap is ioiocore’s: there is no way to say “optional, and empty is fine”.

HIDDEN_CHANNELS = 'hidden_channels'

Configuration key for channels to hide from display

__init__(amplitude_limit=50.0, plots=None, hidden_channels=None, refresh_rate=None, edge_id=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.

  • refresh_rate (float) – Repaints per second. Defaults to DEFAULT_REFRESH_RATE.

  • edge_id (Optional[str]) – Which edge runs this node, matched against the edge process’s –edge-id. None, the default, is every edge; ignored when the pipeline is not distributed.

  • **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[str, 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[str, ndarray]