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, timestamp_step: int, sample_bits: int, heaps_per_fengine_per_chunk: int)[source]

Bases: BaseLayout

Parameters 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.

  • 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 chunk_heaps: int

Number of heaps per chunk.

property heap_bytes

Calculate number of bytes in a heap based on layout parameters.

heaps_per_fengine_per_chunk: int
n_ants: int
n_channels_per_substream: int
n_spectra_per_heap: int
sample_bits: int
timestamp_step: int
katgpucbf.xbgpu.recv.make_sensors(sensor_timeout: float) SensorSet[source]

Create the sensors needed to hold receiver statistics.

Parameters:

sensor_timeout – Time (in seconds) without updates before sensors for received data go into error and sensors for missing data becoming nominal.

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.

async katgpucbf.xbgpu.recv.recv_chunks(stream: ChunkRingStream, 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:
  • stream – Stream object handling reception of F-engine data.

  • 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.