Helpers to evaluate inconsistencies
Helpers for scan inconsistency classification and diagnostics.
- ska_csp_lmc_common.observation.scan.inconsistency.build_pst_threshold_exceeded_inconsistency(invalid_pst_beams: list[dict[str, Any]], pst_threshold: int = 0) dict[str, Any]
Build a synthetic inconsistency when failing PST beams exceed the threshold in PULSAR_TIMING-only scans.
- Parameters:
invalid_pst_beams – Classified inconsistent PST beams collected during scan validation.
- Returns:
Synthetic inconsistency dictionary used to force a FAULT decision when the threshold is exceeded.
- ska_csp_lmc_common.observation.scan.inconsistency.log_commensal_mode_pst_warning(logger: Logger, invalid_pst_beams: list[dict[str, Any]], obs_modes: list[ska_control_model.ObsMode]) None
Log a warning for PST inconsistencies in commensal observing mode.
- Parameters:
invalid_pst_beams – Classified inconsistent PST beams to report.
obs_modes – Active observing modes used to explain why scanning can continue.
- ska_csp_lmc_common.observation.scan.inconsistency.classify_scan_inconsistency(fqdn: str, obs_state: ska_control_model.ObsState, obs_modes: list[ska_control_model.ObsMode]) dict[str, Any]
Classify the type of inconsistency based on the subsystem’s obsState. It returns a structured description of the failure mode.
- Parameters:
fqdn – The fqdn of the component in unexpected obsState
obs_state – The unexpected obsState of the subsystem.
obs_modes – The active observation modes.
- Returns:
A dictionary containing a ‘code’ and ‘description’ of the issue.
- ska_csp_lmc_common.observation.scan.inconsistency.build_scan_consistency_details(obs_modes: list[ska_control_model.ObsMode], invalid_subsystems: list[dict[str, Any]]) str
Build a detailed, human-readable fault message.
Example:
ObsMode:IMAGING. SCAN consistency check failed. Causes: - low-cbf/subarray/01 was unexpectedly restarted during the scan (obsState is EMPTY, should be SCANNING).
- Parameters:
obs_modes – The active observation modes.
invalid_subsystems – The list of subsystems that failed validation.
- Returns:
A formatted diagnostic message string.
- ska_csp_lmc_common.observation.scan.inconsistency.evaluate_decision_final_obsstate(invalid_subsystems: list[dict[str, Any]]) tuple[ska_control_model.ObsState, PolicyAction, Severity]
Derive the final aggregated obsState from classified inconsistencies.
The most severe inconsistency determines the final decision: - HIGH severity forces a transition to FAULT; - MEDIUM severity keeps the scan in SCANNING but marks it as degraded; - LOW severity keeps the scan in SCANNING.
- Parameters:
invalid_subsystems – Classified inconsistent subsystems.
- Returns:
Tuple containing the final obsState, the hard-fault flag and the highest detected severity.