libtcspc.Acquire

final class libtcspc.Acquire(event_type, reader, buffer_provider, batch_size, access_tag)[source]

Bases: Node

Source 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 BucketEvent downstream.

The acquisition runs until the reader signals end of stream (by returning None), the reader raises an exception, or the acquisition is halted via the AcquireAccess retrieved from the ExecutionContext using access_tag. Halting is asynchronous: the halt() 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 AcquisitionReader instance (such as NullReader) to use a built-in C++-side reader, or wrap a Python callable in a runtime Param of type PyAcquisitionReader to bind it at execution time.

  • buffer_provider (BucketSource or None) – Source of buckets used to hold each batch. If None, a default RecyclingBucketSource for event_type is 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 provides halt()) from the ExecutionContext at runtime.

Notes

Events handled:

  • This processor has no input events; it is a source.

  • Emits BucketEvent of event_type whenever a non-empty read completes.

  • End of input is initiated when the reader returns None, whereupon the downstream is flushed. If halted via AcquireAccess before 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().