Nightly Per-Antenna Quality Summary Notebook¶

Josh Dillon, Last Revised February 2021

This notebooks brings together as much information as possible from ant_metrics, auto_metrics and redcal to help figure out which antennas are working properly and summarizes it in a single giant table. It is meant to be lightweight and re-run as often as necessary over the night, so it can be run when any of those is done and then be updated when another one completes.

Contents:¶

  • Table 1: Overall Array Health
  • Table 2: RTP Per-Antenna Metrics Summary Table
  • Figure 1: Array Plot of Flags and A Priori Statuses
In [1]:
import os
os.environ['HDF5_USE_FILE_LOCKING'] = 'FALSE'
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import pandas as pd
pd.set_option('display.max_rows', 1000)
from hera_qm.metrics_io import load_metric_file
from hera_cal import utils, io, redcal
import glob
import h5py
from copy import deepcopy
from IPython.display import display, HTML
from hera_notebook_templates.utils import status_colors
from hera_mc import mc
from pyuvdata import UVData

%matplotlib inline
%config InlineBackend.figure_format = 'retina'
display(HTML("<style>.container { width:100% !important; }</style>"))
In [2]:
# If you want to run this notebook locally, copy the output of the next cell into the first few lines of this cell.

# JD = "2459122"
# data_path = '/lustre/aoc/projects/hera/H4C/2459122'
# ant_metrics_ext = ".ant_metrics.hdf5"
# redcal_ext = ".maybe_good.omni.calfits"
# nb_outdir = '/lustre/aoc/projects/hera/H4C/h4c_software/H4C_Notebooks/_rtp_summary_'
# good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
# os.environ["JULIANDATE"] = JD
# os.environ["DATA_PATH"] = data_path
# os.environ["ANT_METRICS_EXT"] = ant_metrics_ext
# os.environ["REDCAL_EXT"] = redcal_ext
# os.environ["NB_OUTDIR"] = nb_outdir
# os.environ["GOOD_STATUSES"] = good_statuses
In [3]:
# Use environment variables to figure out path to data
JD = os.environ['JULIANDATE']
data_path = os.environ['DATA_PATH']
ant_metrics_ext = os.environ['ANT_METRICS_EXT']
redcal_ext = os.environ['REDCAL_EXT']
nb_outdir = os.environ['NB_OUTDIR']
good_statuses = os.environ['GOOD_STATUSES']
print(f'JD = "{JD}"')
print(f'data_path = "{data_path}"')
print(f'ant_metrics_ext = "{ant_metrics_ext}"')
print(f'redcal_ext = "{redcal_ext}"')
print(f'nb_outdir = "{nb_outdir}"')
print(f'good_statuses = "{good_statuses}"')
JD = "2459831"
data_path = "/mnt/sn1/2459831"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 9-8-2022
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

# find the auto_metrics file
glob_str = os.path.join(data_path, f'zen.{JD}*.auto_metrics.h5')
auto_metrics_file = sorted(glob.glob(glob_str))

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2459831/zen.2459831.33286.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

# get a list of all ant_metrics files
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{ant_metrics_ext}')
ant_metrics_files = sorted(glob.glob(glob_str))

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1506 ant_metrics files matching glob /mnt/sn1/2459831/zen.2459831.?????.sum.ant_metrics.hdf5

Load chi^2 info from redcal¶

In [8]:
use_redcal = False
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{redcal_ext}')

redcal_files = sorted(glob.glob(glob_str))
if len(redcal_files) > 0:
    print(f'Found {len(redcal_files)} ant_metrics files matching glob {glob_str}')
    post_redcal_ant_flags_dict = {}
    flagged_by_redcal_dict = {}
    cspa_med_dict = {}
    for cal in redcal_files:
        hc = io.HERACal(cal)
        _, flags, cspa, chisq = hc.read()
        cspa_med_dict[cal] = {ant: np.nanmedian(cspa[ant], axis=1) for ant in cspa}

        post_redcal_ant_flags_dict[cal] = {ant: np.all(flags[ant]) for ant in flags}
        # check history to distinguish antennas flagged going into redcal from ones flagged during redcal
        tossed_antenna_lines =  hc.history.replace('\n','').split('Throwing out antenna ')[1:]
        flagged_by_redcal_dict[cal] = sorted([int(line.split(' ')[0]) for line in tossed_antenna_lines])
        
    use_redcal = True
else:
    print(f'No files found matching glob {glob_str}. Skipping redcal chisq.')
No files found matching glob /mnt/sn1/2459831/zen.2459831.?????.sum.known_good.omni.calfits. Skipping redcal chisq.

Figure out some general properties¶

In [9]:
# Parse some general array properties, taking into account the fact that we might be missing some of the metrics
ants = []
pols = []
antpol_pairs = []

if use_auto_metrics:
    ants = sorted(set(bl[0] for bl in auto_metrics['modzs']['r2_shape_modzs']))
    pols = sorted(set(bl[2] for bl in auto_metrics['modzs']['r2_shape_modzs']))
if use_ant_metrics:
    antpol_pairs = sorted(set([antpol for dms in ant_metrics_dead_metrics.values() for antpol in dms.keys()]))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))
if use_redcal:
    antpol_pairs = sorted(set([ant for cspa in cspa_med_dict.values() for ant in cspa.keys()]) | set(antpol_pairs))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))

# Figure out remaining antennas not in data and also LST range
data_files = sorted(glob.glob(os.path.join(data_path, 'zen.*.sum.uvh5')))
hd = io.HERAData(data_files[0])
unused_ants = [ant for ant in hd.antpos if ant not in ants]    
hd_last = io.HERAData(data_files[-1])

Load a priori antenna statuses and node numbers¶

In [10]:
# try to load a priori antenna statusesm but fail gracefully if this doesn't work.
a_priori_statuses = {ant: 'Not Found' for ant in ants}
nodes = {ant: np.nan for ant in ants + unused_ants}
try:
    from hera_mc import cm_hookup

    # get node numbers
    hookup = cm_hookup.get_hookup('default')
    for ant_name in hookup:
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in nodes:
            if hookup[ant_name].get_part_from_type('node')['E<ground'] is not None:
                nodes[ant] = int(hookup[ant_name].get_part_from_type('node')['E<ground'][1:])
    
    # get apriori antenna status
    for ant_name, data in hookup.items():
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in a_priori_statuses:
            a_priori_statuses[ant] = data.apriori

except Exception as err:
    print(f'Could not load node numbers and a priori antenna statuses.\nEncountered {type(err)} with message: {err}')

Summarize auto metrics¶

In [11]:
if use_auto_metrics:
    # Parse modzs
    modzs_to_check = {'Shape': 'r2_shape_modzs', 'Power': 'r2_power_modzs', 
                      'Temporal Variability': 'r2_temp_var_modzs', 'Temporal Discontinuties': 'r2_temp_diff_modzs'}
    worst_metrics = []
    worst_zs = []
    all_modzs = {}
    binary_flags = {rationale: [] for rationale in modzs_to_check}

    for ant in ants:
        # parse modzs and figure out flag counts
        modzs = {f'{pol} {rationale}': auto_metrics['modzs'][dict_name][(ant, ant, pol)] 
                 for rationale, dict_name in modzs_to_check.items() for pol in pols}
        for pol in pols:
            for rationale, dict_name in modzs_to_check.items():
                binary_flags[rationale].append(auto_metrics['modzs'][dict_name][(ant, ant, pol)] > mean_round_modz_cut)

        # parse out all metrics for dataframe
        for k in modzs:
            col_label = k + ' Modified Z-Score'
            if col_label in all_modzs:
                all_modzs[col_label].append(modzs[k])
            else:
                all_modzs[col_label] = [modzs[k]]
                
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
else:
    mean_round_modz_cut = 0

Summarize ant metrics¶

In [12]:
if use_ant_metrics:
    a_priori_flag_frac = {ant: np.mean([ant in apxa for apxa in ant_metrics_apriori_exants.values()]) for ant in ants}
    dead_ant_frac = {ap: {ant: np.mean([(ant, ap) in das for das in ant_metrics_dead_ants_dict.values()])
                                 for ant in ants} for ap in antpols}
    crossed_ant_frac = {ant: np.mean([np.any([(ant, ap) in cas for ap in antpols])
                                      for cas in ant_metrics_crossed_ants_dict.values()]) for ant in ants}
    ant_metrics_xants_frac_by_antpol = {antpol: np.mean([antpol in amx for amx in ant_metrics_xants_dict.values()]) for antpol in antpol_pairs}
    ant_metrics_xants_frac_by_ant = {ant: np.mean([np.any([(ant, ap) in amx for ap in antpols])
                                     for amx in ant_metrics_xants_dict.values()]) for ant in ants}
    average_dead_metrics = {ap: {ant: np.nanmean([dm.get((ant, ap), np.nan) for dm in ant_metrics_dead_metrics.values()]) 
                                 for ant in ants} for ap in antpols}
    average_crossed_metrics = {ant: np.nanmean([cm.get((ant, ap), np.nan) for ap in antpols 
                                                for cm in ant_metrics_crossed_metrics.values()]) for ant in ants}
else:
    dead_cut = 0.4
    crossed_cut = 0.0

Summarize redcal chi^2 metrics¶

In [13]:
if use_redcal:
    cspa = {ant: np.nanmedian(np.hstack([cspa_med_dict[cal][ant] for cal in redcal_files])) for ant in antpol_pairs}
    redcal_prior_flag_frac = {ant: np.mean([np.any([afd[ant, ap] and not ant in flagged_by_redcal_dict[cal] for ap in antpols])
                                            for cal, afd in post_redcal_ant_flags_dict.items()]) for ant in ants}
    redcal_flagged_frac = {ant: np.mean([ant in fbr for fbr in flagged_by_redcal_dict.values()]) for ant in ants}

Get FEM switch states¶

In [14]:
HHautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.sum.autos.uvh5"))
diffautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.diff.autos.uvh5"))

try:
    db = mc.connect_to_mc_db(None)
    session = db.sessionmaker()
    startJD = float(HHautos[0].split('zen.')[1].split('.sum')[0])
    stopJD = float(HHautos[-1].split('zen.')[1].split('.sum')[0])
    startTime = Time(startJD,format='jd')
    stopTime = Time(stopJD,format='jd')
    res = session.get_antenna_status(starttime=startTime, stoptime=stopTime)
    fem_switches = {}
    if len(res) == 0:
        femState = None
    else:
        for antpol in res:
            fem_switches[(antpol.antenna_number, antpol.antenna_feed_pol)] = antpol.fem_switch
    femState = (max(set(list(fem_switches.values())), key = list(fem_switches.values()).count)) 
except Exception as e:
    print(e)
    femState = None

Find X-engine Failures¶

In [15]:
read_inds = [1, len(HHautos)//2, -2]
x_status = [1,1,1,1,1,1,1,1]
s = UVData()
s.read(HHautos[1])

nants = len(s.get_ants())
freqs = s.freq_array[0]*1e-6
nfreqs = len(freqs)

antCon = {a: None for a in ants}
rightAnts = []
for i in read_inds:
    s = UVData()
    d = UVData()
    s.read(HHautos[i])
    d.read(diffautos[i])
    for pol in [0,1]:
        sm = np.abs(s.data_array[:,0,:,pol])
        df = np.abs(d.data_array[:,0,:,pol])
        sm = np.r_[sm, np.nan + np.zeros((-len(sm) % nants,len(freqs)))]
        sm = np.nanmean(sm.reshape(-1,nants,nfreqs),axis=1)
        df = np.r_[df, np.nan + np.zeros((-len(df) % nants,len(freqs)))]
        df = np.nanmean(df.reshape(-1,nants,nfreqs),axis=1)

        evens = (sm + df)/2
        odds = (sm - df)/2
        rat = np.divide(evens,odds)
        rat = np.nan_to_num(rat)
        for xbox in range(0,8):
            xavg = np.nanmean(rat[:,xbox*192:(xbox+1)*192],axis=1)
            if np.nanmax(xavg)>1.5 or np.nanmin(xavg)<0.5:
                x_status[xbox] = 0
    for ant in ants:
        for pol in ["xx", "yy"]:
            if antCon[ant] is False:
                continue
            spectrum = s.get_data(ant, ant, pol)
            stdev = np.std(spectrum)
            med = np.median(np.abs(spectrum))
            if (femState == "load" or femState == 'noise') and 80000 < stdev <= 4000000 and antCon[ant] is not False:
                antCon[ant] = True
            elif femState == "antenna" and stdev > 500000 and med > 950000 and antCon[ant] is not False:
                antCon[ant] = True
            else:
                antCon[ant] = False
            if np.min(np.abs(spectrum)) < 100000:
                antCon[ant] = False
for ant in ants:
    if antCon[ant] is True:
        rightAnts.append(ant)
            
x_status_str = ''
for i,x in enumerate(x_status):
    if x==0:
        x_status_str += '\u274C '
    else:
        x_status_str += '\u2705 '

Build Overall Health DataFrame¶

In [16]:
def comma_sep_paragraph(vals, chars_per_line=40):
    outstrs = []
    for val in vals:
        if (len(outstrs) == 0) or (len(outstrs[-1]) > chars_per_line):
            outstrs.append(str(val))
        else:
            outstrs[-1] += ', ' + str(val)
    return ',<br>'.join(outstrs)
In [17]:
# Time data
to_show = {'JD': [JD]}
to_show['Date'] = f'{utc.month}-{utc.day}-{utc.year}'
to_show['LST Range'] = f'{hd.lsts[0] * 12 / np.pi:.3f} -- {hd_last.lsts[-1] * 12 / np.pi:.3f} hours'

# X-engine status
to_show['X-Engine Status'] = x_status_str

# Files
to_show['Number of Files'] = len(data_files)

# Antenna Calculations
to_show['Total Number of Antennas'] = len(ants)

to_show[' '] = ''
to_show['OPERATIONAL STATUS SUMMARY'] = ''

status_count = {status: 0 for status in status_colors}
for ant, status in a_priori_statuses.items():
    if status in status_count:
        status_count[status] = status_count[status] + 1
    else:
        status_count[status] = 1
to_show['Antenna A Priori Status Count'] = '<br>'.join([f'{status}: {status_count[status]}' for status in status_colors if status in status_count and status_count[status] > 0])

to_show['Commanded Signal Source'] = femState
to_show['Antennas in Commanded State'] = f'{len(rightAnts)} / {len(ants)} ({len(rightAnts) / len(ants):.1%})'

if use_ant_metrics:
    to_show['Cross-Polarized Antennas'] = ', '.join([str(ant) for ant in ants if (np.max([dead_ant_frac[ap][ant] for ap in antpols]) + crossed_ant_frac[ant] == 1) 
                                                                                 and (crossed_ant_frac[ant] > .5)])

# Node calculations
nodes_used = set([nodes[ant] for ant in ants if np.isfinite(nodes[ant])])
to_show['Total Number of Nodes'] = len(nodes_used)
if use_ant_metrics:
    node_off = {node: True for node in nodes_used}
    not_correlating = {node: True for node in nodes_used}
    for ant in ants:
        for ap in antpols:
            if np.isfinite(nodes[ant]):
                if np.isfinite(average_dead_metrics[ap][ant]):
                    node_off[nodes[ant]] = False
                if dead_ant_frac[ap][ant] < 1:
                    not_correlating[nodes[ant]] = False
    to_show['Nodes Registering 0s'] = ', '.join([f'N{n:02}' for n in sorted([node for node in node_off if node_off[node]])])
    to_show['Nodes Not Correlating'] = ', '.join([f'N{n:02}' for n in sorted([node for node in not_correlating if not_correlating[node] and not node_off[node]])])

# Pipeline calculations    
to_show['  '] = ''
to_show['NIGHTLY ANALYSIS SUMMARY'] = ''
    
all_flagged_ants = []
if use_ant_metrics:
    to_show['Ant Metrics Done?'] = '\u2705'
    ant_metrics_flagged_ants = [ant for ant in ants if ant_metrics_xants_frac_by_ant[ant] > 0]
    all_flagged_ants.extend(ant_metrics_flagged_ants)
    to_show['Ant Metrics Flagged Antennas'] = f'{len(ant_metrics_flagged_ants)} / {len(ants)} ({len(ant_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Ant Metrics Done?'] = '\u274C'
if use_auto_metrics:
    to_show['Auto Metrics Done?'] = '\u2705'
    auto_metrics_flagged_ants = [ant for ant in ants if ant in auto_ex_ants]
    all_flagged_ants.extend(auto_metrics_flagged_ants)    
    to_show['Auto Metrics Flagged Antennas'] = f'{len(auto_metrics_flagged_ants)} / {len(ants)} ({len(auto_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Auto Metrics Done?'] = '\u274C'
if use_redcal:
    to_show['Redcal Done?'] = '\u2705'    
    redcal_flagged_ants = [ant for ant in ants if redcal_flagged_frac[ant] > 0]
    all_flagged_ants.extend(redcal_flagged_ants)    
    to_show['Redcal Flagged Antennas'] = f'{len(redcal_flagged_ants)} / {len(ants)} ({len(redcal_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Redcal Done?'] = '\u274C' 
to_show['Never Flagged Antennas'] = f'{len(ants) - len(set(all_flagged_ants))} / {len(ants)} ({(len(ants) - len(set(all_flagged_ants))) / len(ants):.1%})'

# Count bad antennas with good statuses and vice versa
n_apriori_good = len([ant for ant in ants if a_priori_statuses[ant] in good_statuses.split(',')])
apriori_good_flagged = []
aprior_bad_unflagged = []
for ant in ants:
    if ant in set(all_flagged_ants) and a_priori_statuses[ant] in good_statuses.split(','):
        apriori_good_flagged.append(ant)
    elif ant not in set(all_flagged_ants) and a_priori_statuses[ant] not in good_statuses.split(','):
        aprior_bad_unflagged.append(ant)
to_show['A Priori Good Antennas Flagged'] = f'{len(apriori_good_flagged)} / {n_apriori_good} total a priori good antennas:<br>' + \
                                            comma_sep_paragraph(apriori_good_flagged)
to_show['A Priori Bad Antennas Not Flagged'] = f'{len(aprior_bad_unflagged)} / {len(ants) - n_apriori_good} total a priori bad antennas:<br>' + \
                                            comma_sep_paragraph(aprior_bad_unflagged)

# Apply Styling
df = pd.DataFrame(to_show)
divider_cols = [df.columns.get_loc(col) for col in ['NIGHTLY ANALYSIS SUMMARY', 'OPERATIONAL STATUS SUMMARY']]
try:
    to_red_columns = [df.columns.get_loc(col) for col in ['Cross-Polarized Antennas', 'Nodes Registering 0s', 
                                                          'Nodes Not Correlating', 'A Priori Good Antennas Flagged']]
except:
    to_red_columns = []
def red_specific_cells(x):
    df1 = pd.DataFrame('', index=x.index, columns=x.columns)
    for col in to_red_columns:
        df1.iloc[col] = 'color: red'
    return df1

df = df.T
table = df.style.hide_columns().apply(red_specific_cells, axis=None)
for col in divider_cols:
    table = table.set_table_styles([{"selector":f"tr:nth-child({col+1})", "props": [("background-color", "black"), ("color", "white")]}], overwrite=False)

Table 1: Overall Array Health¶

In [18]:
HTML(table.render())
Out[18]:
JD 2459831
Date 9-8-2022
LST Range 20.606 -- 4.711 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1506
Total Number of Antennas 139
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 3
RF_maintenance: 32
RF_ok: 3
digital_maintenance: 3
digital_ok: 95
not_connected: 3
Commanded Signal Source None
Antennas in Commanded State 0 / 139 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 14
Nodes Registering 0s N18
Nodes Not Correlating N01, N02, N03, N04, N05, N08, N09, N10, N12, N13, N14, N15
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 139 / 139 (100.0%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 83 / 139 (59.7%)
Redcal Done? ❌
Never Flagged Antennas 0 / 139 (0.0%)
A Priori Good Antennas Flagged 95 / 95 total a priori good antennas:
3, 5, 7, 9, 10, 15, 16, 17, 19, 20, 21, 29,
30, 31, 37, 38, 40, 41, 42, 45, 46, 51, 53,
54, 55, 56, 65, 66, 67, 68, 69, 71, 72, 73,
81, 83, 84, 85, 86, 88, 91, 93, 94, 98, 99,
100, 101, 103, 105, 106, 107, 108, 109, 111,
112, 116, 117, 118, 121, 122, 123, 127, 128,
129, 130, 140, 141, 142, 143, 144, 156, 157,
158, 160, 161, 162, 163, 164, 165, 167, 169,
170, 176, 177, 178, 179, 181, 183, 184, 185,
186, 187, 189, 190, 191
A Priori Bad Antennas Not Flagged 0 / 44 total a priori bad antennas:
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459831.csv

Build DataFrame¶

In [20]:
# build dataframe
to_show = {'Ant': [f'<a href="{ant_to_report_url(ant)}" target="_blank">{ant}</a>' for ant in ants],
           'Node': [f'N{nodes[ant]:02}' for ant in ants], 
           'A Priori Status': [a_priori_statuses[ant] for ant in ants]}
           #'Worst Metric': worst_metrics, 'Worst Modified Z-Score': worst_zs}
df = pd.DataFrame(to_show)

# create bar chart columns for flagging percentages:
bar_cols = {}
if use_auto_metrics:
    bar_cols['Auto Metrics Flags'] = [float(ant in auto_ex_ants) for ant in ants]
if use_ant_metrics:
    if np.sum(list(a_priori_flag_frac.values())) > 0:  # only include this col if there are any a priori flags
        bar_cols['A Priori Flag Fraction in Ant Metrics'] = [a_priori_flag_frac[ant] for ant in ants]
    for ap in antpols:
        bar_cols[f'Dead Fraction in Ant Metrics ({ap})'] = [dead_ant_frac[ap][ant] for ant in ants]
    bar_cols['Crossed Fraction in Ant Metrics'] = [crossed_ant_frac[ant] for ant in ants]
if use_redcal:
    bar_cols['Flag Fraction Before Redcal'] = [redcal_prior_flag_frac[ant] for ant in ants]
    bar_cols['Flagged By Redcal chi^2 Fraction'] = [redcal_flagged_frac[ant] for ant in ants]  
for col in bar_cols:
    df[col] = bar_cols[col]

# add auto_metrics
if use_auto_metrics:
    for label, modz in all_modzs.items():
        df[label] = modz
z_score_cols = [col for col in df.columns if 'Modified Z-Score' in col]        
        
# add ant_metrics
ant_metrics_cols = {}
if use_ant_metrics:
    for ap in antpols:
        ant_metrics_cols[f'Average Dead Ant Metric ({ap})'] = [average_dead_metrics[ap][ant] for ant in ants]
    ant_metrics_cols['Average Crossed Ant Metric'] = [average_crossed_metrics[ant] for ant in ants]
    for col in ant_metrics_cols:
        df[col] = ant_metrics_cols[col]   

# add redcal chisq
redcal_cols = []
if use_redcal:
    for ap in antpols:
        col_title = f'Median chi^2 Per Antenna ({ap})'
        df[col_title] = [cspa[ant, ap] for ant in ants]
        redcal_cols.append(col_title)

# sort by node number and then by antenna number within nodes
df.sort_values(['Node', 'Ant'], ascending=True)

# style dataframe
table = df.style.hide_index()\
          .applymap(lambda val: f'background-color: {status_colors[val]}' if val in status_colors else '', subset=['A Priori Status']) \
          .background_gradient(cmap='viridis', vmax=mean_round_modz_cut * 3, vmin=0, axis=None, subset=z_score_cols) \
          .background_gradient(cmap='bwr_r', vmin=dead_cut-.25, vmax=dead_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .background_gradient(cmap='bwr_r', vmin=crossed_cut-.25, vmax=crossed_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .background_gradient(cmap='plasma', vmax=4, vmin=1, axis=None, subset=redcal_cols) \
          .applymap(lambda val: 'font-weight: bold' if val < dead_cut else '', subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val < crossed_cut else '', subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .applymap(lambda val: 'color: red' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .bar(subset=list(bar_cols.keys()), vmin=0, vmax=1) \
          .format({col: '{:,.4f}'.format for col in z_score_cols}) \
          .format({col: '{:,.4f}'.format for col in ant_metrics_cols}) \
          .format({col: '{:,.2%}'.format for col in bar_cols}) \
          .applymap(lambda val: 'font-weight: bold', subset=['Ant']) \
          .set_table_styles([dict(selector="th",props=[('max-width', f'70pt')])])

Table 2: RTP Per-Antenna Metrics Summary Table¶

This admittedly very busy table incorporates summary information about all antennas in the array. Its columns depend on what information is available when the notebook is run (i.e. whether auto_metrics, ant_metrics, and/or redcal is done). These can be divided into 5 sections:

Basic Antenna Info: antenna number, node, and its a priori status.

Flag Fractions: Fraction of the night that an antenna was flagged for various reasons. Note that auto_metrics flags antennas for the whole night, so it'll be 0% or 100%.

auto_metrics Details: If auto_metrics is included, this section shows the modified Z-score signifying how much of an outlier each antenna and polarization is in each of four categories: bandpass shape, overall power, temporal variability, and temporal discontinuities. Bold red text indicates that this is a reason for flagging the antenna. It is reproduced from the auto_metrics_inspect.ipynb nightly notebook, so check that out for more details on the precise metrics.

ant_metrics Details: If ant_metrics is included, this section shows the average correlation-based metrics for antennas over the whole night. Low "dead ant" metrics (nominally below 0.4) indicate antennas not correlating with the rest of the array. Negative "crossed ant" metrics indicate antennas that show stronger correlations in their cross-pols than their same-pols, indicating that the two polarizations are probably swapped. Bold text indicates that the average is below the threshold for flagging.

redcal chi^2 Details: If redcal is included, this shows the median chi^2 per antenna. This would be 1 in an ideal array. Antennas are thrown out when they they are outliers in their median chi^2, usually greater than 4-sigma outliers in modified Z-score.

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 0.00% 100.00% 100.00% 0.00% 1.014442 0.729882 -0.631616 0.537001 -0.167571 -1.302506 0.856504 0.215576 0.028691 0.032482 0.002516
4 N01 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.290291 1.117707 0.890450 0.247143 0.578928 -0.383432 1.506070 -0.302617 0.055915 0.040489 0.003121
5 N01 digital_ok 0.00% 100.00% 100.00% 0.00% 0.796548 1.348512 -0.716854 -0.015933 -0.216753 -1.129864 -0.242161 -1.361451 0.075259 0.055729 0.004746
7 N02 digital_ok 0.00% 100.00% 100.00% 0.00% -0.027462 1.768013 -0.669881 -0.007159 0.220334 -0.791950 0.732274 0.449882 0.037194 0.040312 0.001224
8 N02 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.842656 0.025281 0.151424 0.023793 -0.584124 0.364392 3.212472 4.612212 0.048088 0.051510 0.001794
9 N02 digital_ok 0.00% 100.00% 100.00% 0.00% -1.158647 -0.096655 0.133957 1.251410 -0.266352 0.351718 0.577953 0.599503 0.030291 0.034779 0.000994
10 N02 digital_ok 0.00% 100.00% 100.00% 0.00% 0.361339 -0.733262 1.019125 0.024895 -0.173231 -0.992856 0.722670 -0.291608 0.032448 0.040068 0.000268
15 N01 digital_ok 0.00% 100.00% 100.00% 0.00% -1.141439 -0.784983 -1.349075 -0.169142 -0.180779 -0.247127 -0.239566 0.262282 0.029893 0.032963 0.002738
16 N01 digital_ok 0.00% 100.00% 100.00% 0.00% -0.631051 1.028792 -1.107752 -0.028552 -0.244226 -0.228640 0.224012 -0.254115 0.029295 0.036824 0.004164
17 N01 digital_ok 0.00% 100.00% 100.00% 0.00% 1.307372 1.631253 -0.677659 0.624245 -0.142507 -0.683746 -0.340084 0.089036 0.031303 0.033347 0.001495
18 N01 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.518282 0.006008 -0.848202 0.132247 -0.397041 0.466315 -0.058032 0.722375 0.041945 0.042744 0.008187
19 N02 digital_ok 0.00% 100.00% 100.00% 0.00% -0.233977 -0.143151 0.071990 0.032558 -0.680503 -0.017153 -0.647490 -0.154567 0.032383 0.041361 0.001423
20 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 0.678374 1.308374 26.190240 1.455334 11.943685 11.025577 43.020648 32.923654 0.031671 0.044034 0.004244
21 N02 digital_ok 100.00% 100.00% 100.00% 0.00% -0.976289 2.050415 -0.443032 3.356254 1.047418 0.296659 1.492222 1.874715 0.029872 0.047779 0.005905
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.348503 0.007238 -0.302542 -1.010644 1.488033 0.898940 7.974624 4.233333 0.045064 0.048341 0.002066
28 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.253390 2.533174 0.354516 -0.314777 -0.369923 2.736196 -0.460770 7.613575 0.046467 0.053274 0.002912
29 N01 digital_ok 0.00% 100.00% 100.00% 0.00% 0.203120 0.267748 0.882457 0.254599 -0.718225 -1.208603 -0.883601 -0.820611 0.041748 0.043178 0.003616
30 N01 digital_ok 0.00% 100.00% 100.00% 0.00% -1.085672 -0.480268 -0.002702 0.022453 0.719597 0.074985 -0.200220 1.724959 0.027845 0.030962 0.000967
31 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 8.349662 0.354338 62.897778 1.914086 3.083580 -0.043551 22.625634 3.146816 0.021266 0.029759 0.003862
32 N02 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.198557 1.044041 -0.161707 0.677463 1.004664 0.602369 -0.868663 1.164962 0.032695 0.041393 0.000616
33 N02 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.641921 3.733518 -0.290408 4.036640 -0.148712 -0.981293 0.798235 2.931446 0.047743 0.045359 0.005551
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 20.293840 18.805289 42.843357 36.065268 6.638884 6.135119 15.736383 17.063723 0.021110 0.020935 0.000663
37 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 14.938500 10.583950 29.721429 27.259611 2.451502 1.273724 13.786471 7.924697 0.021627 0.020852 0.000730
38 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 19.144488 14.468216 41.231880 36.192899 2.758228 2.913445 14.857469 16.101935 0.020342 0.021059 0.000680
40 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 1.049747 1.268683 1.326822 2.507522 -0.546900 -0.555361 -0.066608 1.091929 0.034303 0.039197 0.001523
41 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.017015 0.668232 -0.434502 2.037048 -0.188733 -0.931880 -0.571821 -0.959011 0.042500 0.042553 0.002260
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 0.908284 2.342708 1.676880 3.394467 6.589157 9.776003 0.571298 1.742219 0.030605 0.033928 0.002210
45 N05 digital_ok 0.00% 100.00% 100.00% 0.00% -0.964068 -0.736239 1.217695 1.477257 1.366100 3.342578 0.458780 0.775813 0.025531 0.028165 0.001965
46 N05 digital_ok 0.00% 100.00% 100.00% 0.00% -0.683280 1.481289 -1.223331 -0.492849 -1.289860 -0.257010 -0.959564 0.373274 0.025211 0.031426 0.003972
50 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 18.975244 12.569699 40.104643 34.594871 2.186586 1.028429 14.357333 10.477671 0.020170 0.020370 0.000380
51 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 16.627645 12.636503 34.817276 35.523997 3.711488 3.050134 21.700761 14.776034 0.021406 0.020022 0.000911
52 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 19.736520 15.695324 42.291937 37.273925 4.404646 2.384198 20.629681 14.446747 0.022419 0.020500 0.001137
53 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 15.878274 11.132786 35.256449 35.540281 56.081877 62.092970 151.949630 171.672679 0.024129 0.022457 0.000771
54 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.531910 -0.549216 -1.052095 1.343212 -0.668479 -0.895905 -0.206040 0.774682 0.035457 0.042415 0.001569
55 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.511329 1.461632 0.368192 0.343624 -1.282820 -1.682292 0.500410 0.853583 0.047383 0.063156 0.002112
56 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.392414 -0.318171 -0.455618 2.244220 0.725164 0.822288 0.261231 0.533938 0.045297 0.040147 0.006144
57 N04 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.229600 -0.439949 4.709024 2.703703 2.573753 1.900663 0.604808 -0.195424 0.042704 0.045904 0.007789
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 16.770867 11.179507 38.995028 32.968505 3.291103 3.586342 14.680715 18.217097 0.021728 0.020378 0.001095
66 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 17.203616 11.955180 38.812345 35.366557 3.272949 3.526635 14.361110 18.851245 0.020326 0.020508 0.000388
67 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 14.344196 11.361008 28.386118 27.968118 0.734784 3.011207 8.741429 17.229398 0.020739 0.020436 0.000363
68 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 18.528172 16.590712 39.849140 42.728581 2.057609 3.137750 16.485113 21.579004 0.022892 0.021234 0.001404
69 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.154322 1.335235 -0.359734 1.412400 0.649096 0.765097 1.068327 0.130382 0.042452 0.043636 0.002555
70 N04 RF_maintenance 100.00% 100.00% 100.00% 0.00% 15.674380 0.602958 39.654066 -0.598132 2.723431 -1.173532 23.496090 0.182202 0.020622 0.040093 0.006581
71 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 1.258300 2.084997 -0.703593 0.829564 -1.109888 -1.405269 0.241027 -0.146848 0.045213 0.036172 0.002174
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% -0.856848 -0.405035 -0.488023 3.982738 0.937315 -0.329987 1.696374 1.203954 0.032292 0.037085 0.000878
73 N05 digital_ok 0.00% 100.00% 100.00% 0.00% 0.120856 -0.225008 -0.229677 -0.136401 0.739007 2.479249 1.012555 0.703970 0.025687 0.033488 0.002914
81 N07 digital_ok 100.00% 0.00% 55.11% 0.00% 2.585154 2.249982 18.137729 15.990185 3.655132 2.734674 -1.537775 0.431425 0.560179 0.301962 0.049098
82 N07 RF_maintenance 100.00% 0.00% 55.11% 0.00% 2.954554 0.403556 20.390631 17.728664 5.455424 3.768459 -0.168096 1.949944 0.519544 0.403030 0.049507
83 N07 digital_ok 100.00% 100.00% 55.11% 0.00% 0.110682 3.345320 16.530689 17.632962 6.286092 7.427778 -1.108251 -2.007899 0.128308 0.330836 0.028398
84 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
85 N08 digital_ok 100.00% 100.00% 100.00% 0.00% -0.085276 -0.366573 21.468412 22.911670 4.185265 3.309194 -1.621337 -1.460901 0.027910 0.026341 0.001730
86 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 0.911654 0.025822 17.120836 18.575832 2.047847 1.133455 -1.412641 -1.467964 0.034797 0.027228 0.001771
87 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 15.525595 10.944973 21.067548 18.077241 2.561873 1.216044 12.628855 7.745545 0.027291 0.024753 0.001216
88 N09 digital_ok 100.00% 100.00% 100.00% 0.00% 2.352295 0.915728 16.524761 16.977433 7.039792 4.707929 13.724379 5.097050 0.041475 0.043133 0.002764
90 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.079061 0.738892 16.525726 17.949886 4.298558 4.609595 -1.319926 -2.277147 0.041669 0.043925 0.001272
91 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.130765 1.566781 -0.029797 -0.314137 0.884274 4.750336 0.267424 0.628691 0.033478 0.033844 0.004725
93 N10 digital_ok 0.00% 100.00% 100.00% 0.00% -1.082742 0.713627 -1.281409 0.601126 0.702185 -0.076170 0.036486 1.454221 0.030667 0.035856 0.002652
94 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 0.027675 -0.949881 1.443644 -1.138712 2.306900 0.513733 3.478663 -0.081432 0.029435 0.032662 0.001883
98 N07 digital_ok 100.00% 44.89% 44.89% 0.00% 0.007958 1.730085 20.955012 22.226568 1.522794 2.014899 -0.968680 -1.494683 0.255589 0.317171 0.034195
99 N07 digital_ok 100.00% 100.00% 44.89% 0.00% 1.929047 5.444400 19.271955 20.742308 3.393306 4.126370 -1.522947 -0.499139 0.238734 0.336981 0.038608
100 N07 digital_ok 100.00% 44.89% 100.00% 0.00% 2.346455 3.444749 18.687829 14.705990 6.351062 4.777531 -0.541828 -1.317277 0.397344 0.259181 0.073257
101 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 12.821804 11.267256 16.135728 14.827342 1.867609 2.017631 7.630102 8.570516 0.025209 0.023171 0.001109
102 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.526564 0.713345 67.259584 71.399685 1637.443951 1649.668249 16474.770130 16530.657947 0.031555 0.027196 0.001441
103 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 14.120244 15.291312 16.782120 16.465611 4.211984 4.173143 11.821337 8.348804 0.022151 0.021803 0.000388
104 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 15.726579 120.633622 15.892478 155.197105 3.243899 74.283814 5.013747 666.212646 0.023459 0.019104 0.004224
105 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
106 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
107 N09 digital_ok 100.00% 100.00% 100.00% 0.00% -0.403557 1.098050 22.366713 23.164363 5.919391 5.326940 0.772618 2.166866 0.029578 0.026981 0.001298
108 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
109 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 0.414179 1.221504 -0.217172 1.088131 -0.522044 -1.498029 0.229417 -1.282522 0.051461 0.036792 0.002354
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 18.576982 15.796618 40.881210 38.450815 1.094991 0.665971 14.114827 13.630626 0.020892 0.022499 0.000590
111 N10 digital_ok 0.00% 100.00% 100.00% 0.00% -0.448644 0.155739 -0.843826 -0.141238 -0.293946 -0.204383 -0.479896 -0.700227 0.028531 0.027403 0.000424
112 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 0.877494 0.783602 0.313924 0.069880 0.275755 0.127927 -1.236599 -0.579634 0.026869 0.026490 0.001779
116 N07 digital_ok 100.00% 100.00% 44.89% 0.00% 1.490665 3.208606 16.367146 16.976767 7.349146 6.690388 -0.863057 -2.030083 0.241366 0.306536 0.015975
117 N07 digital_ok 100.00% 100.00% 44.89% 0.00% 1.706109 0.155805 18.232628 17.566711 6.364690 4.960690 -0.509843 -1.923339 0.216635 0.251240 0.056364
118 N07 digital_ok 100.00% 100.00% 44.89% 0.00% 1.216905 1.177736 18.403604 16.394252 7.454913 5.892588 -1.610701 -2.662710 0.191830 0.265648 0.022481
119 N07 RF_maintenance 100.00% 77.42% 100.00% 0.00% 0.509091 0.291616 17.957202 15.324848 7.416762 7.407775 -0.584408 -2.281887 0.285377 0.149522 0.022883
120 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.981247 9.864472 16.234326 14.717191 4.898563 3.993593 13.981863 14.811124 0.024941 0.022328 0.001614
121 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
122 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 16.420230 17.430902 21.210294 15.533619 4.148305 3.625637 10.178740 8.196339 0.021890 0.022862 0.001135
123 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
125 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
126 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
127 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 0.680405 1.251758 -0.952076 -0.640846 -0.099239 0.120546 -0.675084 -0.157117 0.042981 0.029153 0.000988
128 N10 digital_ok 0.00% 100.00% 100.00% 0.00% -0.222781 0.335618 -0.322098 -0.698548 0.168012 0.406892 -0.353630 -0.292771 0.053275 0.035788 0.002152
129 N10 digital_ok 100.00% 100.00% 100.00% 0.00% -1.044823 -0.548124 4.820562 5.489991 -0.549705 -1.070659 0.308574 -1.075887 0.052396 0.036225 0.003689
130 N10 digital_ok 0.00% 100.00% 100.00% 0.00% -1.305945 -0.807432 -0.348609 -0.909706 1.224992 0.911255 -0.020470 1.083209 0.027787 0.027681 0.001272
135 N12 digital_maintenance 0.00% 100.00% 100.00% 0.00% -1.098854 -1.214417 -0.277623 0.477991 0.004178 1.386554 1.727950 -0.235108 0.035061 0.031731 0.002812
136 N12 digital_maintenance 0.00% 100.00% 100.00% 0.00% 1.218042 1.753392 2.350121 1.323464 -0.231310 -0.320767 0.248122 -0.687079 0.036063 0.029464 0.000938
137 N07 RF_maintenance 100.00% 100.00% 44.89% 0.00% 0.211426 3.305664 19.645622 20.107325 2.451236 1.781269 1.429380 -0.314960 0.136791 0.267318 0.076254
138 N07 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.700390 -0.708992 -0.839358 -0.798532 3.263841 2.606010 -0.036936 -0.742624 0.065116 0.067254 0.005921
140 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 0.088687 1.716383 0.473218 -0.517377 -0.187023 0.479892 -0.429848 -0.194745 0.038232 0.036844 0.003648
141 N13 digital_ok 100.00% 100.00% 100.00% 0.00% 0.195996 2.823740 -0.675595 1.111004 -0.835554 1.025139 0.497327 5.361093 0.058172 0.055626 0.007388
142 N13 digital_ok 100.00% 100.00% 100.00% 0.00% 0.460389 2.631880 0.076194 0.203294 0.611454 -0.489971 5.409943 3.537760 0.076478 0.081217 0.006844
143 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.668577 -0.658463 2.171867 0.894179 1.384778 1.140078 0.342314 0.016924 0.026764 0.026151 0.000785
144 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.696333 -0.315680 -1.142852 -1.004770 -0.066870 0.417104 0.526253 3.307796 0.030111 0.028452 0.001677
145 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.430564 -0.075764 0.482342 0.707301 1.221098 1.594579 5.098963 9.330118 0.030245 0.026917 0.002227
150 N15 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.639141 0.626042 0.277616 3.369676 2.181276 2.075189 6.625179 8.318073 0.027427 0.024863 0.001432
155 N12 digital_maintenance 100.00% 100.00% 100.00% 0.00% -0.076267 1.911297 0.142607 -0.248483 1.523899 6.870049 6.494329 9.436866 0.033037 0.031109 -0.000049
156 N12 digital_ok 0.00% 100.00% 100.00% 0.00% -0.030021 0.534238 -1.041723 0.982812 -0.253394 -0.269665 -0.280008 -1.218551 0.031680 0.027221 0.001468
157 N12 digital_ok 0.00% 100.00% 100.00% 0.00% 1.371314 1.323051 0.650999 2.400587 0.798645 0.106176 -0.673897 -1.873058 0.038581 0.031972 0.003757
158 N12 digital_ok 0.00% 100.00% 100.00% 0.00% -0.417639 0.811128 -0.200722 2.642126 1.296934 2.072915 0.237254 1.484424 0.029111 0.027362 0.001700
160 N13 digital_ok 100.00% 100.00% 100.00% 0.00% -0.113219 1.872950 -0.901630 -0.369513 1.424017 2.928742 5.780967 8.066157 0.056314 0.092467 0.020267
161 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -1.181366 -0.516843 1.735250 0.400461 -0.864422 -0.753741 1.144323 3.183470 0.029962 0.027257 0.001795
162 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.629476 -0.342835 -1.206363 0.916105 0.239136 -0.461780 -0.092805 0.718407 0.029009 0.027837 0.001275
163 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 0.337680 0.286988 -0.896102 -0.873271 -0.004178 -0.233583 0.420249 1.461535 0.026663 0.025577 0.001870
164 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 1.451097 1.959743 -0.594198 0.542825 2.180570 2.529960 1.262668 1.142364 0.029351 0.028395 0.001256
165 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.779056 0.289010 2.831536 2.671721 0.453445 -0.301873 -1.153249 0.545218 0.028888 0.028005 0.001596
166 N14 RF_maintenance 0.00% 100.00% 100.00% 0.00% -1.104341 0.595095 0.002702 1.995587 1.684538 1.710479 -1.017855 -1.387865 0.027899 0.026999 0.001214
167 N15 digital_ok 0.00% 100.00% 100.00% 0.00% -0.427433 1.342358 -0.432165 -0.566046 1.497267 1.703116 3.979541 2.248315 0.033052 0.030009 0.002809
168 N15 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.471227 -0.080490 0.176660 -0.641483 0.023558 4.005368 2.277722 7.919948 0.028710 0.027989 0.001120
169 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 0.147668 -0.495203 -0.195766 -0.390202 2.922715 1.142897 11.660297 4.600756 0.028223 0.027629 0.001469
170 N15 digital_ok 100.00% 100.00% 100.00% 0.00% -0.012054 -0.225076 1.322574 -1.077405 5.028924 6.544453 6.400153 3.564657 0.027338 0.028374 0.001563
176 N12 digital_ok 0.00% 100.00% 100.00% 0.00% -0.289039 0.756456 -0.250774 -0.458538 -1.523768 -1.987317 -0.816392 -1.382628 0.038578 0.029689 0.001761
177 N12 digital_ok 0.00% 100.00% 100.00% 0.00% 0.461230 -0.006008 -0.577436 0.939276 -0.507362 -1.006137 -0.610243 -0.697110 0.042011 0.031080 0.002397
178 N12 digital_ok 0.00% 100.00% 100.00% 0.00% -0.842622 -1.053573 -1.179985 -1.046266 -0.822374 0.584385 -0.079218 -0.772899 0.037095 0.031483 0.002012
179 N12 digital_ok 100.00% 100.00% 100.00% 0.00% -0.085597 0.732906 1.789859 6.045606 1.610739 0.936051 1.367570 2.287349 0.039115 0.032206 0.003845
180 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% -1.417215 0.312268 0.254120 1.039436 0.590858 1.125077 0.253242 5.593098 0.056113 0.079936 0.010721
181 N13 digital_ok 100.00% 100.00% 100.00% 0.00% -0.170142 0.567378 1.096468 0.274095 1.175783 2.901261 5.192935 5.291149 0.076732 0.099434 0.011803
182 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.174527 -0.315835 -1.036342 -1.123362 3.367159 2.358612 6.690637 5.906790 0.028843 0.026496 0.001426
183 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 0.344725 0.852576 -0.896208 -0.554710 0.072933 0.634741 -0.893799 -0.145379 0.044334 0.046565 0.007564
184 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.598583 0.068324 0.771229 0.156007 -0.055063 1.554546 1.043641 0.861280 0.025932 0.027589 0.002874
185 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.358961 -0.834198 0.047247 -0.822877 -1.166412 -1.306100 -0.016924 -0.432625 0.029728 0.027463 0.001152
186 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.224699 0.655496 0.165158 0.524766 0.975001 1.457232 1.554599 2.607837 0.028823 0.026679 0.001672
187 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.447303 0.558324 -0.671519 -0.681243 2.042861 3.713890 1.366426 -0.563902 0.026488 0.027779 0.001278
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 2.549766 0.939170 4.684641 -0.515526 5.457682 -0.397487 66.748647 0.370859 0.026680 0.026228 0.002383
190 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 0.411353 2.069005 0.012190 1.011745 1.294503 2.439240 0.518471 7.428554 0.030039 0.027744 0.002053
191 N15 digital_ok 0.00% 100.00% 100.00% 0.00% 1.042848 0.299192 1.716943 0.264298 1.658361 1.117677 1.401008 -0.240898 0.030966 0.029797 0.000961
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
220 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
320 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 4.397279 1.989682 38.031361 41.184744 3.416423 0.763686 15.280353 6.907225 0.028476 0.026825 0.000951
321 N02 not_connected 100.00% 100.00% 100.00% 0.00% 4.820387 4.041528 68.382427 67.388992 1.882747 1.217380 -0.743836 -0.900856 0.029500 0.029021 0.001933
323 N02 not_connected 100.00% 100.00% 100.00% 0.00% 1.418031 0.438172 68.295068 71.985717 -0.041648 -1.164821 1.274362 -2.219406 0.051590 0.046826 0.004009
324 N04 not_connected 100.00% 100.00% 100.00% 0.00% 1.550744 0.966163 70.393736 72.588086 -1.173722 -1.117344 -1.627415 -0.385524 0.036873 0.043791 0.002354
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 2.075052 0.803524 69.392443 66.072483 0.868465 0.444598 -1.568922 -1.546035 0.030421 0.029271 0.001327
333 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 1.507752 0.024202 70.150922 67.430778 3.026718 2.324012 2.054346 -1.484222 0.039364 0.031788 0.000965
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 5, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 27, 28, 29, 30, 31, 32, 33, 36, 37, 38, 40, 41, 42, 45, 46, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 73, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 94, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 116, 117, 118, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129, 130, 135, 136, 137, 138, 140, 141, 142, 143, 144, 145, 150, 155, 156, 157, 158, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 203, 220, 221, 222, 320, 321, 323, 324, 329, 333]

unflagged_ants: []

golden_ants: []
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2459831.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

# Figure out where to draw the nodes
node_centers = {}
for node in sorted(set(list(nodes.values()))):
    if np.isfinite(node):
        this_node_ants = [ant for ant in ants + unused_ants if nodes[ant] == node]
        if len(this_node_ants) == 1:
            # put the node label just to the west of the lone antenna 
            node_centers[node] = hd.antpos[ant][node] + np.array([-14.6 / 2, 0, 0])
        else:
            # put the node label between the two antennas closest to the node center
            node_centers[node] = np.mean([hd.antpos[ant] for ant in this_node_ants], axis=0)
            closest_two_pos = sorted([hd.antpos[ant] for ant in this_node_ants], 
                                     key=lambda pos: np.linalg.norm(pos - node_centers[node]))[0:2]
            node_centers[node] = np.mean(closest_two_pos, axis=0)
In [25]:
def Plot_Array(ants, unused_ants, outriggers):
    plt.figure(figsize=(16,16))
    
    plt.scatter(np.array([hd.antpos[ant][0] for ant in hd.data_ants if ant in ants]), 
                np.array([hd.antpos[ant][1] for ant in hd.data_ants if ant in ants]), c='w', s=0)

    # connect every antenna to their node
    for ant in ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', zorder=0)

    rc_color = '#0000ff'
    antm_color = '#ffa500'
    autom_color = '#ff1493'

    # Plot 
    unflagged_ants = []
    for i, ant in enumerate(ants):
        ant_has_flag = False
        # plot large blue annuli for redcal flags
        if use_redcal:
            if redcal_flagged_frac[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=7 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=rc_color, alpha=redcal_flagged_frac[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot medium green annuli for ant_metrics flags
        if use_ant_metrics: 
            if ant_metrics_xants_frac_by_ant[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=antm_color, alpha=ant_metrics_xants_frac_by_ant[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot small red annuli for auto_metrics
        if use_auto_metrics:
            if ant in auto_ex_ants:
                ant_has_flag = True                
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, lw=0, color=autom_color)) 
        
        # plot black/white circles with black outlines for antennas
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4 * (2 - 1 * float(not outriggers)), fill=True, color=['w', 'k'][ant_has_flag], ec='k'))
        if not ant_has_flag:
            unflagged_ants.append(ant)

        # label antennas, using apriori statuses if available
        try:
            bgc = matplotlib.colors.to_rgb(status_colors[a_priori_statuses[ant]])
            c = 'black' if (bgc[0]*0.299 + bgc[1]*0.587 + bgc[2]*0.114) > 186 / 256 else 'white'
        except:
            c = 'k'
            bgc='white'
        plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color=c, backgroundcolor=bgc)

    # label nodes
    for node in sorted(set(list(nodes.values()))):
        if not np.isnan(node) and not np.all(np.isnan(node_centers[node])):
            plt.text(node_centers[node][0], node_centers[node][1], str(node), va='center', ha='center', bbox={'color': 'w', 'ec': 'k'})
    
    # build legend 
    legend_objs = []
    legend_labels = []
    
    # use circles for annuli 
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgecolor='k', markerfacecolor='w', markersize=13))
    legend_labels.append(f'{len(unflagged_ants)} / {len(ants)} Total {["Core", "Outrigger"][outriggers]} Antennas Never Flagged')
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='k', markersize=15))
    legend_labels.append(f'{len(ants) - len(unflagged_ants)} Antennas {["Core", "Outrigger"][outriggers]} Flagged for Any Reason')

    if use_auto_metrics:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=autom_color, markersize=15))
        legend_labels.append(f'{len([ant for ant in auto_ex_ants if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas Flagged by Auto Metrics')
    if use_ant_metrics: 
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=antm_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum([frac for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants]), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Ant Metrics\n(alpha indicates fraction of time)')        
    if use_redcal:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=rc_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum(list(redcal_flagged_frac.values())), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in redcal_flagged_frac.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Redcal\n(alpha indicates fraction of time)')

    # use rectangular patches for a priori statuses that appear in the array
    for aps in sorted(list(set(list(a_priori_statuses.values())))):
        if aps != 'Not Found':
            legend_objs.append(plt.Circle((0, 0), radius=7, fill=True, color=status_colors[aps]))
            legend_labels.append(f'A Priori Status:\n{aps} ({[status for ant, status in a_priori_statuses.items() if ant in ants].count(aps)} {["Core", "Outrigger"][outriggers]} Antennas)')

    # label nodes as a white box with black outline
    if len(node_centers) > 0:
        legend_objs.append(matplotlib.patches.Patch(facecolor='w', edgecolor='k'))
        legend_labels.append('Node Number')

    if len(unused_ants) > 0:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='grey', markersize=15, alpha=.2))
        legend_labels.append(f'Anntenna Not In Data')
        
    
    plt.legend(legend_objs, legend_labels, ncol=2, fontsize='large', framealpha=1)
    
    if outriggers:
        pass
    else:
        plt.xlim([-200, 150])
        plt.ylim([-150, 150])        
       
    # set axis equal and label everything
    plt.axis('equal')
    plt.tight_layout()
    plt.title(f'Summary of {["Core", "Outrigger"][outriggers]} Antenna Statuses and Metrics on {JD}', size=20)    
    plt.xlabel("Antenna East-West Position (meters)", size=12)
    plt.ylabel("Antenna North-South Position (meters)", size=12)
    plt.xticks(fontsize=12)
    plt.yticks(fontsize=12)
    xlim = plt.gca().get_xlim()
    ylim = plt.gca().get_ylim()    
        
    # plot unused antennas
    plt.autoscale(False)    
    for ant in unused_ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', alpha=.2, zorder=0)
        
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='w', ec=None, alpha=1, zorder=0))
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='grey', ec=None, alpha=.2, zorder=0))
        if hd.antpos[ant][0] < xlim[1] and hd.antpos[ant][0] > xlim[0]:
            if hd.antpos[ant][1] < ylim[1] and hd.antpos[ant][1] > ylim[0]:
                plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color='k', alpha=.2) 

Figure 1: Array Plot of Flags and A Priori Statuses¶

This plot shows all antennas, which nodes they are connected to, and their a priori statuses (as the highlight text of their antenna numbers). It may also show (depending on what is finished running):

  • Whether they were flagged by auto_metrics (red circle) for bandpass shape, overall power, temporal variability, or temporal discontinuities. This is done in a binary fashion for the whole night.
  • Whether they were flagged by ant_metrics (green circle) as either dead (on either polarization) or crossed, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.
  • Whether they were flagged by redcal (blue circle) for high chi^2, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.

Note that the last fraction does not include antennas that were flagged before going into redcal due to their a priori status, for example.

In [26]:
core_ants = [ant for ant in ants if ant < 320]
outrigger_ants = [ant for ant in ants if ant >= 320]
Plot_Array(ants=core_ants, unused_ants=unused_ants, outriggers=False)
if len(outrigger_ants) > 0:
    Plot_Array(ants=outrigger_ants, unused_ants=sorted(set(unused_ants + core_ants)), outriggers=True)

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.3.dev47+ga570afb
3.1.4.dev14+g122e1cb
In [ ]: