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 = "2460126"
data_path = "/mnt/sn1/2460126"
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: 6-30-2023
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/2460126/zen.2460126.42115.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 360 ant_metrics files matching glob /mnt/sn1/2460126/zen.2460126.?????.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/2460126/zen.2460126.?????.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 'startTime' 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 2460126
Date 6-30-2023
LST Range 18.116 -- 20.051 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 360
Total Number of Antennas 205
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
RF_maintenance: 62
RF_ok: 18
digital_maintenance: 3
digital_ok: 83
not_connected: 30
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 205 (0.0%)
Antennas in Commanded State (observed) 0 / 205 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 57 / 205 (27.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 91 / 205 (44.4%)
Redcal Done? ❌
Never Flagged Antennas 113 / 205 (55.1%)
A Priori Good Antennas Flagged 28 / 83 total a priori good antennas:
5, 15, 37, 40, 42, 44, 51, 86, 112, 121, 123,
141, 144, 145, 146, 149, 151, 153, 161, 163,
164, 165, 169, 183, 186, 187, 202, 325
A Priori Bad Antennas Not Flagged 58 / 122 total a priori bad antennas:
8, 16, 22, 35, 36, 46, 48, 49, 50, 52, 57,
63, 64, 68, 79, 80, 84, 89, 90, 95, 97, 102,
108, 111, 113, 114, 120, 126, 127, 132, 134,
135, 136, 139, 155, 156, 159, 175, 179, 195,
206, 207, 223, 224, 226, 228, 229, 240, 241,
243, 244, 245, 261, 324, 332, 333, 336, 340
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_2460126.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% 0.00% 0.00% 0.00% -0.360469 -0.740036 -0.038847 -0.980949 0.334660 -0.650093 0.014237 -0.393106 0.748094 0.521049 0.502436
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.412466 9.713851 -1.151495 -0.703742 -1.726777 -1.031452 -0.860182 -0.427009 0.746452 0.419228 0.489710
5 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 2.118830 6.882033 -0.053344 3.220531 0.328149 1.109758 0.118438 1.118369 0.753677 0.507344 0.504516
7 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.388122 -0.716739 -1.299443 -0.746412 -0.666794 0.011913 1.593108 0.560779 0.717178 0.494510 0.485307
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.938608 2.219859 0.977741 1.119887 0.329207 0.349224 -0.438238 -0.879006 0.686760 0.455401 0.470219
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.355480 0.193186 2.928743 0.225805 1.275627 0.063323 2.060284 0.535925 0.712511 0.485149 0.487870
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.756220 -1.359920 -0.662787 -1.291029 -1.721027 -0.984170 -0.608167 -0.106593 0.694724 0.457304 0.483018
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 11.261774 6.655761 0.485978 0.065264 -1.218080 -0.345024 0.087513 0.060836 0.626126 0.513984 0.371144
16 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.735745 -0.256599 -0.724465 -0.693744 -1.735399 -1.674627 -1.080300 -0.967165 0.755978 0.540555 0.491687
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.891907 1.380460 1.178624 3.017467 1.717754 1.869942 0.777901 1.734648 0.764497 0.540680 0.501224
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.277782 13.420224 0.394903 1.487435 0.463409 0.554966 9.144107 27.039814 0.688531 0.319385 0.529758
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.639418 0.425195 0.677666 0.052215 0.842332 -1.248561 0.943783 -0.778129 0.712461 0.481585 0.482832
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.090737 0.167770 -0.235024 0.560586 0.032704 0.339175 0.824150 0.862358 0.710974 0.487851 0.477975
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.327232 -0.180970 -0.618318 -0.336116 -0.323040 -0.404161 0.171230 0.309442 0.718646 0.482955 0.493809
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.276677 -1.208131 1.170881 -0.631696 0.475119 -0.439850 2.039249 1.147627 0.432772 0.258560 0.306078
27 N01 RF_ok 100.00% 100.00% 85.56% 0.00% 14.621453 18.027002 10.845013 4.094109 1.722614 2.302471 8.439224 26.462987 0.062875 0.187671 0.126957
28 N01 RF_ok 100.00% 0.00% 16.39% 0.00% -0.579729 19.975012 0.290215 4.674445 -0.063504 0.628217 0.048057 16.361027 0.762410 0.242609 0.628270
29 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.449649 7.359225 11.705367 11.898984 1.484770 1.398275 2.558694 2.089115 0.037935 0.053567 0.016308
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.522230 -1.127630 0.024398 -1.332121 -1.057668 -0.941945 -0.060182 -0.555008 0.760055 0.562550 0.490855
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.137336 1.226770 -0.100666 1.412502 0.449201 1.674939 0.453159 1.147956 0.731716 0.518191 0.487291
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.016146 -0.969525 0.123889 -0.752230 -0.281706 -0.300745 0.569479 0.251174 0.662114 0.510637 0.411852
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.310034 0.060345 7.041174 -0.463222 1.486587 -1.417498 2.535306 0.117008 0.039160 0.276883 0.185925
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.173248 -0.770947 -0.345834 -1.128760 -1.438493 -1.620035 -0.158122 0.451835 0.464649 0.271332 0.334854
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.389536 2.111362 0.527812 0.205516 1.107458 0.629325 0.313824 0.304097 0.748866 0.513242 0.493828
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 6.910685 6.271288 4.608746 5.976208 1.864718 1.692683 1.772512 2.072739 0.758352 0.526146 0.488508
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.979743 -0.238001 -0.644542 0.652143 -0.174909 0.866997 -0.166222 1.440735 0.758526 0.535998 0.493564
40 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.237998 0.972293 0.535382 0.538639 0.643952 0.579217 3.168267 13.444858 0.753236 0.541007 0.484498
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.130459 1.662973 -0.193633 2.871785 -0.014257 2.014999 0.952174 2.205174 0.753142 0.538426 0.486326
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.619034 2.503049 0.004003 5.097355 0.335196 1.602544 0.198890 1.734606 0.762066 0.538195 0.497514
43 N05 RF_maintenance 100.00% 98.61% 98.33% 0.00% nan nan inf inf nan nan nan nan 0.515958 0.380811 0.419011
44 N05 digital_ok 100.00% 99.72% 99.72% 0.00% 110.826170 110.887021 inf inf 519.032384 534.823559 3396.434024 3714.907814 0.385820 0.265572 0.335087
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.544105 0.269468 0.373649 -0.151038 0.669918 0.177499 1.010106 0.824421 0.665299 0.449522 0.460922
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.450814 -1.199314 -0.420334 -1.226155 -0.121996 -1.460587 0.570168 -0.019244 0.669010 0.443172 0.471987
47 N06 not_connected 100.00% 89.44% 100.00% 0.00% 6.300736 7.599849 6.762388 6.761113 1.124285 1.389079 3.141204 2.350746 0.161282 0.058889 0.096216
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.122761 1.040992 -1.042129 -0.180396 -1.823102 -1.228773 -0.165444 -0.430115 0.614174 0.377051 0.434260
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.750901 -0.499755 0.282855 -0.946762 0.001889 -1.793060 1.106074 -0.088218 0.598617 0.367867 0.427903
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.442948 -0.151085 -0.117129 0.216082 0.419066 0.544900 -0.038054 0.193272 0.752058 0.513145 0.498496
51 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.100319 0.237405 -0.656538 0.688760 -0.268240 0.816811 11.219852 0.467929 0.753987 0.527039 0.488474
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.455588 1.270572 0.275227 -0.376990 0.656656 -0.213915 0.289866 0.015565 0.764205 0.540408 0.485311
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.186486 -0.059043 -0.397371 -0.471842 -0.358063 -0.572745 0.594089 -0.016079 0.765519 0.554867 0.474583
54 N04 dish_maintenance 100.00% 0.00% 0.00% 0.00% 8.116502 2.898989 2.064870 3.174948 0.941231 0.494000 2.514578 1.337060 0.363531 0.385089 0.148964
55 N04 RF_maintenance 100.00% 100.00% 0.00% 0.00% 26.691078 -1.051274 8.529505 -1.076409 1.491314 -1.416513 0.943926 -0.175854 0.053795 0.542996 0.400693
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.395065 0.579829 -0.772239 0.060769 -0.116145 1.200540 0.221398 0.855674 0.762685 0.560227 0.485706
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.453426 -0.038375 -0.140983 -0.295956 -0.003210 -0.405429 1.133194 1.198475 0.759355 0.553484 0.485349
58 N05 RF_maintenance 100.00% 99.72% 99.72% 0.00% 94.435149 94.311171 inf inf 526.091965 537.897578 3529.699224 3741.587573 0.416860 0.383788 0.332208
59 N05 RF_maintenance 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.146053 0.129448 0.142603
60 N05 RF_maintenance 100.00% 99.44% 99.44% 0.00% nan nan inf inf nan nan nan nan 0.444264 0.458094 0.320969
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.156413 -1.147888 6.677128 -1.046447 1.488044 -1.054456 2.079359 0.787469 0.027525 0.341776 0.250166
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% -0.380967 0.696478 1.781446 -0.015166 -0.158532 -0.854738 1.658477 -0.531497 0.579299 0.385827 0.400002
63 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.557135 3.088384 -1.064198 1.718615 -1.810742 0.950724 0.022822 -0.992706 0.585028 0.330786 0.414187
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.638932 -0.873434 -1.402279 -0.476420 -1.494706 -0.796987 0.239478 0.961728 0.571249 0.340323 0.399780
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.085230 -0.676575 0.214549 -0.999146 0.485350 -0.934506 0.066279 -0.359587 0.752077 0.509224 0.504204
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.113778 -0.022229 0.024624 0.442656 0.114998 0.579621 -0.074029 0.467201 0.739774 0.530305 0.473598
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.811792 -0.142149 -0.652559 0.547827 0.213532 1.180851 0.438250 0.840370 0.761073 0.549320 0.482596
68 N03 RF_ok 0.00% 0.00% 0.00% 0.00% 0.523469 0.018666 0.901410 0.677399 1.008990 0.806289 1.757930 1.605061 0.766579 0.553651 0.481107
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.772289 -0.505309 0.244587 -0.359616 0.839720 0.192781 0.759580 0.134229 0.763353 0.554975 0.481211
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.163393 0.146860 1.586065 0.291400 1.113068 0.727737 0.685623 0.361394 0.760855 0.568655 0.471929
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.584081 -0.123731 -0.970577 -0.041861 -0.532786 0.433048 -0.461702 0.147731 0.768275 0.571676 0.479850
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.206463 -0.124014 -0.390577 -0.272164 0.128557 -0.044133 0.129666 -0.017798 0.766618 0.569177 0.486094
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.290805 2.094953 -0.368266 2.116211 -0.056997 2.308928 0.904516 3.603145 0.672428 0.463549 0.461418
74 N05 RF_maintenance 100.00% 98.89% 98.61% 0.00% nan nan inf inf nan nan nan nan 0.519337 0.410882 0.450633
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 4.643198 3.232101 -0.992581 -1.112730 -1.170258 -1.325837 0.185323 0.416995 0.483658 0.315964 0.304314
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 9.766401 0.561408 -0.185431 0.085324 -1.034036 -0.906969 1.011917 -0.397076 0.464962 0.366257 0.279568
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.101548 -1.055901 0.144703 -1.305395 -0.142142 -1.495031 0.191782 -0.736544 0.758280 0.541163 0.492966
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.297714 1.859881 -0.773896 0.948733 -1.682018 0.107727 -1.070490 -1.235178 0.749729 0.497864 0.502642
84 N08 RF_ok 0.00% 0.00% 0.00% 0.00% 0.959367 1.986998 0.570542 1.056481 -0.297115 0.222638 -1.212227 -0.916663 0.745886 0.523572 0.469483
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.422933 -0.565326 -0.967511 -0.944606 -1.675703 -0.701196 -1.035150 -0.407292 0.768122 0.564255 0.476283
86 N08 digital_ok 100.00% 100.00% 0.00% 0.00% 6.456542 -0.180818 10.528888 0.077035 1.493626 0.006394 0.669533 4.064024 0.064782 0.575254 0.400900
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.699603 6.492727 2.145673 -0.810452 0.538912 -0.970316 55.756703 5.011635 0.652628 0.566881 0.343640
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.358142 0.599742 0.224626 1.007587 0.497264 1.108221 0.796419 0.729299 0.769209 0.579634 0.473188
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.284756 0.252536 0.303420 0.497020 0.588204 0.525378 1.473572 1.655533 0.777655 0.578712 0.488845
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.292737 -0.405112 -0.526644 0.255764 -1.667188 0.228051 -1.084699 0.292634 0.777054 0.581764 0.489789
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.310489 -0.278937 0.292759 0.201875 0.388067 0.106929 0.197724 0.159684 0.774160 0.570808 0.500309
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.353280 7.153071 11.993447 12.215424 1.486080 1.403341 3.171450 3.329467 0.020883 0.038414 0.009278
93 N10 RF_maintenance 100.00% 23.33% 100.00% 0.00% -0.017218 7.515223 -0.054587 12.331333 -0.990106 1.324081 -0.495302 3.622553 0.216883 0.073663 -0.053386
94 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.030190 1.402227 0.386075 5.818166 0.219582 2.069790 1.406162 2.378958 0.670761 0.414800 0.462056
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.745494 -0.238488 -0.905821 -0.504522 -0.993324 -1.548605 -0.529072 -0.954958 0.751958 0.544346 0.483194
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.697001 8.809570 0.033404 -0.435303 -0.819805 -1.260352 -1.209076 0.069159 0.754148 0.439790 0.468154
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.412524 -0.010171 -1.335003 -0.187579 -1.501763 -0.504264 -0.834153 0.403393 0.746022 0.506457 0.493357
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.307252 2.755049 -0.331284 0.411465 -0.320405 0.053801 -0.306150 0.137591 0.762969 0.541932 0.485990
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.609873 -0.405117 -0.781222 -0.859917 -1.744370 -0.604748 -1.093070 -0.182702 0.765307 0.555235 0.478395
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.036143 1.318853 -1.226170 -0.141660 -1.528160 0.023755 -0.929971 0.190930 0.760267 0.565208 0.463596
104 N08 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.435827 26.928657 3.803444 5.316864 3.303919 1.278096 2.539824 1.514551 0.770195 0.570681 0.484865
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.926587 0.175007 -0.572335 0.439663 -0.226631 0.715733 0.051049 0.269099 0.767782 0.573883 0.481440
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.003707 -0.248960 -0.218537 -0.172356 0.401970 0.219066 0.052820 -0.021173 0.777149 0.583248 0.486489
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 2.567916 0.157082 -0.298564 -0.767855 0.069271 -0.430902 0.315024 -0.014237 0.772253 0.576855 0.481424
108 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.914190 1.151665 -0.952410 0.129667 -0.505505 0.391977 -0.393446 0.182758 0.782531 0.579036 0.495128
109 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.130537 7.339973 -1.113854 12.083616 0.786983 1.400387 0.632992 2.781768 0.348528 0.045927 0.227531
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.216173 -0.709035 -0.521167 -0.655941 -1.166504 -0.555635 -0.517247 0.412209 0.600119 0.460826 0.366477
111 N10 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.951706 0.841084 0.404351 0.821930 -0.519896 0.595609 3.191353 1.381344 0.661366 0.454905 0.439742
112 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.334942 -0.150883 9.930668 -0.282901 -1.248655 -1.482980 2.036523 -0.582157 0.522998 0.451694 0.333372
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.692612 2.961771 1.493688 1.625714 0.778635 0.828928 -1.284488 -1.188732 0.732218 0.508495 0.481294
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.427080 -0.563694 1.271799 -1.314642 0.587635 -1.645440 -1.328747 -0.685999 0.732393 0.526715 0.479003
115 N11 not_connected 100.00% 98.89% 98.61% 0.00% nan nan inf inf nan nan nan nan 0.511580 0.414889 0.385814
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.362910 -0.278353 2.101166 -0.187138 1.031427 -0.182684 2.830902 1.909233 0.756419 0.543702 0.471540
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.721515 2.065759 0.731419 6.084520 -0.080156 1.479236 -0.634200 4.440849 0.727566 0.542832 0.452846
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.536838 1.015036 -0.508620 -1.275779 -0.282302 -1.260510 -0.336783 -0.688548 0.767333 0.567640 0.475588
123 N08 digital_ok 0.00% 0.00% 7.22% 0.00% 2.300432 0.697850 1.273585 0.273358 0.686665 -0.693409 -0.218906 3.479832 0.732730 0.421381 0.494901
124 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.545227 7.764861 12.151894 12.464793 1.534609 1.449724 2.735401 5.956520 0.053297 0.054812 0.003030
125 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.204622 -0.332241 4.655280 0.375591 3.239394 0.725312 3.186547 0.268094 0.754871 0.575154 0.484021
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.449224 1.310614 0.510564 0.178884 0.670952 0.157429 2.453887 0.319352 0.775879 0.572304 0.497405
127 N10 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.505688 -0.120429 1.537123 -0.187545 1.714647 -0.020610 1.708315 0.986026 0.687390 0.477040 0.462483
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.336977 -0.529999 0.042711 -0.741652 0.598414 -0.477866 0.656753 1.709116 0.691751 0.472591 0.467423
131 N11 not_connected 100.00% 98.61% 98.33% 0.00% nan nan inf inf nan nan nan nan 0.589316 0.434903 0.406197
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.972082 -1.173609 -1.136751 -1.309690 -1.571927 -1.265204 -0.953307 -0.565220 0.755762 0.534788 0.484509
133 N11 not_connected 100.00% 98.06% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.788619 0.543591 0.423231
134 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.563229 2.146947 2.237815 1.050908 0.312826 0.178103 1.776192 -1.237128 0.701595 0.483240 0.478729
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.943317 0.443465 -0.921126 1.252877 -1.776466 0.642423 -0.991264 1.091539 0.726157 0.477535 0.492825
136 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.041668 3.371631 -1.316996 0.248744 -1.220905 0.256309 -0.799362 0.407928 0.741374 0.483794 0.490204
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.649812 -0.672407 -0.082173 -1.271341 -1.109635 -1.486749 -1.251793 -0.635458 0.741225 0.517090 0.478285
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.135104 0.086541 0.455973 0.169831 0.919624 0.796306 0.974284 0.307564 0.753417 0.548641 0.469306
141 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 6.688124 0.049661 11.963932 0.268077 1.476408 0.935779 1.052865 0.225983 0.090849 0.554965 0.425386
142 N13 RF_ok 100.00% 0.00% 0.00% 0.00% -0.377656 -0.012811 -0.143271 -0.213796 0.243951 0.093267 6.734542 1.145831 0.765513 0.558915 0.486359
143 N14 RF_maintenance 100.00% 98.33% 98.33% 0.00% nan nan inf inf nan nan nan nan 0.543959 0.404900 0.470966
144 N14 digital_ok 100.00% 98.61% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.483264 0.420752 0.360665
145 N14 digital_ok 100.00% 98.89% 98.61% 0.00% nan nan inf inf nan nan nan nan 0.457797 0.391402 0.438688
146 N14 digital_ok 100.00% 98.33% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.615796 0.436462 0.550062
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.437942 0.108031 1.772344 0.533255 1.375956 0.718255 0.989310 0.454338 0.762118 0.552946 0.492617
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.003707 -0.132027 0.024177 0.202563 0.606543 0.365491 0.120190 0.243192 0.764813 0.550835 0.494667
149 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 0.563465 4.551675 -0.370468 0.207533 -0.065801 -0.020676 -0.067904 0.241562 0.755196 0.535069 0.483208
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.689620 -0.386311 0.368175 -0.106166 0.660087 0.114945 0.450841 0.225516 0.744327 0.524958 0.483383
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.025280 -0.357420 -0.970153 0.450328 -1.130854 0.016809 -0.664516 0.241843 0.644396 0.537826 0.365738
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.138172 -1.259332 -1.141100 -1.160680 -1.240034 -1.288058 -0.579130 -0.552975 0.754953 0.524534 0.488717
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 6.643715 -0.804008 6.797938 -0.639535 1.493586 -0.634077 1.167194 -0.249820 0.057229 0.514569 0.344492
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.783507 -0.943584 -0.769739 -1.299843 -1.693295 -1.666637 -1.077123 -0.714267 0.734761 0.495922 0.496474
155 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.977760 -1.462766 0.497645 -1.266694 -0.305316 -1.097574 -1.248891 -0.475718 0.731219 0.477009 0.506384
156 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.955164 0.106334 3.315845 0.268594 1.452414 0.180618 1.928961 0.147207 0.735769 0.489362 0.494958
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.255002 0.058387 -0.116522 0.123794 0.454661 0.447952 -0.061026 0.146668 0.746466 0.509288 0.494126
158 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.233652 -0.379003 -0.407817 -0.188428 0.257210 0.181467 -0.159916 0.153961 0.753029 0.515030 0.499003
159 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.028031 -0.505773 0.579803 -0.867502 0.095464 -0.847027 0.124272 -0.424911 0.727851 0.507052 0.479170
160 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.533569 0.923578 0.783697 4.553243 -0.032405 1.251379 -1.199306 1.249776 0.739735 0.516110 0.485312
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.209360 15.305080 0.294206 -0.091531 0.714151 -0.883413 0.147908 -0.140929 0.756696 0.446143 0.461127
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.985306 -0.225852 -1.208786 0.029641 -1.073294 -0.157621 -0.709961 -0.020806 0.761729 0.544525 0.496206
163 N14 digital_ok 100.00% 99.17% 99.17% 0.00% nan nan inf inf nan nan nan nan 0.373313 0.210400 0.319810
164 N14 digital_ok 100.00% 99.44% 99.17% 0.00% nan nan inf inf nan nan nan nan 0.282590 0.261942 0.254513
165 N14 digital_ok 100.00% 99.17% 98.89% 0.00% nan nan inf inf nan nan nan nan 0.446867 0.487435 0.233430
166 N14 RF_maintenance 100.00% 99.17% 98.89% 0.00% nan nan inf inf nan nan nan nan 0.500286 0.476797 0.287258
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.407445 0.281496 0.162279 0.497464 0.240268 0.285900 0.258269 0.528149 0.740154 0.527876 0.484885
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.222164 -0.344829 0.245869 -0.051123 0.457501 0.077990 0.226231 0.277387 0.753548 0.543683 0.483853
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 1.630178 5.077224 0.338212 0.123356 0.553637 -0.244789 0.265733 0.183919 0.755472 0.521500 0.483700
170 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.563080 0.118048 1.624680 0.529943 1.559862 0.717325 1.142062 0.453374 0.751856 0.537045 0.483374
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.463942 -0.683384 0.368452 0.171682 -0.076908 -0.185817 0.111992 0.017650 0.746074 0.533727 0.471822
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.169463 -0.534173 -0.537348 -0.548600 -1.668563 -0.563499 -1.069757 -0.218528 0.751939 0.527402 0.491419
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.557556 2.879824 1.421933 1.572861 0.678030 0.783785 -1.320404 -1.185914 0.719695 0.488943 0.485635
174 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 7.334907 8.013581 6.726440 6.790170 1.489251 1.405508 1.178293 0.836922 0.028331 0.030086 0.002077
175 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.641641 2.243554 0.728320 0.814666 -0.074131 -0.054184 -1.362308 -1.240474 0.711829 0.456873 0.492091
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.820379 0.428356 1.240396 0.899052 1.549258 1.038071 0.609338 0.432501 0.747372 0.513368 0.496582
180 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.758697 5.171417 0.807994 0.264058 0.820854 -0.053161 0.886155 -0.962246 0.750395 0.449453 0.479225
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.117861 1.498391 0.768775 2.186774 1.251033 1.643416 0.365243 1.355885 0.759444 0.524083 0.501224
182 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.278168 7.256330 -0.394410 12.110585 -1.489183 1.386751 -1.160027 2.182655 0.754151 0.065569 0.610510
183 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.509251 7.795859 -0.083531 12.196266 -0.147504 1.401629 -0.129894 2.197601 0.750275 0.056525 0.600389
184 N14 dish_maintenance 100.00% 99.44% 99.17% 0.00% nan nan inf inf nan nan nan nan 0.426144 0.353884 0.375641
185 N14 RF_maintenance 100.00% 98.89% 98.89% 0.00% nan nan inf inf nan nan nan nan 0.550231 0.397744 0.392233
186 N14 digital_ok 100.00% 99.17% 99.17% 0.00% nan nan inf inf nan nan nan nan 0.479898 0.387658 0.279363
187 N14 digital_ok 100.00% 99.44% 99.17% 0.00% nan nan inf inf nan nan nan nan 0.372642 0.273029 0.336720
189 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.251755 2.126630 0.671583 1.095272 -0.133070 0.326439 -1.220168 -0.921971 0.711338 0.483898 0.468091
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.277868 -0.622290 0.015166 -0.325181 0.300314 -0.215154 0.342937 0.108116 0.741883 0.526887 0.475022
191 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.033138 0.272817 0.354214 0.953391 0.251953 1.039708 2.130678 0.779621 0.739697 0.516859 0.479811
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.646573 3.154840 1.454544 1.750705 0.467097 0.967901 -1.283731 -1.101442 0.722053 0.494772 0.474194
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.900803 2.678879 1.644132 1.459962 0.946663 0.632394 -1.268673 -1.216471 0.713703 0.486600 0.477402
194 N16 digital_maintenance 100.00% 100.00% 0.00% 0.00% 6.574214 -1.204163 6.710441 -1.384540 1.480043 -1.724879 0.778368 -0.680559 0.049133 0.502886 0.384013
195 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.949656 0.403823 0.912821 -0.227952 0.042346 -1.302615 -1.327720 -1.055345 0.706091 0.481706 0.485709
200 N18 RF_maintenance 100.00% 98.61% 98.89% 0.00% nan nan inf inf nan nan nan nan 0.596271 0.387111 0.472198
201 N18 RF_maintenance 100.00% 98.61% 98.61% 0.00% nan nan inf inf nan nan nan nan 0.687738 0.504817 0.420835
202 N18 digital_ok 100.00% 98.89% 98.89% 0.00% nan nan inf inf nan nan nan nan 0.615048 0.450802 0.344357
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.700919 4.796921 0.228181 -0.380086 0.591871 -0.100320 0.199938 -0.157080 0.757333 0.543582 0.496935
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.234873 0.047160 4.467965 0.835013 -1.194820 -0.047194 1.047406 0.389693 0.659106 0.524802 0.438216
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.443603 -0.071508 1.327258 1.328974 0.761980 0.722346 0.485797 0.584235 0.737038 0.525126 0.478899
207 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.050407 0.046505 1.671126 0.888974 1.038040 -0.001889 -1.242422 0.272315 0.707401 0.528145 0.455812
208 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 3.049501 4.677998 6.863482 11.843317 1.611785 1.328914 1.632889 29.375696 0.743627 0.054100 0.638094
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 3.496740 3.799941 11.164242 11.682179 1.353367 1.449372 7.720230 17.793544 0.035663 0.044220 0.004227
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.076514 3.913794 -0.057071 0.160025 0.248296 0.073189 -0.080330 0.092267 0.767388 0.548315 0.479356
211 N20 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.491183 7.308191 -0.383039 7.206844 -0.366144 1.406591 -0.264760 2.120907 0.743162 0.051178 0.624759
213 N16 digital_maintenance 100.00% 0.00% 95.28% 0.00% 2.511563 8.048049 1.404439 6.910481 0.718100 1.252532 -0.328775 1.455044 0.712247 0.130477 0.584792
214 N21 not_connected 100.00% 100.00% 0.00% 0.00% 6.979407 0.255634 6.844441 -1.295675 1.485119 -1.152229 1.028611 -0.517411 0.061479 0.475821 0.400059
220 N18 RF_maintenance 100.00% 98.33% 98.61% 0.00% nan nan inf inf nan nan nan nan 0.579043 0.351246 0.454198
221 N18 RF_ok 100.00% 98.61% 98.89% 0.00% nan nan inf inf nan nan nan nan 0.556851 0.414557 0.416239
222 N18 RF_ok 100.00% 98.33% 98.33% 0.00% nan nan inf inf nan nan nan nan 0.610964 0.517568 0.412498
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.098166 -0.129823 -0.688250 -0.354908 -0.846891 -1.416546 -0.477309 -1.074370 0.748635 0.524504 0.494838
224 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.094830 3.058398 1.813773 1.699958 1.175577 0.939393 -1.151646 -1.148413 0.702133 0.493515 0.460927
225 N19 RF_maintenance 100.00% 0.00% 52.22% 0.00% 0.265750 6.494572 -0.189981 6.770205 -1.152603 0.823397 -1.237115 1.523754 0.750213 0.227618 0.589048
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.989585 3.577981 -1.192117 -0.732865 -1.594154 -1.041824 -0.923525 -0.789901 0.749591 0.473456 0.474663
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 0.357396 -0.758670 0.431008 -1.024943 -0.041737 -1.739499 6.504966 -0.632532 0.739721 0.531544 0.472092
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.085958 -0.990004 -0.741288 -1.019525 -1.576323 -1.381115 -0.971038 -0.459510 0.744716 0.522664 0.473254
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.185040 0.453931 -0.328064 0.070794 -1.508705 -1.047542 -1.228528 -1.185546 0.746517 0.515841 0.491067
237 N18 RF_ok 100.00% 98.61% 98.33% 0.00% nan nan inf inf nan nan nan nan 0.505418 0.468740 0.549449
238 N18 RF_ok 100.00% 98.61% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.597769 0.499660 0.470141
239 N18 RF_ok 100.00% 98.06% 98.33% 0.00% nan nan inf inf nan nan nan nan 0.750674 0.475445 0.588801
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.093080 -0.910224 -1.277423 -1.264407 -1.127622 -1.589505 -0.663358 -0.766356 0.745711 0.511344 0.506363
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.943712 -0.725432 -1.041249 -0.807097 -1.742155 -1.755269 -0.810804 -0.938885 0.749324 0.513423 0.500328
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.369641 -0.115585 -1.080862 -0.483067 -0.952189 -1.541231 -0.627858 -1.003053 0.636705 0.515898 0.374813
243 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.855943 -1.469789 -0.227000 -1.259082 -0.691427 -1.256140 0.224937 -0.598478 0.672389 0.518568 0.414511
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.654278 -0.049093 -0.470141 0.707523 -0.374547 0.494396 -0.259777 0.325509 0.746222 0.509468 0.488002
245 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.171955 -0.787538 -0.522860 -1.375747 -1.611969 -1.318703 -1.163642 -0.602992 0.751075 0.517015 0.493399
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 1.174445 7.467831 3.223605 6.811751 -0.369386 1.400024 1.274831 1.603951 0.677939 0.049130 0.566547
261 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.078297 -0.721825 -0.493390 -0.964089 -1.667868 -1.736889 -1.173616 -0.882008 0.742421 0.504804 0.494758
262 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.653404 4.815738 -0.756960 0.113621 -0.370216 0.413640 -0.392533 0.218536 0.743065 0.513898 0.495269
320 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.752130 -0.594368 -1.377833 -1.311506 -1.099448 -1.274008 -0.568137 -0.583196 0.689488 0.379013 0.493648
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.063778 1.300588 -0.033246 0.149122 -1.008612 -0.794547 -1.013780 -1.046051 0.651486 0.341537 0.467246
325 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.239555 -1.179026 -0.190618 -0.472184 -1.152694 2.395153 -1.128937 3.844120 0.692881 0.387774 0.492345
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 7.174675 7.401044 6.811682 7.248556 1.494452 1.411588 1.489287 1.818629 0.051257 0.051486 0.001948
332 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.548608 1.855818 0.492581 0.701474 -0.517223 -0.353136 -1.207121 -1.241225 0.654742 0.350990 0.481087
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% -0.396380 2.784624 -0.758249 1.476970 -0.574783 0.647367 -0.041901 -1.183572 0.658034 0.328600 0.474499
336 N21 not_connected 0.00% 0.00% 0.00% 0.00% 0.881931 1.754231 -1.292894 -0.193935 -0.992692 -1.087902 -0.254741 -1.026597 0.646784 0.330851 0.467603
340 N21 not_connected 0.00% 0.00% 0.00% 0.00% 2.715314 2.330549 1.369008 0.988588 0.626477 0.116151 -1.294863 -1.195492 0.622345 0.340745 0.440322
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: [4, 5, 15, 18, 27, 28, 29, 32, 34, 37, 40, 42, 43, 44, 47, 51, 54, 55, 58, 59, 60, 61, 73, 74, 77, 78, 86, 87, 92, 93, 94, 96, 104, 109, 110, 112, 115, 121, 123, 124, 125, 131, 133, 141, 142, 143, 144, 145, 146, 149, 151, 153, 160, 161, 163, 164, 165, 166, 169, 174, 180, 182, 183, 184, 185, 186, 187, 194, 200, 201, 202, 204, 205, 208, 209, 210, 211, 213, 214, 220, 221, 222, 225, 227, 237, 238, 239, 242, 246, 262, 325, 329]

unflagged_ants: [3, 7, 8, 9, 10, 16, 17, 19, 20, 21, 22, 30, 31, 35, 36, 38, 41, 45, 46, 48, 49, 50, 52, 53, 56, 57, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 79, 80, 84, 85, 88, 89, 90, 91, 95, 97, 101, 102, 103, 105, 106, 107, 108, 111, 113, 114, 120, 122, 126, 127, 128, 132, 134, 135, 136, 139, 140, 147, 148, 150, 152, 154, 155, 156, 157, 158, 159, 162, 167, 168, 170, 171, 172, 173, 175, 179, 181, 189, 190, 191, 192, 193, 195, 206, 207, 223, 224, 226, 228, 229, 240, 241, 243, 244, 245, 261, 320, 324, 332, 333, 336, 340]

golden_ants: [3, 7, 9, 10, 17, 19, 20, 21, 30, 31, 38, 41, 45, 53, 56, 62, 65, 66, 67, 69, 70, 71, 72, 85, 88, 91, 101, 103, 105, 106, 107, 122, 128, 140, 147, 148, 150, 152, 154, 157, 158, 162, 167, 168, 170, 171, 172, 173, 181, 189, 190, 191, 192, 193, 320]
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_2460126.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.1.1.dev3+gb291d34
3.2.3.dev158+gd5cadd5
In [ ]: