libtcspc.Acquire¶
- final class libtcspc.Acquire(event_type, reader, buffer_provider, batch_size, access_tag)[source]¶
Bases:
NodeSource processor that acquires data into buckets via a pull-style reader.
Used to plug a hardware acquisition driver — or any pull-based data source — into a libtcspc processing graph. On each iteration the processor obtains an empty bucket from the buffer provider, calls the reader to fill it, and emits the (possibly partially filled) bucket as a
BucketEventdownstream.The acquisition runs until the reader signals end of stream (by returning
None), the reader raises an exception, or the acquisition is halted via theAcquireAccessretrieved from theExecutionContextusingaccess_tag. Halting is asynchronous: thehalt()call returns immediately, but the acquisition may continue briefly. Wait for graph execution to finish before tearing down resources used by the reader.- Parameters:
event_type (EventType) – Element type of the acquired data (typically a byte or integer type). Each emitted bucket holds a contiguous array of this type.
reader (AcquisitionReader or Param[PyAcquisitionReader]) – Object that fills supplied buffers with acquired data on each call. Pass an
AcquisitionReaderinstance (such asNullReader) to use a built-in C++-side reader, or wrap a Python callable in a runtimeParamof typePyAcquisitionReaderto bind it at execution time.buffer_provider (BucketSource or None) – Source of buckets used to hold each batch. If
None, a defaultRecyclingBucketSourceforevent_typeis used.batch_size (int or Param[int] or None) – Number of elements requested per read. Smaller values reduce latency; larger values reduce per-read overhead. Defaults to
65536. Must be positive.access_tag (AccessTag) – Tag used to retrieve an
AcquireAccess(which provideshalt()) from theExecutionContextat runtime.
Notes
Events handled:
This processor has no input events; it is a source.
Emits
BucketEventofevent_typewhenever a non-empty read completes.End of input is initiated when the reader returns
None, whereupon the downstream is flushed. If halted viaAcquireAccessbefore end of stream, the downstream is not flushed and a halt exception is raised.
See also
- tcspc::acquire()
The underlying C++ factory function.
- AcquisitionReader
Interface for built-in C++-side readers.
- PyAcquisitionReader
Interface for Python-callable readers (used via
Param).- AcquireAccess
Runtime access object providing
halt().