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 = "2460015"
data_path = "/mnt/sn1/2460015"
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: 3-11-2023
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

# find the auto_metrics file
glob_str = os.path.join(data_path, f'zen.{JD}*.auto_metrics.h5')
auto_metrics_file = sorted(glob.glob(glob_str))

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2460015/zen.2460015.21293.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/2460015/zen.2460015.?????.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/2460015/zen.2460015.?????.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 2460015
Date 3-11-2023
LST Range 5.811 -- 15.773 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 25
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas 42, 70
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 63 / 198 (31.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 132 / 198 (66.7%)
Redcal Done? ❌
Never Flagged Antennas 65 / 198 (32.8%)
A Priori Good Antennas Flagged 62 / 93 total a priori good antennas:
3, 5, 7, 15, 16, 17, 30, 31, 37, 38, 40, 42,
45, 53, 54, 55, 65, 66, 67, 69, 70, 71, 72,
81, 86, 93, 94, 101, 103, 107, 109, 111, 112,
121, 122, 123, 124, 127, 136, 147, 148, 149,
150, 151, 158, 161, 165, 167, 168, 169, 170,
173, 181, 182, 184, 187, 189, 190, 191, 192,
193, 202
A Priori Bad Antennas Not Flagged 34 / 105 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 50, 57, 61, 62, 64,
73, 74, 89, 90, 115, 125, 132, 133, 137, 139,
179, 220, 228, 229, 237, 238, 239, 241, 245,
320, 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_2460015.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% 0.00% 100.00% 0.00% 1.164125 15.477018 0.187080 11.687062 0.745048 6.958321 -0.485032 1.366543 0.566891 0.045412 0.504321
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.194586 14.510730 2.264564 2.148850 1.729499 4.035020 -2.808954 5.612025 0.560394 0.432779 0.351114
5 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 12.117909 15.258731 11.022843 11.398835 5.863043 7.015990 0.486829 0.165161 0.044293 0.036913 0.004139
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.028111 -0.024922 -0.861190 -0.046119 0.391941 0.483257 8.547735 13.480623 0.580600 0.587546 0.352587
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.152502 -1.552155 -0.074249 0.296235 0.502851 0.913268 1.009763 2.888636 0.578151 0.582711 0.346065
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.804457 -0.809231 3.656296 -0.860906 -0.519893 -0.040262 1.620092 -0.687308 0.556601 0.581334 0.352339
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.828847 -1.157224 -0.040516 -1.138357 -0.614825 0.423143 0.491446 -0.039935 0.571022 0.577323 0.349217
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 29.893102 -0.126122 3.745299 3.224601 2.589836 0.467852 0.723041 2.394699 0.423785 0.569803 0.350740
16 N01 digital_ok 100.00% 0.00% 100.00% 0.00% 2.435860 15.437829 3.359353 11.656809 0.495231 6.947805 3.530738 1.190641 0.551858 0.035368 0.458414
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.805356 7.778084 0.916461 10.387719 1.279119 3.085348 0.194626 2.951071 0.585697 0.366836 0.426032
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.327658 9.486980 11.050755 0.657459 5.849691 3.346886 0.735114 38.192126 0.035740 0.381525 0.302542
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.283267 -0.084866 -0.633978 0.523159 0.152757 -0.554320 -0.264880 -0.936445 0.593587 0.601813 0.351485
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.028177 -1.299346 2.303572 -0.904247 1.831036 0.415470 1.935856 -0.379235 0.578547 0.598313 0.348886
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.732023 0.220522 -0.247134 0.244664 0.622726 0.745401 -0.269791 -0.351181 0.573788 0.575620 0.339636
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.901306 -0.164785 -0.123908 -0.224761 -0.218416 0.570404 -0.060667 -1.022425 0.549464 0.557919 0.343259
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.000483 14.435462 11.113925 11.493910 5.837245 7.014034 2.509630 1.973180 0.030356 0.030321 0.000530
28 N01 RF_maintenance 100.00% 100.00% 0.86% 0.00% 11.375047 22.107666 10.868868 4.359700 5.845983 3.268614 0.284180 28.454688 0.028664 0.256512 0.193336
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.673136 -0.218896 2.960582 0.740496 0.398640 0.672681 2.710581 1.793769 0.586339 0.596656 0.350570
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.151310 -0.756386 0.617158 -1.267658 1.848636 0.281525 5.962870 -0.746168 0.589792 0.610900 0.353424
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.697939 -0.902877 1.390162 1.581814 1.859539 0.081095 0.454371 6.510532 0.603668 0.602805 0.346973
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 19.573143 28.893747 1.354876 3.472044 4.240810 0.345571 12.765803 9.003828 0.506469 0.484509 0.233792
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 13.330482 16.190515 5.599587 5.867134 5.825235 6.991459 1.879641 1.423906 0.035033 0.048552 0.008451
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.466241 -0.649992 0.284519 -1.255424 -0.830670 -0.822157 1.836354 -0.007702 0.556783 0.551339 0.340376
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.526697 8.660455 1.270622 0.914093 1.313250 1.768285 0.811809 1.192706 0.563126 0.562884 0.369340
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.034618 24.956759 -0.304230 13.686186 -0.541884 6.961693 -1.111775 3.303893 0.579510 0.033563 0.467460
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.799161 0.511306 -1.251746 2.862147 0.404764 0.094032 5.169972 12.571652 0.587237 0.566489 0.365616
40 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.022366 1.019285 3.010455 -0.201697 0.178159 0.846462 2.612640 8.506470 0.578802 0.597243 0.356199
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.408405 1.174809 1.653463 1.304956 2.127133 0.033813 1.164862 0.982871 0.598513 0.605513 0.352570
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.925733 2.992629 3.201017 -0.960745 2.105520 1.031422 0.421616 1.514778 0.250484 0.246030 -0.276731
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.517479 0.053645 -0.493773 0.870100 -0.805537 1.090590 -1.125767 0.301605 0.608853 0.611461 0.346039
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.357242 0.015843 -0.851718 -0.246538 -0.684798 0.752486 -0.209687 0.229384 0.609121 0.620204 0.349272
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.912904 4.523416 0.761619 0.924284 0.182772 1.759819 0.908655 11.108561 0.596898 0.600971 0.341739
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.831559 -0.638068 -0.270808 -1.052066 0.189988 -0.335298 0.445521 -0.125575 0.596112 0.612036 0.355618
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.256636 15.831096 5.500089 5.482315 5.814178 6.941173 3.472672 0.949111 0.031939 0.058297 0.016821
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.353344 1.238394 -0.658444 1.423348 -0.384505 1.444376 1.198989 -2.532417 0.555842 0.573649 0.347217
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.453500 -0.287703 0.309048 -0.568803 -0.757535 -0.617598 0.149376 5.729925 0.522066 0.553221 0.345655
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.818821 0.894480 0.241682 1.912892 0.220587 1.282106 0.440348 0.366375 0.565579 0.561547 0.364400
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.702436 2.008782 -0.019934 0.199319 1.365104 1.596103 76.552060 3.198161 0.576570 0.578806 0.360039
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.794766 6.177857 0.559109 0.239747 1.452318 1.198370 3.350613 1.863712 0.589272 0.592670 0.359238
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.084985 1.994901 -0.075457 -0.375192 1.593754 -0.218457 13.241556 1.693515 0.599397 0.606127 0.360722
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 14.563158 4.711714 2.207751 0.063398 3.279350 2.327859 -0.565668 -0.421447 0.302675 0.362677 0.149030
55 N04 digital_ok 100.00% 0.27% 100.00% 0.00% 0.596489 57.702054 0.792846 7.458995 0.320042 7.231402 3.941758 2.535088 0.265365 0.042795 0.099459
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.789432 0.486820 -0.883862 2.754896 -0.443773 2.034481 -0.613045 3.530590 0.611415 0.610265 0.341257
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.086244 -0.001468 2.421095 -0.685295 1.915163 0.612855 -2.303391 0.554983 0.605653 0.618742 0.342297
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.836411 14.841753 11.003287 11.607603 5.791998 6.964012 2.265185 1.710612 0.037803 0.037014 0.001896
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.849487 0.596869 10.542824 0.751518 5.707411 1.798964 1.210268 3.212216 0.051142 0.609441 0.465252
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.714381 14.784285 -0.066192 11.637773 0.357222 6.951723 1.295929 3.193599 0.595686 0.075721 0.468063
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.161445 -0.264610 0.287065 -1.067260 0.279519 -0.943118 0.029802 0.924398 0.540922 0.572994 0.343044
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.434585 1.202720 -0.463566 0.943896 -1.021727 0.002449 0.043944 -1.906958 0.543242 0.575167 0.348320
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 1.646254 15.320227 -0.651944 5.899665 -0.548362 7.028382 -0.904164 2.672559 0.549900 0.046522 0.427422
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.228201 -0.138744 -1.240491 -0.506545 -0.879705 -1.053287 1.762781 -0.209339 0.545501 0.536745 0.337381
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 26.059449 24.690559 14.135122 14.128389 5.900273 7.044868 5.863791 7.153203 0.022578 0.024711 0.002365
66 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.438259 1.148960 7.127587 3.329596 0.303415 -0.017908 6.346841 4.556831 0.536994 0.577192 0.371223
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.495329 0.072259 -1.101483 1.074008 0.370537 0.992781 7.601282 2.682361 0.593716 0.586487 0.354244
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 28.042355 0.817589 14.256484 0.845508 5.773636 -0.528132 7.103211 -0.842808 0.035969 0.606951 0.474242
69 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.522839 0.336146 0.595487 3.011386 0.405727 1.132252 5.819664 1.731579 0.607321 0.602874 0.344191
70 N04 digital_ok 100.00% 0.00% 0.00% 100.00% -0.180615 1.880403 1.336691 3.395897 3.089731 0.695298 4.772182 1.991586 0.263543 0.246251 -0.275161
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.599711 -0.401878 0.183230 4.712179 0.735722 -0.082426 2.314373 3.492791 0.609436 0.602280 0.335710
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 1.574660 0.691450 1.765257 7.821062 0.701775 0.542213 0.297273 11.351362 0.614090 0.557581 0.355178
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.498099 0.400993 -0.966868 -0.420690 0.948642 -0.634350 -0.388909 -0.560361 0.619173 0.625414 0.345733
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.771079 -0.066737 -0.333893 -0.385920 -0.412096 1.625145 -1.177194 1.869728 0.614947 0.624076 0.349704
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 55.437110 22.613992 0.594876 -0.524565 3.291597 1.507728 5.214614 -0.167594 0.336084 0.468737 0.255819
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 30.676622 0.897554 -0.381848 1.204638 1.500431 0.640542 2.923912 -0.555392 0.408640 0.579566 0.340590
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.045406 15.599369 -0.939766 5.901694 -0.347107 6.912966 0.053611 -0.214201 0.548594 0.040916 0.440350
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.602538 16.554191 0.077446 5.804563 -0.813882 6.928471 -0.915721 1.219896 0.559831 0.063524 0.441719
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.503292 15.680189 0.489451 10.215838 0.600046 6.756419 0.162507 1.961924 0.535983 0.038854 0.411109
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.484499 0.159573 -0.642656 0.973620 0.509847 5.794991 -0.294479 7.806773 0.572203 0.567765 0.355035
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.117524 0.039021 0.593652 0.676551 0.872657 0.678129 -0.091942 1.664427 0.580973 0.579416 0.350451
84 N08 RF_maintenance 100.00% 69.10% 100.00% 0.00% 20.868069 27.228321 13.811925 14.477715 4.399056 6.914839 4.199082 4.980668 0.201942 0.038984 0.135560
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.678704 1.695367 -1.222322 -1.262076 -0.871292 -0.002449 -0.982100 -0.436605 0.610298 0.611847 0.347052
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.164753 1.172509 0.183571 -0.014251 0.513267 0.854342 0.965502 19.968834 0.609793 0.617731 0.340269
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.192140 7.190370 0.802962 0.073153 9.564340 1.189436 20.938330 6.228531 0.569106 0.631729 0.326799
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.556470 0.585673 0.780681 1.245557 0.389037 -0.497069 1.771355 0.251627 0.611108 0.620019 0.332963
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.025226 0.438631 0.640627 1.184049 -0.134485 0.048887 -0.441041 -0.411943 0.610500 0.621378 0.339597
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.058003 -0.402687 -0.734415 -0.530651 -0.246036 -1.216607 -0.240418 2.062921 0.609127 0.624397 0.344312
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.440607 -0.208806 0.937103 0.620413 0.112984 0.224518 0.455362 0.448545 0.589360 0.610671 0.347370
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.436405 0.000478 10.998419 0.488045 5.866770 1.602019 0.240249 0.563541 0.036864 0.608898 0.409057
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.808473 15.051035 11.129781 11.708840 5.756037 6.929246 2.745230 1.923838 0.030957 0.025003 0.003239
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.613372 15.341954 11.244497 11.508109 5.842309 6.959172 0.973812 0.532784 0.025449 0.025405 0.001060
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.690956 1.969074 -1.008960 0.619227 2.301210 1.690111 -0.604898 0.040531 0.416263 0.422836 0.188059
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 4.726042 18.775857 3.161387 1.442951 2.858837 2.333787 -3.455489 -2.402346 0.551876 0.461056 0.332712
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.493315 4.151044 -1.108341 1.032440 -1.018873 -0.012014 0.051850 11.674260 0.543043 0.510589 0.344425
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.682425 8.668658 0.085334 1.350104 0.531114 1.730436 -0.067561 0.407623 0.599176 0.602106 0.347898
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.792494 0.844394 -0.966376 -1.208293 -0.251328 0.179222 -0.630328 4.709176 0.601427 0.612893 0.343614
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.394604 3.511529 1.870986 -1.165285 4.046008 1.041517 5.041530 8.144533 0.605533 0.612595 0.335049
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.390827 62.095456 -0.136477 7.494608 2.060522 -0.009701 0.560197 2.295683 0.608893 0.597175 0.334650
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.146717 0.303730 0.562670 1.265201 1.098211 0.245872 -0.393461 -0.426894 0.615008 0.621722 0.336305
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.043210 1.357808 -0.413024 -0.121566 -0.465257 -0.549072 -0.572811 -0.376708 0.613417 0.623815 0.337479
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 2.593409 0.608665 0.281472 -0.306340 1.135592 0.330214 6.459764 4.859780 0.606144 0.622875 0.338573
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.497555 43.974406 11.043564 1.266188 5.803825 2.716120 1.883783 1.995765 0.035686 0.294229 0.147087
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.243370 14.840299 11.086836 11.375915 5.839967 7.010744 0.413233 1.801566 0.066186 0.035190 0.021051
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.814800 10.990666 6.429480 -0.031953 5.730189 -0.113854 11.903723 -0.770726 0.527363 0.564545 0.323264
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 22.501302 14.743866 1.144466 11.468916 4.915886 7.007046 21.072564 2.348309 0.501933 0.063077 0.360262
112 N10 digital_ok 100.00% 63.26% 100.00% 0.00% 1.984909 14.337386 7.848945 11.535524 0.081666 6.760226 0.021663 0.559767 0.195183 0.076550 -0.091376
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.579733 16.260894 5.226316 5.895309 5.739439 6.906258 2.688808 1.427729 0.034195 0.031228 0.001827
114 N11 not_connected 100.00% 100.00% 0.00% 0.00% 14.482291 1.114504 5.395965 -0.215989 5.712122 -0.937003 0.504563 0.027892 0.048045 0.554212 0.424543
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.330751 -0.908955 -1.342308 -0.030241 -1.003296 -0.749566 -0.528676 -0.147719 0.527863 0.544864 0.352851
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.384891 16.501324 11.158852 11.955353 5.732802 6.932887 1.223905 3.702206 0.028421 0.032418 0.002592
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.599945 1.699566 0.385261 0.752745 -0.104450 1.056979 -0.367772 0.151308 0.576116 0.581996 0.356394
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.870204 2.021857 2.941563 -1.065402 1.913093 1.652480 22.083365 17.122165 0.584090 0.605323 0.339141
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.367791 3.103222 -1.128275 6.423814 0.936061 -0.389588 28.330329 23.786369 0.612980 0.592941 0.336515
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.130097 6.598740 -0.762935 -1.093561 -0.377994 0.462018 -0.216013 -1.096056 0.615964 0.627343 0.340324
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.142258 8.939669 1.152649 1.313411 1.084221 1.096574 -0.350096 0.245279 0.621238 0.627516 0.340195
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 11.625186 0.750010 11.308591 0.892549 5.723025 0.668468 0.621616 0.740082 0.042733 0.620949 0.418852
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.440141 -0.672328 1.031813 1.211437 1.395880 0.022086 0.966056 0.865549 0.610958 0.617526 0.342002
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.010169 7.498221 -0.282632 2.087264 0.185619 0.756207 3.977596 0.098249 0.608944 0.611879 0.345282
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 11.055723 0.093898 10.995355 2.501238 5.864165 0.110250 1.067363 2.827778 0.033669 0.605156 0.395328
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.217579 -0.338587 -0.968282 -0.303050 0.011374 -0.585260 0.021908 3.516359 0.599089 0.603758 0.362686
131 N11 not_connected 100.00% 0.00% 41.27% 0.00% -0.843442 14.701540 -0.277566 5.795362 -0.613684 6.167579 -1.166973 -0.006931 0.558123 0.226316 0.395782
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.197958 0.271858 -0.473943 -1.209921 -0.287555 -0.764425 0.671223 -0.056586 0.548063 0.544719 0.347607
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.112402 -1.185238 -1.167121 -0.538573 -0.896337 -0.886747 -0.707746 0.889086 0.525005 0.549050 0.356981
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.116076 16.217994 5.372284 5.860569 5.742038 6.920638 0.687681 1.094919 0.041881 0.034833 0.004037
135 N12 RF_maintenance 100.00% 99.89% 99.84% 0.00% 197.581682 198.565830 inf inf 2214.085999 2217.166920 6060.457872 6267.805678 0.240820 0.352002 0.268962
136 N12 digital_ok 100.00% 99.95% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.081424 0.264947 0.222151
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.370906 -0.514118 0.420273 -1.343482 1.714327 -0.070516 1.183520 1.556008 0.558878 0.574010 0.354728
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.262247 1.616077 1.114792 -1.083136 0.176276 -0.881849 -0.913305 0.083715 0.584336 0.574615 0.336099
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.672881 -1.056407 -0.353960 -0.396852 -0.258252 -0.919682 3.634467 1.900112 0.603775 0.612657 0.339931
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.831760 -0.600564 0.030241 0.441961 1.463809 -0.501746 1.775130 -1.429855 0.605986 0.617938 0.339096
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.609944 14.865509 -0.422197 11.646665 1.511109 6.969938 16.465156 1.712889 0.611409 0.049279 0.501448
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.281712 14.732432 10.914294 11.612918 5.356211 6.983461 0.228339 1.415631 0.105540 0.030593 0.060473
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.019360 0.686853 -0.771153 3.517746 0.141883 -0.355001 -0.802789 0.086951 0.618015 0.610009 0.346038
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.110017 -0.483226 2.114453 0.571241 0.386927 3.174734 0.260256 -1.641850 0.604938 0.621243 0.347414
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.298844 -0.630427 -1.200627 -0.838092 -0.890673 -1.313168 -0.393377 -0.906024 0.580585 0.596890 0.344427
147 N15 digital_ok 100.00% 99.78% 99.73% 0.00% 179.304385 179.549228 inf inf 2007.616000 2011.276865 8691.234929 8639.717931 0.354700 0.306753 0.321692
148 N15 digital_ok 100.00% 99.89% 99.84% 0.00% 226.345172 226.724875 inf inf 2499.052737 2459.581853 8291.293505 7989.039920 0.451713 0.346288 0.113052
149 N15 digital_ok 100.00% 99.89% 99.84% 0.00% 216.976832 216.410745 inf inf 1972.265742 1987.636871 5348.945306 5264.450771 0.496431 0.171600 0.514972
150 N15 digital_ok 100.00% 99.78% 99.78% 0.00% 169.176523 170.406082 inf inf 2217.401147 2199.607508 7981.424210 8008.802252 0.357087 0.232031 0.308055
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 12.031620 0.873620 -0.293247 0.835313 1.717344 -0.422041 33.946631 -0.083165 0.488240 0.520110 0.316671
155 N12 RF_maintenance 100.00% 99.73% 99.84% 0.00% 250.933701 250.615003 inf inf 3215.817167 3217.567854 9685.902758 9326.906074 0.423552 0.265079 0.371876
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.466904 14.653149 8.949956 11.424403 1.574601 7.030485 0.931631 2.126803 0.407540 0.041114 0.317655
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.701575 -0.311068 0.471963 0.955640 0.570374 1.490280 0.351383 0.089781 0.565044 0.572284 0.353621
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.701298 -0.560805 0.097382 -0.005781 1.889408 1.437047 3.526803 18.341982 0.579053 0.587650 0.351852
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.644408 25.454103 -0.868837 -0.584912 -0.607778 2.679532 0.218194 11.912727 0.554201 0.470805 0.320902
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.077891 -1.090286 -0.038311 -0.502261 0.251403 1.492342 -0.762202 0.853816 0.595736 0.605667 0.344771
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.171039 32.381761 0.428086 0.013297 0.959108 0.555172 -0.322561 2.539011 0.601935 0.481931 0.317871
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.691763 -1.220689 -0.166831 -1.074024 -0.164514 0.280929 1.929901 -0.525849 0.612957 0.620779 0.345483
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.555018 1.438932 0.272503 0.672430 0.717609 0.717459 0.151011 1.069238 0.615231 0.620988 0.348448
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.212144 0.535843 0.284911 1.545902 0.612680 2.342026 0.210440 0.875783 0.611164 0.612893 0.341068
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 26.702132 -0.056533 -0.288052 -0.606621 1.585298 0.515940 10.004455 -0.005419 0.498328 0.615629 0.342860
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.779290 0.001468 1.096421 0.587504 0.615666 -0.461310 -0.129265 -2.207057 0.600589 0.610549 0.341185
167 N15 digital_ok 100.00% 99.84% 99.84% 0.00% 199.515329 200.372935 inf inf 2248.327335 2261.810358 7878.765695 7821.880461 0.356546 0.462376 0.399513
168 N15 digital_ok 100.00% 99.78% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.537576 0.538371 0.382558
169 N15 digital_ok 100.00% 99.95% 99.95% 0.00% 257.714768 257.839746 inf inf 3227.815660 3227.675096 11804.617180 11806.165247 0.582619 0.576046 0.147803
170 N15 digital_ok 100.00% 99.89% 99.84% 0.00% 225.740415 211.113130 inf inf 2157.127212 2169.118007 5901.081918 6426.348482 0.524510 0.419287 0.394453
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.676100 1.465209 -1.205763 -0.064718 -0.953572 -0.594076 -0.448334 1.661413 0.532720 0.515110 0.336652
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 13.727911 15.444999 4.971172 5.519401 5.885002 7.029751 3.616475 6.457206 0.035882 0.042749 0.004365
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.820353 -0.452887 -0.195746 0.420602 0.621866 1.124294 -0.638334 0.584784 0.567583 0.584936 0.351975
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.026867 15.580276 -1.147039 11.777080 0.441256 6.921454 18.086956 2.898777 0.594217 0.056116 0.491871
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.364132 0.101367 1.250073 0.824315 0.044315 0.852894 -0.234263 4.623898 0.598960 0.603253 0.350562
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.176406 14.554369 -0.461803 11.357707 -0.456454 7.017774 5.551098 2.570690 0.608693 0.051459 0.462077
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.186972 0.447515 0.581791 1.034108 1.435802 0.594499 0.600705 -0.155285 0.597918 0.606076 0.337604
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 20.401768 -0.540201 7.189578 -0.958625 5.912991 0.671187 4.862395 0.021090 0.445059 0.615055 0.362755
185 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.966516 -0.072275 3.223353 0.738774 3.267013 0.041716 -3.094271 -0.882087 0.580601 0.612452 0.352430
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.118807 -1.005693 0.225287 -0.370371 -0.942180 -0.875209 -1.206688 -1.185250 0.607712 0.612352 0.350086
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.395765 -0.838614 -1.157765 -0.193566 -0.015846 -0.094824 7.902236 -0.292413 0.592136 0.601045 0.350839
189 N15 digital_ok 100.00% 99.78% 99.73% 0.00% nan nan inf inf nan nan nan nan 0.531759 0.543879 0.492905
190 N15 digital_ok 100.00% 99.78% 99.78% 0.00% 223.004741 223.077791 inf inf 1768.581779 1759.530562 6781.732616 7008.617494 0.419090 0.401757 0.360036
191 N15 digital_ok 100.00% 99.73% 99.73% 0.00% 172.171117 173.654566 inf inf 1679.779093 1662.278179 7787.132364 7772.712863 0.505864 0.468713 0.365531
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 1.722924 6.985450 1.845145 4.110454 1.443296 5.794835 0.903599 -4.313613 0.540824 0.508646 0.354866
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.387086 1.128231 4.226318 1.273715 4.722319 1.319997 -4.352022 -1.042092 0.506699 0.535793 0.365068
200 N18 RF_maintenance 100.00% 100.00% 47.76% 0.00% 13.306462 40.095893 5.387878 -0.015330 5.869979 2.916959 2.423320 4.204676 0.041611 0.220801 0.143612
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.202033 5.158568 2.593478 3.535043 2.276650 4.819416 -2.095029 -3.811522 0.574898 0.567014 0.342818
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.704381 0.862812 1.213148 -1.322030 0.710248 -0.253058 -1.421455 48.471310 0.588403 0.580121 0.340678
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.562701 15.054163 1.591091 -0.907284 -0.126621 -0.051198 19.911177 1.465677 0.594295 0.607682 0.349033
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 9.544838 0.207155 3.912805 -0.800951 3.603586 -0.791823 34.869009 9.923487 0.355109 0.585870 0.410119
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.287720 6.342570 0.156169 3.046732 0.320084 1.332361 -0.079708 0.366303 0.540019 0.471676 0.338099
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.878992 1.844379 -0.941112 -0.579415 -0.983124 -0.741431 7.499663 -0.593998 0.566907 0.557882 0.341432
208 N20 dish_maintenance 100.00% 99.84% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.327944 0.392906 0.291346
209 N20 dish_maintenance 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.625693 0.481176 0.557339
210 N20 dish_maintenance 100.00% 99.95% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.214448 0.032780 0.208970
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% 0.266967 15.363163 -1.246781 5.926135 -0.871838 6.916351 -0.102905 1.001118 0.528050 0.040652 0.449249
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.101043 -0.706940 0.174130 -0.516099 -0.720702 -0.844747 2.808809 -1.459838 0.578915 0.573848 0.344578
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.047244 -0.423871 -1.302016 -0.807294 -0.127166 -1.114673 14.552461 -0.823780 0.566383 0.581114 0.344218
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.389918 -0.085569 -0.390555 0.004359 -0.608425 -0.713033 5.455138 -1.044101 0.573768 0.586439 0.345401
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.692015 -0.946928 -0.959178 -0.372571 -1.025541 -0.876538 0.390086 7.725734 0.565439 0.583881 0.346790
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.554937 6.329633 4.398966 4.004172 4.962661 5.515504 -4.423884 -3.785660 0.540120 0.555345 0.340833
225 N19 RF_ok 100.00% 0.00% 90.60% 0.00% -0.549569 14.831721 0.467599 5.667915 -0.828529 6.710999 -1.618346 1.501647 0.576173 0.142167 0.461912
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.544813 19.839354 -0.728255 0.474791 -1.027591 2.146276 -1.244154 0.340313 0.563111 0.476338 0.337403
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 3.734611 0.968851 2.533121 -0.438244 0.146611 -0.788337 7.555699 8.183239 0.459325 0.538834 0.359219
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.150502 0.474800 0.620606 -1.302371 -0.089741 -0.640040 -0.300406 0.141693 0.542352 0.533752 0.339990
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.395116 0.895807 0.560775 1.162548 -0.254881 0.898014 -1.836522 -2.755783 0.543699 0.546193 0.359247
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.270236 -0.474210 0.458179 -1.333654 -0.575761 -0.769653 -0.157056 -1.361208 0.516666 0.555162 0.355124
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.147755 -0.435440 0.613040 0.370739 -0.469022 -0.810803 -1.988998 -2.229859 0.570906 0.571483 0.353673
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.184276 -1.154675 -0.370978 -0.338854 -0.686139 -1.132220 -0.366464 2.422281 0.569640 0.572166 0.351188
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.782604 0.072810 0.369123 -1.007232 -0.947916 -1.262878 6.440887 3.948269 0.520626 0.570763 0.361889
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.862347 -1.045929 -0.560624 0.033739 -1.103789 -0.676300 0.677759 -1.581181 0.559943 0.574596 0.359505
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 23.439705 0.694843 -0.394169 1.038163 1.518939 0.669252 -0.462805 -0.255349 0.429452 0.567577 0.351618
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 21.358826 -1.077548 0.672025 -1.260654 1.941819 -0.840004 -1.255736 -0.615690 0.432202 0.552911 0.348603
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.036549 -0.966729 -0.403510 -1.240414 -0.853430 -1.094624 1.585785 4.892228 0.516714 0.553886 0.353499
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.287083 0.533907 0.793669 -0.622190 -0.276231 -1.158639 -2.301548 -0.898555 0.550116 0.546071 0.351931
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.447739 15.996652 -0.999965 5.413667 -0.589323 6.999702 -1.203510 -0.060084 0.532250 0.039332 0.452751
261 N20 RF_ok 100.00% 0.00% 0.00% 0.00% -0.596952 -0.096676 -0.108760 -0.368786 -0.770382 -0.876333 12.230661 1.879277 0.539072 0.537990 0.349015
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 11.576345 14.797260 5.615675 5.647659 -0.127680 -0.451337 -0.209460 1.682659 0.519242 0.521005 0.349680
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.773392 1.473155 2.084815 1.059447 1.114561 0.478642 -1.901282 0.129438 0.468745 0.473838 0.346009
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 2.150681 3.231020 0.946716 1.335508 0.137061 1.446293 0.007702 -1.724308 0.454074 0.454913 0.329497
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.250884 -0.778941 0.808902 -1.324952 0.122924 -1.249705 -1.801749 0.200060 0.481252 0.473388 0.345616
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.665646 0.085338 -0.969599 -1.102832 -0.410732 -0.937107 7.555270 1.590772 0.450386 0.457983 0.330362
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.371676 1.455844 -0.478327 -1.087908 -0.957408 -0.987070 0.397306 0.513857 0.431696 0.448048 0.320846
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, 5, 7, 15, 16, 17, 18, 27, 28, 30, 31, 32, 34, 36, 37, 38, 40, 42, 45, 47, 49, 51, 52, 53, 54, 55, 58, 59, 60, 63, 65, 66, 67, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 84, 86, 87, 92, 93, 94, 95, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 112, 113, 114, 117, 120, 121, 122, 123, 124, 126, 127, 131, 134, 135, 136, 142, 143, 147, 148, 149, 150, 151, 155, 156, 158, 159, 161, 165, 167, 168, 169, 170, 173, 180, 181, 182, 184, 185, 187, 189, 190, 191, 192, 193, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 221, 222, 223, 224, 225, 226, 227, 240, 242, 243, 244, 246, 261, 262, 329]

unflagged_ants: [8, 9, 10, 19, 20, 21, 22, 29, 35, 41, 43, 44, 46, 48, 50, 56, 57, 61, 62, 64, 73, 74, 83, 85, 88, 89, 90, 91, 105, 106, 115, 118, 125, 128, 132, 133, 137, 139, 140, 141, 144, 145, 146, 157, 160, 162, 163, 164, 166, 171, 179, 183, 186, 220, 228, 229, 237, 238, 239, 241, 245, 320, 324, 325, 333]

golden_ants: [9, 10, 19, 20, 21, 29, 41, 44, 56, 83, 85, 88, 91, 105, 106, 118, 128, 140, 141, 144, 145, 146, 157, 160, 162, 163, 164, 166, 171, 183, 186]
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_2460015.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.2.3.dev121+gc95c57f
In [ ]: