Daq Simulator

This module implements a simple DAQ receiver.

It exists to allow MccsDaqReceiver to be unit tested.

class DaqSimulator(**extra_config)[source]

An implementation of a DaqSimulator device.

__init__(**extra_config)[source]

Initialise this device.

Parameters:

extra_config (str | int) – keyword args providing extra configuration.

configure(config)[source]

Apply a configuration to the DaqReceiver.

Parameters:

config (dict[str, Any]) – the configuration to apply

Return type:

tuple[ResultCode, str]

Returns:

a resultcode, message tuple

create_plotting_directory(parent, station_name)[source]

Create plotting directory structure for this station.

This method will always return True unless parent==”invalid_directory”

Parameters:
  • parent (str) – Parent plotting directory

  • station_name (str) – Station name

Return type:

bool

Returns:

False if parent==”invalid_directory” else True

get_configuration()[source]

Retrieve the current DAQ configuration.

Return type:

dict[str, Any]

Returns:

a configuration dictionary.

get_data_rate()[source]

Return the current data rate in Gb/s, or None if not being monitored.

Return type:

float

Returns:

the current data rate in Gb/s, or None if not being monitored.

get_status()[source]

Provide status information for this MccsDaqReceiver.

This method returns status as a json string with entries for:
  • Running Consumers: [DaqMode.name: str, DaqMode.value: int]

  • Receiver Interface: “Interface Name”: str

  • Receiver Ports: [Port_List]: list[int]

  • Receiver IP: “IP_Address”: str

Return type:

dict[str, Any]

Returns:

A json string containing the status of this DaqReceiver.

initialise_daq(libaavsdaq_filepath='')[source]

Initialise a new DaqReceiver instance.

Parameters:

libaavsdaq_filepath (str) – Filepath to a specific version of libaavsdaq.so

Return type:

tuple[ResultCode, str]

Returns:

a resultcode, message tuple

initialise_station_beam(filepath=None)[source]

Initialise the station beam.

Parameters:

filepath (Optional[str]) – Filepath to a specific version of libaavsstationbeam.so

Return type:

tuple[ResultCode, str]

Returns:

a resultcode, message tuple

property initialised: bool

Return whether the simulated DAQ is initialised.

Returns:

whether the simulated DAQ is initialised.

populate_configuration(config)[source]

Initialise a new DaqReceiver instance.

Parameters:

config (dict[str, Any]) – the configuration to apply

Return type:

tuple[ResultCode, str]

Returns:

a resultcode, message tuple

start_bandpass_monitor(argin)[source]

Start monitoring antenna bandpasses.

The MccsDaqReceiver will begin monitoring antenna bandpasses

and producing plots of the spectra.

Parameters:

argin (str) – A json dictionary with keywords - plot_directory Directory in which to store bandpass plots. - monitor_rms Whether or not to additionally produce RMS plots. Default: False. - auto_handle_daq Whether DAQ should be automatically reconfigured, started and stopped without user action if necessary. This set to False means we expect DAQ to already be properly configured and listening for traffic and DAQ will not be stopped when StopBandpassMonitor is called. Default: False.

Yields:

a task status and response message. Optionally also bandpass data for both polarisations and rms data.

Return type:

Iterator[tuple[TaskStatus, str, str | None, str | None, str | None]]

start_daq(modes_to_start, callbacks, diagnostic_callback)[source]

Start data acquisition with the current configuration.

Parameters:
  • modes_to_start (list[DaqModes]) – modes to start.

  • callbacks (list[Callable]) – callbacks for the data modes.

  • diagnostic_callback (Optional[Callable]) – callback for diagnostics.

Return type:

tuple[ResultCode, str]

Returns:

a result code and status.

start_measuring_data_rate(interval=1.0)[source]

Start the data rate monitor on the receiver interface.

Parameters:

interval (float) – the interval over which to measure the data rate.

Return type:

tuple[ResultCode, str]

Returns:

a ResultCode and response message

stop_bandpass_monitor()[source]

Stop monitoring antenna bandpasses.

Return type:

tuple[ResultCode, str]

Returns:

a resultcode, message tuple

stop_daq()[source]

Stop data acquisition.

Return type:

tuple[ResultCode, str]

Returns:

a resultcode, message tuple

stop_measuring_data_rate()[source]

Stop the data rate monitor on the receiver interface.

Return type:

tuple[ResultCode, str]

Returns:

a ResultCode and response message