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 = "2459949"
data_path = "/mnt/sn1/2459949"
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-4-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/2459949/zen.2459949.25193.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 1676 ant_metrics files matching glob /mnt/sn1/2459949/zen.2459949.?????.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/2459949/zen.2459949.?????.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 2459949
Date 1-4-2023
LST Range 2.413 -- 11.432 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1676
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
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 54 / 196 (27.6%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 119 / 196 (60.7%)
Redcal Done? ❌
Never Flagged Antennas 77 / 196 (39.3%)
A Priori Good Antennas Flagged 52 / 93 total a priori good antennas:
3, 7, 9, 10, 15, 16, 20, 29, 30, 37, 38, 40,
42, 53, 54, 55, 56, 71, 72, 81, 86, 94, 101,
103, 106, 107, 109, 111, 121, 122, 123, 128,
136, 143, 144, 146, 151, 158, 161, 164, 165,
170, 173, 182, 184, 185, 187, 189, 191, 192,
193, 202
A Priori Bad Antennas Not Flagged 36 / 103 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 74,
79, 89, 90, 95, 114, 115, 125, 132, 137, 139,
206, 207, 211, 220, 222, 226, 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_2459949.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% 11.099738 14.134055 11.067978 -1.240994 8.598979 4.304928 0.498279 2.423874 0.032405 0.344651 0.273805
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.210047 3.092159 7.296556 -0.075624 3.184713 4.170547 29.389703 10.024024 0.547839 0.635805 0.446786
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.397186 -0.206001 0.161037 0.033536 0.047462 1.486626 0.689553 0.032347 0.626397 0.640983 0.412867
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.117012 -0.051683 -1.308662 -0.201860 0.099416 0.208432 12.943985 13.918120 0.630877 0.645006 0.404674
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.564683 -1.461240 -0.583699 0.040511 -0.249244 0.405736 2.524132 2.111862 0.630619 0.641145 0.399241
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.487534 -0.823948 9.191187 -0.348131 3.954281 1.630371 0.168000 -0.272100 0.465252 0.642771 0.474376
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 1.238059 -0.724594 -1.519917 -1.491784 -0.409999 1.177885 0.553326 5.656559 0.622789 0.641232 0.407107
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.321380 17.568693 10.423730 -1.127916 8.604504 4.455207 -0.070268 1.150483 0.033600 0.349676 0.268005
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.392946 -0.799480 11.032902 0.653200 8.599504 1.892889 0.350268 2.124610 0.032393 0.646951 0.526797
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.835736 1.657006 0.538322 0.428934 0.799225 0.701231 1.591589 1.199709 0.633246 0.648533 0.409342
18 N01 RF_maintenance 100.00% 100.00% 53.40% 0.00% 12.108247 20.602100 11.028043 -0.304279 8.759550 7.000322 0.369460 19.546810 0.029058 0.220916 0.168500
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.340162 -0.488743 -1.151477 -0.925757 -0.005356 1.577441 -0.303782 0.449295 0.638593 0.654959 0.399883
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.847958 -1.549749 2.683921 -0.792852 3.272968 5.919414 2.201479 0.344140 0.627459 0.652675 0.404922
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.788124 -0.273697 -0.693807 -0.124653 0.301048 2.170958 -0.290420 -0.469483 0.625702 0.638577 0.401365
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.072072 -0.644303 -0.005811 -0.222339 1.948457 1.962213 -0.308578 -1.171133 0.594341 0.610516 0.398023
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.616974 12.019438 11.084740 11.483905 8.734640 9.824828 1.810222 1.114167 0.036204 0.040255 0.005995
28 N01 RF_maintenance 100.00% 0.00% 86.16% 0.00% 11.745511 28.586857 -1.004803 1.293081 5.147086 6.624649 3.217337 18.982702 0.359084 0.162181 0.266516
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 11.358519 12.484514 10.647060 11.048960 8.720609 9.803495 0.388662 -0.124457 0.029485 0.036292 0.006969
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.288090 0.256751 -0.406867 0.670510 8.131198 0.692802 2.239529 -0.380837 0.641719 0.656407 0.400632
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.421796 -0.151276 1.173111 1.540381 1.798913 -0.180292 0.198441 1.908206 0.649647 0.648870 0.395929
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 15.662573 20.387631 0.668300 2.669445 8.789014 5.702014 45.840429 52.789614 0.566981 0.563903 0.319469
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 13.021907 13.775439 5.056816 5.330601 8.712004 9.790625 2.581539 2.090848 0.033776 0.045176 0.007717
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.192241 -0.691518 0.913014 -1.573610 -0.009718 -0.787373 -1.100228 -0.254380 0.607743 0.604535 0.394772
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.925659 8.506477 0.410753 0.371988 0.994782 1.700478 1.495685 0.503553 0.618596 0.630172 0.417893
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.173681 0.483183 -1.317693 1.561910 1.208634 1.172546 -0.509809 4.462030 0.633482 0.639370 0.418540
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.340835 0.630975 0.408526 0.747748 0.332042 0.408522 5.135056 1.091504 0.637379 0.647892 0.418606
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 10.639328 1.156906 10.678102 0.589388 8.731173 1.170377 0.865150 0.863991 0.037848 0.639022 0.505751
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.255213 0.111344 -0.352939 0.023317 1.713658 0.428587 1.143949 0.934018 0.641582 0.653048 0.395967
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.030822 13.106459 11.344723 11.999852 8.463080 9.553991 0.180153 0.702975 0.026894 0.026157 0.001319
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.130081 0.225838 0.005811 0.683108 -0.207739 0.636686 0.163964 1.916485 0.645814 0.652721 0.397045
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.811032 0.004656 -0.883215 -0.535404 -0.770441 0.343410 -0.991681 -0.758606 0.649051 0.661211 0.395110
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.045497 3.671621 0.414888 0.463814 -0.427012 1.528571 0.376125 3.619070 0.640305 0.642918 0.386840
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.241375 0.425959 -0.729867 -1.192146 -0.454447 -0.187263 -0.103476 -0.505696 0.641000 0.662243 0.409878
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.132384 13.420411 4.858892 4.919669 8.641363 9.702237 1.195224 0.240068 0.029927 0.050020 0.013716
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.245272 0.997174 0.587339 1.782573 -0.809323 2.147608 -1.323968 -2.027257 0.613399 0.631758 0.401792
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.442854 -0.388332 -0.981840 -0.075700 0.204547 -0.517227 -0.102042 2.540278 0.564576 0.608231 0.402293
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.000979 18.687565 0.529091 1.426104 0.060870 4.531926 17.693918 64.709510 0.610452 0.567508 0.383448
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 25.858076 4.578885 14.047864 -0.772902 8.921384 4.326280 7.940603 1.217372 0.038939 0.526879 0.407081
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.372637 7.285438 -0.430670 0.622813 1.029319 1.021637 0.661776 0.312627 0.640975 0.649189 0.408187
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.892915 3.436989 0.014951 0.194332 1.720746 1.652907 2.875380 5.057945 0.648792 0.656932 0.413732
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.164980 12.746927 11.087854 11.721162 8.702171 9.781468 2.151420 1.175475 0.026766 0.025953 0.001270
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.696093 13.484028 11.115892 11.624751 8.725518 9.801115 0.864180 2.184187 0.027728 0.030990 0.003074
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% -0.101902 13.609172 0.642016 11.860039 -0.198249 9.661178 1.034124 0.340805 0.646984 0.038327 0.540782
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 26.795505 -0.000516 8.205667 1.347858 5.560732 0.601490 4.966460 2.710888 0.417305 0.659507 0.408657
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.616667 12.374654 10.962426 11.606577 8.605002 9.714397 1.083968 0.659735 0.035543 0.035259 0.001685
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.646633 0.680814 10.457419 1.688780 8.461236 1.992855 0.845678 7.081384 0.048618 0.646957 0.526262
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.697911 12.297836 -0.304640 11.645637 0.078677 9.755639 2.006103 2.698316 0.642267 0.069474 0.527568
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.854801 -0.389293 -0.264370 -1.558226 1.814340 -0.909841 0.139328 0.906559 0.584094 0.621938 0.396188
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.051766 1.201516 -0.645763 1.228875 -0.213815 -0.015154 1.004764 -1.003843 0.583296 0.631511 0.405238
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.036424 12.783559 -0.561623 5.366444 -0.375823 9.845097 -0.338846 2.061651 0.606433 0.044793 0.492227
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.015323 -0.163022 -0.975183 -1.006795 0.259806 -1.151892 3.055730 -0.449334 0.591126 0.589780 0.383830
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.699015 1.326797 0.769638 1.243430 -0.503183 0.752202 1.559154 0.797616 0.615721 0.633473 0.424386
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.266252 1.750141 -1.625444 -1.247129 2.225700 -0.298716 -0.458942 0.801113 0.633952 0.647835 0.419113
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.608398 -0.544339 -0.084436 1.383667 -0.338743 0.656883 0.629494 2.323483 0.640190 0.648620 0.409059
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 23.362626 28.646948 1.557483 15.237252 4.621686 9.759891 -0.250069 7.601057 0.357098 0.029392 0.265788
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.546738 -0.231256 0.601842 0.796444 -0.324802 1.785192 0.295628 0.166307 0.643182 0.656828 0.395356
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.258764 -0.513337 -0.272832 -0.054437 1.135944 1.200068 0.373032 -0.078464 0.649236 0.662367 0.393837
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.760543 0.123602 0.720553 1.266417 0.709600 -0.646667 0.976566 0.831196 0.662529 0.658176 0.386789
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.178352 13.651262 11.463388 12.028646 8.486364 9.574561 0.395841 0.447207 0.026842 0.025215 0.001566
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.680651 1.094205 -1.531904 -0.011713 0.887039 4.545649 -0.364032 -0.493118 0.657496 0.663312 0.389863
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.541061 0.703033 -0.089437 -0.665874 -0.167487 2.293592 -0.720627 1.689611 0.656411 0.663722 0.388490
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 46.591552 0.940961 0.081038 -0.203768 11.423677 -0.152927 61.458258 0.443024 0.417412 0.626059 0.413130
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 35.030109 0.326277 -0.571575 1.131308 2.008478 0.321040 3.471791 2.687725 0.436985 0.635825 0.388527
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.323725 -0.618022 -1.612846 -0.049432 -0.634211 -1.069752 0.091470 -1.585684 0.599906 0.630576 0.406529
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.626180 14.046135 -0.150823 5.266709 0.043449 9.677317 2.579066 0.600651 0.598442 0.051581 0.473535
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.325470 13.275732 0.036256 10.095128 -0.168224 9.435279 -0.193730 1.294797 0.591594 0.037705 0.464649
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.139313 -0.234697 0.457422 5.512995 -0.003255 39.500022 -0.186448 3.540225 0.613749 0.526050 0.417149
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.607078 -0.034898 0.241466 0.488753 0.345542 0.326452 0.074120 1.371322 0.625505 0.639585 0.406315
84 N08 RF_maintenance 100.00% 61.34% 100.00% 0.00% 21.494943 25.362077 14.140254 14.755665 7.059186 9.702368 3.083622 3.522913 0.212711 0.035856 0.141062
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.061687 0.162679 0.125865 0.809009 0.207681 -0.455577 0.365821 -0.313231 0.644742 0.654359 0.397773
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.408494 -0.087111 2.250190 1.849073 3.064619 -0.966406 0.467378 15.204150 0.627286 0.642729 0.376676
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.233339 8.127199 0.101883 -0.092347 11.718320 2.409058 2.685542 1.148994 0.624288 0.672657 0.381277
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.094132 0.655650 0.443684 1.113913 -0.621268 -0.421986 1.426787 -0.100785 0.652507 0.663754 0.379761
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.866974 0.570409 0.320259 1.029855 -0.874572 -0.673523 -0.538302 -0.588518 0.655279 0.664835 0.383541
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.141854 -0.780547 1.068335 1.604800 -0.344187 -0.834420 -0.032347 3.371195 0.651312 0.656741 0.384548
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.255839 -0.105375 0.591385 0.451288 -0.716810 -0.709101 -0.052043 -0.375730 0.647813 0.665513 0.397610
92 N10 RF_maintenance 100.00% 0.00% 13.48% 0.00% 38.934691 45.540320 0.766489 1.443787 5.251241 5.639006 0.758824 5.964432 0.283112 0.239677 0.091779
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.810916 0.988376 2.670509 -0.411538 0.482468 2.257439 3.582037 0.335292 0.632048 0.655004 0.400241
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.276940 12.848806 11.242359 11.495085 8.656421 9.731415 0.601909 0.249496 0.031503 0.026266 0.002575
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.096071 -0.523228 -0.942552 0.788740 -0.700914 0.082778 -0.170733 1.377191 0.612042 0.640313 0.405674
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.465584 13.614125 4.866786 5.446533 8.484507 9.558596 0.595688 0.150186 0.033266 0.039611 0.003119
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.513655 8.885250 -1.228539 3.509327 1.945076 5.948314 1.281189 1.941241 0.595928 0.462091 0.411404
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.896701 9.391088 -0.311558 1.215300 0.073408 1.436460 0.386107 0.607277 0.644741 0.653132 0.398201
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.988260 1.128518 -0.939860 -1.595862 0.422289 1.113457 -0.277081 4.888232 0.653114 0.661865 0.395168
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.295255 5.938043 6.168757 -0.960869 45.185326 3.798094 6.070205 10.158837 0.602919 0.666102 0.403420
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.357358 64.075090 -0.536646 8.098119 3.181056 2.666876 0.623587 0.926883 0.661356 0.636347 0.388287
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.072830 -0.064750 0.151948 1.059292 0.790197 -0.621902 -0.377718 -0.415212 0.659880 0.663876 0.376937
106 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.153869 0.807822 1.633081 1.354242 6.678354 -0.848394 0.209944 0.606882 0.642596 0.660225 0.375394
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 2.680684 1.412262 -0.879265 -0.974386 0.946516 -0.282931 8.422336 7.614798 0.657462 0.672538 0.383864
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.259855 42.697167 11.023016 0.876738 8.676134 5.212324 1.286652 3.386372 0.035454 0.282537 0.158419
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.016020 12.365223 11.066299 11.354419 8.757216 9.820442 0.250992 1.179114 0.026186 0.026414 0.001247
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 28.180337 27.013791 14.653233 14.945978 8.632320 9.588222 3.347035 3.304484 0.023980 0.026369 0.001303
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.066509 12.282178 0.711823 11.465054 -0.368101 9.836121 14.134184 1.530465 0.641663 0.035118 0.468949
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.696789 -0.614101 0.326475 0.099188 0.741568 2.054993 0.511256 -0.594477 0.635782 0.649469 0.405504
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.300266 13.652230 4.630843 5.330576 8.512956 9.609277 1.215082 0.201603 0.035412 0.030800 0.002483
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.945469 0.881085 -1.506753 -0.127722 2.730573 -0.653351 0.352696 0.115030 0.588938 0.625673 0.404588
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.175377 -0.987600 -1.198229 -0.596783 -0.675459 -1.281907 -0.185005 -0.483644 0.582050 0.608667 0.408999
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.169169 13.987505 11.143666 12.004771 8.543919 9.734120 1.149380 3.035538 0.027996 0.032194 0.003025
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.850676 1.414512 0.032207 0.744821 -0.550681 0.058941 0.379012 1.266943 0.611090 0.635720 0.409892
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.445433 1.941067 3.061613 -1.153131 0.456514 2.573011 3.689130 1.442911 0.632702 0.662308 0.398577
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.759341 3.667094 -1.262084 6.937795 2.345294 2.731782 21.139569 13.694177 0.655772 0.634199 0.382052
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.410181 7.404461 0.556169 0.926301 0.365193 1.204127 -0.134279 -0.739296 0.661450 0.670868 0.387430
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.198593 9.299873 0.810628 1.214236 0.695361 0.097661 -0.245381 -0.064595 0.666859 0.672659 0.387154
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.379290 0.317585 0.164914 0.780841 -0.477674 0.039013 0.699532 0.076331 0.667406 0.671666 0.385939
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.200991 -0.331186 -0.243753 1.114961 -0.529381 -0.840390 -0.042408 -0.454169 0.660753 0.668536 0.384404
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 31.327098 7.364665 -0.117126 1.766447 6.112546 0.021787 10.215590 -0.418028 0.546719 0.664493 0.378039
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.268109 0.030961 0.377966 0.490960 2.375538 1.317737 1.315231 3.114682 0.653305 0.669416 0.398912
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.199673 11.850793 11.138786 11.601251 8.575984 9.654248 0.038272 0.183810 0.030610 0.027869 0.001496
131 N11 not_connected 100.00% 0.00% 19.75% 0.00% -0.832262 12.784272 -0.020522 5.277519 -0.933137 8.766173 -1.139768 -0.584225 0.625433 0.258135 0.455178
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.809947 0.966156 -0.359214 -1.633304 0.861063 -0.933972 -0.242505 -0.659429 0.606100 0.614851 0.395572
133 N11 not_connected 100.00% 100.00% 0.00% 0.00% 12.809034 -0.692649 4.629196 -1.544341 8.624722 -1.131215 1.043113 -0.789915 0.050945 0.608282 0.475710
135 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
136 N12 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.217485 -0.651548 -0.067506 -1.518755 1.183394 -0.939669 0.747847 1.548753 0.600445 0.629405 0.415997
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.953447 -0.605069 1.492654 -1.157240 0.312687 -0.392038 0.350450 0.544282 0.631537 0.635341 0.391741
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.529379 -0.396800 -0.908565 -0.454818 -0.785669 -0.843160 3.799491 1.828132 0.646587 0.666479 0.392454
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.362972 -0.566557 -0.479545 0.603304 1.479480 -0.613986 0.404408 -1.431605 0.651240 0.669264 0.387946
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.109108 12.292211 -0.921778 11.651350 1.769495 9.775286 15.342779 1.057285 0.656526 0.047099 0.535579
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% -0.961677 12.809843 0.876740 11.701431 1.245029 9.540770 1.283539 1.863112 0.657692 0.040570 0.551992
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.366109 0.433449 -1.146424 0.646497 2.002231 9.127772 -0.698455 -0.644419 0.666741 0.671544 0.386873
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.166321 1.488553 -1.041344 6.407291 1.664617 11.426484 -0.072650 0.151722 0.664324 0.625431 0.401194
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 12.495495 -1.274440 4.641141 -0.111420 8.611801 -1.182235 -0.057288 -1.239523 0.037905 0.660974 0.512932
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.695469 -1.693305 1.557900 2.567728 0.238423 -0.492415 0.109183 -0.141367 0.639591 0.650507 0.390448
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.282869 0.085252 -0.742965 -0.654839 1.392712 2.027898 -0.369650 -0.693677 0.645903 0.661654 0.401847
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.129817 -1.211078 -1.155937 -1.410828 -0.063788 0.643437 0.313988 -0.231627 0.639737 0.656414 0.406634
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.296408 -0.744226 -1.478309 -1.411077 -0.434436 0.238157 -0.588178 -0.525949 0.632700 0.647025 0.407632
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 27.816320 0.537101 -0.382075 0.426310 3.860479 -1.063469 1.081188 -0.223651 0.487676 0.596685 0.366302
155 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 6.403423 12.071609 9.979560 11.377203 5.934911 9.834008 0.340680 1.225780 0.349478 0.039143 0.269555
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.399936 -0.206259 0.061149 0.756155 -0.401905 0.883500 -0.143585 -0.184499 0.614157 0.629931 0.411763
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.382910 -0.188197 -0.367347 -0.532233 1.680180 2.209888 4.221591 12.140404 0.628783 0.645543 0.413482
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.084166 27.881320 -1.662806 -0.832505 -0.649335 6.496257 -0.350829 46.822110 0.603914 0.509720 0.369606
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.033522 -1.143111 -0.155527 -0.843272 -0.477597 1.430524 0.433598 0.346574 0.640982 0.655986 0.396652
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.041542 31.124467 0.016907 -0.561843 0.185561 1.594428 -0.357531 0.245008 0.646890 0.526851 0.350583
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.210657 -1.039092 -0.734881 -1.295955 1.117783 0.881772 1.986431 -0.579510 0.660696 0.672280 0.390400
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.199775 1.408842 -0.122993 0.513219 0.036437 1.075156 -0.135227 0.937027 0.663724 0.671122 0.394791
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.892333 0.688303 1.940379 -0.137288 6.095076 2.196254 0.625630 0.437531 0.652705 0.672114 0.389176
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 34.612137 -0.035076 2.616936 0.698029 5.232371 0.042591 1.688300 -0.250770 0.500463 0.666253 0.386108
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.273706 0.580147 0.702502 3.116648 0.090473 3.629581 4.703578 1.879737 0.656269 0.655891 0.390122
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.252355 -0.771446 -1.591215 0.121747 1.132910 0.491848 -0.588567 1.637786 0.651254 0.659439 0.395971
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.158679 -1.141217 0.211842 -0.394757 1.554915 0.861236 -0.126186 0.252788 0.641378 0.655989 0.401752
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.665897 -0.688821 -0.959753 -1.611350 0.547679 0.251680 -0.741122 -1.066890 0.640758 0.656106 0.401688
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.947135 -0.554846 11.281211 -1.014674 8.502253 -0.248912 0.663404 1.663957 0.038059 0.650817 0.509290
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.500817 2.414552 -1.215698 1.009095 -1.103781 1.684399 -0.268569 1.247674 0.594020 0.573093 0.382706
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 13.566111 13.394918 4.375016 4.959457 8.826399 9.842626 2.553666 5.178493 0.040023 0.045265 0.004324
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.056424 -0.973264 -0.347522 0.401915 2.266391 33.542013 -0.227751 6.248937 0.622355 0.636092 0.405617
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.200784 13.044710 -0.112551 11.793194 1.479555 9.684342 19.729811 1.554468 0.639755 0.053904 0.535311
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.663913 -0.004656 0.187502 0.523668 0.334204 0.005356 -0.488133 3.613629 0.649155 0.657883 0.400522
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.347014 12.050179 -1.648232 11.343359 -0.051323 9.864890 8.491970 1.358480 0.658285 0.047916 0.510816
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.373659 1.250205 -0.342557 0.962104 1.313356 0.445540 0.112871 -0.382017 0.648449 0.658382 0.382055
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -1.158936 -0.660892 -0.648722 -0.189568 3.522422 7.732318 0.892301 0.614310 0.656018 0.667960 0.385159
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 34.042496 -0.162411 3.959709 0.240955 11.226069 8.527607 6.388687 0.629759 0.501749 0.663522 0.395246
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.741362 -1.317573 -1.644079 -0.534244 0.777690 -0.667641 -0.481304 -0.969348 0.664157 0.677771 0.401955
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.177188 -0.112734 -1.212455 -0.488505 0.164910 0.666327 1.087145 17.444417 0.658623 0.669705 0.394708
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.954831 11.836278 10.522802 11.409290 8.652430 9.849613 5.920658 0.754723 0.028042 0.030722 0.001217
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.189912 -1.429290 -0.611073 0.178740 -0.217719 -0.279154 -0.167974 -1.279922 0.637331 0.658256 0.411712
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.414851 0.434922 1.484937 -0.457353 0.859355 0.479929 11.493357 1.023702 0.624015 0.645132 0.409973
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.585107 7.624851 5.039301 5.020370 6.670704 7.749046 -3.213319 -3.362044 0.587366 0.603651 0.400700
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.266617 0.040787 5.133711 1.070133 6.805816 1.303985 -3.159562 0.469969 0.572976 0.615303 0.429496
200 N18 RF_maintenance 100.00% 100.00% 49.05% 0.00% 13.051328 37.513893 4.820599 0.717948 8.782025 7.034609 1.214673 -0.848658 0.041743 0.215843 0.144457
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.941532 5.802574 3.123334 4.396716 4.086662 6.488304 -1.152758 -2.890982 0.632777 0.628464 0.397074
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.606337 1.174994 1.660988 -1.532086 1.173971 0.863832 -1.291150 27.247500 0.641251 0.631989 0.389780
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.309983 2.751702 -0.034516 -0.409578 -0.793614 -0.659607 -0.777625 6.197034 0.635885 0.626273 0.384313
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 1.240768 1.488903 0.970833 -1.042225 0.587498 -0.709116 -0.250285 2.322179 0.635314 0.631455 0.385616
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.945426 3.314336 1.360288 0.032768 1.193390 -0.300635 -0.738356 -1.336677 0.619858 0.621944 0.365400
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.964454 11.883339 10.260951 12.809510 8.281284 9.124058 15.026747 80.186319 0.034042 0.034087 0.000837
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.786696 8.509451 9.998587 10.220600 8.440508 9.607035 7.626784 10.974269 0.041491 0.041128 0.001406
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 13.899518 12.708689 -0.824738 -0.949499 -0.772600 -0.573191 -0.415503 -0.440010 0.633290 0.643928 0.402502
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.549204 -0.794758 -1.262030 -0.012340 0.062867 -0.578825 0.911326 -1.098512 0.589488 0.620095 0.404693
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.358534 -1.164763 0.408538 -0.563998 -0.617707 -0.318939 2.083257 -1.204403 0.628772 0.634403 0.394765
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.014812 -0.638810 -1.124114 -0.898235 4.731876 -0.765749 2.821089 -0.903957 0.617932 0.639560 0.398504
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.233404 -0.189819 -0.145769 0.104922 -0.917118 -0.609842 2.773875 -1.487961 0.624727 0.647575 0.401226
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.842142 1.821645 -1.656514 -0.063046 -0.529009 3.517204 1.143158 4.283062 0.615023 0.647098 0.401319
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.559860 7.358458 5.388379 5.087282 6.734863 7.815958 -3.171260 -3.345690 0.603723 0.622987 0.391816
225 N19 RF_ok 100.00% 0.00% 92.00% 0.00% 1.509479 12.835417 0.980081 5.111144 -0.925271 9.635300 -1.116475 0.263617 0.635231 0.116336 0.532995
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.037912 1.097126 0.037636 1.249038 -0.989527 1.836887 -1.016747 -0.991107 0.627072 0.645430 0.402985
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.949469 0.439889 -1.535112 -0.001689 -0.054458 -0.448030 11.920547 -0.070814 0.597310 0.629079 0.390155
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.011950 21.943502 -0.826133 -0.325389 0.988790 3.915660 39.904648 31.216735 0.557261 0.515110 0.337923
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.053504 0.333327 1.618148 1.364130 0.307405 0.913857 -0.151043 -1.752204 0.608553 0.625026 0.406506
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.912040 -0.488470 -0.187270 -1.603162 -1.064551 -0.938876 0.067639 -1.097673 0.571591 0.617836 0.415707
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.008677 -1.019748 0.989817 0.567600 -0.615432 -0.905392 -1.490351 -1.796658 0.625216 0.636758 0.408053
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.123887 -0.907927 -0.185770 0.352187 -0.327954 -0.992127 1.150167 3.028874 0.622362 0.638227 0.404110
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 29.597714 46.677042 0.363895 1.568080 4.393757 6.744751 11.745642 10.676742 0.486200 0.407118 0.254654
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.042756 3.393973 -0.891140 0.737515 -0.947236 0.265012 3.813481 16.583120 0.615044 0.592900 0.397944
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 46.600909 2.159330 0.182035 1.655473 8.359775 2.049762 18.435627 -1.282128 0.403119 0.638997 0.461325
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 64.439264 2.329834 0.923696 -1.537424 6.036416 -0.678210 -1.477002 -0.615040 0.274980 0.620247 0.490819
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.798960 1.824103 1.643924 -0.607196 1.777172 1.815240 1.209953 6.163633 0.506284 0.594024 0.396901
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.308495 2.194082 0.139671 -1.057355 -0.578766 -0.716076 -1.174495 -0.101681 0.604050 0.608352 0.399061
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.272725 7.577625 -0.891277 -0.041983 5.086707 5.122715 2.202574 -1.061706 0.320872 0.328275 0.163254
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.625105 1.334181 0.785177 -0.475244 -0.286375 -0.982469 -0.693265 1.171284 0.603386 0.609956 0.401446
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.588617 8.481924 10.139480 10.803359 8.144130 8.832395 11.835776 18.490865 0.033413 0.028118 0.004745
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 11.125602 13.384107 5.859007 7.675798 3.530782 9.849293 15.780331 2.345443 0.352190 0.046604 0.271275
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.059966 2.751839 1.147154 1.587317 0.743983 1.656418 2.817677 2.099128 0.509188 0.527588 0.394863
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.683085 -0.903441 1.247020 -1.504128 0.872952 -0.800347 -1.147920 -0.165716 0.532529 0.537498 0.397139
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.541855 -0.962245 1.142620 -1.058528 2.328360 -1.030088 3.826428 0.684876 0.437199 0.528765 0.403847
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.086411 2.460342 -0.651081 -1.594375 -0.589274 -1.022247 1.342583 1.647899 0.473119 0.510807 0.386317
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, 20, 27, 28, 29, 30, 32, 34, 36, 37, 38, 40, 42, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 73, 77, 78, 80, 81, 82, 84, 86, 87, 92, 94, 96, 97, 101, 102, 103, 104, 106, 107, 108, 109, 110, 111, 113, 117, 120, 121, 122, 123, 126, 128, 131, 133, 135, 136, 142, 143, 144, 145, 146, 151, 155, 156, 158, 159, 161, 164, 165, 166, 170, 173, 179, 180, 182, 184, 185, 187, 189, 191, 192, 193, 200, 201, 202, 205, 208, 209, 210, 221, 223, 224, 225, 227, 228, 240, 241, 242, 243, 244, 246, 262, 320, 329]

unflagged_ants: [5, 8, 17, 19, 21, 22, 31, 35, 41, 43, 44, 45, 46, 48, 49, 61, 62, 64, 65, 66, 67, 69, 70, 74, 79, 83, 85, 88, 89, 90, 91, 93, 95, 105, 112, 114, 115, 118, 124, 125, 127, 132, 137, 139, 140, 141, 147, 148, 149, 150, 157, 160, 162, 163, 167, 168, 169, 171, 181, 183, 186, 190, 206, 207, 211, 220, 222, 226, 229, 237, 238, 239, 245, 261, 324, 325, 333]

golden_ants: [5, 17, 19, 21, 31, 41, 44, 45, 65, 66, 67, 69, 70, 83, 85, 88, 91, 93, 105, 112, 118, 124, 127, 140, 141, 147, 148, 149, 150, 157, 160, 162, 163, 167, 168, 169, 171, 181, 183, 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_2459949.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.1.5.dev215+gd2b157e
In [ ]: