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 = "2459944"
data_path = "/mnt/sn1/2459944"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 12-30-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/2459944/zen.2459944.21292.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 1851 ant_metrics files matching glob /mnt/sn1/2459944/zen.2459944.?????.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/2459944/zen.2459944.?????.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 2459944
Date 12-30-2022
LST Range 1.145 -- 11.107 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 94
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 18
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 68 / 201 (33.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 122 / 201 (60.7%)
Redcal Done? ❌
Never Flagged Antennas 79 / 201 (39.3%)
A Priori Good Antennas Flagged 55 / 94 total a priori good antennas:
3, 7, 9, 10, 15, 16, 21, 29, 30, 37, 40, 42,
53, 54, 55, 56, 71, 72, 81, 86, 93, 94, 98,
99, 100, 101, 103, 109, 111, 116, 121, 122,
123, 124, 128, 129, 130, 136, 143, 146, 147,
148, 149, 158, 161, 164, 165, 170, 182, 183,
185, 187, 189, 191, 202
A Priori Bad Antennas Not Flagged 40 / 107 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 77, 79, 82, 89, 90, 95, 115, 120, 125,
132, 137, 139, 207, 211, 220, 221, 222, 223,
226, 237, 238, 239, 245, 261, 324, 325, 329,
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_2459944.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% 9.200268 12.715068 9.012891 -1.303086 7.965706 3.911948 0.317578 4.183524 0.033797 0.364471 0.290659
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.816244 -0.190399 -1.219118 0.725475 5.705238 -0.267384 16.715283 9.135747 0.649090 0.667332 0.407000
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.273030 0.092718 -0.040876 0.019007 -0.016256 1.778455 1.572213 0.736031 0.647355 0.660742 0.401619
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.744572 -0.935190 0.889230 3.198204 -0.785588 0.076733 11.390353 9.249630 0.634982 0.645806 0.386230
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.503981 -1.051384 -0.775807 -0.054566 -0.032143 1.115614 1.759523 1.869011 0.652606 0.661937 0.388221
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 3.542109 -0.154709 7.427746 0.268290 3.548618 0.726648 -0.334107 -0.024570 0.485957 0.658309 0.460488
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 7.246043 -0.246874 -0.436095 -0.583931 0.472507 1.773324 1.373355 4.632679 0.632429 0.657379 0.395373
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 9.401694 16.045607 8.456947 -1.102822 7.974857 3.608197 -0.097160 0.820488 0.034070 0.365201 0.281804
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 9.437997 -0.821310 8.982546 0.620049 7.971910 2.146437 0.311221 1.874165 0.032644 0.665481 0.537338
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.473246 1.605655 0.224478 0.261883 0.860311 0.660038 1.316314 0.687898 0.652465 0.665063 0.399500
18 N01 RF_maintenance 100.00% 100.00% 58.13% 0.00% 10.054190 16.317219 8.965881 -0.478413 8.127329 6.423721 0.280232 14.314226 0.029327 0.237726 0.180822
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.082992 -1.589727 -0.516150 3.177728 1.015104 0.631040 0.606220 2.301361 0.655631 0.650556 0.387800
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.981881 -0.882959 3.461148 -1.112697 0.461296 -0.257165 1.447288 -0.257919 0.640915 0.673609 0.402015
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.120874 -0.279004 -0.074477 4.148182 0.152322 0.578694 0.075496 0.111619 0.644483 0.627704 0.391705
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.748193 -0.730338 0.053303 -0.289326 1.446696 0.838378 -0.622453 -0.996397 0.619445 0.635716 0.391094
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.788581 10.136322 9.020775 9.521997 8.103569 8.466678 1.492500 1.437550 0.036036 0.039755 0.005574
28 N01 RF_maintenance 100.00% 0.00% 83.90% 0.00% 10.798264 25.133891 -1.140454 0.977296 4.397291 6.364020 3.648918 14.145643 0.378775 0.174680 0.272275
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 9.441420 10.561538 8.639287 9.143939 8.092836 8.446426 0.259337 0.293738 0.029884 0.035333 0.005674
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.055725 0.218363 -0.157711 0.435043 2.073921 1.448704 9.127061 0.000364 0.660585 0.672049 0.390803
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.561163 -1.221204 0.870493 1.074113 1.487925 -0.207854 0.192387 2.462615 0.668447 0.669510 0.386397
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 21.761511 -0.740748 0.729726 1.275459 5.428998 0.401353 25.934218 3.204915 0.556551 0.662184 0.373981
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.874396 11.634399 3.839626 4.232257 8.065652 8.437556 0.738108 0.832336 0.034834 0.041879 0.004730
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.188089 -0.638608 0.495733 -1.540670 -0.663963 -0.678448 2.646071 0.068740 0.626989 0.625684 0.384725
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.414690 7.874546 0.062399 0.277132 0.748947 2.106586 0.986107 1.659145 0.641540 0.652046 0.404321
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.104848 0.302093 -1.612088 0.650922 0.139366 1.810930 -0.539888 4.339597 0.649017 0.661982 0.406730
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.134620 -0.397270 0.001017 0.568577 0.336844 -0.097988 3.037540 0.961712 0.657619 0.665529 0.403343
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 8.814348 0.456541 8.671076 0.399343 8.062647 -0.132451 0.359602 -0.277594 0.038215 0.663803 0.525672
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.795227 0.125097 -0.372568 -0.039405 2.085083 0.750719 0.201812 0.666403 0.661280 0.672782 0.385240
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.998520 11.070808 9.260026 9.981555 7.867491 8.263105 0.945417 1.845045 0.030971 0.029228 0.002046
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.018235 0.130754 -0.521574 0.503178 0.099695 0.943418 -0.242788 1.077084 0.672913 0.676239 0.390960
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.230013 0.257922 -1.420259 0.000468 0.085184 0.875592 -0.802922 -0.480965 0.675223 0.684411 0.388551
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.038792 1.925332 0.017979 0.384182 -0.135795 1.373792 -0.055935 1.987603 0.664249 0.669310 0.382510
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.151485 1.553620 1.247094 1.462922 -0.125986 0.254224 -0.396610 -1.496362 0.655106 0.680531 0.402944
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.094019 11.355758 3.672544 3.883564 8.007835 8.362064 0.592713 0.250909 0.031469 0.049198 0.012205
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.534366 0.675263 0.173645 1.303100 -1.104121 1.045660 1.069769 -1.709478 0.631599 0.653298 0.393679
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.465253 -0.859019 -0.565308 -0.710354 0.016256 -1.162779 -0.132290 1.128777 0.583072 0.632351 0.397693
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.220925 13.705818 0.070646 1.191116 1.669796 4.681003 15.965108 19.684561 0.631435 0.599900 0.368490
51 N03 dish_maintenance 100.00% 98.33% 0.00% 0.00% 21.906896 4.053055 11.560057 -0.543440 8.268167 5.906251 6.866978 3.923292 0.043162 0.550135 0.417907
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.596025 6.269367 -0.580865 0.409901 0.796737 1.295094 0.879003 1.355184 0.660687 0.670347 0.395792
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.090840 2.768387 -0.129057 0.173033 1.177422 2.205639 2.063114 4.369961 0.662366 0.676436 0.401938
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.231543 10.753313 9.034129 9.737890 8.046429 8.410465 1.512402 1.178135 0.030758 0.029408 0.001296
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.675471 11.368409 9.046592 9.643814 8.070176 8.430456 0.458229 2.068991 0.028201 0.030871 0.002579
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.370742 11.505485 0.235510 9.850649 -0.195582 8.328406 1.161904 1.049002 0.667883 0.037978 0.550157
57 N04 RF_maintenance 100.00% 1.78% 0.00% 0.00% 13.257925 2.268690 8.113832 0.421726 6.708271 4.648364 4.745053 3.702795 0.297871 0.677251 0.468997
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.841537 10.455906 8.924158 9.634145 8.032802 8.425053 1.804605 1.867510 0.035562 0.035324 0.001562
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.873261 3.402213 8.983623 1.317388 7.838026 1.889217 0.576858 6.570257 0.047101 0.662027 0.530239
60 N05 RF_maintenance 100.00% 0.00% 96.27% 0.00% 0.563890 10.384930 -0.498644 9.663352 0.075858 8.432463 0.551701 2.320848 0.663164 0.083903 0.533324
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.231946 -0.436111 -0.659867 -1.466435 1.584820 -0.830634 -0.447748 0.529874 0.605312 0.641972 0.388472
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.347190 0.533807 -1.013715 0.687477 -1.219233 -0.788102 0.547214 -0.874220 0.603636 0.651917 0.396308
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.086756 10.743846 -0.577963 4.259745 -0.282843 8.510566 -0.247009 1.815307 0.626177 0.046768 0.498182
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.130241 0.053665 -1.013662 -0.974550 -1.206294 -1.406270 1.164894 -0.259836 0.611297 0.609060 0.376582
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.524866 1.134368 0.255243 0.962786 0.795710 1.308975 -0.165964 0.366362 0.638252 0.656199 0.411799
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.380150 1.616857 2.144811 1.815293 2.690796 0.398088 -0.031841 1.142709 0.644478 0.661886 0.403319
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.826256 -0.775105 1.275004 1.273211 -0.286231 1.210673 0.071449 2.031632 0.657182 0.669811 0.397242
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 21.113033 24.608810 1.025535 12.751925 3.415043 8.455563 -0.060060 6.898057 0.376070 0.030604 0.274837
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.605795 -0.430550 0.109046 0.628497 0.189536 2.253904 0.242333 0.616806 0.663952 0.677143 0.385078
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.916786 -0.184013 -0.397865 -0.047011 0.856459 1.913205 0.581009 0.603586 0.657444 0.681559 0.388453
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.532608 -0.263259 0.413793 0.910532 0.961216 0.100266 0.493926 0.804436 0.682730 0.684853 0.380654
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.221533 11.547995 0.523808 10.002296 0.530600 8.251479 3.677226 1.176016 0.672720 0.035587 0.546847
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.713488 0.910245 -1.284207 1.719445 0.740370 2.657164 -0.323943 0.008408 0.685332 0.679383 0.382856
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.456069 2.080645 -0.324258 -0.667761 -0.332146 1.716241 -0.731786 2.549296 0.679697 0.680998 0.379938
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.681392 0.522203 0.115698 -0.517256 -1.349455 -0.971200 2.497978 -0.962066 0.643054 0.644896 0.384145
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 30.830150 -0.006485 -0.677056 0.636552 1.933936 -0.713881 0.296353 1.182339 0.438283 0.655166 0.393023
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.934641 -0.732207 -1.652908 -0.470128 -1.264854 -1.424995 -0.240436 -1.163780 0.609573 0.642012 0.397472
80 N11 not_connected 100.00% 0.00% 98.60% 0.00% -0.991308 11.917282 -0.388887 4.183232 0.655830 8.352967 4.557844 0.852490 0.605955 0.051678 0.473756
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.064785 11.171476 -0.401278 8.335868 -0.386690 8.190516 6.313509 1.436853 0.605475 0.040634 0.464073
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.547574 -0.580345 0.144862 2.821346 -0.072670 0.230180 -0.355848 -0.068477 0.633524 0.631540 0.389710
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.576883 0.073121 -0.074120 0.298637 0.095812 0.859308 -0.571601 0.256402 0.644538 0.660817 0.394362
84 N08 RF_maintenance 100.00% 68.29% 100.00% 0.00% 18.372722 21.487145 11.689122 12.329729 6.565504 8.373613 2.680740 3.315468 0.226244 0.034376 0.143141
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.489663 -0.283417 -0.168273 0.574498 -0.437420 -0.208207 -0.653228 -0.391858 0.664596 0.672117 0.386004
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.912448 0.327548 0.684915 0.804785 4.042417 -1.083824 0.053765 11.081648 0.647836 0.657189 0.363170
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.665235 7.314252 -0.314554 -0.280801 11.401361 0.842850 1.170082 1.749378 0.643242 0.690492 0.372306
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.366305 0.401220 0.134150 0.687652 -0.254289 0.080088 3.269714 1.252719 0.670104 0.679487 0.371228
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.225607 0.504213 -0.108031 0.723180 -0.392085 -0.421921 -0.747692 -0.540437 0.656222 0.681967 0.375276
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.350445 -0.248977 0.779563 1.163130 -0.722393 -1.121304 0.132333 2.283060 0.664852 0.665745 0.373566
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.271295 -0.105814 0.171217 0.198890 -0.567800 -0.297040 0.002250 -0.184601 0.662196 0.680196 0.389638
92 N10 RF_maintenance 100.00% 0.00% 21.12% 0.00% 34.015815 39.896790 0.380550 1.008631 4.708512 4.856893 0.070482 6.402157 0.298912 0.257296 0.087513
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 3.982763 0.269394 1.951620 0.337441 2.227044 1.153525 2.521392 -0.375607 0.638263 0.667843 0.394308
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.189215 10.840421 9.159117 9.535979 8.036896 8.397686 0.559611 0.693419 0.031104 0.026592 0.002246
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.024147 -1.000655 -1.117520 0.353917 -0.617178 -0.715001 0.113993 1.994894 0.623338 0.652762 0.400065
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.398243 11.517688 3.687298 4.342737 7.850266 8.226503 0.430450 0.600748 0.033187 0.037818 0.002673
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.544451 6.676195 -0.193738 2.405074 -0.338010 3.699678 0.654282 3.047765 0.570635 0.497276 0.372637
98 N07 digital_ok 100.00% 99.19% 99.30% 0.00% 236.960274 236.553065 inf inf 3716.933009 3654.336212 3902.157492 3703.073946 0.593517 0.613061 0.280938
99 N07 digital_ok 100.00% 99.14% 99.24% 0.00% nan nan inf inf nan nan nan nan 0.551791 0.518757 0.188428
100 N07 digital_ok 100.00% 99.19% 99.19% 0.00% 234.852537 234.632118 inf inf 4907.743479 4906.501905 7217.292289 7212.601602 0.461135 0.589871 0.282979
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.212724 8.495154 -0.595529 1.004370 0.421986 1.766101 -0.024801 0.457639 0.665134 0.673785 0.385942
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.859991 0.582270 -1.102796 2.092077 0.300778 0.163541 -0.476341 5.898168 0.672152 0.666694 0.378754
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.687757 3.762634 -1.623431 -0.181115 2.712620 0.924267 6.803099 5.088073 0.673390 0.679640 0.372871
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.284861 56.915172 6.271663 6.586969 2.661186 0.462320 -0.080783 1.486565 0.614441 0.655320 0.381048
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.436928 -0.045664 0.000790 0.734634 0.796105 -0.134763 -0.455873 -0.345009 0.677712 0.682075 0.368345
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.342262 -0.813568 0.789826 0.887103 0.848680 -0.317936 -0.295899 -0.127168 0.664707 0.665350 0.361423
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.746142 1.237699 -0.365865 -0.352315 -0.141443 0.029346 2.130876 2.215790 0.673791 0.681988 0.372559
108 N09 RF_maintenance 100.00% 100.00% 4.16% 0.00% 9.326228 37.292010 8.965552 0.719599 8.044723 4.751632 1.006038 4.200719 0.035400 0.285253 0.146889
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.119629 10.448331 9.002991 9.410631 8.139146 8.477726 0.075245 1.344671 0.026711 0.027145 0.001235
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 23.996305 23.165299 12.093189 12.506089 7.989414 8.299338 2.672528 3.096065 0.024350 0.026770 0.001324
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.164115 10.315988 0.239278 9.503533 -0.221318 8.488113 2.776555 1.687348 0.656794 0.038716 0.466854
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.906473 2.623428 -0.012083 0.091400 0.889902 2.525539 -0.268284 -0.570801 0.648636 0.649796 0.396153
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.116438 11.568408 3.479632 4.240191 7.898308 8.284350 0.816699 0.439481 0.035296 0.030925 0.002248
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 20.960267 12.659694 22.385445 11.294751 60.314071 11.438148 1050.400366 108.940244 0.016753 0.025267 0.004997
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.400290 1.418545 1.044886 1.682479 0.181301 1.117897 -1.455518 -1.250644 0.612684 0.632399 0.408714
116 N07 digital_ok 100.00% 98.81% 98.76% 0.00% 236.080513 236.276559 inf inf 4918.461605 4917.366472 7277.389197 7273.373481 0.611121 0.580862 0.291396
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.094089 11.886677 9.079934 9.969847 7.910721 8.378056 0.797666 2.804514 0.028040 0.031407 0.002399
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.480485 1.102111 -0.331043 0.509953 -0.095165 -0.233065 -0.289906 0.280914 0.633713 0.659095 0.398776
119 N07 RF_maintenance 100.00% 99.08% 99.03% 0.00% nan nan inf inf nan nan nan nan 0.710177 0.681450 0.310393
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.511610 2.418491 2.338716 1.702214 0.050742 0.649342 1.163629 -1.599791 0.649589 0.675955 0.380681
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.121558 3.298370 -1.266492 5.313612 0.742929 -0.448058 19.003772 9.756410 0.674296 0.656431 0.371399
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.349050 6.465097 0.024647 0.717125 2.053899 1.445868 -0.304295 -0.610325 0.681778 0.687682 0.376795
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.597149 8.508878 0.462056 0.907651 0.478976 0.186664 -0.326254 0.300110 0.685352 0.691142 0.378504
124 N09 digital_ok 100.00% 0.00% 0.00% 0.00% -0.145891 4.203047 -0.216472 0.543226 -0.531439 -0.588289 0.156907 0.029075 0.685800 0.677060 0.372362
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.813533 -0.935265 -0.454253 0.694408 0.125624 -0.422969 -0.262389 -0.512629 0.672420 0.683801 0.374788
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.690177 6.106478 -1.125208 1.322725 5.441056 -0.141455 31.164128 -0.280877 0.665232 0.680586 0.379768
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.508832 0.293897 0.228364 0.333559 2.379061 1.760224 -0.444595 0.064893 0.671286 0.685282 0.392838
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 8.473556 9.993813 9.075078 9.629393 7.933097 8.315070 -0.056688 0.523640 0.030696 0.028380 0.001213
129 N10 digital_ok 100.00% 99.24% 99.30% 0.00% 192.216433 191.962041 inf inf 3537.441982 3558.623389 3782.728754 3831.881455 0.600316 0.623360 0.179858
130 N10 digital_ok 100.00% 99.51% 99.35% 0.00% nan nan inf inf nan nan nan nan 0.574543 0.597151 0.163152
131 N11 not_connected 100.00% 0.00% 32.31% 0.00% -1.048257 10.809321 -0.294993 4.188206 -0.036300 7.612062 -0.923471 -0.058876 0.631662 0.270869 0.444791
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.038660 0.474560 -0.803344 -1.595888 0.676513 -0.718343 -0.152457 -0.332537 0.610084 0.622953 0.392020
133 N11 not_connected 100.00% 97.35% 0.00% 0.00% 10.665007 -0.563480 3.472922 -1.470633 8.022579 -0.735251 0.889997 -0.605834 0.058893 0.615885 0.474842
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.508490 -0.748091 -0.162862 -1.617521 4.007429 0.561130 8.418516 0.070845 0.616939 0.642247 0.414029
136 N12 digital_ok 100.00% 99.35% 0.00% 0.00% 8.450209 0.440083 8.618871 1.414006 8.133319 15.491028 0.916442 1.441134 0.042643 0.631385 0.468242
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.126343 -0.597302 -0.145486 -1.380166 1.393892 -0.074947 0.129079 0.679689 0.614188 0.652376 0.407390
138 N07 RF_maintenance 100.00% 99.41% 99.46% 0.00% 230.396902 229.889827 inf inf 3732.377099 3716.259028 4733.957241 4653.722820 0.514503 0.481624 0.193634
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.604700 -0.564501 1.148745 -1.323772 0.434118 -1.095434 -1.270609 -0.241754 0.640300 0.654690 0.382026
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.254512 -0.383816 -1.139863 -0.681220 -0.465310 -0.400534 3.033961 2.499124 0.664604 0.684969 0.382281
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.142652 -0.921957 -0.565552 0.214199 1.840085 -1.300094 -0.141096 -1.142427 0.669775 0.686688 0.377132
142 N13 RF_maintenance 100.00% 0.00% 98.97% 0.00% 1.985347 10.326238 -0.917712 9.667535 2.634484 8.428934 15.260215 1.265816 0.674807 0.049101 0.541832
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% 0.679163 10.824671 5.715652 9.654646 -0.358825 8.194175 -0.324256 0.803095 0.613571 0.037022 0.496503
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.442888 0.464837 -0.483667 0.719271 0.137053 1.380062 -0.593215 -0.110914 0.682324 0.689724 0.375904
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.859220 3.649133 -0.350385 4.605024 -0.542661 12.505009 -0.396044 0.599208 0.678400 0.641626 0.391113
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 10.431039 1.399421 3.485163 -0.543219 8.007321 -0.657922 -0.065710 -0.992432 0.038296 0.662782 0.519962
147 N15 digital_ok 100.00% 99.51% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.546295 0.466552 0.216027
148 N15 digital_ok 100.00% 99.14% 99.19% 0.00% nan nan inf inf nan nan nan nan 0.567292 0.527692 0.235003
149 N15 digital_ok 100.00% 99.14% 99.30% 0.00% nan nan inf inf nan nan nan nan 0.575122 0.572118 0.269764
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.133322 -0.085559 1.093275 0.329170 0.139336 -1.118099 -1.557973 -1.115764 0.653638 0.657897 0.403703
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.026272 -0.568189 8.704985 -1.278611 8.140535 1.568672 0.235494 1.772746 0.038275 0.643631 0.476552
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.393035 10.186084 7.365521 9.423098 3.593557 8.492716 0.753011 1.520678 0.453307 0.038943 0.350149
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.357905 -0.026380 -0.222612 0.599234 -0.465711 1.177517 -0.462345 -0.046545 0.632544 0.651059 0.399591
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.327667 -0.140025 -0.470980 -0.985543 1.973979 1.482554 2.318812 9.658534 0.647993 0.668058 0.402610
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.018107 20.755292 -1.682648 -1.085990 -0.865270 4.710516 -0.542906 31.966346 0.621837 0.553286 0.362021
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.588225 0.004747 -0.467172 -0.723304 -0.480523 1.591327 0.087487 0.527506 0.660593 0.668130 0.381515
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.799973 26.871108 -0.237003 -0.633069 0.113324 0.935663 -0.491234 1.806744 0.665756 0.546341 0.342286
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.191528 0.091200 1.849191 0.893052 0.045232 -1.179310 -0.002250 -0.899635 0.673360 0.689785 0.381072
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.578232 0.059478 -0.378652 0.349613 -0.267138 0.835716 -0.499204 0.801660 0.683200 0.683839 0.382837
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.996691 0.613700 0.852906 -0.115880 4.972684 2.727857 0.397428 0.665168 0.674298 0.689547 0.378204
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 29.317483 0.127605 1.944921 0.471594 4.447428 0.433976 5.934569 0.311639 0.520498 0.683208 0.377707
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.099593 1.153439 0.301120 1.925304 0.385978 1.996230 2.738542 9.676334 0.674296 0.676827 0.381299
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.004747 -1.345002 -1.296926 3.454345 1.136390 -0.184544 -0.362158 3.059725 0.677648 0.661517 0.397337
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.757898 -0.663494 -0.004259 -0.408764 1.332912 0.544530 -0.559021 1.525683 0.663372 0.671878 0.399281
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.385684 -0.441688 -1.036418 -1.678417 0.825848 0.768327 -0.823071 -0.941451 0.661904 0.676668 0.403549
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 9.926591 -0.497468 9.201854 -1.239828 7.871662 -0.057123 0.359111 0.339743 0.040329 0.670636 0.522938
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.877636 -0.471218 1.607314 3.087609 -1.142911 1.603910 -0.602908 13.156093 0.604898 0.642485 0.388582
180 N13 RF_maintenance 100.00% 0.00% 99.24% 0.00% -0.079959 11.053581 -0.289192 9.793951 1.245480 8.345892 12.494567 1.693676 0.657369 0.055019 0.543442
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.607198 -0.026932 -0.143907 0.273358 0.549249 0.253865 -0.508768 3.507741 0.666870 0.675650 0.389481
182 N13 digital_ok 100.00% 0.00% 99.57% 0.00% 0.408333 10.146099 -0.688683 9.393911 0.110459 8.490431 6.971356 1.493129 0.674343 0.049745 0.515817
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.767572 1.349554 1.071872 4.633048 0.633231 -0.385575 0.401485 -0.197549 0.658344 0.627300 0.370479
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.062774 -0.750046 0.614875 3.243123 -0.437207 -0.741375 0.234393 0.283320 0.659333 0.664871 0.371973
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 16.802103 -1.378282 7.379707 4.200729 8.754507 -1.174831 0.351739 -0.237213 0.371013 0.650147 0.408960
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.687697 -1.081375 -1.690189 -0.902771 1.318011 -0.256192 -0.255970 -0.612655 0.679818 0.693463 0.394088
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.303535 -0.566631 -1.552981 2.274351 0.096068 3.704793 0.702646 10.679730 0.674433 0.670789 0.386553
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 7.803901 9.980171 8.470579 9.453078 7.910467 8.499322 16.628297 0.921347 0.028763 0.031479 0.001192
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.180138 -1.102401 -0.791271 -0.073912 -0.460081 -0.472398 -0.578513 -1.194190 0.655258 0.670256 0.405813
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 3.014703 0.230020 0.997455 -0.413304 0.404339 1.040608 9.752770 0.090169 0.623801 0.660659 0.415019
200 N18 RF_maintenance 100.00% 100.00% 49.76% 0.00% 10.882877 33.636787 3.630156 0.307246 8.167981 5.733812 0.971709 1.326763 0.041723 0.234792 0.158918
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.502001 5.006216 2.572291 3.552030 2.744217 5.243871 -1.007351 -2.005475 0.652043 0.647852 0.387910
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.153764 0.483223 1.264055 -1.638030 0.539392 1.121697 -1.353407 17.899741 0.661284 0.653498 0.382059
203 N18 RF_maintenance 100.00% 99.35% 99.30% 0.00% nan nan inf inf nan nan nan nan 0.632954 0.583463 0.205743
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.247493 2.309021 0.297756 -1.046223 -1.124155 -0.251489 -0.673563 4.969185 0.649702 0.641516 0.377738
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.472529 3.191862 1.076378 -1.220814 10.732400 -0.612727 0.075061 3.397073 0.652866 0.635234 0.384197
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.373449 2.647975 1.007639 -1.434766 0.310801 -0.039988 -0.739798 0.051523 0.632713 0.632824 0.362475
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.655981 13.217180 8.376894 9.714639 7.734038 8.606079 12.050083 41.377090 0.034385 0.037838 0.001382
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.099879 7.400805 8.148123 8.698428 7.300266 8.799785 10.195427 13.259310 0.041700 0.040517 0.002241
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 12.581837 7.352611 -1.055532 -0.929841 -0.706220 -0.585312 -0.641376 -0.401420 0.644062 0.642336 0.398129
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.304776 -1.041737 -1.196890 -0.370718 -0.816298 -1.258781 2.060139 -0.607873 0.599638 0.629374 0.400066
219 N18 RF_maintenance 100.00% 99.24% 99.30% 0.00% nan nan inf inf nan nan nan nan 0.552426 0.476550 0.199508
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.643964 -1.245460 0.124689 -0.841097 -0.614687 -0.958757 1.365259 -1.120634 0.646534 0.651313 0.385314
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.828565 -0.688465 -1.428925 -1.068004 0.544555 -1.429520 1.833727 -0.710072 0.630963 0.656724 0.390533
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.181481 -0.710123 -0.482436 -0.268821 0.089847 -1.439920 2.008974 -1.293879 0.642568 0.665453 0.394024
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.673719 3.416409 -1.651651 1.880131 -0.672469 1.940042 0.236068 0.935497 0.632665 0.556605 0.401611
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.692245 6.425206 4.585870 4.169435 6.461649 6.466808 -2.781025 -2.517868 0.615505 0.641897 0.385939
225 N19 RF_ok 100.00% 0.00% 89.63% 0.00% 1.201447 10.901987 0.576694 4.048353 -0.846908 8.298264 -1.222704 0.634047 0.649737 0.130917 0.532646
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.136779 0.781437 -0.165510 0.852417 -1.187215 0.936048 -0.812712 -0.769450 0.640492 0.662305 0.398910
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 5.579889 0.131004 -1.506082 -0.337594 0.206668 -1.214281 10.735530 -0.690923 0.592397 0.645612 0.390665
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 21.126915 15.551120 -0.570550 -0.571847 2.250383 4.241370 25.534010 51.095370 0.487149 0.546386 0.294365
229 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.222454 0.166833 0.887809 0.863518 -0.695141 0.042265 10.250884 -1.502711 0.622597 0.642933 0.406260
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.630264 -0.228821 -0.255370 -1.657626 -0.231836 -0.389932 0.176356 -0.747348 0.579885 0.633353 0.408247
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.390432 -0.820824 0.623340 -0.000468 -0.519736 0.517862 -1.405764 -1.412893 0.642960 0.652988 0.398685
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.035503 -1.066824 0.131836 0.253192 -0.402907 -0.318230 1.074217 0.905230 0.640995 0.656137 0.396057
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.053792 39.662177 2.069829 0.958985 3.694885 7.311778 17.024459 70.098215 0.508086 0.439809 0.245859
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.702486 3.268679 -0.995258 0.425655 -0.853157 -0.350068 3.791348 14.843103 0.630379 0.608567 0.392281
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 47.984153 1.832526 0.232641 1.254825 6.916718 0.717590 24.572304 -1.133024 0.379144 0.655411 0.457883
243 N19 RF_ok 100.00% 10.97% 0.00% 0.00% 57.305689 2.111991 0.559371 -1.632624 4.914433 -0.216276 -1.151068 -0.291280 0.283563 0.634302 0.490524
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.211186 1.524220 1.070882 -0.779014 1.650466 0.591207 1.874878 7.108977 0.516967 0.608545 0.391397
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.402813 1.339894 -0.071251 -1.269686 -1.100503 -1.210654 -1.310620 0.025641 0.618266 0.625843 0.394324
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.262155 7.077875 -0.937263 -0.850671 3.525300 4.099557 1.199615 -0.196175 0.337710 0.338876 0.160354
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.213492 1.066199 0.387963 -0.795699 -0.481985 -0.998576 3.267785 2.612909 0.619168 0.626736 0.394482
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 5.898433 7.407727 8.152835 8.956651 8.257025 8.096779 10.127236 16.433684 0.032166 0.027593 0.004020
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 9.546101 11.304985 4.604332 6.250227 3.364622 8.525596 7.456871 3.132790 0.371452 0.045991 0.287339
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.882317 2.069040 0.810792 1.060257 0.281232 0.804042 1.077878 0.715954 0.526421 0.548611 0.382648
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.498786 -1.127878 0.910400 -1.626389 0.817343 -0.084761 -0.276529 1.129749 0.556783 0.564722 0.390040
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.092005 -1.251639 -1.023823 -0.739635 0.228976 -0.057893 2.156460 -0.088764 0.494157 0.555110 0.392443
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.503056 1.922720 -0.794834 -1.624461 -0.710983 -0.431326 0.692628 0.669293 0.494911 0.535905 0.378647
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 9, 10, 15, 16, 18, 21, 27, 28, 29, 30, 32, 34, 36, 37, 40, 42, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 78, 80, 81, 84, 86, 87, 92, 93, 94, 96, 97, 98, 99, 100, 101, 102, 103, 104, 108, 109, 110, 111, 113, 114, 116, 117, 119, 121, 122, 123, 124, 126, 128, 129, 130, 131, 133, 135, 136, 138, 142, 143, 145, 146, 147, 148, 149, 155, 156, 158, 159, 161, 164, 165, 166, 170, 179, 180, 182, 183, 185, 187, 189, 191, 200, 201, 202, 203, 205, 206, 208, 209, 210, 219, 224, 225, 227, 228, 229, 240, 241, 242, 243, 244, 246, 262, 320]

unflagged_ants: [5, 8, 17, 19, 20, 22, 31, 35, 38, 41, 43, 44, 45, 46, 48, 49, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 77, 79, 82, 83, 85, 88, 89, 90, 91, 95, 105, 106, 107, 112, 115, 118, 120, 125, 127, 132, 137, 139, 140, 141, 144, 150, 157, 160, 162, 163, 167, 168, 169, 181, 184, 186, 190, 207, 211, 220, 221, 222, 223, 226, 237, 238, 239, 245, 261, 324, 325, 329, 333]

golden_ants: [5, 17, 19, 20, 31, 38, 41, 44, 45, 65, 66, 67, 69, 70, 83, 85, 88, 91, 105, 106, 107, 112, 118, 127, 140, 141, 144, 150, 157, 160, 162, 163, 167, 168, 169, 181, 184, 186, 190]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2459944.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.dev13+gd6c757c
3.1.5.dev197+g9b7c3f4
In [ ]: