Calibration store subpackage
This subpackage implements calibration store functionality for MCCS.
- class CalibrationStoreComponentManager(logger, communication_state_changed_callback, component_state_changed_callback, database_host, database_port, database_name, database_admin_user, database_admin_password)
A component manager for MccsCalibrationStore.
- __init__(logger, communication_state_changed_callback, component_state_changed_callback, database_host, database_port, database_name, database_admin_user, database_admin_password)
Initialise a new instance.
- Parameters:
logger (
Logger
) – a logger for this object to usecomponent_state_changed_callback (
Callable
[[Optional
[bool
],Optional
[PowerState
]],None
]) – callback to be called when the component state changescommunication_state_changed_callback (
Callable
[[CommunicationStatus
],None
]) – callback to be called when the status of the communications channel between the component manager and its component changesdatabase_host (
str
) – the database hostdatabase_port (
int
) – the database portdatabase_name (
str
) – the database namedatabase_admin_user (
str
) – the database admin userdatabase_admin_password (
str
) – the database admin password
- create_database_connection(logger, communication_state_changed_callback, database_host, database_port, database_name, database_admin_user, database_admin_password)
Create the database connection object.
- Parameters:
logger (
Logger
) – a logger for the connection to usecommunication_state_changed_callback (
Callable
[[CommunicationStatus
],None
]) – callback to be called when the component state changesdatabase_host (
str
) – the database hostdatabase_port (
int
) – the database portdatabase_name (
str
) – the database namedatabase_admin_user (
str
) – the database admin userdatabase_admin_password (
str
) – the database admin password
- Return type:
- Returns:
the database connection
- get_solution(frequency_channel, outside_temperature)
Get a solution for the provided frequency and outside temperature.
This at present will return the most recently stored solution for the inputs.
- class CalibrationStoreDatabaseConnection(logger, communication_state_callback, database_host, database_port, database_name, database_admin_user, database_admin_password, timeout=10, connection_max_tries=5)
A connection to a postgres database for the calibration store.
- __init__(logger, communication_state_callback, database_host, database_port, database_name, database_admin_user, database_admin_password, timeout=10, connection_max_tries=5)
Initialise a new instance of a database connection.
- Parameters:
logger (
Logger
) – a logger for this object to usecommunication_state_callback (
Callable
[[CommunicationStatus
],None
]) – callback to be called when the status of the communications channel between the component manager and its component changesdatabase_host (
str
) – the database hostdatabase_port (
int
) – the database portdatabase_name (
str
) – the database namedatabase_admin_user (
str
) – the database admin userdatabase_admin_password (
str
) – the database admin passwordtimeout (
float
) – the timeout for database operationsconnection_max_tries (
int
) – the maximum number of attempts to connect to the database
- get_solution(frequency_channel, outside_temperature)
Get a solution for the provided frequency and outside temperature.
This at present will return the most recently stored solution for the inputs.
- Parameters:
- Raises:
RuntimeError – if there are repeated connection issues with the database
- Return type:
- Returns:
a calibration solution from the database.
- store_solution(solution, frequency_channel, outside_temperature)
Store the provided solution in the database.
- Parameters:
- Raises:
RuntimeError – if there are repeated connection issues witht the database
- Return type:
tuple
[list
[ResultCode
],list
[str
]]- Returns:
tuple of result code and message.
- class CalibrationStoreHealthModel(*args, **kwargs)
A health model for a calibration store.
At present this uses the base health model; this is a placeholder for a future, better implementation.
- class MccsCalibrationStore(*args, **kwargs)
An implementation of the CalibrationStore Tango device.
- GetSolution(argin)
Get a calibration solution from the database.
- class GetSolutionCommand(component_manager, logger=None)
Class for handling the GetSolution() command.
This command takes as input a JSON string that conforms to the following schema:
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://skao.int/MccsCalibrationStore_GetSolution.json", "title": "MccsCalibrationStore GetSolution schema", "description": "Schema for MccsCalibrationStore's GetSolution command", "type": "object", "properties": { "frequency_channel": { "description": "Freqency channel to calibrate for", "type": "integer", "minimum": 0, "maximum": 511 }, "outside_temperature": { "description": "Outside temperature to calibrate for", "type": "number" } }, "required": ["frequency_channel", "outside_temperature"] }
- __init__(component_manager, logger=None)
Initialise a new instance.
- Parameters:
component_manager (
CalibrationStoreComponentManager
) – the device’s component managerlogger (
Optional
[Logger
]) – a logger for this command to log with.
- do(*args, **kwargs)
Implement
MccsCalibrationStore.GetSolution()
command.
- class InitCommand(*args, **kwargs)
A class for
MccsCalibrationStore
’s Init command.The
do()
method below is called uponMccsCalibrationStore
’s initialisation.- do(*args, **kwargs)
Initialise the attributes and properties of the MccsCalibrationStore.
- Parameters:
- Return type:
- Returns:
A tuple containing a return code and a string message indicating status. The message is for information purpose only.
- StoreSolution(argin)
Store a solution in the database.
- class StoreSolutionCommand(component_manager, logger=None)
Class for handling the StoreSolution() command.
This command takes as input a JSON string that conforms to the following schema:
{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://skao.int/MccsCalibrationStore_StoreSolution.json", "title": "MccsCalibrationStore StoreSolution schema", "description": "Schema for MccsCalibrationStore's StoreSolution command", "type": "object", "properties": { "frequency_channel": { "description": "Freqency channel to store a solution for", "type": "integer", "minimum": 0, "maximum": 511 }, "outside_temperature": { "description": "Outside temperature to store a solution for", "type": "number" }, "solution": { "description": "The calibration solution to store", "type": "array", "items": { "type": "number" } } }, "required": ["frequency_channel", "outside_temperature"] }
- __init__(component_manager, logger=None)
Initialise a new instance.
- Parameters:
component_manager (
CalibrationStoreComponentManager
) – the device’s component managerlogger (
Optional
[Logger
]) – a logger for this command to log with.
- do(*args, **kwargs)
Implement
MccsCalibrationStore.StoreSolution()
command.- Parameters:
- Return type:
tuple
[list
[ResultCode
],list
[str
]]- 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.
- Calibration store component manager
CalibrationStoreComponentManager
CalibrationStoreComponentManager.__init__()
CalibrationStoreComponentManager.create_database_connection()
CalibrationStoreComponentManager.get_solution()
CalibrationStoreComponentManager.start_communicating()
CalibrationStoreComponentManager.stop_communicating()
CalibrationStoreComponentManager.store_solution()
- Calibration store device
MccsCalibrationStore
MccsCalibrationStore.GetSolution()
MccsCalibrationStore.GetSolutionCommand
MccsCalibrationStore.InitCommand
MccsCalibrationStore.StoreSolution()
MccsCalibrationStore.StoreSolutionCommand
MccsCalibrationStore.__init__()
MccsCalibrationStore.create_component_manager()
MccsCalibrationStore.init_command_objects()
main()
- Calibration store health model
- Calibration store database connection