DAQ receiver subpackage
This subpackage implements Daq Receiver functionality for MCCS.
- class DaqComponentManager(daq_id, receiver_interface, receiver_ip, receiver_ports, daq_address, consumers_to_start, skuid_url, logger, max_workers, communication_state_callback, component_state_callback, received_data_callback)
A component manager for a DaqReceiver.
- __init__(daq_id, receiver_interface, receiver_ip, receiver_ports, daq_address, consumers_to_start, skuid_url, logger, max_workers, communication_state_callback, component_state_callback, received_data_callback)
Initialise a new instance of DaqComponentManager.
- Parameters:
daq_id (
int
) – The ID of this DaqReceiver.receiver_interface (
str
) – The interface this DaqReceiver is to watch.receiver_ip (
str
) – The IP address of this DaqReceiver.receiver_ports (
str
) – The port this DaqReceiver is to watch.daq_address (
str
) – the address of the DAQ receiver. This is dependent on the communication mechanism used. For gRPC, this is the channel.consumers_to_start (
str
) – The default consumers to be started.skuid_url (
str
) – The address at which a SKUID service is running.logger (
Logger
) – the logger to be used by this object.max_workers (
int
) – the maximum worker threads for the slow commands associated with this component manager.communication_state_callback (
Callable
[[CommunicationStatus
],None
]) – callback to be called when the status of the communications channel between the component manager and its component changescomponent_state_callback (
Callable
[...
,None
]) – callback to be called when the component state changesreceived_data_callback (
Callable
[[str
,str
,str
],None
]) – callback to be called when data is received from a tile
- configure_daq(daq_config)
Apply a configuration to the DaqReceiver.
- Parameters:
daq_config (
str
) – A json containing configuration settings.- Return type:
- Returns:
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- daq_status(task_callback=None)
Provide status information for this MccsDaqReceiver.
- get_configuration()
Get the active configuration from DAQ.
- start_bandpass_monitor(argin, task_callback=None)
Start monitoring antenna bandpasses.
- The MccsDaqReceiver will begin monitoring antenna bandpasses
and producing plots of the spectra.
- Parameters:
argin (
str
) – A json string 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. - cadence The time in seconds over which to average bandpass data. Default: 0 returns snapshots.task_callback (
Optional
[Callable
]) – Update task state, defaults to None
- Return type:
- Returns:
a task status and response message
- start_daq(modes_to_start, task_callback=None)
Start data acquisition with the current configuration.
Extracts the required consumers from configuration and starts them.
- stop_bandpass_monitor(task_callback=None)
Stop monitoring antenna bandpasses.
- The MccsDaqReceiver will cease monitoring antenna bandpasses
and producing plots of the spectra.
- class DaqHealthModel(component_state_callback)
A health model for a Daq receiver.
- __init__(component_state_callback)
Initialise a new instance.
- evaluate_health()
Compute overall health of the Daq receiver.
- Return type:
- Returns:
an overall health of the Daq receiver.
- class DaqSimulator
An implementation of a DaqSimulator device.
- __init__()
Initialise this device.
- configure(config)
Apply a configuration to the DaqReceiver.
- create_plotting_directory(parent, station_name)
Create plotting directory structure for this station.
This method will always return True unless parent==”invalid_directory”
- get_configuration()
Retrieve the current DAQ configuration.
- get_status()
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
- initialise(config)
Initialise a new DaqReceiver instance.
- property initialised: bool
Return whether the simulated DAQ is initialised.
- Returns:
whether the simulated DAQ is initialised.
- start(modes_to_start)
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`.
- start_bandpass_monitor(argin)
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
,Optional
[str
],Optional
[str
],Optional
[str
]]]
- stop()
Stop data acquisition.
- Return type:
- Returns:
a resultcode, message tuple
- stop_bandpass_monitor()
Stop monitoring antenna bandpasses.
- Return type:
- Returns:
a resultcode, message tuple
- class MccsDaqReceiver(*args, **kwargs)
An implementation of a MccsDaqReceiver Tango device.
- Configure(argin)
Configure the DaqReceiver.
Applies the specified configuration to the DaqReceiver.
- Parameters:
argin (
str
) – A JSON string containing the daq configuration to apply.- Return type:
- Returns:
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- Example:
>>> daq = tango.DeviceProxy("low-mccs/daqreceiver/001") >>> daq_config = { "receiver_ports": "4660", "receiver_interface": "eth0", } >>> daq.Configure(json.dumps(daq_config))
- class ConfigureCommand(component_manager, logger=None)
Class for handling the Configure(argin) command.
- __init__(component_manager, logger=None)
Initialise a new ConfigureCommand instance.
- DaqStatus()
Provide status information for this MccsDaqReceiver.
- This method returns status as a json string with entries for:
Daq Health: [HealthState.name: str, HealthState.value: int]
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:
- Returns:
A json string containing the status of this DaqReceiver.
- Example:
>>> daq = tango.DeviceProxy("low-mccs/daqreceiver/001") >>> jstr = daq.DaqStatus() >>> dict = json.loads(jstr)
- class DaqStatusCommand(component_manager, logger=None)
A class for the MccsDaqReceiver’s DaqStatus() command.
- __init__(component_manager, logger=None)
Initialise a new instance.
- GetConfiguration()
Get the Configuration from DAQ.
- Return type:
- Returns:
A JSON-encoded dictionary of the configuration.
- Example:
>>> daq = tango.DeviceProxy("low-mccs/daqreceiver/001") >>> jstr = daq.GetConfiguration() >>> dict = json.loads(jstr)
- class GetConfigurationCommand(component_manager, logger=None)
Class for handling the GetConfiguration() command.
- __init__(component_manager, logger=None)
Initialise a new GetConfigurationCommand instance.
- do()
Implement
MccsDaqReceiver.GetConfiguration()
command.- Return type:
- Returns:
The configuration as received from pydaq
- class InitCommand(*args, **kwargs)
Implements device initialisation for the MccsDaqReceiver device.
- do(*args, **kwargs)
Initialise the attributes and properties.
- Parameters:
- Return type:
- Returns:
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- SetConsumers(argin)
Set the default list of consumers to start.
Sets the default list of consumers to start when left unspecified in the start_daq command.
- Parameters:
argin (
str
) – A string containing a comma separated list of DaqModes.- Return type:
- Returns:
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- Example:
>>> daq = tango.DeviceProxy("low-mccs/daqreceiver/001") # pylint: disable=line-too-long >>> consumers = "DaqModes.INTEGRATED_BEAM_DATA,ANTENNA_BUFFER, BEAM_DATA," # noqa: E501 >>> daq.SetConsumers(consumers)
- class SetConsumersCommand(component_manager, logger=None)
Class for handling the SetConsumersCommand(argin) command.
- __init__(component_manager, logger=None)
Initialise a new SetConsumersCommand instance.
- Start(argin='')
Start the DaqConsumers.
- The MccsDaqReceiver will begin watching the interface specified in the
configuration and will start the configured consumers.
- Parameters:
argin (
str
) – A json dictionary with optional keywords. ‘{“modes_to_start”}’.- Return type:
- Returns:
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- Example:
>>> daq = tango.DeviceProxy("low-mccs/daqreceiver/001") >>> argin = '{"modes_to_start": "INTEGRATED_CHANNEL_DATA, RAW_DATA"}' >>> daq.Start(argin) # use specified consumers >>> daq.Start("") # Uses default consumers.
- StartBandpassMonitor(argin)
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. - cadence The time in seconds over which to average bandpass data. Default: 0 returns snapshots.- Return type:
- Returns:
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- Stop()
Stop the DaqReceiver.
The DAQ receiver will cease watching the specified interface and will stop all running consumers.
- StopBandpassMonitor()
Stop monitoring antenna bandpasses.
- The MccsDaqReceiver will cease monitoring antenna bandpasses
and producing plots of the spectra.
- class StopBandpassMonitorCommand(component_manager, logger=None)
Class for handling the StopBandpassMonitorCommand() command.
- __init__(component_manager, logger=None)
Initialise a new StopBandpassMonitorCommand instance.
- do()
Implement MccsDaqReceiver.SetConsumersCommand functionality.
Stop monitoring antenna bandpasses.
- The MccsDaqReceiver will cease monitoring antenna bandpasses
and producing plots of the spectra.
- Return type:
- Returns:
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- class StopCommand(component_manager, logger=None)
Class for handling the Stop() command.
- __init__(component_manager, logger=None)
Initialise a new StopCommand instance.
- do()
Implement MccsDaqReceiver.StopCommand command functionality.
- Return type:
- Returns:
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- __init__(*args, **kwargs)
Initialise this device object.
- create_component_manager()
Create and return a component manager for this device.
- Return type:
- Returns:
a component manager for this device.
- dataReceivedResult()
Read the result of the receiving of data.
- init_command_objects()
Initialise the command handlers for commands supported by this device.
- Return type:
- init_device()
Initialise the device.
This is overridden here to change the Tango serialisation model.
- Return type:
- rmsPlot()
Read the last rms plot filepath.
- Return type:
- Returns:
The last block of rms data.
- xPolBandpass()
Read the last bandpass plot data for the x-polarisation.
- Return type:
- Returns:
The last block of x-polarised bandpass data.
- DAQ component manager
DaqComponentManager
DaqComponentManager.__init__()
DaqComponentManager.configure_daq()
DaqComponentManager.daq_status()
DaqComponentManager.get_configuration()
DaqComponentManager.start_bandpass_monitor()
DaqComponentManager.start_communicating()
DaqComponentManager.start_daq()
DaqComponentManager.stop_bandpass_monitor()
DaqComponentManager.stop_communicating()
DaqComponentManager.stop_daq()
- DAQ receiver device
MccsDaqReceiver
MccsDaqReceiver.Configure()
MccsDaqReceiver.ConfigureCommand
MccsDaqReceiver.DaqStatus()
MccsDaqReceiver.DaqStatusCommand
MccsDaqReceiver.GetConfiguration()
MccsDaqReceiver.GetConfigurationCommand
MccsDaqReceiver.InitCommand
MccsDaqReceiver.SetConsumers()
MccsDaqReceiver.SetConsumersCommand
MccsDaqReceiver.Start()
MccsDaqReceiver.StartBandpassMonitor()
MccsDaqReceiver.Stop()
MccsDaqReceiver.StopBandpassMonitor()
MccsDaqReceiver.StopBandpassMonitorCommand
MccsDaqReceiver.StopCommand
MccsDaqReceiver.__init__()
MccsDaqReceiver.create_component_manager()
MccsDaqReceiver.dataReceivedResult()
MccsDaqReceiver.init_command_objects()
MccsDaqReceiver.init_device()
MccsDaqReceiver.rmsPlot()
MccsDaqReceiver.xPolBandpass()
MccsDaqReceiver.yPolBandpass()
main()
- DAQ health model