orca.transform.qa ================= .. py:module:: orca.transform.qa .. autoapi-nested-parse:: Quality assurance transforms for data validation. Provides functions for data sanity checking, gain calibration quality assessment, and identification of problematic antennas and channels. Integrates with ClickHouse for logging QA metrics. Attributes ---------- .. autoapisummary:: orca.transform.qa.logger Functions --------- .. autoapisummary:: orca.transform.qa.sanity_check orca.transform.qa.gainQA Module Contents --------------- .. py:data:: logger .. py:function:: sanity_check(msl: List[str]) -> List[str] Check measurement sets for data integrity issues. Reads data from each measurement set and checks for excessive zero values. Reports statistics to ClickHouse database and returns list of problematic files. :param msl: List of measurement set paths to check. :returns: List of measurement sets that had I/O errors or unexpected row counts. .. py:function:: gainQA(calfile: str, do_plot: bool = True, save_stats: bool = True, outdir: str = './', qa_file: str = None) Analyze a CASA gain calibration table to identify problematic antennas and channels based on gain amplitude and SNR statistics. Optionally generates a QA report and diagnostic plots. :param calfile: Path to the CASA calibration table (gaincal output). :type calfile: str :param do_plot: If True, generates diagnostic plots and saves to `outdir`. :type do_plot: bool :param save_stats: If True, writes a .qa report with flagged antennas/channels. :type save_stats: bool :param outdir: Output directory to save plots. Defaults to './'. :type outdir: str :param qa_file: Optional path to the QA report file. If None, defaults to `calfile + '.qa'`. :type qa_file: str :returns: Array of indices of CORRELATOR NUMBERS with anomalous amplitude statistics. bad_ch (np.ndarray): Array of indices of channels with anomalous SNR statistics. :rtype: bad_corrs (np.ndarray)