libtcspc.ArrayEventType¶
- class libtcspc.ArrayEventType(element_type, count)[source]¶
Bases:
EventTypeEvent holding a fixed-size array of elements of another event type.
The corresponding C++ event is
std::array<T, N>, whereTis the element type andNis the (compile-time) element count. Use this for events that group a fixed number of structured elements, such as a pair of detections (DetectionPairEvent), or for future N-fold correlation.- Parameters:
element_type (EventType) – The event type of the array elements. It must support value construction (see
EventType.value()).count (int) – The number of elements in the array. Must be at least 1.
Notes
A value of this type is constructed with the single field
elements, given as a sequence of exactlycountEventInstancevalues ofelement_type:ArrayEventType(DetectionEvent(nt), 2).value(elements=[start, stop])
When delivered to a Python sink (or read back),
elementsis a tuple ofEventInstancevalues ofelement_type. For convenience, anEventInstanceof this type also supportslen(...)and indexing (inst[i]), which return the elements directly.Whether values can be embedded in compiled code (and used with
Prepend/Append) and whether they are hashable follow from the element type: an array of scalar-only elements is embeddable and hashable; an array of bucket-carrying elements is neither.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
DetectionPairEventA specialization for a pair of detections.