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 = "2459939"
data_path = "/mnt/sn1/2459939"
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: 12-25-2022
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/2459939/zen.2459939.21320.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 1849 ant_metrics files matching glob /mnt/sn1/2459939/zen.2459939.?????.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/2459939/zen.2459939.?????.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 2459939
Date 12-25-2022
LST Range 0.823 -- 10.775 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1849
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 94
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 18
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 67 / 201 (33.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 125 / 201 (62.2%)
Redcal Done? ❌
Never Flagged Antennas 76 / 201 (37.8%)
A Priori Good Antennas Flagged 53 / 94 total a priori good antennas:
3, 7, 9, 10, 15, 16, 29, 30, 37, 38, 40, 42,
53, 54, 55, 56, 71, 72, 81, 86, 93, 94, 98,
99, 100, 101, 103, 109, 111, 116, 121, 122,
123, 128, 129, 130, 136, 143, 146, 148, 158,
161, 164, 165, 170, 181, 182, 183, 185, 187,
189, 191, 202
A Priori Bad Antennas Not Flagged 35 / 107 total a priori bad antennas:
8, 22, 43, 46, 48, 49, 61, 62, 64, 74, 77,
79, 82, 89, 90, 95, 114, 115, 120, 125, 137,
139, 206, 207, 211, 223, 237, 238, 239, 245,
261, 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_2459939.csv

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 9.838093 14.680847 8.424947 0.607982 7.157435 3.664617 0.665507 3.884913 0.033326 0.348270 0.276399
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.186838 1.585122 0.460176 1.574485 2.787604 1.667677 6.420906 0.014763 0.649626 0.656110 0.410976
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.119760 -0.054320 -0.189798 -0.114809 0.326982 1.912023 0.299604 -0.524078 0.648732 0.658509 0.411578
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.916489 -1.049968 0.700547 2.975522 0.127739 -0.370503 16.906347 13.202941 0.640186 0.642361 0.397946
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.012698 -1.252041 -0.783683 -0.106194 0.046694 1.088996 2.393603 2.415420 0.651700 0.658921 0.399765
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 3.840229 -0.230580 6.929880 0.253438 3.023846 0.678906 -0.023113 -0.557811 0.484468 0.655013 0.471375
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 6.008284 -0.586391 -0.391778 -0.620219 0.467954 1.266521 0.541719 3.247885 0.632880 0.645426 0.400488
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.023324 17.067946 7.912705 1.685748 7.161157 3.705706 0.099395 1.450803 0.031900 0.342143 0.261336
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.094933 -0.629933 8.397063 0.418376 7.163199 2.382985 0.612246 1.809406 0.031515 0.662164 0.533952
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.847034 1.828259 0.010861 0.179119 1.424853 1.343592 2.080258 1.598552 0.653675 0.663596 0.408663
18 N01 RF_maintenance 100.00% 100.00% 62.95% 0.00% 10.748356 19.151154 8.392517 0.345859 7.317727 4.703990 0.620057 15.319760 0.029165 0.217855 0.163912
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.265695 -1.353215 -0.549273 2.873497 0.805221 1.480703 1.045521 3.280005 0.653954 0.648835 0.398600
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.963379 -1.209496 3.103430 -1.216548 0.337636 -0.616154 0.869272 -0.885780 0.639066 0.670358 0.413143
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.192920 -0.224199 -0.204543 3.790174 0.878897 -0.369591 0.050557 -0.403054 0.640431 0.624928 0.402041
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.201574 -0.956457 -0.210617 -0.474718 2.746355 1.737442 -0.184321 -1.118325 0.610608 0.624423 0.399571
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.371494 10.628859 8.438118 8.933115 7.300745 7.931501 2.257903 1.549898 0.034821 0.038622 0.005556
28 N01 RF_maintenance 100.00% 0.00% 85.13% 0.00% 12.125809 26.565466 -1.240174 0.955495 3.926239 4.836090 3.651487 13.762177 0.361859 0.159427 0.269340
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.067634 11.087786 8.088616 8.586287 7.284238 7.904282 0.816538 0.216125 0.029809 0.035048 0.005473
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.291147 -0.069039 -0.339799 0.365063 2.564538 0.956811 14.305390 -0.006921 0.662652 0.668032 0.401370
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.150721 -1.008065 0.651149 1.085763 1.957006 0.058565 0.438074 3.560453 0.667747 0.667107 0.398984
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.891463 11.845980 0.072613 1.630327 6.104003 6.910150 11.780497 106.741825 0.589906 0.607349 0.342372
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.572921 12.222459 3.653785 4.049365 7.242490 7.880446 1.571741 1.096662 0.033927 0.040581 0.004497
35 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.323592 -0.628676 0.485513 -1.398552 -0.858306 -0.630026 4.550488 0.186625 0.619933 0.616917 0.395231
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.354052 7.277433 0.012956 0.186362 1.048119 1.952282 1.001306 0.823417 0.643218 0.653425 0.413697
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.777705 0.107949 -1.312052 1.099694 1.214654 1.765291 -0.468766 5.849291 0.656457 0.661500 0.416268
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.068810 0.116440 0.010421 0.448022 0.298172 0.147695 5.260646 1.176494 0.658250 0.668983 0.416422
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 9.404369 0.485511 8.115336 0.375182 7.284557 -0.239367 0.954136 0.179884 0.036685 0.662222 0.528808
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.609511 0.099333 -0.545906 -0.045300 2.339561 0.930732 0.249209 0.507331 0.661730 0.671136 0.395787
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.686921 11.642004 8.645167 9.342823 7.049772 7.697528 0.995103 1.520360 0.030722 0.029157 0.001976
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.070845 0.278519 -0.514175 0.398296 -0.141457 1.023446 0.219933 1.278292 0.670641 0.673421 0.402528
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.462671 0.257772 -1.345352 -0.024979 -0.125424 0.953679 -0.183251 -0.480983 0.668040 0.681217 0.397693
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.311391 3.409205 0.006868 0.239935 -0.236038 2.849097 0.462565 3.399168 0.661988 0.663491 0.390751
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.212952 1.520978 1.120676 1.285610 -0.376020 0.511187 -0.163308 -2.023238 0.652256 0.677868 0.414203
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.747773 11.936266 3.497478 3.724389 7.206487 7.814928 1.251901 0.205372 0.030990 0.049603 0.012568
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.144012 0.365174 0.090530 1.074316 0.564929 1.393554 0.711435 -1.653389 0.626425 0.643879 0.401296
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.530987 -0.581540 -1.135291 -0.173747 -0.523424 -0.884909 0.020647 1.071979 0.580411 0.624599 0.405290
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.778329 19.301388 0.094959 1.079805 1.582006 5.152814 7.909946 25.772717 0.632303 0.580658 0.382334
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 23.296457 3.792444 10.790355 -0.607825 7.480454 5.449286 9.148494 3.184134 0.038591 0.548936 0.427641
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.011717 6.299740 -0.649755 0.355661 1.091983 1.322047 2.023552 0.395786 0.658378 0.670051 0.405880
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.146494 2.521947 -0.259035 0.043251 1.952563 2.355198 2.966456 5.650401 0.667099 0.676029 0.410953
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.898598 11.334721 8.446934 9.129248 7.254275 7.879839 2.439525 1.372483 0.030709 0.029296 0.001269
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.388794 11.993334 8.463010 9.046121 7.322190 7.941883 1.840956 3.209442 0.028008 0.030577 0.002492
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% -0.290861 12.107926 0.185371 9.229782 -0.128059 7.785924 2.452431 0.949602 0.666621 0.036959 0.555233
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.899762 7.074297 7.875607 0.872885 5.904558 2.772571 6.165604 3.797235 0.308743 0.673595 0.472750
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.399083 10.981708 8.341319 9.030363 7.224441 7.880777 2.279680 1.709478 0.035175 0.034884 0.001655
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.574194 0.794713 8.390458 1.083816 7.055759 3.192555 1.461780 12.499129 0.046711 0.669873 0.543910
60 N05 RF_maintenance 100.00% 0.00% 99.46% 0.00% 0.613702 10.873967 -0.526612 9.059913 0.365535 7.889404 1.318928 2.836867 0.659735 0.070953 0.537991
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.520936 0.837530 -0.569320 -1.362379 1.746982 -0.928131 -0.147303 0.395152 0.600509 0.632556 0.394238
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.269127 0.626461 -0.996791 0.625568 -1.082472 -0.604453 0.966783 -1.017981 0.600115 0.645368 0.405386
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.110424 11.320983 -0.580842 4.078851 -0.528786 7.949111 -0.063304 2.263448 0.620832 0.042360 0.498006
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.121697 0.064894 -0.871424 -0.906406 -1.230821 -1.154960 -0.084280 -0.181196 0.607415 0.603532 0.386316
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.558406 0.896803 0.278403 0.846118 0.005950 1.325964 0.003532 0.137341 0.638402 0.656904 0.421655
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.356231 1.298688 1.748404 1.672530 2.948407 0.259055 0.213005 1.505549 0.645485 0.661777 0.412889
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -1.024786 -0.953431 1.710410 1.675038 -0.343104 0.922728 0.819281 3.236398 0.655548 0.667655 0.406876
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 22.528744 25.922463 0.885021 11.915788 3.064256 7.935473 0.529257 8.937831 0.363435 0.028840 0.265709
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.318090 -0.309829 0.132287 0.508028 -0.347065 1.860664 0.593742 0.604685 0.662909 0.676054 0.394809
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.621536 -0.078962 -0.507108 -0.135990 1.278827 1.816417 1.335970 0.959775 0.670974 0.682295 0.394534
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.565176 -0.059888 0.285680 0.890601 1.158577 0.339965 1.140767 1.370696 0.682129 0.683947 0.390541
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.509523 12.167274 0.428840 9.365650 -0.064085 7.715922 3.756233 1.408848 0.673433 0.034894 0.553924
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.994694 0.686712 -1.105980 1.813384 0.953782 5.176902 0.097040 0.065074 0.683469 0.675308 0.392878
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.789233 1.687692 -0.250167 -0.693266 -0.256600 2.569738 -0.894223 1.763520 0.675366 0.678425 0.389949
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.662225 0.438824 0.136586 -0.499591 -0.886934 -0.941470 2.859251 -0.829292 0.639942 0.640942 0.397046
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 31.107730 -0.232792 -0.462125 0.541388 1.712944 -0.393978 0.761799 3.386041 0.423530 0.650004 0.402381
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.074425 -0.686757 -1.529094 -0.403479 -1.130065 -1.496578 0.129364 -1.526741 0.609885 0.641154 0.405436
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 2.707479 12.488856 2.274106 3.980796 2.295312 7.791683 -0.219318 0.659625 0.613008 0.046128 0.481511
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.447082 11.801825 -0.309427 7.828477 0.231664 7.585254 0.003657 1.605799 0.613449 0.037464 0.480629
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.403122 -0.492108 0.046734 1.677080 0.154408 0.822422 -0.352459 -0.397639 0.633486 0.642234 0.404618
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.446893 0.241540 -0.129058 0.258625 0.301657 0.253348 -0.239203 0.384939 0.646147 0.659775 0.403575
84 N08 RF_maintenance 100.00% 52.84% 100.00% 0.00% 19.687596 22.894682 10.871674 11.525629 5.758120 7.826461 3.655525 3.994676 0.221539 0.035569 0.145405
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.008022 -0.233011 0.680207 1.054558 -0.364947 0.232895 -0.463146 -0.520108 0.661603 0.671550 0.397142
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.472057 1.699786 1.452281 1.308051 3.682020 -0.922812 0.282394 14.930296 0.644512 0.648830 0.368802
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.268733 7.228921 -0.041240 -0.146442 12.697627 -0.240720 2.711748 1.031397 0.631506 0.689498 0.378490
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.442123 0.066938 0.035605 0.732301 -0.833950 0.190355 3.604407 1.293501 0.664010 0.678288 0.381455
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.981071 0.208224 -0.067846 0.691383 -0.811380 -0.449469 -0.472235 -0.537651 0.675445 0.679498 0.384441
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.464941 -0.656093 0.668775 1.089402 -0.276076 -0.674649 0.187432 3.058876 0.664754 0.667473 0.384625
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.833876 -0.814691 0.128496 0.207321 -0.604525 -0.332230 0.094556 -0.171268 0.657586 0.673605 0.390636
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 235.894541 235.463254 inf inf 3674.650993 3658.857675 6366.943453 6274.710441 nan nan nan
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.190337 -1.052670 -0.939976 0.278473 -0.231051 -0.709049 -0.318494 0.960467 0.625278 0.651776 0.405568
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.069673 12.110974 3.502910 4.141627 7.045953 7.684317 0.868625 0.307288 0.033738 0.038631 0.002386
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.663035 7.187331 -0.052677 2.356023 -0.735436 3.350334 2.248112 3.274222 0.568122 0.492808 0.380058
98 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 226.246521 225.975273 inf inf 4200.115151 4123.953498 7932.473253 7677.771006 nan nan nan
99 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 185.026269 184.597688 inf inf 3882.429670 3846.184310 7107.101973 6969.459831 nan nan nan
100 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 220.721941 221.074031 inf inf 3224.951501 2699.446290 7442.884418 6720.515019 nan nan nan
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.017127 8.226069 -0.563997 0.853549 0.225815 1.802202 0.066996 0.414950 0.663784 0.671384 0.396745
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.053093 0.633446 -1.461802 2.454554 1.039113 1.096685 -0.366245 5.857927 0.671545 0.663411 0.389610
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.709629 4.454016 -1.097627 -0.421644 2.223444 1.112889 9.631615 3.884688 0.671847 0.680650 0.384181
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.882047 58.602561 5.856063 6.275322 2.300555 3.731485 0.078630 -0.155802 0.613993 0.653527 0.390433
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.396600 -0.220840 -0.121045 0.699709 1.148865 -0.044013 -0.172211 -0.555561 0.677563 0.680269 0.377494
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.038049 0.496785 0.805401 0.918649 0.387206 -0.508633 -0.094907 -0.464580 0.663258 0.675029 0.373783
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.770092 1.072465 -0.430835 -0.319500 0.330398 -0.005950 2.454397 3.199602 0.672535 0.681690 0.383514
108 N09 RF_maintenance 100.00% 100.00% 3.84% 0.00% 9.975724 39.245091 8.388087 0.606231 7.223386 4.419536 1.526875 1.720902 0.035655 0.276413 0.144438
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.758465 10.969115 8.423188 8.829678 7.350098 7.962274 0.685287 1.658833 0.026859 0.026931 0.001295
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 25.392748 24.428368 11.270396 11.683412 7.204786 7.766780 3.836735 3.738204 0.024014 0.026095 0.001139
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% -0.110177 10.903831 0.265831 8.918202 -0.438575 7.950637 1.355879 1.619815 0.656921 0.034868 0.478230
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.176072 -0.225968 -0.065873 -0.014630 0.551689 2.262673 0.772551 -0.534677 0.649787 0.661404 0.408908
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.813397 12.159207 3.315257 4.049178 7.083704 7.729918 1.364621 0.254774 0.034721 0.030914 0.002037
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.803106 0.384014 -1.249801 -0.469456 2.026956 -0.597955 0.190547 -0.607461 0.593878 0.635202 0.407644
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.223543 1.205780 0.932771 1.488297 0.113699 0.960312 -1.556941 -1.816512 0.611001 0.629763 0.415938
116 N07 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.813227 12.467073 8.485347 9.344055 7.094754 7.844966 1.098151 3.229572 0.027547 0.030932 0.002355
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.541484 1.092444 -0.265099 0.480052 0.116306 0.283446 0.873008 1.513211 0.635328 0.655653 0.408070
119 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 205.975750 202.890257 inf inf 3108.492872 3266.330259 5727.508111 5817.645156 nan nan nan
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.629287 1.991992 2.120106 1.527830 -0.348027 0.976220 1.046937 -2.127444 0.648909 0.670885 0.388298
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.529921 2.847657 -1.163814 5.279694 0.924068 0.409935 30.031084 12.738116 0.675394 0.652364 0.385377
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.189529 6.302516 0.215466 0.597474 1.012097 1.668052 0.108025 -0.602061 0.680241 0.686412 0.387217
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.129990 7.872772 0.325475 0.831802 1.011105 0.368881 0.105577 0.777704 0.683899 0.688113 0.387126
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.300246 -0.349599 -0.219393 0.471185 -0.256171 0.687939 0.803562 0.422732 0.684895 0.690886 0.388063
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.653429 -1.152510 -0.550941 0.711226 -0.414694 -0.324472 -0.069929 -0.366936 0.679573 0.680009 0.386589
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.210765 1.697671 -0.852937 1.156434 5.276565 6.740153 30.998442 9.427373 0.666203 0.673453 0.389256
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.249512 0.334102 -0.006868 0.265060 2.869285 1.687374 -0.093808 0.067825 0.670918 0.684837 0.402498
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.030422 10.510431 8.480577 9.025273 7.143998 7.772519 0.188028 0.262108 0.029800 0.026356 0.001750
129 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
130 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
131 N11 not_connected 100.00% 0.00% 25.69% 0.00% -0.682692 11.378050 -0.236466 4.006741 -0.722915 7.049036 -0.961595 -0.448054 0.631730 0.263257 0.457138
132 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.105817 0.319936 -0.788683 -1.513210 4.402997 -0.586902 0.521714 -0.637729 0.611687 0.626116 0.401085
133 N11 not_connected 100.00% 100.00% 0.00% 0.00% 11.375283 -0.367617 3.314720 -1.319574 7.192093 -1.015639 1.253139 -0.709947 0.049202 0.616827 0.482580
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.728483 -0.941309 -0.250447 -1.561537 3.676737 0.859232 7.594567 -0.168001 0.612761 0.641911 0.427314
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 8.979575 0.665340 8.068768 1.826022 7.316669 17.367186 1.531677 0.570371 0.038017 0.623188 0.471214
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.346924 -0.874211 -0.326390 -1.228732 2.099078 -0.337062 0.927670 1.475741 0.621868 0.649559 0.414499
138 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 217.283858 216.988809 inf inf 2877.042827 2855.295561 5651.603298 5649.037000 nan nan nan
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.630804 -0.544857 1.031948 -1.273362 -0.186856 -1.101105 -1.252692 -0.304775 0.648806 0.652097 0.393018
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.416171 -0.795905 -1.087583 -0.703021 -0.575396 -0.617917 3.576700 2.633982 0.662080 0.682527 0.392959
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.329398 -0.909674 -0.637792 0.152621 1.174076 -1.259964 0.097842 -1.524617 0.668064 0.685650 0.388095
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.224668 10.913804 -1.032562 9.065990 2.399370 7.883270 17.601064 1.642564 0.673958 0.045929 0.547913
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% 0.662557 11.398576 5.201056 9.043788 -0.464617 7.649970 -0.196921 0.588533 0.613594 0.036270 0.503268
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.233801 0.496879 -0.498561 0.581254 0.656188 1.451626 -0.369032 0.672439 0.681148 0.688582 0.387736
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.259764 1.578388 -0.424540 4.884799 0.012014 12.137696 -0.155584 0.374107 0.676717 0.637473 0.403134
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 11.113271 -1.497166 3.322853 -0.459313 7.159063 -0.778140 0.117607 -1.234446 0.037436 0.674348 0.531111
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.563553 -1.462800 0.944571 1.902030 0.278482 -0.011442 0.039617 -0.350929 0.660342 0.670978 0.394828
148 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -2.022338 -0.160461 2.380760 1.404124 0.214915 2.078956 4.157834 -0.437460 0.642325 0.672548 0.408115
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.854088 0.770940 -1.547194 1.178943 -0.158316 -0.366882 -0.113902 -1.669305 0.661036 0.672497 0.409150
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.568748 -0.455685 0.969149 0.264214 -0.139524 -1.096494 -0.765296 -0.567464 0.654113 0.666786 0.416337
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.513748 -0.893629 8.148245 -1.150580 7.310674 1.018781 0.531965 0.530366 0.035062 0.639903 0.477292
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.581470 10.699025 6.840643 8.843160 3.030081 7.937239 1.064706 1.655588 0.451226 0.038542 0.356233
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.137924 -0.125031 -0.269812 0.499381 -0.206802 1.233992 -0.026527 -0.062544 0.627669 0.647051 0.410485
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.353771 -0.238376 -0.616429 -1.037857 2.497272 2.214190 4.057392 13.991186 0.644364 0.663324 0.413127
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.004327 16.196967 -1.558666 -1.148875 -1.260595 3.183084 -0.289930 32.301278 0.619668 0.583466 0.377685
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.818766 -0.827178 -0.461970 -0.760764 -0.263834 1.801573 0.198945 0.538941 0.658026 0.670820 0.395714
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.913911 27.560112 -0.316151 -0.591403 0.861796 0.589228 -0.142962 0.399920 0.662272 0.537269 0.350386
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.315842 -0.198154 1.747905 0.814814 -0.024108 -0.889821 -0.003532 -1.408713 0.671358 0.684132 0.391496
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.008022 1.200541 -0.408400 0.296951 0.114070 1.622823 -0.189505 0.829909 0.679565 0.685410 0.395817
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.834054 0.340400 1.328537 -0.211073 6.222496 2.255727 0.818323 0.792821 0.666837 0.683225 0.388639
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 29.552912 0.100634 1.915069 0.411744 3.234683 0.574967 1.662711 -0.277999 0.514428 0.682123 0.388073
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.320488 0.834018 0.206268 1.955222 0.617107 2.060294 4.181279 11.909084 0.671668 0.671425 0.394714
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.344243 -0.657608 -1.086887 3.233033 1.317738 -0.358180 -0.916219 2.924084 0.680038 0.660093 0.406288
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.881794 -0.952423 -0.138199 -0.434593 1.745401 1.138249 -0.240368 2.885430 0.666781 0.680294 0.407000
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.789387 -0.818097 -1.064850 -1.574250 0.792231 0.727742 -0.676542 -1.101702 0.665805 0.679183 0.406307
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.597487 -0.394190 8.593652 -1.029495 7.064260 0.121167 0.722598 1.798439 0.037504 0.672353 0.533928
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.307610 -0.300920 1.433168 3.752892 -0.997958 14.128910 -0.227030 4.415411 0.626317 0.625957 0.397068
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.048603 11.663043 -0.397245 9.178444 2.102295 7.795834 17.029541 1.915481 0.653579 0.052202 0.548019
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.448062 0.152334 -0.191211 0.280231 0.016354 0.461420 0.018663 4.694626 0.661330 0.671006 0.401099
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.234297 10.676612 -0.704837 8.820002 0.257695 7.977057 8.485567 2.040471 0.669802 0.046380 0.521855
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.917548 0.172287 0.872975 4.309984 1.407498 -0.794292 0.770725 0.068612 0.652971 0.627985 0.383561
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.177384 -0.440120 0.496101 3.031295 0.587198 -0.561970 0.442621 0.419663 0.663679 0.661974 0.382177
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 17.518620 -1.354978 6.899140 3.812883 7.786642 -1.016491 0.228593 -0.451420 0.359946 0.647640 0.424336
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.734025 -1.524417 -1.496296 -0.830270 1.123808 -0.456563 -0.225745 -0.950530 0.677710 0.691443 0.403187
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.056033 -0.394120 -1.388533 1.097077 0.025616 2.546384 1.350792 14.144242 0.675769 0.677567 0.393442
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 8.903011 10.232290 7.998827 8.814146 7.428744 7.550405 3.037589 2.257544 0.028510 0.030440 0.000862
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.175233 -1.709306 -0.784982 -0.189453 -0.100073 -0.571274 -0.187679 -1.396403 0.658092 0.676666 0.415273
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.459873 0.549511 0.866666 -0.463147 0.971911 0.939063 12.420293 0.850943 0.642219 0.661714 0.417593
200 N18 RF_maintenance 100.00% 100.00% 53.87% 0.00% 11.578285 35.044372 3.465114 0.245661 7.340333 5.453283 1.631846 -0.719288 0.040919 0.215374 0.147804
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.434112 4.944042 2.320991 3.157502 3.210727 5.000571 -1.309050 -3.034905 0.646458 0.639791 0.402459
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.031618 0.588470 1.134534 -1.454646 0.269795 1.019923 -1.244954 27.702552 0.655188 0.647602 0.398762
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 236.793654 236.738923 inf inf 3463.130481 3494.654586 5896.960501 6019.942351 nan nan nan
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.083584 3.002474 0.262554 -0.934944 -1.008713 -0.258338 -0.523551 5.904246 0.649355 0.632997 0.390338
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 1.008042 0.648797 0.598282 -1.196772 0.339746 -1.175408 -0.383123 2.949692 0.652382 0.650706 0.390426
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.467845 2.395578 0.919394 -1.219858 0.172077 2.575170 -0.970924 -0.738670 0.634623 0.635555 0.369303
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.197302 10.326711 7.644678 9.586987 7.116024 6.116341 9.181765 68.824506 0.032246 0.032350 0.000485
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.159706 7.567159 7.720413 8.097506 6.867105 7.672145 15.428774 17.729348 0.036714 0.035544 0.000831
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 12.298038 12.086120 1.779149 3.178578 -0.651241 -0.496701 -0.074957 -0.258364 0.635026 0.640429 0.401793
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.259829 -1.090723 -1.143128 -0.354184 -0.868869 -1.242537 0.970512 -1.130580 0.601935 0.629298 0.406531
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 256.026864 255.754970 inf inf 4655.010476 4655.099890 9233.348780 9232.936043 nan nan nan
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.650281 3.362047 -1.557154 1.740376 -0.982238 1.945395 1.342962 1.889917 0.628538 0.554897 0.408183
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.728556 6.398136 4.133208 3.716228 5.697448 6.103580 -3.153467 -3.525090 0.616153 0.637107 0.392243
225 N19 RF_ok 100.00% 0.00% 90.10% 0.00% 1.132900 11.437102 0.589023 3.877426 -1.062813 7.756424 -1.134507 0.355484 0.651163 0.118370 0.546184
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.086430 5.125726 -0.133276 0.669933 -1.453831 1.945458 -0.907408 -1.158093 0.643957 0.629522 0.390987
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.575851 0.107273 -1.395274 -0.356613 0.749471 -1.043850 14.939722 -0.373887 0.613165 0.645841 0.395261
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 20.011178 20.449652 -0.650437 -0.693453 2.608726 3.773148 38.746017 50.842178 0.499333 0.526945 0.275802
229 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.424617 -0.125408 0.940584 0.731025 -0.430273 0.034216 9.747985 -1.770331 0.623365 0.643736 0.414070
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.249611 -0.155935 -0.328949 -1.557653 -0.710362 -0.548782 0.685223 -1.031349 0.581828 0.626619 0.420024
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.136635 -1.056945 0.983521 0.451786 -0.519697 -0.435289 -1.668332 -1.984176 0.634872 0.645191 0.414974
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.100457 -1.077102 0.115752 0.282215 -0.622523 -0.595093 -0.611895 1.271661 0.636042 0.650499 0.413148
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.598610 45.287496 1.870355 0.804693 3.503739 5.786386 8.652707 15.807979 0.501680 0.413714 0.245934
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.648982 3.208759 -0.870013 0.418948 -0.806238 -0.458301 4.660531 18.522882 0.628656 0.605258 0.402338
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 45.547869 1.262425 -0.235973 0.700613 14.276929 0.079109 35.712720 -1.184776 0.389181 0.654812 0.464202
243 N19 RF_ok 100.00% 1.62% 0.00% 0.00% 57.854999 1.938698 0.521012 -1.524194 5.240875 0.035046 -0.902489 -0.564015 0.288489 0.633802 0.498099
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.241586 1.750100 0.996595 -0.647620 1.731337 0.568828 2.670979 5.936623 0.521190 0.609682 0.400083
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 3.334302 0.745209 2.396487 0.349802 2.261334 -0.674332 -2.380953 -0.543243 0.624936 0.637882 0.407945
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.356621 7.425871 -0.882122 -0.856128 2.945620 4.046424 2.261522 -0.914637 0.326507 0.329335 0.163274
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.224065 0.857378 0.446384 -0.739063 -0.688940 -1.152364 -0.684849 -0.139036 0.621123 0.627641 0.405161
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 5.934697 7.264902 7.748675 8.595573 7.039209 7.624176 16.118550 23.225332 0.031853 0.027292 0.004061
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 9.909594 11.860671 4.219026 5.912988 2.318784 7.935959 12.441303 2.418121 0.374838 0.045346 0.292007
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.808978 2.038756 0.702598 0.900526 0.204364 1.111670 0.489529 -0.910922 0.527865 0.546586 0.393646
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.488796 -1.066379 0.823764 -1.558195 0.243643 -0.515144 -1.355645 -0.209992 0.551562 0.556362 0.399801
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.308900 -1.062396 -0.434284 -1.182648 -0.697580 -0.568257 3.715033 -0.086220 0.493412 0.554774 0.403061
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.589139 2.041758 -0.816727 -1.510068 -1.168785 -1.040205 0.664101 0.175804 0.491686 0.532026 0.388867
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 9, 10, 15, 16, 18, 27, 28, 29, 30, 32, 34, 35, 36, 37, 38, 40, 42, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 73, 78, 80, 81, 84, 86, 87, 92, 93, 94, 96, 97, 98, 99, 100, 101, 102, 103, 104, 108, 109, 110, 111, 113, 116, 117, 119, 121, 122, 123, 126, 128, 129, 130, 131, 132, 133, 135, 136, 138, 142, 143, 145, 146, 148, 155, 156, 158, 159, 161, 164, 165, 166, 170, 179, 180, 181, 182, 183, 185, 187, 189, 191, 200, 201, 202, 203, 205, 208, 209, 210, 219, 220, 221, 222, 224, 225, 226, 227, 228, 229, 240, 241, 242, 243, 244, 246, 262, 320]

unflagged_ants: [5, 8, 17, 19, 20, 21, 22, 31, 41, 43, 44, 45, 46, 48, 49, 61, 62, 64, 65, 66, 67, 69, 70, 74, 77, 79, 82, 83, 85, 88, 89, 90, 91, 95, 105, 106, 107, 112, 114, 115, 118, 120, 124, 125, 127, 137, 139, 140, 141, 144, 147, 149, 150, 157, 160, 162, 163, 167, 168, 169, 184, 186, 190, 206, 207, 211, 223, 237, 238, 239, 245, 261, 324, 325, 329, 333]

golden_ants: [5, 17, 19, 20, 21, 31, 41, 44, 45, 65, 66, 67, 69, 70, 83, 85, 88, 91, 105, 106, 107, 112, 118, 124, 127, 140, 141, 144, 147, 149, 150, 157, 160, 162, 163, 167, 168, 169, 184, 186, 190]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2459939.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

# Figure out where to draw the nodes
node_centers = {}
for node in sorted(set(list(nodes.values()))):
    if np.isfinite(node):
        this_node_ants = [ant for ant in ants + unused_ants if nodes[ant] == node]
        if len(this_node_ants) == 1:
            # put the node label just to the west of the lone antenna 
            node_centers[node] = hd.antpos[ant][node] + np.array([-14.6 / 2, 0, 0])
        else:
            # put the node label between the two antennas closest to the node center
            node_centers[node] = np.mean([hd.antpos[ant] for ant in this_node_ants], axis=0)
            closest_two_pos = sorted([hd.antpos[ant] for ant in this_node_ants], 
                                     key=lambda pos: np.linalg.norm(pos - node_centers[node]))[0:2]
            node_centers[node] = np.mean(closest_two_pos, axis=0)
In [25]:
def Plot_Array(ants, unused_ants, outriggers):
    plt.figure(figsize=(16,16))
    
    plt.scatter(np.array([hd.antpos[ant][0] for ant in hd.data_ants if ant in ants]), 
                np.array([hd.antpos[ant][1] for ant in hd.data_ants if ant in ants]), c='w', s=0)

    # connect every antenna to their node
    for ant in ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', zorder=0)

    rc_color = '#0000ff'
    antm_color = '#ffa500'
    autom_color = '#ff1493'

    # Plot 
    unflagged_ants = []
    for i, ant in enumerate(ants):
        ant_has_flag = False
        # plot large blue annuli for redcal flags
        if use_redcal:
            if redcal_flagged_frac[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=7 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=rc_color, alpha=redcal_flagged_frac[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot medium green annuli for ant_metrics flags
        if use_ant_metrics: 
            if ant_metrics_xants_frac_by_ant[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=antm_color, alpha=ant_metrics_xants_frac_by_ant[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot small red annuli for auto_metrics
        if use_auto_metrics:
            if ant in auto_ex_ants:
                ant_has_flag = True                
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, lw=0, color=autom_color)) 
        
        # plot black/white circles with black outlines for antennas
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4 * (2 - 1 * float(not outriggers)), fill=True, color=['w', 'k'][ant_has_flag], ec='k'))
        if not ant_has_flag:
            unflagged_ants.append(ant)

        # label antennas, using apriori statuses if available
        try:
            bgc = matplotlib.colors.to_rgb(status_colors[a_priori_statuses[ant]])
            c = 'black' if (bgc[0]*0.299 + bgc[1]*0.587 + bgc[2]*0.114) > 186 / 256 else 'white'
        except:
            c = 'k'
            bgc='white'
        plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color=c, backgroundcolor=bgc)

    # label nodes
    for node in sorted(set(list(nodes.values()))):
        if not np.isnan(node) and not np.all(np.isnan(node_centers[node])):
            plt.text(node_centers[node][0], node_centers[node][1], str(node), va='center', ha='center', bbox={'color': 'w', 'ec': 'k'})
    
    # build legend 
    legend_objs = []
    legend_labels = []
    
    # use circles for annuli 
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgecolor='k', markerfacecolor='w', markersize=13))
    legend_labels.append(f'{len(unflagged_ants)} / {len(ants)} Total {["Core", "Outrigger"][outriggers]} Antennas Never Flagged')
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='k', markersize=15))
    legend_labels.append(f'{len(ants) - len(unflagged_ants)} Antennas {["Core", "Outrigger"][outriggers]} Flagged for Any Reason')

    if use_auto_metrics:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=autom_color, markersize=15))
        legend_labels.append(f'{len([ant for ant in auto_ex_ants if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas Flagged by Auto Metrics')
    if use_ant_metrics: 
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=antm_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum([frac for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants]), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Ant Metrics\n(alpha indicates fraction of time)')        
    if use_redcal:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=rc_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum(list(redcal_flagged_frac.values())), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in redcal_flagged_frac.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Redcal\n(alpha indicates fraction of time)')

    # use rectangular patches for a priori statuses that appear in the array
    for aps in sorted(list(set(list(a_priori_statuses.values())))):
        if aps != 'Not Found':
            legend_objs.append(plt.Circle((0, 0), radius=7, fill=True, color=status_colors[aps]))
            legend_labels.append(f'A Priori Status:\n{aps} ({[status for ant, status in a_priori_statuses.items() if ant in ants].count(aps)} {["Core", "Outrigger"][outriggers]} Antennas)')

    # label nodes as a white box with black outline
    if len(node_centers) > 0:
        legend_objs.append(matplotlib.patches.Patch(facecolor='w', edgecolor='k'))
        legend_labels.append('Node Number')

    if len(unused_ants) > 0:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='grey', markersize=15, alpha=.2))
        legend_labels.append(f'Anntenna Not In Data')
        
    
    plt.legend(legend_objs, legend_labels, ncol=2, fontsize='large', framealpha=1)
    
    if outriggers:
        pass
    else:
        plt.xlim([-200, 150])
        plt.ylim([-150, 150])        
       
    # set axis equal and label everything
    plt.axis('equal')
    plt.tight_layout()
    plt.title(f'Summary of {["Core", "Outrigger"][outriggers]} Antenna Statuses and Metrics on {JD}', size=20)    
    plt.xlabel("Antenna East-West Position (meters)", size=12)
    plt.ylabel("Antenna North-South Position (meters)", size=12)
    plt.xticks(fontsize=12)
    plt.yticks(fontsize=12)
    xlim = plt.gca().get_xlim()
    ylim = plt.gca().get_ylim()    
        
    # plot unused antennas
    plt.autoscale(False)    
    for ant in unused_ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', alpha=.2, zorder=0)
        
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='w', ec=None, alpha=1, zorder=0))
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='grey', ec=None, alpha=.2, zorder=0))
        if hd.antpos[ant][0] < xlim[1] and hd.antpos[ant][0] > xlim[0]:
            if hd.antpos[ant][1] < ylim[1] and hd.antpos[ant][1] > ylim[0]:
                plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color='k', alpha=.2) 

Figure 1: Array Plot of Flags and A Priori Statuses¶

This plot shows all antennas, which nodes they are connected to, and their a priori statuses (as the highlight text of their antenna numbers). It may also show (depending on what is finished running):

  • Whether they were flagged by auto_metrics (red circle) for bandpass shape, overall power, temporal variability, or temporal discontinuities. This is done in a binary fashion for the whole night.
  • Whether they were flagged by ant_metrics (green circle) as either dead (on either polarization) or crossed, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.
  • Whether they were flagged by redcal (blue circle) for high chi^2, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.

Note that the last fraction does not include antennas that were flagged before going into redcal due to their a priori status, for example.

In [26]:
core_ants = [ant for ant in ants if ant < 320]
outrigger_ants = [ant for ant in ants if ant >= 320]
Plot_Array(ants=core_ants, unused_ants=unused_ants, outriggers=False)
if len(outrigger_ants) > 0:
    Plot_Array(ants=outrigger_ants, unused_ants=sorted(set(unused_ants + core_ants)), outriggers=True)

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.5.dev11+g87299d5
3.1.5.dev197+g9b7c3f4
In [ ]: