libtcspc.EventInstance

class libtcspc.EventInstance(event_type, fields)[source]

Bases: object

A concrete event value: an EventType plus its field values.

Unlike an EventType (which is only a type tag), an EventInstance represents an actual event value with concrete field contents. Construct one via EventType.value(), for example DetectionEvent(nt).value(abstime=42, channel=1).

Used as the event inserted by Prepend/Append, as input to ExecutionContext.handle, and as the value delivered to a PySink. Field values are concrete ints, floats, strings, or (for bucket fields) read-only NumPy arrays; read them as attributes (for example, event.abstime). Prepend/Append can also insert an event value bound at run time via a Param.

Instances of bucket-carrying event types (such as HistogramEvent) are not hashable.

Constructing and inspecting individual event values from Python is intended for debugging and learning only and is extremely slow; production graphs process events in compiled C++ and exchange bulk data via buckets.

See also

EventType.value()

The factory used to construct an EventInstance.

Parameters: