libtcspc.CopyToFullBuckets¶
- final class libtcspc.CopyToFullBuckets(element_type, buffer_provider=None, batch_size=None)[source]¶
Bases:
NodeProcessor 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. UnlikeCopyToBuckets, it collects the data into fixed-size buckets and has two outputs:live: a read-onlyConstBucketEventview of the data copied on each incoming event, delivered immediately (typically used for live display).batch: a fullBucketEventbucket emitted wheneverbatch_sizeelements 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. Theliveviews are zero-copy when the buffer provider supplies shared-view-capable buckets, so they must not be modified.- Parameters:
element_type (EventType) – Element type
Tof 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 defaultRecyclingBucketSourceforelement_typeis used. A runtimeParamof typePyBucketSourcebinds a Python bucket source at execution time. The buffer provider must support shared views unless theliveoutput is connected to aSinkAll.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
ConstBucketEventofelement_type(a read-onlybucket<T const>): copied into the current bucket. A read-onlyConstBucketEventview of the copy is emitted onlive, and a fullBucketEventofelement_typeis emitted onbatchwheneverbatch_sizeelements 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
batchbefore both downstreams are flushed.
See also
- tcspc::copy_to_full_buckets()
The underlying C++ factory function.
CopyToBucketsThe single-output counterpart.
AcquireFullBucketsThe pull-mode counterpart.
BucketSourceInterface for bucket sources.
PyBucketSourceInterface for Python bucket sources (used via
Param).