libtcspc.CopyToFullBuckets

final class libtcspc.CopyToFullBuckets(element_type, buffer_provider=None, batch_size=None)[source]

Bases: Node

Processor that copies pushed data into fixed-size buckets while also delivering real-time read-only views.

Like CopyToBuckets, this plugs a push-style data source into a libtcspc processing graph by copying the contents of each incoming data event into buckets obtained from the buffer provider. Unlike CopyToBuckets, it collects the data into fixed-size buckets and has two outputs:

  • live: a read-only ConstBucketEvent view of the data copied on each incoming event, delivered immediately (typically used for live display).

  • batch: a full BucketEvent bucket emitted whenever batch_size elements have been collected, plus any partial final bucket on flush (typically used for saving to disk).

This is the push-mode counterpart of AcquireFullBuckets. Data is typically fed in by pushing numpy arrays (or other buffer-protocol objects) into the graph input; each is wrapped zero-copy as a read-only bucket, so the only bulk-data copy is the one into the bucket-source’s buckets. The live views are zero-copy when the buffer provider supplies shared-view-capable buckets, so they must not be modified.

Parameters:
  • element_type (EventType) – Element type T of the data. Each emitted bucket holds a contiguous array of this type.

  • buffer_provider (BucketSource or Param[PyBucketSource] or None) – Source of buckets used to hold each batch. If None, a default RecyclingBucketSource for element_type is used. A runtime Param of type PyBucketSource binds a Python bucket source at execution time. The buffer provider must support shared views unless the live output is connected to a SinkAll.

  • batch_size (int or Param[int] or None) – Number of elements collected in each full bucket. Smaller values reduce latency; larger values reduce per-batch overhead. Defaults to 65536. Must be positive.

Notes

Events handled:

  • A ConstBucketEvent of element_type (a read-only bucket<T const>): copied into the current bucket. A read-only ConstBucketEvent view of the copy is emitted on live, and a full BucketEvent of element_type is emitted on batch whenever batch_size elements have been collected.

  • All other event types: passed through unchanged on live, to carry out-of-band timing events.

  • End of input: any partial bucket is emitted on batch before both downstreams are flushed.

See also

tcspc::copy_to_full_buckets()

The underlying C++ factory function.

CopyToBuckets

The single-output counterpart.

AcquireFullBuckets

The pull-mode counterpart.

BucketSource

Interface for bucket sources.

PyBucketSource

Interface for Python bucket sources (used via Param).