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 = "2460101"
data_path = "/mnt/sn1/2460101"
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: 6-5-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/2460101/zen.2460101.42115.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 361 ant_metrics files matching glob /mnt/sn1/2460101/zen.2460101.?????.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/2460101/zen.2460101.?????.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 'startTime' 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 2460101
Date 6-5-2023
LST Range 16.473 -- 18.414 hours
X-Engine Status ❌ ❌ ❌ ✅ ❌ ✅ ❌ ❌
Number of Files 361
Total Number of Antennas 202
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 12
dish_ok: 1
RF_maintenance: 60
RF_ok: 24
digital_ok: 81
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 202 (0.0%)
Antennas in Commanded State (observed) 0 / 202 (0.0%)
Cross-Polarized Antennas 16, 18, 40, 42, 70, 111, 112
Total Number of Nodes 19
Nodes Registering 0s N15
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 52 / 202 (25.7%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 83 / 202 (41.1%)
Redcal Done? ❌
Never Flagged Antennas 116 / 202 (57.4%)
A Priori Good Antennas Flagged 31 / 81 total a priori good antennas:
5, 9, 15, 17, 40, 41, 42, 55, 66, 70, 86, 112,
121, 136, 140, 147, 148, 149, 150, 151, 153,
161, 164, 165, 167, 168, 169, 170, 189, 190,
191
A Priori Bad Antennas Not Flagged 66 / 121 total a priori bad antennas:
8, 22, 35, 36, 43, 46, 48, 49, 50, 52, 56,
57, 60, 63, 64, 73, 74, 77, 79, 80, 84, 89,
95, 97, 102, 108, 113, 114, 115, 120, 125,
126, 132, 133, 134, 135, 139, 142, 179, 185,
201, 204, 206, 220, 221, 222, 223, 224, 226,
228, 229, 237, 238, 239, 240, 241, 242, 243,
244, 245, 261, 262, 320, 324, 325, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2460101.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 0.00% 0.00% 0.00% 0.00% 0.148398 -0.648637 0.166599 -0.865332 0.399067 -0.454769 0.498111 -0.275312 0.685253 0.646915 0.502961
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.134358 7.047001 -0.689097 -0.334061 -1.040422 -0.234648 -0.670087 -0.140623 0.690077 0.584993 0.493032
5 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.290157 3.003330 0.008259 3.828004 0.322984 2.322830 0.342622 2.072476 0.704260 0.668688 0.505331
7 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.402347 -0.263347 -1.104810 -0.254518 -0.333470 0.365397 2.494070 2.375714 0.704593 0.669544 0.493539
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.204230 2.248085 1.654940 1.757409 0.986731 1.004214 -0.949300 -1.066763 0.673758 0.637271 0.486763
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 3.163288 0.205053 4.009782 0.400824 1.891300 0.326266 2.465621 0.505926 0.696461 0.666639 0.492620
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.486688 -1.380688 -0.197050 -1.147285 -0.963053 -0.921232 -0.898120 -0.368612 0.684239 0.653515 0.495247
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 5.765652 -0.793074 0.242979 -0.629059 -0.575349 -0.487818 0.660679 0.051959 0.646290 0.675169 0.457138
16 N01 RF_ok 0.00% 0.00% 0.00% 100.00% -0.625739 -1.116417 -0.327114 -0.818843 -0.246043 -1.091572 0.454140 -0.699010 0.240057 0.235677 -0.383584
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.158268 1.992889 0.619299 13.367517 0.857372 0.916011 0.771930 3.229184 0.725905 0.637272 0.534407
18 N01 RF_ok 100.00% 25.21% 22.99% 74.79% 4.797904 0.435651 5.232672 0.836442 2.658323 0.320743 29.017939 7.555853 0.136882 0.199968 -0.275453
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.034235 -0.444323 -0.772284 -0.198748 -0.324755 0.277906 -0.107372 1.128413 0.720534 0.684118 0.486053
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.235526 0.483069 0.785482 0.930104 0.821541 0.721441 0.918865 1.004611 0.719627 0.687755 0.488387
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.017203 -0.291068 -0.483782 -0.119421 -0.525281 -0.128415 -0.012910 0.128627 0.707512 0.673691 0.485409
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.454964 -0.080627 1.667290 -0.343854 0.448454 -0.499070 1.125350 0.022371 0.683518 0.646049 0.497434
27 N01 RF_ok 100.00% 100.00% 100.00% 0.00% 5.061153 10.092797 19.015120 11.578539 2.232198 0.732464 4.258164 56.919476 0.048567 0.048925 0.007656
28 N01 RF_ok 100.00% 0.00% 0.00% 0.00% -0.350933 8.458752 -0.197593 7.720379 -0.435036 0.461461 -0.836940 8.664454 0.725500 0.415073 0.624355
29 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.273460 6.203964 18.473173 18.800111 2.230593 2.206461 4.196929 3.186912 0.044851 0.044545 0.002909
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 1.520764 -0.786448 1.204707 -1.200117 0.427006 -0.781912 -1.086192 -0.469342 0.719735 0.707613 0.490610
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.348154 1.626323 -0.114788 1.549054 0.514471 1.557115 0.381399 1.939729 0.742995 0.713284 0.489633
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.442809 -0.698375 0.746811 -1.119736 0.117572 -0.241129 3.043544 13.969818 0.694098 0.697744 0.428099
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 5.763069 0.163950 11.863108 -0.154079 2.245202 -0.887834 3.472467 -0.888650 0.044526 0.660124 0.518942
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.418992 0.022722 0.096098 -1.032117 -0.638395 -1.138115 -0.993862 -0.620981 0.695054 0.652864 0.489555
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.038503 1.473475 0.951947 0.457588 1.431627 0.645810 0.914978 0.709706 0.660675 0.625039 0.467043
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.005378 1.046571 0.119924 1.699930 0.126796 1.341967 0.377211 3.131336 0.682673 0.650501 0.469113
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.418412 0.244012 -0.428048 1.046068 -0.315234 0.833353 0.654746 3.229562 0.699687 0.668822 0.474990
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 1.350655 0.152930 1.003223 -0.348676 1.039510 -0.230989 23.364590 0.223829 0.249476 0.255221 -0.382634
41 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.445423 2.747199 0.090957 3.931783 0.171711 2.223359 0.390804 2.188669 0.742064 0.711873 0.481760
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.674834 -0.827490 -0.675738 -0.968682 -0.274516 -1.082451 -0.041569 -0.587361 0.271111 0.266209 -0.388318
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.324734 0.216469 0.125774 0.538541 1.235639 0.524597 0.673772 0.864286 0.759687 0.730299 0.489882
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.402183 0.169610 -1.087704 0.132914 -0.556778 0.396313 -0.292599 0.332597 0.751755 0.730208 0.487371
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.502232 0.217807 0.694290 0.178965 0.831959 0.305502 0.761482 0.798921 0.751344 0.725146 0.489552
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.666665 -1.251794 -0.203105 -0.847258 0.112780 -1.211358 0.312541 -0.624398 0.743670 0.713290 0.495522
47 N06 not_connected 100.00% 26.32% 100.00% 0.00% 4.708255 6.473666 11.354601 11.493758 1.665403 2.194618 3.869459 3.028278 0.340210 0.102530 0.281199
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.589291 0.471031 -0.586279 0.365272 -0.922110 -0.319988 -0.576524 -1.106061 0.707006 0.661457 0.481079
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.870226 0.120001 0.005676 -0.139678 -0.279608 -0.995450 0.305973 -0.995270 0.695525 0.649247 0.494146
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.284678 -0.015550 0.094714 0.539475 0.364139 0.699771 0.463170 0.549254 0.660390 0.628100 0.465114
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 0.438562 0.026724 -0.371428 1.076525 0.038401 1.040216 11.111819 1.195126 0.681843 0.657221 0.462832
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.518060 0.799482 0.293228 -0.138577 0.346999 -0.003375 1.060969 0.297773 0.706364 0.673481 0.471520
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.443145 -0.604904 -0.123177 -0.276355 0.042278 -0.176081 2.307158 1.828187 0.722623 0.691884 0.468163
54 N04 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.439890 6.696965 -0.070265 3.695472 1.589148 2.111090 1.622965 1.941315 0.437605 0.450001 0.264967
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.948790 26.096966 1.577200 13.867813 1.953221 2.595719 2.940670 2.725923 0.270566 0.044477 0.060693
56 N04 dish_maintenance 0.00% 0.00% 0.00% 0.00% -0.224247 1.223733 -0.069328 1.035610 0.313501 1.366748 0.246403 0.838004 0.758155 0.735315 0.486070
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.249894 -0.003673 -0.024974 -0.041505 0.031961 -0.116087 0.437174 0.610066 0.770116 0.739984 0.491311
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.592993 7.999898 18.889230 19.491258 2.230530 2.218868 3.674980 3.655411 0.048830 0.043246 0.002697
59 N05 RF_ok 100.00% 0.00% 100.00% 0.00% -0.573888 8.248621 -0.296677 19.459261 -0.233525 2.214645 0.101797 3.261397 0.761928 0.041964 0.578977
60 N05 RF_ok 0.00% 0.00% 0.00% 0.00% -0.365289 1.630495 -0.163052 1.372315 -0.190082 0.620240 0.124800 -0.978549 0.752850 0.709644 0.508952
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 5.700491 -1.387539 11.333534 -0.909138 2.245791 -0.926689 2.512993 -0.024915 0.044283 0.697959 0.545322
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% 0.225642 1.048173 1.663388 0.492605 0.170154 -0.105767 1.142704 -1.169297 0.705625 0.673341 0.481608
63 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.178500 3.199032 -0.683483 2.412067 -1.109203 1.585494 -0.556464 -0.947226 0.703570 0.629677 0.492083
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.778519 -1.079557 -1.157654 -0.259651 -1.113462 -0.405187 -0.415857 0.096377 0.690151 0.647043 0.485377
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.292758 -0.927076 0.287424 -0.774707 0.430817 -0.444417 0.505453 0.114007 0.663075 0.626814 0.475181
66 N03 digital_ok 100.00% 100.00% 30.47% 0.00% 12.779963 1.927804 22.863776 12.799844 2.254126 1.127651 8.249384 3.093231 0.048265 0.212950 0.032016
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.956307 0.623227 -0.512989 1.032085 0.144582 1.089007 0.703110 1.127667 0.708162 0.677784 0.468142
68 N03 RF_ok 100.00% 0.00% 0.00% 0.00% 1.545618 2.881594 1.445123 7.703678 1.235903 2.530885 2.035626 4.899442 0.728537 0.691572 0.470102
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.422182 -0.254511 0.554962 -0.056523 1.041345 0.257171 2.124023 0.297056 0.742461 0.711051 0.470245
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% 0.560307 1.936729 1.038473 2.336358 1.052355 1.548487 1.240065 1.367804 0.282948 0.279686 -0.382699
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.944288 -0.196091 -0.715835 0.152920 -0.272543 0.242869 -0.090255 0.471709 0.763819 0.739804 0.474996
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.005964 -0.386952 -0.168200 -0.159482 0.180948 0.118817 0.425716 0.319189 0.774236 0.748255 0.482500
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.162792 1.888056 -0.076399 1.964924 0.049458 1.841600 0.656482 1.409462 0.777174 0.751543 0.494021
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.141543 -1.378903 -0.059134 -1.141551 -0.707281 -0.475603 -0.859309 -0.226111 0.763953 0.745029 0.493159
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% 3.946001 1.038137 -0.759819 -0.816838 -0.231134 -0.805669 -0.296032 -0.284240 0.682521 0.676913 0.394126
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 7.288945 0.882368 0.859109 0.603631 0.011602 -0.239702 0.584308 -1.089795 0.640645 0.673039 0.413697
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.003673 -1.044444 0.673243 -1.097295 0.255128 -1.184089 0.722892 -0.540262 0.700057 0.667386 0.475906
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.274491 1.983751 -0.274164 1.562195 -0.761418 0.810486 -0.842469 -1.189971 0.685787 0.628149 0.486588
81 N07 RF_maintenance 100.00% 0.00% 100.00% 0.00% 46.908656 47.313603 inf inf 2.190151 2.519344 9.378201 34.940709 0.422414 0.066686 0.198187
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 46.906447 47.017421 inf inf 1.727866 1.676207 6.775951 8.715330 0.487827 0.354526 0.107543
83 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 46.904418 47.020159 inf inf 1.169278 1.557951 6.000932 7.448181 0.438560 0.353520 0.106581
84 N08 RF_ok 0.00% 0.00% 0.00% 0.00% 1.347303 2.100036 1.112440 1.668998 0.326804 0.845304 -1.166536 -1.150629 0.709858 0.673567 0.465754
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.450630 -1.108106 -0.526496 -0.797176 -1.259769 -0.536721 -0.797278 -0.202821 0.738171 0.715413 0.469549
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.887157 -0.139056 1.276987 -0.163539 1.388561 0.085147 2.693340 6.365199 0.758902 0.730809 0.466773
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.188526 0.384777 3.931167 -0.826579 1.079948 -0.534950 3.955566 -0.143329 0.749122 0.744419 0.429717
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.331948 0.828824 0.542041 1.567188 0.770446 1.567264 0.791570 1.168541 0.779552 0.749630 0.476905
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.096477 0.397982 0.572933 0.807435 0.658205 0.824691 0.654013 0.743798 0.781986 0.754886 0.487384
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.023194 -0.208953 10.874981 0.158191 1.142281 0.207306 2.517912 0.663619 0.733390 0.756096 0.493929
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.162693 -0.075411 0.611997 0.453867 0.436527 0.450146 0.640509 0.511666 0.772853 0.747379 0.509513
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.844199 5.891706 19.012842 19.380944 2.235777 2.217917 4.566262 4.573063 0.042385 0.041704 0.002001
93 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.196913 6.320288 18.920162 19.612301 2.241520 2.224681 4.300892 4.740540 0.042060 0.041526 0.001917
94 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.606045 3.409350 19.197144 9.555273 2.256562 2.437343 4.438065 2.742915 0.041809 0.685199 0.513636
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.002860 -0.104311 -0.624488 -0.023190 -0.679854 -0.741993 -0.008983 -0.944952 0.706305 0.676441 0.481008
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.794947 8.852644 0.569454 -0.277959 0.027853 -0.737174 -1.056592 0.245904 0.687488 0.605715 0.454979
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.069106 1.552534 -0.994634 1.302843 -1.238733 0.668405 -0.559099 1.649206 0.679965 0.637191 0.475505
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.455631 2.053211 -0.202396 0.792523 -0.051606 0.418113 0.218752 0.672113 0.721087 0.694843 0.468056
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.084950 -0.154706 -0.948770 -0.832726 -1.106270 -0.680893 -0.579212 0.572734 0.736899 0.712120 0.464458
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.173843 0.559102 -0.544930 0.153711 -0.934014 0.363948 -0.766616 0.612610 0.746097 0.724865 0.453664
104 N08 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.512615 30.084350 4.360020 8.533792 1.858905 3.602328 2.151100 3.222259 0.765789 0.709724 0.482748
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.646069 0.357008 -0.128133 1.009962 0.417414 1.085258 0.978771 1.347821 0.773799 0.750339 0.471371
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.845471 -0.733374 0.650378 0.193569 0.823641 0.365524 1.074411 0.353143 0.781753 0.753359 0.483842
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.799499 0.586837 0.007390 -0.668185 0.379020 -0.330197 2.213329 1.877210 0.777995 0.751173 0.488058
108 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.922357 0.520996 -0.610281 0.607964 -0.237794 0.691266 0.008983 0.563351 0.770443 0.753022 0.500068
109 N10 RF_maintenance 100.00% 10.80% 100.00% 0.00% 3.733114 6.193284 18.242783 19.190818 1.097454 2.223061 2.844574 4.379156 0.454215 0.045033 0.367824
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.706220 -0.953478 0.534520 -0.182325 -0.278355 -0.325157 0.802214 0.121977 0.708359 0.729078 0.420044
111 N10 RF_maintenance 100.00% 0.00% 0.00% 100.00% 3.225086 6.587815 3.669290 -0.045290 1.879324 -0.862960 2.186584 0.195257 0.243653 0.268344 -0.371805
112 N10 digital_ok 100.00% 0.00% 0.00% 100.00% 0.254119 2.410948 0.496563 13.425576 0.763670 0.796646 0.770595 2.039561 0.242107 0.209775 -0.379886
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 3.037777 3.047354 2.186172 2.307849 1.427076 1.471667 -0.985929 -0.979402 0.675097 0.641283 0.475695
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.753992 -0.379080 1.931936 -1.014655 1.227615 -1.434181 -1.040875 -0.613905 0.661599 0.652256 0.454834
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.304237 -0.285559 -1.093542 -0.197405 -0.828380 -0.671797 -0.318209 -0.967581 0.667228 0.626050 0.467118
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 46.900926 47.017195 inf inf 2.340728 2.337733 5.759450 7.496054 0.035017 0.045052 0.012609
118 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 46.899941 47.016657 inf inf 1.576598 1.464266 6.129831 6.221548 0.277514 0.356462 0.025239
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.656326 -0.329499 2.861149 0.040495 1.847891 0.166932 2.074173 0.392469 0.736154 0.708870 0.471696
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.667311 4.619333 1.348896 7.596715 0.673032 2.625352 -0.907484 7.020083 0.730444 0.719550 0.457882
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.796779 0.187128 -0.628097 -0.997682 -0.194235 -1.019236 -0.015425 -0.572586 0.758313 0.728851 0.458200
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.698730 1.005159 1.966422 0.805749 1.251797 -0.045394 -0.847584 -1.246537 0.742687 0.734136 0.470333
124 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.077124 0.278141 19.248548 0.745350 2.229259 0.832842 3.749394 1.230351 0.049370 0.755279 0.570373
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.153102 -0.072348 3.576815 0.683125 2.698919 0.929794 2.419757 0.669102 0.780845 0.757946 0.491627
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.657538 -0.036554 0.849088 0.229733 0.796354 0.326419 2.044379 0.369194 0.775194 0.751268 0.505792
127 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 4.986684 17.974986 18.988367 4.895677 2.232752 3.301821 3.413178 2.517595 0.042316 0.353585 0.190317
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.471480 -0.397287 0.284813 -0.518920 0.558262 -0.224752 0.709390 0.836383 0.759482 0.737259 0.516257
131 N11 not_connected 100.00% 0.00% 4.99% 0.00% -0.489518 5.444910 -0.626320 11.537841 -0.883189 0.920547 -0.657459 2.389901 0.702763 0.398680 0.544079
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.674148 -1.318294 -0.636865 -1.196602 -1.059800 -1.195670 -0.700070 -0.517482 0.695750 0.662730 0.470220
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.276025 -0.905162 -1.162832 -0.835827 -1.002190 -1.395175 -0.344512 -0.678118 0.679067 0.641638 0.461704
134 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.629221 2.238856 3.475973 1.671326 0.820477 0.886195 2.838459 -1.180137 0.628880 0.594165 0.457845
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.226307 -1.321492 -0.513063 -1.070995 -0.945111 -1.239798 -0.730394 -0.429605 0.626910 0.595934 0.473952
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 4.628050 1.069284 18.609900 0.927086 2.205318 0.887489 4.620735 1.280115 0.042863 0.625983 0.484923
137 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 46.908821 47.019820 inf inf 2.569549 3.159368 12.308362 16.481273 0.277885 0.357534 0.025689
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.930276 -0.070236 0.494936 -1.165775 -0.257615 -1.098594 -1.021264 -0.421860 0.706991 0.685358 0.475437
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.877510 0.266457 0.733350 0.511358 0.553522 0.874452 5.304143 1.174288 0.737567 0.712213 0.463222
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.154491 -0.138720 0.298738 0.413726 0.409680 0.523040 0.444180 0.431090 0.752108 0.727222 0.466075
142 N13 RF_ok 0.00% 0.00% 0.00% 0.00% -0.137034 2.355886 0.040659 2.167905 0.097841 1.788018 2.914974 3.179807 0.757836 0.730696 0.464498
143 N14 RF_maintenance 100.00% 0.00% 100.00% 0.00% 10.547819 6.412997 8.561861 19.538046 1.957391 2.232720 3.267252 5.618904 0.493830 0.042301 0.389056
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.755770 -0.112980 -0.842686 -0.522476 -0.508198 -0.342096 -0.051475 0.363425 0.774284 0.746961 0.480746
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.409620 1.921595 0.181915 2.033403 0.446240 1.807133 0.425927 1.571725 0.780281 0.751078 0.485262
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.262131 -1.000012 -1.117316 -0.928708 -0.973693 -1.382551 -0.292607 -0.419193 0.759661 0.736785 0.508703
147 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
149 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
150 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 4.702765 0.070354 -0.600274 0.969187 -0.323313 0.392622 -0.085888 1.508182 0.641530 0.667870 0.436664
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.318692 -1.318102 -1.119112 -1.109376 -0.998595 -1.071141 -0.159193 -0.402164 0.685380 0.647080 0.462388
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 5.237119 -0.273736 11.535277 -0.126396 2.241313 -0.333136 3.467277 0.167558 0.045165 0.620242 0.465307
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.449188 -0.951465 -0.413165 -1.033706 -1.027250 -1.318703 -0.803676 -0.609407 0.643110 0.596180 0.445712
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.030676 -0.348526 18.744925 0.288613 2.220155 0.507124 4.328533 0.598196 0.042134 0.604648 0.477207
156 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.451495 0.199778 6.409325 0.126081 2.386832 -0.667427 3.112908 -1.071617 0.654849 0.614440 0.485509
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.481120 0.341808 0.207589 0.435239 0.470550 0.449632 0.407122 0.406073 0.682416 0.649817 0.478966
158 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.827755 -1.261186 -0.730106 -0.747896 -0.937193 -1.267918 -0.462272 -0.272273 0.697231 0.666084 0.480874
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.347165 6.503680 1.084497 1.155112 0.350173 -0.785795 0.879299 0.520259 0.700008 0.610782 0.472430
160 N13 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.537217 0.191286 18.910796 0.403852 2.244893 0.594782 4.498442 0.501656 0.050325 0.704885 0.589499
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.494567 13.324999 0.585223 0.462013 0.532502 -0.621550 0.634458 0.143244 0.745922 0.673339 0.419594
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.750098 -0.052538 -1.118193 -0.005676 -0.845559 0.003375 -0.246295 0.212371 0.752080 0.724853 0.469405
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.185915 1.235462 0.010830 0.447869 0.235923 0.498878 0.307027 0.502350 0.760681 0.733087 0.472757
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 2.881587 0.625350 4.695110 0.736919 2.336959 0.467305 2.242104 0.658096 0.758984 0.732547 0.475722
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 6.297716 -0.001989 1.516827 0.051786 -0.364063 0.235387 0.834470 0.339837 0.706894 0.739359 0.443835
166 N14 RF_maintenance 100.00% 100.00% 0.00% 0.00% 7.253974 -0.388291 19.181460 -0.299732 2.238439 0.072506 3.620484 0.008761 0.042364 0.740942 0.565602
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% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
170 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 80.172235 80.197817 inf inf 631.987558 630.409273 5276.477694 5298.611916 nan nan nan
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.374685 -0.160034 1.368727 0.623398 0.406751 0.233653 2.092794 1.801986 0.693075 0.666142 0.481886
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.078268 -0.428461 -0.119358 -0.755699 -0.795563 -0.820978 -0.816633 -0.146036 0.680269 0.644228 0.474862
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.003362 3.048844 2.137786 2.255167 1.374232 1.454368 -1.030736 -1.015734 0.634724 0.587608 0.458110
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.453565 0.020373 0.897563 0.275752 0.975670 0.571187 0.751163 0.447013 0.709150 0.677270 0.486534
180 N13 RF_ok 100.00% 0.00% 0.00% 0.00% -0.345929 12.699473 -0.172372 16.227957 -0.107593 -0.036856 1.000101 2.706496 0.718568 0.480332 0.482412
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.095857 0.460239 1.017637 0.281589 0.809323 0.165603 0.810406 0.984190 0.733292 0.703409 0.478961
182 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.853170 6.132526 -0.294192 19.168507 -1.087977 2.173983 -0.676758 4.509422 0.737948 0.049318 0.558915
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.690150 0.267031 0.082476 0.889961 0.065135 0.575538 0.360321 0.726916 0.749736 0.719127 0.469259
184 N14 dish_maintenance 100.00% 0.00% 0.00% 0.00% 7.026080 0.594701 16.087229 1.082504 -0.179743 0.843290 2.924987 0.844135 0.517177 0.727360 0.495883
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.540947 -0.019654 -0.296218 0.503989 0.079732 0.522645 0.121914 0.513994 0.753961 0.726238 0.479738
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.262109 -0.951430 -0.123848 -0.813248 -0.625337 -1.211842 -0.914675 -0.750531 0.744019 0.719544 0.482095
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.007562 -0.676055 -0.190567 -0.153669 0.051728 0.071529 0.261237 0.234845 0.753035 0.729743 0.500456
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
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 0.00% 0.00% 0.00% 0.00% 3.138952 3.284984 2.258559 2.447973 1.452894 1.599934 -0.959229 -0.932553 0.652898 0.608533 0.471183
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.266995 2.793835 2.358014 2.125243 1.566605 1.288682 -0.930435 -1.053794 0.632577 0.589989 0.449427
200 N18 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.075018 -0.180655 11.676635 -1.159747 2.245563 -1.100516 3.306184 -0.377428 0.047378 0.676777 0.575475
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.603906 2.740268 1.144949 2.077851 0.481565 1.258956 -1.134114 -1.085235 0.709015 0.662990 0.490236
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 0.430688 -0.030595 0.335501 0.330049 -0.113615 -0.126782 -1.004895 2.224389 0.725604 0.696663 0.473023
204 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.090534 3.836255 -0.303353 0.456162 -0.202468 0.210347 0.848878 0.686815 0.738143 0.712536 0.479843
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.443975 0.581059 7.128485 0.828621 -0.215812 0.293508 2.676015 2.650518 0.664747 0.702953 0.482123
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 1.049800 0.761254 2.342383 2.338291 1.778091 1.468871 1.432580 1.410405 0.717007 0.691270 0.470836
207 N19 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.888929 -1.449261 11.212875 -1.078291 2.242671 -0.869271 2.910613 -0.368610 0.051258 0.705938 0.602075
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.558879 6.203261 -0.177657 12.064714 -0.274821 2.212444 0.193112 3.308702 0.681803 0.045410 0.578965
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.855328 -1.113165 -0.632757 -1.206800 -0.618499 -0.726866 -0.518248 -0.338160 0.710038 0.678124 0.485684
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.509463 -0.914165 -0.676400 -0.982087 -1.146523 -1.374111 -0.313838 -0.675210 0.718172 0.686634 0.483004
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.660480 -0.160228 -0.743233 -0.379991 -1.111712 -1.147668 -0.499693 -0.891153 0.719393 0.686679 0.481064
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.088301 1.517269 -0.390672 3.023532 -0.614068 0.929997 0.043716 2.018083 0.715636 0.674333 0.484561
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.546732 3.120968 2.553728 2.382806 1.771203 1.561967 -0.851714 -0.951957 0.682674 0.656404 0.474311
225 N19 RF_maintenance 100.00% 0.00% 18.84% 0.00% 0.353463 5.252968 0.262590 11.347745 -0.382046 1.273019 -1.018740 3.846896 0.714126 0.361277 0.598520
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.939799 3.416064 -0.875256 -0.549324 -1.297758 -0.126052 -0.602522 -0.565171 0.717914 0.645733 0.479576
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.045435 -1.230200 1.747214 -1.164709 0.492027 -1.105503 5.839616 0.437316 0.698987 0.673843 0.484137
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.364575 -1.029121 0.086773 -0.985504 -0.278228 -0.961451 -0.747226 -0.010929 0.686905 0.651308 0.474909
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.454838 0.625337 0.079222 0.540587 -0.634609 -0.307827 -0.954850 -1.181084 0.673493 0.629337 0.482480
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.320265 -1.204990 0.466746 -1.189545 -0.385271 -1.131019 0.447793 -0.531105 0.687524 0.656444 0.493035
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.513391 0.406249 0.275580 0.344818 -0.382846 -0.431199 -1.049826 -1.154988 0.696890 0.659329 0.497030
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.059166 -0.273676 -1.089693 -0.423012 -1.142608 -1.116073 -0.414473 -0.714552 0.707620 0.671825 0.493466
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.018456 -0.709649 -0.773466 -0.939341 -0.741164 -1.275044 -0.087115 -0.268747 0.708020 0.675920 0.487637
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.796351 -0.510235 -0.662810 -0.379491 -1.130605 -0.944099 -0.582831 -0.925524 0.711535 0.676743 0.495723
242 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.998023 0.648902 -0.737790 0.263889 -0.170047 -0.484399 0.052451 -1.071098 0.649238 0.667453 0.454322
243 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.381958 -1.328229 0.140352 -1.200502 0.079146 -1.043562 0.249356 -0.455524 0.669829 0.667705 0.468343
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.234427 0.415430 -0.160956 1.156036 -0.142222 0.377935 0.244654 1.064614 0.698374 0.662074 0.482221
245 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.156152 -1.111237 -0.046915 -1.138838 -0.677185 -1.221999 -0.964960 -0.254129 0.679935 0.644468 0.477202
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.474366 6.831984 -0.794253 11.477866 -1.131674 2.219525 -0.319992 2.779488 0.664617 0.044857 0.560823
261 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.188020 -0.558584 -0.109891 -0.612961 -0.716457 -1.178129 -0.853775 -0.822620 0.672249 0.636388 0.476495
262 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.296891 3.420255 0.057042 0.301655 0.113977 0.434011 0.453474 0.441095 0.663915 0.629540 0.489214
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% -0.599932 -0.452910 -1.104475 -0.887273 -1.043519 -1.181705 -0.409045 -0.523571 0.490782 0.352321 0.344658
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.268624 1.607491 0.485755 0.680023 -0.007931 0.083642 -1.012035 -1.156195 0.471420 0.364513 0.340712
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.453167 -1.351635 0.367530 -1.147452 -0.266719 -0.903585 -1.063171 -0.396944 0.525685 0.439775 0.372432
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 5.730560 6.122783 11.436352 12.209103 2.247067 2.217463 2.974870 3.757626 0.046365 0.046355 0.002465
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 0.791517 -0.071207 0.725301 -1.155385 0.418934 -0.852143 0.765914 -0.420238 0.450143 0.314839 0.308852
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, 9, 15, 16, 17, 18, 27, 28, 29, 32, 34, 40, 41, 42, 47, 51, 54, 55, 58, 59, 61, 66, 68, 70, 78, 81, 82, 83, 86, 87, 90, 92, 93, 94, 96, 104, 109, 110, 111, 112, 117, 118, 121, 124, 127, 131, 136, 137, 140, 143, 147, 148, 149, 150, 151, 153, 155, 156, 159, 160, 161, 164, 165, 166, 167, 168, 169, 170, 180, 182, 184, 189, 190, 191, 200, 205, 207, 208, 209, 210, 211, 225, 227, 246, 329]

unflagged_ants: [3, 7, 8, 10, 19, 20, 21, 22, 30, 31, 35, 36, 37, 38, 43, 44, 45, 46, 48, 49, 50, 52, 53, 56, 57, 60, 62, 63, 64, 65, 67, 69, 71, 72, 73, 74, 77, 79, 80, 84, 85, 88, 89, 91, 95, 97, 101, 102, 103, 105, 106, 107, 108, 113, 114, 115, 120, 122, 123, 125, 126, 128, 132, 133, 134, 135, 139, 141, 142, 144, 145, 146, 152, 154, 157, 158, 162, 163, 171, 172, 173, 179, 181, 183, 185, 186, 187, 192, 193, 201, 202, 204, 206, 220, 221, 222, 223, 224, 226, 228, 229, 237, 238, 239, 240, 241, 242, 243, 244, 245, 261, 262, 320, 324, 325, 333]

golden_ants: [3, 7, 10, 19, 20, 21, 30, 31, 37, 38, 44, 45, 53, 62, 65, 67, 69, 71, 72, 85, 88, 91, 101, 103, 105, 106, 107, 122, 123, 128, 141, 144, 145, 146, 152, 154, 157, 158, 162, 163, 171, 172, 173, 181, 183, 186, 187, 192, 193, 202]
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_2460101.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.dev158+gd5cadd5
In [ ]: