orca.transform.hot_baselines
Hot-baseline and amplitude-vs-UV diagnostics.
Ported from the standalone hot_baseline_worker.py script into the orca
package so that the Celery pipeline does not depend on preliminary_pipeline/.
The main entry point is run_diagnostics(), which is called by the
Phase-2 Celery task when hot_baselines=True.
Attributes
Functions
|
Extract the integer antenna number from a name like 'LWA-042'. |
|
Map LWA antenna numbers to MS row indices from the ANTENNA sub-table. |
|
Build a DataFrame mapping correlator numbers to hardware info. |
|
Read ECEF antenna positions from the MS. |
|
Read the mean frequency from the SPECTRAL_WINDOW sub-table. |
|
Compute per-baseline mean and std amplitude matrices from an MS. |
|
Blank baselines shorter than uv_cut_m metres. |
|
Identify outlier baselines from amplitude-vs-UV-distance scatter. |
|
Find hot baselines and bad antennas from the cross-pol heatmap. |
|
Flag bad antennas and baselines in the MS FLAG column. |
|
Save a single heatmap as a PNG. |
|
Save a two-panel diagnosis heatmap with overlays. |
|
Run the full hot-baseline analysis on a concatenated MS. |
Module Contents
- orca.transform.hot_baselines.extract_ant_number(name)[source]
Extract the integer antenna number from a name like ‘LWA-042’.
- orca.transform.hot_baselines.get_ms_id_map(ms_name: str) Dict[int, int][source]
Map LWA antenna numbers to MS row indices from the ANTENNA sub-table.
- orca.transform.hot_baselines.build_complete_map(ms_id_map: Dict[int, int]) pandas.DataFrame[source]
Build a DataFrame mapping correlator numbers to hardware info.
Uses
corr_numdirectly fromSYSTEM_CONFIG(verified against the wiring spreadsheet) rather than inferring it from MS ANTENNA table row indices. ms_id_map is still used to verify which antennas are present in the MS.
- orca.transform.hot_baselines.get_antenna_positions(ms_name: str) numpy.ndarray[source]
Read ECEF antenna positions from the MS.
- orca.transform.hot_baselines.get_mean_frequency(ms_name: str) float[source]
Read the mean frequency from the SPECTRAL_WINDOW sub-table.
- orca.transform.hot_baselines.get_data_matrix(ms_name: str, data_col: str = 'CORRECTED_DATA') Tuple[Dict[str, numpy.ndarray], Dict[str, numpy.ndarray], int][source]
Compute per-baseline mean and std amplitude matrices from an MS.
Reads in chunks for memory efficiency.
- Returns:
(mean_matrices, std_matrices, n_ant) — dicts keyed by pol name.
- orca.transform.hot_baselines.apply_uv_cut(matrix: numpy.ndarray, pos_array: numpy.ndarray, uv_cut_m: float) numpy.ndarray[source]
Blank baselines shorter than uv_cut_m metres.
- orca.transform.hot_baselines.analyze_amp_vs_uv(raw_mean: Dict[str, numpy.ndarray], pos_array: numpy.ndarray, n_ant: int, mean_freq: float | None = None, sigma_cut: float = 5.0, plot_prefix: str = 'amp_vs_uv') List[Tuple[int, int]][source]
Identify outlier baselines from amplitude-vs-UV-distance scatter.
Uses a rolling-median envelope to detect baselines whose amplitude exceeds
sigma_cutMADs above the local median.- Returns:
List of (ant1, ant2) tuples for bad baselines.
- orca.transform.hot_baselines.identify_bad_components(combined_matrix: numpy.ndarray, df_map: pandas.DataFrame, n_ant: int, extra_bad_baselines: List[Tuple[int, int]] | None = None, sigma_cut: float = 5.0, threshold_percent: float = 0.1) Tuple[List[Tuple[int, int]], Set[int], List[str]][source]
Find hot baselines and bad antennas from the cross-pol heatmap.
- Returns:
(heatmap_bad_baselines, bad_antennas, report_lines).
- orca.transform.hot_baselines.apply_flags_to_ms(ms_name: str, bad_antennas: Set[int], bad_baselines: List[Tuple[int, int]]) None[source]
Flag bad antennas and baselines in the MS FLAG column.
- orca.transform.hot_baselines.plot_heatmap(matrix: numpy.ndarray, title: str, filename: str, vmin: float | None = None, vmax: float | None = None, grid_lines: List[float] | None = None, axis_ticks: numpy.ndarray | None = None, axis_labels: numpy.ndarray | None = None) None[source]
Save a single heatmap as a PNG.
- orca.transform.hot_baselines.plot_diagnosis_figure(matrix: numpy.ndarray, bad_antennas: Set[int], bad_baselines: List[Tuple[int, int]], filename: str, uv_baselines: List[Tuple[int, int]] | None = None) None[source]
Save a two-panel diagnosis heatmap with overlays.
- orca.transform.hot_baselines.run_diagnostics(args_obj, run_logger=None) None[source]
Run the full hot-baseline analysis on a concatenated MS.
- Parameters:
args_obj – Object with attributes
ms,col,uv_cut,uv_cut_lambda,sigma,uv_sigma,threshold,apply_antenna_flags,apply_baseline_flags,run_uv,run_heatmap.run_logger – Optional logger; defaults to module logger.