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 = "2459969"
data_path = "/mnt/sn1/2459969"
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: 1-24-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/2459969/zen.2459969.21315.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

# get a list of all ant_metrics files
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{ant_metrics_ext}')
ant_metrics_files = sorted(glob.glob(glob_str))

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1850 ant_metrics files matching glob /mnt/sn1/2459969/zen.2459969.?????.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/2459969/zen.2459969.?????.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 2459969
Date 1-24-2023
LST Range 2.794 -- 12.750 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 196
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 196 (0.0%)
Antennas in Commanded State (observed) 0 / 196 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 54 / 196 (27.6%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 120 / 196 (61.2%)
Redcal Done? ❌
Never Flagged Antennas 76 / 196 (38.8%)
A Priori Good Antennas Flagged 49 / 93 total a priori good antennas:
3, 5, 7, 9, 10, 15, 16, 29, 37, 40, 42, 45,
54, 55, 56, 71, 72, 81, 86, 94, 101, 103, 107,
109, 111, 121, 122, 123, 127, 128, 136, 143,
144, 146, 151, 158, 161, 164, 165, 169, 170,
173, 182, 185, 189, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 32 / 103 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 82, 89, 95, 115, 125, 132, 137, 139, 211,
220, 221, 222, 237, 238, 239, 245, 261, 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_2459969.csv

Build DataFrame¶

In [20]:
# build dataframe
to_show = {'Ant': [f'<a href="{ant_to_report_url(ant)}" target="_blank">{ant}</a>' for ant in ants],
           'Node': [f'N{nodes[ant]:02}' for ant in ants], 
           'A Priori Status': [a_priori_statuses[ant] for ant in ants]}
           #'Worst Metric': worst_metrics, 'Worst Modified Z-Score': worst_zs}
df = pd.DataFrame(to_show)

# create bar chart columns for flagging percentages:
bar_cols = {}
if use_auto_metrics:
    bar_cols['Auto Metrics Flags'] = [float(ant in auto_ex_ants) for ant in ants]
if use_ant_metrics:
    if np.sum(list(a_priori_flag_frac.values())) > 0:  # only include this col if there are any a priori flags
        bar_cols['A Priori Flag Fraction in Ant Metrics'] = [a_priori_flag_frac[ant] for ant in ants]
    for ap in antpols:
        bar_cols[f'Dead Fraction in Ant Metrics ({ap})'] = [dead_ant_frac[ap][ant] for ant in ants]
    bar_cols['Crossed Fraction in Ant Metrics'] = [crossed_ant_frac[ant] for ant in ants]
if use_redcal:
    bar_cols['Flag Fraction Before Redcal'] = [redcal_prior_flag_frac[ant] for ant in ants]
    bar_cols['Flagged By Redcal chi^2 Fraction'] = [redcal_flagged_frac[ant] for ant in ants]  
for col in bar_cols:
    df[col] = bar_cols[col]

# add auto_metrics
if use_auto_metrics:
    for label, modz in all_modzs.items():
        df[label] = modz
z_score_cols = [col for col in df.columns if 'Modified Z-Score' in col]        
        
# add ant_metrics
ant_metrics_cols = {}
if use_ant_metrics:
    for ap in antpols:
        ant_metrics_cols[f'Average Dead Ant Metric ({ap})'] = [average_dead_metrics[ap][ant] for ant in ants]
    ant_metrics_cols['Average Crossed Ant Metric'] = [average_crossed_metrics[ant] for ant in ants]
    for col in ant_metrics_cols:
        df[col] = ant_metrics_cols[col]   

# add redcal chisq
redcal_cols = []
if use_redcal:
    for ap in antpols:
        col_title = f'Median chi^2 Per Antenna ({ap})'
        df[col_title] = [cspa[ant, ap] for ant in ants]
        redcal_cols.append(col_title)

# sort by node number and then by antenna number within nodes
df.sort_values(['Node', 'Ant'], ascending=True)

# style dataframe
table = df.style.hide_index()\
          .applymap(lambda val: f'background-color: {status_colors[val]}' if val in status_colors else '', subset=['A Priori Status']) \
          .background_gradient(cmap='viridis', vmax=mean_round_modz_cut * 3, vmin=0, axis=None, subset=z_score_cols) \
          .background_gradient(cmap='bwr_r', vmin=dead_cut-.25, vmax=dead_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .background_gradient(cmap='bwr_r', vmin=crossed_cut-.25, vmax=crossed_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .background_gradient(cmap='plasma', vmax=4, vmin=1, axis=None, subset=redcal_cols) \
          .applymap(lambda val: 'font-weight: bold' if val < dead_cut else '', subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val < crossed_cut else '', subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .applymap(lambda val: 'color: red' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .bar(subset=list(bar_cols.keys()), vmin=0, vmax=1) \
          .format({col: '{:,.4f}'.format for col in z_score_cols}) \
          .format({col: '{:,.4f}'.format for col in ant_metrics_cols}) \
          .format({col: '{:,.2%}'.format for col in bar_cols}) \
          .applymap(lambda val: 'font-weight: bold', subset=['Ant']) \
          .set_table_styles([dict(selector="th",props=[('max-width', f'70pt')])])

Table 2: RTP Per-Antenna Metrics Summary Table¶

This admittedly very busy table incorporates summary information about all antennas in the array. Its columns depend on what information is available when the notebook is run (i.e. whether auto_metrics, ant_metrics, and/or redcal is done). These can be divided into 5 sections:

Basic Antenna Info: antenna number, node, and its a priori status.

Flag Fractions: Fraction of the night that an antenna was flagged for various reasons. Note that auto_metrics flags antennas for the whole night, so it'll be 0% or 100%.

auto_metrics Details: If auto_metrics is included, this section shows the modified Z-score signifying how much of an outlier each antenna and polarization is in each of four categories: bandpass shape, overall power, temporal variability, and temporal discontinuities. Bold red text indicates that this is a reason for flagging the antenna. It is reproduced from the auto_metrics_inspect.ipynb nightly notebook, so check that out for more details on the precise metrics.

ant_metrics Details: If ant_metrics is included, this section shows the average correlation-based metrics for antennas over the whole night. Low "dead ant" metrics (nominally below 0.4) indicate antennas not correlating with the rest of the array. Negative "crossed ant" metrics indicate antennas that show stronger correlations in their cross-pols than their same-pols, indicating that the two polarizations are probably swapped. Bold text indicates that the average is below the threshold for flagging.

redcal chi^2 Details: If redcal is included, this shows the median chi^2 per antenna. This would be 1 in an ideal array. Antennas are thrown out when they they are outliers in their median chi^2, usually greater than 4-sigma outliers in modified Z-score.

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.924721 13.962114 9.847216 -0.495045 9.903222 5.792397 0.946235 8.710972 0.031960 0.349815 0.280825
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.600913 1.009372 3.617683 0.706254 4.994086 3.342894 33.026626 7.197236 0.595888 0.633796 0.407722
5 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.190286 0.035312 0.675304 0.045517 -0.495953 2.033100 7.910080 0.331776 0.622975 0.638480 0.396715
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.118516 -0.097883 -1.180454 -0.220040 -0.180199 0.849649 12.530034 11.995516 0.629576 0.644035 0.389710
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.024415 -1.339810 -0.508277 0.028919 -0.223358 0.761864 2.037825 2.056128 0.627559 0.639891 0.385862
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.687369 -0.611500 8.180646 -0.352189 5.687181 0.026240 -0.679723 -0.865557 0.461105 0.639900 0.460995
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 1.001510 -0.867582 0.016691 -1.384997 2.951282 1.029316 5.206720 0.748321 0.613991 0.635832 0.393910
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.138131 18.356993 9.270998 0.151114 9.847132 4.696915 -0.168145 1.987015 0.032035 0.352635 0.273444
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.188197 -0.777272 9.814109 0.609753 9.825955 2.375339 -0.145927 3.783915 0.031300 0.643669 0.526105
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.766753 1.636640 0.416701 0.449975 0.462445 0.541218 0.347532 0.667067 0.632665 0.647744 0.392987
18 N01 RF_maintenance 100.00% 100.00% 48.05% 0.00% 11.884111 19.156374 9.802541 -0.357967 10.026883 8.407148 -0.255934 12.285989 0.028726 0.229362 0.175955
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.664052 -0.556577 -1.113217 -0.890039 -0.314433 1.571727 -0.040625 2.246550 0.635201 0.653758 0.387057
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.303906 -1.070374 2.404051 -0.944079 0.104439 -0.172678 0.912393 -0.522621 0.628067 0.652275 0.394334
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.248204 -0.112924 -0.683735 -0.037589 0.280438 0.453779 -0.682384 -0.718166 0.623713 0.635777 0.386786
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.669214 -0.477898 0.391177 -0.049658 2.040296 2.871761 -0.767531 -1.307023 0.593859 0.607894 0.386124
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.933243 12.542305 9.865749 10.298484 10.017861 11.465311 1.388646 0.807504 0.033554 0.037018 0.004702
28 N01 RF_maintenance 100.00% 0.00% 85.84% 0.00% 11.990581 26.935620 -0.134278 2.773806 6.641144 8.705554 2.775921 12.998987 0.370651 0.162970 0.274816
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 11.188360 13.068686 9.464699 9.908525 9.986081 11.416835 0.107128 -0.261423 0.029989 0.035829 0.006277
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.356759 0.214104 -0.900620 0.519837 2.276284 0.641739 -0.113477 -0.307978 0.643251 0.657114 0.384607
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.388821 -1.213254 0.984461 1.304147 1.581481 -0.009003 0.176587 1.626273 0.647031 0.652936 0.380647
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.161124 25.410938 -0.109507 2.597522 2.385401 3.211875 12.478832 29.688767 0.633412 0.551967 0.365231
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.783209 14.272217 4.481667 4.809884 9.938000 11.369003 0.393266 -0.006102 0.033203 0.046905 0.009369
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.859450 -0.694896 1.473585 -0.928709 0.401473 -1.157759 -0.791950 -0.186133 0.604892 0.602540 0.382549
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 28.170557 27.832245 13.004042 12.967197 10.165475 11.362139 3.297758 3.122157 0.031128 0.028899 0.001319
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.412676 0.440121 -1.266252 1.402837 1.040392 1.525092 -0.709280 4.776568 0.628174 0.636220 0.402795
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.211621 0.087824 0.320179 0.689694 -0.134841 -0.299818 3.154295 0.472417 0.634941 0.646508 0.402437
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 10.462980 2.938950 9.490061 0.542146 10.022876 -0.806856 0.836094 0.497000 0.036770 0.630940 0.491239
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.946662 0.175765 -0.302125 0.096879 1.840235 0.504439 -0.340619 1.836532 0.641021 0.656024 0.378532
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.536947 -0.304302 4.582163 5.863307 -0.517168 -0.485145 0.127278 -0.248159 0.621355 0.625058 0.371646
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.388418 1.129555 -0.037322 0.599665 -0.388424 0.575656 -0.398680 1.883862 0.649440 0.651575 0.379933
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.936541 -0.002377 -0.490039 -0.466509 -0.479663 0.395408 -0.870876 -0.681914 0.643692 0.660749 0.381118
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.713902 4.946726 0.314968 0.424281 -0.938337 1.593095 -0.151136 1.903907 0.634658 0.641479 0.371371
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.243083 0.031027 -0.684363 -0.843698 -0.778999 -0.459944 -0.889075 -1.186044 0.640107 0.659682 0.396121
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.914998 13.963466 4.306939 4.445828 9.854766 11.271327 0.043474 -0.719536 0.030360 0.050287 0.013746
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.046610 0.946889 0.790848 1.806482 -0.979624 2.592695 -1.591948 -2.376635 0.612267 0.626623 0.390360
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.260691 -0.122712 -0.916229 0.487823 0.479683 -0.148457 -0.714336 0.172804 0.564572 0.609475 0.395606
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.238158 1.546030 0.848034 0.981123 1.777020 1.288411 52.356540 26.234766 0.574316 0.613438 0.367780
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 22.461303 3.991216 11.795953 -1.192202 10.088749 4.373160 4.688104 1.030437 0.042708 0.528085 0.411960
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.013973 6.825477 -0.428000 0.554676 0.972538 1.048280 1.654466 0.419958 0.639013 0.648538 0.394113
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.917263 3.155660 0.016269 0.222306 1.633580 2.211680 2.090153 2.972101 0.648542 0.658478 0.397078
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 28.854870 -0.906986 4.959364 3.102662 2.578633 -0.931476 1.949685 0.185353 0.458386 0.644549 0.376017
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.228616 13.385121 9.334756 9.860785 9.962978 11.378919 0.302031 1.518724 0.028761 0.031427 0.002713
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.186396 1.811789 5.514530 7.651192 0.608247 2.447924 -0.651803 0.047080 0.609096 0.579163 0.361870
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 24.095967 0.067788 7.699586 1.211610 10.028935 0.833542 13.194127 1.857115 0.407309 0.664080 0.409777
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.466670 12.936991 9.752989 10.409106 9.849534 11.313429 1.306238 0.951973 0.035020 0.034663 0.001382
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.446822 0.690776 9.306403 0.773994 9.642982 2.446057 0.388749 5.899785 0.048642 0.650431 0.525207
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.593522 12.852459 -0.386794 10.439949 -0.336306 11.363832 0.926555 2.165279 0.634420 0.072286 0.512132
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.578747 -0.049437 -0.414954 -1.357857 1.892840 -1.119280 -0.707402 -0.025484 0.585459 0.618538 0.383427
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.305460 1.109344 -0.701931 1.308680 0.403508 0.234003 0.714145 -0.933686 0.582191 0.626901 0.393578
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.177882 13.385350 -0.202784 4.840588 0.407706 11.494415 -0.329569 1.730420 0.605803 0.044073 0.483076
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.029993 0.014003 -0.561946 -0.864588 -1.213648 -0.870614 2.408742 0.208965 0.590759 0.586445 0.375391
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.633682 1.310693 0.588586 1.112605 -0.275675 1.040822 1.234163 0.096563 0.616617 0.632027 0.407251
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.594717 1.457037 -1.288181 -1.095776 1.872259 -0.331591 -0.771247 -0.037647 0.630531 0.647806 0.403443
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.608487 2.447672 -0.712721 0.637418 -0.535907 0.009003 0.135324 2.259043 0.642773 0.640791 0.390556
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 21.801267 28.324922 1.143603 13.630733 5.535171 11.325641 -0.366159 6.174678 0.372960 0.029115 0.277479
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.833014 -0.329576 0.480545 0.717502 -0.401359 1.456576 0.152857 -0.016039 0.642560 0.661411 0.379615
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.766543 -0.318757 -0.220113 -0.015854 0.706032 1.442647 -0.032145 -0.007066 0.654905 0.668896 0.378368
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.116964 -0.018026 0.610241 1.125354 0.657072 -0.597741 0.227919 0.122321 0.663854 0.671444 0.368740
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.001720 14.185418 10.203615 10.789448 9.685338 11.119891 0.055428 0.116062 0.030340 0.033892 0.003720
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.677599 1.039517 -1.364090 -0.885396 0.695284 -0.470626 -0.419669 -0.557005 0.657862 0.668756 0.376933
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.590169 0.159766 0.151162 -0.528287 -0.587827 1.542224 -1.389520 1.194347 0.655369 0.664253 0.376337
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 61.282508 1.074070 0.687963 -0.174570 6.331805 -0.425047 9.384442 0.182444 0.327885 0.620992 0.449918
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 34.025678 0.225935 -0.278586 1.205097 2.765353 0.211804 4.512527 1.452187 0.440870 0.632276 0.381256
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.434447 13.674852 -1.333747 4.847989 -1.176191 11.230452 0.335481 -0.581097 0.598761 0.039965 0.465487
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.869147 14.587089 0.132327 4.756755 0.232499 11.276368 2.115011 0.445240 0.596804 0.047612 0.469275
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.237922 13.814254 0.014779 9.073191 -0.426399 10.960984 0.065360 0.950718 0.594068 0.037891 0.460305
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.091364 -0.167426 0.406772 2.050132 -0.101974 -0.208476 -0.306753 0.336738 0.614655 0.621092 0.389080
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.358534 0.090020 0.190160 0.403171 0.260195 0.812069 -0.438347 0.555726 0.627772 0.642436 0.391041
84 N08 RF_maintenance 100.00% 58.81% 100.00% 0.00% 20.794846 25.187218 12.577338 13.204553 8.275984 11.355223 3.540222 3.986526 0.214668 0.034989 0.139734
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.222818 0.775759 0.841930 0.718136 1.994087 0.513261 0.083459 0.533508 0.641451 0.655221 0.380900
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.050534 -0.120102 1.939284 1.641529 4.250645 -0.178170 0.693265 13.790503 0.628268 0.652865 0.366782
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.272816 7.408740 -0.007844 -0.126964 11.707673 -0.197352 4.701962 2.314618 0.625174 0.676887 0.367857
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.795631 0.361782 0.356647 1.001104 -0.864294 -0.473221 2.629839 0.762499 0.653462 0.666371 0.365726
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.444129 0.497340 0.236476 0.944128 -0.769081 -0.268700 -0.737007 -0.579983 0.658437 0.667420 0.370321
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.135657 0.075274 0.960028 4.528461 -0.641926 4.015049 0.422555 6.962354 0.650860 0.620241 0.374499
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.222857 -0.076374 0.491512 0.413130 -0.816204 -0.631096 0.199467 0.100701 0.649754 0.666119 0.386024
92 N10 RF_maintenance 100.00% 0.00% 16.11% 0.00% 36.898170 43.800800 0.561849 1.306241 5.129628 5.680543 17.581330 6.844879 0.295004 0.251515 0.082076
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.072383 -0.387217 2.433195 -1.111616 1.164059 1.090088 2.420069 0.042784 0.634963 0.656176 0.392487
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.030100 13.415132 9.999847 10.309298 9.929122 11.322038 0.278496 -0.045406 0.031099 0.025945 0.002479
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.360613 0.040339 -0.589833 0.914325 -0.632481 0.295200 0.754170 0.853248 0.612660 0.637834 0.397111
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.276225 14.164792 4.329559 4.942125 9.721502 11.145227 0.561402 0.393114 0.033190 0.038613 0.002757
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.026561 6.054760 -0.555399 1.700512 -0.086215 2.627418 0.251194 6.999075 0.595812 0.541568 0.387709
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.421744 8.980204 -0.288683 1.119959 0.074655 1.757525 1.034385 1.816532 0.646036 0.655589 0.384468
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.781156 0.965930 -0.580450 -1.339533 0.414142 0.860737 -0.717703 4.465716 0.655373 0.665491 0.380674
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.104982 6.256235 1.871001 -1.094345 54.862591 9.326222 7.084095 3.695580 0.641282 0.669661 0.376820
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.579707 62.304732 -0.355660 7.163008 3.135123 0.587902 0.393535 0.569392 0.662595 0.640243 0.372906
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.603232 0.184202 0.172183 0.983595 0.689295 -0.307318 0.098327 0.563235 0.659793 0.667746 0.365118
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.387255 1.437502 -0.977305 -0.261107 1.178466 -0.784582 0.336839 1.699870 0.660088 0.670652 0.366688
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.192099 0.811925 -0.781239 -0.969562 0.120358 -0.134005 4.434988 5.629299 0.657124 0.673658 0.374367
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.056056 44.092279 9.800132 0.896495 9.943629 5.484613 0.881695 2.683707 0.034461 0.299413 0.175127
109 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 3.398587 12.969992 7.664976 10.181513 3.549543 11.430972 -0.428708 0.923061 0.521189 0.029665 0.355576
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 27.053828 26.762106 13.034338 13.381282 9.918075 11.179756 3.409905 3.396406 0.024127 0.026479 0.001251
111 N10 digital_ok 100.00% 0.00% 68.81% 0.00% -0.101290 11.802315 -0.260438 10.091716 0.035966 10.608607 0.873203 0.783266 0.647139 0.200740 0.467727
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.549735 -0.398793 0.217663 0.101961 0.894640 3.068988 0.789164 -0.662694 0.633848 0.649553 0.396523
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.014033 14.317209 4.119855 4.840635 9.755430 11.193650 0.948577 0.050903 0.034399 0.030818 0.001979
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.838676 1.054712 -1.287783 0.102646 4.599804 -0.796909 -0.253083 -0.454206 0.580228 0.620905 0.392831
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.145278 -0.930188 -0.917058 -0.326064 -0.535569 -1.284535 -0.307297 0.972735 0.580997 0.608292 0.397376
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.950341 14.521044 9.914375 10.759897 9.786648 11.339098 0.943606 2.715853 0.027768 0.031487 0.002746
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.605824 1.372005 0.015854 0.611202 -0.752223 -0.030609 -0.454947 -0.041565 0.620997 0.641143 0.394175
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.203533 1.689408 2.630474 -0.991123 0.348213 1.071649 5.817104 4.049903 0.633325 0.664435 0.385696
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.289756 3.026376 -1.131550 5.956435 3.288200 0.048145 15.851153 14.490168 0.653848 0.641377 0.366836
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.098978 6.863868 0.384378 0.839042 0.654506 1.297211 1.794625 -0.875823 0.649759 0.672111 0.375128
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.101988 9.109535 0.741644 1.103561 0.278528 0.420776 -0.475206 -0.144149 0.667305 0.675136 0.375081
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.339185 -0.131778 0.125618 0.651258 -0.758343 0.653310 0.928926 0.519221 0.666849 0.677335 0.377589
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.159807 -0.965682 0.356295 1.013382 2.227219 -0.524707 0.769133 0.327880 0.659782 0.669032 0.374711
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 22.540020 3.009561 -0.128779 1.623222 12.122443 5.113556 38.690516 2.924339 0.566709 0.658318 0.368818
127 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 0.205310 0.171634 0.308603 0.367590 2.500126 1.787432 0.912889 4.921427 0.656497 0.668528 0.385154
128 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 1.339040 12.473692 7.202203 10.407508 3.993802 11.221476 -0.998594 -0.254102 0.555473 0.032651 0.391195
131 N11 not_connected 100.00% 0.00% 0.54% 0.00% -0.661311 12.853680 0.215712 4.719570 -1.008257 10.072046 -1.295704 -0.794844 0.623273 0.297188 0.436836
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.684632 1.972122 -0.046399 -1.270621 0.098977 -0.919407 -0.552841 -0.560420 0.604691 0.610169 0.381693
133 N11 not_connected 100.00% 100.00% 0.00% 0.00% 12.619560 -0.589891 4.111401 -1.387300 9.922210 -1.139898 1.080554 -0.224988 0.056101 0.606921 0.473472
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.607534 -1.201908 -1.021393 -1.242978 3.664264 0.707636 13.513340 -0.059585 0.599197 0.625624 0.409583
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 10.026354 2.505347 9.439313 -0.693664 10.014244 0.872841 0.428215 0.002282 0.040436 0.613930 0.465031
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.148315 -0.578583 -0.044788 -1.206086 1.374426 -0.286873 -0.343410 0.138050 0.607195 0.636608 0.399760
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.319164 -0.218572 1.610660 -0.764198 1.191791 -1.160461 0.179264 0.328511 0.631848 0.638966 0.379612
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.619129 -0.924209 -0.856679 -0.163889 -0.458198 -0.680817 2.930866 2.146624 0.647109 0.664966 0.377936
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.494983 -0.605794 -0.362339 0.750020 1.322877 -0.530006 0.666233 -1.427464 0.650844 0.671137 0.375449
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.552139 12.926888 -0.842476 10.450231 1.737319 11.399905 14.252316 0.942298 0.648932 0.047030 0.527612
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% -1.242141 13.384758 0.776727 10.498413 1.584395 11.090785 1.092420 1.313833 0.659555 0.039958 0.547747
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.521112 0.191851 -1.055771 1.148729 -0.127434 22.544137 -0.779774 -0.587113 0.665753 0.669099 0.373972
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.279871 1.630976 -0.944450 4.508778 -0.188233 4.489871 -0.144410 0.013392 0.664107 0.641876 0.381835
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 12.362713 -1.091824 4.113710 0.062953 9.907750 -1.114356 -0.147368 -0.665558 0.038460 0.659482 0.517590
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.518344 -1.624896 1.345964 2.365414 -0.253552 -0.455928 -0.519720 -0.446210 0.643486 0.650761 0.378200
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.388374 0.002377 -0.672072 -0.601188 1.244884 2.054462 -0.966638 -1.082448 0.647793 0.661873 0.390787
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.117643 -1.372968 -0.953670 -1.040190 0.079408 0.924017 -0.499956 -0.855433 0.639952 0.655297 0.394985
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.493909 -1.028895 -1.020115 -1.043361 -0.804962 -0.375566 0.275270 0.045682 0.632235 0.646390 0.395268
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 15.547248 0.967042 0.095257 0.411479 5.798242 -1.010933 3.755232 -0.268789 0.537410 0.594015 0.354832
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.538753 -0.831489 9.593568 -1.159774 10.097538 0.606360 2.157542 1.167962 0.042840 0.623927 0.489542
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.122804 12.673251 8.032809 10.196761 5.625764 11.488547 0.913026 1.311963 0.440745 0.038710 0.341849
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.093469 -0.189602 0.032711 0.698374 -0.668165 0.766101 -0.269686 -0.466487 0.612642 0.633865 0.397604
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.310649 -0.350941 -0.339614 -0.637382 2.056482 2.163062 4.320933 14.311611 0.629191 0.649817 0.398827
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.368010 30.660381 -1.345356 -0.514712 -0.222710 6.006053 -0.724135 23.009105 0.603351 0.498891 0.353246
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.897713 -0.918989 -0.201683 -0.764647 -0.690488 2.059697 -0.057533 0.296903 0.640585 0.655276 0.382280
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.911953 30.492588 0.011192 -0.419943 0.003935 1.796600 0.117089 2.076501 0.646736 0.523934 0.341734
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 2.174154 -1.395420 -0.402311 -0.890251 1.038331 1.237447 2.463735 -0.456022 0.649355 0.670911 0.382021
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.345663 1.193700 -0.155613 0.441375 -0.147654 1.483432 -0.240297 1.096175 0.662211 0.669975 0.382998
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.808456 0.612703 1.190812 -0.123828 5.211738 2.489588 0.715178 0.545542 0.653913 0.670676 0.376218
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 33.493582 0.107053 -0.312785 -0.873778 5.475741 -0.067207 2.300479 0.555254 0.519757 0.670039 0.373429
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.323593 1.846983 -0.930589 -0.928130 0.171443 16.209722 4.241537 5.720360 0.660260 0.670654 0.382434
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.635876 -0.803063 -1.381357 0.067603 1.316598 0.369318 -0.574590 1.873153 0.652565 0.658887 0.383696
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.860844 -1.068987 0.175898 -0.304309 1.286401 1.317486 -0.541108 0.010280 0.642507 0.655052 0.389903
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.838866 2.904817 -0.892592 -1.224330 0.440833 3.573568 -1.027853 17.847372 0.640309 0.636854 0.383757
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.863995 -0.485795 10.108741 -0.703534 9.744256 -0.752541 1.438088 5.492622 0.040459 0.648762 0.517760
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.779298 2.596570 -1.141406 0.896982 -0.884879 1.850550 -0.127326 1.781445 0.591456 0.571233 0.372679
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 13.271509 13.429832 3.869366 4.472213 10.097685 11.441801 1.408773 3.428405 0.038806 0.044420 0.004699
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.450358 -0.755192 -0.122036 -1.354064 2.567123 1.152214 -0.878260 -0.406348 0.593105 0.646840 0.399298
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.341733 13.640060 -1.224732 10.579517 1.314084 11.273607 13.892017 1.253169 0.641302 0.053862 0.532319
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.501560 -0.027401 0.607131 0.676910 -0.512301 0.201312 -0.028845 3.486481 0.645696 0.656856 0.387912
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.352459 12.616036 -1.053057 10.170718 2.026009 11.486938 7.350296 0.915201 0.654917 0.047330 0.503366
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.107794 0.895575 -0.828995 0.195963 0.562020 -0.413029 0.002647 -0.352376 0.645141 0.656972 0.371187
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.921269 -0.665045 -1.295144 -0.276455 -0.276609 0.342168 -0.325289 -0.002647 0.655261 0.668604 0.372207
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 36.032329 -0.306011 0.162405 -1.326201 11.424854 0.292934 8.512779 0.743852 0.529180 0.666267 0.376631
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.810905 -1.379229 -1.274791 -0.247477 0.448179 -0.791050 -0.499315 -1.223982 0.662386 0.674732 0.389026
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.391444 2.437563 -1.188636 2.406929 -0.271292 2.268230 0.418661 3.018015 0.657677 0.662681 0.378371
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.922877 12.516229 9.423782 10.296284 10.209634 11.511196 2.962925 1.740297 0.027776 0.030797 0.001456
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.259418 -1.430266 -0.576618 0.396170 -0.465934 -0.099366 -0.661665 -1.262412 0.635069 0.654701 0.400934
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.610069 0.293568 1.265619 -0.384767 0.462052 0.742660 9.759382 -0.192522 0.620738 0.639467 0.397939
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.521047 7.295468 4.702039 4.720241 7.585348 9.168680 -3.325245 -3.508978 0.584693 0.599405 0.389245
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.427077 0.773728 4.907583 1.623706 7.944730 2.229962 -3.367069 -0.428829 0.569384 0.612043 0.417103
200 N18 RF_maintenance 100.00% 100.00% 43.08% 0.00% 12.819354 36.523861 4.268855 0.836258 10.062281 7.194067 0.412684 -1.369040 0.041069 0.225836 0.153843
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.189977 5.335486 3.100205 4.093952 3.755803 7.589648 -1.358491 -2.998907 0.630482 0.627160 0.384272
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.724805 3.038138 1.732052 -1.273049 1.495646 0.146230 -0.425999 29.275066 0.639381 0.625583 0.379517
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.609089 2.727065 0.734650 -0.922172 -0.153795 -0.601747 -1.110626 4.802523 0.631550 0.623480 0.372033
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.680327 3.361356 1.321865 -0.690869 8.811575 -0.003775 0.343376 3.390183 0.632715 0.615369 0.376454
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.148227 2.715483 1.485852 -1.078555 1.390420 15.249293 -0.976611 0.049084 0.617068 0.612724 0.360078
208 N20 dish_maintenance 100.00% 92.97% 93.51% 0.00% 210.415521 210.652673 inf inf 4111.040786 4091.105873 5255.673625 5293.932908 0.453276 0.412216 0.348922
209 N20 dish_maintenance 100.00% 93.19% 93.62% 0.00% 247.084366 247.335602 inf inf 5060.582447 5072.642877 7383.183594 7412.649694 0.424381 0.423222 0.328439
210 N20 dish_maintenance 100.00% 92.86% 94.05% 0.00% 246.448115 246.559873 inf inf 5072.264497 5060.829652 7392.428269 7386.280725 0.481614 0.391743 0.345905
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.624868 2.329127 -0.897358 0.214119 0.312974 -0.089853 1.736733 -1.027514 0.586995 0.600062 0.380871
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.281519 -1.064062 0.631591 -0.205645 -0.500800 -1.054656 1.898398 -1.234742 0.625551 0.631928 0.383657
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.364640 -0.325884 -0.810744 -0.557094 2.556906 -0.822930 2.833149 -0.962186 0.612727 0.636366 0.387082
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.228135 -0.251800 0.102579 0.260466 -0.601786 0.173658 3.090114 -1.385571 0.622133 0.644660 0.390112
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.146296 1.710979 -1.300703 0.400574 0.069943 27.212632 1.628023 2.320532 0.608778 0.633269 0.385951
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.555962 6.878438 5.039093 4.704247 7.544443 9.042526 -3.392688 -3.493572 0.602796 0.618623 0.380178
225 N19 RF_ok 100.00% 0.00% 88.43% 0.00% 1.627679 13.024139 1.122145 4.632226 -0.941675 11.066135 -1.338849 0.211457 0.631051 0.152424 0.519816
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.623571 7.965794 0.306126 1.353861 -0.893079 3.650787 -1.186305 -1.057590 0.624129 0.602927 0.377839
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.891247 0.744354 -1.142338 0.206092 -0.505579 -0.540745 12.185433 -0.252426 0.593517 0.625415 0.381957
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.830293 22.184624 -0.740304 -0.134790 1.522496 6.168553 36.558778 77.001272 0.547763 0.496149 0.328827
229 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.272633 0.153637 1.690997 1.421476 0.487492 0.938602 4.930243 -1.814286 0.605356 0.620987 0.397646
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.334534 -0.329848 -0.162501 -1.213130 -0.919594 -0.806288 -0.713632 -1.076819 0.569056 0.614639 0.402386
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.725679 -0.511141 1.576002 1.144074 0.093483 -0.700611 -1.816670 -1.897021 0.619454 0.631651 0.395117
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.690877 -0.575140 0.613447 0.870918 0.405699 -0.690265 0.734660 0.375613 0.618316 0.634571 0.393566
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 30.163224 54.246684 0.193517 0.840386 7.600448 6.399396 17.043967 19.738535 0.482634 0.403627 0.259227
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.111679 3.449357 -0.485411 0.647509 -1.127547 0.237590 3.791802 14.857232 0.608337 0.587785 0.385866
242 N19 RF_ok 100.00% 5.19% 0.00% 0.00% 61.399974 1.620726 0.612958 1.369548 14.395706 1.134080 9.462062 -1.388162 0.297747 0.634131 0.492128
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 60.955015 2.279447 0.993125 -1.180453 8.350817 -0.893585 -1.180397 -0.712885 0.288356 0.612462 0.478063
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.746152 2.203499 1.438647 -0.453177 3.320736 1.563619 1.898218 5.263436 0.500805 0.587474 0.384711
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.786206 2.093564 -0.149501 -1.304763 -0.911244 -0.577264 -1.199125 0.180047 0.596895 0.601032 0.386915
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.272358 7.951728 -0.936985 -0.248450 5.438110 5.139264 1.181859 -0.593966 0.328090 0.329050 0.160648
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.752116 1.615809 0.936608 -0.214381 -0.667418 -1.027696 -1.171518 0.364430 0.597620 0.601195 0.391975
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.611317 7.960188 8.853638 9.823020 9.857066 10.319270 5.433192 19.502837 0.031918 0.027375 0.004111
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 6.524611 13.656764 2.373204 6.900517 1.782090 11.471031 39.537448 1.381757 0.456893 0.045853 0.366546
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.442300 2.649480 1.272179 1.606083 0.991968 1.760887 1.661585 0.843935 0.506421 0.518860 0.380560
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.671383 -1.049346 1.365785 -1.126510 1.055139 -1.206021 -1.382223 -0.417417 0.537576 0.540143 0.398264
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.817690 -0.341753 -0.164411 -0.195657 3.968579 -0.610710 4.702612 0.630736 0.461417 0.530206 0.383638
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.445847 2.960976 -0.584390 -1.270178 -0.519943 -0.488268 0.992786 2.338997 0.473877 0.507215 0.371323
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, 9, 10, 15, 16, 18, 27, 28, 29, 32, 34, 36, 37, 40, 42, 45, 47, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 77, 78, 79, 80, 81, 84, 86, 87, 90, 92, 94, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 113, 114, 117, 120, 121, 122, 123, 126, 127, 128, 131, 133, 135, 136, 142, 143, 144, 145, 146, 151, 155, 156, 158, 159, 161, 164, 165, 166, 169, 170, 173, 179, 180, 182, 185, 189, 191, 192, 193, 200, 201, 202, 205, 206, 207, 208, 209, 210, 223, 224, 225, 226, 227, 228, 229, 240, 241, 242, 243, 244, 246, 262, 320, 329]

unflagged_ants: [8, 17, 19, 20, 21, 22, 30, 31, 35, 38, 41, 43, 44, 46, 48, 49, 53, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 82, 83, 85, 88, 89, 91, 93, 95, 105, 106, 112, 115, 118, 124, 125, 132, 137, 139, 140, 141, 147, 148, 149, 150, 157, 160, 162, 163, 167, 168, 171, 181, 183, 184, 186, 187, 190, 211, 220, 221, 222, 237, 238, 239, 245, 261, 324, 325, 333]

golden_ants: [17, 19, 20, 21, 30, 31, 38, 41, 44, 53, 65, 66, 67, 69, 70, 83, 85, 88, 91, 93, 105, 106, 112, 118, 124, 140, 141, 147, 148, 149, 150, 157, 160, 162, 163, 167, 168, 171, 181, 183, 184, 186, 187, 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_2459969.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.1
In [ ]: