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 = "2460036"
data_path = "/mnt/sn1/2460036"
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: 4-1-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/2460036/zen.2460036.21269.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 1852 ant_metrics files matching glob /mnt/sn1/2460036/zen.2460036.?????.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/2460036/zen.2460036.?????.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 2460036
Date 4-1-2023
LST Range 7.185 -- 17.152 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1852
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 25
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas 40, 42, 70, 72, 112
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 65 / 198 (32.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 118 / 198 (59.6%)
Redcal Done? ❌
Never Flagged Antennas 78 / 198 (39.4%)
A Priori Good Antennas Flagged 61 / 93 total a priori good antennas:
5, 7, 15, 16, 17, 31, 37, 38, 40, 42, 45, 53,
54, 55, 65, 66, 67, 69, 70, 71, 72, 81, 85,
86, 93, 94, 101, 103, 109, 111, 112, 121, 122,
123, 124, 127, 136, 140, 147, 148, 149, 150,
151, 158, 160, 161, 165, 167, 168, 169, 170,
173, 182, 184, 187, 189, 190, 191, 192, 193,
202
A Priori Bad Antennas Not Flagged 46 / 105 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 50, 57, 61, 62,
64, 73, 74, 82, 89, 90, 95, 115, 120, 125,
126, 132, 133, 137, 139, 185, 206, 220, 221,
222, 223, 228, 229, 237, 238, 239, 240, 241,
245, 261, 320, 324, 325, 329, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2460036.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
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.200554 19.092029 -0.610079 -0.322049 -0.792817 0.814709 -0.937042 4.578370 0.542737 0.435307 0.353902
5 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.272253 12.716244 10.399359 10.731768 3.823068 4.049263 0.556237 0.589125 0.035193 0.030450 0.001752
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.047391 0.171226 -0.647704 0.092980 -0.329546 0.459857 8.433658 15.515233 0.554616 0.567620 0.354124
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.510158 3.660645 2.530587 2.537038 1.887818 2.138408 -2.148552 -1.824084 0.530299 0.544673 0.337044
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.908750 -0.475728 3.229760 -0.572591 1.416429 0.036017 3.051909 -0.572817 0.534890 0.563482 0.351497
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.885983 -1.066173 0.148976 -0.793341 -0.895470 -0.318857 -1.180379 1.060974 0.547031 0.554348 0.346178
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 22.596990 0.458919 0.769549 0.206284 0.607983 0.533113 0.226914 3.116008 0.421133 0.562534 0.357968
16 N01 digital_ok 100.00% 0.00% 100.00% 0.00% 0.186580 13.254164 -0.333395 10.980159 0.539073 4.006783 2.037215 2.732649 0.558321 0.035159 0.470466
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.114531 4.985014 0.960417 9.320924 0.960655 0.983178 -0.003137 4.114713 0.561747 0.397587 0.409566
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.449710 5.399717 10.416302 1.088947 3.807993 1.156062 0.793022 27.330868 0.034075 0.365537 0.291677
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.101058 -1.034322 -0.383873 -0.952452 0.059647 0.442149 -0.560002 1.889959 0.569996 0.582305 0.349815
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.153502 -1.005709 2.220988 -0.652516 1.119804 0.204284 1.626197 -0.251589 0.556589 0.582057 0.348607
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.505883 0.033937 -0.036713 0.399808 0.280587 0.664641 0.552246 0.563693 0.550886 0.564463 0.341209
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.109764 -0.418386 -0.429033 -0.358606 -0.165568 0.033994 -0.682115 -0.979478 0.522699 0.540583 0.342796
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.326062 27.748174 9.991383 6.076065 3.164339 2.609065 6.678682 30.825342 0.065968 0.065363 -0.030607
28 N01 RF_maintenance 100.00% 100.00% 15.77% 0.00% 9.776289 16.752767 10.323169 4.231970 3.819874 0.419259 1.547511 16.250183 0.029833 0.247392 0.186694
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.227516 -0.626699 -0.679193 -0.507375 0.176180 0.035137 2.237866 0.641804 0.577476 0.587059 0.355234
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.115937 -0.819056 0.847900 -0.906831 0.859725 -0.317701 2.865887 -0.363405 0.570820 0.594823 0.355219
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.739050 -0.622093 1.340516 2.742663 1.326303 0.505614 0.667266 17.721050 0.581681 0.583504 0.346021
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.572937 20.406135 -0.222848 -0.138576 -0.360717 -0.385007 1.289022 3.064026 0.467052 0.500335 0.207914
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.206268 0.024374 5.558073 -0.429827 3.782536 -0.970762 0.851589 1.222092 0.039423 0.554287 0.409653
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.185091 -0.895844 0.627806 -1.043022 -0.167599 -1.025099 1.858290 -0.215223 0.535517 0.538955 0.339912
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.421540 6.723201 1.254757 0.984389 1.098337 1.085062 -0.139362 0.475269 0.538077 0.539096 0.363667
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 0.935369 22.793197 -0.719369 13.424785 -0.728219 4.019404 -0.632960 3.674100 0.536862 0.028787 0.425924
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.580938 1.682173 -0.227400 0.221946 0.209179 -0.415410 2.719259 8.365334 0.562148 0.543866 0.359660
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.007920 1.268684 0.039021 -0.540076 0.352857 0.380655 9.726915 0.253121 0.227842 0.221022 -0.280157
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.874717 1.369622 1.600129 1.688276 1.100420 0.257509 -0.159508 0.011697 0.572301 0.586987 0.356502
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.043767 3.963508 -0.375870 1.815197 0.517659 1.565843 -0.102579 2.668406 0.249773 0.234767 -0.278880
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.617474 0.026933 -0.437211 0.929367 -0.731365 0.599650 -1.077008 0.455665 0.586789 0.597453 0.349087
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.807244 0.549016 -1.030685 0.486830 -0.416163 0.450633 -0.798069 -0.190776 0.587645 0.605857 0.351034
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.226188 4.058240 0.834310 0.929304 0.570726 0.876450 0.097602 8.149588 0.574162 0.589811 0.343938
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.463780 -0.508652 -0.040959 -0.820416 0.273199 -0.602245 -0.011697 -0.573989 0.576232 0.600255 0.358095
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.317316 13.150698 5.468809 5.451205 3.784544 3.996330 2.453961 0.575557 0.031000 0.048977 0.012520
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.188815 1.084129 -0.421674 1.127680 -1.106597 0.703081 -0.802493 -1.846532 0.538157 0.557278 0.344263
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.576169 -0.067791 0.511111 -0.480368 -0.545919 -0.750282 0.101859 3.084073 0.502629 0.535262 0.343703
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.650107 0.916949 0.365702 1.774475 0.714823 1.348704 -0.297580 -0.172964 0.539940 0.537608 0.359651
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.818366 1.316008 -0.004754 -0.318172 1.141226 0.356541 86.475955 -0.304549 0.550645 0.557444 0.358947
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.882346 4.810842 0.736716 0.382644 1.016664 0.835326 2.149906 0.356206 0.565672 0.570007 0.356610
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.189951 1.126142 0.098424 -0.277846 0.780948 -0.478505 10.033977 4.658321 0.572504 0.585138 0.360468
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.834425 3.643812 1.995005 -0.051175 2.257326 1.264004 -1.274082 0.422681 0.287541 0.349766 0.155894
55 N04 digital_ok 100.00% 17.06% 100.00% 0.00% 0.739743 46.724385 0.733269 7.204604 0.076185 3.923855 1.638966 0.297677 0.243520 0.037068 0.099064
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -1.143925 1.065000 -0.670232 2.152659 -0.974288 2.575054 -1.037697 0.446632 0.587939 0.595523 0.343205
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.637010 1.166722 -0.319605 -0.605513 -0.591722 0.354307 0.133428 1.364953 0.595000 0.595970 0.340011
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.253271 12.314894 10.366733 10.906236 3.777168 4.009562 1.241584 1.071842 0.034480 0.034294 0.002402
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.208964 0.769856 10.404722 1.347211 3.734122 0.996110 0.559033 4.323824 0.041802 0.596720 0.453076
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.239290 12.270088 0.074496 10.938079 0.344955 3.997999 0.716553 2.288910 0.578646 0.066037 0.466197
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.557115 -0.805571 0.824928 -0.734567 -0.185539 -0.833212 -0.103102 -0.051668 0.518366 0.563933 0.348293
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.097856 1.086474 0.005912 0.844661 -0.714006 -0.018936 0.590236 -1.390046 0.519561 0.561009 0.348197
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.117688 12.704405 -0.496626 5.832767 -1.043113 4.044694 -0.617300 2.436318 0.538002 0.042125 0.420677
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.441204 -0.228144 -0.980558 -0.193692 -0.929059 -0.820523 1.778543 0.341686 0.524489 0.523226 0.338063
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 21.923281 20.814734 13.191269 13.179753 3.807969 4.055536 4.136512 5.532316 0.023464 0.028587 0.005881
66 N03 digital_ok 100.00% 24.78% 100.00% 0.00% 2.990555 21.437924 2.106508 13.343883 1.391338 3.995538 -2.158960 5.793562 0.212903 0.040898 0.110855
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.722565 -0.329810 -0.426172 1.665475 -0.195427 0.741303 6.523687 1.854933 0.569475 0.571148 0.351701
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 23.460377 0.865880 13.279843 0.799363 3.736228 -0.231546 4.662683 -1.169621 0.031329 0.584697 0.449991
69 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 1.003386 4.836593 1.381494 -0.607074 0.647571 0.181710 2.257077 0.423228 0.582225 0.594969 0.349237
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.026161 2.155142 1.372203 3.012981 1.128283 1.482894 3.354511 0.651468 0.252949 0.235262 -0.277082
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.279768 -0.286879 -0.286373 0.364755 0.059041 0.336980 -0.645204 0.494142 0.591904 0.610700 0.347804
72 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.145058 1.371410 2.455986 1.077379 1.797677 1.339811 11.794994 1.273309 0.258562 0.251743 -0.278125
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.590503 1.332598 -0.708536 0.605901 0.135764 1.491157 -0.203531 1.433827 0.599676 0.613024 0.348940
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.987381 0.004921 -0.216998 -0.168527 -0.839156 0.252736 -0.903624 2.487452 0.595225 0.611711 0.351590
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 46.614799 14.447146 0.737963 -0.408974 2.517105 0.274098 2.679105 -0.848194 0.293928 0.472375 0.276069
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 23.096162 0.918180 -0.099999 1.033470 0.718692 0.260666 -0.322910 -1.148621 0.389297 0.563570 0.337497
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 0.209731 12.954265 -0.620110 5.818364 -0.674173 3.984291 0.129060 0.072474 0.528900 0.038082 0.423384
80 N11 not_connected 100.00% 0.00% 70.63% 0.00% -0.139047 12.788500 0.065221 5.545286 -0.812439 3.183662 -0.945005 1.215031 0.532283 0.151696 0.414635
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.224768 13.016659 0.663204 9.680208 0.545713 3.935745 0.212808 1.591125 0.516873 0.036528 0.394810
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.917815 0.894682 -0.326899 -0.173205 -0.008587 -0.953007 -0.659876 -1.057499 0.549747 0.555601 0.358203
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.085642 0.292428 0.687435 0.878974 0.840178 0.653981 -0.424471 0.457889 0.561210 0.566863 0.352785
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.533528 22.738389 3.364527 13.470676 1.373588 3.960273 -0.148909 4.306364 0.571828 0.040971 0.444545
85 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.560234 8.569731 -0.850751 -0.471664 -0.297997 0.801269 -0.501940 5.558442 0.591413 0.589265 0.337797
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.108566 0.974633 0.307605 0.110936 0.481839 0.632458 -0.021126 9.607049 0.589121 0.603848 0.342376
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.545184 4.522204 2.762712 -0.221659 5.024366 -0.751345 10.636903 -0.640209 0.509953 0.619560 0.331108
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.664827 1.006257 0.830416 1.232298 0.568717 0.379722 -0.283268 -0.154707 0.591431 0.608085 0.338886
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.470896 0.316823 0.708516 1.181970 0.511528 0.529836 -0.391211 -0.093948 0.589221 0.609361 0.343215
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.581415 -0.500514 -0.499576 -0.323356 -0.395221 -0.964066 -0.221611 0.819395 0.584043 0.613107 0.348757
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.004921 0.089389 0.929623 0.653870 0.713935 0.633877 -0.042865 -0.195436 0.578449 0.602466 0.351180
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.746456 0.175735 10.375085 0.542341 3.821310 0.955845 0.382981 0.774500 0.033135 0.595997 0.404526
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.953024 12.497766 10.473624 10.991893 3.769536 3.996623 2.181014 1.846404 0.029474 0.024995 0.002591
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.664719 12.767641 10.586131 10.820039 3.782273 4.016739 1.051776 0.828969 0.025462 0.025208 0.001018
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.804968 1.672268 -0.728801 0.653744 0.803544 0.737302 -0.747041 -0.896255 0.402089 0.401728 0.180329
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.712220 21.144525 0.952761 -0.291715 -0.152997 0.486401 -1.665016 -0.750552 0.542170 0.446922 0.334433
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.248216 2.080176 -1.008680 0.377526 -1.035208 -0.770601 3.218926 10.775276 0.522105 0.515032 0.339447
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.631028 6.839925 0.150595 1.325197 0.916829 1.186736 -0.072214 -0.136120 0.577923 0.583617 0.346352
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.699935 0.820051 -1.018342 -0.391578 0.051378 0.525860 -0.725003 5.770657 0.591530 0.598622 0.345994
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.081833 3.882726 2.599549 -0.566681 1.955480 0.303477 -1.993144 17.478571 0.571457 0.605519 0.345052
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.140485 49.329671 0.402007 6.805459 0.957786 0.802109 0.940029 0.102613 0.596555 0.586094 0.339179
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.233698 0.403396 0.643989 1.227877 0.630836 0.434206 -0.208583 -0.209162 0.595342 0.608768 0.338383
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.658612 1.076212 -0.204303 0.055985 0.016496 0.144917 0.314207 -0.354340 0.596346 0.613959 0.342207
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 2.995002 1.268516 0.397082 -0.265317 0.541892 0.037962 1.203490 1.682588 0.590476 0.609246 0.338084
108 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.194392 2.330392 2.173857 2.452389 1.077048 0.998146 10.005458 0.097465 0.584705 0.602501 0.346714
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.542350 12.325760 10.452372 10.711731 3.795495 4.050174 0.502661 1.744262 0.055506 0.034029 0.016416
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 23.961881 -0.152249 0.761292 -0.216890 2.099835 0.549318 2.273221 -0.441398 0.476185 0.594087 0.337005
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 13.166531 12.303269 1.013760 10.794054 1.321633 4.032926 16.971534 2.110525 0.507165 0.052984 0.382371
112 N10 digital_ok 100.00% 11.02% 12.69% 87.31% 0.393874 6.626889 1.842246 9.654184 1.112601 1.846261 1.235761 0.728460 0.223482 0.129250 -0.218005
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.407267 13.483769 5.213848 5.810045 3.745643 3.977018 1.581038 0.910073 0.033049 0.031013 0.001380
114 N11 not_connected 100.00% 100.00% 0.00% 0.00% 12.120629 0.760555 5.361820 -0.114892 3.737022 -0.778159 0.285300 -0.720368 0.040953 0.540460 0.418059
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.346116 -0.760054 -1.066293 0.040339 -0.740056 -0.957397 -0.327187 -1.205671 0.509778 0.530093 0.349309
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.480953 13.710708 10.486588 11.206098 3.748797 4.001959 1.124910 3.405927 0.027710 0.030424 0.001785
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.377957 1.200692 0.526035 0.886197 0.528368 0.832646 -0.212649 0.146664 0.550823 0.560264 0.354212
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.842739 1.023047 2.907225 -0.615364 1.366870 0.275715 2.583146 0.698085 0.572734 0.595696 0.347277
121 N08 digital_ok 100.00% 1.03% 0.00% 0.00% 0.939379 2.559282 -0.960991 5.873590 -0.295516 0.649729 10.225094 13.757201 0.556795 0.581851 0.340114
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.266681 4.804484 -0.604226 -0.831537 0.788423 -0.079211 -0.546273 -0.724924 0.602838 0.613741 0.343576
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.833698 3.919090 2.972708 1.392924 2.417560 0.551595 -2.759068 -1.671093 0.580931 0.614805 0.348921
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 9.813096 0.334856 10.625159 0.866659 3.746097 0.866949 0.575306 0.793608 0.038739 0.617838 0.418416
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.515917 -0.319773 1.800294 1.221355 0.528865 0.217128 0.689764 0.793322 0.591068 0.604909 0.342786
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.859073 1.352532 -0.063494 1.173628 0.357932 0.853820 0.596719 0.062542 0.593646 0.604370 0.345662
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 9.530008 -0.575816 10.372758 -0.958313 3.826453 -0.025831 0.338601 -0.223761 0.032753 0.603794 0.404667
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.060251 -0.709932 -0.678750 -0.181491 0.060326 -0.687613 0.853818 3.078967 0.579176 0.592851 0.362823
131 N11 not_connected 100.00% 0.00% 54.91% 0.00% -0.963764 12.059257 -0.207083 5.720581 -0.727454 3.382236 -1.052402 0.302768 0.539602 0.214172 0.395553
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.839476 0.035246 -0.368292 -0.870373 -1.112462 -0.678648 0.254967 -0.251050 0.530378 0.531938 0.341906
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.428970 -1.032777 -0.843346 -0.438546 -0.798968 -1.078263 0.032910 0.958475 0.515184 0.534807 0.349940
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.001944 13.402111 5.348841 5.793541 3.742812 3.984440 0.437495 0.872256 0.037999 0.033846 0.002686
135 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
136 N12 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.241147 -0.420835 0.582245 -0.922033 0.790225 -0.286342 0.671007 1.067154 0.535772 0.553335 0.354631
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.222772 -0.158347 0.966035 -0.885359 0.008587 -1.018921 -1.596160 0.424313 0.559734 0.564734 0.336728
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 11.354050 -0.633823 -0.601008 -0.275856 7.399166 -0.262364 111.076294 12.509802 0.541423 0.596103 0.340113
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.528055 -0.262914 0.221986 0.403735 0.514354 -0.535094 -0.107366 -1.313827 0.588232 0.602136 0.342082
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.266965 12.331775 -0.231571 10.944359 0.624225 4.014424 20.627355 1.725782 0.593762 0.042198 0.487251
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.304947 12.287379 10.267803 10.910768 3.491106 4.016779 0.350581 1.496978 0.095610 0.030075 0.054538
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.225035 -0.379396 -0.485662 -0.680799 0.239428 -0.110063 -0.559352 -0.578361 0.602480 0.617929 0.348737
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.072026 -0.150836 -0.030015 -0.304237 0.298507 1.023505 0.182237 0.942098 0.598401 0.608034 0.345634
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.528948 -0.737405 -1.017478 -0.678964 -0.987592 -1.113045 -0.388386 -0.702928 0.564447 0.586949 0.346318
147 N15 digital_ok 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.601928 0.474380 0.426346
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.085318 0.018281 -0.047900
149 N15 digital_ok 100.00% 99.95% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.206154 0.106928 0.148853
150 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.189778 0.105095 0.136482
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 16.485435 -0.409518 -0.410000 1.172065 0.237372 -0.482112 -0.434245 11.482443 0.419415 0.513749 0.307365
155 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.724143 12.195378 9.048917 10.752954 1.190699 4.042862 3.188482 1.994084 0.333775 0.036329 0.253307
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.759362 0.148199 0.589574 1.017154 0.500934 0.908304 -0.203058 0.131630 0.537578 0.552432 0.353393
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.414369 -0.040710 -1.023090 -1.006025 -0.015495 -0.271186 4.409743 14.944656 0.556614 0.564409 0.349136
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.423182 19.252251 -0.411676 -0.340835 -0.746453 0.717220 -0.246748 1.078554 0.529828 0.450118 0.314215
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 10.242156 -0.845241 10.356761 -0.252156 3.788823 0.374893 0.577733 0.469255 0.042732 0.589078 0.472789
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.168695 25.935021 0.536936 0.261471 0.679347 -0.352213 -0.272502 0.432207 0.581070 0.479248 0.316591
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.070947 -1.334520 -0.112008 -0.835282 -0.678956 -0.201487 3.399888 -0.435083 0.592968 0.607839 0.348216
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.684155 1.497422 0.392962 0.759533 0.670333 1.056978 0.026040 1.483317 0.597238 0.610562 0.350962
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.065627 1.127085 0.725029 1.458555 0.729611 1.321121 0.552632 1.394363 0.592374 0.604498 0.341994
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 20.593240 0.051308 0.371488 -0.363550 0.391832 0.176937 1.417973 -0.448322 0.470193 0.605899 0.335520
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.533017 -0.076494 1.133870 0.544997 0.578598 -0.524336 0.446006 -1.468216 0.583080 0.598138 0.342599
167 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
168 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
169 N15 digital_ok 100.00% 100.00% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.176474 0.252231 0.152161
170 N15 digital_ok 100.00% 99.89% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.349820 0.203410 0.182903
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.406953 -0.975358 0.491307 -0.435506 -0.932933 -0.878399 -0.244063 1.962841 0.496013 0.538284 0.353879
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.829279 0.604010 2.543623 0.907296 1.871286 0.077637 -2.340647 0.621769 0.524513 0.539592 0.354914
173 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 5.472779 5.350503 3.322069 3.322257 2.904443 3.228430 -3.077895 -1.828654 0.491708 0.495339 0.337561
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.123603 -0.078551 0.395979 0.962945 -0.260448 0.597256 -0.357739 11.287100 0.538072 0.566902 0.354023
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.142263 12.944133 -0.828369 11.052076 0.342984 3.988995 19.342745 2.126817 0.567887 0.048204 0.474708
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.485934 0.467070 1.414385 0.909629 0.656012 0.716499 -0.135250 3.683691 0.574667 0.588800 0.354149
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.394671 12.113682 -0.429080 10.690396 -0.914503 4.039291 5.474057 2.061285 0.587518 0.043696 0.448176
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.500132 0.940070 0.728277 1.022083 0.955693 0.954143 1.067053 0.362407 0.581721 0.594671 0.341400
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 16.457911 -0.304597 7.846201 -0.325473 2.211970 -0.240499 3.211102 -0.228576 0.377028 0.603084 0.371318
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.068172 -0.162711 -1.009854 -0.049546 -0.612821 0.121452 2.607479 0.762204 0.592182 0.601154 0.348164
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.851656 -0.981999 0.212671 -0.292693 -0.796547 -0.926960 -0.718032 -0.807759 0.587848 0.599215 0.349494
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.273296 -0.572686 0.151829 -0.083738 0.522101 -0.462140 5.073799 -0.418954 0.575678 0.589377 0.352499
189 N15 digital_ok 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.721270 0.763184 0.711758
190 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
191 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 2.870462 5.610651 2.233101 3.431956 1.574392 3.301957 -1.831476 -2.945031 0.519561 0.502233 0.341955
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 5.791257 4.971394 3.474017 3.149118 3.023136 3.052673 -3.123514 -2.835570 0.490263 0.486342 0.332621
200 N18 RF_maintenance 100.00% 100.00% 38.39% 0.00% 11.188632 31.344320 5.382894 0.165961 3.808155 1.746007 1.508964 9.750780 0.040020 0.216998 0.143521
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.786509 4.281546 2.152218 2.982739 1.451136 2.754841 -1.415596 -2.587185 0.550671 0.549577 0.342254
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.845210 1.068255 1.027139 -0.422050 0.098304 -0.191484 -1.336232 38.014311 0.567456 0.561889 0.339045
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.765039 11.392179 1.610266 -0.658036 0.823550 -0.150646 14.063198 0.671178 0.577614 0.592772 0.348304
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.429144 -0.881178 4.167276 -0.546614 1.261024 -0.175274 3.015876 3.494766 0.384568 0.576926 0.401841
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.161775 3.909050 0.730955 3.099768 -0.162811 -0.038907 -0.151327 0.286925 0.519416 0.471402 0.329356
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.825821 1.102359 -0.753290 0.287493 -1.049596 -0.394310 5.897376 -0.045740 0.549799 0.543485 0.340426
208 N20 dish_maintenance 100.00% 99.89% 99.89% 0.05% nan nan inf inf nan nan nan nan 0.417049 0.485637 0.106781
209 N20 dish_maintenance 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.662985 0.544234 0.643204
210 N20 dish_maintenance 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.809514 0.792744 0.738569
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% -0.136114 12.739646 -0.820665 5.841743 -0.929873 3.990919 -0.025267 1.182062 0.512916 0.037214 0.428101
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.766021 -0.820680 0.176396 -0.440676 -0.945868 -1.054062 1.247668 -0.961182 0.555892 0.559979 0.344998
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.704984 -0.552801 -1.043071 -0.635429 -0.567125 -1.086855 1.696110 -0.680872 0.548511 0.566682 0.344884
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.373992 -0.408364 -0.298308 -0.360330 -0.810942 -0.982977 2.852277 -0.952044 0.554195 0.570829 0.344817
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.248051 -1.181983 -0.586964 -0.085722 -0.756753 -0.774072 0.322115 3.336618 0.547028 0.553790 0.337830
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.248543 5.234829 3.711965 3.372866 3.298871 3.203280 -3.226675 -2.584117 0.511776 0.537919 0.338259
225 N19 RF_ok 100.00% 0.00% 92.22% 0.00% -0.180435 12.290398 0.422723 5.614782 -0.709871 3.831785 -1.242968 1.590275 0.556211 0.131748 0.457507
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.675546 15.755558 -0.625915 0.280819 -1.113882 1.077333 -0.876469 -0.669980 0.545443 0.469564 0.332848
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 2.331749 -0.986300 2.568962 -0.660104 -0.476772 -1.071004 9.130309 -0.194590 0.448059 0.543334 0.374350
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.469939 -0.074553 0.542397 -0.924272 -0.527291 -0.617467 0.378303 0.693692 0.524134 0.524517 0.337617
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.528364 0.903826 0.466448 1.013062 -0.321022 0.272771 1.312813 -1.767248 0.524124 0.529993 0.354749
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.071348 -0.650324 0.642415 -0.963254 -0.580878 -0.501698 0.047700 -0.633713 0.498043 0.538470 0.354223
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.171124 -0.395198 0.563456 0.363743 -0.524962 -0.620832 -1.479314 -1.465225 0.547895 0.555103 0.353010
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.038356 -0.636341 -0.425241 -0.125141 -0.923474 -0.903859 1.091568 0.631429 0.547694 0.557649 0.351471
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.536669 -0.093893 -0.031452 -0.807895 -0.913799 -1.045849 -0.066617 2.695929 0.545240 0.556506 0.350378
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.188589 -0.944815 -0.437914 0.026779 -1.165740 -0.765161 0.426707 -0.921712 0.547568 0.559410 0.358697
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 16.395330 0.599854 -0.334891 0.845779 0.438940 0.030744 -1.046454 -0.776278 0.415945 0.552569 0.349071
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 14.400140 -1.099001 0.674737 -0.923110 1.868988 -0.711843 0.201462 -0.208073 0.440714 0.539793 0.347240
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.016578 -0.800165 -0.135211 -0.762565 -0.762976 -0.492961 2.612593 5.485253 0.505721 0.538417 0.349052
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.382228 2.102988 0.707265 -0.548787 -0.159584 -0.834836 -1.709913 0.147400 0.531746 0.522959 0.345122
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.568691 13.270083 -0.781048 5.396452 -0.816481 4.031351 -0.661128 0.357417 0.513218 0.036565 0.427272
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.235526 -0.027038 -0.005912 -0.282242 -0.594609 -0.890396 2.357552 0.049000 0.519993 0.523216 0.346281
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 9.879738 12.541384 0.345639 0.390441 0.774320 0.319835 -0.091602 1.884025 0.529651 0.532559 0.364205
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.999702 0.878853 1.837498 1.024034 1.054689 0.348339 -2.051008 0.235914 0.434287 0.440731 0.334484
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 2.161386 2.671782 0.824105 1.125933 -0.177302 0.582339 -1.479275 -1.784562 0.421060 0.425395 0.319215
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.090513 -0.936434 0.703333 -0.889620 -0.234749 -0.862882 -1.561157 -0.130180 0.453714 0.447784 0.339106
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.129521 -0.063071 -0.715234 -0.954430 -0.951193 -0.858937 -0.038793 -0.677975 0.425081 0.431984 0.323565
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.224911 2.545884 -0.153132 -0.731780 -0.855168 -0.802894 1.451088 -0.181570 0.401553 0.410228 0.303510
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: [4, 5, 7, 15, 16, 17, 18, 27, 28, 31, 32, 34, 36, 37, 38, 40, 42, 45, 47, 51, 52, 53, 54, 55, 58, 59, 60, 63, 65, 66, 67, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 84, 85, 86, 87, 92, 93, 94, 96, 97, 101, 102, 103, 104, 108, 109, 110, 111, 112, 113, 114, 117, 121, 122, 123, 124, 127, 131, 134, 135, 136, 140, 142, 143, 147, 148, 149, 150, 151, 155, 156, 158, 159, 160, 161, 165, 167, 168, 169, 170, 173, 179, 180, 182, 184, 187, 189, 190, 191, 192, 193, 200, 201, 202, 204, 205, 207, 208, 209, 210, 211, 224, 225, 226, 227, 242, 243, 244, 246, 262]

unflagged_ants: [8, 9, 10, 19, 20, 21, 22, 29, 30, 35, 41, 43, 44, 46, 48, 49, 50, 56, 57, 61, 62, 64, 73, 74, 82, 83, 88, 89, 90, 91, 95, 105, 106, 107, 115, 118, 120, 125, 126, 128, 132, 133, 137, 139, 141, 144, 145, 146, 157, 162, 163, 164, 166, 171, 172, 181, 183, 185, 186, 206, 220, 221, 222, 223, 228, 229, 237, 238, 239, 240, 241, 245, 261, 320, 324, 325, 329, 333]

golden_ants: [9, 10, 19, 20, 21, 29, 30, 41, 44, 56, 83, 88, 91, 105, 106, 107, 118, 128, 141, 144, 145, 146, 157, 162, 163, 164, 166, 171, 172, 181, 183, 186]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2460036.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.1.1.dev3+gb291d34
3.2.3.dev149+g96d0dd5
In [ ]: