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 = "2459931"
data_path = "/mnt/sn1/2459931"
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, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 12-17-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/2459931/zen.2459931.21318.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 1849 ant_metrics files matching glob /mnt/sn1/2459931/zen.2459931.?????.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/2459931/zen.2459931.?????.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])
    start_time = Time(startJD,format='jd')
    stop_time = Time(stopJD,format='jd')

    # get initial state by looking for commands up to 3 hours before the starttime
    # this logic can be improved after an upcoming hera_mc PR
    # which will return the most recent command before a particular time.
    search_start_time = start_time - TimeDelta(3*3600, format="sec")
    initial_command_res = session.get_array_signal_source(starttime=search_start_time, stoptime=start_time)
    if len(initial_command_res) == 0:
        initial_source = "Unknown"
    elif len(command_res) == 1:
        initial_source = initial_command_res[0].source
    else:
        # multiple commands
        times = []
        sources = []
        for obj in command_res:
            times.append(obj.time)
            sources.append(obj.source)
        initial_source = sources[np.argmax(times)]
    
    # check for any changes during observing
    command_res = session.get_array_signal_source(starttime=start_time, stoptime=stop_time)
    if len(command_res) == 0:
        # still nothing, set it to None
        obs_source = None
    else:
        obs_source_times = []
        obs_source = []
        for obj in command_res:
            obs_source_times.append(obj.time)
            obs_source.append(obj.source)

    if obs_source is not None:
        command_source = [initial_source] + obs_source
    else:
        command_source = initial_source
    
    res = session.get_antenna_status(starttime=startTime, stoptime=stopTime)
    fem_switches = {}
    right_rep_ant = []
    if len(res) > 0:
        for obj in res:
            if obj.antenna_number not in fem_switches.keys():
                fem_switches[obj.antenna_number] = {}
            fem_switches[obj.antenna_number][obj.antenna_feed_pol] = obj.fem_switch
        for ant, pol_dict in fem_switches.items():
            if pol_dict['e'] == initial_source and pol_dict['n'] == initial_source:
                right_rep_ant.append(ant)
except Exception as e:
    print(e)
    initial_source = None
    command_source = None
    right_rep_ant = []
name 'command_res' is not defined

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 (initial_source == 'digital_noise_same' or initial_source == 'digital_noise_different') and med < 10:
                antCon[ant] = True
            elif (initial_source == "load" or initial_source == 'noise') and 80000 < stdev <= 4000000 and antCon[ant] is not False:
                antCon[ant] = True
            elif initial_source == "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'] = ', '.join(command_source if hasattr(command_source, '__iter__') else [str(command_source)])
to_show['Antennas in Commanded State (reported)'] = f'{len(right_rep_ant)} / {len(ants)} ({len(right_rep_ant) / len(ants):.1%})'
to_show['Antennas in Commanded State (observed)'] = 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 2459931
Date 12-17-2022
LST Range 0.297 -- 10.248 hours
X-Engine Status ✅ ✅ ✅ ✅ ❌ ❌ ✅ ✅
Number of Files 1849
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 94
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 18
Nodes Registering 0s N11, N18, N19, N20
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 93 / 201 (46.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 138 / 201 (68.7%)
Redcal Done? ❌
Never Flagged Antennas 63 / 201 (31.3%)
A Priori Good Antennas Flagged 55 / 94 total a priori good antennas:
3, 7, 9, 10, 15, 16, 19, 21, 29, 30, 38, 40,
42, 53, 54, 55, 56, 71, 72, 81, 85, 86, 94,
98, 99, 100, 101, 103, 107, 109, 111, 121,
122, 123, 128, 129, 130, 136, 143, 146, 147,
148, 149, 158, 161, 165, 170, 181, 182, 183,
185, 187, 189, 191, 202
A Priori Bad Antennas Not Flagged 24 / 107 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 77, 82, 89, 102, 125, 137, 139, 166, 179,
324, 325, 333
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_2459931.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 100.00% 100.00% 0.00% 0.00% 11.847013 16.825832 10.134638 0.583196 6.681935 4.222352 0.822391 3.415639 0.034688 0.381232 0.307363
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.177251 0.811104 1.472477 1.877435 0.009505 -0.222200 17.429888 9.020967 0.674062 0.684445 0.399900
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.365988 -0.013718 -0.390135 -0.430665 -0.248074 1.275283 0.587962 0.093110 0.674611 0.684058 0.397774
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.464098 -1.511600 0.749624 3.361379 -0.136190 0.906841 11.666772 12.045158 0.663845 0.668659 0.382925
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.460622 -1.466295 -1.035486 -0.423237 -0.280249 1.192408 2.343983 3.303229 0.673443 0.682625 0.382211
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.830635 -0.766095 8.272656 0.010670 3.252362 0.798467 0.024138 0.210759 0.514551 0.677648 0.453256
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 5.784659 -1.079749 -0.167607 -1.130040 0.536391 0.939901 1.187019 2.427257 0.651058 0.669420 0.389931
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 12.065639 18.780757 9.516254 1.820726 6.696537 4.633339 0.412638 2.364159 0.033802 0.374902 0.291643
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 12.136169 -0.360360 10.101124 0.186770 6.687176 1.130243 0.719332 2.839453 0.034498 0.689948 0.567110
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.707358 2.077024 -0.055765 -0.103457 0.908150 0.509744 3.052959 1.753561 0.679136 0.690445 0.394267
18 N01 RF_maintenance 100.00% 100.00% 28.61% 0.00% 12.858511 24.007365 10.103822 0.269846 6.787854 5.772243 0.746558 23.524692 0.029995 0.254242 0.199235
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.305341 -0.440427 -0.414229 3.907603 1.588280 19.211581 5.031537 9.331068 0.680543 0.663935 0.387467
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.424512 -0.862913 3.811966 -0.630729 -0.949360 -0.835833 1.657958 -1.010027 0.661285 0.692952 0.394133
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.269669 0.196934 -0.308356 4.345661 0.250688 -0.314025 0.554446 -0.366965 0.661834 0.644025 0.385495
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.938281 -0.238808 0.299265 0.337917 2.293041 0.521393 -0.178172 -1.356235 0.624164 0.642711 0.385373
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.349820 12.803056 10.150915 10.568924 6.769692 7.472456 2.514938 1.955523 0.037373 0.042917 0.007525
28 N01 RF_maintenance 100.00% 0.00% 82.15% 0.00% 14.322848 29.703549 -1.170249 0.914074 3.291026 5.685462 2.732894 20.069135 0.393644 0.197501 0.263332
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 12.102226 13.294688 9.735405 10.157539 6.762264 7.451993 0.854441 0.472622 0.029867 0.038890 0.008994
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.223677 -0.033880 -1.484342 0.121923 2.967001 -0.142091 10.631271 -0.241989 0.685766 0.694071 0.383065
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.165019 -1.436131 0.648615 1.025570 1.742027 0.072593 0.112765 2.166709 0.690684 0.693274 0.380261
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 26.898556 3.606814 0.777100 1.374336 0.476227 4.748267 19.972495 129.233318 0.578279 0.662705 0.344439
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 13.755237 14.524546 4.340581 4.637726 6.735271 7.431280 1.239673 0.935145 0.035174 0.049108 0.008332
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.148268 0.000882 1.342456 -1.408672 0.720887 -1.228417 -0.886153 -0.648807 0.633232 0.634219 0.379558
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.671237 7.591852 -0.056300 -0.053708 0.795256 1.793271 1.565833 2.233315 0.670882 0.679127 0.395164
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.383073 0.255008 -0.787184 0.367059 1.815143 1.223110 -0.364053 3.361427 0.684781 0.691188 0.398077
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.050127 0.040549 -0.074612 0.410208 0.040558 0.046922 5.115301 1.704033 0.684629 0.696672 0.398300
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 11.398955 0.423715 9.762731 0.148183 6.778743 -0.481837 1.311179 0.275806 0.041136 0.690046 0.539571
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.532680 -0.032887 -0.752842 -0.273525 0.855945 0.039081 -0.303038 -0.076199 0.687601 0.697228 0.379868
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.726106 13.834854 10.401710 11.067364 6.637418 7.362502 1.721553 2.580629 0.031859 0.029870 0.002479
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.575884 0.615096 -0.612788 0.178889 -0.871960 0.095875 -0.057606 0.899077 0.690101 0.693970 0.381672
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.651641 -0.025225 -0.941747 -0.300217 -0.478913 0.353141 -0.377945 -0.353654 0.689370 0.701078 0.377867
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.615069 0.337398 -0.135565 0.116811 -0.701230 0.792170 1.112557 3.356924 0.680820 0.691778 0.376878
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.081738 2.002583 1.229153 2.503461 -0.943249 0.891089 0.292001 -2.413608 0.669262 0.694950 0.394066
47 N06 not_connected 100.00% 100.00% 99.03% 0.00% 12.842152 14.199988 4.149892 4.244695 6.703577 7.388633 1.043273 0.139160 0.030503 0.059368 0.017681
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.249202 1.391264 1.068343 2.210969 -0.835684 1.207417 -1.093721 -2.344638 0.638309 0.660647 0.389676
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.028983 0.105770 -1.406967 0.722065 -0.198012 0.062452 -0.303301 1.223460 0.587662 0.639615 0.395121
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.331943 26.889466 -0.094159 1.241716 0.638128 1.729600 13.025708 29.657828 0.664644 0.607064 0.358282
51 N03 dish_maintenance 100.00% 98.16% 0.00% 0.00% 26.410453 3.515388 13.015884 -1.020629 6.863477 4.631367 8.796080 -0.450258 0.050368 0.583986 0.446565
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.694273 7.030135 -0.865263 0.169624 0.060005 0.618691 1.891139 0.596048 0.686503 0.699559 0.387934
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.284562 2.756738 -0.418081 -0.168401 0.731342 0.777738 2.202063 5.864529 0.694038 0.704392 0.393347
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.935582 13.533330 10.164834 10.813115 6.760845 7.451318 2.823649 1.942876 0.031673 0.030190 0.001499
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.439359 14.283511 10.186315 10.712824 6.769029 7.454449 1.049930 3.072021 0.028136 0.032173 0.003486
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.131477 14.401494 0.133364 10.935781 -0.552627 7.383888 1.626760 0.892357 0.689210 0.043541 0.565570
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.840129 -0.326712 9.106094 0.208958 8.404920 0.412537 2.867528 1.910409 0.319902 0.703979 0.464732
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.373176 13.180089 10.032127 10.688951 6.684368 7.404649 1.639485 1.260102 0.038837 0.038367 0.001469
59 N05 RF_maintenance 100.00% 98.27% 0.00% 0.00% 12.621306 0.846053 10.092252 0.978884 6.602912 2.189496 0.731841 6.431037 0.060631 0.690444 0.539940
60 N05 RF_maintenance 100.00% 0.00% 96.43% 0.00% 1.072099 13.110494 -0.717788 10.722762 -0.227789 7.411044 0.479535 2.959572 0.675678 0.109418 0.505408
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 3.561739 0.599598 -0.746961 -1.549142 1.204075 -0.971155 -0.521171 0.249953 0.614986 0.652238 0.381016
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.215832 1.324160 -0.924071 1.641785 2.283917 0.025924 0.352711 -1.496135 0.604854 0.660224 0.392332
63 N06 not_connected 100.00% 0.00% 99.89% 0.00% 0.139631 13.556610 -0.041910 4.674337 -0.782268 7.490433 -0.347119 2.620075 0.623496 0.048945 0.469939
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.486852 0.549869 -0.339207 -1.427969 -0.877947 -1.094441 0.135783 -0.527777 0.604213 0.610693 0.378163
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.430567 0.987319 0.234096 0.727342 0.315596 1.725322 0.212257 0.690528 0.666665 0.686056 0.402889
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.009141 1.619022 2.071729 1.771290 1.696392 0.482153 0.987648 2.375751 0.674974 0.692481 0.392296
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -1.099145 -0.898666 1.287506 0.903343 -0.419829 0.878343 0.755221 3.185047 0.685021 0.698612 0.388326
68 N03 dish_maintenance 100.00% 0.00% 99.95% 0.00% 24.979671 29.127950 0.950347 14.195472 3.036932 7.404871 0.065711 8.994653 0.398919 0.034629 0.293410
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.496197 -0.469304 0.087753 0.313666 -0.329576 1.523508 0.078319 -0.531948 0.688288 0.703581 0.375772
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.620878 -0.221958 -0.703575 -0.481950 0.257105 0.411854 0.056272 0.110724 0.682803 0.708554 0.380211
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.916725 -0.280801 0.222964 0.786858 0.255832 -0.092869 0.982315 1.296305 0.703601 0.708387 0.371595
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.874801 14.426452 0.432771 11.098167 -0.008534 7.343012 9.825132 1.069215 0.695318 0.039481 0.561387
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.398702 0.574119 -0.627204 1.880252 0.149194 3.646142 -0.764716 -0.669108 0.702094 0.696505 0.372786
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.804877 1.163330 0.409406 -1.105435 -0.898407 1.205232 -1.479299 0.625994 0.693312 0.700144 0.371288
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.347340 1.027624 0.913208 0.302418 -0.890496 -0.494996 -1.565292 -1.622775 0.650358 0.655772 0.381100
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 34.237687 0.566084 -0.278399 1.702755 2.496042 -0.245740 2.332580 0.128086 0.427833 0.657229 0.391198
79 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.341263 16.957455 -0.373765 0.499668 -1.072424 -0.797220 0.097719 -1.668547 nan nan nan
80 N11 not_connected 100.00% 100.00% 100.00% 0.00% 17.823434 25.002773 3.146920 4.922242 2.372135 7.344609 0.515503 1.279902 nan nan nan
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.523538 13.989010 -0.460015 9.234388 -0.702071 7.279566 -0.043837 1.741206 0.645324 0.042645 0.478965
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.452616 -0.641358 -0.001690 1.863949 -0.551869 -0.269012 -0.443479 -0.072948 0.663628 0.672229 0.383361
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.844472 -0.383795 -0.212390 0.037512 -0.631771 -0.559059 -0.147768 0.938406 0.674349 0.690569 0.384110
84 N08 RF_maintenance 100.00% 96.59% 100.00% 0.00% 27.272815 25.995995 13.611845 13.741446 6.552496 7.349491 4.467283 4.617696 0.109047 0.040150 0.045470
85 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.057041 -0.192390 -0.170562 0.337676 5.833483 -0.563425 -0.363262 -0.723839 0.690239 0.700908 0.378983
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.037941 3.642792 1.605364 1.368637 2.236622 -0.682972 0.920359 17.096942 0.678616 0.678332 0.356143
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.126383 7.763188 -0.400255 -0.196663 10.207306 -0.222206 3.660788 0.575579 0.677576 0.718775 0.366788
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.807451 0.285364 -0.029167 0.555956 -1.279133 -0.335159 -0.130347 -0.589158 0.689563 0.705550 0.363623
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.815406 -0.138845 -0.158084 0.565348 -0.912541 -0.919345 -0.557724 -0.884595 0.697535 0.705151 0.366084
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.588724 -0.534205 1.593663 1.065517 3.569786 -1.220669 0.691188 4.453160 0.679638 0.694520 0.370333
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.686035 -0.492158 0.059822 0.001690 -1.040232 -0.662431 -0.050013 -0.633043 0.679813 0.700097 0.384670
92 N10 RF_maintenance 100.00% 0.00% 14.12% 0.00% 41.599151 48.285414 0.433292 0.142212 4.493508 5.225413 0.929478 2.922083 0.311009 0.269460 0.088546
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.710505 0.469132 2.055909 -0.015488 0.716107 0.554072 3.019191 -0.694245 0.658895 0.681479 0.393755
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.987923 13.635253 10.308115 10.581593 6.724755 7.414116 0.926792 0.732687 0.032394 0.026546 0.003567
95 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.564535 16.933588 -0.406840 0.867524 -0.689550 -0.360480 -0.399336 -0.550394 nan nan nan
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 23.543796 24.631421 4.522580 5.115711 6.543986 7.293590 1.215598 1.025472 nan nan nan
97 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.292183 19.675080 -1.225558 3.096302 21.669983 4.845386 0.678954 2.049837 nan nan nan
98 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 1.068241 6.054813 -0.233551 -0.689991 -0.202469 0.037898 0.513407 2.042044 0.642436 0.664614 0.388089
99 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 3.981627 -0.897889 0.697883 0.316605 -1.282251 1.961671 1.151596 -0.212236 0.636701 0.676214 0.396404
100 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 276.655757 276.815450 inf inf 4510.291698 4510.196384 10204.820452 10203.573547 nan nan nan
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.510290 9.186007 -0.738579 0.726640 -0.061168 1.001560 0.625609 0.957160 0.688873 0.701057 0.379156
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.132168 1.249990 -0.436890 2.013192 -0.359058 -0.077936 -1.030922 2.931310 0.697150 0.695423 0.370793
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.087319 4.564762 -0.367844 -0.772942 64.843059 0.425207 3.148939 3.633340 0.689371 0.709047 0.368037
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.852082 65.272116 7.065384 7.249038 1.186769 1.491848 -0.407833 -0.701887 0.641131 0.683937 0.374159
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.484392 -0.908246 -0.277115 0.528996 0.269562 -0.501494 -0.390645 -0.799617 0.700401 0.705922 0.359053
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.316056 0.312926 1.084174 0.812495 1.175021 -0.745865 -0.026275 1.178651 0.688327 0.704438 0.361799
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 2.941751 2.207471 -0.584979 -0.603834 -0.035430 -0.153846 10.345475 7.509929 0.693285 0.707889 0.365109
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.022434 41.067415 10.100722 0.317581 6.736792 5.774985 1.886146 2.302717 0.040466 0.310435 0.158673
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.769031 13.191304 10.134389 10.447884 6.786190 7.464215 0.465261 1.869763 0.025889 0.026938 0.001448
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 28.584035 27.498449 13.591066 13.910017 6.706429 7.303589 4.095851 4.293782 0.024400 0.027947 0.001182
111 N10 digital_ok 100.00% 0.00% 99.89% 0.00% -0.017149 13.092075 0.230095 10.554877 -0.482441 7.470861 3.795703 2.184598 0.661742 0.041350 0.501461
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.360330 -0.662080 -0.192310 -0.321001 0.224748 1.388330 0.461795 -0.684464 0.649560 0.667120 0.411226
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 24.216467 24.698867 4.295543 5.004274 6.566115 7.317273 1.683002 0.837334 nan nan nan
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.315124 16.865690 -0.692660 0.154217 1.697261 -0.770355 0.109973 -0.169293 nan nan nan
115 N11 not_connected 100.00% 100.00% 100.00% 0.00% 17.225288 17.666463 1.505727 2.359860 0.341955 1.226212 -1.238147 -1.674840 nan nan nan
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.311256 0.144333 -0.621248 0.307439 -0.095827 0.565493 0.448612 1.440659 0.635052 0.653673 0.389562
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.907756 14.803536 10.215995 11.081396 6.647009 7.435887 1.208824 3.686127 0.027281 0.033371 0.003382
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.351859 1.040421 -0.321926 0.342825 -0.600542 -0.199720 -0.002996 0.765507 0.664630 0.685484 0.390016
119 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.946452 3.258109 2.435095 2.811236 0.729133 1.646133 10.881980 0.267952 0.671174 0.693475 0.365803
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.549951 4.230872 -1.415491 2.844991 0.858729 -0.279617 4.089110 18.153547 0.700484 0.703419 0.367181
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.563140 6.726007 0.026981 0.509719 0.807744 0.520180 0.170423 -0.692756 0.704306 0.712577 0.366112
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.648592 8.856422 0.316327 0.722257 0.216522 -0.137781 -0.121569 0.027108 0.706344 0.716761 0.367892
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.880027 0.317536 -0.300022 0.306720 -0.568060 -0.036420 0.849218 0.029364 0.705675 0.713950 0.366704
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.712782 0.215314 -0.648390 0.609125 -0.571474 -0.142937 -0.597410 -0.529210 0.697479 0.703913 0.367911
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 34.015768 3.055375 -0.373292 0.947356 4.371948 -0.591002 9.407020 0.370280 0.571701 0.695847 0.365360
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.204717 -0.000882 -0.070506 0.106053 1.436645 0.295783 3.783600 0.866973 0.681943 0.699573 0.393251
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.962836 12.656398 10.201989 10.684651 6.668402 7.379669 0.288481 0.704593 0.032074 0.026517 0.003524
129 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
130 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.629446 23.817493 0.232152 5.001310 -0.950013 6.713065 -0.946291 0.022706 nan nan nan
132 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.457003 16.216545 -0.019847 -1.069198 -0.114262 -0.717924 -0.768449 -0.629751 nan nan nan
133 N11 not_connected 100.00% 100.00% 100.00% 0.00% 23.649586 16.478220 4.294505 -1.178525 6.629630 -0.908402 1.659395 -0.702016 nan nan nan
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.749754 -1.206506 -0.299814 -0.786499 2.121258 0.192706 8.880909 -0.000361 0.632608 0.668257 0.414457
136 N12 digital_ok 100.00% 98.38% 0.00% 0.00% 10.951689 1.034441 9.705132 2.245122 6.787087 13.431780 1.520977 0.620586 0.048182 0.648266 0.509352
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.110366 -1.078180 -0.417936 -1.626302 0.384387 -0.944024 1.199123 2.260751 0.648796 0.678104 0.397762
138 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.129779 -0.194319 1.961796 -0.700366 0.094074 -1.455264 -1.633701 -0.230404 0.673888 0.679909 0.375323
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.493495 -0.635872 -1.428404 0.100498 -0.744510 -0.826869 2.767094 1.985926 0.688077 0.709521 0.375636
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.674189 -0.468934 -0.968679 1.044772 1.416890 -0.920204 -0.452409 -1.908382 0.692263 0.712043 0.370211
142 N13 RF_maintenance 100.00% 0.00% 97.84% 0.00% 1.493317 13.141035 -1.308326 10.729873 1.211215 7.438866 15.185459 1.793388 0.695047 0.060207 0.582315
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 1.570533 -0.991214 6.291593 -0.387882 -0.570950 1.254983 -0.351994 -0.440312 0.636643 0.714198 0.407236
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.285150 0.036284 -0.708901 0.518380 0.065513 1.093173 -0.442521 -0.118074 0.698696 0.709843 0.373843
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.615180 2.142264 -0.561070 5.779980 -0.920476 8.239870 0.087506 -0.081511 0.692335 0.657767 0.396915
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 13.235744 -0.990520 3.934410 0.364362 6.698011 -0.849728 0.185812 -1.403299 0.040002 0.689131 0.587696
147 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
149 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.031569 0.114910 1.889228 1.216510 -0.006838 -0.723050 -2.076476 -1.473580 0.650223 0.668470 0.422703
155 N12 RF_maintenance 100.00% 99.46% 0.00% 0.00% 11.588038 -0.817502 9.802025 -1.622152 6.786504 1.177991 0.624225 1.110716 0.042773 0.661418 0.520949
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.159504 12.889613 7.854974 10.465059 0.396208 7.479805 0.280867 1.984784 0.501940 0.044614 0.405860
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.007891 -0.319800 -0.457883 0.235637 -0.424132 0.487764 0.163272 0.211216 0.650076 0.671612 0.396506
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.255534 -0.391308 -1.003026 -1.304870 1.413906 2.332729 1.634467 15.245377 0.666554 0.686535 0.396858
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.599955 31.473241 -1.240930 -0.679420 -1.211445 5.036629 -0.509998 31.856513 0.642995 0.547752 0.352052
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.929365 -1.217002 -0.610111 -1.280399 -0.678469 1.096234 -0.132567 0.626634 0.678763 0.694984 0.381379
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.995360 31.012927 -0.429591 -0.671796 -0.090687 1.076248 -0.284171 0.051523 0.681553 0.569561 0.335260
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 2.316426 0.532308 2.813412 1.872851 0.556985 -0.390161 0.322890 -1.619003 0.689306 0.705407 0.371600
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.246255 0.994439 -0.565929 0.148578 -0.459839 0.242112 -0.078620 1.187706 0.693765 0.702943 0.382309
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.760259 -0.015197 1.210533 -0.558949 3.336112 1.461187 0.679874 0.868183 0.681497 0.699653 0.378357
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 33.343288 0.154207 2.030599 0.261028 1.694126 0.022567 5.737592 -0.716468 0.534735 0.694231 0.388188
166 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.935477 1.482256 -0.307542 1.126371 -0.817545 -0.748530 3.429327 -0.758086 0.678760 0.695574 0.394437
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.662947 -1.218174 -0.564601 3.647843 0.397158 -0.686577 -1.112306 1.489699 0.679581 0.669741 0.405914
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.943568 -1.334445 -0.234675 -0.830703 0.769054 0.670513 -0.106232 0.002996 0.662239 0.682750 0.414552
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.101276 -1.351757 -1.417829 -1.115137 -0.066592 -0.087726 -0.639738 -1.391506 0.659087 0.679415 0.416857
170 N15 digital_ok 100.00% 99.89% 0.00% 0.00% 12.679246 -0.559182 10.340514 -1.379342 6.629223 1.304380 0.863138 1.849843 0.044184 0.670499 0.576814
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.512723 -0.128303 0.988901 2.115466 2.293440 0.639006 0.024292 -0.273230 0.653023 0.666579 0.384463
180 N13 RF_maintenance 100.00% 0.00% 97.73% 0.00% 0.195353 14.013573 -0.572282 10.873822 -0.096769 7.393043 14.715773 2.235642 0.673597 0.068749 0.582193
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.190658 -0.266857 -0.376927 0.061537 -0.484404 -0.314701 -0.176541 4.320280 0.679099 0.688704 0.385560
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.120324 4.892744 0.580233 3.858301 4.872882 3.144066 0.916543 -1.779024 0.689306 0.686440 0.387206
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.989182 1.142961 0.974416 5.013727 0.791170 -0.762225 0.928553 -0.703719 0.667054 0.643750 0.371623
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.330262 -0.278485 -1.053807 3.398890 0.006838 -0.917312 -0.061583 0.341577 0.676720 0.676868 0.381498
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 20.184092 -1.353906 8.268365 4.378970 5.930153 -1.293425 -0.158650 -0.605938 0.380350 0.659598 0.421229
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.855761 -1.539746 -1.105015 -0.013519 0.292232 -0.009638 -0.423596 -0.964179 0.681479 0.694129 0.404200
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.373651 -0.488018 -1.594099 0.065632 28.496914 0.992740 2.151027 15.458608 0.650594 0.685928 0.406316
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 10.705101 12.637196 9.601789 10.495944 6.795446 7.470856 4.643830 1.253816 0.028803 0.032355 0.001809
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.722358 -1.386866 -1.110566 0.635088 -0.742912 -0.857271 0.049220 -1.574908 0.644456 0.673533 0.425053
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.644265 0.685108 0.944915 -0.936225 0.272923 0.024306 6.479242 0.544092 0.632442 0.658488 0.426673
200 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 23.954352 47.864050 4.477580 0.661663 6.735864 6.165452 1.886585 0.073605 nan nan nan
201 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 17.801878 19.246283 3.123871 4.382983 2.521596 4.815764 -1.084655 -2.845482 nan nan nan
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% 17.105994 16.448793 1.720249 -0.692427 0.149501 0.347891 -1.519291 32.345989 nan nan nan
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 24.397886 25.093809 4.232851 4.761959 6.689543 7.423386 2.798177 3.017169 nan nan nan
205 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 17.268700 17.087713 0.697692 -1.051517 -0.731117 -0.658235 -0.641037 7.545019 nan nan nan
206 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 17.380913 17.073722 1.028206 -0.459743 3.398321 -1.040680 0.685420 3.943526 nan nan nan
207 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 18.066192 17.306248 1.462857 -0.139518 0.524833 14.337203 -0.839932 -0.963211 nan nan nan
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 19.656730 24.030964 9.722848 11.757197 6.284379 6.472640 17.184139 76.308817 nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 19.654517 20.943961 10.034912 9.746877 6.515839 7.693129 24.849348 18.120868 nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 23.803658 24.086928 2.454938 3.929112 -0.903418 -1.258342 0.962441 -0.198695 nan nan nan
211 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 16.451161 16.885605 -0.610883 0.278266 -0.076388 -0.570412 0.729271 -1.118119 nan nan nan
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 20.100101 18.692205 5.170848 3.727709 5.205859 3.739646 -3.414149 -2.685598 nan nan nan
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 16.729596 16.736560 0.572300 -0.117595 -0.744914 -0.923618 4.520924 -1.427873 nan nan nan
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 16.607508 16.608358 -0.318781 -0.408510 8.184089 -1.062776 3.561003 -0.779124 nan nan nan
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 16.521352 16.964250 0.135125 0.300044 -0.822552 -0.831398 3.290889 -1.293142 nan nan nan
223 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 17.056669 17.363011 -1.013250 0.363502 -0.709999 16.066431 3.670617 5.645163 nan nan nan
224 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 20.409620 20.330422 5.443123 5.067559 5.160885 5.960398 -3.536581 -3.424829 nan nan nan
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 17.363625 23.914364 1.096665 4.790162 -0.761193 7.306049 -1.050836 1.032419 nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 16.883817 17.185265 0.342698 1.325119 -1.091112 1.755206 -0.786761 -0.684025 nan nan nan
227 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 16.915041 17.008271 -0.859566 0.262500 -0.447320 -0.759264 16.873929 0.069868 nan nan nan
228 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.457458 18.142442 -0.633003 0.136927 2.384882 2.767022 105.934077 103.676523 nan nan nan
229 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 17.280806 17.231584 1.666913 1.419225 0.404376 0.523887 1.460785 -1.768518 nan nan nan
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 16.083858 16.182802 -0.257550 -0.926225 -0.739935 -0.915468 0.067711 -0.934330 nan nan nan
238 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 16.831801 16.591140 1.078875 0.615246 -0.591425 -0.455049 -1.190787 -1.805495 nan nan nan
239 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 16.539278 16.772786 0.140498 0.314322 -0.986061 0.752570 -0.016886 1.693582 nan nan nan
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% 27.318036 53.574223 2.776179 1.565857 6.819200 5.206660 1.095406 8.355418 nan nan nan
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 17.154654 17.482087 -0.311593 0.614487 -0.426033 -0.297412 5.022904 18.260315 nan nan nan
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 51.527375 17.557652 -0.265399 1.387349 14.015818 0.276173 11.199254 -0.117303 nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 66.344710 17.259430 0.807224 -0.857647 5.075931 -0.378714 -1.208583 -0.446570 nan nan nan
244 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 17.463606 16.632070 1.414515 -0.670844 1.446344 0.847816 2.413610 6.709558 nan nan nan
245 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 18.012414 17.359518 3.252980 0.972358 2.442113 0.101841 -2.175738 -0.346999 nan nan nan
246 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 23.116988 22.644095 -0.433824 -0.246099 3.190055 4.748445 2.646492 -0.602150 nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 17.454329 17.278464 0.865383 -0.086331 -0.283149 0.147958 0.270856 -0.061953 nan nan nan
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 19.577272 21.124859 9.677036 10.103297 6.309601 7.277435 15.776989 19.340618 nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 12.262475 14.039629 5.099857 6.903775 2.576469 7.510633 14.069016 4.185532 0.412610 0.051967 0.313761
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.588272 3.022433 1.609785 2.035151 0.506036 0.751570 2.233526 0.426201 0.550419 0.570437 0.385325
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.954224 -0.803230 1.714232 -0.990035 0.753282 -0.571595 0.527627 0.635786 0.577076 0.585537 0.392697
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 0.849849 -0.900976 -0.015653 0.129079 4.741342 -0.516822 6.523558 0.364987 0.542779 0.576928 0.393966
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.403685 2.409891 -1.154538 -1.079404 -0.542042 -0.247841 1.332960 1.264726 0.515597 0.557375 0.382099
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, 7, 9, 10, 15, 16, 18, 19, 21, 27, 28, 29, 30, 32, 34, 36, 38, 40, 42, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 78, 79, 80, 81, 84, 85, 86, 87, 90, 92, 94, 95, 96, 97, 98, 99, 100, 101, 103, 104, 107, 108, 109, 110, 111, 113, 114, 115, 117, 119, 120, 121, 122, 123, 126, 128, 129, 130, 131, 132, 133, 135, 136, 138, 142, 143, 145, 146, 147, 148, 149, 155, 156, 158, 159, 161, 165, 170, 180, 181, 182, 183, 185, 187, 189, 191, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 211, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 329]

unflagged_ants: [5, 8, 17, 20, 22, 31, 35, 37, 41, 43, 44, 45, 46, 48, 49, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 77, 82, 83, 88, 89, 91, 93, 102, 105, 106, 112, 116, 118, 124, 125, 127, 137, 139, 140, 141, 144, 150, 157, 160, 162, 163, 164, 166, 167, 168, 169, 179, 184, 186, 190, 324, 325, 333]

golden_ants: [5, 17, 20, 31, 37, 41, 44, 45, 65, 66, 67, 69, 70, 83, 88, 91, 93, 105, 106, 112, 116, 118, 124, 127, 140, 141, 144, 150, 157, 160, 162, 163, 164, 167, 168, 169, 184, 186, 190]
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_2459931.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.5.dev11+g87299d5
3.1.5.dev197+g9b7c3f4
In [ ]: