libtcspc.Prepend

final class libtcspc.Prepend(event, *, event_type=None)[source]

Bases: Node

Pass-through processor that inserts an event at the start of the stream.

All events are passed through unchanged. Before the first event is passed through, the given event is emitted once.

Parameters:
  • event (EventInstance or Param[EventInstance]) – The event value to emit before the first passed-through event. A concrete EventInstance (construct it via EventType.value(), for example DetectionEvent().value(abstime=0, channel=0)) is baked into the generated code. A Param binds the event value at execution time; event_type must then be given.

  • event_type (EventType or None, keyword-only) – The type of the inserted event. Required if and only if event is a Param. For a concrete EventInstance it is inferred and, if given, must equal the event’s type.

Notes

Events handled:

  • All event types: pass through. Before the first one, event is emitted.

  • End of input: pass through.

When event is a Param, scalar, raw-bytes, bucket, and array event types are all supported.

See also

tcspc::prepend()

The underlying C++ factory function.

Append

Insert an event at the end of the stream instead.