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 = "2459947"
data_path = "/mnt/sn1/2459947"
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-2-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/2459947/zen.2459947.21321.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

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

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1849 ant_metrics files matching glob /mnt/sn1/2459947/zen.2459947.?????.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/2459947/zen.2459947.?????.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 2459947
Date 1-2-2023
LST Range 1.349 -- 11.301 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1849
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 94
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 18
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 65 / 201 (32.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 118 / 201 (58.7%)
Redcal Done? ❌
Never Flagged Antennas 83 / 201 (41.3%)
A Priori Good Antennas Flagged 52 / 94 total a priori good antennas:
3, 5, 7, 9, 15, 16, 17, 19, 20, 21, 29, 30,
31, 40, 42, 54, 55, 56, 67, 71, 72, 81, 86,
94, 98, 99, 100, 101, 103, 109, 111, 116, 121,
122, 123, 128, 129, 130, 136, 143, 146, 149,
161, 165, 170, 182, 183, 185, 187, 189, 191,
202
A Priori Bad Antennas Not Flagged 41 / 107 total a priori bad antennas:
4, 8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 82, 89, 90, 95, 114, 115, 125, 132, 135,
137, 139, 179, 205, 206, 207, 211, 220, 222,
223, 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_2459947.csv

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.534426 13.271002 9.536480 -1.355463 7.575929 5.097074 6.212495 1.720417 0.036620 0.377566 0.301420
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.527806 1.257335 -1.626776 -0.341077 -0.199940 -1.212383 3.197567 -0.049704 0.669472 0.670062 0.375329
5 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 3.685806 10.778127 -0.035035 0.172878 -0.201316 0.406907 1.399316 1.267679 0.669786 0.649198 0.367203
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.250239 -1.712920 0.864231 3.288181 0.315524 -0.119980 9.727182 5.443474 0.670114 0.655821 0.361562
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.273090 -1.528032 -0.732428 -0.180910 0.024237 0.256494 1.210303 2.023190 0.672404 0.670149 0.362077
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.158842 -0.772983 7.825366 0.219253 3.385065 0.622298 1.208344 1.567984 0.523972 0.666010 0.428462
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.422161 -0.372913 1.989218 -0.832115 0.188693 1.277648 3.437777 1.393039 0.651372 0.662980 0.369439
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.736881 19.218392 8.965970 -1.174846 7.579750 4.956191 5.932228 2.712200 0.037149 0.374451 0.288339
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.792527 -0.776943 9.505661 0.379519 7.581781 1.601386 6.154749 1.842440 0.036476 0.672280 0.549973
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.726249 7.849845 0.109934 0.423151 0.911414 0.389401 0.533248 0.558582 0.674412 0.658240 0.367652
18 N01 RF_maintenance 100.00% 100.00% 53.38% 0.00% 11.515685 22.830630 9.507418 -0.436796 7.693827 7.100336 6.140438 13.168200 0.031611 0.232634 0.178152
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.411743 -0.294558 -0.469533 4.331414 -0.363804 103.844504 0.266604 38.434603 0.680763 0.615488 0.385034
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.602782 -1.068730 2.462958 -1.212833 17.937980 -0.766554 15.573783 -0.673505 0.670096 0.677454 0.367629
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.050194 -0.169290 -0.085239 4.089999 0.230159 -0.662460 0.999871 1.439259 0.665137 0.638909 0.369839
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.317920 -0.964554 -0.381306 -0.533500 1.250467 1.179122 -0.491337 -0.400110 0.629695 0.631710 0.366510
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.099639 11.517733 9.551650 9.928131 7.676039 8.926907 6.927540 3.716374 0.040109 0.044019 0.005561
28 N01 RF_maintenance 100.00% 0.00% 81.02% 0.00% 11.182720 27.973500 -1.174577 0.867078 5.582443 8.025257 4.356185 13.768386 0.387104 0.169527 0.288821
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.765157 11.974849 9.167102 9.548499 7.673557 8.917466 6.278653 3.060659 0.031611 0.039712 0.008343
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.391219 0.127205 -0.083537 0.327800 10.508743 0.743248 -0.157337 0.133014 0.681637 0.680569 0.363255
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.393121 -0.073900 0.818185 1.140649 4.919242 -0.309226 10.617376 1.281608 0.690047 0.674915 0.361546
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.422342 1.785697 -0.363528 1.326649 1.133234 4.504277 2.202122 19.240485 0.678633 0.662875 0.355436
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.359849 13.166688 4.202716 4.469381 7.620506 8.870187 6.236256 3.124310 0.038282 0.049633 0.007422
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.342931 -0.515382 0.981138 -1.471937 0.459767 -1.473497 -0.476223 0.057517 0.638400 0.627210 0.367732
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.415371 7.945208 0.123460 0.123873 0.928878 1.990634 0.420226 0.178563 0.658304 0.656572 0.377947
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.521018 -0.028450 -1.337751 0.522905 0.314396 1.341922 -1.693104 0.896941 0.670036 0.665769 0.379512
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.040750 0.059337 0.084395 0.513111 0.667971 0.387126 2.528262 0.839625 0.676200 0.673204 0.375224
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 10.063864 0.212076 9.190223 0.327137 7.677561 -0.617862 6.185335 0.157371 0.042233 0.667445 0.524625
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.856869 -0.086085 -0.537918 -0.143949 1.000168 0.137269 -0.352037 0.574583 0.683168 0.677952 0.356841
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.413536 12.523067 9.781504 10.385952 7.486340 8.748294 5.977857 3.337571 0.026734 0.025973 0.001362
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.246972 0.394401 -0.399114 0.382997 -0.433897 0.577698 -0.432013 1.034273 0.691190 0.682451 0.359094
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.561536 0.215549 -1.587427 -0.064415 -0.411759 0.319707 -1.706385 -0.089158 0.690628 0.688890 0.359493
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.296685 1.004468 0.093341 0.292340 -0.083169 0.888043 0.002664 1.154537 0.683494 0.677468 0.356170
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.285468 1.628330 1.306169 1.585768 0.113496 0.701139 1.482977 -0.501730 0.675963 0.682392 0.373763
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.509043 12.846789 4.027401 4.104495 7.593913 8.829507 6.265910 2.805350 0.030657 0.053989 0.015795
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.282947 1.658942 0.267558 1.321245 -1.081681 0.988229 -1.119578 -0.751880 0.646438 0.649523 0.369169
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.246623 -0.437334 -1.102174 -0.061765 0.174216 -0.723977 -0.334501 -0.274170 0.603835 0.633063 0.371459
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.103492 3.740679 0.197598 0.749698 1.168699 1.590770 12.345806 12.748764 0.645447 0.642744 0.363451
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 24.322234 4.092211 12.177778 -0.815462 7.829495 4.856897 9.649454 0.732824 0.044998 0.550954 0.426337
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.779724 6.421556 -0.587645 0.335948 1.015498 1.102463 0.546666 0.401489 0.678481 0.674297 0.368657
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.564653 2.458928 -0.217921 0.000907 0.600297 1.316261 0.715044 2.085910 0.687819 0.682691 0.370369
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.599864 12.206981 9.559290 10.148477 7.673439 8.917100 6.872497 3.387166 0.026733 0.025843 0.001247
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.101969 12.859798 9.578361 10.052911 7.675598 8.928140 6.249752 4.136269 0.029054 0.034425 0.004819
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.094938 13.022795 0.339981 10.261394 -0.159485 8.821086 0.389675 3.169798 0.687161 0.042307 0.562654
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 20.376339 0.802638 7.564182 0.405460 8.362207 0.848532 4.608974 0.419576 0.424349 0.686069 0.397263
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.055935 11.840615 9.442585 10.037148 7.574870 8.846986 6.465723 3.287247 0.040778 0.040093 0.001697
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.288137 0.672281 9.497276 1.327022 7.469255 3.995019 6.014756 2.379536 0.052603 0.679022 0.538053
60 N05 RF_maintenance 100.00% 0.00% 99.19% 0.00% 0.735052 11.719809 -0.511802 10.069245 0.089702 8.865587 -0.026118 4.143989 0.682806 0.078435 0.548292
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 3.045681 -0.244549 -0.334812 -1.517822 0.574055 -1.655958 -1.219206 -0.450250 0.622028 0.645079 0.360703
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.621048 0.643242 -0.456046 0.810419 -0.472933 -0.264330 -0.305456 -0.598232 0.614560 0.651956 0.370063
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.143695 12.365510 -0.769142 4.502873 -0.962683 8.930934 -1.324099 4.006660 0.640280 0.048852 0.506097
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.011510 0.048169 -1.024867 -1.088514 -1.382368 -1.180397 -0.567246 0.897566 0.625914 0.613056 0.359397
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.421064 0.687767 0.408127 0.904477 0.269943 0.967532 0.864900 0.219174 0.650810 0.656648 0.386072
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.137247 1.179597 2.117779 1.888381 1.295524 0.007138 1.737361 0.853715 0.661642 0.664833 0.377008
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.512329 8.326264 2.049597 1.948941 -0.300935 0.235283 2.142541 1.401034 0.672440 0.658063 0.363041
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 22.316985 27.241286 1.089295 13.270464 4.767010 8.878740 3.966344 7.426039 0.383498 0.033994 0.285744
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.260012 -0.679556 0.262015 0.473438 -0.335344 2.065877 0.279668 -0.082959 0.683600 0.683979 0.357460
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.221334 0.157023 -0.457193 -0.203152 0.451355 1.337880 0.005092 0.965607 0.687763 0.686515 0.352236
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.102548 -0.148035 0.403941 0.878217 1.369748 1.002768 1.038727 0.390571 0.700862 0.693056 0.353958
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.596214 13.037692 9.886688 10.412281 7.511088 8.763849 6.085132 3.225194 0.026535 0.025200 0.001499
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.996954 0.256894 -1.268533 2.298014 0.232474 2.507355 -1.853350 0.236635 0.701060 0.681702 0.354130
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.667460 0.735752 -0.346927 -0.777045 -0.548240 2.219471 -1.658294 0.252134 0.695155 0.689849 0.353974
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 28.446151 0.472754 -0.270961 -0.454589 2.321084 -0.973207 0.886818 -0.954708 0.530331 0.648087 0.344426
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 32.487925 0.204502 -0.756397 0.953180 2.573903 2.731024 1.507940 0.018662 0.468181 0.657367 0.369193
79 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.401003 -0.598078 -1.632633 -0.353635 10.992490 2.162134 2.822066 -0.953653 0.623763 0.646412 0.375438
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.834406 13.486166 -0.396243 4.414829 -0.113073 8.826917 0.491970 3.342554 0.622340 0.053628 0.473878
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.696123 12.640881 -0.197890 8.700752 -1.011726 8.664994 -0.111948 3.756436 0.629841 0.043004 0.482233
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.167387 -0.685514 0.165798 1.895748 -0.367870 -0.238461 0.056018 0.029431 0.649793 0.643493 0.371750
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.931456 0.094819 -0.000907 0.168142 0.308780 -0.322163 -0.256915 0.455539 0.661884 0.664678 0.368029
84 N08 RF_maintenance 100.00% 47.38% 100.00% 0.00% 20.114930 23.607979 12.287450 12.832189 6.137676 8.780387 5.343109 4.963811 0.267088 0.039642 0.174323
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.066696 -0.214321 0.400599 1.171414 -0.706275 -0.088519 0.091419 -0.002664 0.684294 0.679075 0.357757
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.323417 -0.635871 1.696780 1.427548 1.903523 -0.265990 0.521002 7.965940 0.668407 0.675106 0.341492
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.927484 7.161809 -0.577012 -0.254764 4.738927 0.340465 0.751534 0.035386 0.691128 0.696082 0.344679
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.347316 0.049515 0.134697 0.725544 -0.549440 -0.272151 3.209133 1.135698 0.693907 0.689154 0.342694
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.681538 -0.042833 0.031433 0.714426 -0.594884 -0.797924 -0.242539 -0.232094 0.697396 0.689793 0.346743
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.671398 -0.993389 1.318255 1.197285 -0.435269 -0.532969 0.665284 1.796032 0.687107 0.682693 0.345922
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.581576 -0.328342 0.292147 0.219641 -1.076628 0.148215 0.178668 0.102801 0.686758 0.687997 0.357531
92 N10 RF_maintenance 100.00% 0.00% 9.68% 0.00% 36.699324 43.771096 0.455854 -0.017972 5.294303 5.939018 4.013698 2.659724 0.306237 0.263896 0.084677
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.993766 0.457152 2.015019 0.216594 0.014846 1.038953 3.368676 -0.085148 0.672670 0.675655 0.362920
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.651177 12.299995 9.691057 9.939493 7.648875 8.871115 6.199439 3.126394 0.035249 0.028098 0.003354
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.401722 -0.622897 -1.112535 0.413694 -0.774776 -0.616047 -1.579550 -0.035285 0.642055 0.655732 0.374156
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.816177 13.011301 4.033995 4.572911 7.495466 8.744400 6.271044 3.137037 0.035811 0.043804 0.003789
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.334809 8.516328 -1.004217 2.874230 0.839427 4.722821 -0.852652 1.232484 0.624034 0.481742 0.394938
98 N07 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
99 N07 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
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% 8.258413 8.503107 -0.490494 0.871210 0.543225 1.729642 0.173130 0.407486 0.679007 0.676164 0.361604
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.053593 0.463754 -1.680024 2.076002 0.874202 8.601618 -1.468398 1.192577 0.687114 0.673790 0.353745
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.239718 4.961930 -1.298232 -0.525716 59.106421 0.374544 3.292779 0.824228 0.689685 0.688242 0.345845
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.703727 60.259957 6.802748 7.012758 2.652341 0.641729 0.748406 0.699172 0.638731 0.662546 0.346584
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.779075 -0.593751 -0.135274 0.705185 -0.005946 -0.061937 -0.155235 -0.202824 0.699202 0.688675 0.342427
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.016386 -0.451527 0.917640 0.984167 -0.004564 -0.750163 0.266462 -0.105030 0.688731 0.682698 0.338635
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 2.064768 0.545705 -0.980554 -1.068673 1.181783 0.139583 1.685802 1.365468 0.696431 0.695879 0.345958
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.710395 41.382898 9.500550 0.597489 7.641454 6.263402 6.578176 3.283660 0.040520 0.310009 0.166817
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.442374 11.852931 9.538134 9.814821 7.705599 8.946952 6.069101 3.686207 0.026776 0.027640 0.001379
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.498849 25.629576 12.717208 13.006009 7.585823 8.716873 7.090925 4.706560 0.026117 0.029977 0.001965
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.059015 11.756622 0.461476 9.915148 0.107294 8.946848 1.845711 3.885437 0.678203 0.039940 0.470211
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.149422 -0.793652 0.011931 -0.108238 1.066447 2.051179 0.669280 0.034194 0.667598 0.671606 0.372736
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.636920 13.095901 3.826869 4.470780 7.516944 8.775948 6.498717 3.070012 0.039749 0.031481 0.004129
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.898339 0.645867 -1.509799 -0.408332 0.536964 -0.825704 -1.340418 -0.608513 0.615547 0.639285 0.377658
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.027836 1.346773 0.983989 1.776759 -0.404486 1.750822 -0.718497 -0.859850 0.621751 0.632866 0.390752
116 N07 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.544976 13.498408 9.608599 10.396652 7.533279 8.863980 6.349835 4.541091 0.028956 0.036095 0.004746
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.420771 1.025923 -0.167457 0.455215 0.439387 0.227963 -0.064865 0.098772 0.651629 0.660027 0.376527
119 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.006077 2.327368 2.379407 1.850727 0.261890 1.320481 4.164063 0.234579 0.666307 0.673657 0.353995
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.355061 2.159040 -1.592570 7.740084 0.182954 12.612665 0.063417 11.608981 0.691286 0.625089 0.361610
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.909866 7.849365 0.082603 0.705110 1.378213 2.435693 0.465093 0.015151 0.699639 0.692548 0.347452
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.142098 7.878069 0.503516 0.839500 0.681270 0.930106 1.053381 0.527706 0.704138 0.695831 0.346326
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.701797 0.062038 -0.062111 0.475160 0.004564 0.086177 0.781576 0.287477 0.705634 0.696471 0.348734
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.158159 -0.783785 -0.319566 0.822590 0.351889 -0.175432 -0.274460 -0.114210 0.700547 0.694148 0.348805
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 30.426352 4.789412 -0.342490 1.250604 4.050449 3.739881 3.188335 0.982565 0.582837 0.689275 0.330120
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.014502 0.011510 0.098087 0.205366 1.758749 1.513232 0.038563 0.648176 0.692849 0.695262 0.359553
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.714543 11.354911 9.598312 10.031677 7.555948 8.817568 5.972504 3.100120 0.034496 0.031117 0.001638
129 N10 digital_ok 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.223027 0.328160 0.140280
130 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.082959 0.071876 0.006350
131 N11 not_connected 100.00% 0.00% 17.09% 0.00% -0.929764 12.289762 -0.358374 4.423930 -0.981676 8.025545 -1.755281 2.020782 0.649509 0.278217 0.443368
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.856339 1.392040 -0.649828 -1.690784 -0.338866 -0.881830 -1.700612 -0.658196 0.629655 0.627641 0.373189
133 N11 not_connected 100.00% 100.00% 0.00% 0.00% 12.162057 -0.229855 3.824130 -1.545413 7.603352 -1.220972 6.504577 -0.390210 0.048105 0.621497 0.457823
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.567282 -1.033041 -0.476236 -1.727200 3.557338 2.865335 3.552113 0.679702 0.629502 0.643663 0.396118
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 9.613712 0.231435 9.137428 1.525838 7.684197 8.384176 6.575020 0.576293 0.045016 0.631275 0.466431
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.384426 -0.968244 -0.218111 -1.512266 0.809157 -0.279500 0.515713 0.102014 0.638912 0.654629 0.381502
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% 0.435337 -0.663805 1.088659 -1.136356 -0.288537 -1.200005 -0.061103 -0.310985 0.662668 0.658959 0.363045
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.180976 -0.799721 -1.047620 -0.650423 -0.133140 -0.872269 0.342857 -0.047782 0.682470 0.688054 0.353952
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.395795 -0.784854 -0.631322 0.257071 1.868535 -1.207621 -0.159385 -0.882312 0.689584 0.691153 0.350854
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.676173 11.727429 -1.054161 10.075347 1.507646 8.894544 5.100501 3.625258 0.694645 0.050655 0.547501
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% 1.157773 12.286299 5.957046 10.057708 -0.491300 8.723988 0.275173 3.254308 0.643249 0.042016 0.512133
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.344083 -0.109746 -0.486305 1.371834 0.280802 0.597297 -0.161602 0.102439 0.702401 0.693065 0.347642
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.171377 1.351554 -0.387551 5.323476 -0.051742 11.336450 0.156477 0.780370 0.702254 0.652936 0.363549
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 11.872662 -0.121589 3.828528 -0.432297 7.551990 -0.847700 5.913951 -1.077128 0.041891 0.683022 0.517346
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.703533 -1.497089 1.109691 1.967932 -0.681011 -0.153635 1.296634 0.366589 0.685736 0.680444 0.354309
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -2.141065 -0.294493 2.904271 1.446957 -0.480775 1.541443 1.148519 0.110738 0.668549 0.680924 0.366018
149 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.091161 0.994894 -1.705631 1.458293 11.299462 0.395841 6.331152 -0.430096 0.678318 0.676135 0.373941
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.791524 -0.296338 1.015110 0.408442 -0.311392 -1.054067 -0.453378 -0.966165 0.666680 0.672342 0.384659
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.160614 -0.987727 9.225699 -1.326916 7.683640 1.256215 6.131283 1.049136 0.041160 0.643689 0.472292
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 5.643044 11.529463 8.442139 9.827358 4.720098 8.948697 1.414829 3.828115 0.415844 0.043417 0.313936
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.350053 -0.360320 -0.178920 0.413725 -0.410611 0.474145 0.961298 0.453547 0.646438 0.653594 0.379707
158 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.227169 -0.427112 -0.462286 -0.919458 1.190178 1.776222 0.992596 3.901407 0.661836 0.669720 0.379595
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.395589 31.365500 -1.716246 -0.838174 -1.406593 2.624877 -0.913104 4.609814 0.638029 0.511063 0.340947
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.984171 -1.126246 -0.409458 -0.973613 -0.374637 0.660087 0.210616 -0.106930 0.678233 0.678451 0.357615
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.036066 28.541574 -0.225760 -0.756277 0.071904 1.041332 0.124423 0.966189 0.685393 0.558595 0.327793
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.553047 0.067803 1.871165 1.038379 0.508571 -0.856121 0.866586 -0.754061 0.684954 0.690675 0.356389
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.167124 1.117516 -0.368220 0.209510 0.089377 0.928790 -0.074778 0.372993 0.700930 0.694399 0.353191
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.043581 0.387930 1.204847 -0.368673 3.781885 2.412093 1.274210 0.215146 0.693925 0.694779 0.347817
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 29.685287 0.142082 2.254407 0.418993 2.767426 0.162867 0.811429 0.295729 0.547796 0.692125 0.335254
166 N14 RF_maintenance 100.00% 1.89% 0.00% 0.00% 0.754312 2.220890 1.370124 0.433684 39.285841 -0.199336 1.815967 -0.579425 0.647613 0.694884 0.374586
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.261982 -1.368383 -1.261233 3.577702 0.371785 -0.511186 -1.741332 1.009453 0.698667 0.672518 0.363672
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.885740 -1.255767 -0.030503 -0.547539 1.372967 0.779247 0.260962 0.168303 0.688065 0.687382 0.365470
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.930794 -1.031951 -1.114942 -1.714001 0.234454 0.254641 -0.792318 -0.964649 0.683239 0.683960 0.368615
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.314806 -0.668014 9.724779 -1.042380 7.508531 1.210767 6.179304 0.629099 0.043022 0.676178 0.525008
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.310778 -0.220320 1.083670 2.149370 0.066579 0.729910 1.312846 0.489225 0.652146 0.653433 0.368764
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.015769 12.476828 -0.328681 10.203401 1.130739 8.838537 3.565300 4.016386 0.673608 0.056921 0.546791
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.418500 -0.199512 -0.064541 0.234061 0.926396 0.742862 0.259518 1.787774 0.684104 0.680099 0.361390
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.060263 11.569736 -0.250696 9.807328 1.494337 8.947239 0.884285 3.788468 0.693888 0.054889 0.518830
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.502523 0.662994 1.091789 4.768187 0.670614 -0.804287 1.003007 -0.007179 0.674027 0.641998 0.336375
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.388324 -0.475840 0.664571 3.249181 0.028439 -1.095572 1.747306 0.827332 0.692817 0.675559 0.343715
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 17.441202 -1.458558 7.983058 4.318549 7.727330 -1.011433 2.502282 0.242811 0.402363 0.659536 0.390530
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.810033 -1.494456 -1.736247 -0.684410 0.604915 -0.810491 -1.410965 -1.138245 0.700568 0.699048 0.360364
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.022924 -0.922380 -1.717219 2.874464 14.587871 1.396982 5.368814 6.660995 0.694781 0.678548 0.353075
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.553418 11.308045 9.063281 9.861815 7.797974 8.959796 7.029762 3.359554 0.029857 0.034799 0.002574
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.306979 -1.657032 -0.803415 -0.100834 -0.167991 -1.038196 -0.363804 -0.998194 0.675613 0.681132 0.378271
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.593780 0.196612 1.058754 -0.657721 1.753793 0.574772 8.372787 0.148617 0.660721 0.666292 0.378986
200 N18 RF_maintenance 100.00% 100.00% 44.46% 0.00% 12.422302 34.667506 3.993170 0.310928 7.712123 6.981885 6.534387 2.027993 0.046153 0.229893 0.153427
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.275267 4.983608 2.440260 3.649037 2.591893 5.890392 1.544544 0.536723 0.664602 0.648833 0.367187
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.091593 0.786040 1.174218 -1.532144 -0.075680 -0.126756 -0.326827 11.742071 0.676336 0.660342 0.357987
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.038812 0.034351 -0.078182
205 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.213499 2.552469 0.246981 -1.143574 -1.008738 -0.811126 -0.169140 1.597534 0.668439 0.649799 0.352690
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 1.387625 2.309115 0.605828 -0.346381 1.145020 -1.053289 -0.040895 -0.351897 0.670987 0.659283 0.352999
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.721222 3.363815 0.945574 -0.241563 0.069722 -0.356644 -0.090057 -0.761086 0.655555 0.646473 0.338449
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.342940 9.928014 8.677444 11.493689 7.033260 9.366439 11.646281 55.557799 0.037396 0.036788 0.001098
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.234017 7.708630 8.939337 8.845794 6.989458 8.921162 15.779775 10.298290 0.044491 0.044745 0.001330
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 12.755343 11.931703 -0.971479 -1.037964 -0.530609 -0.326615 -0.732950 -0.578722 0.666407 0.663093 0.373290
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.627866 -0.995059 -1.284482 -0.288819 -1.186797 -0.961897 -0.872397 -1.045516 0.623329 0.637607 0.374486
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.496430 -1.713527 0.056052 -0.794247 -1.112577 -0.645040 0.426223 -1.028237 0.665749 0.657490 0.358708
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.177271 -0.298104 -1.154664 -1.120699 6.043581 -1.084730 -0.668942 -0.874511 0.661012 0.663104 0.358939
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.196503 -0.437553 -0.462212 -0.199389 -0.934792 -1.383563 -1.005535 -1.084348 0.666221 0.670736 0.363361
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.857040 2.251987 -1.721025 0.740687 -1.221995 -0.440597 -0.799639 -0.314681 0.655679 0.672804 0.364647
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.974844 6.520310 4.640576 4.272462 6.381160 7.121606 4.383363 0.915514 0.631900 0.642966 0.368027
225 N19 RF_ok 100.00% 0.00% 86.97% 0.00% 1.260356 12.275506 0.598267 4.262373 -1.041934 8.745564 -0.539431 3.110833 0.670496 0.137438 0.554158
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.336758 7.410075 -0.231467 0.821385 -1.234160 1.841942 -1.580363 -0.147728 0.665101 0.632172 0.358857
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 2.149762 0.571688 -1.658878 -0.304621 -0.252293 -1.055539 5.781229 0.692412 0.634271 0.648200 0.353170
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 15.684652 22.429189 -0.836919 -0.655020 3.321253 3.856587 35.878862 21.891051 0.553584 0.532077 0.272347
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.731801 -0.174465 1.235016 0.931414 -0.453181 0.208102 -0.679814 -0.824425 0.640739 0.646672 0.380483
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.434375 -0.128608 -0.284117 -1.716809 -0.934075 -1.254096 -1.144023 -0.799466 0.617373 0.640960 0.371012
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.677584 -0.534210 0.587365 0.130734 -0.969000 -0.798320 -1.215990 -1.082663 0.662579 0.658887 0.370779
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.068182 -0.802527 0.044065 0.452407 -1.062559 -0.760098 -1.289203 -0.603412 0.662207 0.662660 0.367585
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.075467 42.181246 2.055873 1.051628 4.877383 6.049592 12.271603 3.299609 0.541661 0.436863 0.269243
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.607034 3.422292 -1.026065 0.442082 -0.533373 -0.532653 1.401214 6.558305 0.652263 0.617820 0.366825
242 N19 RF_ok 100.00% 5.35% 0.00% 0.00% 63.127801 1.210362 0.316646 0.686626 7.940524 13.089753 5.216942 4.119875 0.327782 0.660154 0.499558
243 N19 RF_ok 100.00% 3.84% 0.00% 0.00% 61.897503 2.273975 0.560010 -1.655491 6.194771 -0.555749 3.000388 -0.430742 0.321197 0.643208 0.479131
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.564769 1.640850 1.255807 -0.738312 1.847755 0.060532 0.601385 1.435034 0.559397 0.621982 0.357704
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.533506 2.415478 -0.141599 -1.238845 -0.889482 -1.032670 -1.070243 -0.387026 0.640653 0.631590 0.369582
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.190113 8.197911 -1.048236 -0.827260 4.387450 5.446418 4.728377 1.044246 0.351727 0.352954 0.164879
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.254811 1.130614 0.373824 -0.712519 -0.644312 -1.388537 1.191097 -0.567509 0.643667 0.636828 0.370466
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.080319 7.781208 8.817098 9.259504 7.522426 8.365128 13.267861 14.051896 0.036880 0.030214 0.006150
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 10.853329 12.777887 4.942256 6.554057 2.958196 8.947948 14.455932 4.214067 0.389863 0.050525 0.302719
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.963491 2.304081 0.747938 1.118423 0.458689 1.104794 1.926842 1.251972 0.539096 0.548069 0.376581
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.369470 -0.985184 0.855890 -1.626306 0.431669 -0.685212 -0.825308 2.143622 0.589166 0.570910 0.364713
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 0.298363 -1.127573 -0.375528 -0.665747 1.403398 -1.273980 4.452222 1.024372 0.536166 0.553736 0.381968
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.742413 1.343093 -0.857377 -1.689184 -0.942405 -1.122811 3.762482 1.661958 0.498826 0.533040 0.380885
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, 5, 7, 9, 15, 16, 17, 18, 19, 20, 21, 27, 28, 29, 30, 31, 32, 34, 36, 40, 42, 47, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 63, 67, 68, 71, 72, 77, 78, 79, 80, 81, 84, 86, 87, 92, 94, 96, 97, 98, 99, 100, 101, 102, 103, 104, 108, 109, 110, 111, 113, 116, 117, 119, 120, 121, 122, 123, 126, 128, 129, 130, 131, 133, 136, 138, 142, 143, 145, 146, 149, 155, 156, 159, 161, 165, 166, 170, 180, 182, 183, 185, 187, 189, 191, 200, 201, 202, 203, 208, 209, 210, 219, 221, 224, 225, 226, 227, 228, 240, 241, 242, 243, 244, 246, 262, 320, 329]

unflagged_ants: [4, 8, 10, 22, 35, 37, 38, 41, 43, 44, 45, 46, 48, 49, 53, 61, 62, 64, 65, 66, 69, 70, 73, 74, 82, 83, 85, 88, 89, 90, 91, 93, 95, 105, 106, 107, 112, 114, 115, 118, 124, 125, 127, 132, 135, 137, 139, 140, 141, 144, 147, 148, 150, 157, 158, 160, 162, 163, 164, 167, 168, 169, 179, 181, 184, 186, 190, 205, 206, 207, 211, 220, 222, 223, 229, 237, 238, 239, 245, 261, 324, 325, 333]

golden_ants: [10, 37, 38, 41, 44, 45, 53, 65, 66, 69, 70, 83, 85, 88, 91, 93, 105, 106, 107, 112, 118, 124, 127, 140, 141, 144, 147, 148, 150, 157, 158, 160, 162, 163, 164, 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_2459947.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 [ ]: