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 = "2460136"
data_path = "/mnt/sn1/2460136"
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: 7-10-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/2460136/zen.2460136.42128.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 359 ant_metrics files matching glob /mnt/sn1/2460136/zen.2460136.?????.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/2460136/zen.2460136.?????.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 2460136
Date 7-10-2023
LST Range 18.776 -- 20.706 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 359
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 N09, N18
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 205 / 205 (100.0%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 138 / 205 (67.3%)
Redcal Done? ❌
Never Flagged Antennas 0 / 205 (0.0%)
A Priori Good Antennas Flagged 83 / 83 total a priori good antennas:
3, 5, 7, 9, 10, 15, 17, 19, 20, 21, 30, 31,
37, 38, 40, 41, 42, 44, 45, 51, 53, 56, 62,
65, 66, 67, 69, 70, 71, 72, 85, 86, 88, 91,
101, 103, 105, 106, 107, 112, 121, 122, 123,
128, 140, 141, 144, 145, 146, 147, 148, 149,
150, 151, 152, 153, 154, 157, 158, 161, 162,
163, 164, 165, 167, 168, 169, 170, 171, 172,
173, 181, 183, 186, 187, 189, 190, 191, 192,
193, 202, 320, 325
A Priori Bad Antennas Not Flagged 0 / 122 total a priori bad antennas:
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_2460136.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% 25.07% 100.00% 0.00% -0.135588 -0.443024 -0.142434 -1.168539 0.088505 -1.103863 -0.101821 -0.810045 0.229328 0.084103 0.167116
4 N01 RF_maintenance 100.00% 25.07% 100.00% 0.00% -1.913199 26.718753 -0.145409 0.191746 -1.390670 1.465272 -1.015935 -0.795118 0.231289 0.078514 0.166552
5 N01 digital_ok 0.00% 25.07% 100.00% 0.00% -0.194214 -0.031218 -0.389528 3.444940 0.103606 0.833814 -0.218761 0.137075 0.233770 0.081953 0.170644
7 N02 digital_ok 0.00% 0.28% 98.33% 0.00% -1.740074 -1.102035 -1.101802 -1.217106 -0.993518 0.394642 0.156682 3.435281 0.270841 0.129679 0.223200
8 N02 RF_maintenance 100.00% 0.28% 98.33% 0.00% 4.344073 5.708920 3.430951 3.848322 3.785571 4.329180 -2.357948 -2.653170 0.257986 0.135092 0.206694
9 N02 digital_ok 100.00% 0.28% 98.33% 0.00% 1.058095 -0.216492 4.262501 -0.081892 0.523662 -0.235776 0.438643 -0.465404 0.267746 0.127272 0.216196
10 N02 digital_ok 0.00% 0.28% 98.33% 0.00% 0.467541 -1.362297 1.086175 -0.582235 0.015461 -1.115321 -1.682080 -0.986674 0.270493 0.135212 0.225500
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 18.184671 -0.941672 -0.178000 -1.345816 0.627384 -0.909156 -1.165910 -1.344707 0.040280 0.039312 0.010836
16 N01 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.493736 1.028483 0.566691 0.870868 -1.002720 0.392809 -2.022533 -2.227384 0.036983 0.037352 0.008264
17 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 0.474806 1.172575 1.736102 4.546138 1.227731 0.578062 -0.892016 -0.275656 0.037677 0.037012 0.008218
18 N01 RF_maintenance 100.00% 99.72% 100.00% 0.00% 11.320884 14.144246 0.550034 2.964535 0.239344 2.707505 5.727473 21.112722 0.159806 0.056091 0.114108
19 N02 digital_ok 100.00% 0.28% 98.33% 0.00% -1.653036 0.472436 -1.446137 2.178010 -1.014824 1.972969 -0.719783 4.336896 0.285582 0.122529 0.227777
20 N02 digital_ok 0.00% 0.28% 98.33% 0.00% 0.392252 -0.911604 0.803936 0.398477 0.678347 0.390979 0.106020 -0.372496 0.285989 0.127357 0.227300
21 N02 digital_ok 0.00% 0.28% 98.61% 0.00% 0.055406 -0.528945 -1.055318 -0.737782 -0.479710 -0.064037 -0.563046 -0.633109 0.266018 0.136271 0.211461
22 N06 not_connected 0.00% 29.25% 99.72% 0.00% 0.310657 -1.084420 1.909356 -1.196501 -0.027395 -0.338384 0.449057 -0.347780 0.214509 0.119656 0.163650
27 N01 RF_ok 100.00% 100.00% 100.00% 0.00% 28.809455 30.715447 14.110511 5.230945 6.822011 5.657017 3.796840 18.248750 0.022430 0.047408 0.020681
28 N01 RF_ok 100.00% 28.41% 100.00% 0.00% -0.956246 25.171118 0.223592 6.412710 -0.689692 3.774571 -0.005815 5.656170 0.218618 0.046285 0.182381
29 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 14.686017 17.137698 15.196126 15.239228 6.428677 6.508022 -0.024965 -0.274151 0.016684 0.017273 0.000845
30 N01 digital_ok 0.00% 100.00% 100.00% 0.00% 1.351784 -1.598187 1.749694 -0.667166 0.893955 -1.326222 -2.306206 -1.703778 0.033176 0.031163 0.006071
31 N02 digital_ok 0.00% 0.28% 98.89% 0.00% 0.425521 0.609746 -0.385964 3.502727 0.474964 1.857742 -0.298412 0.809755 0.269822 0.137955 0.229764
32 N02 RF_maintenance 100.00% 63.51% 98.89% 0.00% 29.169960 19.873777 -0.089746 -0.667077 -1.230353 -0.498390 0.489303 2.531827 0.193545 0.137088 0.127405
34 N06 not_connected 100.00% 100.00% 99.72% 0.00% 16.516316 1.590271 8.631177 1.247075 6.418014 0.763478 0.627895 -1.488058 0.019775 0.129400 0.058641
35 N06 not_connected 0.00% 10.58% 99.72% 0.00% 0.911177 -0.191651 1.188914 0.157081 0.123348 -0.658051 -1.707145 -1.396703 0.253067 0.129532 0.200474
36 N03 RF_maintenance 100.00% 0.00% 31.20% 0.00% 7.700027 6.857602 0.735621 0.098676 2.049570 0.643489 0.111720 -0.034959 0.289362 0.195996 0.239647
37 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 14.438243 13.494902 6.515223 8.173419 1.315288 0.748686 -0.464203 1.048234 0.046174 0.038394 0.012461
38 N03 digital_ok 0.00% 100.00% 100.00% 0.00% -1.092879 -0.518881 -1.092449 0.653688 -0.793451 0.946785 -0.589652 0.121736 0.048382 0.040382 0.013403
40 N04 digital_ok 100.00% 0.28% 34.82% 0.00% 0.060674 1.385203 0.752618 0.463949 0.054169 0.426910 0.198875 17.841046 0.274139 0.209516 0.242851
41 N04 digital_ok 0.00% 0.28% 44.57% 0.00% 0.420547 0.610409 -0.327905 3.566098 -0.597462 0.996439 -0.394248 -0.060977 0.276446 0.194773 0.233420
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 0.893958 2.456738 -0.185067 7.124021 -0.021497 0.313344 -0.957406 -0.741484 0.038767 0.034809 0.010328
43 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.109712 0.054771 0.050972
44 N05 digital_ok 100.00% 100.00% 100.00% 0.00% 196.907490 197.315785 inf inf 1688.658306 1700.725335 3624.190540 3638.217183 0.074055 0.062275 0.104518
45 N05 digital_ok 100.00% 99.72% 100.00% 0.00% 224.190108 224.751380 inf inf 1670.798657 1662.419617 3690.466905 3666.937326 0.242800 0.125927 0.144002
46 N05 RF_maintenance 100.00% 99.72% 99.72% 0.00% 228.052800 227.572929 inf inf 1636.029685 1662.226832 3956.233761 3986.211876 0.223687 0.277805 0.131060
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 14.927358 17.748995 8.327124 8.018363 5.977761 6.499668 -0.044608 -0.415919 0.024595 0.019896 0.003773
48 N06 not_connected 0.00% 10.03% 100.00% 0.00% 0.213552 2.111997 0.121772 1.791998 -0.967631 1.128969 -1.309094 -2.030236 0.257497 0.122386 0.203623
49 N06 not_connected 0.00% 10.03% 100.00% 0.00% -1.378461 1.077802 0.171965 0.544222 -1.340667 -0.006418 -0.076608 -1.334363 0.245384 0.125619 0.188547
50 N03 RF_maintenance 0.00% 0.00% 28.13% 0.00% 0.019224 0.332171 -0.173596 0.018119 1.191452 0.212890 -0.428495 -0.545352 0.298527 0.228928 0.252641
51 N03 digital_ok 100.00% 0.00% 28.13% 0.00% 2.955949 1.584041 -1.203266 0.958542 0.755045 0.847980 35.680202 1.196240 0.278889 0.229013 0.231567
52 N03 RF_maintenance 100.00% 0.00% 28.13% 0.00% 7.339007 5.053954 0.320639 -0.945392 0.389804 -0.838278 0.861936 -0.394329 0.306643 0.264072 0.261373
53 N03 digital_ok 0.00% 0.00% 28.13% 0.00% 0.923854 1.752597 -0.699552 -1.068585 -1.245004 -1.069209 1.720489 0.866747 0.289840 0.240446 0.250123
54 N04 dish_maintenance 100.00% 100.00% 100.00% 0.00% 24.068227 8.562804 2.974609 4.324786 3.725087 2.490607 -0.467365 -0.634426 0.032770 0.036040 0.006352
55 N04 RF_maintenance 100.00% 100.00% 26.46% 0.00% 59.149301 -0.948369 10.615221 0.121294 6.026395 -1.171097 0.080641 -0.116918 0.019445 0.251985 0.078446
56 N04 digital_ok 0.00% 0.28% 32.87% 0.00% -0.263265 2.682743 -1.242170 -0.396574 0.006418 0.152368 -0.629435 -0.391326 0.278888 0.227075 0.239800
57 N04 RF_maintenance 0.00% 0.28% 44.57% 0.00% -1.469667 -0.646022 -1.182562 -1.422361 -0.850667 -0.891714 -0.479873 -0.681974 0.271713 0.190941 0.229522
58 N05 RF_maintenance 100.00% 99.72% 100.00% 0.00% 229.997982 230.516899 inf inf 1675.199187 1669.949983 2936.348618 2868.816100 0.314460 0.149532 0.095926
59 N05 RF_maintenance 100.00% 99.72% 99.72% 0.00% 186.234145 186.124719 inf inf 1488.513401 1480.983271 3456.571786 3459.411583 0.377775 0.250102 0.094944
60 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 220.167889 220.677085 inf inf 1575.632709 1576.076789 2727.592716 2727.667459 0.090156 0.062459 0.024300
61 N06 not_connected 100.00% 100.00% 100.00% 0.00% 16.284140 -0.655760 8.121761 -0.817394 6.424665 -1.275873 -0.222234 -1.264766 0.016538 0.035320 0.013876
62 N06 digital_ok 0.00% 10.86% 99.72% 0.00% -0.506030 3.007899 1.289010 1.965674 -1.294256 2.000694 0.758381 -1.448724 0.231762 0.130090 0.180561
63 N06 not_connected 100.00% 2.51% 99.44% 0.00% 0.678384 7.632395 0.077450 4.836750 -1.480363 5.676440 -1.158990 -3.230271 0.272634 0.129833 0.220776
64 N06 not_connected 0.00% 2.51% 99.44% 0.00% 0.053465 -0.899916 -0.966116 -1.333065 -1.679117 -1.482752 -0.867086 -0.805026 0.264302 0.131868 0.207278
65 N03 digital_ok 0.00% 0.00% 29.53% 0.00% 0.535674 -0.170557 0.178266 -1.367992 0.264970 -0.709370 0.063773 -0.087893 0.261659 0.202077 0.233745
66 N03 digital_ok 0.00% 0.00% 28.13% 0.00% 1.848369 0.929278 -0.057076 0.360602 -0.784514 1.141784 -0.281783 -0.055035 0.256226 0.222275 0.219254
67 N03 digital_ok 0.00% 0.00% 28.13% 0.00% -0.541968 -0.714701 -1.100488 0.677000 0.270328 1.190065 0.563988 0.117102 0.270024 0.237974 0.229924
68 N03 RF_ok 0.00% 100.00% 100.00% 0.00% 1.554734 -0.433232 1.382062 0.623377 1.512130 1.127909 -0.626480 -0.882368 0.045475 0.041015 0.016026
69 N04 digital_ok 0.00% 0.00% 26.46% 0.00% 0.678264 0.145987 0.362809 -0.707076 1.279528 0.477138 0.563898 -0.514787 0.285659 0.255934 0.248991
70 N04 digital_ok 0.00% 0.28% 26.46% 0.00% 0.213636 -0.365552 2.345687 0.223567 0.598526 0.341643 0.165819 0.537019 0.302436 0.264745 0.249180
71 N04 digital_ok 100.00% 0.28% 26.46% 0.00% 6.910121 -0.970128 -1.108053 -0.548976 -1.143498 0.238431 -0.848857 -0.549990 0.312690 0.240837 0.261597
72 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 0.128943 -0.160783 -0.769220 -0.353620 -0.044628 0.245877 -1.007278 -0.988259 0.040045 0.034922 0.009571
73 N05 RF_maintenance 100.00% 99.72% 99.72% 0.00% 247.562246 247.580488 inf inf 1747.514002 1763.432814 3901.691758 3967.062904 0.220209 0.237335 0.180218
74 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.061866 0.057897 0.012153
77 N06 not_connected 100.00% 100.00% 100.00% 0.00% 39.026054 9.871016 0.366673 0.301411 2.855673 1.430256 -0.943898 -1.367055 0.032746 0.035269 0.004849
78 N06 not_connected 100.00% 90.53% 98.33% 0.00% 24.130153 2.445981 -0.432690 2.129688 0.806318 1.894615 0.591362 -1.444184 0.179401 0.141556 0.124541
79 N11 not_connected 0.00% 0.56% 88.58% 0.00% 0.209265 -0.328750 0.000742 -0.198375 -0.941225 -0.479366 1.350548 -0.065611 0.256922 0.134704 0.190248
80 N11 not_connected 100.00% 0.56% 88.86% 0.00% 0.598226 5.192846 0.552904 3.585939 -0.150783 4.160070 -1.127458 -1.998025 0.259387 0.132674 0.197121
84 N08 RF_ok 100.00% 100.00% 100.00% 0.00% 2.368748 5.244558 2.651900 3.732897 2.554227 4.267696 -2.277252 -2.689679 0.038451 0.035548 0.014061
85 N08 digital_ok 0.00% 0.00% 46.52% 0.00% 0.445130 0.493105 0.165676 -1.263218 -1.329901 -1.045718 -0.518131 -0.027705 0.257712 0.211228 0.212219
86 N08 digital_ok 100.00% 100.00% 46.52% 0.00% 14.902573 1.038363 13.551943 -0.506502 6.555333 -0.115591 1.731078 7.018293 0.024533 0.209726 0.059111
87 N08 RF_maintenance 100.00% 30.36% 46.52% 0.00% 41.975137 6.395574 3.461135 -0.729288 -0.057792 -0.480420 0.928746 -0.030178 0.211036 0.213789 0.157675
88 N09 digital_ok 100.00% 100.00% 100.00% 0.00% 229.058777 229.249216 inf inf 1623.247781 1621.465844 3008.104022 3106.991815 0.148896 0.034094 0.076244
89 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.105886 0.073581 0.045098
90 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.067492 0.122961 0.112289
91 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.113984 0.084130 0.056096
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 14.533869 16.872148 15.605201 15.699815 6.473272 6.555586 1.337052 1.226983 0.016486 0.016504 0.000403
93 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.981425 17.706969 2.065228 15.890308 2.169846 6.510636 -0.811108 1.646889 0.031398 0.020884 0.003788
94 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.831422 2.464292 0.418725 9.035416 1.328527 1.701774 0.298980 0.445888 0.037968 0.032560 0.008737
95 N11 not_connected 0.00% 0.56% 81.34% 0.00% 1.060548 0.863262 -1.393874 1.190025 -1.198689 1.021207 0.497575 -0.495386 0.253182 0.150928 0.196506
96 N11 not_connected 100.00% 0.56% 83.01% 0.00% 2.045820 21.578164 1.826560 -0.585947 1.756287 0.653196 -0.210487 1.147150 0.267773 0.142407 0.199028
97 N11 not_connected 0.00% 0.56% 82.17% 0.00% -1.268909 1.020638 -0.476459 -0.890900 -1.228654 -0.670634 0.197765 1.766930 0.262888 0.144144 0.205557
101 N08 digital_ok 100.00% 0.00% 61.56% 0.00% 7.233520 7.865850 -0.651230 0.233806 -0.039653 0.512354 1.003596 1.223128 0.294736 0.185796 0.253109
102 N08 RF_maintenance 0.00% 0.00% 61.56% 0.00% -1.133755 0.376876 -0.505643 -1.240503 -1.427498 -0.428880 0.027705 1.734611 0.259865 0.189315 0.205862
103 N08 digital_ok 100.00% 0.00% 66.30% 0.00% 1.083859 6.529795 -0.042522 -0.542332 -0.996352 0.239283 -0.196515 0.852254 0.268225 0.188096 0.213331
104 N08 dish_maintenance 100.00% 0.00% 67.13% 0.00% 5.721298 59.827849 5.618640 7.624857 6.071490 0.105361 2.329544 1.341083 0.262957 0.179334 0.221385
105 N09 digital_ok 100.00% 100.00% 100.00% 0.00% 215.969563 216.324920 inf inf 1668.244732 1673.088031 3679.560029 3703.141929 0.126503 0.045914 0.077790
106 N09 digital_ok 100.00% 100.00% 100.00% 0.00% 139.066686 139.218973 inf inf 1598.401717 1583.975709 3864.724208 3885.373927 0.134210 0.109020 0.077229
107 N09 digital_ok 100.00% 100.00% 100.00% 0.00% 218.323681 217.995897 inf inf 1801.843519 1798.186279 4191.304279 4163.963172 0.041670 0.028659 -0.009940
108 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% 173.599986 174.508939 inf inf 1698.653135 1675.794949 3624.922271 3500.670613 0.123885 0.081201 0.058070
109 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.680431 17.255598 -0.049940 15.516389 6.366076 6.586997 0.109990 2.009269 0.087316 0.020789 0.036934
110 N10 RF_maintenance 100.00% 93.87% 78.27% 0.00% 21.152929 -0.602655 1.189768 -0.864573 2.176052 -1.119454 -0.895009 -0.226178 0.176488 0.142482 0.130142
111 N10 RF_maintenance 100.00% 33.43% 78.27% 0.00% 18.742371 1.308118 0.895549 0.951735 3.109945 0.076107 2.466853 0.419748 0.204886 0.150289 0.166184
112 N10 digital_ok 100.00% 100.00% 78.27% 0.00% 6.984858 1.252411 13.071088 1.463966 1.706913 1.220719 1.901027 -0.158685 0.159389 0.160854 0.125165
113 N11 not_connected 100.00% 0.56% 81.06% 0.00% 5.898349 7.390100 4.227547 4.678478 5.007020 5.470805 -2.382748 -2.653970 0.247249 0.148131 0.195711
114 N11 not_connected 100.00% 0.56% 81.06% 0.00% 5.226957 0.983539 3.749561 -0.221641 4.414716 -0.518548 -1.648667 -0.112419 0.250387 0.149082 0.191376
115 N11 not_connected 100.00% 100.00% 100.00% 0.00% 7.516431 8.908487 3.695901 4.550291 4.750387 5.546228 3.338167 1.067524 0.019033 0.018604 0.002798
120 N08 RF_maintenance 0.00% 0.00% 74.37% 0.00% 3.348398 2.027534 3.016843 -0.611829 0.560835 -0.164400 0.896095 0.251231 0.263406 0.150944 0.210326
121 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 3.805592 3.987772 2.969836 7.384466 3.093358 0.856149 -2.499364 -0.251363 0.038803 0.034462 0.008569
122 N08 digital_ok 100.00% 0.00% 68.25% 0.00% 5.850535 5.822191 -0.848909 -0.385170 -0.462740 -1.180655 -0.485252 -1.161572 0.288048 0.174628 0.239822
123 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 4.911509 3.319169 3.909386 2.450508 4.635547 2.389681 -1.955674 -1.666514 0.041971 0.036290 0.009781
124 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% 212.062426 211.845229 inf inf 1673.545896 1669.619163 3687.777508 3685.990607 0.071060 0.077087 0.021017
125 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% 173.123301 171.445277 inf inf 1660.684505 1678.071105 3645.286677 3722.950827 0.148986 0.108515 0.077925
126 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.093782 0.060664 0.047541
127 N10 RF_maintenance 0.00% 0.56% 78.27% 0.00% 1.829784 -0.307679 1.961422 -0.575853 2.824241 -0.211101 0.982926 0.607287 0.262749 0.154058 0.218195
128 N10 digital_ok 0.00% 0.56% 78.27% 0.00% 0.103369 -0.809660 0.055037 -1.405802 1.082477 -0.030953 2.846112 3.123005 0.276154 0.161207 0.234747
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 7.495463 9.333422 4.410816 7.811724 5.829612 5.941267 2.777336 15.225085 0.020044 0.019497 0.003109
132 N11 not_connected 0.00% 0.56% 80.22% 0.00% -0.752857 -1.142496 0.145803 -0.592054 -0.856676 -1.298572 -0.628856 -0.912691 0.267622 0.152884 0.212755
133 N11 not_connected 100.00% 100.00% 100.00% 0.00% 7.960986 8.961818 1.059821 4.211918 1.939969 5.274193 19.559116 4.551815 0.018846 0.018680 0.003058
134 N11 not_connected 100.00% 30.36% 87.19% 0.00% 1.711341 5.562451 2.976254 3.699926 -0.652847 4.034289 2.278934 -0.888273 0.212744 0.131246 0.163636
135 N12 RF_maintenance 0.00% 16.71% 100.00% 0.00% 1.824319 -0.627092 0.011420 0.391320 -0.556353 0.159665 -0.429066 0.558688 0.246897 0.098596 0.182333
136 N12 RF_maintenance 100.00% 10.86% 100.00% 0.00% -0.499590 11.354132 -0.456634 0.112406 -1.344573 0.397828 0.426800 1.965084 0.265085 0.095798 0.196891
139 N13 RF_maintenance 0.00% 100.00% 100.00% 0.00% 2.129178 -0.353182 1.639002 -0.374206 0.934096 -0.412839 -0.902795 -0.309811 0.039157 0.035613 0.010749
140 N13 digital_ok 100.00% 9.75% 100.00% 0.00% 24.461050 1.867976 -0.463378 -0.403578 3.597669 0.923641 41.060522 11.545162 0.227162 0.107568 0.151156
141 N13 digital_ok 100.00% 100.00% 100.00% 0.00% 15.320758 -0.683066 15.571803 -0.163879 6.450419 0.855183 1.413930 0.172169 0.029420 0.096881 0.061707
142 N13 RF_ok 100.00% 8.64% 100.00% 0.00% -0.787395 0.018923 -0.243075 -1.050822 0.382739 -0.263559 4.892875 2.751466 0.262942 0.104211 0.191740
143 N14 RF_maintenance 100.00% 99.72% 99.72% 0.00% 103.840740 101.045700 inf inf 1448.231543 1453.149713 3643.773364 3668.467971 0.219147 0.104810 0.166702
144 N14 digital_ok 100.00% 99.72% 100.00% 0.00% 97.372352 98.909007 inf inf 1466.034578 1449.333701 3535.145623 3544.337810 0.226971 0.099276 0.160394
145 N14 digital_ok 100.00% 99.72% 100.00% 0.00% 184.061468 184.855253 inf inf 1481.230413 1477.321112 3269.982664 3356.859911 0.294126 0.080789 0.143775
146 N14 digital_ok 100.00% 99.72% 99.72% 0.00% 120.336175 120.580178 inf inf 1530.711974 1533.723238 3771.671684 3804.536819 0.137477 0.070838 0.061792
147 N15 digital_ok 0.00% 0.00% 59.05% 0.00% 0.878074 -0.843029 2.508279 0.548005 2.172973 1.266106 2.791439 2.432259 0.293844 0.181425 0.254083
148 N15 digital_ok 0.00% 0.00% 59.05% 0.00% -0.543161 -0.291591 -0.315978 -0.001002 0.364330 0.057316 0.509968 0.553380 0.301134 0.199151 0.262260
149 N15 digital_ok 0.00% 0.00% 59.05% 0.00% -0.070347 -0.808883 0.963340 -0.670849 0.733772 0.013219 1.760673 1.215098 0.299291 0.209428 0.267720
150 N15 digital_ok 0.00% 100.00% 100.00% 0.00% -0.116916 -0.675539 0.380148 -0.549697 0.659248 0.179989 1.483541 1.137604 0.041887 0.036560 0.011676
151 N16 digital_ok 100.00% 25.35% 77.72% 0.00% 14.800586 -1.539709 -0.447257 0.306099 1.319766 -1.125146 -0.748155 1.560723 0.213520 0.158423 0.156991
152 N16 digital_ok 0.00% 2.51% 85.24% 0.00% -1.261156 -1.206504 -1.020215 -0.745274 -1.530317 -0.944700 0.117572 -0.186528 0.256727 0.141748 0.202243
153 N16 digital_ok 100.00% 100.00% 85.79% 0.00% 15.155823 -0.820010 8.303934 -1.448311 6.562198 -0.025420 2.387583 2.125513 0.018834 0.136443 0.059745
154 N16 digital_ok 0.00% 24.51% 92.76% 0.00% -0.407610 -0.397530 0.506836 -0.084864 0.046998 0.085404 0.804603 0.956197 0.236898 0.122867 0.183449
155 N12 RF_maintenance 0.00% 17.55% 100.00% 0.00% 2.212866 -1.250013 2.549109 -0.702006 2.058849 -0.343476 -1.451644 -0.229218 0.238480 0.093472 0.168191
156 N12 RF_maintenance 100.00% 10.58% 100.00% 0.00% 1.167720 -0.443424 4.716404 0.016041 0.441317 0.300356 1.026478 0.234330 0.256068 0.096487 0.184657
157 N12 digital_ok 0.00% 10.31% 100.00% 0.00% 0.652953 -0.488015 -0.149545 -0.130216 0.351881 -0.405826 0.128130 -0.067565 0.264410 0.093722 0.191653
158 N12 digital_ok 0.00% 9.47% 100.00% 0.00% -1.383112 -1.529901 -0.671981 -0.727239 0.177001 -0.151864 0.785904 3.882082 0.265850 0.090615 0.192177
159 N13 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.157512 0.167635 0.582812 -1.212231 -0.311204 -0.320435 1.195081 0.569240 0.040779 0.034503 0.008111
160 N13 RF_maintenance 100.00% 8.36% 100.00% 0.00% 3.572067 -0.199655 3.070129 6.235855 3.337067 0.186956 -0.776543 3.185152 0.266589 0.094277 0.190231
161 N13 digital_ok 100.00% 9.75% 100.00% 0.00% -0.317494 32.080182 0.339758 -0.232819 0.860990 0.031124 2.060627 1.777031 0.246723 0.089059 0.169674
162 N13 digital_ok 0.00% 9.75% 100.00% 0.00% -0.862930 -0.284331 -1.099287 -0.420209 -1.360300 -0.141181 0.368231 0.536850 0.245406 0.094986 0.174048
163 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.124141 0.110919 0.039061
164 N14 digital_ok 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.197395 0.054725 0.115788
165 N14 digital_ok 100.00% 99.44% 99.72% 0.00% 105.473799 104.170643 inf inf 1672.272552 1680.088437 3926.946875 3934.825666 0.249104 0.098431 0.052833
166 N14 RF_maintenance 100.00% 99.72% 99.72% 0.00% 152.142539 152.522440 inf inf 1337.870815 1357.325085 3493.594648 3587.335613 0.264407 0.521142 0.049289
167 N15 digital_ok 0.00% 100.00% 100.00% 0.00% 0.170946 0.025389 0.197293 0.263811 0.498385 1.139417 0.667007 0.730672 0.043007 0.036772 0.012468
168 N15 digital_ok 0.00% 0.00% 58.22% 0.00% -1.236248 -0.804593 0.285688 -0.449307 0.514981 -0.023086 1.557478 1.356150 0.293394 0.199776 0.255489
169 N15 digital_ok 0.00% 0.00% 58.22% 0.00% -0.315477 -1.431327 0.241113 -1.140795 0.151276 -0.980794 0.067818 -0.245023 0.300044 0.217086 0.258451
170 N15 digital_ok 0.00% 0.00% 58.22% 0.00% 2.271731 0.239292 2.975552 0.365534 1.447910 1.133991 2.695110 2.013552 0.290357 0.223252 0.254373
171 N16 digital_ok 0.00% 2.51% 77.72% 0.00% -1.433860 -0.996982 0.371206 0.123386 -0.965015 -0.898431 0.333163 0.369438 0.247907 0.160108 0.193132
172 N16 digital_ok 0.00% 2.51% 84.12% 0.00% 0.595878 0.240892 0.832013 -1.206599 -0.336003 -1.127847 -1.080767 -0.188155 0.258591 0.147798 0.202858
173 N16 digital_ok 100.00% 20.33% 89.69% 0.00% 5.729710 7.209382 4.158347 4.591013 4.802822 5.295349 -2.784910 -3.034931 0.236152 0.127740 0.178700
174 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 16.702568 18.617374 8.190215 8.055572 6.466245 6.558053 0.101216 -0.161293 0.016510 0.016532 0.000760
175 N21 not_connected 100.00% 45.40% 100.00% 0.00% 4.218084 6.130710 3.083061 3.743047 3.203339 4.278655 -2.239509 -2.418341 0.200273 0.088254 0.146815
179 N12 RF_maintenance 100.00% 9.19% 100.00% 0.00% -0.274680 0.191975 1.166292 3.200899 1.898920 7.850475 0.772787 3.254391 0.255549 0.097228 0.188555
180 N13 RF_maintenance 100.00% 8.36% 100.00% 0.00% 0.545310 12.286062 1.234058 2.585735 0.586463 3.495234 1.730108 -1.392437 0.272210 0.096682 0.197939
181 N13 digital_ok 0.00% 8.36% 100.00% 0.00% 1.278634 0.272771 0.517560 -0.052766 2.084321 0.378093 0.729388 0.827224 0.274040 0.096405 0.199846
182 N13 RF_maintenance 100.00% 9.75% 100.00% 0.00% -0.361050 16.991134 0.736939 15.541252 0.012598 6.634814 1.080520 3.610256 0.242446 0.025401 0.160538
183 N13 digital_ok 100.00% 100.00% 100.00% 0.00% -0.480576 18.288833 -0.224477 15.672550 -0.191533 6.536434 -0.248448 0.684507 0.042321 0.017177 0.018067
184 N14 dish_maintenance 100.00% 99.72% 99.72% 0.00% 197.377988 197.117191 inf inf 1722.132904 1726.338829 3831.221158 3858.161360 0.198586 0.332350 0.293982
185 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 204.194805 204.012178 inf inf 1683.544442 1682.872707 3778.248594 3750.895989 0.087300 0.075842 0.043552
186 N14 digital_ok 100.00% 99.72% 99.72% 0.00% 159.908122 159.198509 inf inf 1489.948477 1468.731040 3422.580882 3375.645984 0.267956 0.478838 0.268780
187 N14 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.266111 0.196234 0.207207
189 N15 digital_ok 100.00% 0.00% 58.77% 0.00% 3.104872 5.607185 2.877566 3.828175 3.012998 4.499144 -1.713432 -2.176799 0.281866 0.194638 0.252963
190 N15 digital_ok 0.00% 0.00% 58.77% 0.00% -0.789012 -1.482085 -0.066126 -0.993283 0.241125 -0.455846 0.879180 0.429028 0.311259 0.199135 0.265523
191 N15 digital_ok 0.00% 0.00% 58.77% 0.00% -0.673443 -0.453716 0.538439 1.103626 1.930966 0.771595 3.323972 0.448280 0.306368 0.202597 0.262421
192 N16 digital_ok 100.00% 20.06% 89.69% 0.00% 6.260779 7.881940 4.486863 4.930710 5.382766 5.796661 -2.724128 -3.002431 0.237208 0.125922 0.179508
193 N16 digital_ok 100.00% 20.33% 94.71% 0.00% 6.281581 6.775772 4.470892 4.409616 5.395143 5.068549 -2.652491 -2.714953 0.233217 0.123217 0.172808
194 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 15.404542 0.173328 7.409754 0.317765 6.502141 0.486023 0.822652 -0.511064 0.016571 0.032800 0.011828
195 N21 not_connected 100.00% 45.40% 100.00% 0.00% 4.653101 2.214614 3.257255 1.579315 3.249232 0.805722 -2.403480 -1.749255 0.200524 0.087185 0.143998
200 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.049549 0.018228 0.024813
201 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.079861 0.027684 0.238635
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.084320 0.075223 0.043637
204 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.090146 0.062326 0.043944
205 N19 RF_ok 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.094354 0.090483 0.055481
206 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.145966 0.074119 0.077658
207 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.090943 0.073860 0.015393
208 N20 dish_maintenance 100.00% 23.96% 100.00% 0.00% 8.022052 11.262822 9.066038 15.272835 0.539541 6.109637 0.538955 24.154194 0.221114 0.018085 0.140774
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 7.537634 9.922148 14.339958 15.303757 6.612768 6.866733 6.963015 19.066986 0.016952 0.017644 0.000966
210 N20 dish_maintenance 100.00% 16.99% 100.00% 0.00% 13.128826 11.731124 -0.225804 -0.141198 -0.087792 -0.395105 0.055257 -0.086886 0.251945 0.099191 0.179670
211 N20 RF_maintenance 100.00% 23.96% 100.00% 0.00% -0.511132 17.183565 -0.793414 8.651407 -1.702682 6.524333 -0.179420 0.916320 0.224041 0.017491 0.142830
213 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 5.579764 18.839012 4.094795 8.253602 4.961177 6.365784 -1.780990 -0.093382 0.032524 0.024369 0.009321
214 N21 not_connected 100.00% 100.00% 100.00% 0.00% 15.870992 1.483125 8.359179 -0.377834 6.413550 -0.960010 0.651073 -0.845332 0.020997 0.091101 0.051294
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.093947 0.085303 0.069690
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.090020 0.062543 0.056180
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.105951 0.053008 0.056193
223 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.173046 0.086071 0.032370
224 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.134595 0.104835 0.052438
225 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.016702 0.050176 0.042801
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.068197 0.066007 0.039966
227 N20 RF_ok 100.00% 22.84% 100.00% 0.00% 0.714363 -0.684482 0.395576 -0.088216 -0.879257 0.290601 6.547640 2.751497 0.230400 0.095638 0.161234
228 N20 RF_maintenance 0.00% 20.33% 100.00% 0.00% 1.241335 -0.288516 0.572385 -0.994285 0.319177 -0.579214 -1.158716 -0.864346 0.240416 0.088903 0.169373
229 N20 RF_maintenance 0.00% 20.33% 100.00% 0.00% 1.177864 2.297147 1.138245 2.077112 0.165277 2.055999 -1.612997 -2.002637 0.242655 0.095386 0.175113
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.042581 0.064939 0.021768
238 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.144983 0.062656 0.113579
239 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.127759 0.083770 0.070093
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.119379 0.044754 0.078197
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.107252 0.038713 0.057517
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.130488 0.100942 0.055009
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.107358 0.068700 0.049399
244 N20 RF_maintenance 0.00% 35.38% 100.00% 0.00% -1.220753 -0.019224 -0.622894 0.807408 -0.748951 0.171406 0.063265 0.501610 0.209323 0.083474 0.146505
245 N20 RF_maintenance 0.00% 27.30% 100.00% 0.00% 0.840511 -0.526082 0.935534 -0.392977 -0.077691 -1.034611 -1.176927 0.079799 0.223822 0.081173 0.159359
246 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 4.929966 17.415279 4.491799 8.086409 0.797594 6.512292 -0.647628 -0.695786 0.040123 0.016606 0.016520
261 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.808082 0.597249 0.863261 0.468633 -0.246805 -0.541770 -1.995442 -2.058121 0.037054 0.033927 0.007203
262 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.630110 14.708952 -0.215950 -0.122833 0.227737 1.530055 -1.039465 -1.168128 0.036641 0.032981 0.006157
320 N03 digital_ok 0.00% 26.18% 100.00% 0.00% 0.330500 0.701034 -0.658850 -0.000742 -1.853939 -0.963868 -0.902194 -1.188476 0.228538 0.074444 0.171848
324 N04 not_connected 100.00% 32.59% 100.00% 0.00% 3.276144 4.107330 1.714595 2.275620 1.154695 2.030212 -1.477000 -1.851372 0.214597 0.070834 0.160639
325 N09 digital_ok 100.00% 100.00% 100.00% 0.00% 171.070126 171.425337 inf inf 1486.446521 1487.369356 3380.105150 3498.492574 0.116034 0.068252 0.043435
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 16.397679 17.334433 8.327642 8.719026 6.565554 6.673324 2.379922 2.429381 0.017401 0.017453 0.000641
332 N21 not_connected 100.00% 100.00% 100.00% 0.00% 3.746725 5.291365 2.529499 3.179577 2.015397 3.142882 -2.155333 -2.768292 0.034571 0.030384 0.007115
333 N12 dish_maintenance 0.00% 52.65% 100.00% 0.00% 0.341018 1.320136 0.849547 -1.369118 -0.366028 -0.757261 1.132823 0.641787 0.189324 0.067779 0.138848
336 N21 not_connected 0.00% 100.00% 100.00% 0.00% 3.521973 3.855802 1.374230 1.764192 0.644411 0.942141 -2.078425 -2.385971 0.034549 0.030440 0.006186
340 N21 not_connected 100.00% 100.00% 100.00% 0.00% 6.165217 6.260006 4.009160 3.641807 4.592788 3.754864 -2.914287 -2.925135 0.035141 0.030407 0.006186
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, 5, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 120, 121, 122, 123, 124, 125, 126, 127, 128, 131, 132, 133, 134, 135, 136, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 194, 195, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 213, 214, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 324, 325, 329, 332, 333, 336, 340]

unflagged_ants: []

golden_ants: []
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_2460136.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 [ ]: