Calibration Store Component Manager
This module implements the component management for a calibration store.
- class CalibrationStoreComponentManager(*args: Any, **kwargs: Any)[source]
A component manager for MccsCalibrationStore.
- __init__(logger: Logger, communication_state_changed_callback: Callable[[ska_control_model.CommunicationStatus], None], component_state_changed_callback: Callable[[bool | None, ska_control_model.PowerState | None], None], policy_name: str, policy_frequency_tolerance: int, policy_temperature_tolerance: float) None[source]
Initialise a new instance.
- Parameters:
logger – a logger for this object to use
component_state_changed_callback – callback to be called when the component state changes
communication_state_changed_callback – callback to be called when the status of the communications channel between the component manager and its component changes
policy_name – The policy type to use. Currently [“preferred”, “closest_in_range”] supported.
policy_frequency_tolerance – a configuration parameter that may be used by policy [channel]
policy_temperature_tolerance – a configuration parameter that may be used by policy [Degrees]
- Raises:
ValueError – When the SelectionPolicy configuration is incorrect from deployment.
- check_calibration_id(cal_id: str) bool[source]
Check if the given cal id is in the database already.
- Parameters:
cal_id – the cal ID to check.
- Returns:
True if the cal ID is already in the database
- create_database_connection(logger: Logger, communication_state_changed_callback: Callable[[ska_control_model.CommunicationStatus], None]) CalibrationStoreDatabaseConnection[source]
Create the database connection object.
- Parameters:
logger – a logger for the connection to use
communication_state_changed_callback – callback to be called when the component state changes
- Returns:
the database connection
- get_calibration_ids() list[str][source]
Get all calibration_ids.
- Returns:
A list of all calibration_ids
- get_policy() str[source]
Return the active SelectionPolicy.
- Returns:
a JSON servialised dictionary with information in a format validated.
- get_policy_description() str[source]
Return a description of the SelectionPolicy active.
- Returns:
a string with information about the policy.
- get_solution(**kwargs: Any) list[float][source]
Get a solution for the provided frequency and station id.
This at present will return the most recently stored solution for the inputs.
- Parameters:
kwargs – kwargs to feed policy.
- Returns:
the solution or an empty list
- Raises:
ValueError – when no SelectionPolicy is loaded.
- set_selection_policy(policy_name: str, **kwargs: Any) tuple[list[ska_control_model.ResultCode], list[str]][source]
Set a new policy for selecting solutions.
- Parameters:
policy_name – The policy to use.
kwargs – kwargs to pass to policy.
kwargs are used to configure the SelectionPolicy, See details on the configure command for selected policy for details: https://developer.skao.int/projects/ska-low-mccs/en/latest/api/calibration_store/selection_policy/index.html
- Returns:
a tuple containing the ResultCode and a message.
- store_calibration_job(sweep_id: int, **kwargs: Any) tuple[list[ska_control_model.ResultCode], list[str]][source]
Store the provided calibration job in the database.
- Parameters:
sweep_id – the frequency sweep ID this job refers to.
kwargs – any optional validated kwargs.
- Returns:
tuple of result code and message
- store_frequency_sweep(station_id: int, channel_start: int, channel_stop: int, **kwargs: Any) tuple[list[ska_control_model.ResultCode], list[str]][source]
Store the provided frequency sweep in the database.
- Parameters:
station_id – the id of the station to store this frequency sweep for.
channel_start – the first channel in the sweep.
channel_stop – the last channel in the sweep.
kwargs – any optional validated kwargs.
- Returns:
tuple of result code and message
- store_solution(solution: list[float], frequency_channel: int, station_id: int, calibration_path: str, preferred: bool = False, **kwargs: Any) tuple[list[ska_control_model.ResultCode], list[str]][source]
Store the provided solution in the database.
- Parameters:
solution – the solution to store.
frequency_channel – the frequency channel that the solution is for
station_id – the id of the station to store this solution for.
preferred – mark solution as preferred.
calibration_path – the path to the correlation matrix used to get this solution.
kwargs – any optional validated kwargs.
- Returns:
tuple of result code and message