katgpucbf.fsim.main module

Simulate channelised data from the MeerKAT F-Engines destined for one or more XB-Engines.

Refer to F-Engine Packet Simulator for more information.

katgpucbf.fsim.main.QUEUE_DEPTH = 8

Number of heaps in time to keep in flight

class katgpucbf.fsim.main.Sender(args: Namespace, idx: int)[source]

Bases: object

Manage sending data to a single XB-engine.

async run(sync_time: float, run_once: bool) None[source]

Send heaps until cancelled.

async katgpucbf.fsim.main.async_main() None[source]

Run main program.

katgpucbf.fsim.main.main() None[source]

Run main program.

katgpucbf.fsim.main.make_heap(timestamp: ndarray, feng_id: int, channel_offset: int, payload: ndarray) HeapReference[source]

Create a heap to transmit.

The timestamp must be a zero-dimensional array of dtype >u8. It will be transmitted by reference, so it can be updated in place to change the stored timestamp.

katgpucbf.fsim.main.make_heap_payload(out: ndarray, heap_index: int, feng_id: int, n_ants: int) None[source]

Create the simulated payload data for a heap.

A pattern is chosen that will hopefully be easy to verify at the receiver graphically. On each F-Engine, the signal amplitude will increase linearly over time for each channel. Each channel will have a different starting amplitude but the rate of increase will be the same for all channels.

Each F-Engine will have the same same signal amplitude for the same timestamp, but the signal phase will be different. The signal phase remains constant across all channels in a single F-Engine. By examining the signal phase it can be verified that correct feng_id is attached to the correct data.

These samples need to be stored as 8 bit samples. As such, the amplitude is wrapped each time it reaches 127. 127 is used as the amplitude when multiplied by the phase can reach -127. The full range of values is covered.

This current format is not fixed and it is likely that it will be adjusted to be suited for different verification needs.

Parameters:
  • out – Output array, with shape (n_channels_per_substream, n_spectra_per_heap, N_POLS, COMPLEX)

  • heap_index – Heap index on time axis

  • feng_id – Heap index on antenna axis

  • n_ants – Number of antennas in the array

katgpucbf.fsim.main.make_stream(args: Namespace, idx: int, data: ndarray) spead2.send.asyncio.AsyncStream[source]

Create a SPEAD stream for a single destination.

Parameters:
  • args – Command-line arguments

  • idx – Index into the destinations to use

  • data – All payload data for this destination

katgpucbf.fsim.main.parse_args(arglist: Sequence[str] | None = None) Namespace[source]

Parse the command-line arguments.