API documentation

This section describes requirements and guidelines.

Packetisers

We begin with the packetiser we have written as a default emulator this is a pretty simple package that uses the transmitter and payload classes defined in the configuration to send data.

At the moment we have an assumption that the ICD payload is being used. but minor changes to the packetise method would remove that requirement. Very minimal work is needed to replicate this with another payload.

The actual transmission protocol is abstracted into the transmitters and this is currently defaulting to SPEAD2 and UDP. But as this is almost completely abstracted should be easy to change.

Default Emulator

Reads data from a MS and creates SPEAD2 packets.

This package is designed to be easily extensible to different payloads and protocols. This module is currently installed as emu_send when the package is installed.

cbf_sdp.packetiser.packetise(config, ms, loop=None)[source]

Reads data off a Measurement Set and transmits it using the transmitter specified in the configuration.

Uses the vis_reader get data from the measurement set then gives it to the transmitter for packaging and transmission. This code is transmission protocol agnostic.

Parameters:
  • config – The configuration
  • ms – The measurement set

Transmitters

The transmitters are envisaged to be at least as diverse as UDP, IBV and perhaps ROCE we have only implemented the UDP transmitter. But extensions should be trivial

spead2_transmitters

Class that manages transmission of a SPEAD2 HEAP via UDP and of a content defined by the payload class

class cbf_sdp.transmitters.spead2_transmitters.Spead2SenderPayload(num_baselines=None, num_channels=None)[source]

SPEAD2 payload following the CSP-SDP interface document

class cbf_sdp.transmitters.spead2_transmitters.transmitter(config, num_baselines, num_chan, loop)[source]

SPEAD2 transmitter

This class uses the spead2 library to transmit visibilities over multiple spead2 streams. Each visiblity set given to this class’ send method is broken down by channel range (depending on the configuration parameters), and each channel range is sent through a different stream.

close()[source]

Sends the end-of-stream message

send(ts, ts_fraction, vis)[source]

Send a visibility set through all SPEAD2 streams

Parameters:
  • ts – the integer part of the visibilities’ timestamp
  • ts_fraction – the fractional part of the visibilities’ timestamp
  • vis – the visibilities

Payloads

class cbf_sdp.icd.Payload[source]

A payload as specified by the ICD

channel_count

The number of channels contained in this payload

channel_id

The ID of the first channel of this payload

correlated_data_fraction

The fraction of data on this payload that was correlated

hardware_id

The ID of the hardware source of this payload

mjd_time

The timestamp of the payload in MJD seconds

phase_bin_count

The number of phase bins of this payload

phase_bin_id

The ID of the first phase bin of this payload

polarisation_id

The ID of the polarisation of this payload

scan_id

The ID of the scan of this payload

time_centroid_indices

The time centroids for each visibility of this payload

timestamp_count

The timestamp of the visibilities, as (integer) seconds since UNIX epoch

timestamp_fraction

The fractional timestamp of the visibilities, as an integer with units of 1/2**32 seconds

unix_time

The timestamp as fractional seconds since UNIX epoch

visibilities

The correlator visibilities of this payload

Receivers

UDP Protocol Multi-stream SPEAD2 receiver

class cbf_sdp.receivers.spead2_receivers.Spead2ReceiverPayload[source]

A Payload that updates itself from data coming from spead2 heaps

class cbf_sdp.receivers.spead2_receivers.receiver(config, tm, loop)[source]

SPEAD2 receiver

This class uses the spead2 library to receive a multiple number of streams, each using a single UDP reader. As heaps are received they are given to a single consumer.

run()[source]

Receive all heaps, passing them to the consumer

Others

class cbf_sdp.utils.FakeTM(ms)[source]

TelescopeManager-like class that reads its model information from a Measurement Set.

freq_inc_hz

The frequency increment between channels, in Hz

freq_start_hz

The frequency of the first channel, in Hz

get_freq_inc_hz()[source]

The frequency increment between channels, in Hz

get_freq_start_hz()[source]

The frequency of the first channel, in Hz

get_is_autocorrelated()[source]

Whether the current observation is used autocorrelation or not

get_matching_data(current_mjd_utc) → cbf_sdp.utils.DataObject[source]

Like get_nearest_data, but if no exact match is found an ValueError exception is raised.

get_nearest_data(time) → cbf_sdp.utils.DataObject[source]

Returns the (meta)data associated with correlator dumps happening at a given point in time. If no exact match is found the nearest is returned.

get_num_baselines()[source]

The number of baselines used by the current observation

get_num_channels()[source]

The number of channels of the current observation

get_num_pols()[source]

The number of polarisations used by the current observation

get_num_stations()[source]

The number of stations used by the current observation

get_phase_centre_radec_rad()[source]

Return the RA/DEC phase centre in radians

is_autocorrelated

Whether the current observation is used autocorrelation or not

num_baselines

The number of baselines used by the current observation

num_channels

The number of channels of the current observation

num_pols

The number of polarisations used by the current observation

num_stations

The number of stations used by the current observation

phase_centre_radec_rad

Return the RA/DEC phase centre in radians