Result Scope
- class gpype.frontend.widgets.result_scope.ResultScope[source]
-
Generic result endpoint: a sink a frontend subscribes to.
Makes no assumption about the stream. Where TimeSeriesScope needs a sampling rate and a time axis, this takes whatever arrives – a classifier decision at 4 Hz, a sparse label, a feature vector – and shows the current value per channel. A non-Python frontend subscribes to the same stream and renders it however it likes: this node’s identity is its role in the pipeline, and the Qt readout is one per-residency implementation of that role, not the node itself.
One row per channel: the channel’s name, its current value, and – when
historyis positive – the values before it.An INode and a Widget rather than a Scope or an IONode: a readout draws no plot, and a sparse decision stream has no sampling rate, which
IONode.setupwould refuse.- DEFAULT_DECIMALS = 3
Digits drawn after the decimal point, when the author names none.
- DEFAULT_HISTORY = 0
Values kept per channel besides the current one. Zero means the readout shows the latest frame and nothing else.
- CAPTION = 'Result'
Caption when the author names the readout nothing.
- MIN_DECIMALS = 0
the readout formats with
f"{value:.{decimals}f}", and a negative precision raises ValueError from inside the format string on the GUI thread, where the number an author wrote appears nowhere.- Type:
Accepted range for
decimals. Bounded rather than trusted
- MAX_DECIMALS = 12
- MIN_HISTORY = 0
Accepted range for
history. The lower bound is whatdeque(maxlen=...)accepts – a negative maxlen raises. The upper bound is a display bound, not a memory one: past values are drawn as text on one line per channel.
- MAX_HISTORY = 1000
- __init__(name=None, refresh_rate=None, decimals=3, history=0, timing=None, edge_id=None, **kwargs)[source]
Initialize the result readout widget.
- Parameters:
name (
str) – Optional name for this node. Shown as the widget’s group box caption, and used to refer to the node from a document’s connections.refresh_rate (
float) – Repaints per second. Defaults to DEFAULT_REFRESH_RATE.decimals (
int) – Digits after the decimal point in the readout.history (
int) – Past values shown per channel besides the current one. Zero shows the latest frame only.timing (
str) – Timing to give the input port, from Constants.Timing. A result stream may be sparse, and a SYNC port cannot be connected to an ASYNC source (“Ports have incompatible timings”). None leaves the port default alone; ports supplied directly keep their own.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 classes.
- Raises:
RuntimeError – If no Qt application exists yet.
ValueError – If decimals or history is outside its range.
- setup(data, port_context_in)[source]
Read the stream’s shape, which is a channel count and nothing more.
No sampling rate is read, and that is the point of the class: a classifier decision, a sparse label or an end-of-run summary has no rate, and demanding one would make this scope unusable for exactly the streams it exists for.
- Parameters:
- Returns:
Updated port context for downstream components.
- Return type:
- Raises:
ValueError – If the input context declares no channel count.