Generator
- class gpype.backend.sources.generator.Generator[source]
Bases:
FixedRateSourceSignal generator for creating synthetic test signals.
Generates configurable test signals with optional noise for testing pipelines. Supports multiple waveforms (sine, rectangular, pulse) with multi-channel output; every channel carries the same signal.
- SHAPE_SINUSOID = 'sine'
Sinusoidal waveform signal shape
- SHAPE_RECTANGULAR = 'rect'
Square wave signal shape
- SHAPE_PULSE = 'pulse'
Brief pulses signal shape
- SIGNAL_SHAPES = ('sine', 'rect', 'pulse')
Every shape this node can produce. Named, and named with the parameter it constrains, because the set had no representation at all before: the shapes existed as three separate constants and the only thing that knew which were valid was an if/elif chain in step(). A form offering a dropdown, or a generated catalog, has nowhere else to read this from.
- DEFAULT_SAMPLING_RATE = 250.0
Default sampling rate in Hz
- DEFAULT_CHANNEL_COUNT = 8
Default number of channels
- DEFAULT_SIGNAL_FREQUENCY = 10.0
Default signal frequency in Hz
- DEFAULT_SIGNAL_SHAPE = 'sine'
Default signal shape
- DEFAULT_SIGNAL_AMPLITUDE = 0.0
Default signal amplitude
- DEFAULT_NOISE_AMPLITUDE = 0.0
Default noise amplitude
- class Configuration[source]
Bases:
ConfigurationConfiguration class for Generator signal parameters.
- class Keys[source]
Bases:
KeysConfiguration key constants for the Generator.
- SIGNAL_FREQUENCY = 'signal_frequency'
Signal frequency configuration key
- SIGNAL_SHAPE = 'signal_shape'
Signal shape configuration key
- SIGNAL_AMPLITUDE = 'signal_amplitude'
Signal amplitude configuration key
- NOISE_AMPLITUDE = 'noise_amplitude'
Noise amplitude configuration key
- __init__(sampling_rate=None, channel_count=None, frame_size=None, signal_frequency=None, signal_shape=None, signal_amplitude=0.0, noise_amplitude=0.0, edge_id=None, **kwargs)[source]
Initialize the signal generator.
- Parameters:
sampling_rate (
float) – Sampling frequency in Hz.channel_count (
int) – Number of output channels. All get same signals.frame_size (
int) – Samples per output frame.signal_frequency (
float) – Signal frequency in Hz. Defaults to 10.0.signal_shape (
str) – Waveform shape (sine, rect, pulse). Defaults to sine.signal_amplitude (
float) – Peak amplitude of signal component.noise_amplitude (
float) – Standard deviation of Gaussian noise.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 parameters for FixedRateSource.
- Raises:
ValueError – If signal_frequency or noise_amplitude is negative, or signal_shape is unsupported.
- NUM_TIMELINE_CHANNELS = 1
One channel beyond the configured count, carrying the instant each frame was produced.
A generator numbers nothing, so Sync numbers it by counting arrivals – and under distributed residency that Sync runs in the server process, counting arrivals off a socket. Pairing those positions with a locally read clock fits the master timeline to the transport rather than to the signal. The stamp is what makes the two residencies the same measurement.