Spectrum Scope

class gpype.frontend.widgets.spectrum_scope.SpectrumScope[source]

Bases: Scope

Frequency domain visualization widget for spectral analysis.

Displays real-time frequency spectrum of input signals with configurable amplitude limits and averaging.

DEFAULT_AMPLITUDE_LIMIT = 50.0

Default maximum amplitude for display scaling

DEFAULT_NUM_AVERAGES = 10

Default number of spectra to average for smoothing

CAPTION = 'Spectrum 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

class Keys[source]

Bases: Keys

AMPLITUDE_LIMIT = 'amplitude_limit'

Configuration key for maximum amplitude display limit

NUM_AVERAGES = 'num_averages'

Configuration key for number of averaging samples

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 list of channels to hide from display

__init__(amplitude_limit=None, num_averages=None, hidden_channels=None, refresh_rate=None, edge_id=None, **kwargs)[source]

Initialize the SpectrumScope widget.

Parameters:
  • amplitude_limit (float) – Maximum amplitude for display scaling. Defaults to 50.

  • num_averages (int) – Number of spectra to average. Defaults to 10.

  • hidden_channels (list) – List of channel indices to hide. Defaults to empty list.

  • 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 classes.

setup(data, port_context_in)[source]

Set up the spectrum scope with frequency vector and channels.

Parameters:
  • data (dict[str, ndarray]) – Initial data dictionary.

  • port_context_in (dict[str, dict]) – Input port context information.

Returns:

Output port context from parent setup.

Return type:

dict[str, dict]

Raises:

ValueError – If required parameters are missing or invalid.

step(data)[source]

Process incoming FFT data and update buffer for averaging.

Parameters:

data (dict[str, ndarray]) – Dictionary containing FFT amplitude data.

Returns:

Unchanged input data (pass-through).

Return type:

dict[str, ndarray]