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 = "2459974"
data_path = "/mnt/sn1/2459974"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 1-29-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/2459974/zen.2459974.21311.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

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

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1850 ant_metrics files matching glob /mnt/sn1/2459974/zen.2459974.?????.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/2459974/zen.2459974.?????.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 2459974
Date 1-29-2023
LST Range 3.121 -- 13.078 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 196
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 196 (0.0%)
Antennas in Commanded State (observed) 0 / 196 (0.0%)
Cross-Polarized Antennas 96
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 53 / 196 (27.0%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 131 / 196 (66.8%)
Redcal Done? ❌
Never Flagged Antennas 65 / 196 (33.2%)
A Priori Good Antennas Flagged 58 / 93 total a priori good antennas:
3, 5, 7, 9, 10, 15, 16, 20, 29, 37, 38, 40,
42, 53, 54, 55, 56, 67, 71, 72, 81, 86, 88,
93, 94, 101, 103, 107, 109, 111, 121, 122,
123, 127, 128, 136, 140, 143, 144, 146, 151,
158, 161, 162, 164, 165, 167, 169, 170, 173,
181, 182, 185, 189, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 30 / 103 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 61, 62, 73, 74, 82,
89, 90, 95, 114, 115, 125, 132, 133, 137, 139,
229, 237, 238, 239, 245, 261, 324, 325, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459974.csv

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.037843 12.860273 10.868564 -1.034273 10.537106 5.478121 0.743397 10.089283 0.031664 0.341033 0.273682
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.999897 0.386340 2.071074 0.489232 2.747832 1.984557 28.953475 13.464854 0.601572 0.629039 0.401280
5 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.468268 -0.172212 0.437904 -0.008847 0.366304 2.798809 4.648082 0.004410 0.614621 0.631572 0.394806
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.969054 0.348836 -1.272938 -0.208808 0.068063 0.684771 20.607323 19.999548 0.621489 0.636967 0.388306
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.132327 -1.184790 -0.591562 -0.064559 -0.212951 0.712045 3.506814 2.262236 0.620589 0.634320 0.384749
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.555950 -0.194640 9.051724 -0.494626 6.417695 -0.047998 0.768124 -0.656791 0.448247 0.630683 0.457834
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 2.886443 -0.895931 7.191897 -1.665492 1.887450 1.258822 3.078086 0.794451 0.525059 0.631219 0.429220
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.436883 16.965698 10.801551 0.481091 10.593623 3.897152 0.261548 3.092853 0.030540 0.344249 0.267139
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.281507 -0.799030 10.832754 0.637014 10.545117 2.643781 0.887466 4.493819 0.030484 0.637041 0.521128
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.747795 1.568982 0.439513 0.354248 0.685822 0.751653 2.119681 3.059482 0.624556 0.641562 0.393082
18 N01 RF_maintenance 100.00% 100.00% 49.78% 0.00% 10.914940 17.369876 10.813081 -0.550868 10.749358 8.223374 0.666950 20.184199 0.028903 0.225100 0.174118
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.663415 -0.468401 -1.233980 -1.061888 -0.461583 2.070145 -0.577934 1.733042 0.628755 0.648030 0.385510
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.167126 -1.000323 2.574443 -1.255371 1.767524 0.399511 3.833019 -0.632371 0.610294 0.646246 0.391383
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.163005 0.312038 -0.764789 -0.170222 0.830091 2.045532 0.127129 0.007663 0.617074 0.624132 0.379884
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.713280 -0.593752 0.221223 -0.078610 1.899968 2.434175 -0.245105 -1.460318 0.586213 0.602746 0.384861
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.587858 11.709999 10.876123 11.300851 10.723688 12.245181 2.718008 1.589052 0.032722 0.035464 0.004094
28 N01 RF_maintenance 100.00% 0.00% 88.11% 0.00% 10.783728 25.022883 -0.203766 3.038410 5.991450 10.234387 5.352618 19.519807 0.362227 0.155997 0.271351
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.281508 12.182853 10.437780 10.867568 10.701828 12.210466 0.653808 -0.341137 0.029772 0.033785 0.004550
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.263864 0.090441 -0.734536 0.502911 1.855833 0.732596 0.596709 -0.065198 0.634096 0.650784 0.383981
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.016293 -1.019362 1.156580 1.224120 1.831662 0.500932 0.561868 3.527078 0.638642 0.646428 0.380279
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.007986 24.120179 -0.122268 2.908814 1.910496 1.512998 12.397426 22.886632 0.622908 0.540660 0.358763
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.781329 13.305437 4.893025 5.192703 10.648748 12.163688 1.443881 0.485337 0.032252 0.042909 0.007684
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.039075 -0.455170 0.866716 -1.624278 -0.010321 -0.964634 -1.085689 -0.419007 0.599388 0.595267 0.379154
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 25.547749 25.360590 14.366602 14.266376 10.875664 12.161641 5.232984 4.654584 0.029739 0.027846 0.001594
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.074164 0.425232 -1.354401 1.473306 1.125909 1.279026 0.154160 7.500514 0.618326 0.629057 0.400803
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.172388 -0.087646 0.287580 0.642332 -0.050861 0.464733 5.537526 1.380120 0.625955 0.638531 0.400292
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 9.649373 2.534984 10.466854 0.464939 10.660061 -0.559272 1.257276 0.712030 0.034954 0.624366 0.484386
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.288084 0.234331 -0.274782 -0.016496 2.872429 0.078923 1.648898 3.645388 0.631390 0.650518 0.379226
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.846410 -0.234125 5.081713 6.388360 -0.244225 -0.214178 -0.116475 -0.910811 0.610842 0.617323 0.368643
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.418288 0.742429 -0.259795 0.577195 -0.558174 0.726691 -0.540346 1.924908 0.638875 0.643626 0.377686
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.853567 0.273591 -0.801494 -0.632271 -0.212623 0.351779 -0.791829 -0.747792 0.631699 0.649941 0.378725
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.890037 2.685894 0.287721 0.419613 -0.678030 2.178631 0.008214 2.599425 0.622515 0.632314 0.371579
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.205194 0.018189 -0.833171 -1.149137 -0.348267 -0.260396 0.121337 -0.724123 0.629414 0.650246 0.393860
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.966203 13.028429 4.701019 4.789944 10.575679 12.063467 1.814110 0.210512 0.029793 0.045039 0.010891
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.015446 0.772301 0.432090 1.841690 -0.418342 2.803058 -0.687532 -3.076068 0.599806 0.617138 0.387228
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.038086 -0.629875 -0.325253 -0.492679 0.526853 -0.977322 0.877486 10.092612 0.552927 0.598190 0.391055
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.304327 5.172839 0.465240 1.110232 1.140956 3.981921 33.684557 67.362507 0.598599 0.586555 0.375655
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 22.580180 3.928593 13.791031 -0.728349 10.920557 4.863089 10.058988 2.199468 0.036932 0.520330 0.400468
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.025168 5.945794 -0.452441 0.485052 1.411481 0.851818 3.254970 1.186678 0.629519 0.641361 0.393254
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.627797 2.896093 0.034245 0.201112 1.873933 2.804143 3.843665 5.603005 0.639867 0.652578 0.396369
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 26.489700 -0.779711 5.530381 3.356320 1.926715 -0.823402 5.165162 1.316463 0.450491 0.637909 0.376442
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.565322 13.018068 10.899842 11.434099 10.663306 12.150470 0.866617 2.311181 0.027660 0.029563 0.002062
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.003192 1.813767 6.157610 8.293133 1.301073 2.742253 -0.285005 0.229159 0.596813 0.571280 0.355767
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 22.713858 0.800098 7.965822 0.524022 6.117748 2.405082 7.578134 3.683672 0.392999 0.653389 0.399421
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.649333 12.110880 10.765666 11.429289 10.547758 12.095908 2.274441 1.317605 0.032867 0.032627 0.001550
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.527637 0.615912 10.274252 0.800574 10.292179 2.494834 0.438600 7.626812 0.043680 0.639318 0.512383
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.277639 12.019557 -0.470408 11.461420 -0.241340 12.133968 1.368311 2.691778 0.626284 0.064636 0.510217
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.400582 -0.079145 -0.572288 -1.639902 2.264602 -1.547531 -0.554106 0.106546 0.576541 0.608643 0.379604
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.550603 0.731494 -0.770043 1.212750 -0.622172 -0.109925 2.499112 -0.989698 0.567522 0.615241 0.390896
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.095885 12.508795 -0.478011 5.224278 0.470591 12.284523 0.324724 2.448920 0.597438 0.041511 0.484184
64 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.090879 -0.027971 -0.995321 -1.110222 0.685322 -0.945424 5.030271 0.447959 0.581841 0.577967 0.370737
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.541893 1.310149 0.587968 1.111134 -0.210401 0.691725 0.536639 -0.343327 0.607890 0.625434 0.405987
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.575615 1.437327 -1.663279 -1.360417 3.491214 -0.367021 -0.369056 -0.092437 0.622995 0.642117 0.403495
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.615569 2.034230 -0.159098 1.346144 -0.498793 0.152272 0.916622 4.770037 0.633641 0.633930 0.387625
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 19.719775 26.044529 1.236687 15.008274 5.160026 12.159517 -0.157576 10.838677 0.365212 0.027559 0.273116
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.775631 -0.282537 0.444616 0.707748 -0.149031 1.667042 -0.234704 -0.438629 0.632753 0.654211 0.378259
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.590784 -0.345016 -0.280463 -0.097224 1.788957 1.920791 1.857856 0.465678 0.644613 0.660465 0.376595
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.293600 -0.232049 0.669756 1.083210 0.867724 -0.378022 0.949414 0.818279 0.653542 0.664959 0.368335
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.094840 13.213092 11.270071 11.856899 10.363341 11.870273 0.821026 0.614492 0.029759 0.031967 0.002700
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.685566 0.811822 -1.542595 -1.140350 1.396171 -0.402626 -0.163616 -0.889457 0.645832 0.658978 0.375198
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.373685 0.103473 -0.166983 -0.703306 -0.311179 1.809314 -0.854129 3.211886 0.645847 0.655879 0.375732
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 55.626139 0.822199 0.524444 -0.452456 9.187769 -0.926852 25.060724 -0.652596 0.311766 0.611595 0.438294
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 31.469748 -0.094148 -0.504657 1.095608 2.268870 0.105864 2.372415 1.211575 0.434722 0.623439 0.377313
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.606816 12.780623 -1.614744 5.239227 -0.863844 12.012465 1.047526 -0.733094 0.595009 0.038146 0.473058
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.437202 13.605716 0.283218 5.134086 -0.348561 12.078051 -0.670349 0.877889 0.602075 0.044619 0.477985
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.212903 12.885285 0.040090 9.952714 0.380835 11.680646 1.019628 2.226367 0.585881 0.035644 0.461175
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.702645 -0.130542 0.447637 2.183023 -0.219667 -0.119561 -0.138875 0.027649 0.605860 0.613613 0.385671
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.472585 0.360236 0.195026 0.412632 0.538050 0.010321 -0.498428 1.255037 0.618691 0.635431 0.389526
84 N08 RF_maintenance 100.00% 69.03% 100.00% 0.00% 19.007674 23.133391 13.913352 14.532914 8.858977 12.131049 4.600192 4.733850 0.201149 0.032797 0.132565
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.292892 0.800097 0.952152 0.753689 -1.026932 0.336477 -0.493497 -0.384550 0.631858 0.648151 0.379708
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.764579 -0.246958 1.250997 1.005512 5.438826 -0.390656 1.782705 20.423271 0.621516 0.646867 0.365576
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.455631 4.038802 -0.345794 -0.606427 15.024841 3.459962 136.958674 107.636869 0.599799 0.661566 0.352354
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.376786 0.249641 0.368985 0.915369 -0.316946 0.003070 5.279744 2.120340 0.642192 0.658226 0.363465
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.270218 0.387508 0.189311 0.910417 -0.452876 -0.476605 -0.681861 -0.755981 0.650387 0.661177 0.369198
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.248698 -0.711035 0.942524 3.545285 -0.664338 0.363076 0.504827 3.333070 0.641859 0.634621 0.368131
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.272449 -0.013079 0.509288 0.308057 -0.621529 -0.634729 0.362322 -0.427568 0.642125 0.660002 0.385144
92 N10 RF_maintenance 100.00% 0.00% 15.57% 0.00% 33.421098 35.771098 0.469268 1.465191 5.589877 4.591922 2.667025 10.936036 0.287663 0.250284 0.066526
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.228621 0.209280 2.627736 -1.335809 1.068385 1.040676 4.457415 0.387453 0.628174 0.648939 0.390468
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.058694 12.503297 11.012447 11.318047 10.611676 12.114045 0.981567 0.176808 0.029671 0.025782 0.002040
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.475685 -0.378796 -0.991382 0.820901 -0.276982 0.515711 0.794859 1.362510 0.606332 0.632099 0.394458
96 N11 not_connected 100.00% 0.00% 0.00% 100.00% 10.918514 6.238165 3.507389 4.988420 4.319471 9.663035 -2.647201 -4.963731 0.266948 0.218138 -0.253598
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.838020 5.419029 -1.278547 1.552230 -0.805508 2.952130 0.408574 8.866432 0.589957 0.540831 0.379871
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.798293 8.131197 -0.374739 1.154878 -0.009139 1.832756 0.831257 1.072803 0.636806 0.648674 0.382247
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.058872 1.221949 -0.940236 -1.637802 1.186808 1.004926 1.582780 12.044432 0.643394 0.655807 0.376837
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.051161 5.122838 2.381290 -1.517108 3.592243 1.424636 17.363749 6.576514 0.636559 0.664042 0.374919
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.693381 57.186271 -0.601225 7.726424 3.262995 0.783032 1.397593 2.139823 0.652195 0.633311 0.369407
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.354449 0.119298 0.208744 0.956808 0.943960 -0.694958 -0.348773 -0.667121 0.650373 0.661528 0.365871
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.265804 1.339734 -1.247325 -0.492295 1.429939 -0.412228 0.120077 0.614341 0.651816 0.664849 0.366134
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.260551 0.281431 -0.169888 -0.523358 1.091729 -0.044173 7.192547 6.887087 0.650710 0.666986 0.372302
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.163451 40.274853 10.811769 0.824104 10.639298 4.703420 1.801841 8.055689 0.032728 0.291266 0.169953
109 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 3.602686 12.085713 8.342404 11.171529 3.766137 12.232896 -0.357281 1.534844 0.513890 0.028966 0.356404
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 24.722480 24.666885 14.415180 14.736454 10.580407 11.955350 4.835024 4.576738 0.023661 0.025298 0.001071
111 N10 digital_ok 100.00% 0.00% 74.05% 0.00% -0.141508 11.005304 -0.404158 11.071327 0.091443 11.351606 3.139174 1.809851 0.639526 0.186606 0.465000
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.068624 -0.451943 0.226181 0.041408 1.306385 3.491727 0.812976 -1.097577 0.628844 0.642385 0.394916
113 N11 not_connected 100.00% 0.00% 100.00% 0.00% 4.048843 13.343528 3.819395 5.218883 4.380254 11.926069 -3.710143 0.097828 0.615711 0.070236 0.480204
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.172813 0.865409 0.317269 -0.139871 3.897958 -0.776327 -0.584179 -0.919402 0.596816 0.614789 0.383823
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.932314 -0.822821 -1.273718 -0.598750 -0.484768 -1.243240 -0.386821 1.326005 0.576822 0.601962 0.392697
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.968684 13.493943 10.946627 11.819035 10.435292 12.089275 1.724838 3.980379 0.027678 0.030111 0.001954
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.040274 1.456319 -0.081137 0.546367 -0.480411 0.171321 -0.178588 0.220802 0.614679 0.635178 0.395016
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.248405 2.048064 2.945525 -1.130680 -0.069173 1.461397 2.584310 -0.684435 0.626133 0.660164 0.386893
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.971995 2.851931 -1.462752 6.409157 0.882773 -0.730183 8.556361 21.860955 0.644976 0.634857 0.364802
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.633896 6.196927 0.304388 0.841123 0.429514 1.727965 0.363827 -0.907491 0.640862 0.665124 0.374619
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.331585 8.005873 0.806816 1.082986 0.560998 -0.049925 0.015222 0.669844 0.656830 0.668212 0.374585
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.287946 0.013079 0.091287 0.633082 -0.633194 0.302764 1.606862 0.222362 0.657177 0.670729 0.377187
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.097161 0.790546 -0.052212 0.925878 0.764730 0.261330 0.501928 -0.062786 0.654278 0.659761 0.372140
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 21.309615 -1.085748 -0.332593 0.945338 11.098514 0.042292 53.515877 -0.947847 0.557627 0.656365 0.370122
127 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 0.193375 0.175993 0.465205 0.314858 2.935293 1.611949 0.611661 4.013011 0.649941 0.661599 0.382833
128 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 1.548090 11.208175 7.271552 10.840970 3.154350 11.974432 -0.359267 0.079888 0.553110 0.031533 0.396740
131 N11 not_connected 100.00% 0.00% 0.11% 0.00% -0.623568 11.950355 -0.084247 5.074424 -0.752262 10.835129 -1.159671 -0.452464 0.618625 0.288853 0.434380
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.446122 2.424936 -0.480606 -1.588610 2.415279 -0.530569 0.206720 0.441184 0.598685 0.598029 0.374201
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.893728 0.431562 -1.008888 1.865335 -0.940971 1.803301 -0.597401 -0.764910 0.588747 0.619569 0.403245
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.093046 -1.109103 -0.930015 -1.619580 2.739043 1.136970 19.666448 -0.617624 0.584142 0.619682 0.411280
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 9.251326 4.472448 10.407551 -0.750631 10.767711 1.439340 1.670848 3.545326 0.036972 0.607798 0.454973
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.159177 -0.612446 0.038389 -1.571787 2.299640 -0.101425 1.110920 1.488310 0.597990 0.630639 0.399647
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.985410 -0.133717 1.490633 -1.050543 1.044974 -1.051525 -1.046736 -0.275039 0.624113 0.632237 0.378721
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.572088 -0.867575 -0.996465 -0.370875 -0.582330 -0.245765 6.923684 4.362851 0.639820 0.659488 0.379127
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.196459 -0.745192 -0.381167 0.631543 2.062558 -0.639922 0.717769 -1.932148 0.643206 0.665102 0.375897
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.547721 12.051020 -0.856377 11.471164 3.056737 12.195093 26.724177 1.383937 0.640276 0.042854 0.527530
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -1.272862 -0.267731 -0.997828 0.955531 0.085725 6.484031 -0.402054 -1.815002 0.660078 0.668147 0.376282
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.307941 -0.713304 -1.293604 5.048053 0.312384 8.588926 -0.388386 -0.665123 0.657848 0.633719 0.379098
145 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.457636 12.174845 10.820813 11.507281 10.397351 12.314384 0.395388 3.090273 0.070089 0.029882 0.030973
146 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.079384 -0.880000 1.409462 -0.174135 1.202650 10.722724 -1.741315 -1.292280 0.647085 0.653121 0.377587
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.373754 -1.580601 1.386335 2.520016 -0.655091 -0.629541 2.976288 -0.007663 0.632679 0.638760 0.374882
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.096158 0.128760 -0.711842 -0.746832 2.066253 2.091768 -0.581771 -1.174949 0.636377 0.650339 0.388003
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.280427 -1.213488 -1.167806 -1.433414 -0.390493 1.449353 1.947156 0.253229 0.627453 0.643188 0.391560
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.654950 -0.558380 -1.428403 -1.390505 -0.466686 0.320040 1.436427 2.004286 0.622604 0.634878 0.390899
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 24.679218 0.846382 -0.449954 0.364410 3.368053 -1.150211 4.026889 0.250348 0.472962 0.584813 0.348673
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.649626 -0.849024 10.576836 -1.439534 10.824253 0.329845 2.599836 1.206263 0.039062 0.617835 0.479505
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.566000 11.814349 8.741235 11.185888 4.775748 12.287878 1.497877 1.676684 0.437448 0.036493 0.345779
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.081999 -0.263543 0.016496 0.678250 -0.547472 0.894037 -0.164678 -0.561160 0.603934 0.627519 0.398003
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.111713 -0.165466 -0.322752 -0.721945 3.106334 2.812445 5.580829 17.578300 0.620525 0.643853 0.398450
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.343244 28.685216 -1.689490 -0.710428 -0.089405 4.215351 -0.211526 14.237820 0.593336 0.485336 0.349299
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.842311 -0.866215 -0.273335 -0.898158 -0.472594 2.103091 0.693674 0.579083 0.631410 0.649643 0.382902
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.832484 27.781156 -0.016363 -0.616173 0.462493 1.393888 0.007835 0.951113 0.638733 0.528222 0.343366
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 2.438551 -0.818631 -0.831489 -1.251034 2.016981 1.450706 5.994748 -0.335024 0.640558 0.665383 0.381845
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.248893 1.041506 -0.214080 0.388382 -0.047677 1.416441 -0.291853 1.163708 0.652227 0.663269 0.382536
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.750721 0.491818 0.973192 1.410390 4.698081 2.894102 1.466780 0.935021 0.646071 0.658467 0.371852
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 30.300085 -0.127346 -0.461377 -1.098139 5.412094 0.117222 8.379506 0.831461 0.508620 0.663529 0.371364
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.515821 2.751090 -0.409845 3.261587 0.261328 5.073276 3.935099 -0.682558 0.645077 0.651153 0.377015
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.745515 -0.863573 -1.606438 -0.056171 2.154089 0.074497 1.288426 5.229239 0.639944 0.646198 0.379296
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.904730 -0.945422 0.211841 -0.450839 1.824785 0.907079 -0.379187 1.777010 0.639591 0.651574 0.389288
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.781051 1.122438 -0.992553 -1.603574 0.962819 4.425018 -0.816752 4.692333 0.637829 0.637058 0.388280
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.906290 -0.309200 11.163117 -0.870658 10.430017 0.200116 2.905611 10.522189 0.037447 0.645989 0.513049
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.687996 2.402713 -1.608962 0.142856 -0.867073 1.963103 -0.164672 0.866879 0.584888 0.564706 0.368335
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 12.175964 12.572243 4.203025 4.811675 10.836816 12.262252 4.150286 6.657588 0.037795 0.041947 0.003861
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.925099 -0.683669 -0.166132 -1.450779 -0.648996 4.671091 -0.354174 1.203490 0.586473 0.639505 0.398389
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.234896 12.745864 -1.689173 11.618264 1.485405 12.046556 22.047818 1.956610 0.632016 0.048825 0.530394
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.469051 0.025713 0.738861 0.573374 0.103137 -0.169026 -0.335779 5.022648 0.635852 0.649736 0.387694
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.393449 11.772601 -1.175566 11.156354 0.063599 12.283481 10.458961 1.512676 0.646103 0.043272 0.502680
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.108747 0.864028 -0.176435 0.790359 1.378805 -0.063190 1.316879 0.252157 0.636737 0.649404 0.371514
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.887021 -0.545511 -1.714877 -0.465030 -0.320157 0.496935 0.022822 -0.131148 0.649960 0.662943 0.369387
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 35.017449 -0.324919 -0.201137 -1.605630 10.332338 0.621698 5.484777 0.628056 0.512925 0.660103 0.376767
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.978241 -0.783375 0.376872 -0.381935 -0.153855 -0.747380 -0.111543 0.814273 0.651757 0.664642 0.383005
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.885975 0.502039 0.017429 1.633346 1.141834 0.907017 1.155056 -1.776071 0.641531 0.654506 0.377348
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.115240 11.664847 10.386638 11.295801 10.835228 12.329869 5.656777 2.717651 0.027550 0.029690 0.001042
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.142872 -1.324887 -0.670731 0.280802 -0.279191 0.254576 -0.189377 -1.878896 0.629896 0.648274 0.398889
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.434976 0.397507 1.436532 -0.528034 0.132221 0.855953 15.864232 0.315547 0.615564 0.632337 0.395574
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 5.913903 6.453075 4.994860 5.056787 7.857663 9.695177 -4.422850 -5.026441 0.578263 0.591676 0.385041
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.714166 0.473950 5.207076 1.615080 8.432918 2.855816 -4.427885 -0.177162 0.563308 0.604224 0.413525
200 N18 RF_maintenance 100.00% 100.00% 73.57% 0.00% 11.769995 34.168225 4.652694 0.957696 10.810174 5.794622 2.046239 24.957249 0.039108 0.182359 0.118197
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.832367 4.625838 3.229247 4.355289 3.067088 7.949871 -0.517819 -3.816095 0.621014 0.619500 0.382385
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.604542 2.799894 1.618782 -1.455276 1.179337 0.184014 -1.566192 29.764137 0.630413 0.616635 0.378488
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.101760 2.531766 -0.023616 -0.424099 -0.791411 -0.231544 -0.372698 15.365891 0.623102 0.611938 0.369851
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.972193 2.650448 1.771768 -0.972858 13.573020 0.086375 0.758962 4.310209 0.626722 0.610922 0.376360
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.763646 2.505072 1.354716 -1.454224 1.026354 6.485294 -0.689265 0.208558 0.608681 0.605353 0.357864
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 138.302061 138.867390 inf inf 3338.528762 3355.546305 8078.275406 8099.636816 nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 158.590089 158.822399 inf inf 3513.824336 3486.362400 9026.655345 8934.701402 nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 171.299379 171.367090 inf inf 3408.598227 3408.516416 8833.024056 8717.400745 nan nan nan
211 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 0.865662 2.105039 -1.336728 0.001374 -0.617342 -0.165212 5.699770 -0.542754 0.579553 0.593237 0.377826
220 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.262949 -1.082232 0.382979 -0.474407 -0.618956 -1.026909 4.388383 -1.784731 0.616333 0.623943 0.381477
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.743416 -0.192829 -1.344328 -0.810678 0.834130 -1.073456 9.766596 -1.347019 0.602172 0.629033 0.385725
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.441348 -0.224409 -0.293258 0.122194 -0.344838 -0.734680 4.667220 -2.103038 0.612609 0.637729 0.388831
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.895235 1.428818 -1.657616 0.236120 0.066522 3.663912 1.298212 5.235849 0.600235 0.633901 0.388334
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.822410 6.068775 5.321758 5.041177 8.334987 9.506554 -4.590386 -4.920404 0.593620 0.610967 0.377709
225 N19 RF_ok 100.00% 0.00% 90.92% 0.00% 1.381637 12.187499 0.904297 4.993368 -0.751009 11.892831 -1.435242 1.161913 0.622320 0.140648 0.517243
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.294741 5.346497 0.028090 1.298569 -0.923121 5.216732 -0.841597 -0.447359 0.616318 0.602347 0.378572
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.790178 0.607253 -1.606582 0.002511 0.279878 -0.414265 17.584748 4.381381 0.579944 0.614087 0.376277
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.471195 17.787635 -0.509813 -0.405288 4.835667 5.204072 106.474622 94.182193 0.483523 0.502155 0.280074
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.007670 0.038149 1.601999 1.376532 0.375621 1.268344 0.027940 -2.188837 0.597332 0.612755 0.394744
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.582539 -0.130876 -0.137559 -1.612239 -0.670952 -0.720844 -0.418549 -1.386872 0.556512 0.605836 0.401168
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.192555 -0.396606 0.925628 0.461533 -0.508906 -0.364853 -1.698698 -2.451495 0.611606 0.624557 0.393684
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.898788 -1.350009 -0.208638 0.119960 -0.381733 -0.597369 0.538313 2.192420 0.610057 0.627788 0.392423
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 26.751349 45.932787 0.369669 0.642785 3.654249 4.630578 38.772278 28.293786 0.471011 0.406922 0.245941
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.835364 3.242255 -0.898414 0.593607 -0.740884 0.495427 5.819474 22.706715 0.601743 0.578701 0.386472
242 N19 RF_ok 100.00% 1.46% 0.00% 0.00% 54.606324 1.832848 0.486279 1.793097 7.203217 2.004597 28.189440 -1.180639 0.274723 0.625097 0.493040
243 N19 RF_ok 100.00% 19.24% 0.00% 0.00% 57.495798 2.192340 0.855617 -1.542931 7.283924 -0.714751 -1.479892 -0.611412 0.253865 0.603748 0.483133
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.559679 1.824128 1.556483 -0.757392 2.410232 1.397844 3.225680 9.215952 0.488066 0.576260 0.381415
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.461472 1.724433 0.114466 -1.089116 -0.550028 -0.539820 -1.611089 0.048600 0.590002 0.594310 0.386537
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.893184 6.948571 -1.255319 -0.452538 4.994467 4.675513 4.756278 -0.909921 0.320390 0.319543 0.158684
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.477269 1.475485 0.709135 -0.476096 -0.301020 -1.241251 -0.499857 0.047202 0.588947 0.592224 0.390046
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.124778 7.156836 9.878685 10.535366 10.264803 10.830762 16.164475 22.196989 0.030243 0.027069 0.002830
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 5.862472 12.732527 2.695774 7.518098 1.412687 12.270141 45.159332 3.218453 0.444964 0.042699 0.360385
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.350625 2.424602 1.093384 1.562319 0.891675 1.780056 1.943875 -0.795387 0.499057 0.517440 0.380835
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.286393 -1.013039 1.219395 -1.475022 1.148633 -0.908744 -1.647018 -0.290654 0.530006 0.536358 0.396401
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.663676 -0.657165 0.635145 -0.449389 2.363914 -1.108205 5.811440 0.214322 0.429907 0.528633 0.388415
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.314524 1.921617 -0.635896 -1.624455 -0.532886 -1.129420 1.327272 1.234548 0.467199 0.507113 0.374589
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 5, 7, 9, 10, 15, 16, 18, 20, 27, 28, 29, 32, 34, 36, 37, 38, 40, 42, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 64, 67, 68, 71, 72, 77, 78, 79, 80, 81, 84, 86, 87, 88, 92, 93, 94, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 113, 117, 120, 121, 122, 123, 126, 127, 128, 131, 135, 136, 140, 142, 143, 144, 145, 146, 151, 155, 156, 158, 159, 161, 162, 164, 165, 166, 167, 169, 170, 173, 179, 180, 181, 182, 185, 189, 191, 192, 193, 200, 201, 202, 205, 206, 207, 208, 209, 210, 211, 220, 221, 222, 223, 224, 225, 226, 227, 228, 240, 241, 242, 243, 244, 246, 262, 320, 329]

unflagged_ants: [8, 17, 19, 21, 22, 30, 31, 35, 41, 43, 44, 45, 46, 48, 61, 62, 65, 66, 69, 70, 73, 74, 82, 83, 85, 89, 90, 91, 95, 105, 106, 112, 114, 115, 118, 124, 125, 132, 133, 137, 139, 141, 147, 148, 149, 150, 157, 160, 163, 168, 171, 183, 184, 186, 187, 190, 229, 237, 238, 239, 245, 261, 324, 325, 333]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.5.dev13+gd6c757c
3.2.1
In [ ]: