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 = "2459957"
data_path = "/mnt/sn1/2459957"
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-12-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/2459957/zen.2459957.21313.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

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

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1850 ant_metrics files matching glob /mnt/sn1/2459957/zen.2459957.?????.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/2459957/zen.2459957.?????.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 2459957
Date 1-12-2023
LST Range 2.005 -- 11.961 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 196
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 196 (0.0%)
Antennas in Commanded State (observed) 0 / 196 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 55 / 196 (28.1%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 119 / 196 (60.7%)
Redcal Done? ❌
Never Flagged Antennas 77 / 196 (39.3%)
A Priori Good Antennas Flagged 48 / 93 total a priori good antennas:
3, 7, 9, 10, 15, 16, 29, 38, 40, 42, 54, 55,
56, 71, 72, 81, 86, 94, 101, 103, 109, 111,
121, 122, 123, 128, 136, 140, 143, 146, 151,
158, 161, 164, 165, 167, 169, 170, 173, 182,
185, 186, 187, 189, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 32 / 103 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 61, 62, 73, 74, 89,
90, 95, 114, 115, 125, 132, 137, 139, 179,
205, 211, 220, 222, 229, 237, 238, 239, 245,
324, 325, 329
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_2459957.csv

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 9.739900 12.624992 9.795024 -1.114724 11.362427 6.710393 0.083215 7.882953 0.032481 0.348953 0.276322
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.526175 1.058692 0.599444 1.434233 7.597119 0.650761 2.693225 1.130734 0.615305 0.635596 0.400951
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.217344 -0.098425 0.163450 0.006794 0.025212 2.249567 0.701699 0.774854 0.620374 0.636577 0.396168
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.256993 -0.382240 -1.338658 -0.531700 -0.259544 0.236471 13.324686 9.372932 0.625203 0.641214 0.390347
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.055588 -1.458601 -0.791690 -0.179205 -0.145898 0.362484 3.870274 0.828789 0.626438 0.639293 0.387459
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.244154 -1.266143 8.102120 -0.690638 6.269619 -0.056018 -0.244501 -0.871168 0.452448 0.638532 0.463368
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 1.413549 -0.533111 -1.453597 -1.560790 0.280320 1.858352 1.565703 9.898350 0.616613 0.636507 0.393144
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.088060 16.810206 9.723977 -0.027185 11.398433 6.166184 -0.216385 1.962311 0.031529 0.346005 0.265048
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 9.925205 -0.572087 9.757976 0.677172 11.370794 1.701485 0.417267 2.367498 0.031721 0.640737 0.517768
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.885751 1.513747 0.253535 0.103396 -0.156729 0.562486 0.561282 0.485929 0.629015 0.643978 0.395381
18 N01 RF_maintenance 100.00% 100.00% 43.46% 0.00% 10.563653 17.077460 9.724109 -0.997764 11.528039 8.823546 0.072784 16.055592 0.029665 0.230407 0.176714
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 2.109065 -0.780994 -1.417798 -0.770630 1.536839 2.269928 0.801884 2.227574 0.626738 0.649698 0.385683
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.482363 -1.333422 2.345085 -1.298928 -0.003024 0.587282 0.605788 -0.525547 0.624415 0.648428 0.394834
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.037457 -0.370433 -0.830899 -0.109956 0.735845 2.319274 -0.111513 0.074695 0.617512 0.632586 0.386268
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.836527 -0.225214 0.753347 0.596603 1.514417 1.611527 0.955671 -0.743897 0.583574 0.602090 0.384490
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.229542 11.215447 9.785155 10.150468 11.522139 13.263856 1.804364 0.948627 0.034877 0.038153 0.005038
28 N01 RF_maintenance 100.00% 0.00% 85.19% 0.00% 11.142252 24.090097 -0.917191 0.673080 8.781168 9.670472 4.342112 18.216447 0.360579 0.159778 0.270633
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 9.948632 11.621637 9.364524 9.732195 11.481616 13.208182 0.083331 -0.356016 0.029422 0.035428 0.006266
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.258318 -0.119927 0.059261 0.358583 0.096376 -0.298319 3.382688 0.394258 0.635498 0.652736 0.387413
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.715478 0.003748 1.121404 0.809397 1.176336 0.038793 0.074314 3.089916 0.645534 0.643938 0.382015
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.797008 22.539006 -0.332731 2.615667 -0.150055 0.919087 0.530682 6.148047 0.634874 0.543980 0.368892
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.465349 12.842720 4.008774 4.248896 11.574337 13.289867 3.938462 3.572728 0.032861 0.044215 0.007819
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.078812 0.285042 1.257070 -1.585955 -0.132573 -0.592072 -0.144840 1.162480 0.597159 0.587688 0.379533
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 24.861544 24.773624 13.109890 12.970728 11.632302 13.103205 3.708947 3.684596 0.031377 0.029050 0.001366
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.064084 0.522123 -1.406929 1.283174 0.481150 0.919824 -0.991026 1.790876 0.631449 0.636539 0.403730
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.073066 0.387250 -0.056098 0.400089 0.547970 0.207560 4.229764 0.332838 0.636119 0.646401 0.404481
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 9.318922 -0.080503 9.395041 0.266689 11.501314 -0.419304 1.796752 0.637294 0.036895 0.640962 0.502752
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.623756 -0.103518 -0.161326 -0.205157 1.897146 0.222602 0.009890 0.982394 0.634751 0.649891 0.382247
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.556225 12.247528 10.086238 10.690708 11.159734 12.909370 0.135281 0.826243 0.026566 0.025852 0.001335
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.186051 0.303382 -0.362364 0.459428 -0.201956 0.443993 1.047711 1.500610 0.635840 0.642976 0.380093
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.562753 -0.157328 -0.905723 -0.132872 -0.307744 0.002359 -0.478080 -0.229327 0.639715 0.652449 0.379754
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.051079 1.617078 -0.004288 0.468810 -0.232821 1.761725 0.458124 3.652870 0.630988 0.638471 0.373478
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.110116 0.325166 -1.132100 -0.854745 -0.479791 -0.707656 -0.572601 -0.986852 0.632279 0.655106 0.395507
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.660700 12.527253 3.828326 3.865176 11.403749 13.109545 1.325698 0.516095 0.029450 0.047004 0.012232
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.074829 0.820931 0.791786 2.344345 -0.631581 2.662574 0.234158 -1.346906 0.598651 0.621457 0.388259
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.023002 -0.071980 -1.343541 0.011153 0.977521 -0.054044 1.134184 5.237687 0.544254 0.590368 0.385137
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 21.840704 1.467208 0.710127 0.788214 2.449653 0.919931 17.762468 2.733370 0.546897 0.619259 0.374303
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 21.951822 4.258898 12.562690 -0.692304 11.698976 5.172763 7.273437 1.642845 0.038846 0.527820 0.402952
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.110132 6.506236 -0.504780 0.337059 1.312547 0.299223 0.002722 -0.115441 0.638444 0.647608 0.393795
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.040476 2.782068 0.004288 0.185551 1.368622 1.666000 1.708810 2.737845 0.644555 0.654497 0.396530
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.727475 11.836515 9.804059 10.391163 11.421663 13.146131 1.179714 0.139343 0.026550 0.025627 0.001218
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.167597 12.487091 9.810492 10.277489 11.513521 13.216602 0.837772 2.434664 0.027537 0.030832 0.003080
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% -0.200362 12.684297 0.345922 10.531618 -0.460401 13.070544 1.261865 1.160927 0.642944 0.037444 0.527375
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 20.603968 6.930125 6.786382 0.911374 8.008649 7.063187 32.449912 5.520348 0.463738 0.654797 0.403601
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.347969 11.565228 9.694975 10.285493 11.399727 13.163799 1.916203 1.608384 0.033549 0.033675 0.001501
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.429951 0.682436 9.778947 2.407029 11.221488 1.193840 1.619813 13.353742 0.043441 0.633395 0.507273
60 N05 RF_maintenance 100.00% 0.00% 99.89% 0.00% 0.536330 11.466134 -0.546879 10.311849 -0.145404 13.253980 2.597232 3.603910 0.631983 0.062845 0.517321
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.823206 0.482162 -0.985058 -1.561078 1.728020 -1.080108 0.657187 1.203002 0.570922 0.605197 0.375930
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.933942 0.445270 -0.957726 1.508145 -0.285067 0.146600 2.617100 -0.203505 0.561020 0.618909 0.393096
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.089774 11.938905 -0.000990 4.274253 0.564263 13.369361 1.361161 3.872839 0.594022 0.043330 0.476352
64 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.405212 0.588148 -0.880263 -1.270167 -0.809977 -0.538750 6.464815 1.960244 0.572908 0.569612 0.366929
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.510519 1.088914 0.210169 0.953933 0.094162 -0.039852 -0.286951 -0.432621 0.616042 0.633250 0.409286
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.415267 1.454185 -1.395292 -1.479455 3.344388 -0.448388 -0.893745 -0.344532 0.632514 0.648806 0.403821
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.530431 -0.351607 -1.147986 0.507583 -0.604794 -0.052882 -0.135663 1.381588 0.636487 0.646845 0.393371
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 20.069801 25.055776 1.128877 13.690725 6.749224 13.223496 -0.154207 8.969447 0.362639 0.029340 0.267093
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.776896 -0.707871 0.043223 0.638518 -0.002359 0.930666 -0.211967 -0.040627 0.640317 0.654855 0.379937
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.358580 -0.478987 -0.256579 -0.098993 1.037838 1.050856 0.770254 0.217485 0.645983 0.659550 0.378139
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.903939 0.038946 0.563445 0.678118 0.819278 -0.077818 2.036185 1.375266 0.658879 0.656426 0.372990
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.856570 12.728781 10.196621 10.709317 11.231145 12.950900 0.583209 0.733835 0.026559 0.025054 0.001573
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.617207 0.764221 -1.525744 -1.407570 0.377234 1.191084 0.003840 -0.263871 0.649519 0.659669 0.376477
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.694918 0.027518 0.693857 -1.463309 0.430072 1.183499 -0.611751 3.531743 0.648159 0.655676 0.373436
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 42.593242 0.728213 0.164386 0.125523 8.330130 -0.181067 16.142182 0.768318 0.397776 0.610947 0.386297
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 32.890562 -0.223048 -0.395548 1.499046 3.491757 0.689328 2.453786 2.817373 0.419435 0.622271 0.379248
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.683236 12.296473 -1.477951 4.304170 -0.470687 13.066675 1.286395 -0.683548 0.591431 0.040214 0.458842
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.984791 13.113283 0.119272 4.197221 0.743134 13.110809 10.664059 0.637925 0.590755 0.045245 0.463412
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.224919 12.414732 -0.013962 8.884774 -0.251967 12.827883 1.890122 3.112212 0.588527 0.037785 0.455802
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.266675 9.199177 0.243213 8.189441 0.013901 10.415396 1.731924 1.960666 0.610258 0.319720 0.440261
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.715385 -0.035004 0.068537 0.147273 0.607448 -0.676853 -0.099940 0.657949 0.621410 0.640398 0.391106
84 N08 RF_maintenance 100.00% 76.92% 100.00% 0.00% 19.441579 22.161823 12.771001 13.230390 9.834713 13.088445 3.409590 3.796005 0.190401 0.035767 0.119744
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.197110 0.011416 2.324976 1.229094 -1.463674 -0.905451 -0.120439 -0.736896 0.627112 0.650695 0.384883
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.231153 -0.479712 1.072991 1.432023 4.162055 -0.919388 0.928696 20.716375 0.629899 0.640070 0.361190
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.256798 6.939484 -0.807734 -0.543270 0.021358 2.623123 -0.313707 0.795347 0.658167 0.673076 0.372531
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.550831 0.395811 0.302462 0.478354 -0.573704 -0.381869 -0.046897 -0.418105 0.648055 0.661718 0.366204
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.105525 0.231716 -0.196156 0.613619 -0.453380 -1.172697 -0.915125 -0.809005 0.653071 0.662326 0.369380
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.054046 -0.598033 0.669057 1.093249 -0.839204 -0.993146 -0.125568 1.659733 0.646558 0.655819 0.371601
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.502613 -0.233435 0.243875 0.019091 -1.234667 -1.393433 1.684592 0.200149 0.641223 0.661549 0.382083
92 N10 RF_maintenance 100.00% 0.00% 31.51% 0.00% 33.657275 39.412848 0.425646 1.027917 7.123081 7.270194 0.245691 9.603442 0.279071 0.234040 0.087635
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.921785 -0.084159 1.939831 -1.377018 1.010624 0.116861 2.449784 -0.778908 0.626702 0.650582 0.387361
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.725048 11.963452 9.922979 10.172557 11.833504 13.181143 1.014570 0.454819 0.030855 0.025691 0.002461
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.937876 -0.967637 -0.850526 1.241922 -0.818606 0.070946 -0.628140 -0.273566 0.602648 0.639237 0.399501
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.028872 12.715412 3.869522 4.414309 11.206470 12.955270 0.384935 0.318085 0.033157 0.039329 0.002952
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.005884 5.804191 -0.344442 1.027251 0.376033 3.085556 0.934547 5.770636 0.554302 0.538351 0.360586
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.582581 8.592112 -0.592115 1.076813 0.394873 1.244928 0.133811 -0.211490 0.643560 0.653431 0.383393
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.731091 1.288490 -1.469848 -1.063812 0.678617 1.529491 -0.116725 10.821238 0.650675 0.660933 0.380817
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.871946 5.035366 4.416210 -1.269455 0.698877 -0.073177 9.759484 9.505259 0.621156 0.666489 0.382430
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.034808 56.582559 -1.262731 6.908193 2.259216 -0.004551 0.273920 1.249684 0.658048 0.634781 0.373742
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.471532 -0.310170 0.128410 0.593469 0.082390 -0.798609 -0.705000 -0.711853 0.654533 0.662373 0.363403
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.830085 0.328796 0.211806 -0.891491 -0.332299 -0.672128 0.257835 -0.186418 0.641884 0.662544 0.361988
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 2.334248 1.635764 -0.964080 -1.309939 0.263116 -0.515522 2.798204 2.472701 0.654476 0.672955 0.370753
108 N09 RF_maintenance 100.00% 100.00% 0.65% 0.00% 9.847066 37.262191 9.735031 0.534823 11.452265 8.118544 0.809476 2.373296 0.034887 0.285192 0.164244
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.624113 11.530579 9.763728 10.022950 11.566764 13.261446 -0.084635 1.280019 0.026340 0.026099 0.001307
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 24.239263 23.807821 13.189594 13.453841 11.417560 13.002487 3.265709 3.387382 0.023697 0.026268 0.001381
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.011155 11.442564 0.295880 10.126917 -0.417981 13.273798 1.105222 1.328220 0.636950 0.035012 0.456009
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.862717 -0.576784 0.106830 0.139168 0.434941 2.012822 -0.349548 -0.826989 0.629004 0.644390 0.394020
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.724954 12.850396 3.636353 4.296933 11.264574 13.035970 0.951764 0.021429 0.034953 0.030606 0.002351
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.155480 0.786265 -0.818005 0.090982 0.270119 -0.693962 0.106991 -0.031652 0.584755 0.620578 0.390193
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.713036 -0.508965 -0.771026 -0.238612 0.234366 -1.069031 -0.602993 -0.700815 0.575263 0.603878 0.395306
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.682555 13.020566 9.878254 10.660708 11.249785 13.127638 0.772348 3.416470 0.027541 0.031812 0.003100
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.153970 1.411683 -0.458324 0.364694 -0.420948 -0.207178 1.240929 2.336165 0.609292 0.636963 0.394790
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.142501 1.218242 2.591172 -1.196392 5.149456 2.903947 11.835719 6.485186 0.626454 0.659804 0.381722
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.032164 3.453484 -0.585367 5.595063 0.846092 -0.510747 27.011678 15.642371 0.653078 0.639860 0.369127
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.584689 6.616117 0.060210 0.806481 -0.089679 1.219777 -0.299441 -0.777101 0.659970 0.667991 0.373077
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.965732 8.929274 0.669773 0.775714 0.069825 -0.243605 -0.753218 -0.563336 0.664190 0.674981 0.375732
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.566946 0.175532 -0.207346 0.455660 -0.758235 -0.655654 0.326716 -0.301429 0.664706 0.669841 0.371608
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.016606 -0.599609 -0.661292 0.513164 0.447321 -0.853101 -0.290141 -0.883072 0.659185 0.668272 0.373016
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.298350 6.809061 -1.300087 1.419233 11.079042 -0.898514 29.245109 -0.783819 0.613807 0.659984 0.371171
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.003748 -0.014059 0.499691 0.254812 0.974002 1.366896 -0.429838 0.274370 0.646681 0.663648 0.385450
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.302569 10.668003 9.309400 9.714114 11.287143 13.039867 -0.485745 -0.224930 0.029809 0.027927 0.001104
131 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.727084 11.467948 0.163888 4.113457 -1.244640 11.674420 -1.129183 -0.431989 0.620575 0.306965 0.435349
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.390935 1.279922 -0.749282 -1.400657 -0.374624 -1.369536 0.158390 -0.119850 0.594282 0.610307 0.380900
133 N11 not_connected 100.00% 100.00% 0.00% 0.00% 11.376772 0.104040 3.609039 -1.497963 11.428715 -0.537906 1.100126 -0.995047 0.061560 0.602003 0.472397
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.888214 -0.916013 -0.485010 -1.420654 4.691202 0.536825 8.058692 -0.255061 0.590524 0.621435 0.413001
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 8.959396 0.822904 9.336744 -0.424316 11.506510 5.218483 0.799829 -0.642407 0.039719 0.615008 0.461883
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.924034 -0.641110 0.138510 -1.368923 2.150325 -0.668490 0.727846 -0.011590 0.591519 0.631943 0.401902
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.361196 -0.306479 1.886327 -0.635766 0.911854 -0.992318 -1.855295 -1.084970 0.629142 0.633578 0.377999
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.117686 -0.156282 -1.234594 0.119660 0.117221 -0.489962 4.290048 3.311266 0.643951 0.666627 0.379083
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.550626 -0.675001 -0.293176 1.038910 1.383484 -0.878183 -0.333143 -1.125786 0.646478 0.670122 0.375711
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.136685 11.506495 -0.682795 10.316168 4.255716 13.231055 35.235808 1.128016 0.650616 0.045697 0.526073
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% -0.987824 11.962628 0.897354 10.404809 1.270758 12.903545 -0.248028 1.661547 0.651694 0.039404 0.533156
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.216667 -0.279949 -1.261429 0.450576 -0.052516 -0.281552 -0.602048 -0.681143 0.663653 0.668915 0.371549
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.035820 0.658247 -1.226382 3.874552 0.316278 7.682660 -0.295484 -0.073205 0.661957 0.645944 0.379806
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 11.131270 -0.985867 3.614439 0.054126 11.349015 -0.736283 -0.106840 -0.870421 0.039073 0.655660 0.511088
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.984022 -1.439796 0.970897 2.086485 -0.582802 -1.397064 -0.304765 0.840491 0.634212 0.643990 0.375946
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.322613 0.159763 -0.649824 -0.732481 1.948430 1.472974 -0.643150 -0.726256 0.639546 0.656772 0.388606
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.030951 -1.211647 -1.377746 -1.261058 -0.176992 1.521470 0.064388 0.075497 0.634255 0.651946 0.392669
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.041519 -0.673981 -0.980472 -1.146344 -0.320200 0.069580 0.079581 0.764452 0.623407 0.637690 0.390685
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 26.016734 1.459387 0.103570 0.203798 6.783984 0.449012 4.207793 1.087461 0.485184 0.582198 0.349101
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.280155 -0.899174 9.493449 -1.577763 11.552803 0.894068 1.563282 2.398294 0.042011 0.622340 0.485379
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 5.998006 11.245555 8.833858 10.036813 7.955225 13.236070 0.608302 1.360982 0.332085 0.038748 0.246794
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.173990 -0.301274 -0.193614 0.525607 0.025843 0.149889 -0.416922 0.155416 0.609039 0.631090 0.398134
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.478672 0.144821 -0.185103 -0.786097 2.094470 2.089617 1.744993 16.069552 0.622962 0.647631 0.400836
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.368093 18.399794 -1.321563 -0.984602 -0.108115 8.470409 -0.823559 41.563994 0.594419 0.551689 0.363185
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.407054 -1.246302 -0.457731 -0.809784 -0.786569 1.549176 0.802696 1.110444 0.639262 0.656010 0.383948
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.064209 26.334024 -0.168803 -0.726692 0.058216 1.990413 -0.281145 0.656973 0.642756 0.530544 0.342396
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.760187 -1.279919 -0.786914 -1.124023 2.031803 1.377636 1.449286 0.138292 0.658026 0.670942 0.378000
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.549649 1.039644 -0.362807 0.267105 -0.386434 0.705670 0.129382 1.949580 0.659938 0.668605 0.381328
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -1.196617 0.397379 0.615250 -0.160293 5.780319 1.934233 1.663409 1.722241 0.653025 0.669550 0.375019
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 31.580409 -0.121226 -0.530552 -1.273987 4.918558 -0.057223 0.309299 -0.296885 0.510939 0.669012 0.369365
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.326275 1.700032 -1.154347 -0.026408 0.396406 0.892244 5.767711 4.900286 0.658611 0.667355 0.381343
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.293549 -1.164149 -1.491138 -0.345935 1.611219 0.267251 1.046606 6.186951 0.640784 0.650115 0.379498
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.017686 -1.332931 0.192085 -0.570042 1.560586 0.322422 0.048650 1.425649 0.629600 0.646666 0.385997
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.411715 0.165030 -1.045247 -1.289635 0.517746 3.315531 -0.454708 8.536171 0.631663 0.638740 0.383720
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.671698 -0.891814 10.088271 -1.502883 11.291478 -0.358659 2.457458 1.900706 0.039415 0.643130 0.504675
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.754854 2.840394 -1.251245 -0.300320 -0.360348 2.554482 0.718153 1.676807 0.585744 0.568843 0.368512
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 11.896402 12.353359 3.329419 3.879204 11.652451 13.272612 3.802794 6.240820 0.039838 0.044178 0.003940
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.088999 -0.241394 -0.582942 -0.645964 -0.950579 3.461031 -0.624498 -0.349795 0.617933 0.639656 0.393666
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.656437 12.200106 -1.534476 10.464680 1.495619 13.107170 14.715065 1.590425 0.639471 0.051368 0.528429
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.378162 -0.583889 -0.102219 0.097716 -0.231124 -0.293858 -0.441995 3.445419 0.645304 0.655444 0.387487
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.075706 11.240897 -0.705931 10.007145 -0.690817 13.268318 9.283517 1.235695 0.655970 0.046755 0.502765
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.201372 0.589709 -0.364503 0.471289 1.606404 0.088040 0.609475 -0.646616 0.645394 0.656322 0.372183
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.081202 -0.896228 -0.931961 -0.679925 0.545925 0.262779 0.622944 0.023282 0.653487 0.668552 0.372126
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 36.456695 -0.268693 -0.380057 -1.595660 9.919015 0.333129 2.969883 -0.103063 0.517643 0.666344 0.374641
186 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.757255 -1.289750 -1.601597 -0.272178 1.980262 -0.067639 0.326929 4.378610 0.660530 0.676979 0.389710
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.208775 1.904178 -1.373181 2.463731 -0.123166 0.988139 0.886607 12.739367 0.655512 0.669865 0.381730
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 8.928677 11.116909 9.320361 10.139154 11.664934 13.304179 2.741617 2.145619 0.027137 0.030929 0.001995
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.432842 -1.150934 -0.872476 0.783902 -0.194327 -0.047307 -0.667838 -1.603612 0.632433 0.655245 0.398499
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.562176 0.266072 1.182863 -0.594317 1.506939 0.427282 10.013894 0.450518 0.617269 0.639353 0.395017
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 5.993725 6.713912 5.661736 5.626224 8.853553 10.574203 -2.195909 -2.286404 0.583443 0.602382 0.386754
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.568749 0.630538 5.745048 2.142966 9.088587 3.155851 -1.707727 2.036895 0.571944 0.612972 0.412802
200 N18 RF_maintenance 100.00% 100.00% 60.27% 0.00% 11.577816 34.084723 3.761872 1.019637 11.599387 8.403325 1.500374 1.356513 0.041354 0.214243 0.144167
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.345584 4.785802 3.532661 4.900720 3.025603 8.723407 0.287417 -2.271879 0.630564 0.629241 0.384298
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.545506 2.120391 2.060726 -1.440616 1.119892 -0.615445 -0.325140 22.911974 0.638038 0.621929 0.380557
205 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.443415 2.846805 0.866302 -1.318029 -0.736917 -0.854384 -0.979378 3.566075 0.630449 0.617231 0.373300
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.598415 1.373898 2.841335 -0.529092 11.516716 -0.207515 -0.884320 5.986327 0.635601 0.630416 0.376607
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.810038 4.324299 1.706987 -1.290517 1.415697 -0.165521 -0.900763 0.679346 0.615911 0.606164 0.356179
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.313321 11.872282 9.101040 10.824967 11.185176 9.620044 18.861928 68.459930 0.033554 0.035114 0.001003
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.174868 7.448068 8.868959 9.180601 11.372426 14.136277 13.128858 19.266610 0.040789 0.039875 0.001554
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 12.459162 11.015931 -1.098360 -1.146686 -0.585095 -0.508397 -0.226906 0.940990 0.631671 0.641598 0.388966
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.209300 -0.679158 -1.084037 0.355045 -0.920001 -0.604988 1.255052 -0.003840 0.578997 0.614128 0.389895
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.322208 -1.084095 0.728118 0.011948 -0.681335 2.000588 3.128474 -1.429916 0.622422 0.631019 0.382691
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.223627 0.046415 -1.274615 -0.373205 -0.373489 -0.650898 11.818728 -0.189974 0.602517 0.634848 0.388524
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.845213 0.139234 -0.088064 0.407526 -0.358628 -1.134398 1.574322 -1.630362 0.615250 0.642857 0.388896
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.883027 1.224902 -1.188047 -1.250633 0.086735 -0.590667 0.450593 6.024533 0.607830 0.618497 0.372962
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.600319 6.276558 5.877328 5.606151 9.157560 10.460574 -2.882613 -3.152844 0.605695 0.624808 0.380480
225 N19 RF_ok 100.00% 0.00% 87.41% 0.00% 1.347279 11.812438 1.098091 4.065566 -0.748197 12.953214 -1.036444 0.992663 0.630038 0.139047 0.524579
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.183856 20.590542 0.371768 1.577517 -1.171146 5.354718 -0.618647 -0.374088 0.622985 0.545920 0.372990
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 2.001648 0.641148 -1.393379 0.438254 0.283688 -0.145419 12.098958 -0.370292 0.586991 0.626713 0.380198
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.008254 21.946860 -1.149810 -0.027007 0.371765 4.445301 7.040439 4.975039 0.556147 0.502859 0.327285
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.638161 -0.063439 1.909790 1.798204 0.283917 1.696613 0.547665 -2.124204 0.608120 0.626947 0.395641
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.643309 0.217571 -0.285859 -1.337135 0.444766 -1.327294 -0.614102 -1.090475 0.551012 0.609591 0.403151
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.975691 0.041775 1.212658 0.623031 -0.571378 -0.935556 -1.190959 -1.556379 0.618701 0.631393 0.394648
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.904921 -1.302988 0.081073 0.434661 -0.767929 -0.597569 1.824560 2.994704 0.615290 0.633397 0.391313
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 31.827210 50.486605 -0.536692 1.084489 3.678767 7.582833 14.173511 8.026725 0.457452 0.409517 0.248768
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.014396 3.943225 -0.653577 0.229906 -0.601476 0.801280 5.886077 19.057096 0.606104 0.583820 0.388160
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 54.168324 1.661145 0.656013 2.176030 11.654722 1.915293 16.925638 -0.749388 0.331185 0.636682 0.487821
243 N19 RF_ok 100.00% 24.32% 0.00% 0.00% 58.886212 2.574931 1.127304 -1.295116 8.131795 -0.780919 -1.421683 0.228290 0.255512 0.611673 0.485750
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.197931 2.213918 1.181701 -1.120781 4.949869 1.917925 3.335013 7.295604 0.483156 0.588480 0.388313
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.543034 2.303977 0.430989 -0.681471 -0.593461 -0.999731 -0.981467 -0.216964 0.595030 0.602371 0.383438
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.997897 7.553033 -0.490751 0.442583 6.181935 7.129739 3.707302 -0.201588 0.318057 0.324538 0.159569
261 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.290595 1.504542 0.925662 -0.168350 -0.039657 -0.850582 0.003280 4.334160 0.596835 0.604326 0.388165
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 5.977217 7.498199 8.811250 9.668847 10.905314 12.371470 9.353097 21.743899 0.032269 0.026853 0.004792
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 6.266049 11.997356 2.452741 6.482611 1.203763 13.314014 26.614195 2.765484 0.443301 0.045980 0.353148
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.428886 2.434894 1.457559 2.014069 1.055502 1.386911 -0.339293 -1.045282 0.494963 0.520145 0.378272
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.221092 -0.709879 1.595504 -0.987653 0.857042 -1.055811 -1.076582 -0.305370 0.535487 0.538880 0.395244
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.171715 -0.794500 -1.163129 -0.088849 0.041633 -0.833679 2.606483 -0.425403 0.485276 0.527721 0.377777
333 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.326037 4.813581 -0.838063 -1.319623 0.054412 -0.169952 0.849193 0.199167 0.461727 0.499343 0.364475
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 9, 10, 15, 16, 18, 27, 28, 29, 32, 34, 36, 38, 40, 42, 47, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 63, 64, 68, 71, 72, 77, 78, 79, 80, 81, 82, 84, 86, 87, 92, 94, 96, 97, 101, 102, 103, 104, 108, 109, 110, 111, 113, 117, 120, 121, 122, 123, 126, 128, 131, 133, 135, 136, 140, 142, 143, 145, 146, 151, 155, 156, 158, 159, 161, 164, 165, 166, 167, 169, 170, 173, 180, 182, 185, 186, 187, 189, 191, 192, 193, 200, 201, 202, 206, 207, 208, 209, 210, 221, 223, 224, 225, 226, 227, 228, 240, 241, 242, 243, 244, 246, 261, 262, 320, 333]

unflagged_ants: [5, 8, 17, 19, 20, 21, 22, 30, 31, 35, 37, 41, 43, 44, 45, 46, 48, 53, 61, 62, 65, 66, 67, 69, 70, 73, 74, 83, 85, 88, 89, 90, 91, 93, 95, 105, 106, 107, 112, 114, 115, 118, 124, 125, 127, 132, 137, 139, 141, 144, 147, 148, 149, 150, 157, 160, 162, 163, 168, 171, 179, 181, 183, 184, 190, 205, 211, 220, 222, 229, 237, 238, 239, 245, 324, 325, 329]

golden_ants: [5, 17, 19, 20, 21, 30, 31, 37, 41, 44, 45, 53, 65, 66, 67, 69, 70, 83, 85, 88, 91, 93, 105, 106, 107, 112, 118, 124, 127, 141, 144, 147, 148, 149, 150, 157, 160, 162, 163, 168, 171, 181, 183, 184, 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_2459957.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

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