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 = "2459978"
data_path = "/mnt/sn1/2459978"
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: 2-2-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/2459978/zen.2459978.21312.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/2459978/zen.2459978.?????.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/2459978/zen.2459978.?????.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 2459978
Date 2-2-2023
LST Range 3.384 -- 13.341 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 96
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 52 / 196 (26.5%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 117 / 196 (59.7%)
Redcal Done? ❌
Never Flagged Antennas 79 / 196 (40.3%)
A Priori Good Antennas Flagged 46 / 93 total a priori good antennas:
3, 7, 9, 10, 15, 16, 29, 38, 40, 42, 54, 55,
56, 71, 72, 81, 86, 94, 101, 103, 107, 109,
111, 121, 122, 123, 128, 136, 140, 143, 144,
147, 151, 158, 161, 165, 167, 170, 173, 182,
185, 189, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 32 / 103 total a priori bad antennas:
22, 35, 43, 46, 48, 61, 62, 64, 73, 82, 89,
90, 95, 115, 120, 126, 132, 133, 137, 139,
211, 220, 222, 223, 229, 237, 238, 241, 245,
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_2459978.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.177085 12.407852 9.557122 -0.813959 9.259305 4.199990 -0.004669 12.283545 0.031468 0.325331 0.261397
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.234208 1.715894 1.441230 0.420056 2.410216 2.865933 3.976717 4.954032 0.590563 0.616072 0.405821
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.735190 -0.306245 0.254903 0.174876 1.216732 1.804591 0.624413 0.276262 0.601200 0.614173 0.394925
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.059026 0.320104 -1.227580 -0.174402 0.001139 0.269370 13.886739 14.896796 0.607858 0.622975 0.388521
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.092938 -1.396148 -0.690143 -0.011845 -0.297138 0.322853 5.441301 1.209512 0.607142 0.619753 0.385123
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.595654 -0.349990 7.910286 -0.482965 5.176173 -0.295605 -0.328583 -0.507138 0.430513 0.615025 0.453217
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 3.415313 -0.651654 6.855500 -1.418117 2.868900 0.534274 0.977024 0.322110 0.484376 0.618167 0.438449
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.554718 13.535443 9.491492 10.231791 9.298421 10.955730 -0.380971 0.004456 0.026669 0.025338 0.001593
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.396956 -0.791062 9.523323 0.744143 9.260345 1.489498 -0.056623 2.614082 0.030084 0.620618 0.504819
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.759627 1.557974 0.286771 0.330168 0.962959 0.370093 1.406015 1.302054 0.611343 0.627452 0.392732
18 N01 RF_maintenance 100.00% 100.00% 48.97% 0.00% 11.022550 18.186774 9.492311 -0.790311 9.397819 6.131507 -0.111704 17.325256 0.028968 0.223223 0.172728
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.986950 -0.881841 -1.293359 -0.898353 -0.512734 1.056029 -0.498181 1.961601 0.614657 0.634543 0.385724
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.675882 -1.265792 2.299287 -1.145400 0.236948 0.760070 2.650998 -0.784742 0.602537 0.632905 0.391595
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.146254 0.520281 -0.771784 -0.009576 0.479935 1.383100 -0.434735 -0.095117 0.601275 0.610989 0.380976
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.672946 -0.392004 0.533860 0.193240 0.789150 0.666908 -0.223698 -0.701312 0.567406 0.584011 0.380669
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.711045 12.331670 9.553601 10.105066 9.384020 10.998893 1.610562 1.097200 0.032488 0.035321 0.004011
28 N01 RF_maintenance 100.00% 0.00% 88.27% 0.00% 10.857826 25.340935 -0.382153 2.413305 6.187759 10.277611 5.333438 21.252147 0.351600 0.150775 0.264853
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.451572 12.818719 9.150549 9.706434 9.361476 10.968398 -0.097460 -0.396639 0.029384 0.033485 0.004541
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.249077 0.006112 -0.640299 0.487282 0.702547 -0.220380 0.324828 0.014732 0.618673 0.637854 0.383739
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.582111 -1.309153 1.009019 0.895022 1.297838 -0.761031 0.535677 2.577997 0.627792 0.634532 0.381604
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.084754 25.510250 -0.256865 2.768179 0.098743 0.208522 2.048324 8.596420 0.614240 0.520164 0.366654
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.917698 13.989825 4.076246 4.511077 9.418371 11.009921 3.753334 3.429514 0.031919 0.041327 0.006865
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.540345 -0.004953 1.436131 -1.250089 0.672972 -1.323856 -1.147360 -0.115028 0.579314 0.571809 0.376834
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 25.500538 25.863164 12.724740 12.799018 9.458004 10.865468 3.983408 4.141558 0.029459 0.027422 0.001547
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.327961 0.470761 -1.281560 1.358930 0.751044 0.636327 -1.113766 2.526673 0.605956 0.615710 0.401562
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.421470 -0.535955 0.010561 0.495958 -0.072713 0.739030 6.871010 1.362586 0.611483 0.624399 0.400301
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 9.816976 2.750347 9.178747 0.391082 9.341094 -0.797772 0.975727 0.539482 0.034755 0.608747 0.471441
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.558456 -0.050934 -0.171559 -0.018147 1.577384 0.257326 0.143879 2.520642 0.617122 0.635699 0.378735
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.664789 -0.221969 4.583090 5.778116 -0.541428 -0.072129 0.451063 0.324845 0.592831 0.600712 0.366442
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.122406 0.774683 -0.003876 0.589283 -0.979871 0.087939 -1.045055 0.777289 0.622931 0.625933 0.376463
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.793869 -0.088620 -0.462590 -0.591703 -0.438048 0.052551 -0.351063 0.170987 0.618568 0.638442 0.379195
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.507894 3.100999 0.024403 0.562776 -0.585641 1.030731 1.043193 2.717875 0.611000 0.622650 0.374042
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.242949 -0.073218 -0.994887 -1.066822 -0.541032 -0.383645 -0.229672 -0.366862 0.616913 0.639617 0.394865
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.080897 13.699626 3.902974 4.146491 9.329700 10.909370 1.973065 1.140804 0.029351 0.043513 0.010211
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.009708 0.774318 0.505880 1.812502 -0.966202 2.166310 -1.401370 -2.527830 0.583946 0.605442 0.388265
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.005198 -0.342304 -1.156313 -0.318773 0.941972 -0.820633 1.244240 11.356959 0.536252 0.578482 0.385180
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.050681 2.471652 0.535583 0.897004 0.468256 0.679133 14.646489 9.647818 0.558354 0.594481 0.368583
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 22.596591 4.216067 12.206548 -0.549849 9.518006 3.266843 8.558656 3.369752 0.035381 0.509519 0.389938
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.620002 6.062801 -0.497598 0.457521 0.856663 0.483766 1.300999 1.778460 0.617131 0.628481 0.393084
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.883182 2.805394 -0.003751 0.321640 1.114037 1.337539 2.394920 3.570001 0.626879 0.639555 0.396988
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 26.958383 -0.849793 4.909067 3.016845 2.572386 -0.942460 3.732909 1.457861 0.433854 0.623752 0.378246
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.647070 13.644167 9.574278 10.227243 9.356220 10.938580 0.891689 2.666534 0.027383 0.029480 0.002153
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.189454 2.192123 5.361778 7.410222 0.726317 3.553252 -0.464240 1.221569 0.580256 0.554216 0.354509
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.021235 0.688330 7.493336 1.067744 5.882880 1.502398 36.124064 3.011911 0.422560 0.644700 0.420056
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.815328 12.746058 9.462867 10.230231 9.281632 10.917802 2.125240 1.866856 0.032394 0.032399 0.001638
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.635168 0.687269 9.028381 0.921729 9.127868 1.265624 1.760845 7.457421 0.041257 0.625494 0.496406
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.057812 12.657621 -0.574548 10.256123 -0.291598 10.941760 1.394290 2.726160 0.608174 0.059278 0.499140
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.228573 0.306642 -0.873280 -1.489620 1.304504 -1.017582 0.392389 1.386706 0.559213 0.590980 0.374986
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.851128 0.319266 -0.851843 1.089058 -0.281071 -0.252631 3.727402 -0.215265 0.546967 0.603167 0.392732
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.010762 13.193716 -0.182917 4.533119 0.605841 11.021330 -0.595237 2.191963 0.582907 0.040674 0.474605
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.004953 0.300565 -0.721387 -1.009784 -0.559215 -0.891658 3.133456 0.044098 0.566601 0.558453 0.369045
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.357882 1.046474 0.266609 1.030602 -0.197413 0.470638 0.351272 -0.166039 0.593547 0.612711 0.406201
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.637866 1.260284 -1.409298 -1.287564 2.330524 -0.217539 -0.706679 -0.218388 0.610219 0.630367 0.404313
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.691320 2.061571 -0.380407 1.227303 -0.346558 0.311639 -0.125616 1.792969 0.621999 0.621636 0.389076
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 19.481895 26.575943 0.897862 13.483327 4.855350 10.886084 -0.832388 8.244255 0.356365 0.026895 0.265548
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.794737 -0.296597 0.116758 0.715429 -0.276240 1.350856 0.551538 0.687798 0.618996 0.640468 0.376510
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.528700 -0.281025 -0.271391 0.058024 0.698568 1.013601 0.645813 0.219162 0.630839 0.646797 0.375961
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.560688 -0.403438 0.485242 0.872638 0.754740 -0.494549 3.089657 2.163303 0.639352 0.652223 0.370112
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.165743 13.882230 9.936289 10.632904 9.161428 10.755172 0.585372 0.880282 0.029874 0.032004 0.002656
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.603298 0.762460 -1.492565 -1.127548 0.997386 -0.617350 -0.008194 -0.152453 0.634879 0.648680 0.377419
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.341501 -0.005617 -0.023707 -0.621417 0.183805 1.616103 -0.034888 5.597204 0.629515 0.640355 0.375310
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 58.734571 0.736918 0.552355 -0.437296 8.125045 -0.638337 17.634925 0.183354 0.286391 0.594062 0.436437
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 32.415981 -0.367226 -0.458810 1.021382 2.316053 0.218761 2.198807 1.975215 0.414547 0.609055 0.380532
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.683964 13.469519 -1.508705 4.560337 -0.569887 10.842042 1.191920 -0.880226 0.576520 0.037346 0.459340
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.603422 14.274825 0.371489 4.461693 -0.703301 10.877466 -0.547672 0.861280 0.591486 0.043642 0.476505
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.406053 13.559178 -0.001239 8.901021 -0.239531 10.611417 1.263017 2.329377 0.569928 0.035042 0.449100
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.478727 -0.379528 0.284753 2.073883 -0.343134 -0.600024 -0.470452 0.357259 0.591681 0.597937 0.384753
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.573177 -0.110914 0.080790 0.347960 0.331703 0.013147 -0.563547 0.667852 0.604834 0.622688 0.389803
84 N08 RF_maintenance 100.00% 79.08% 100.00% 0.00% 19.680623 23.526714 12.364082 13.044872 7.922984 10.874480 3.746792 4.245004 0.181988 0.033806 0.119674
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.225325 0.458395 1.285204 1.343518 -0.828086 -0.344757 -0.584663 -0.443591 0.618237 0.636834 0.380861
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.998123 -0.298911 1.177342 1.603627 2.898820 -0.779051 0.465522 21.726266 0.610012 0.631856 0.363093
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.386604 4.583297 -0.946938 -0.504781 3.362191 1.916089 45.777752 39.168053 0.628460 0.653514 0.360969
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.628786 -0.121098 0.271260 0.661137 -0.300594 -0.834865 0.617558 -0.116435 0.631973 0.647801 0.366512
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.274832 0.133352 -0.098151 0.782218 -0.706401 -0.970562 -1.096876 -0.768695 0.636896 0.648899 0.370352
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.263311 -0.655509 0.721706 3.187329 -0.752103 -0.578417 -0.499442 2.746211 0.627704 0.621577 0.370007
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.292183 -0.195622 0.292812 0.201060 -0.679923 -1.001581 0.292497 -0.008041 0.625732 0.645919 0.384426
92 N10 RF_maintenance 100.00% 0.00% 24.32% 0.00% 34.027205 36.417046 0.249032 1.349654 5.209606 4.437401 1.476318 11.969837 0.275111 0.240358 0.063830
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.695139 -0.259433 2.046497 -1.138375 0.951096 0.003085 2.347261 -0.150069 0.613272 0.634534 0.391121
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.170672 13.142814 9.679950 10.125849 9.284940 10.916357 0.188914 0.030832 0.029591 0.025503 0.002102
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.539029 0.218801 -0.324134 1.264304 -0.860483 0.746838 -0.228525 0.008041 0.587574 0.616935 0.395235
96 N11 not_connected 100.00% 0.00% 0.00% 100.00% 12.268894 6.516440 3.421427 4.750043 3.885474 8.777623 -2.368223 -4.044642 0.242346 0.199299 -0.256280
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.907415 5.765473 -1.052283 1.249332 -0.885552 2.833989 4.906665 8.676361 0.571377 0.521459 0.383172
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.283642 8.446100 -0.519712 1.140291 0.037588 1.249772 0.063197 0.236503 0.624179 0.636307 0.382718
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.885889 1.405218 -1.420904 -0.894480 0.550555 1.085641 0.334592 9.907899 0.632389 0.645189 0.378295
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.256989 5.113643 2.874753 -1.272179 2.193731 0.440132 9.329027 7.908384 0.618525 0.652882 0.378204
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.345338 59.189508 -1.059693 6.892504 0.839308 -0.431266 0.997079 3.289932 0.638356 0.622239 0.368588
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.682448 -0.200697 0.154962 0.803382 0.086844 -0.802966 -0.884750 -0.516561 0.636417 0.649767 0.367211
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.569047 1.257591 -1.474103 -0.631182 0.081864 -0.999965 -0.312512 -0.106492 0.639421 0.653356 0.367280
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.306076 1.871927 -0.882479 -1.107612 0.108900 -0.389400 2.991469 4.519077 0.637348 0.653906 0.371069
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.274279 41.850393 9.498020 0.885222 9.330661 4.720671 0.813642 14.270272 0.032178 0.277370 0.160766
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.101255 12.721996 9.529859 9.984495 9.402739 10.986861 -0.263714 1.125960 0.027497 0.025663 0.001687
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 24.878177 25.241002 12.801005 13.251850 9.282270 10.744383 3.241307 3.490288 0.022527 0.023264 0.000722
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 28.572652 12.837238 2.557157 9.932125 4.529721 10.661595 2.186622 1.274169 0.287603 0.074516 0.170807
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.028321 -0.395162 0.123020 0.226015 0.573451 2.192620 0.515107 -0.904621 0.612667 0.626005 0.394098
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.150793 14.024536 3.721949 4.555508 9.193542 10.817361 0.793353 -0.111709 0.033715 0.030891 0.001734
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 15.064706 11.836987 14.639505 11.610389 10.761535 13.441057 335.325869 190.570834 0.020851 0.025435 0.002776
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.002611 -0.674358 -0.981317 -0.536815 -0.140571 -1.246004 -1.055728 -0.214099 0.558050 0.583968 0.390269
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.105001 14.127057 9.634654 10.586665 9.198008 10.912320 1.136164 3.507499 0.027416 0.030134 0.002107
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.186349 1.419431 -0.340847 0.481831 -0.575685 -0.002506 0.234669 1.297780 0.601940 0.622676 0.395964
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.916826 2.047811 2.550194 -0.954485 -0.525651 0.978626 1.507982 -0.234283 0.613584 0.648921 0.388184
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.137528 2.979441 -1.423797 5.796580 0.503483 -0.789514 4.573095 16.556112 0.633395 0.621980 0.367214
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.465296 6.298168 -0.002145 0.860344 1.306522 1.010189 -0.692795 -0.781326 0.628286 0.652841 0.375144
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.934988 8.677239 0.642645 0.922889 0.125445 -0.035169 0.159665 1.775036 0.645630 0.658677 0.376756
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.107480 -0.170832 -0.135642 0.572970 -0.549593 -0.003467 0.607166 0.155058 0.644597 0.658987 0.377646
125 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.863563 2.034738 -0.487042 0.669683 0.098743 -0.338151 0.380836 0.026126 0.636960 0.647558 0.369254
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.242289 1.535548 -1.361045 1.167165 1.752088 0.523732 2.153633 1.021579 0.641274 0.641858 0.376270
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.301426 0.257319 0.476186 0.365077 0.855344 0.297286 0.022927 0.169460 0.632038 0.648619 0.385172
128 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 1.278652 12.284146 6.916616 10.234346 1.086699 10.848195 -1.037240 0.050776 0.525956 0.030564 0.377673
131 N11 not_connected 100.00% 0.00% 9.41% 0.00% -0.877798 12.509860 0.027705 4.388703 -0.817205 9.613030 -1.253987 -0.513860 0.601564 0.274608 0.435049
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.525308 3.690452 -0.280237 -1.428919 0.122545 -0.452305 -0.134279 0.251005 0.580809 0.573922 0.372425
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.987036 0.308351 -0.801720 1.808063 -0.751490 1.237234 -0.897454 -0.379285 0.569823 0.605388 0.405279
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.729258 -1.185517 -1.094764 -1.561113 2.178227 0.511451 10.812921 -0.061251 0.563846 0.601912 0.411151
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 9.435945 -0.092818 9.122595 -0.806526 9.385157 0.132127 0.698442 -0.977439 0.036642 0.603125 0.456771
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.279959 -0.827892 0.094735 -1.449057 1.482588 -0.640804 1.063761 0.859403 0.581471 0.617796 0.400333
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.777718 -0.074015 1.595547 -0.915646 0.723953 -1.100068 -0.928032 -0.174244 0.611539 0.618621 0.378186
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.293721 -0.836121 -1.099808 -0.223203 -0.664724 -0.662223 4.947114 3.295500 0.629327 0.649557 0.381091
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.489963 -0.937722 -0.353380 0.631265 1.411425 -0.950560 0.131606 -1.301389 0.630610 0.655589 0.377695
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.767233 12.687495 -0.715527 10.258069 2.713999 10.972449 27.506670 1.042067 0.627457 0.041779 0.519408
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -1.267606 -0.173129 -0.668600 1.261583 -0.297056 5.074263 -0.678148 -1.719754 0.648015 0.657955 0.378259
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.124550 0.139986 -1.310763 6.198106 0.292696 0.231374 -0.575178 -0.184334 0.645481 0.587565 0.395849
145 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.524845 12.895225 9.520863 10.296008 9.136903 10.999241 -0.276070 2.272718 0.063463 0.029635 0.025909
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.135920 -0.652008 1.545271 0.578463 0.883069 0.113850 -1.491270 -1.727473 0.633073 0.646511 0.378598
147 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.386087 -1.610160 1.061667 2.279744 -0.225381 -0.812428 4.826354 0.851648 0.619531 0.626483 0.375588
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.381111 -0.009160 -0.681461 -0.603632 1.536358 1.497660 -0.825419 -0.790757 0.622143 0.638129 0.387743
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.189654 -1.369176 -1.283007 -1.426555 -0.215287 0.864533 1.332874 1.010519 0.615410 0.632427 0.393528
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.371495 -0.623050 -1.083723 -1.300318 -0.954610 0.487827 0.474749 1.387192 0.607016 0.620162 0.392194
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 11.738129 1.376488 0.301180 0.399216 5.098944 -0.617428 6.243170 -0.341454 0.532241 0.562922 0.355294
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.836365 -1.030215 9.274664 -1.429282 9.407683 -0.338071 1.247834 1.713682 0.037979 0.605981 0.470547
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.709871 12.403590 7.726980 9.996973 4.768964 10.994431 0.784584 1.195361 0.413409 0.036216 0.327738
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.084513 -0.373301 -0.143392 0.674561 -0.392246 0.010167 -0.811033 -0.199847 0.589312 0.615364 0.396888
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.105680 0.277137 -0.207753 -0.510703 1.452996 2.176122 2.420484 15.056672 0.605453 0.631738 0.398855
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.386365 26.138935 -1.443254 -0.789886 0.096382 2.954087 -0.831292 41.511885 0.577262 0.501464 0.354937
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.674623 -1.076361 -0.422079 -0.674421 -0.452085 1.192170 0.806228 0.681130 0.619923 0.638789 0.384147
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.953289 28.718017 -0.110730 -0.561960 0.158170 1.433372 -0.617589 0.463935 0.626709 0.511275 0.346836
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 2.620407 -0.924838 -0.802020 -1.279821 0.896259 0.735257 2.301981 0.111459 0.627654 0.653858 0.382999
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.537437 0.930985 -0.339553 0.430539 -0.111049 0.490983 -0.314783 1.327284 0.639791 0.652118 0.383091
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.098490 0.197574 0.253718 1.396476 0.002506 2.171461 0.592952 0.878667 0.634599 0.646666 0.372408
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 31.970585 -0.247210 -0.537332 -1.014421 3.838442 -0.045362 1.974523 -0.397249 0.500410 0.651988 0.376020
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.530601 2.782915 -0.524549 3.136628 0.105477 4.471370 4.210491 0.866433 0.633478 0.640668 0.378281
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.063430 -0.985405 -1.485810 -0.140878 1.397326 0.062020 1.181598 4.216593 0.620956 0.629278 0.376464
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.903075 -1.365253 0.171282 -0.382588 1.126376 0.516364 -0.348173 1.415864 0.619588 0.633449 0.387125
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.771271 -1.156261 -0.993960 -1.494579 0.183173 0.272686 -1.052148 -0.983904 0.619897 0.635289 0.390439
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.045097 -0.513841 9.835314 -0.896918 9.199709 -0.247524 2.867593 8.512116 0.036236 0.629708 0.495408
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.807613 2.922463 -1.359414 0.019134 -0.412492 1.737540 -0.274950 1.368161 0.565726 0.547630 0.366504
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 12.301152 13.225719 3.435726 4.159906 9.462059 11.006299 3.155195 5.198780 0.037633 0.041307 0.003553
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.488039 -0.482934 -0.113780 0.101306 -0.708590 7.338356 -0.624729 6.759367 0.581167 0.623801 0.396077
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.435586 13.346462 -1.541414 10.403396 0.635375 10.874296 19.675656 2.108509 0.620520 0.047628 0.522517
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.442378 -0.326117 0.286271 0.421713 -0.143728 -0.534555 -0.927860 3.712844 0.624804 0.637908 0.387870
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.199564 12.369913 -1.197971 9.966466 -0.050003 11.023486 10.338439 1.523037 0.634057 0.042251 0.494632
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.124908 0.494158 -0.200145 0.660524 1.103088 -0.836471 0.559367 -0.156149 0.624482 0.638906 0.374917
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.045942 -0.684003 -1.458883 -0.419436 -0.676010 -0.242918 0.084337 -0.357301 0.636935 0.651495 0.370547
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 30.834923 -0.366357 -0.596054 -1.471840 10.111582 0.641149 12.034314 0.154462 0.525124 0.649073 0.379387
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.159389 -0.786866 0.475393 -0.247746 -0.477698 -1.029606 -0.332528 0.409236 0.640597 0.654287 0.382420
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.717392 0.561444 -0.665679 1.766016 1.067358 0.128894 0.394765 -1.510281 0.628813 0.644299 0.378532
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.175774 12.237603 9.089547 10.095842 9.516934 11.042284 8.266135 2.800288 0.027201 0.029489 0.001144
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.310998 -1.385543 -0.786420 0.387095 -0.624086 -0.155750 -0.993374 -1.140298 0.614317 0.636147 0.399403
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.663050 0.623471 1.130609 -0.430761 0.591098 0.293398 11.768813 1.980909 0.599386 0.617716 0.394145
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.227604 6.751642 4.917842 4.810808 6.992799 8.773530 -4.020078 -4.091627 0.565408 0.581133 0.385766
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.102890 0.626551 5.121517 1.646049 7.355302 2.402765 -4.028787 -0.407415 0.549899 0.590917 0.411906
200 N18 RF_maintenance 100.00% 100.00% 78.11% 0.00% 11.988810 35.073322 3.843564 0.729048 9.424871 5.533004 0.629902 23.027719 0.038804 0.173935 0.111107
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.565365 4.738017 3.163657 4.152007 2.761528 7.061661 -0.329115 -2.831855 0.610504 0.609267 0.384146
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.600496 3.760381 1.720459 -1.214272 1.009146 -0.635011 -0.005985 25.562019 0.616153 0.600001 0.380186
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.269419 1.093728 1.750156 -0.252626 4.905473 -0.596158 0.539609 8.829312 0.461935 0.594547 0.402563
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.159870 7.544139 -0.583275 1.946672 3.146538 4.254307 -0.301860 0.707368 0.599884 0.499659 0.400704
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.329883 2.685674 -0.619351 0.107565 -0.482902 -0.461837 8.863912 1.674063 0.601348 0.580440 0.375971
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.796694 10.584418 8.703908 11.672249 9.421152 11.037565 10.310454 96.157284 0.019880 0.018933 0.001037
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.772488 7.616901 8.642602 9.095957 9.359154 10.850672 9.126657 12.732903 0.023051 0.021596 0.001792
210 N20 dish_maintenance 100.00% 37.41% 38.49% 0.00% 12.399190 7.075671 -1.069955 -0.817992 -0.802986 -0.483050 0.716945 3.325146 0.300834 0.283082 0.200300
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.876232 2.366731 -1.184279 0.003751 -0.603128 -0.137164 2.618598 -0.231562 0.563094 0.580985 0.376854
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.222083 -1.018827 0.528236 -0.384512 -0.625921 -0.216704 3.034911 -1.441469 0.603255 0.611230 0.381964
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.167470 0.040878 -1.259406 -0.682438 -0.296777 -1.037731 10.597783 -0.984611 0.584501 0.615926 0.385292
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.381975 -0.233959 -0.222269 -0.224974 -0.547812 3.261101 3.160486 -1.239247 0.595624 0.620844 0.384182
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.050480 -0.438794 -1.555237 0.412312 -0.516237 -0.774471 1.384222 3.241894 0.587640 0.626430 0.390459
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.453212 6.021188 5.303073 4.677210 7.582877 8.325214 -4.055738 -3.113330 0.583177 0.604215 0.380408
225 N19 RF_ok 100.00% 0.00% 93.41% 0.00% -0.819833 12.887848 0.732450 4.331719 -0.655372 10.697958 -1.197168 1.168815 0.609822 0.127192 0.511681
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.567025 18.001313 -0.462638 0.877758 -0.773642 6.824068 -0.627410 1.261541 0.598167 0.539166 0.370087
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.888468 0.466872 -1.465186 0.079468 -0.217913 -0.702086 12.078642 -0.318509 0.563197 0.602484 0.376789
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.986215 20.276446 -1.014809 -0.353662 0.404486 3.400990 14.962790 27.329670 0.527607 0.492068 0.320026
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.901941 -0.054125 1.647151 1.340995 0.135847 1.149677 0.232856 -1.917103 0.583583 0.600701 0.394247
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.766723 0.107807 -0.238400 -1.512262 -0.213748 -1.256176 -0.984696 -1.212563 0.537016 0.590690 0.398336
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.424543 -0.038572 0.994347 0.299839 -0.580558 -1.036199 -1.841134 -1.916521 0.598682 0.611184 0.391801
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -1.079070 -1.455355 -0.139363 0.027655 -0.546150 -1.141242 4.578635 1.646189 0.595089 0.613382 0.390083
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.796305 0.237179 1.044992 1.409515 -0.183940 0.524419 5.363552 5.925902 0.603948 0.622605 0.396126
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.505412 -1.127040 -0.324721 0.749555 -0.661532 -0.459771 1.172423 -0.659646 0.594655 0.620801 0.400649
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 24.048094 0.720723 0.430045 1.671903 2.701431 1.736991 -1.259098 0.160794 0.446865 0.612991 0.387781
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 53.730029 -0.487011 0.824703 -1.573082 5.161532 -1.287010 4.751616 0.047776 0.396991 0.590189 0.418781
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.830764 2.159395 1.200454 -0.817156 2.684658 0.721310 2.722662 7.870353 0.464858 0.565946 0.382468
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.430693 2.257307 -0.317302 -1.483721 -0.739366 -1.046093 -1.386845 -0.215104 0.576308 0.580688 0.384159
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.965991 7.243448 -0.539978 0.177313 4.371044 4.862858 3.847042 -0.749290 0.309162 0.306645 0.155954
261 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.419164 1.584171 0.747854 -0.487885 -0.555398 -0.971501 -0.384367 6.094248 0.574708 0.577534 0.387683
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.564281 7.581552 8.648014 9.821885 8.970956 10.421298 11.688471 29.176525 0.030209 0.026340 0.003547
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 6.116578 13.164874 2.344546 6.629575 0.972821 11.030456 29.734993 2.082511 0.428374 0.042275 0.345040
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.410492 2.409503 1.113537 1.437986 0.853572 1.015987 0.434632 -1.072603 0.484779 0.501354 0.378247
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.736066 -0.866796 1.247230 -1.396405 0.720913 -1.097843 -1.742438 -0.314602 0.516513 0.517620 0.393620
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.346153 -0.255168 1.027184 -1.072002 2.155661 -1.150094 3.231930 0.671795 0.405360 0.510692 0.384718
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.422795 2.211720 -0.706880 -1.488787 0.221169 -0.766941 0.206660 0.066232 0.450416 0.493367 0.371390
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 8, 9, 10, 15, 16, 18, 27, 28, 29, 32, 34, 36, 38, 40, 42, 47, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 74, 77, 78, 79, 80, 81, 84, 86, 87, 92, 94, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 113, 114, 117, 121, 122, 123, 125, 128, 131, 135, 136, 140, 142, 143, 144, 145, 147, 151, 155, 156, 158, 159, 161, 165, 166, 167, 170, 173, 179, 180, 182, 185, 189, 191, 192, 193, 200, 201, 202, 205, 206, 207, 208, 209, 210, 221, 224, 225, 226, 227, 228, 239, 240, 242, 243, 244, 246, 261, 262, 320, 329]

unflagged_ants: [5, 17, 19, 20, 21, 22, 30, 31, 35, 37, 41, 43, 44, 45, 46, 48, 53, 61, 62, 64, 65, 66, 67, 69, 70, 73, 82, 83, 85, 88, 89, 90, 91, 93, 95, 105, 106, 112, 115, 118, 120, 124, 126, 127, 132, 133, 137, 139, 141, 146, 148, 149, 150, 157, 160, 162, 163, 164, 168, 169, 171, 181, 183, 184, 186, 187, 190, 211, 220, 222, 223, 229, 237, 238, 241, 245, 324, 325, 333]

golden_ants: [5, 17, 19, 20, 21, 30, 31, 37, 41, 44, 45, 53, 65, 66, 67, 69, 70, 83, 85, 88, 91, 93, 105, 106, 112, 118, 124, 127, 141, 146, 148, 149, 150, 157, 160, 162, 163, 164, 168, 169, 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_2459978.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 [ ]: