Time Series Scope
- class gpype.frontend.widgets.time_series_scope.TimeSeriesScope[source]
Bases:
ScopeReal-time oscilloscope widget for multi-channel time series.
Displays continuous time-series data from BCI pipelines with configurable time windows, amplitude scaling, channel hiding, and event markers.
- DEFAULT_TIME_WINDOW = 10
Default display window duration in seconds
- DEFAULT_AMPLITUDE_LIMIT = 50.0
Default amplitude scale limit in microvolts
- DEFAULT_REFRESH_RATE = 20.0
Repaints per second when the author does not choose one.
This display’s own, deliberately higher than Widget.DEFAULT_REFRESH_RATE. A sweep moves continuously, so its frame rate is what the motion looks like; the other widgets only redraw when something arrives and 10 Hz is enough for them.
20 rather than 30 for two measured reasons. The interval is int(round(1000/rate)) ms, so 20 Hz is exactly 50 ms while 30 Hz is 33 ms and delivers 30.3. And the redraw is not the whole cost: _update() itself is 0.415 ms at 8 channels, but a full frame including Qt’s rasterisation costs 8.85 ms at 8 channels, 20.0 ms at 32 and 32.8 ms at 64 – so at 64 channels a 30 Hz frame would not fit inside its own interval. 20 Hz costs roughly 17% of one core at 8 channels and 63% at 64.
- CAPTION = 'Time Series 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
- MIN_TIME_WINDOW = 1
Accepted range for
time_window, in seconds, exclusive at both ends. The docstring said “(1-120)” for a long time while the code accepted 1 < x < 240, which is why the numbers live here now and the prose does not restate them.
- MAX_TIME_WINDOW = 240
- AMPLITUDE_STEP = 5
Amplitude scale change per button press, in microvolts. An int, so that an authored int limit stays an int and the axis label does not gain a “.0” the moment the viewer touches it.
- TIME_WINDOW_STEP = 5
Time-window change per button press, in seconds.
- class Markers
Bases:
dictMarker styling helper, reachable as gp.TimeSeriesScope.Markers.
- __init__(color, label, channel, value)
Initialize marker configuration with display properties.
- class Configuration[source]
Bases:
ConfigurationConfiguration keys for TimeSeriesScope widget settings.
Extends the base Scope configuration with time series specific parameters for display window, amplitude scaling, event markers, and channel visibility management.
- class Keys[source]
Bases:
KeysRequired configuration parameter keys.
- TIME_WINDOW = 'time_window'
Configuration key for display duration in seconds
- AMPLITUDE_LIMIT = 'amplitude_limit'
Configuration key for Y-axis scale in microvolts
- class EmptyableKeys[source]
Bases:
objectOptional 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 makesmarkers=[]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”.
- MARKERS = 'markers'
Configuration key for event marker configurations
- HIDDEN_CHANNELS = 'hidden_channels'
Configuration key for channels to hide from display
- __init__(time_window=None, amplitude_limit=None, markers=None, hidden_channels=None, refresh_rate=None, show_amplitude_control=True, show_time_window_control=True, name=None, edge_id=None, **kwargs)[source]
Initialize the time series oscilloscope widget.
- Parameters:
time_window (
int) – Display window duration in seconds; longer than 1 and shorter than 240. Uses DEFAULT_TIME_WINDOW if None.amplitude_limit (
float) – Y-axis scale limit in microvolts (1-5000). Uses DEFAULT_AMPLITUDE_LIMIT if None.markers (
list) – List of marker configurations for event visualization. Empty list if None.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.show_amplitude_control (
bool) – Whether the display offers the viewer buttons for the amplitude scale. What they change is the display; the configured value is what a document round-trips.show_time_window_control (
bool) – Whether the display offers the viewer buttons for the time window. Changing it re-cuts the sweep buffer, so the sweep restarts.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.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 time_window is not longer than 1 second and shorter than 240.
ValueError – If amplitude_limit is outside reasonable range.
- setup(data, port_context_in)[source]
Initialize the widget with data stream parameters and buffers.
- Parameters:
- Returns:
Updated port context for downstream components.
- Return type:
- Raises:
ValueError – If required context parameters are missing.