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 = "2460125"
data_path = "/mnt/sn1/2460125"
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: 6-29-2023
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

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

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2460125/zen.2460125.42120.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 360 ant_metrics files matching glob /mnt/sn1/2460125/zen.2460125.?????.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/2460125/zen.2460125.?????.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 'startTime' 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 2460125
Date 6-29-2023
LST Range 18.051 -- 19.986 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 360
Total Number of Antennas 205
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
RF_maintenance: 62
RF_ok: 18
digital_maintenance: 3
digital_ok: 83
not_connected: 30
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 205 (0.0%)
Antennas in Commanded State (observed) 0 / 205 (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 57 / 205 (27.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 95 / 205 (46.3%)
Redcal Done? ❌
Never Flagged Antennas 109 / 205 (53.2%)
A Priori Good Antennas Flagged 30 / 83 total a priori good antennas:
5, 15, 17, 37, 40, 42, 44, 51, 86, 107, 112,
121, 123, 140, 141, 144, 145, 146, 149, 151,
153, 161, 163, 164, 165, 169, 183, 186, 187,
202
A Priori Bad Antennas Not Flagged 56 / 122 total a priori bad antennas:
8, 16, 22, 35, 36, 46, 48, 49, 50, 52, 57,
63, 64, 68, 73, 80, 84, 89, 90, 95, 97, 102,
108, 113, 114, 120, 125, 127, 132, 134, 135,
136, 139, 155, 159, 175, 179, 195, 206, 207,
210, 223, 224, 226, 228, 229, 240, 241, 244,
245, 261, 324, 332, 333, 336, 340
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_2460125.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 0.00% 0.00% 0.00% 0.00% -0.270271 -0.698911 0.103512 -0.987968 0.397105 -0.627770 0.055377 -0.496108 0.740454 0.516707 0.509624
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.544634 4.799907 -1.403000 -1.102194 -1.186761 -0.168583 -0.799177 16.039056 0.739270 0.460035 0.505197
5 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 2.058898 6.859318 0.183172 3.724252 0.445100 1.283374 0.110602 0.983624 0.746312 0.503162 0.511551
7 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.270296 -0.391887 -1.238769 -0.578596 -0.575127 0.195090 2.423211 3.417394 0.714583 0.495892 0.493893
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.697372 2.217003 0.958772 1.164993 0.129659 0.224801 -1.133221 -1.261178 0.690605 0.453278 0.486301
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.516966 0.276835 3.505467 0.304434 1.391614 0.053854 2.261319 0.413082 0.709720 0.485798 0.497058
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.401878 -1.442355 -0.462745 -1.342316 -1.431198 -1.138553 -0.312881 -0.084228 0.696869 0.467479 0.495511
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 10.196367 6.497540 0.549074 0.054299 -1.185224 -0.387550 0.095178 0.260253 0.623105 0.513155 0.379993
16 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.936990 -0.380595 -0.908229 -0.868602 -1.760909 -1.794398 -1.213254 -0.887578 0.750359 0.538409 0.497259
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.960938 2.159712 1.414263 3.723376 1.591014 1.737475 0.714926 4.443727 0.761016 0.534128 0.511879
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.501953 5.278851 0.642910 1.321154 0.528254 -0.359958 10.858379 23.110883 0.680390 0.328321 0.527676
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.756463 0.386441 -0.778925 -0.006146 -0.406930 -1.190373 -0.065019 -1.133431 0.719853 0.493560 0.496427
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.315311 -0.065451 0.088118 0.451522 0.010320 0.230127 1.420885 0.655332 0.715067 0.498103 0.489897
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.246725 0.106059 -0.480826 -0.289480 -0.253941 -0.382248 0.143442 0.142079 0.709545 0.477729 0.500031
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.308541 -1.408117 1.134567 -0.993547 -0.034097 -1.166771 2.511950 1.393097 0.437108 0.259731 0.324254
27 N01 RF_ok 100.00% 100.00% 82.50% 0.00% 11.021092 12.429298 12.337834 4.947309 1.487271 1.576766 7.159287 38.418384 0.051272 0.184097 0.132279
28 N01 RF_ok 100.00% 0.00% 29.72% 0.00% -0.326376 9.518516 0.555401 5.662852 0.117628 -0.185822 0.168976 18.352395 0.756286 0.244591 0.629995
29 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.305717 7.245279 13.170141 13.304104 1.377883 1.315418 2.611578 2.023261 0.032272 0.047006 0.015388
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.360550 -1.238909 -0.143677 -1.354361 -1.223454 -0.934329 0.655095 -0.420383 0.755687 0.561472 0.495661
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.061487 1.063459 -0.146676 1.016830 0.609692 1.265363 0.436924 1.158104 0.724256 0.512410 0.495258
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.935143 1.975132 0.353577 -0.328507 -0.255832 0.475038 10.762414 40.216123 0.647577 0.490281 0.389355
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.172442 0.005738 7.999370 -0.563151 1.375607 -1.525061 2.643159 0.017626 0.032294 0.279355 0.194837
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.298367 -0.916529 -0.518755 -1.328718 -1.520999 -1.643970 -0.268723 0.335707 0.466012 0.273277 0.349884
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.244115 1.896167 0.716583 0.282793 0.980071 0.573975 0.395030 0.320450 0.742578 0.506967 0.503698
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 6.897572 6.200169 5.191082 6.637580 1.922333 1.837155 1.468173 6.401091 0.749022 0.513160 0.502583
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.769707 -0.147550 -0.560651 0.617002 -0.167572 0.683697 0.403005 1.966773 0.752641 0.534029 0.498265
40 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.581722 1.096041 0.821714 0.573284 0.632669 0.486972 1.168756 25.060971 0.748323 0.540540 0.489865
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.018700 1.895107 0.045364 3.024209 0.231037 1.684752 0.016467 1.040423 0.754987 0.545716 0.494754
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.742786 2.758271 0.215137 5.673321 0.537110 1.645521 0.263366 1.606125 0.756831 0.538730 0.501512
43 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
44 N05 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.569454 0.412113 0.537910 -0.020641 0.728282 0.223350 0.951420 0.934099 0.673163 0.461351 0.477628
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.570401 -1.329014 -0.343208 -1.411537 -0.102298 -1.481742 0.607162 -0.212004 0.675955 0.454064 0.488925
47 N06 not_connected 100.00% 89.17% 100.00% 0.00% 6.224136 7.469553 7.697305 7.611487 1.008098 1.298485 3.109502 2.304724 0.146187 0.053640 0.091642
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.319090 1.107487 -1.342312 -0.155550 -1.776169 -1.115981 -0.100493 -0.587633 0.591764 0.361375 0.431046
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.725623 -0.667595 0.551577 -1.117845 0.076709 -1.844454 1.394717 -0.101477 0.574076 0.352490 0.423563
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.355143 -0.154139 -0.008854 0.359867 0.394312 0.593391 -0.102946 0.155810 0.745301 0.508193 0.505642
51 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.834221 0.113711 -0.364874 0.768387 0.137829 0.757641 37.506787 2.030670 0.745499 0.524592 0.491534
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.287841 1.037386 0.481761 -0.297380 0.788227 -0.081271 0.974660 0.006914 0.759174 0.537438 0.492788
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.077459 -0.009888 -0.119621 -0.393354 -0.081197 -0.461832 2.853677 0.098327 0.760269 0.552550 0.479897
54 N04 dish_maintenance 100.00% 0.00% 0.00% 0.00% 7.268367 2.692546 2.520882 3.145271 0.809756 0.535260 1.360900 0.716924 0.358609 0.381296 0.161242
55 N04 RF_maintenance 100.00% 100.00% 0.00% 0.00% 26.810904 -1.207907 9.552024 -1.268864 1.422522 -1.375217 0.828925 0.386383 0.046881 0.541083 0.405707
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.466006 0.273453 -0.712068 0.009228 -0.166652 0.274923 -0.392385 0.683814 0.760767 0.559324 0.490695
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.477512 -0.423205 -0.458382 -0.701954 -0.381103 -0.749072 -0.075771 0.300495 0.761076 0.561342 0.491607
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
59 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
60 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.012961 -1.175696 7.596794 -1.040562 1.374451 -1.073726 2.083188 1.184119 0.022176 0.338526 0.254349
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% -0.485402 0.613955 1.517169 -0.108261 -0.370870 -0.970848 1.772231 -0.540318 0.567956 0.371820 0.406605
63 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.582703 3.172522 -1.293498 1.840535 -1.756397 0.849913 0.326613 -1.226458 0.586916 0.331908 0.431370
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.818234 -0.666648 -1.430462 -0.462196 -1.375712 -0.919672 0.238371 0.902440 0.571133 0.340435 0.413210
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.232599 -0.720568 0.355044 -1.009393 0.488132 -0.891869 0.050743 -0.325982 0.744379 0.503441 0.510454
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.176343 0.006274 0.238465 0.514437 0.251901 0.643404 -0.062846 0.633164 0.732675 0.525867 0.480888
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.794243 -0.071628 -0.679619 0.633768 0.067146 1.038228 1.340506 0.648045 0.755199 0.548553 0.487340
68 N03 RF_ok 0.00% 0.00% 0.00% 0.00% 0.796170 0.016834 1.123216 0.671389 1.021227 0.714996 0.829636 1.220946 0.762094 0.553076 0.486610
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.938611 -0.357556 0.376208 -0.205967 0.873825 0.472281 1.231765 0.011871 0.760699 0.556542 0.489349
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.348191 0.152047 1.910289 0.376673 1.705081 0.710797 0.935194 0.710636 0.754020 0.565552 0.477044
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.424637 -0.218838 -0.908183 -0.124856 -0.448336 0.180744 -0.461170 0.283096 0.763444 0.569714 0.486922
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.033234 -0.059899 -0.255037 -0.272178 0.198649 -0.072851 0.016594 0.002511 0.763566 0.569629 0.490836
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.158600 1.645444 -0.221704 1.431801 0.148880 1.139318 0.861070 1.639502 0.680231 0.477628 0.474265
74 N05 RF_maintenance 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.772527 0.434769 0.704868
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 4.303962 0.276695 -1.158278 -0.911522 -1.201284 -1.832187 0.333511 0.054223 0.478434 0.335474 0.335840
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 10.224696 0.468218 -0.020304 0.020801 -1.003338 -1.009106 2.016862 -0.565652 0.464215 0.369948 0.291342
79 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.135335 -1.159740 2.240812 -1.511952 13.270866 -1.401499 33.115778 0.344349 0.661067 0.540797 0.468060
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.480669 1.862823 -1.002330 0.977316 -1.763846 0.028547 -1.086132 -1.416544 0.744701 0.496342 0.509711
84 N08 RF_ok 0.00% 0.00% 0.00% 0.00% 0.756888 2.001866 0.456711 1.087296 -0.499458 0.072122 -1.531282 -1.416447 0.739464 0.519722 0.475286
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.189729 -0.954591 -0.839414 -1.356243 -1.817596 -0.986087 -1.278346 -0.685058 0.761590 0.565831 0.481561
86 N08 digital_ok 100.00% 100.00% 0.00% 0.00% 6.327967 -0.426341 11.887035 -0.269697 1.370186 -0.272865 0.571506 7.407485 0.058515 0.573105 0.406227
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.774215 7.809191 3.253699 -0.487742 -0.475846 -0.670642 3.870138 0.556587 0.650570 0.570643 0.344332
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.002990 0.681387 0.400969 1.057943 0.598453 1.012839 2.045198 0.794204 0.766580 0.580792 0.480148
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.301949 0.313736 0.470989 0.655347 0.594895 0.475999 0.141209 0.175337 0.775428 0.578109 0.497760
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.459544 -0.164909 -0.677592 0.579143 -1.670767 0.495599 -1.311967 1.332965 0.774979 0.582675 0.498210
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.174408 -0.219705 0.490901 0.331892 0.415462 0.142723 0.219467 0.086989 0.772258 0.572312 0.509945
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.206562 7.023705 13.485392 13.652142 1.378679 1.321701 3.270047 3.330688 0.020957 0.034656 0.007668
93 N10 RF_maintenance 100.00% 60.00% 97.78% 2.22% 0.912136 7.426279 0.557770 13.786832 -0.263467 1.216256 -1.080111 3.583639 0.201723 0.066228 -0.062933
94 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.145941 1.980325 0.604542 4.628142 0.407329 1.260858 1.401988 2.191626 0.673023 0.434844 0.471792
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.594967 -0.357070 -0.745322 -0.605261 -0.838770 -1.648519 -0.437456 -1.027121 0.747631 0.543918 0.489692
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.498894 8.962302 -0.122052 -0.306154 -0.968225 -1.287959 -1.310008 -0.068431 0.749647 0.436449 0.473918
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.473752 -0.162375 -1.529780 -0.388351 -1.436888 -0.625460 -0.839206 0.744939 0.740772 0.505770 0.500764
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.067365 2.616148 -0.196536 0.560735 -0.163464 0.148675 -0.295087 0.199622 0.757581 0.539019 0.491726
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.899402 -0.509904 -1.038321 -0.988601 -1.830552 -0.785566 -1.212632 0.810900 0.759939 0.553358 0.483153
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.249861 1.131087 -1.414401 -0.038305 -1.610707 0.039725 -0.733540 0.795302 0.755849 0.565898 0.467537
104 N08 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.000970 27.003261 3.803763 7.085906 1.932791 2.193927 1.345173 1.511920 0.768947 0.559452 0.500944
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -1.199642 0.272312 -1.221783 0.631554 -0.768644 0.882854 -0.547942 0.254323 0.765337 0.576042 0.488348
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.098186 -0.447924 -0.260690 -0.183328 0.172484 0.115120 -0.190360 -0.081525 0.772525 0.581045 0.494603
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.453378 1.136081 0.078373 -0.843958 0.398052 -0.544124 5.384567 2.305460 0.773452 0.578884 0.488368
108 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.994204 0.990075 -0.799747 0.302548 -0.259309 0.527495 -0.285840 0.185575 0.780591 0.579898 0.505950
109 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.075498 7.200792 -0.991623 13.509725 0.761993 1.318527 0.908778 2.675020 0.332037 0.039341 0.225294
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.025048 -0.808036 -0.644765 -0.742216 -1.224324 -0.680157 -0.566372 0.273303 0.593104 0.456440 0.373156
111 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.588550 1.209977 1.775755 1.234027 -0.747958 0.567143 1.372530 1.246031 0.567457 0.448937 0.351573
112 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.330461 -0.268110 11.229513 -0.407103 -1.286137 -1.581441 1.354136 -0.748961 0.508887 0.446646 0.337039
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.582777 3.025408 1.511214 1.738616 0.665284 0.730905 -1.508972 -1.398887 0.728302 0.504648 0.489290
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.301982 -0.647054 1.246118 -1.543880 0.451029 -1.523407 -1.205972 -0.466012 0.726803 0.524400 0.485945
115 N11 not_connected 100.00% 99.44% 99.44% 0.00% nan nan inf inf nan nan nan nan 0.576202 0.494951 0.387199
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.624638 -0.002990 2.625260 -0.026020 1.457007 0.004541 1.361896 -0.035620 0.752554 0.543874 0.479273
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.532570 2.230880 0.664357 6.055727 -0.151044 1.427095 -0.740534 5.436946 0.707615 0.544009 0.452243
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.281261 0.821705 -0.493516 -1.394243 -0.310166 -1.212203 -0.349291 -0.797245 0.763569 0.567756 0.482090
123 N08 digital_ok 0.00% 0.00% 2.22% 0.00% 2.115913 0.788950 1.301175 0.271382 0.496302 -0.759161 -0.944446 0.913124 0.741639 0.533940 0.482205
124 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.424636 7.637807 13.676697 13.941086 1.375565 1.320847 1.436868 4.234162 0.046448 0.048931 0.003538
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.664465 -0.238119 3.525185 0.347522 1.850277 0.578936 1.288272 0.135530 0.761901 0.572528 0.497951
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.366442 1.245289 0.442739 0.316165 0.416989 0.231859 4.278642 0.200575 0.771960 0.570483 0.507327
127 N10 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.284418 0.013194 0.080143 -0.074470 -0.910742 0.024978 -0.884919 1.183468 0.669336 0.472517 0.464382
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.402422 -0.599232 0.182957 -0.682501 0.561721 -0.366734 1.342216 1.751301 0.685394 0.471730 0.473730
131 N11 not_connected 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.645475 0.610330 0.402544
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.288244 -1.240655 -1.439341 -1.360389 -1.570605 -1.238670 -0.004323 -0.567783 0.751172 0.533459 0.489850
133 N11 not_connected 100.00% 99.44% 99.44% 0.00% 93.865966 94.009652 inf inf 512.051308 526.729504 3911.342671 4168.280553 0.543961 0.467421 0.328913
134 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.758471 2.193695 2.663941 1.134802 0.416919 0.146608 2.050418 -1.311502 0.694165 0.480270 0.484223
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.316120 0.315278 -1.398668 0.822003 -1.526648 0.093998 -0.836948 0.589720 0.721082 0.474066 0.501577
136 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.023573 3.704440 -1.384514 0.455750 -0.816246 0.394552 -0.736343 1.306805 0.734620 0.476672 0.499417
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.352919 -0.742779 -0.244788 -1.419279 -1.232710 -1.511449 -1.295028 -0.389640 0.736570 0.514164 0.484241
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.846404 0.232692 0.330854 0.142906 0.453498 0.476426 16.344036 2.552533 0.737329 0.545119 0.465764
141 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 6.555784 0.036888 13.459439 0.184244 1.369638 0.554085 0.966879 0.167874 0.081779 0.552728 0.433311
142 N13 RF_ok 100.00% 0.00% 0.00% 0.00% -0.194888 9.277826 0.114013 1.557918 0.424349 2.739191 6.470692 29.980351 0.761541 0.554709 0.493850
143 N14 RF_maintenance 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.331106 0.398253 0.305420
144 N14 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.333804 0.306145 0.264059
145 N14 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.347596 0.461437 0.374314
146 N14 digital_ok 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.029870 0.511690 0.467011
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.629320 0.135644 1.801096 0.577824 1.194693 0.565408 0.825606 0.427938 0.756866 0.550049 0.500279
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.099100 0.046356 -0.001684 0.399820 0.265461 0.452616 0.008525 0.262314 0.759262 0.547579 0.501617
149 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 1.136120 5.585747 -0.256570 0.518910 -0.122854 -0.011722 0.591393 0.441094 0.747150 0.526743 0.487332
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.474576 -0.379185 0.417837 0.001684 0.617472 0.121723 0.935904 0.324439 0.750070 0.534604 0.491503
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.033618 -0.406598 -1.029076 0.612721 -1.150273 0.038640 -0.589772 2.253908 0.640781 0.535596 0.371910
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.180898 -1.299932 -1.121420 -1.187336 -1.243906 -1.294188 0.211527 -0.656047 0.750861 0.521944 0.496472
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 6.437046 -1.008232 7.732314 -1.091576 1.378535 -1.280830 1.236537 -0.403553 0.051469 0.513401 0.352322
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.990253 -1.028307 -1.032201 -1.491258 -1.793270 -1.648250 -1.093535 -0.845841 0.728511 0.490903 0.501930
155 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.789811 -1.609018 0.394011 -1.240638 -0.439639 -1.063474 -1.483227 -0.588726 0.721419 0.468305 0.511545
156 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.184201 0.302515 3.854409 0.439745 1.895647 0.194315 2.136384 0.172470 0.728935 0.481033 0.502301
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.541702 0.200992 0.031783 0.279588 0.455782 0.475838 0.043230 0.101734 0.741339 0.503458 0.501570
158 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.403719 -0.508026 -0.159168 -0.096269 0.390331 0.149790 0.480149 2.577021 0.747889 0.512485 0.503551
159 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.027486 -0.431962 0.683646 -0.811330 0.025111 -0.888616 0.139744 -0.474403 0.722929 0.502237 0.485126
160 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.326114 1.254097 0.703989 5.214443 -0.162756 1.460410 -1.534193 3.784635 0.736219 0.514001 0.492490
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.239474 15.418725 0.434431 -0.003865 0.753186 -0.947741 0.143990 -0.398202 0.752512 0.447625 0.464027
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.047636 -0.049472 -1.065781 0.167486 -0.876941 -0.014538 0.486820 0.219226 0.758611 0.544779 0.502864
163 N14 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.468004 0.457463 0.425714
164 N14 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.357713 0.526702 0.415093
165 N14 digital_ok 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.568464 0.101084 0.501903
166 N14 RF_maintenance 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.689819 0.698770 0.492594
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.689834 0.461457 0.383547 0.574810 0.352423 0.316682 0.336512 0.685575 0.746669 0.538848 0.495162
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.147954 -0.410355 0.549027 0.076043 0.624141 0.100541 0.582408 0.332039 0.743197 0.535084 0.487724
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 1.488803 5.345128 0.603560 0.176551 0.548406 -0.210771 0.332220 0.221869 0.745243 0.517015 0.487779
170 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.571511 0.637985 1.813313 0.641717 1.843712 0.740621 1.971694 0.665167 0.743579 0.531851 0.487900
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.151724 -0.710290 0.886044 0.018396 0.147568 -0.356183 0.288910 0.040773 0.738539 0.532275 0.476213
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.358258 -0.461569 -0.717796 -0.431518 -1.719316 -0.415720 -1.106631 -0.125051 0.747216 0.524818 0.497886
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.522303 2.952708 1.467039 1.688226 0.650119 0.710045 -1.499100 -1.389759 0.712605 0.482652 0.491020
174 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 7.202879 7.876059 7.650295 7.638418 1.377501 1.317840 1.036856 0.736307 0.028255 0.028521 0.001391
175 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.544442 2.549304 0.712089 1.081695 -0.120621 0.024492 -1.493092 -1.295671 0.699980 0.444908 0.494154
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.660676 0.623922 1.192327 1.026023 1.191016 1.114639 0.446775 0.503948 0.741798 0.511339 0.502825
180 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.998625 4.975278 1.177385 0.234084 1.016567 -0.148013 4.090361 -1.138063 0.745773 0.447095 0.482801
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.881769 0.497513 0.477553 0.377745 0.585680 0.187449 0.025390 0.616355 0.756238 0.527269 0.506462
182 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.410544 7.138785 -0.479604 13.537400 -1.493758 1.307572 -1.344985 2.177428 0.749933 0.060371 0.615640
183 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.674642 7.649699 0.119065 13.631385 0.135497 1.323712 0.027742 2.078858 0.757298 0.050213 0.615854
184 N14 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.074352 0.025459 0.039450
185 N14 RF_maintenance 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.552274 0.594703 0.419714
186 N14 digital_ok 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.665135 0.055146 0.608036
187 N14 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.476346 0.321998 0.425576
189 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.155864 2.134262 0.612944 1.141710 -0.217743 0.206904 -1.391882 -1.363700 0.700337 0.473218 0.472038
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.127483 -0.534736 0.178257 -0.318394 0.369239 -0.176169 0.529513 0.100663 0.731675 0.518344 0.478891
191 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.197321 0.264044 0.468254 0.629161 0.922392 0.745479 3.074260 0.571565 0.730016 0.512409 0.481570
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.609918 3.267660 1.525283 1.915042 0.104055 0.899220 -0.624839 -1.375564 0.715679 0.489392 0.482148
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.803470 2.765179 1.681031 1.575906 0.832753 0.574083 -1.472062 -1.431161 0.706732 0.481298 0.483284
194 N16 digital_maintenance 100.00% 100.00% 0.00% 0.00% 6.425805 -1.310083 7.622866 -1.546188 1.373087 -1.755212 0.678549 -0.784644 0.041474 0.494994 0.384810
195 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.828470 0.361182 0.876893 -0.317658 -0.047950 -1.429936 -1.519008 -1.243506 0.697027 0.474371 0.489826
200 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
201 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.320604 4.616906 0.463589 -0.408055 0.342140 -0.246556 1.537354 -0.149243 0.753105 0.536459 0.508147
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.181666 0.304748 5.150267 1.078469 -1.077401 0.132120 1.685847 1.817621 0.653716 0.523074 0.445004
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.795407 0.086462 2.185957 1.536666 0.823235 0.713075 1.293664 1.856656 0.725587 0.524106 0.477995
207 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.949644 0.191221 1.712678 1.164298 0.910696 0.181870 -1.442710 0.196494 0.700744 0.525809 0.459408
208 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 2.418929 4.666634 7.614664 13.668256 1.604178 1.492034 1.576139 47.192007 0.741042 0.042015 0.639192
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 3.360764 3.800438 12.595839 13.222280 1.354877 1.197777 7.631082 19.350684 0.031230 0.036258 0.002021
210 N20 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.881378 3.744031 0.026186 0.208638 0.187021 0.092375 0.134041 -0.047133 0.760644 0.539568 0.486470
211 N20 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.263949 7.168543 -0.259253 8.106689 -0.259441 1.316534 -0.083555 2.071035 0.738926 0.044207 0.625639
213 N16 digital_maintenance 100.00% 0.00% 94.72% 0.00% 2.468084 7.582193 1.426104 7.741500 0.640276 1.159884 0.966954 1.463456 0.700459 0.120648 0.585207
214 N21 not_connected 100.00% 100.00% 0.00% 0.00% 6.832415 0.260836 7.777991 -1.199571 1.374300 -1.472579 0.990581 -0.686701 0.052600 0.467242 0.400699
220 N18 RF_maintenance 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.639934 0.618145 0.415151
221 N18 RF_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.844130 0.739910 0.429796
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.049423 -0.158462 -0.604660 -0.428148 -0.770229 -1.429103 -0.399410 -1.188295 0.744025 0.521963 0.501212
224 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.004944 3.132329 1.869522 1.820417 1.039634 0.826735 -1.392091 -1.386585 0.701819 0.490036 0.471386
225 N19 RF_maintenance 100.00% 0.00% 62.78% 0.00% 0.045069 6.344684 -0.378832 7.590767 -1.323159 0.697887 -1.368724 1.523415 0.746475 0.223678 0.597586
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.073966 3.069767 -1.477488 -0.804378 -1.544617 -1.124512 -0.881908 -0.888664 0.745277 0.475625 0.480923
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 0.364171 -0.869748 0.640985 -1.148247 0.097994 -1.834969 8.788254 0.299077 0.734161 0.529233 0.477697
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.171610 -1.089367 -0.983753 -0.991303 -1.664807 -1.336022 -0.531705 -0.397976 0.735252 0.518698 0.475686
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.120980 0.451076 -0.450367 0.013364 -1.536439 -1.104059 -1.353223 -1.359566 0.741576 0.511949 0.497779
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
238 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
239 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.318570 -1.002749 -1.461204 -1.438969 -1.410690 -1.589192 -0.820689 -0.602976 0.742110 0.509376 0.513493
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.141734 -0.814145 -1.268452 -0.893513 -1.702076 -1.799905 -0.483138 -1.083785 0.744506 0.510037 0.506520
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.829910 0.099783 -1.166778 -0.416727 -0.971193 -1.397822 4.418610 -0.836464 0.639398 0.509750 0.390847
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.221889 -1.442894 -0.447770 -1.300959 -0.875714 -1.243327 -0.426632 -0.655420 0.662320 0.516953 0.412941
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.556210 -0.440323 -0.393561 0.210232 -0.351479 -0.004541 -0.165493 0.468557 0.741433 0.511829 0.492400
245 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.304929 -0.839582 -0.694611 -1.502697 -1.651966 -1.366423 -1.242785 -0.002511 0.745866 0.516538 0.497377
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 1.660755 7.355722 4.327042 7.633230 -0.933303 1.317286 1.979568 1.499178 0.653751 0.041838 0.550436
261 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.298563 -0.695596 -0.694609 -1.056700 -1.768090 -1.744857 -1.141574 -1.078247 0.737083 0.502064 0.502628
262 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.774709 5.073325 -0.658653 0.105814 -0.355714 0.268924 -0.260386 0.022811 0.735970 0.501551 0.505988
320 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -1.074503 -0.582712 -1.391616 -1.426911 -1.049045 -1.419504 -0.436607 -0.487579 0.671902 0.360486 0.494767
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.866664 1.261041 -0.195668 0.107331 -1.046670 -0.812163 -0.443924 -1.071357 0.641779 0.330768 0.472718
325 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.034417 -1.402069 -0.369517 -1.218892 -1.242323 -1.256476 -1.174526 -0.545445 0.676775 0.377667 0.494751
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 7.052553 7.250028 7.752966 8.158420 1.377671 1.314724 1.387094 1.680684 0.044643 0.044452 0.002348
332 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.450950 1.375633 0.474026 0.323062 -0.489722 -0.756013 -1.006000 -1.030552 0.635004 0.339398 0.475447
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% -0.585427 2.846398 -0.591489 1.585121 -0.465429 0.565701 0.444916 -1.385697 0.637572 0.305489 0.473546
336 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.335977 1.691848 -0.430017 -0.304605 -1.127076 -1.180408 -0.520404 -1.118476 0.625217 0.313556 0.461439
340 N21 not_connected 0.00% 0.00% 0.00% 0.00% 2.577938 2.383987 1.367462 1.019859 0.521811 -0.013070 -1.430737 -1.389954 0.607846 0.322174 0.443893
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: [4, 5, 15, 17, 18, 27, 28, 29, 32, 34, 37, 40, 42, 43, 44, 47, 51, 54, 55, 58, 59, 60, 61, 74, 77, 78, 79, 86, 87, 92, 93, 94, 96, 104, 107, 109, 110, 111, 112, 115, 121, 123, 124, 126, 131, 133, 140, 141, 142, 143, 144, 145, 146, 149, 151, 153, 156, 160, 161, 163, 164, 165, 166, 169, 174, 180, 182, 183, 184, 185, 186, 187, 194, 200, 201, 202, 204, 205, 208, 209, 211, 213, 214, 220, 221, 222, 225, 227, 237, 238, 239, 242, 243, 246, 262, 329]

unflagged_ants: [3, 7, 8, 9, 10, 16, 19, 20, 21, 22, 30, 31, 35, 36, 38, 41, 45, 46, 48, 49, 50, 52, 53, 56, 57, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 80, 84, 85, 88, 89, 90, 91, 95, 97, 101, 102, 103, 105, 106, 108, 113, 114, 120, 122, 125, 127, 128, 132, 134, 135, 136, 139, 147, 148, 150, 152, 154, 155, 157, 158, 159, 162, 167, 168, 170, 171, 172, 173, 175, 179, 181, 189, 190, 191, 192, 193, 195, 206, 207, 210, 223, 224, 226, 228, 229, 240, 241, 244, 245, 261, 320, 324, 325, 332, 333, 336, 340]

golden_ants: [3, 7, 9, 10, 19, 20, 21, 30, 31, 38, 41, 45, 53, 56, 62, 65, 66, 67, 69, 70, 71, 72, 85, 88, 91, 101, 103, 105, 106, 122, 128, 147, 148, 150, 152, 154, 157, 158, 162, 167, 168, 170, 171, 172, 173, 181, 189, 190, 191, 192, 193, 320, 325]
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_2460125.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.1.1.dev3+gb291d34
3.2.3.dev158+gd5cadd5
In [ ]: