katgpucbf.xbgpu.recv module
SPEAD receiver utilities.
- class katgpucbf.xbgpu.recv.Layout(n_ants: int, n_channels_per_substream: int, n_spectra_per_heap: int, heap_timestamp_step: int, sample_bits: int, heaps_per_fengine_per_chunk: int)[source]
Bases:
BaseLayoutParameters controlling the sizes of heaps and chunks.
- Parameters:
n_ants (int) – The number of antennas that data will be received from
n_channels_per_substream (int) – The number of frequency channels contained in the stream.
n_spectra_per_heap (int) – The number of time samples received per frequency channel.
heap_timestamp_step (int) – Each heap contains a timestamp. The timestamp between consecutive heaps changes depending on the FFT size and the number of time samples per channel. This parameter defines the difference in timestamp values between consecutive heaps. This parameter can be calculated from the array configuration parameters for power-of-two array sizes, but is configurable to allow for greater flexibility during testing.
sample_bits (int) – The number of bits per sample. Only 8 bits is supported at the moment.
heaps_per_fengine_per_chunk (int) – Each chunk out of the SPEAD2 receiver will contain multiple heaps from each antenna. This parameter specifies the number of heaps per antenna that each chunk will contain.
- property heap_bytes
Number of payload bytes per heap.
- katgpucbf.xbgpu.recv.iter_chunks(ringbuffer: ChunkRingbuffer, layout: Layout, sensors: SensorSet, time_converter: TimeConverter) AsyncGenerator[Chunk, None][source]
Retrieve chunks from the ringbuffer, updating metrics as they are received.
The returned chunks are yielded from this asynchronous generator.
- Parameters:
ringbuffer – Source of chunks.
layout – Structure of the stream.
sensors – Sensor set containing at least the sensors created by
make_sensors().time_converter – Converter to turn data timestamps into sensor timestamps.
- katgpucbf.xbgpu.recv.make_stream(layout: Layout, data_ringbuffer: ChunkRingbuffer, free_ringbuffer: ChunkRingbuffer, recv_affinity: int, max_active_chunks: int) ChunkRingStream[source]
Create a SPEAD receiver stream.
Helper function with XB-engine-specific logic in it.
- Parameters:
layout – Heap size and chunking parameters.
data_ringbuffer – Output ringbuffer to which chunks will be sent.
free_ringbuffer – Ringbuffer for holding chunks for recycling once they’ve been used.
recv_affinity – CPU core affinity for the worker thread.
max_active_chunks – Maximum number of chunks under construction.