Event Source
- class gpype.backend.sources.base.event_source.EventSource[source]
Bases:
SourceEvent-driven source for asynchronous data generation.
Generates events in response to external triggers.
- DERIVE_FRAME_SIZE = False
An event source emits one row when something happens, so a frame is not a slice of time here and there is nothing to derive a size from. See Source.DERIVE_FRAME_SIZE.
- __init__(**kwargs)[source]
Initialize event source with asynchronous output configuration.
- Parameters:
**kwargs – Additional arguments for parent Source class including channel_count, frame_size, and other configuration parameters.
- setup(data, port_context_in)[source]
Declare every output channel as a trigger.
An event source emits occurrences, not a measured signal. Saying so is what stops a filter from smearing the edges it depends on: without a role every channel counts as signal, and a keypress run through a bandpass comes out as a decaying oscillation that still looks like data.
- trigger(value, port_name='out')[source]
Trigger an event with the specified value.
The event is emitted immediately, on the calling thread. It is deliberately not delayed to line up with a buffered signal stream: the observation time is what carries the event’s timing, and a Sync node places it on the master timeline from that. A delay here would shift the event away from when it happened and destroy the very information the placement needs.
The instant is read here, on the calling thread, and travels with the value. Reading it in the Sync instead times whenever the framework got round to the event – which, in a distributed pipeline, is after it has crossed a Link.
- Parameters:
port_name – Name of the output port to trigger.
value – Event value to be transmitted. Converted to appropriate data type and formatted as single-sample array.