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 = "2459934"
data_path = "/mnt/sn1/2459934"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 12-20-2022
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

# find the auto_metrics file
glob_str = os.path.join(data_path, f'zen.{JD}*.auto_metrics.h5')
auto_metrics_file = sorted(glob.glob(glob_str))

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2459934/zen.2459934.21347.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 1848 ant_metrics files matching glob /mnt/sn1/2459934/zen.2459934.?????.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/2459934/zen.2459934.?????.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 2459934
Date 12-20-2022
LST Range 0.501 -- 10.447 hours
X-Engine Status ✅ ✅ ✅ ✅ ❌ ❌ ✅ ✅
Number of Files 1848
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 94
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 18
Nodes Registering 0s N11, N18, N19, N20
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 92 / 201 (45.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 136 / 201 (67.7%)
Redcal Done? ❌
Never Flagged Antennas 65 / 201 (32.3%)
A Priori Good Antennas Flagged 49 / 94 total a priori good antennas:
3, 7, 9, 15, 16, 17, 21, 29, 30, 37, 40, 42,
53, 54, 55, 56, 71, 72, 81, 86, 88, 94, 100,
101, 103, 107, 109, 111, 121, 122, 123, 128,
129, 130, 136, 143, 146, 158, 161, 164, 165,
170, 182, 183, 185, 187, 189, 191, 202
A Priori Bad Antennas Not Flagged 20 / 107 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 74,
77, 82, 89, 90, 125, 137, 139, 324, 325
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_2459934.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% 12.812216 18.181944 9.038078 0.430305 8.624403 4.246760 0.515491 4.713286 0.034339 0.365933 0.291901
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.323019 0.876810 1.590304 2.172979 0.236202 1.979621 7.625654 9.527114 0.665412 0.675462 0.409215
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.326030 -0.079581 -0.505635 -0.378597 -0.135076 1.702863 1.175793 -0.155070 0.664810 0.676149 0.407471
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.342579 -1.342690 0.516510 3.025676 -0.232545 -0.031989 12.355828 10.977965 0.654695 0.660079 0.393034
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.581066 -1.534919 -1.112115 -0.393585 -0.414920 0.839216 1.870431 1.998553 0.664013 0.673372 0.392042
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 5.493462 -0.894225 7.384164 -0.019520 4.366218 0.588142 -0.041037 -0.208301 0.499780 0.670902 0.467730
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.912642 -0.941758 -0.496934 -0.988851 -0.584307 0.802161 0.185192 3.735968 0.645498 0.661719 0.399824
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 13.053857 20.497621 8.470843 1.629694 8.640745 4.679942 0.265708 1.524835 0.032348 0.361152 0.277397
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 13.124612 -0.100605 9.007944 0.222912 8.629748 2.207448 0.481526 1.723453 0.032551 0.681756 0.552558
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.966409 2.506356 -0.230996 -0.135924 0.637911 0.936278 8.014737 3.292187 0.669384 0.682320 0.404203
18 N01 RF_maintenance 100.00% 100.00% 39.07% 0.00% 13.896620 23.636036 8.999882 0.135719 8.795885 6.739998 0.428428 16.504421 0.029656 0.238556 0.183197
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.541803 -0.632852 -0.846106 2.992636 0.009672 0.320039 0.615958 2.350184 0.671723 0.665437 0.393185
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.594908 -1.149699 3.240656 -0.518869 0.335993 -1.024216 0.912294 -0.721109 0.652509 0.686455 0.405103
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.585854 0.548417 -0.442646 3.926969 0.592525 0.063452 0.100948 -0.340574 0.653326 0.635240 0.397151
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.455641 -0.236514 0.646103 0.391193 1.920018 1.449773 -0.435999 -1.278953 0.617813 0.635947 0.394697
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.275063 13.657899 9.049658 9.559599 8.787467 8.792026 2.367386 1.743738 0.035828 0.040006 0.006239
28 N01 RF_maintenance 100.00% 0.00% 83.60% 0.00% 15.420125 32.460103 -1.039388 0.830299 4.182024 6.332598 3.730297 14.225976 0.379581 0.176953 0.273289
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 13.100616 14.178355 8.664309 9.176822 8.768070 8.763329 0.631540 0.051727 0.029891 0.035603 0.005999
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.171384 0.226645 -0.490615 0.103595 5.094786 0.957685 10.784458 -0.195596 0.676643 0.686503 0.393779
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.225511 -1.178264 0.497929 0.858912 1.026643 -0.227940 0.074733 2.381192 0.682606 0.685903 0.391481
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 28.175003 1.177995 0.444218 1.097620 3.723582 3.461593 10.133076 37.742484 0.568930 0.668712 0.367837
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 14.877066 15.508603 3.743531 4.142130 8.750139 8.761062 1.788960 1.283569 0.033664 0.041467 0.004934
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.320879 -0.014657 1.341697 -0.736837 -0.009672 -0.858814 2.086422 -0.619562 0.622723 0.626284 0.388187
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.457330 7.967329 -0.237770 -0.047078 0.876589 1.696313 1.847869 1.331168 0.661853 0.670188 0.405694
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.469554 0.476232 -0.784530 0.318599 0.942627 1.050055 -0.616916 4.723501 0.676203 0.682665 0.409380
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.002142 0.154050 -0.252683 0.276140 -0.030708 -0.155037 3.569896 0.838795 0.676627 0.689038 0.409166
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 12.341369 0.535275 8.693998 0.136472 8.776988 -0.472261 1.340371 1.260504 0.038618 0.681327 0.535322
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.427595 0.107229 -0.784657 -0.341914 2.122169 0.254706 -0.130390 -0.183626 0.678760 0.690653 0.390691
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 13.807727 14.796156 9.286733 10.020950 8.547528 8.584641 1.556677 1.904823 0.031306 0.029573 0.002265
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.357522 0.860226 -0.772649 0.176935 -0.385585 0.487126 -0.124785 1.148673 0.682806 0.687816 0.393522
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.942030 0.326187 -0.729662 -0.297771 -0.282961 0.560362 -0.537644 -0.478811 0.680448 0.693882 0.388398
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.617496 0.855841 -0.263480 0.068042 -0.808424 1.807980 -0.030345 1.892849 0.673091 0.683450 0.386044
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.244472 2.282236 0.971143 2.256892 -0.479426 0.829584 -0.457207 -2.137886 0.662272 0.690003 0.405355
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 13.895282 15.145668 3.571555 3.785475 8.708016 8.698649 2.122205 1.148027 0.029981 0.049980 0.012162
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.272219 1.405945 0.935849 2.040410 0.154614 1.582865 0.599316 -1.751034 0.629586 0.653477 0.397362
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.136826 -0.035435 -1.461637 0.604252 0.314667 -0.568982 -0.273417 0.677165 0.578822 0.631606 0.403021
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.243499 18.546334 -0.244283 0.842140 1.343609 5.320925 19.299955 41.641603 0.653647 0.619113 0.375696
51 N03 dish_maintenance 100.00% 98.65% 0.00% 0.00% 28.426028 4.324647 11.656556 -0.923762 8.971160 6.070440 7.390324 0.371199 0.043895 0.573080 0.436627
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.820112 7.529456 -0.944858 0.127531 0.571959 1.074547 2.069023 0.751579 0.679692 0.691598 0.398971
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.418951 3.175358 -0.500063 -0.201949 1.320885 2.152009 3.096232 5.670165 0.686410 0.696427 0.404106
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.866094 14.412117 9.060859 9.779256 8.692065 8.703513 1.446934 0.389907 0.031438 0.029854 0.001477
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 13.126138 14.566313 8.540330 9.135436 8.760338 8.759483 1.287154 2.298231 0.028384 0.031597 0.002716
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.436461 15.362775 -0.045451 9.894131 -0.300388 8.683877 2.998310 2.022828 0.681444 0.038929 0.564615
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.877693 0.266469 7.863016 0.166179 7.446015 0.722409 5.077822 1.706726 0.345450 0.695420 0.462857
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.343880 14.044485 8.945776 9.670466 8.632110 8.671115 1.171283 0.638810 0.035622 0.035048 0.001761
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 13.654028 0.935361 9.003765 0.929006 8.486433 3.188230 0.535124 7.359708 0.049565 0.682421 0.538187
60 N05 RF_maintenance 100.00% 0.00% 97.19% 0.00% 1.172265 13.992993 -0.821688 9.703443 -0.168686 8.729944 1.057177 2.647329 0.669495 0.080861 0.526744
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 3.803656 0.536749 -0.967067 -1.353416 2.339038 -0.985233 -0.422293 0.194092 0.609451 0.646134 0.389690
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.846421 1.383173 -1.305166 1.487546 -0.442531 -0.222457 0.839268 -1.021881 0.602803 0.653834 0.399149
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.324759 14.455688 0.134217 4.171970 0.123579 8.819711 0.293102 1.941607 0.615513 0.045953 0.476997
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.576365 0.488006 -0.217906 -1.307546 -0.768756 -1.350954 1.480056 -0.196838 0.595740 0.601435 0.385455
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.598447 1.069548 0.014347 0.668251 0.734330 1.194291 0.186184 0.201196 0.657858 0.677948 0.413564
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.341356 1.795266 1.771138 1.566018 3.072568 0.187172 -0.001220 0.827696 0.666382 0.684848 0.403770
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -1.060195 -0.758319 1.028880 0.919678 -0.194193 0.924506 0.814182 2.940338 0.677740 0.690475 0.399249
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 27.162770 31.387091 0.742087 12.863302 3.772823 8.795708 0.953127 7.693188 0.386592 0.030681 0.282179
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.611606 -0.178551 -0.113403 0.295105 -0.370437 1.933844 -0.163730 -0.270454 0.680540 0.695512 0.385545
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.820881 -0.066676 -0.766734 -0.405678 0.566258 1.622569 0.803150 1.103023 0.674385 0.701572 0.392610
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.674605 -0.200566 0.085713 0.675141 0.867876 0.201449 2.151849 1.671282 0.695358 0.701268 0.381281
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 3.163301 15.427273 0.245106 10.045994 -0.180462 8.559210 6.678011 1.029422 0.686561 0.035875 0.557765
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.279223 0.684230 -0.496509 1.679846 0.609381 4.779066 -0.121959 -0.199660 0.695105 0.690892 0.384527
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.705432 1.873842 0.482220 -1.007832 -0.429710 1.405756 -0.502080 2.476169 0.686408 0.693646 0.381483
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.100014 1.151525 0.907933 0.243285 -0.586626 -0.818914 1.779131 -1.173479 0.644814 0.649441 0.390221
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 37.082905 0.242356 -0.377237 1.417792 2.832648 -0.148707 2.484302 1.796850 0.415165 0.650548 0.399107
79 N11 not_connected 100.00% 100.00% 100.00% 0.00% 18.814059 19.373215 -0.853680 0.187222 -0.821000 -1.189140 0.306348 -1.395863 nan nan nan
80 N11 not_connected 100.00% 100.00% 100.00% 0.00% 20.521329 27.553896 2.984889 4.417155 3.191509 8.597012 0.234239 0.618905 nan nan nan
81 N07 digital_ok 100.00% 0.00% 99.95% 0.00% -0.349291 14.916346 -0.559849 8.343321 -0.228539 8.427472 -0.136828 0.900379 0.636623 0.040367 0.482083
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.661338 -0.387253 -0.178433 1.614297 -0.263366 -0.653068 -0.228675 -0.231700 0.655201 0.664222 0.394974
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.776604 -0.176605 -0.387771 -0.036353 -0.137809 -1.110924 -0.298557 0.426243 0.666781 0.682574 0.395216
84 N08 RF_maintenance 100.00% 30.47% 100.00% 0.00% 24.229797 27.636388 11.765588 12.439132 7.210795 8.713279 2.995046 3.246301 0.245640 0.037700 0.168935
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.324461 -0.334504 0.139907 0.904612 -0.423202 -0.590455 -0.635912 -0.775372 0.682909 0.691531 0.389165
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.134661 2.806377 1.249089 1.175097 4.767683 -0.931005 -0.060304 12.879799 0.672328 0.673471 0.370568
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.319585 8.584950 -0.415853 -0.361188 13.293762 0.429107 1.155468 1.597577 0.661102 0.712118 0.376774
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.036967 0.057448 -0.178373 0.454283 -0.855029 -0.052675 4.453897 1.676670 0.679339 0.696576 0.375027
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.046297 0.002142 -0.349559 0.459586 -0.527618 -0.686566 -0.764935 -0.870679 0.689524 0.697961 0.378051
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.498130 -0.650837 0.609151 0.941460 -1.127381 -1.286092 0.025833 2.952785 0.677698 0.688293 0.380662
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.657042 -0.275775 -0.719436 -0.670763 -1.135622 -0.769744 -0.330561 -0.681569 0.674080 0.695550 0.393169
92 N10 RF_maintenance 100.00% 0.11% 14.45% 0.00% 44.362836 52.127175 0.238263 0.868957 5.469356 5.161004 0.932214 7.055240 0.297466 0.253487 0.093479
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.991021 0.440646 1.779513 -0.014347 2.518817 1.080725 2.553832 -0.591844 0.653710 0.676771 0.398881
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 14.039407 14.536488 9.199714 9.571013 8.659426 8.696099 0.957351 0.477162 0.030505 0.026312 0.002654
95 N11 not_connected 100.00% 100.00% 100.00% 0.00% 19.188847 19.436503 -0.316056 0.770586 -0.344345 -0.182476 0.007728 1.404261 nan nan nan
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 26.190506 27.163056 3.928921 4.597853 8.444090 8.497952 0.835984 0.401418 nan nan nan
97 N11 not_connected 100.00% 100.00% 100.00% 0.00% 18.792251 21.843510 -0.008899 2.683683 0.400965 4.625441 2.719639 3.250395 nan nan nan
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.949211 2.904385 -0.350676 -0.351569 -0.058238 0.735279 0.349850 1.445834 0.633311 0.650646 0.396792
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 3.906376 -0.890962 0.456888 0.167336 -1.125825 2.632442 1.430013 -0.469099 0.625853 0.668059 0.407597
100 N07 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.451913 9.912874 -0.861786 0.669468 -0.389044 1.506062 0.448058 0.579778 0.683176 0.693201 0.390678
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.267855 1.566903 -0.880176 2.482504 1.044712 -0.201949 -0.264360 5.548051 0.690127 0.685156 0.382449
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.563701 5.258486 -1.387511 -0.617230 6.209352 2.845206 5.960696 7.469987 0.689325 0.700966 0.376971
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.590606 70.861604 6.213902 6.569323 3.548867 2.285715 -0.250927 0.757239 0.631376 0.673477 0.384666
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.308940 -0.732397 -0.991129 -0.162295 0.592547 -0.553338 -0.469850 -0.671816 0.691743 0.698041 0.370933
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.054628 0.568449 0.563720 0.691899 1.665290 -0.280336 -0.461407 -0.291035 0.681535 0.696281 0.374856
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 3.151394 2.907835 -1.264561 -1.220746 0.436662 -0.340009 6.416743 5.602883 0.686135 0.701905 0.375154
108 N09 RF_maintenance 100.00% 100.00% 2.92% 0.00% 12.971654 44.709132 8.996837 0.260414 8.707027 5.422727 1.418847 1.680995 0.037419 0.296375 0.145432
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.728754 14.046626 9.032834 9.445514 8.797642 8.771013 0.455310 1.253589 0.026606 0.026883 0.001408
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 30.954195 29.661152 12.192972 12.609377 8.673111 8.603972 3.112143 3.031457 0.024213 0.026405 0.000876
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.021078 13.940232 0.018319 9.543229 -0.298056 8.791306 4.630036 1.590054 0.658549 0.037992 0.496306
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.778202 -0.428902 -0.332104 -0.275982 0.638263 2.740915 0.823612 -0.716068 0.644138 0.662927 0.416375
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 26.938863 27.209878 3.720767 4.494417 8.485533 8.550033 1.382564 0.428289 nan nan nan
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 18.921863 19.384152 -0.529207 0.113920 1.627148 -0.741657 0.399690 0.017251 nan nan nan
115 N11 not_connected 100.00% 100.00% 100.00% 0.00% 19.946953 20.275693 1.499279 2.124583 0.751639 1.317651 -1.128513 -1.164719 nan nan nan
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.234716 0.617277 -0.606680 0.295204 -0.042420 0.179547 1.450049 1.221461 0.625273 0.644081 0.398516
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 13.933777 15.769069 9.109041 10.021232 8.582249 8.722969 1.315469 2.814223 0.027664 0.031362 0.002275
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.694632 1.693579 -0.567911 0.276304 0.127468 -0.558553 0.046426 0.472938 0.655998 0.677060 0.400465
119 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 290.487969 290.400140 inf inf 3650.665682 3655.539415 4858.452321 4798.530231 nan nan nan
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.241169 3.573508 2.003138 2.568114 2.933061 2.283262 9.515047 0.191313 0.662388 0.684683 0.376560
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.017524 3.293648 -1.327781 6.685361 2.564265 4.127353 12.234859 10.664696 0.690076 0.656832 0.380770
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.523831 7.437250 -0.106098 0.412684 0.352303 1.267037 0.382010 -0.942517 0.696037 0.704148 0.378778
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.551120 9.786638 0.134165 0.634713 0.436468 0.299584 -0.535663 -0.427731 0.699820 0.707874 0.382903
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -1.022288 0.401041 -0.490230 0.243805 -0.884148 0.258345 0.453731 -0.245345 0.697115 0.705195 0.382253
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.223459 3.063339 -0.977057 0.418289 -0.573326 1.631576 0.308943 1.209135 0.689095 0.692696 0.376992
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.984123 1.947203 -1.270448 0.781762 6.203662 1.667519 56.212661 -0.104798 0.670513 0.689999 0.385438
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.264333 0.337373 -0.163733 0.082057 2.342870 1.111011 0.822519 0.433544 0.677106 0.696290 0.399162
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.914537 13.473470 9.101111 9.667582 8.607100 8.622409 0.364619 0.400305 0.030356 0.028071 0.001587
129 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 242.383236 242.026174 inf inf 3809.216179 3743.052853 5044.909606 4819.839790 nan nan nan
130 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 19.288789 26.187168 0.280926 4.469041 -0.025985 8.070803 -0.907071 -0.162780 nan nan nan
132 N11 not_connected 100.00% 100.00% 100.00% 0.00% 19.050655 18.643060 -0.006698 -0.960481 3.695796 -0.581642 0.345158 -0.577112 nan nan nan
133 N11 not_connected 100.00% 100.00% 100.00% 0.00% 26.289429 18.930257 3.716706 -1.075232 8.599173 -0.993046 1.226814 -0.693576 nan nan nan
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.784911 -1.053788 -0.505526 -1.111400 3.649389 0.943837 8.707810 0.027819 0.624233 0.659601 0.422537
136 N12 digital_ok 100.00% 99.68% 0.00% 0.00% 11.840557 1.108607 8.641051 1.678697 8.786353 20.764692 1.076911 0.241953 0.042787 0.642884 0.502725
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.199995 -1.206180 -0.519643 -1.506320 1.833922 -1.275006 0.464672 0.720190 0.639577 0.669176 0.407636
138 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.416625 0.040310 1.930189 -0.587954 0.892400 -0.724141 -1.021503 0.001220 0.665439 0.670481 0.386917
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.828301 -0.601658 -1.455341 0.076876 -0.738384 -0.390009 3.692606 2.995661 0.678883 0.700609 0.387491
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.739373 -0.548236 -0.950799 0.975704 2.165146 -0.920120 0.010941 -1.402924 0.683106 0.702912 0.382364
142 N13 RF_maintenance 100.00% 0.00% 98.97% 0.00% 1.907456 14.000015 -1.319737 9.706595 2.245935 8.725067 17.175692 0.939548 0.686066 0.051987 0.586103
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% 1.680808 14.510543 5.511553 9.690752 -0.237072 8.508362 -0.101576 0.456890 0.626616 0.037888 0.550551
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.691939 0.303200 -0.812680 0.418639 -0.278258 1.301628 -0.694346 -0.164241 0.690009 0.701214 0.386302
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.668894 2.623078 -0.643136 4.971972 -0.949938 13.002514 0.273621 0.997391 0.682285 0.650318 0.403109
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 14.314421 -0.978544 3.378129 0.278955 8.645787 -0.681544 0.061082 -1.363152 0.038225 0.684949 0.575757
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.625034 -1.272335 0.669127 1.825303 -0.359144 -0.314992 -0.021315 0.040248 0.661440 0.677144 0.398037
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.325878 -0.234258 2.461847 1.304036 0.701207 1.635528 -0.471065 -0.738731 0.641133 0.675628 0.413070
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.781903 1.547537 -0.978901 2.129473 -0.835486 0.269420 -0.524346 -1.876424 0.654086 0.673331 0.420345
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.346809 0.295042 1.872600 1.119154 0.460505 -0.999326 -1.167281 -0.816381 0.644809 0.665096 0.431366
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.503144 -1.029009 8.729387 -1.506318 8.799342 0.988786 0.485598 0.834805 0.038083 0.654316 0.508207
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 5.413827 13.740567 7.305929 9.461599 5.108594 8.815619 0.867013 1.712821 0.468762 0.040553 0.385970
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.128556 -0.390496 -0.577703 0.255038 -0.506219 1.039669 0.264758 0.268765 0.643332 0.663735 0.408064
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.614562 -0.396317 -0.880933 -1.406021 2.177739 1.573752 3.698715 11.668041 0.658256 0.679126 0.408175
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.810911 28.784545 -1.005413 -0.762114 -0.578563 5.418215 -0.190316 36.906100 0.633670 0.561122 0.368785
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.895740 -1.118775 -0.717826 -1.111840 -0.624686 1.755552 0.408482 0.447674 0.670797 0.685599 0.393261
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.995068 34.094963 -0.572630 -0.632563 0.282072 1.400590 -0.235955 0.401217 0.672890 0.555279 0.350973
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 2.366784 0.559738 2.699953 1.725915 0.792429 -0.377229 0.913949 -0.853053 0.680891 0.694122 0.387803
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.129846 1.118442 -0.678219 0.073389 -0.359201 0.504786 -0.373249 1.033316 0.685277 0.693300 0.396159
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.747434 0.377285 0.985824 -0.503581 5.778298 2.330897 1.034571 1.240378 0.672679 0.690983 0.392130
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 34.102389 -0.019766 1.696433 0.187549 8.086699 0.222835 17.799496 -0.598588 0.528892 0.687001 0.398723
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.649074 1.548928 0.012809 0.017191 -0.048976 21.454285 3.541523 4.034373 0.669916 0.679348 0.401974
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.512388 -1.009440 -0.461455 3.288951 1.123357 -0.487861 -0.917173 2.540707 0.675343 0.666216 0.412159
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.808704 -1.058830 -0.385612 -0.756140 1.443427 0.786708 -0.457814 0.159782 0.660202 0.681249 0.416794
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.052178 -1.061857 -1.424551 -1.055659 0.471483 0.182557 -0.757775 -1.282955 0.657063 0.678244 0.419702
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 13.719719 -0.271375 9.229136 -1.338758 8.534446 -0.270567 0.690812 1.412227 0.039996 0.667969 0.572148
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.728457 -0.073307 1.178395 3.135176 0.529194 29.656862 -0.236627 2.833998 0.641410 0.641025 0.394504
180 N13 RF_maintenance 100.00% 0.00% 99.78% 0.00% 0.195479 14.919662 -0.647594 9.837235 1.448527 8.659162 15.740752 1.802882 0.664815 0.058855 0.584124
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.190850 0.017385 -0.526375 0.028444 -0.506808 0.244975 -0.303185 3.895658 0.670288 0.678353 0.398300
182 N13 digital_ok 100.00% 0.00% 98.00% 0.00% 0.435093 6.280503 -1.071811 6.083713 -0.104235 352.171058 9.033751 41.021727 0.676838 0.068297 0.548263
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.966115 1.154062 0.739566 4.522374 0.865437 -0.447230 0.824206 -0.111880 0.657504 0.631598 0.386418
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.377900 -0.182709 0.323523 3.068066 0.040260 -0.733382 0.737926 0.549495 0.665616 0.670718 0.387892
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 22.029412 -1.412472 7.328848 4.014485 8.483853 -1.114546 0.261069 -0.687902 0.367567 0.648638 0.431345
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.704869 -1.826614 -0.922581 -0.113104 1.346769 -0.407684 -0.327344 -0.805178 0.674194 0.687518 0.412924
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.160323 -0.583203 -0.190205 -0.607397 -0.591346 2.074439 0.582169 12.259934 0.669501 0.681129 0.404468
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 11.801331 13.458786 8.563067 9.489017 8.840942 8.797276 5.069518 0.964872 0.028644 0.031031 0.001088
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.975450 -1.334004 -1.132889 0.620839 -0.662416 -0.297502 -0.357517 -1.390403 0.641917 0.669145 0.431993
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.642091 1.281288 0.677775 -0.809682 0.254648 0.822048 9.914549 0.139724 0.625960 0.653177 0.433043
200 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.639797 52.752703 3.880002 0.582015 8.795431 6.544895 2.180561 0.931646 nan nan nan
201 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 20.519161 21.814626 3.021575 4.004987 3.967276 5.721641 -0.686632 -2.451600 nan nan nan
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% 19.741321 18.871210 1.690234 -0.687592 1.302029 0.999077 -0.853413 27.746041 nan nan nan
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
205 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 20.161782 19.482302 0.718784 -0.910054 -0.545360 0.939379 -0.556651 10.547945 nan nan nan
206 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 20.091309 19.581788 1.145136 -0.440753 0.312135 -1.055254 1.024655 3.664070 nan nan nan
207 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 20.806897 19.718646 1.451790 -0.341036 1.205551 3.966609 -0.434740 -0.568661 nan nan nan
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 22.294354 27.048946 8.768097 9.857883 7.983560 8.436075 14.476362 43.969469 nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 22.308040 23.457928 8.606261 8.841602 8.119684 8.689935 11.770454 9.983708 nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 26.742719 26.985449 2.053096 3.606034 -0.544395 -0.311329 -0.179705 -0.046817 nan nan nan
211 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 18.976508 19.433592 -0.457274 0.228496 -0.665194 -0.870174 1.784080 -0.625898 nan nan nan
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 289.762609 289.917190 inf inf 3528.800225 3541.431098 4410.068280 4485.164645 nan nan nan
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 19.329157 19.205820 0.580980 -0.145153 -0.340226 -0.540992 2.544505 -1.244106 nan nan nan
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 19.132931 19.081859 -0.521363 -0.348826 0.295380 -0.824485 1.888591 -0.916820 nan nan nan
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 19.116791 19.513523 0.191718 0.301531 0.713574 -0.959074 4.927138 -1.001994 nan nan nan
223 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 19.813919 20.028300 -0.801296 1.971680 -0.242499 3.999835 2.684873 1.745738 nan nan nan
224 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 23.126635 22.943793 5.068150 4.634927 6.737504 6.815427 -2.777736 -3.108787 nan nan nan
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 20.050733 26.380440 1.072769 4.299322 -0.494207 8.560657 -1.014878 0.375540 nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 19.623680 20.127641 0.390162 1.234475 -0.946457 1.538797 -0.760090 -1.164260 nan nan nan
227 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 19.429539 19.698653 -0.689027 0.238989 0.400588 -0.885147 14.094380 -0.354815 nan nan nan
228 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 33.956964 33.385117 -0.489800 -0.228674 3.795982 3.813909 45.599878 38.252996 nan nan nan
229 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 19.940107 19.834435 1.496047 1.294060 0.078229 0.304122 7.811810 -1.782828 nan nan nan
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 18.644707 18.576486 -0.285878 -0.882037 -0.101946 -0.368496 1.255874 -1.032257 nan nan nan
238 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 19.486827 19.037371 1.092190 0.526651 -0.010052 0.111302 -1.004085 -1.497558 nan nan nan
239 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 19.336212 19.525442 0.586332 0.795590 0.285916 -0.251063 -0.325189 1.779382 nan nan nan
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% 31.769178 62.618105 2.488115 1.139002 5.121774 6.241519 23.130951 26.868911 nan nan nan
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 19.849485 19.930678 -0.209255 0.505240 -0.576593 -0.243763 4.741048 16.301404 nan nan nan
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 63.150444 20.343513 0.113236 1.680959 13.650633 1.350059 30.687136 -0.939226 nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 78.251563 19.781531 0.689220 -0.802757 6.515175 -0.081106 -0.664309 -0.561183 nan nan nan
244 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 19.998995 19.048060 1.145976 -0.785874 1.915804 0.454807 3.645853 7.037634 nan nan nan
245 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 20.736351 19.932869 3.098936 0.877164 3.326858 0.003303 -1.823725 -0.258292 nan nan nan
246 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.586754 25.465711 -0.284568 -0.224448 3.620251 4.869890 3.186704 -0.358753 nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 20.211161 19.844246 0.860300 -0.069878 -0.164214 -0.845398 -0.339082 1.236106 nan nan nan
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 22.183953 23.590342 8.382252 9.500337 8.699684 8.150738 5.082750 24.018141 nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 12.783954 15.028504 4.343059 6.204813 3.311703 8.781463 12.674731 1.821242 0.402994 0.047743 0.311989
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 2.185006 3.357377 1.582155 1.842242 1.137503 1.136815 1.232483 -0.321532 0.539413 0.560791 0.395732
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.863765 -0.773889 1.686760 -0.915607 1.238784 -0.467891 -1.165530 -0.241311 0.566916 0.574104 0.402839
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.588938 -0.556235 -0.774585 -0.483750 0.362032 -0.865356 4.528277 0.215754 0.502923 0.567449 0.407499
333 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.282156 3.283243 -1.161610 -1.071951 -0.236734 -0.791128 1.094439 1.227159 0.502471 0.545402 0.390048
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, 15, 16, 17, 18, 21, 27, 28, 29, 30, 32, 34, 36, 37, 40, 42, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 73, 78, 79, 80, 81, 84, 86, 87, 88, 92, 94, 95, 96, 97, 100, 101, 102, 103, 104, 107, 108, 109, 110, 111, 113, 114, 115, 117, 119, 120, 121, 122, 123, 126, 128, 129, 130, 131, 132, 133, 135, 136, 138, 142, 143, 145, 146, 155, 156, 158, 159, 161, 164, 165, 166, 170, 179, 180, 182, 183, 185, 187, 189, 191, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 211, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 329, 333]

unflagged_ants: [5, 8, 10, 19, 20, 22, 31, 35, 38, 41, 43, 44, 45, 46, 48, 49, 61, 62, 64, 65, 66, 67, 69, 70, 74, 77, 82, 83, 85, 89, 90, 91, 93, 98, 99, 105, 106, 112, 116, 118, 124, 125, 127, 137, 139, 140, 141, 144, 147, 148, 149, 150, 157, 160, 162, 163, 167, 168, 169, 181, 184, 186, 190, 324, 325]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

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