API

Daq handler

This module implements the DaqServer part of the MccsDaqReceiver device.

class DaqHandler[source]

An implementation of a DaqHandler device.

__init__()[source]

Initialise this device.

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.

Parameters:
  • parent (str) – Parent plotting directory

  • station_name (str) – Station name

Return type:

bool

Returns:

True if this method succeeded else False

generate_bandpass_plots(plotting_directory, station_name, cadence)[source]

Generate antenna bandpass plots.

Parameters:
  • station_name (str) – The name of the station.

  • plotting_directory (str) – Directory to store plots in.

  • cadence (int) – Time in seconds over which to average bandpass data.

Return type:

None

generate_rms_plots(station_name, plotting_directory)[source]

Generate RMS plots.

Parameters:
  • station_name (str) – Station name.

  • plotting_directory (str) – Directory to store plots in.

Return type:

None

get_configuration()[source]

Retrieve the current DAQ configuration.

Return type:

dict[str, Any]

Returns:

a configuration dictionary.

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

  • Bandpass Monitor: “Monitoring Status”: bool

Return type:

dict[str, Any]

Returns:

A json string containing the status of this DaqReceiver.

initialise(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

property initialised: bool

Return whether the DAQ is initialised.

Returns:

whether the DAQ is initialised.

start(modes_to_start)[source]

Start data acquisition with the current configuration.

A infinite streaming loop will be started until told to stop. This will notify the client of state changes and metadata of files written to disk, e.g. data_type.`file_name`.

Parameters:

modes_to_start (str) – string listing the modes to start.

Yield:

a status update.

Raises:

ValueError – if an invalid DaqMode is supplied

Return type:

Iterator[str | tuple[str, str, str]]

start_bandpass_monitor(argin)[source]

Begin monitoring antenna bandpasses.

Parameters:

argin (str) –

A dict of arguments to pass to start_bandpass_monitor command.

  • plot_directory: Plotting directory.

    Mandatory.

  • monitor_rms: Flag to enable or disable RMS monitoring.

    Optional. Default False. [DEPRECATED - To be removed.]

  • auto_handle_daq: Flag to indicate whether the DaqReceiver should

    be automatically reconfigured, started and stopped during this process if necessary. Optional. Default False. [DEPRECATED - To be removed.]

  • cadence: Number of seconds over which to average data.

    Optional. Default 0 (returns snapshots).

Yields:

Taskstatus, Message, bandpass/rms plot(s).

Return type:

Iterator[tuple[TaskStatus, str, Optional[str], Optional[str], Optional[str]]]

Returns:

TaskStatus, Message, None, None, None

stop()[source]

Stop data acquisition.

Return type:

tuple[ResultCode, str]

Returns:

a resultcode, message tuple

stop_bandpass_monitor()[source]

Stop monitoring antenna bandpasses.

Return type:

tuple[ResultCode, str]

Returns:

a resultcode, message tuple

main()[source]

Entrypoint for the module.

Create and start a server.

Return type:

None