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 = "2459891"
data_path = "/mnt/sn1/2459891"
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-7-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/2459891/zen.2459891.25269.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 1850 ant_metrics files matching glob /mnt/sn1/2459891/zen.2459891.?????.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/2459891/zen.2459891.?????.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 2459891
Date 11-7-2022
LST Range 22.620 -- 8.576 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 7
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 96
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
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 67 / 201 (33.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 132 / 201 (65.7%)
Redcal Done? ❌
Never Flagged Antennas 69 / 201 (34.3%)
A Priori Good Antennas Flagged 56 / 96 total a priori good antennas:
3, 7, 19, 29, 37, 38, 44, 45, 51, 53, 54, 55,
56, 59, 68, 71, 81, 84, 85, 86, 93, 94, 101,
103, 108, 109, 111, 117, 121, 122, 123, 129,
130, 136, 140, 142, 143, 144, 158, 161, 162,
164, 165, 167, 169, 170, 181, 183, 184, 185,
186, 187, 189, 190, 191, 202
A Priori Bad Antennas Not Flagged 29 / 105 total a priori bad antennas:
35, 43, 46, 48, 49, 61, 62, 64, 74, 79, 82,
89, 95, 115, 120, 125, 132, 137, 139, 148,
149, 168, 207, 220, 221, 238, 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_2459891.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% 10.215364 -0.692091 10.275372 0.330818 8.480312 0.479719 0.884509 2.651387 0.033020 0.669680 0.537343
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.097926 4.174347 5.915497 7.225507 22.657509 14.647852 1.158170 0.807621 0.614862 0.589811 0.382071
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.149822 -0.406331 -0.636488 -0.458702 -0.610006 0.306576 -0.474003 -0.407937 0.674997 0.672479 0.396566
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.053643 -1.092035 -0.203023 -0.095729 -0.554453 1.005533 9.923982 10.364320 0.666442 0.669728 0.390732
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.274421 -1.337441 -0.898311 -0.106534 -1.264912 0.382039 6.082326 0.713334 0.659079 0.666148 0.384071
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.148554 -0.322195 -0.138556 0.477938 0.670543 0.921602 -0.050574 1.045610 0.660479 0.664678 0.395275
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.502871 -0.805475 -1.249408 -1.387341 -0.443973 0.075180 -0.398434 0.258264 0.654142 0.663964 0.400642
15 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.633645 -0.265053 0.711655 0.712260 0.033327 0.249727 0.497121 1.008665 0.672302 0.677446 0.396725
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.925798 -0.842584 -0.889909 0.167776 -0.013521 0.120543 1.602115 3.221018 0.676102 0.675032 0.391772
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.229578 0.714435 -0.394252 -0.124439 -0.799416 0.162248 0.352988 0.427949 0.677388 0.681946 0.393921
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.984794 12.212408 -0.925613 0.062005 0.833358 2.842108 13.529960 22.391830 0.650984 0.458668 0.463604
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 2.887203 -1.194451 -0.842571 -0.812772 1.924273 1.082191 4.941517 1.882732 0.666200 0.689346 0.391839
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.411507 -0.992636 -0.672067 -0.809298 1.435916 -1.033352 2.002416 -0.958103 0.672087 0.687666 0.393499
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.137914 0.971574 -0.613229 0.145351 0.436758 0.246296 1.113133 0.006407 0.655414 0.660451 0.390429
22 N06 not_connected 100.00% 0.00% 0.00% 0.00% 30.071504 9.143069 -0.792342 -0.961052 7.948269 4.975498 5.398219 3.119574 0.444022 0.601528 0.321900
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.244655 11.820144 10.313926 11.063135 8.531745 10.284394 2.781298 2.156535 0.032538 0.037344 0.004822
28 N01 RF_maintenance 100.00% 0.00% 84.65% 0.00% 13.290912 27.388701 1.022304 0.766249 6.346750 13.630602 7.554994 17.972129 0.356770 0.159811 0.258108
29 N01 digital_ok 100.00% 0.00% 100.00% 0.00% -1.106978 12.258715 -0.563534 10.634178 -0.434740 10.256064 -0.272835 0.432660 0.682402 0.035965 0.578469
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 1.780416 -0.704906 -1.775051 0.222482 -0.460072 -0.523537 -0.169464 0.053335 0.672026 0.685282 0.377492
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.116196 -1.254955 -0.649434 0.544051 0.415890 2.952074 3.248343 0.972169 0.690243 0.689195 0.387912
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.949935 24.119619 0.814592 -0.101153 18.053813 4.408726 1.521595 1.640745 0.588863 0.587443 0.257387
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.985636 1.224970 4.291926 -0.775751 8.479977 4.952835 1.011093 2.357650 0.041514 0.654183 0.485698
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.853441 0.143468 -0.949284 -1.606109 2.405430 -1.556214 1.663089 0.197571 0.597820 0.637790 0.392672
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.263946 7.954390 -0.262866 0.103717 0.741561 1.869016 0.313902 1.671529 0.666422 0.674607 0.396586
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.686383 0.270161 -1.670394 1.146042 -0.022670 1.188553 -0.316182 10.443617 0.678677 0.684978 0.401521
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.055607 -0.018853 -0.327599 0.278628 1.474156 1.100993 6.578942 1.763972 0.680311 0.691160 0.401065
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.135244 0.457755 -0.412982 0.252193 0.007071 0.468548 0.195950 0.434091 0.676972 0.684123 0.388139
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.269826 0.127724 -1.089145 -0.243211 0.594140 0.166967 0.188168 0.663232 0.682555 0.684985 0.378147
42 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.105113 0.864339 -0.430459 0.676915 0.250780 0.176487 -0.081892 -0.010669 0.692622 0.690016 0.391032
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.385453 0.263661 0.214694 0.242128 -1.521205 -0.066037 -1.377633 0.750634 0.696332 0.693641 0.385515
44 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 1.976990 2.534471 -0.137836 -0.040121 0.777975 -0.258960 9.340139 4.668164 0.673715 0.687355 0.374986
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.415463 0.693198 -0.330583 0.037033 0.162306 -0.763169 0.282770 4.411098 0.680794 0.682294 0.381226
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.296804 1.382105 1.029242 2.143777 -0.139964 0.228028 0.289509 -1.905120 0.667837 0.696295 0.395740
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.139212 1.903692 4.092732 -1.497828 8.508112 -1.630761 1.409039 3.036935 0.037751 0.652676 0.473113
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.640609 1.108442 1.337764 1.484248 -0.814064 -0.842339 -1.998610 -2.281643 0.642404 0.667455 0.400722
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.005841 0.294767 -1.687284 0.822395 -1.091191 -1.829965 0.066395 -1.015716 0.610134 0.651807 0.398508
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.670559 24.801631 -0.350109 1.307795 1.932820 0.477612 0.487239 3.606932 0.659259 0.600343 0.364137
51 N03 digital_ok 100.00% 100.00% 0.00% 0.00% 24.586609 0.661196 13.301815 -0.148094 8.588007 1.470207 9.850060 4.198131 0.038166 0.690299 0.538723
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.238389 6.497972 -0.770335 0.219421 0.816662 0.993342 1.770225 1.477582 0.681814 0.695803 0.388683
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.441972 2.739116 -0.661263 -0.258443 1.044631 0.849283 3.706530 6.810219 0.687553 0.699531 0.389533
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.285711 12.528269 10.310631 11.305640 8.558975 10.332183 2.837768 1.873322 0.044322 0.044449 0.001133
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 1.041374 13.286267 0.191381 11.218411 4.814242 10.358074 2.911961 4.637443 0.678371 0.034747 0.511833
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.404950 13.362885 -0.081914 11.430128 -0.460922 10.315270 0.879418 1.259557 0.687029 0.037043 0.529643
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 30.455547 -0.416926 5.118612 0.274747 3.737377 1.366601 4.508544 4.065941 0.504871 0.699191 0.378620
58 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.166735 12.131670 -1.037663 11.174811 0.779638 10.378276 2.507100 2.171385 0.692046 0.036630 0.500803
59 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.676215 3.452067 -0.958824 1.030391 0.061053 0.745218 2.462111 4.652311 0.680850 0.682958 0.373809
60 N05 RF_maintenance 100.00% 0.00% 98.92% 0.00% -1.176935 12.041641 0.220165 11.218913 -1.784379 10.285866 -0.765540 3.486832 0.689259 0.077253 0.536357
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.363557 2.249983 -1.466474 -0.009739 0.470870 -2.000680 -0.518509 3.053694 0.625472 0.634344 0.375899
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.089528 1.371587 0.463199 1.257188 -0.902453 -0.132246 -0.822579 -1.858707 0.640092 0.672553 0.389664
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.124242 12.488975 0.370877 4.971065 -1.380955 10.299503 -0.208471 3.202046 0.622075 0.042337 0.466319
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.766700 0.037611 -0.912626 0.371188 -1.525902 -2.081635 -0.303221 -1.307339 0.598561 0.636171 0.396415
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.343803 1.152834 -0.021565 0.713599 2.428285 2.692001 -0.184680 0.479432 0.661374 0.685735 0.403264
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.162398 1.225996 1.841176 1.873033 2.381223 0.750632 -0.147716 1.249661 0.666345 0.687855 0.393428
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -1.195653 -0.873388 1.752150 1.750310 -0.457078 0.404168 1.248777 2.845016 0.673503 0.692740 0.385964
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.024029 27.917928 0.031711 14.829446 0.218902 10.042062 0.459306 11.381607 0.684468 0.031067 0.539748
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.222031 -0.667981 -0.134602 0.344220 0.232180 0.671320 0.334378 2.100983 0.683470 0.701550 0.380510
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.416575 -0.670161 -1.011961 -0.516295 0.467372 -0.089354 0.872250 0.910524 0.692112 0.705779 0.378651
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.444831 -0.610761 0.102613 0.873965 -0.153935 0.858111 0.186123 1.506612 0.700024 0.701899 0.376682
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.473642 -0.219677 0.173290 0.768643 0.221743 0.985547 1.929595 0.311701 0.681312 0.696212 0.367753
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.098556 0.577034 -0.761051 1.755226 -0.498781 11.208349 0.219015 1.232041 0.701156 0.698131 0.380413
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.334893 0.532026 0.354028 -1.152870 -0.913017 2.044735 -0.491232 3.537667 0.698459 0.703883 0.378964
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 17.616095 27.181562 0.942186 -0.978050 6.688103 3.276632 8.818581 0.632746 0.563777 0.512951 0.275633
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 32.198714 -0.677446 -0.166037 -0.156102 3.174478 -2.734856 -0.476740 0.162768 0.458761 0.651630 0.373128
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.845845 -0.370037 -0.517770 -0.979751 -1.348090 -1.908343 -0.702511 -0.917191 0.627150 0.655655 0.395749
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 9.070364 13.713027 2.924076 4.834553 7.182313 10.327018 20.230524 1.743424 0.297526 0.039044 0.201453
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -0.508550 -0.820701 -0.761862 3.072379 -0.815847 32.066342 -0.455279 1.568518 0.639356 0.644912 0.384467
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.245294 -0.385246 -0.318179 1.796980 -0.740049 -1.510439 -0.685750 -0.379218 0.655917 0.671899 0.385532
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.576189 -0.425595 -0.564727 -0.057696 -0.634745 0.469328 -0.714474 0.346613 0.667825 0.688587 0.381805
84 N08 digital_ok 100.00% 40.97% 100.00% 0.00% 20.568383 24.709353 13.418735 14.371639 6.600945 9.894719 4.751441 5.496691 0.233295 0.034225 0.151967
85 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.312859 -0.279542 1.517459 0.939277 6.509273 -0.766016 -0.491774 -0.338921 0.672681 0.696520 0.380847
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.277274 -0.396854 1.568461 1.310417 5.563236 -1.066045 0.167829 17.079802 0.670474 0.693329 0.370992
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.238985 7.432405 0.671249 -0.187980 23.743832 1.001308 0.423578 0.892710 0.622556 0.713795 0.347134
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.386629 0.155104 -0.211488 0.576340 -1.510104 2.055238 1.014367 0.004066 0.685939 0.699744 0.365083
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.357262 0.133971 -0.438937 0.527719 -0.219285 0.256303 -0.704251 -0.424865 0.687692 0.698910 0.372885
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.371042 -0.566079 0.879215 0.824137 0.039510 -0.438322 0.036682 4.279096 0.679461 0.692316 0.372043
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.482374 -0.152549 -0.213544 0.009739 -0.911359 0.101648 -0.388387 -0.447555 0.679809 0.699784 0.386503
92 N10 RF_maintenance 100.00% 0.00% 19.57% 0.00% 38.921592 45.745740 0.186744 0.825857 7.402355 12.149934 1.541844 12.284628 0.289371 0.238839 0.098965
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 1.618756 0.208435 1.677449 -0.067204 2.639578 -0.168306 6.435816 -0.364254 0.663030 0.690649 0.396277
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 11.332034 -1.154524 10.456501 -0.056088 8.473876 1.687910 0.935635 3.990173 0.032439 0.683887 0.457917
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.051602 -0.393956 -0.437580 1.044443 -0.289417 -1.616502 -1.137607 -0.741813 0.634469 0.672616 0.405813
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.453154 13.309214 4.079719 5.018698 8.476806 10.355044 1.374451 0.947056 0.033110 0.037494 0.002556
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.942641 3.834564 0.710458 0.092536 -1.384343 -2.053424 -1.130035 10.063431 0.623952 0.605255 0.398376
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.046720 3.321296 -0.524352 -0.104091 0.611373 0.039095 0.054007 1.951252 0.637053 0.658164 0.389772
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.504461 -0.780352 0.476149 0.487703 -1.574222 3.674245 2.568604 -0.443953 0.641258 0.673043 0.391071
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.273586 -0.689823 -0.436161 0.775803 0.697461 -0.576253 1.151510 3.529899 0.658790 0.679262 0.381908
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.018634 6.764780 -1.077625 0.701755 0.286625 0.031642 -0.300083 -0.377383 0.684008 0.696070 0.378804
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.314606 0.400021 -1.135873 2.774308 -0.540298 -0.850784 -0.525741 7.362250 0.689460 0.689383 0.374704
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.030976 5.269318 0.007873 0.039398 6.660656 0.261969 18.930505 4.029741 0.685819 0.703514 0.370535
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.323386 61.150837 6.856419 7.490829 -0.194690 6.748806 0.264946 2.125700 0.633707 0.677872 0.376225
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.571920 -0.527847 -0.545983 0.602152 -0.019096 -0.130712 -0.370702 -0.443526 0.692151 0.701078 0.366202
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.582067 0.081974 0.500613 0.837079 2.189899 1.099946 0.437730 -0.304987 0.676421 0.697364 0.366506
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.649839 0.998323 -0.993026 -0.259206 -0.826679 0.104922 0.649554 2.260586 0.688044 0.702301 0.372276
108 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 10.411320 3.278041 10.245997 -0.666150 8.492839 -0.830115 2.069930 0.079203 0.040042 0.701552 0.476722
109 N10 digital_ok 100.00% 0.00% 100.00% 0.00% -1.370406 12.231998 0.100755 10.940511 -0.189974 10.280217 0.048996 2.019796 0.678820 0.034913 0.475014
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.218542 26.408430 -0.694545 14.522225 0.410651 9.946123 -0.334352 5.150988 0.685025 0.031717 0.473605
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.261153 12.099411 -0.015856 11.053827 -0.139794 10.267314 -0.439330 2.604368 0.667487 0.035262 0.468386
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.568396 1.373825 -0.450225 -0.354501 0.053042 -0.408528 0.016009 -0.359785 0.655535 0.672545 0.401625
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.279050 13.324311 3.847893 4.906808 8.492090 10.352485 2.144808 1.160023 0.035146 0.030657 0.002749
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.525733 0.515977 0.856346 -0.325425 4.653433 -1.274421 1.814205 -0.657505 0.525571 0.645812 0.423614
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.191373 0.777594 2.972441 1.965357 1.376240 0.326423 -2.818256 -1.237900 0.618013 0.646170 0.413645
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.029953 -0.054119 -0.557580 0.273010 3.343605 -0.615979 -0.080065 -0.330638 0.631912 0.656465 0.389310
117 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 11.265527 13.760726 10.352375 11.581099 8.484937 10.354846 1.703582 4.460829 0.027634 0.031329 0.002209
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.597310 0.855554 -0.669577 0.461357 -0.724249 0.859724 0.299252 1.165360 0.658603 0.682562 0.385524
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.789149 0.978169 -1.418166 2.781764 -0.444773 17.262062 0.140090 3.038818 0.672919 0.669168 0.378988
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.502492 2.106971 2.308178 2.412436 -1.089543 1.154102 2.229081 -2.628714 0.668033 0.697595 0.370806
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.486099 4.852060 -1.300864 0.723703 -0.771882 0.178955 9.936997 14.873727 0.692310 0.704989 0.377369
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.955223 6.876856 -1.135038 0.422136 6.652768 0.363782 -0.029031 -0.446018 0.700560 0.709371 0.377332
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.265320 8.221661 -0.027368 0.738899 -0.238227 1.313601 -0.387117 0.247284 0.698416 0.708268 0.374286
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.893915 -0.285134 -0.598785 0.292045 -0.677662 -0.007071 0.115883 0.313254 0.696898 0.710574 0.376331
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.319863 -1.272727 -1.216393 0.596778 1.344875 0.646080 -0.298381 -0.035067 0.690628 0.699607 0.376289
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.876359 3.967443 -1.066259 0.874024 17.733096 -0.255326 2.622361 1.004231 0.615308 0.697796 0.371899
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.019984 -0.222894 -0.441022 0.021740 1.276926 0.688351 -0.030773 1.262857 0.684838 0.702745 0.391379
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -1.003473 -0.259669 1.290089 0.738465 -0.598034 0.039355 -0.209310 -0.212361 0.672452 0.694962 0.392076
129 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
130 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.333930 13.440007 4.129333 5.167683 8.499893 10.279552 2.934945 0.059757 0.033952 0.039052 0.001948
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.138015 0.486936 0.537901 -1.457797 -1.030735 -1.079648 -0.908836 0.048354 0.622548 0.634959 0.401061
133 N11 not_connected 100.00% 100.00% 83.03% 0.00% 11.834922 17.598569 3.858780 3.547505 8.461664 10.108828 1.661389 0.933214 0.040944 0.173465 0.096249
135 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.996001 12.173811 -0.318373 11.288973 0.180192 10.339101 0.056567 1.467219 0.632323 0.038261 0.480837
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 2.314380 -0.254260 5.859873 4.571560 22.694030 30.772920 0.454483 0.856124 0.559444 0.623995 0.385950
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.005841 -0.745797 -0.791072 -0.278453 1.705130 3.237375 0.928162 1.475332 0.640870 0.667606 0.392200
138 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.980771 -0.321276 0.521292 1.468402 0.084269 0.577499 4.395105 -0.320099 0.661583 0.681767 0.391818
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.774138 -0.562657 1.877524 -1.083378 -0.167069 -2.257663 -1.744864 -0.270532 0.666921 0.675620 0.378923
140 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.327955 12.876517 0.464126 11.156043 -1.200626 10.236209 2.372947 2.908477 0.682399 0.043636 0.553435
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.513168 -0.829632 -1.150345 0.714529 -0.517976 -2.828338 -0.182681 -1.677743 0.683881 0.703160 0.375924
142 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.376382 12.113496 -1.071896 11.227264 2.217098 10.353265 2.189021 2.694194 0.685935 0.043620 0.551724
143 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 10.492874 -0.602210 10.417237 0.021396 8.491589 0.624969 0.665381 0.057514 0.037577 0.706711 0.553484
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.496450 -1.117082 -0.782081 5.357092 0.759338 -0.526229 0.055714 0.313667 0.692356 0.668111 0.393334
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.136259 2.036867 -0.761043 6.844771 2.268282 15.074731 0.206057 2.038483 0.686148 0.635906 0.405517
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.067478 1.021531 -1.860822 1.170873 0.442497 -1.141120 -0.004066 -1.913772 0.650147 0.695597 0.396203
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.882522 -1.629088 0.845047 2.103680 2.729388 -0.843512 0.019654 -0.128604 0.672150 0.687879 0.386259
148 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -2.030936 -0.605659 2.999892 1.502633 -1.536113 0.023670 -0.229143 -0.037432 0.655316 0.690251 0.404797
149 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.296332 0.843159 -1.081965 2.046900 -0.987958 0.703362 -0.651708 -1.942371 0.667717 0.687560 0.404929
150 N15 RF_maintenance 100.00% 100.00% 2.92% 0.00% 11.028507 -0.339941 10.305863 -0.553839 8.517745 0.275969 2.564217 0.195860 0.040988 0.278754 0.140215
155 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.668409 -1.315108 -0.469693 4.525182 0.646901 38.318521 3.558564 1.950696 0.632515 0.621436 0.402318
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.223075 11.730150 0.864475 10.919830 -1.045941 10.277612 -0.887204 0.777094 0.644055 0.041702 0.509671
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.110557 -0.396798 -0.228473 0.308353 -0.785907 0.250508 -0.007238 0.500922 0.645573 0.666849 0.397621
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.167610 -0.738991 -1.136585 -1.575229 1.557908 -0.645195 9.063958 16.934755 0.661927 0.680600 0.400851
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.194498 31.140657 -1.410472 -0.833006 -2.025420 3.794921 -0.416722 0.392945 0.635844 0.513314 0.362885
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.454035 -1.013860 -0.968858 -1.116947 -0.360563 0.883617 0.974788 1.431150 0.674233 0.689389 0.380155
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.939936 29.454785 -0.712614 -0.886551 -0.785024 0.591655 0.202817 1.272837 0.678610 0.566777 0.351632
162 N13 digital_ok 100.00% 1.08% 100.00% 0.00% 8.552867 12.926832 9.674253 11.317604 9.199453 10.362045 1.364938 1.881138 0.320635 0.051046 0.239574
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.511896 0.946079 -0.850013 0.109063 -0.346090 1.175268 1.361043 2.201354 0.690385 0.699210 0.385553
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.864102 -0.047565 1.341593 -0.615629 10.644492 -0.255379 2.084446 2.034469 0.679194 0.700646 0.384463
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 28.697966 -0.151369 2.144024 0.238992 2.976501 -0.079638 2.001831 0.751913 0.523797 0.693794 0.380797
166 N14 RF_maintenance 100.00% 0.00% 100.00% 0.00% 30.674359 11.388957 -0.039509 10.756155 2.604220 10.251188 1.317501 1.553433 0.541961 0.034692 0.366983
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.401172 -1.250554 -0.711841 0.941023 0.432158 0.529995 -0.810326 4.484908 0.688305 0.694475 0.395876
168 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.009083 -1.009725 -0.572048 -0.904039 0.895823 -0.374304 0.084419 1.072266 0.675348 0.696016 0.400501
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 2.631979 5.594052 -1.649927 -1.685309 1.559952 8.181558 3.706373 5.106808 0.664715 0.654013 0.395667
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.002407 -0.904810 10.478696 -1.729277 8.481956 6.365577 0.980498 7.170245 0.037407 0.684878 0.554288
179 N12 RF_maintenance 100.00% 100.00% 92.76% 0.00% 11.172412 13.011025 10.474680 11.687846 8.517671 9.887172 1.094280 1.808078 0.062354 0.110290 0.051056
180 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.559675 12.836851 10.391718 11.362951 8.538593 10.379738 1.212835 3.277165 0.046928 0.049768 0.003879
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.405262 -0.422569 -0.849422 0.155200 0.074254 2.496056 0.379404 5.681501 0.681927 0.686752 0.387157
182 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.218593 3.589107 -0.961576 3.552605 0.193988 4.237593 8.886455 -1.493561 0.685284 0.682827 0.386765
183 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 10.718101 -0.893272 10.159574 -0.130121 8.481869 1.252743 0.323938 0.410960 0.039770 0.687435 0.504665
184 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 10.486321 12.495953 10.389237 11.232492 8.503424 10.255224 1.368190 1.804141 0.055216 0.045032 0.010523
185 N14 digital_ok 100.00% 3.41% 0.00% 0.00% 8.388870 0.907932 9.661407 7.628990 7.916938 0.205800 0.606950 0.635181 0.294173 0.599696 0.433364
186 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 10.039783 1.386444 10.406519 2.391584 8.496367 0.712884 2.481587 -2.336818 0.044759 0.694670 0.530052
187 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 10.547758 1.526207 10.130041 2.047092 8.521107 1.408079 2.393947 -0.112751 0.044664 0.693038 0.535270
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 9.036609 9.717651 1.437116 -0.024436 4.429532 11.132889 1.363350 1.118255 0.343277 0.369473 0.174083
190 N15 digital_ok 100.00% 0.00% 100.00% 0.00% 45.541460 12.320641 -0.299916 11.322838 6.645952 10.411053 27.646022 3.298264 0.471845 0.034205 0.362211
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.184075 0.130994 3.604090 -0.224273 -1.060334 0.513651 10.702569 2.156007 0.623563 0.666249 0.426390
200 N18 RF_maintenance 100.00% 100.00% 58.49% 0.00% 11.978520 36.522363 4.071073 0.723639 8.514517 10.719383 2.228786 -0.313832 0.046640 0.211847 0.144517
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.919503 5.553452 5.608758 4.586201 6.783428 7.105563 -4.171952 -3.639503 0.633073 0.645807 0.383491
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.543736 2.042951 1.058298 -0.490605 -1.154942 -0.710330 0.210769 5.600678 0.665054 0.634819 0.393090
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.508402 14.225493 3.812858 4.683485 8.484898 10.268114 2.638259 3.606871 0.033603 0.041801 0.002071
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.768468 2.653646 0.370375 -0.710888 -1.808162 6.766999 -0.932934 12.326508 0.657103 0.641346 0.398152
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.258825 0.357973 -0.513626 -0.988215 21.877206 -2.522243 -0.169909 4.117081 0.641458 0.653007 0.390405
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.226469 1.759140 1.784918 0.114934 0.770453 0.523529 -1.683650 -1.543832 0.635982 0.647955 0.378715
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 250.435907 250.381952 inf inf 6476.105096 6440.812582 7143.803316 7001.402462 nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 250.444069 250.318938 inf inf 6512.798389 6592.280038 7223.578489 7491.409033 nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 250.514065 250.395486 inf inf 6374.234369 6417.750115 6860.865336 6945.357498 nan nan nan
211 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 230.157367 230.283854 inf inf 6340.640165 6318.878743 6739.320332 6627.347725 nan nan nan
219 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.052970 3.791784 5.738344 3.703095 7.139231 4.547125 -4.068828 -2.870358 0.627458 0.652772 0.403537
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.471499 -0.948917 0.280792 -0.230692 -1.891239 -2.003545 2.631860 -1.136596 0.657714 0.656071 0.395857
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.455629 -0.064148 -1.161272 -0.505843 0.390496 -2.322807 2.496235 -0.436764 0.623413 0.659160 0.399186
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.584548 1.930408 0.995915 -1.379344 -0.618748 78.071190 4.616191 6.018179 0.655948 0.618155 0.417929
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.541743 0.831759 -1.527699 -1.613522 -1.331091 40.625344 -0.250284 10.370295 0.636886 0.645194 0.391794
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.136336 6.091013 5.833548 5.141387 7.411585 8.738493 -4.147094 -4.088426 0.630703 0.636378 0.398206
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% 5.927670 1.441663 1.420500 -1.271810 3.225064 -1.987803 2.026960 -0.769898 0.521583 0.633912 0.436978
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.392093 -0.808624 1.568923 0.855016 -0.684623 -0.272311 -1.972245 -1.883109 0.655686 0.654237 0.405503
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.686308 -0.062228 0.189256 -0.991828 -1.534232 19.020885 -0.756814 8.937025 0.649279 0.625842 0.405886
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% 249.889357 250.118438 inf inf 6518.256555 6529.549063 7229.517718 7318.427249 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% 212.594527 212.414785 inf inf 6446.519418 6422.996096 7076.903623 6994.323730 nan nan nan
244 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 269.251815 269.133451 inf inf 8731.608112 8729.935384 11393.106168 11388.551336 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% 253.295823 252.944885 inf inf 6521.960919 6616.139601 7240.319811 7536.802080 nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 253.319239 253.011744 inf inf 6450.212713 6557.810452 7044.263333 7397.994562 nan nan nan
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 251.051015 251.212773 inf inf 6469.025748 6615.526627 7122.797360 7487.892586 nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.517431 13.090355 -0.946523 7.273118 -1.000859 10.345653 11.767551 4.310413 0.651060 0.047779 0.550924
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.962273 1.945568 1.537698 1.692606 0.215956 -0.123646 -0.272287 -1.414254 0.549274 0.554594 0.394800
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.277128 -1.262370 1.631316 -1.427022 -0.301879 -0.042627 -1.751818 0.041582 0.584331 0.568056 0.405681
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.255164 -1.230973 0.831055 -0.892132 2.502768 -1.110249 2.707246 0.379838 0.461940 0.565245 0.410976
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.171341 0.678820 -1.489338 -1.549460 -0.564700 -1.250623 2.552862 0.527051 0.513167 0.549524 0.393427
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, 8, 18, 19, 22, 27, 28, 29, 32, 34, 36, 37, 38, 44, 45, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 73, 77, 78, 80, 81, 84, 85, 86, 87, 90, 92, 93, 94, 96, 97, 101, 102, 103, 104, 108, 109, 110, 111, 113, 114, 117, 119, 121, 122, 123, 126, 129, 130, 131, 133, 135, 136, 138, 140, 142, 143, 144, 145, 150, 155, 156, 158, 159, 161, 162, 164, 165, 166, 167, 169, 170, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 200, 201, 202, 203, 205, 206, 208, 209, 210, 211, 219, 222, 223, 224, 225, 226, 227, 228, 229, 237, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 329]

unflagged_ants: [5, 9, 10, 15, 16, 17, 20, 21, 30, 31, 35, 40, 41, 42, 43, 46, 48, 49, 61, 62, 64, 65, 66, 67, 69, 70, 72, 74, 79, 82, 83, 88, 89, 91, 95, 98, 99, 100, 105, 106, 107, 112, 115, 116, 118, 120, 124, 125, 127, 128, 132, 137, 139, 141, 146, 147, 148, 149, 157, 160, 163, 168, 207, 220, 221, 238, 324, 325, 333]

golden_ants: [5, 9, 10, 15, 16, 17, 20, 21, 30, 31, 40, 41, 42, 65, 66, 67, 69, 70, 72, 83, 88, 91, 98, 99, 100, 105, 106, 107, 112, 116, 118, 124, 127, 128, 141, 146, 147, 157, 160, 163]
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_2459891.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.4.dev44+g3962204
3.1.5.dev171+gc8e6162
In [ ]: