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 = "2459902"
data_path = "/mnt/sn1/2459902"
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: 11-18-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/2459902/zen.2459902.25278.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/2459902/zen.2459902.?????.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/2459902/zen.2459902.?????.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 2459902
Date 11-18-2022
LST Range 23.345 -- 9.296 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1849
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 7
dish_ok: 1
RF_maintenance: 52
RF_ok: 19
digital_ok: 98
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 N20
Nodes Not Correlating N07
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 77 / 201 (38.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 131 / 201 (65.2%)
Redcal Done? ❌
Never Flagged Antennas 61 / 201 (30.3%)
A Priori Good Antennas Flagged 63 / 98 total a priori good antennas:
3, 7, 9, 15, 19, 20, 21, 29, 30, 37, 38, 42,
51, 53, 54, 55, 56, 59, 68, 71, 72, 81, 83,
84, 86, 88, 94, 98, 99, 100, 101, 103, 108,
109, 111, 116, 117, 118, 121, 122, 123, 127,
136, 140, 142, 143, 146, 155, 158, 161, 164,
165, 170, 181, 182, 183, 184, 185, 186, 187,
189, 190, 191
A Priori Bad Antennas Not Flagged 26 / 103 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 62, 64, 79, 89, 90,
115, 120, 125, 132, 139, 148, 149, 168, 220,
221, 238, 239, 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_2459902.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.856390 -0.214995 10.302313 0.179408 7.746769 0.481346 1.024001 3.013713 0.035580 0.663689 0.508427
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.163665 1.688206 2.394441 1.285757 1.667913 1.107749 14.899421 49.101011 0.665715 0.663605 0.404161
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.292598 -0.059251 -0.388681 -0.663592 -0.248480 1.469144 0.884114 -0.320940 0.667145 0.667968 0.401325
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.208221 -0.849093 0.775952 2.640595 -0.122944 -0.545025 12.652693 15.355496 0.662180 0.661310 0.396271
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.852825 -1.570967 -1.041614 -0.586569 -0.339490 0.576350 3.279682 3.098179 0.663798 0.668842 0.395103
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 5.186743 -0.148599 8.566504 -0.113143 4.111668 0.193549 0.124904 -0.402734 0.490166 0.663101 0.467644
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.108378 -0.574933 -1.293900 -1.002835 -0.221846 0.087539 -0.090909 -0.180263 0.646968 0.658772 0.402834
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.334527 0.327644 1.512165 1.515374 -0.318591 -0.189258 8.199947 10.697565 0.660402 0.667575 0.403155
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.364175 -1.340878 -0.685390 -0.021542 1.333638 1.569224 1.751883 2.817018 0.674395 0.674523 0.402897
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.363614 1.086940 -0.193069 -0.376180 0.736226 0.679870 3.341847 2.170862 0.670362 0.676943 0.399720
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.485068 14.989796 -0.667924 -0.017328 1.161747 2.459694 18.865606 33.924604 0.656170 0.458545 0.473487
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.284283 -1.458646 0.788074 0.922513 -0.058338 0.676735 7.074992 5.375876 0.662279 0.676359 0.391092
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 5.501000 -0.955448 3.508056 -1.079168 3.271758 0.433458 1.913479 -0.814894 0.643953 0.684123 0.404907
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.404314 0.029063 -0.471874 4.197040 0.690787 -0.399353 0.357668 -0.133493 0.651207 0.636838 0.399593
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.688769 -0.181265 0.380207 0.182213 1.588650 1.383360 -0.429450 -1.228752 0.624678 0.642965 0.398342
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.732014 12.871236 10.334263 10.690382 7.926886 8.299919 2.581246 1.689264 0.034304 0.038667 0.004587
28 N01 RF_maintenance 100.00% 0.00% 84.53% 0.00% 14.429426 29.661117 1.246812 0.738079 3.722790 7.814758 4.255186 19.212098 0.367860 0.162663 0.262670
29 N01 digital_ok 100.00% 0.00% 100.00% 0.00% -1.500885 13.364111 -0.349477 10.262293 0.452118 8.288127 -0.137231 0.326107 0.675778 0.037955 0.538564
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.243006 -0.206113 -1.103887 0.024522 5.186830 0.085658 18.843055 0.756610 0.674830 0.683869 0.386109
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.033733 -1.326209 0.948036 1.021439 1.986118 1.623209 2.127676 0.651192 0.682411 0.684309 0.389525
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.757903 25.250327 0.014648 2.086725 11.795340 4.576285 5.498939 10.491707 0.615231 0.584210 0.305827
34 N06 not_connected 100.00% 100.00% 0.59% 0.00% 13.828206 -0.712398 4.485503 -0.278992 7.820599 14.079231 1.157466 5.338592 0.045706 0.650170 0.456047
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.344975 -0.029205 1.007091 -1.499854 1.594772 -1.099119 0.346360 -0.374910 0.634517 0.638330 0.395858
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.635711 9.357377 -0.180422 -0.087730 0.458382 1.827542 3.387113 3.828105 0.644667 0.664220 0.407619
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.925682 0.538675 -1.692150 0.914138 0.862075 0.788779 -0.380384 8.801974 0.661354 0.674538 0.413953
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.304041 0.207176 -0.116713 0.049389 0.046870 0.111264 7.021837 1.626410 0.665860 0.681760 0.415150
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.442819 0.974120 -0.162796 0.053246 -0.805311 0.430598 -0.395815 1.603702 0.669406 0.678138 0.395411
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.455279 0.617713 -1.025299 -0.468403 2.135495 -0.104591 -0.405106 0.856344 0.676620 0.678874 0.382419
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.841771 13.984406 10.557976 11.167892 7.649735 8.143019 0.735468 1.320672 0.036982 0.033937 0.001219
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.587384 0.484810 0.139257 0.038951 -1.157024 0.212174 -1.327266 0.189731 0.691069 0.690149 0.387943
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -2.004741 0.251341 -0.574372 -0.627232 -0.334106 0.006626 -0.888772 -0.552868 0.687702 0.697368 0.387214
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.588204 2.347645 -0.016013 -0.206738 -0.377010 1.917741 0.424236 3.839422 0.675402 0.675255 0.379886
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.029279 2.307398 1.285902 2.318015 -0.401858 0.405806 -0.029983 -2.068110 0.665052 0.694269 0.402885
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 12.890629 0.242634 4.291690 -1.047810 7.793394 -1.379011 1.307613 3.478717 0.040417 0.655149 0.451436
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.175048 1.003999 0.367874 1.891420 2.324948 1.131881 -0.530761 -2.137959 0.636014 0.665936 0.400455
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.048694 0.501255 -0.669002 -1.534149 -0.783353 -1.392893 0.127547 10.196019 0.588556 0.625445 0.386895
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.049120 28.353177 -0.026065 1.088081 1.024597 0.345714 15.293722 23.884332 0.634504 0.588246 0.367213
51 N03 digital_ok 100.00% 100.00% 0.00% 0.00% 27.956062 1.006166 13.232606 -0.423826 8.059165 3.291269 8.917917 6.187245 0.043533 0.677152 0.503375
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.946759 7.543263 -0.653160 0.009028 -0.833044 0.779699 0.590820 0.215851 0.666881 0.685010 0.404421
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.487525 3.077555 -0.524720 -0.440480 2.130466 1.122581 3.551318 5.872107 0.675701 0.690143 0.402122
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.918492 13.665227 10.339021 10.930055 7.834405 8.258769 2.215245 0.972968 0.034639 0.033878 0.001266
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 1.636951 14.466199 0.592420 10.831488 2.850349 8.282084 6.087123 2.760376 0.675269 0.036123 0.479738
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.723100 14.534937 0.097129 11.040655 -0.021811 8.187772 1.849471 0.829678 0.679200 0.040288 0.497992
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 31.512045 0.159766 5.857136 0.107946 2.691036 0.447184 10.407336 1.893128 0.502057 0.693788 0.397322
58 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.270703 13.236881 -0.737388 10.798310 -0.750668 8.216141 1.235925 0.958270 0.683025 0.037446 0.460569
59 N05 digital_ok 100.00% 100.00% 49.22% 0.00% 12.434369 12.299104 9.698035 10.161050 7.605637 7.499387 0.403184 0.613569 0.048957 0.231085 0.144208
60 N05 RF_maintenance 100.00% 0.00% 98.22% 0.00% -1.304081 13.132347 0.089141 10.837271 -1.556514 8.240173 -0.895851 2.649020 0.684196 0.082823 0.493291
61 N06 not_connected 100.00% 44.29% 0.00% 0.00% 12.893711 0.128486 3.878786 -1.647626 7.027089 -2.129089 -0.069602 0.409770 0.230537 0.657767 0.485310
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.513337 1.720059 -1.513516 1.580645 -1.182776 -0.342499 1.002029 -1.535349 0.625089 0.671508 0.399549
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.643593 13.557691 0.311835 4.767600 -0.173543 8.318307 -0.226805 2.496119 0.621109 0.047097 0.434682
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.456412 0.780987 -0.939906 0.636101 -0.961214 -1.370330 0.473648 -0.911033 0.601096 0.637856 0.399590
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.284767 1.241460 0.190146 0.496009 0.716285 0.916792 1.560293 1.503202 0.634740 0.667146 0.426054
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.410661 1.787612 1.786426 1.567328 3.069270 0.413481 -0.008994 1.906755 0.644965 0.671602 0.415165
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.535078 -0.654092 1.202470 0.892029 -0.556358 0.110868 0.694298 1.176317 0.653416 0.675629 0.404296
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 1.093536 30.911201 0.358543 14.359235 -0.057216 8.226570 0.686359 8.807223 0.670126 0.033727 0.494286
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.415017 -0.398041 0.101406 0.145420 -0.476815 1.244230 0.067715 0.023548 0.673502 0.692131 0.387005
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.669309 -0.284229 -0.823907 -0.630396 1.321507 1.471820 0.128029 -0.089054 0.684972 0.699063 0.384136
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.275376 0.032813 0.260101 0.706264 0.481610 0.365535 0.481765 0.907312 0.695026 0.699629 0.379276
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 3.072248 0.297244 0.451106 0.691868 -0.058303 -0.107745 4.869486 0.533079 0.683560 0.695577 0.374724
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.203021 0.932732 -0.764909 1.921594 0.052232 7.613479 -0.454835 -0.327044 0.696368 0.692349 0.381682
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.306987 4.562857 0.313141 -1.376055 -0.543668 4.858284 -0.993063 2.542332 0.691748 0.688742 0.373493
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 25.588792 28.346669 0.485802 -0.894720 2.219867 2.580411 12.983373 9.116538 0.533116 0.504834 0.207823
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 35.398167 -0.130277 -0.151776 0.130560 2.008333 -1.649280 2.952381 0.122197 0.466112 0.655260 0.376790
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.643282 -0.186410 -0.560611 -0.717206 -0.762644 -1.061792 0.160231 -0.675737 0.624745 0.651766 0.396077
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 10.460544 14.981597 2.721919 4.634542 5.183396 8.188573 12.496670 0.948084 0.309786 0.040445 0.194751
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% -0.579962 -0.577148 -0.641215 2.015406 -0.696748 27.548334 0.033026 0.913084 0.063906 0.074578 0.010827
82 N07 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.827763 -0.015467 -0.167899 1.537170 0.601128 -1.013161 -0.264256 -0.043480 0.067482 0.071276 0.010670
83 N07 digital_ok 0.00% 100.00% 100.00% 0.00% -0.679673 -0.103453 -0.398749 -0.156882 -0.340664 -0.805785 -0.496013 0.774518 0.074136 0.072353 0.013119
84 N08 digital_ok 100.00% 31.53% 100.00% 0.00% 23.130449 27.345443 13.308286 13.883386 6.224892 8.151587 4.103919 4.615385 0.236043 0.037955 0.140558
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.261700 0.347136 0.222790 0.881444 0.121756 -0.314919 -0.418048 -0.277236 0.672071 0.682589 0.384739
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.248190 -0.229635 1.980551 1.148295 5.088789 -0.628457 0.388886 17.999718 0.661677 0.685031 0.373273
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.660427 8.067664 0.792802 -0.662384 15.909385 1.087754 5.302674 1.555799 0.628401 0.705858 0.363372
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.673980 0.296757 0.036152 0.601159 -0.883901 1.237762 11.205189 3.058199 0.679489 0.693876 0.364838
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.419992 0.413315 -0.192709 0.374946 -0.668420 -0.497332 -0.473648 -0.427818 0.682336 0.695652 0.371523
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.384165 -0.502111 1.290289 0.856221 -1.688519 -0.925158 -0.052400 3.648619 0.673980 0.688879 0.374966
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.547122 -0.008747 0.002131 -0.165834 -0.534196 -0.556326 0.047007 -0.317094 0.674809 0.695061 0.387465
92 N10 RF_maintenance 100.00% 0.00% 13.63% 0.00% 43.682475 51.421390 0.384292 0.658170 4.693440 6.155652 3.556904 10.456143 0.301078 0.254133 0.098570
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.541610 0.273280 2.078392 -0.201782 0.420829 0.761229 3.853753 -0.423414 0.660595 0.687740 0.397776
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 13.123909 -0.881999 10.490531 -0.693641 7.816206 0.906546 1.081615 5.481926 0.034642 0.680130 0.420280
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.873051 0.503541 -0.450338 1.294937 -0.195083 -0.461751 2.153794 5.067071 0.631217 0.667646 0.404710
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.259240 14.511034 4.281508 4.816718 7.653540 8.125085 1.167687 0.713364 0.033581 0.038822 0.002841
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.655035 4.266356 0.631496 -0.107494 -0.959292 0.350138 -0.923425 9.864943 0.617160 0.601518 0.397047
98 N07 digital_ok 0.00% 100.00% 100.00% 0.00% 1.242567 2.519887 -0.215826 -0.303986 -0.021976 1.099153 0.172560 1.591452 0.068514 0.068109 0.011745
99 N07 digital_ok 0.00% 100.00% 100.00% 0.00% 0.654568 -0.817982 0.596401 0.508256 -0.891432 2.607921 2.138068 -0.480615 0.065776 0.062345 0.008869
100 N07 digital_ok 0.00% 100.00% 100.00% 0.00% -1.467193 -0.944220 -1.051542 -0.114357 1.377807 -0.849007 0.122526 0.657010 0.058408 0.060994 0.006509
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.188600 8.714300 -0.852843 0.531866 -0.156337 1.100012 0.334478 0.176477 0.665092 0.680197 0.396521
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.401474 0.673051 -1.080235 2.523362 0.371916 -0.021046 -0.292620 7.782188 0.676563 0.677035 0.382561
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.979103 6.076633 4.016932 0.148460 7.952947 4.968570 6.573511 4.360683 0.656671 0.692224 0.379417
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.422897 67.761813 6.960975 7.457952 2.451815 7.548703 0.211826 1.723655 0.627903 0.666854 0.377095
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.318055 -0.197115 -0.346750 0.441984 0.807218 -0.563657 -0.127823 -0.162744 0.686449 0.694362 0.364166
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.356941 0.733025 0.952115 0.769809 0.328921 0.296323 -0.127332 0.049986 0.675700 0.694570 0.367290
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.841344 0.008747 -1.456485 -1.170627 -0.573283 -0.707144 2.477572 3.700670 0.684312 0.698598 0.373793
108 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 12.016452 4.226479 10.260320 -0.763455 7.825249 -0.105542 1.971466 -0.153522 0.043647 0.698586 0.449058
109 N10 digital_ok 100.00% 0.00% 100.00% 0.00% -0.460891 13.289707 0.275552 10.565034 -0.382852 8.308021 5.730028 1.828041 0.673777 0.037560 0.438729
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 11.455806 29.147983 0.316532 14.053606 10.740321 8.070449 2.650491 4.216725 0.635956 0.033179 0.385477
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.179213 13.183119 0.213466 10.676592 -0.150236 8.308780 0.908770 2.183217 0.667021 0.037330 0.433289
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.375492 0.990203 -0.255800 -0.558350 0.114748 1.535434 0.333895 -0.339399 0.655301 0.673171 0.403513
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 14.194611 14.541297 4.053825 4.706932 7.674927 8.151981 1.526460 0.637723 0.036687 0.030705 0.003492
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 6.434006 0.971008 0.997989 0.026272 5.553119 -1.060911 2.519273 -0.499661 0.527947 0.642649 0.426753
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 3.041667 1.773038 2.778681 2.148972 1.815695 0.354507 -2.102298 -1.150001 0.611881 0.641949 0.420069
116 N07 digital_ok 0.00% 100.00% 100.00% 0.00% -0.143302 0.394172 -0.362511 0.091243 1.700084 -0.021063 0.018034 0.007449 0.082627 0.077835 0.017710
117 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 12.981601 14.958089 10.368175 11.181561 7.701884 8.243182 1.423618 3.558545 0.026291 0.025305 0.000638
118 N07 digital_ok 0.00% 100.00% 100.00% 0.00% -0.318748 0.830422 -0.406387 0.220594 0.185958 -0.103022 3.952864 3.731971 0.063819 0.061586 0.007065
119 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.916166 1.684366 -1.640709 1.848604 -0.242320 11.718209 0.120475 1.716309 0.069418 0.071819 0.011747
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.216834 3.264286 2.416154 2.607272 0.652648 0.948824 0.673244 -2.462671 0.652553 0.681966 0.380741
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.538787 4.987261 -0.804861 0.892576 2.327421 5.685668 19.184987 15.584317 0.676973 0.692075 0.378354
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.397471 7.931754 -0.697174 0.232314 3.424453 0.899100 0.044721 -0.518881 0.691583 0.700848 0.378014
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.206481 9.973348 0.153365 0.571853 1.079150 0.232914 -0.213186 0.249527 0.693319 0.705802 0.374966
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.939726 -0.090901 -0.445973 0.120791 -0.282272 0.196317 0.789568 0.928103 0.692493 0.707900 0.374626
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.329276 -1.084490 -0.749946 0.457816 -0.047573 -0.065966 -0.116141 -0.401541 0.684926 0.697488 0.375784
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.802323 7.172478 -0.793877 1.105529 10.260358 1.157387 16.027630 0.716502 0.654537 0.693036 0.382544
127 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 0.359225 0.205548 -0.314831 -0.195387 2.482651 1.175104 1.705341 7.927161 0.680455 0.700467 0.396536
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.492887 0.357537 1.331558 0.575260 -0.552117 1.989213 -0.183381 2.255799 0.672070 0.691637 0.396297
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.099335 -1.790434 0.537896 0.567609 -0.526068 -0.006626 -0.007449 1.795404 0.668337 0.686422 0.403421
130 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.818329 0.739896 -0.315004 -0.153138 -1.039505 0.471552 1.855292 3.707074 0.650471 0.674549 0.399492
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.096790 14.652796 4.326853 4.958461 7.786464 8.227949 2.649771 -0.234632 0.035000 0.040531 0.002144
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.786114 0.460372 0.472195 -1.567793 -0.279213 -1.290695 0.787028 -0.170765 0.619534 0.631200 0.406431
133 N11 not_connected 100.00% 100.00% 80.75% 0.00% 13.576210 19.299657 4.062908 3.350588 7.774280 7.375743 1.585539 0.618812 0.043644 0.184022 0.094567
135 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -1.093304 13.275795 -0.145212 10.912139 0.271472 8.201091 -0.008248 1.192072 0.604622 0.041589 0.440291
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 7.090591 0.284722 8.508412 5.333959 13.049629 23.972832 0.283089 -0.060817 0.400787 0.590121 0.424715
137 N07 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.109103 -0.658878 -0.703784 -0.571347 2.162069 3.339027 0.614043 1.124351 0.070560 0.070942 0.011160
138 N07 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.136854 -0.076536 -0.039312 0.592847 0.306409 -0.028405 1.329158 -0.215556 0.071818 0.070534 0.012687
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.102141 -0.426472 1.735414 -0.723126 0.119337 -1.642205 -1.136445 0.391488 0.650316 0.661130 0.389990
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.782949 4.323361 0.248440 3.497352 -1.097236 3.504140 2.669227 -1.266612 0.670710 0.680031 0.379346
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.283278 -0.301186 -1.007703 1.008365 0.142193 -1.256398 0.053444 -1.630316 0.674970 0.694743 0.375270
142 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.748361 13.104175 -1.544567 10.844781 2.079267 8.258650 22.278836 1.746298 0.683083 0.049707 0.521964
143 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 12.145057 36.600251 10.429889 2.327345 7.594923 7.492922 0.353426 17.237664 0.039398 0.322664 0.211009
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.469828 -0.706107 -0.644348 3.416426 0.120650 -0.823383 -0.419451 -0.205483 0.688441 0.686349 0.382722
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.265417 3.175593 -0.716182 7.144147 -0.177953 20.849707 0.245144 0.578633 0.681736 0.610430 0.411901
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 13.301611 2.702526 4.079172 1.429914 7.761811 -0.676198 0.361811 -1.672315 0.040116 0.690363 0.509761
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.541523 -1.373015 1.314854 1.843077 2.651935 -0.504468 -0.042383 -0.210218 0.668111 0.686541 0.388598
148 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.697442 -0.087672 2.849238 1.318827 -0.438217 0.669112 0.120630 -0.324249 0.656643 0.687565 0.403668
149 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.037530 1.660019 -1.088768 2.210138 -1.200269 -0.013421 -0.761449 -2.057325 0.667662 0.682613 0.403945
150 N15 RF_maintenance 100.00% 0.00% 100.00% 0.00% 5.597482 13.323795 4.141210 10.747843 6.658281 8.235333 -2.881907 0.863913 0.339320 0.042341 0.235712
155 N12 digital_ok 100.00% 100.00% 59.17% 0.00% 11.672903 0.617440 9.991111 -0.907652 7.911427 1.278293 0.807092 1.461805 0.038596 0.218780 -0.007031
156 N12 RF_maintenance 100.00% 0.00% 99.95% 0.00% -0.160867 12.801311 0.035721 10.548437 25.247978 8.303319 3.719206 0.549955 0.610474 0.056534 0.455874
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.095716 -0.075479 -0.003038 0.192563 -0.455435 0.485460 -0.087856 -0.073129 0.622048 0.652068 0.417906
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.110425 -0.523566 -1.047134 -1.395879 2.179134 1.813336 5.457251 17.763465 0.642629 0.667106 0.415572
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.149514 30.693492 -1.432132 -0.839542 -1.295293 5.007622 -0.084039 29.136345 0.622439 0.533907 0.367729
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.724455 -1.152390 -0.728670 -1.448858 -0.481458 1.428857 0.264791 0.380392 0.663046 0.680256 0.389937
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.710723 33.343800 -0.599964 -0.769992 -0.242421 0.362215 -0.314117 0.763033 0.669230 0.561076 0.347764
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 2.208745 0.354362 2.677899 1.691739 0.768353 -0.953568 -0.800664 -1.652515 0.678805 0.695963 0.376619
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.347556 1.391862 -0.648918 -0.101442 -0.286067 1.244480 -0.054314 0.927146 0.686749 0.696268 0.385746
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.173652 0.447096 2.795499 -0.797554 23.619524 1.621213 0.681659 1.097798 0.664075 0.697585 0.391779
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 32.119457 0.263238 3.151359 0.060964 3.434152 0.005917 0.963790 -0.121550 0.509614 0.690092 0.389024
166 N14 RF_maintenance 100.00% 6.44% 100.00% 0.00% 59.269259 12.424009 0.191568 10.399768 4.696889 8.370971 0.849612 1.140163 0.260959 0.033627 0.148146
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.568112 -1.294327 -0.729377 3.529537 0.711177 -0.894985 -0.876879 1.565479 0.682637 0.677658 0.401816
168 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.666316 -0.859107 -0.405252 -1.000224 1.669939 0.906079 -0.018696 1.390725 0.672000 0.691521 0.403662
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.942461 1.942464 -1.434977 -1.191069 0.225734 -1.145097 -0.455327 -0.817183 0.669426 0.673177 0.402319
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 12.740606 -0.605456 10.500013 -1.712787 7.667303 7.638905 0.985250 3.020680 0.040627 0.677399 0.519821
179 N12 RF_maintenance 100.00% 99.95% 81.77% 0.00% 12.880481 13.367805 10.490439 11.186910 7.514215 7.025655 0.767601 1.038934 0.072485 0.174511 0.094040
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.139714 14.146124 0.335907 10.982160 -0.645914 8.193491 23.341945 2.159157 0.654343 0.055046 0.507520
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.745117 -0.152110 -0.624346 -0.008917 0.459943 0.149746 -0.369988 4.826462 0.670892 0.679745 0.391031
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.151720 4.980551 -1.132133 3.678526 -0.568408 3.644300 11.995739 -1.732440 0.679551 0.676240 0.388505
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.932064 1.641457 1.334556 5.479954 1.009301 -0.849476 0.640663 -0.186494 0.669363 0.634563 0.381597
184 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 12.175609 13.621437 10.420535 10.859974 7.859070 8.332061 0.851722 0.940884 0.026075 0.025340 0.001128
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 16.936490 -1.476243 9.061005 4.141875 8.870579 -1.371227 0.032473 -0.023885 0.314468 0.658206 0.441346
186 N14 digital_ok 100.00% 100.00% 39.59% 0.00% 11.425816 13.675138 10.433661 9.106015 7.867277 6.731221 2.368897 0.995830 0.031625 0.234353 0.135716
187 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 12.252234 9.013392 10.162667 2.955621 8.042045 6.031493 2.342348 0.593321 0.047438 0.358515 0.226831
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 10.286578 10.315152 1.717400 -0.140054 1.946615 5.605327 0.750633 3.172101 0.356296 0.380191 0.179485
190 N15 digital_ok 100.00% 0.00% 100.00% 0.00% 51.947035 13.402064 -0.114733 10.942348 7.399426 8.217611 83.614802 2.611064 0.444058 0.036687 0.317287
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.808294 0.453027 3.688893 -0.326216 -0.244071 -0.014511 11.773749 0.432993 0.621135 0.661326 0.432807
200 N18 RF_maintenance 100.00% 100.00% 37.91% 0.00% 13.853632 40.862129 4.270752 0.883163 7.941012 6.840694 1.724181 -0.839353 0.048691 0.221612 0.139799
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.267002 7.320280 5.296278 4.684097 6.228919 5.646378 -3.446430 -2.960388 0.623206 0.640963 0.383555
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 1.320098 2.286473 1.022422 -0.623561 -0.778201 -0.317038 -0.417911 3.728246 0.656773 0.630242 0.390352
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 14.390983 15.480430 4.017290 4.489581 7.864638 8.311459 2.666111 2.960088 0.034319 0.045013 0.004000
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.355032 3.564656 0.836689 -1.613297 -0.870562 -0.745104 -0.955575 6.162532 0.647712 0.640575 0.390819
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.364559 1.681577 -0.567906 -0.736664 15.858870 -1.218453 1.009883 3.088867 0.634271 0.646332 0.392144
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.770160 3.154269 1.630437 -0.064081 0.583180 6.714768 -0.820199 -0.780988 0.630594 0.640804 0.377376
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
219 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.364748 5.256834 5.430372 3.832944 6.497579 4.593614 -3.587617 -2.533650 0.615545 0.646402 0.407446
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.907256 -0.496878 0.172233 0.047063 -1.644553 -1.454029 2.848723 -0.727154 0.647654 0.649569 0.396846
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.184627 0.422691 -0.995174 -0.171515 0.087308 -1.254765 2.027536 -0.690336 0.618959 0.655345 0.403180
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.406263 1.099282 0.941294 -0.069901 -0.575606 -0.462950 5.349924 0.303210 0.648368 0.655905 0.401760
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.191166 2.522467 -1.487253 0.887523 -1.066409 4.704869 1.214092 5.094416 0.629016 0.657573 0.403782
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 8.371570 7.884752 5.489764 5.197584 6.177749 6.685956 -3.572990 -3.711530 0.621304 0.630879 0.400060
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
227 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
228 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
229 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
237 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 6.882685 1.973668 1.474738 -0.932155 0.476426 -1.139240 2.873890 0.016775 0.522695 0.629484 0.436665
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.906638 -0.493358 1.448439 1.140973 -0.390573 -0.600415 -1.387771 -1.541071 0.645709 0.648245 0.410942
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.114209 2.867383 -0.002131 0.985289 -0.029692 1.824964 1.471191 3.483792 0.639093 0.583634 0.420446
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
244 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
245 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
246 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 0.022488 14.447047 -0.694394 7.010645 -1.105169 8.302582 6.120072 2.899321 0.631952 0.050961 0.492198
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.483319 3.183523 1.464043 1.915711 0.478103 0.377671 0.905700 -1.305041 0.531947 0.544653 0.396945
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.695526 -1.274877 1.531951 -1.054341 0.435386 -0.537295 -1.205239 -0.087112 0.566817 0.561252 0.410352
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.321657 -0.736466 -1.658078 -0.599149 -1.231610 -1.366830 6.945845 1.254427 0.502353 0.547473 0.400838
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.881996 0.718863 -1.194548 -1.195240 -1.588464 -0.813979 0.974414 0.525347 0.497462 0.538925 0.398156
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, 15, 18, 19, 20, 21, 27, 28, 29, 30, 32, 34, 36, 37, 38, 42, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 63, 68, 71, 72, 73, 74, 77, 78, 80, 81, 82, 83, 84, 86, 87, 88, 92, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 108, 109, 110, 111, 113, 114, 116, 117, 118, 119, 121, 122, 123, 126, 127, 131, 133, 135, 136, 137, 138, 140, 142, 143, 145, 146, 150, 155, 156, 158, 159, 161, 164, 165, 166, 170, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 200, 201, 203, 205, 206, 207, 208, 209, 210, 211, 219, 222, 223, 224, 225, 226, 227, 228, 229, 237, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 329]

unflagged_ants: [5, 8, 10, 16, 17, 22, 31, 35, 40, 41, 43, 44, 45, 46, 48, 62, 64, 65, 66, 67, 69, 70, 79, 85, 89, 90, 91, 93, 105, 106, 107, 112, 115, 120, 124, 125, 128, 129, 130, 132, 139, 141, 144, 147, 148, 149, 157, 160, 162, 163, 167, 168, 169, 202, 220, 221, 238, 239, 324, 325, 333]

golden_ants: [5, 10, 16, 17, 31, 40, 41, 44, 45, 65, 66, 67, 69, 70, 85, 91, 93, 105, 106, 107, 112, 124, 128, 129, 130, 141, 144, 147, 157, 160, 162, 163, 167, 169, 202]
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_2459902.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.dev6+gfb03830
3.1.5.dev171+gc8e6162
In [ ]: