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 = "2460088"
data_path = "/mnt/sn1/2460088"
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: 5-23-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/2460088/zen.2460088.42139.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/2460088/zen.2460088.?????.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/2460088/zen.2460088.?????.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 2460088
Date 5-23-2023
LST Range 15.625 -- 17.560 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 360
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 94
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas 40, 42, 70, 112
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating N07
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 65 / 198 (32.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 93 / 198 (47.0%)
Redcal Done? ❌
Never Flagged Antennas 103 / 198 (52.0%)
A Priori Good Antennas Flagged 47 / 94 total a priori good antennas:
7, 15, 16, 17, 29, 31, 37, 38, 40, 41, 42,
55, 62, 66, 70, 81, 83, 86, 93, 94, 109, 111,
112, 118, 121, 124, 127, 136, 147, 148, 149,
150, 151, 160, 161, 165, 166, 167, 168, 169,
170, 181, 182, 184, 189, 190, 191
A Priori Bad Antennas Not Flagged 56 / 104 total a priori bad antennas:
8, 22, 35, 36, 43, 46, 48, 49, 50, 52, 57,
63, 64, 73, 74, 79, 80, 89, 90, 95, 97, 102,
108, 113, 115, 120, 126, 132, 133, 135, 139,
179, 185, 201, 207, 220, 221, 222, 223, 224,
226, 228, 229, 237, 238, 239, 240, 241, 243,
244, 245, 261, 320, 324, 325, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2460088.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
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.931229 6.756749 -0.789405 -0.379414 -0.731115 -0.372667 -0.663137 -0.313886 0.525052 0.421830 0.326538
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.391021 2.133218 0.559230 3.756955 0.866932 2.597933 0.162148 1.281469 0.540242 0.523077 0.336221
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.895657 -0.078311 -0.448241 0.239547 -0.190867 0.132615 0.586487 4.139386 0.540757 0.527522 0.324861
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.039841 2.166262 1.476261 1.539023 0.804350 0.740305 -0.918952 -1.216039 0.512583 0.500059 0.312756
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 2.245166 -0.497268 3.586817 -0.455110 2.619593 0.102042 2.603888 0.152638 0.537516 0.530161 0.324291
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.123807 -0.701689 -0.563362 -0.545889 -0.182899 -0.422230 -0.364156 -0.339122 0.531616 0.512693 0.323702
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 5.950174 -0.123695 0.028364 -0.197488 -0.357151 0.253593 0.171547 0.329896 0.462168 0.537222 0.322418
16 N01 digital_ok 100.00% 100.00% 44.17% 0.00% 5.150563 1.621907 14.320015 1.206465 1.736873 0.335661 1.520328 -1.131113 0.084216 0.217601 0.069574
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.644977 1.863237 0.978062 11.110380 1.256076 0.587271 0.479720 3.252821 0.561338 0.470970 0.374765
18 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.059128 6.580727 11.143734 14.922987 0.190806 1.755572 16.999268 1.480795 0.129911 0.057574 0.052441
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.349889 -0.722820 -0.194410 -0.478465 -0.035431 0.049175 -0.176636 0.730730 0.559072 0.553096 0.328760
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.999081 -0.782198 2.152754 -0.303787 2.062458 0.031300 1.251851 -0.183529 0.561322 0.548727 0.330333
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.308636 0.391481 0.033334 0.413217 0.253848 0.520836 0.070298 0.045751 0.546479 0.537487 0.322993
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.069571 -0.755359 0.631109 -0.470865 -0.179223 -0.416617 1.433616 0.708851 0.512642 0.505154 0.322557
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.330370 12.168478 13.905482 8.944172 1.072261 0.361365 5.116364 54.735348 0.083513 0.068631 -0.011765
28 N01 RF_maintenance 100.00% 100.00% 12.78% 0.00% 5.318899 8.427812 14.368864 5.694565 1.930762 0.771977 2.141900 15.176097 0.030361 0.284020 0.222196
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 5.392137 6.187867 14.105183 14.377911 1.924265 1.768317 2.125458 1.311766 0.031154 0.041201 0.010487
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.172836 -0.780532 0.065914 -0.659191 0.442341 -0.431043 0.291396 -0.494417 0.572537 0.565116 0.337401
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.694594 1.716036 1.173231 4.859750 1.240476 2.161979 0.537542 7.270019 0.576092 0.556764 0.330919
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.342262 -0.799226 0.450839 -0.947224 -0.690874 -0.673083 1.472367 1.302525 0.497001 0.553321 0.299537
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 5.959864 -0.082815 8.913924 -0.344062 1.930280 -0.853237 2.226467 -0.283244 0.048339 0.522085 0.367193
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.051555 -0.966025 -0.005729 -0.475195 -0.557718 -0.376970 -0.979060 -0.460519 0.523806 0.515842 0.320824
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.275871 1.980212 1.225322 0.901408 1.301898 0.991831 0.755040 0.800340 0.515248 0.494848 0.305611
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.876559 12.037021 -0.894219 17.848181 -0.421876 1.846123 0.535476 4.338683 0.531928 0.036360 0.409020
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.076964 0.042320 0.078570 0.914950 0.304725 0.993193 0.927081 5.707670 0.543244 0.532495 0.322467
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.453505 0.096836 0.527756 -0.336574 0.385937 0.284005 20.747852 1.260218 0.241629 0.241673 -0.268470
41 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.950083 2.519456 1.339995 4.126683 1.519510 2.072242 0.953029 1.549428 0.575895 0.566976 0.339285
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.078646 0.005706 -0.060452 -0.692224 0.034250 0.129409 0.250452 0.999364 0.257087 0.250238 -0.271830
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.782518 0.431580 -0.701761 0.905900 -0.820904 1.064627 -0.290168 1.232326 0.587675 0.583593 0.341485
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.952716 0.637240 -0.610364 0.630333 -0.350171 0.620592 0.886918 1.306697 0.579812 0.582586 0.334416
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.978209 1.031076 1.041612 0.769735 1.125900 0.723872 1.324316 3.056797 0.584778 0.577346 0.339595
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.037512 -0.934376 0.281431 -0.930825 0.565802 -0.612925 0.163686 -0.580487 0.574909 0.569896 0.346328
47 N06 not_connected 100.00% 96.94% 96.94% 0.00% 81.145590 79.518767 inf inf 317.380415 326.666621 4248.915298 4384.286523 0.506611 0.455125 0.271946
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.566929 0.673917 -0.690587 0.344496 -0.949296 -0.256590 -0.605439 -1.090693 0.534122 0.521872 0.319643
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.089995 -0.459745 0.950595 -0.716590 0.472944 -0.994233 0.303006 -0.454499 0.520879 0.511525 0.322419
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.411740 0.854770 -0.063618 1.683128 0.207412 1.501723 0.156396 0.733757 0.516323 0.498634 0.308696
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 0.477996 -0.372025 0.075029 -0.049309 0.870796 0.283331 53.940616 0.009848 0.530040 0.520447 0.315224
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.880262 1.175270 0.677495 0.314258 0.912720 0.657401 1.028019 0.280360 0.552536 0.537593 0.320509
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.282083 -0.171457 -0.164823 -0.319800 0.776443 -0.803882 1.923120 1.865787 0.567555 0.551316 0.334879
54 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 3.179592 2.013485 0.742479 -0.761644 1.518545 1.593630 0.136491 0.260257 0.303168 0.359262 0.169053
55 N04 digital_ok 100.00% 31.11% 100.00% 0.00% 0.390676 19.883720 0.135863 11.994710 -0.283443 1.923704 1.472329 2.036105 0.246773 0.047285 0.089952
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.866478 2.099931 -0.939984 2.176485 -0.687939 0.819423 0.235164 1.531544 0.589975 0.585825 0.335690
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.841508 -0.177949 -0.883432 -0.090195 -0.608868 0.370238 -0.350457 0.460090 0.598664 0.595224 0.338581
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.083542 6.093120 14.365606 14.859571 1.920110 1.768387 2.316715 2.042240 0.041945 0.041893 0.002455
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.499089 0.997429 14.370837 0.979879 1.909966 1.112827 1.396030 3.303929 0.060603 0.589233 0.438048
60 N05 RF_maintenance 100.00% 0.00% 88.61% 0.00% -0.120153 5.989158 0.334429 14.885137 0.231294 1.713800 1.007105 3.384038 0.571234 0.116083 0.442975
61 N06 not_connected 100.00% 97.78% 98.06% 0.00% 79.523835 79.680201 inf inf 392.009905 401.429538 4798.706303 4425.396106 0.559887 0.488188 0.283419
62 N06 digital_ok 100.00% 0.00% 100.00% 0.00% 0.282547 6.444193 1.293851 8.257457 0.604207 1.769811 0.681221 1.037803 0.528722 0.058589 0.400447
63 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.315508 3.076880 -0.651218 2.182673 -0.994425 1.334735 -0.674515 -1.227513 0.538443 0.487850 0.332761
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.769416 -0.500749 -0.814998 0.062931 -0.706238 0.085304 -0.346082 -0.065316 0.527764 0.512126 0.316701
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.640722 -0.416652 0.642848 -0.189822 1.096247 0.482763 0.229922 -0.023523 0.518886 0.501347 0.317229
66 N03 digital_ok 100.00% 48.33% 100.00% 0.00% 1.552175 11.394118 1.087807 17.730692 0.501202 1.736168 -0.951828 5.097773 0.212051 0.064758 0.087196
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.557371 0.628501 0.014624 1.580601 0.207475 1.530288 1.973268 1.524920 0.555786 0.541487 0.320610
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 12.587905 0.614278 17.751852 0.197430 1.979398 -0.476482 4.415386 -0.948149 0.038247 0.545166 0.423308
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.465618 -0.290848 1.695642 -0.601033 1.401712 -0.240108 1.671558 0.001856 0.582620 0.570836 0.325809
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% 0.881926 2.069788 1.442911 2.792581 0.961114 2.218787 1.963547 1.094097 0.273412 0.261523 -0.265864
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.284487 0.342414 -0.186453 0.538230 0.098384 0.676934 -0.030500 0.744991 0.601498 0.597694 0.336342
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.142996 -1.094041 -0.259979 -0.821860 0.349660 -0.704538 0.799587 0.069484 0.608805 0.602358 0.341878
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.605018 2.134754 -0.643026 2.537078 -0.127140 1.465793 0.406911 2.340604 0.605318 0.601297 0.341343
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.772999 -0.264215 -0.525481 -0.040692 -0.793171 0.071932 -0.025404 0.858927 0.590058 0.593605 0.342489
77 N06 not_connected 100.00% 99.17% 98.89% 0.00% 81.910642 81.983166 inf inf 396.812727 394.937573 4070.762283 4195.103786 0.416924 0.525699 0.363648
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 7.539735 0.622898 0.695042 0.397093 -0.250659 -0.258349 0.653997 -0.796798 0.433683 0.536449 0.299701
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.286612 -0.821630 0.998309 -0.795091 0.638045 -0.632608 0.955332 -0.010408 0.530498 0.529303 0.317705
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.345040 1.801892 -0.380467 1.309537 -0.945969 0.561182 -0.835059 -1.272530 0.527914 0.496364 0.324473
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 43.489484 20.713105 35.618086 29.433912 4.782693 3.372655 363.524404 268.581780 0.017087 0.016376 0.000941
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 18.277375 26.924947 29.042150 30.484365 6.020688 4.639001 293.594149 308.593220 0.016549 0.016381 0.000841
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 16.364723 19.998406 27.766342 26.809066 4.031385 3.206867 260.151218 213.537373 0.016542 0.016541 0.000730
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.909841 12.733074 0.707881 17.801288 0.003422 1.649377 -0.481988 4.641296 0.556148 0.064244 0.384416
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.406700 -0.589011 -0.731283 -0.314394 -0.991500 0.004797 -0.702888 -0.357538 0.585323 0.578059 0.331097
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.489123 -0.152327 1.227844 0.245109 1.088091 0.630898 0.753153 6.145336 0.601087 0.592999 0.331357
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.279926 0.758827 3.479007 -0.587579 1.271289 -0.722994 8.035251 1.252448 0.553792 0.600520 0.312720
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.346783 0.916027 0.953546 1.780531 0.918714 1.168776 0.791018 0.577856 0.609286 0.601851 0.333387
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.563189 0.586269 0.889150 1.257919 1.050605 1.384772 0.243042 0.393501 0.615689 0.611073 0.347101
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.137579 -0.569247 -0.401624 -0.584608 -0.943944 -0.981292 -0.878314 -0.633985 0.600957 0.602309 0.343063
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.521959 0.376519 1.002669 0.752350 1.190132 0.956819 0.358514 0.118639 0.597780 0.597338 0.356864
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.320340 0.187405 14.425961 0.551217 1.926664 0.641152 1.364492 0.598396 0.039088 0.578904 0.395726
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 5.413044 6.175411 14.474692 14.945424 1.916809 1.764588 2.533865 2.207889 0.032825 0.025082 0.003669
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 5.725982 3.736543 14.663826 13.587895 1.926525 0.301842 1.658445 1.106058 0.028111 0.336425 0.217326
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.016252 -0.005706 0.007410 -0.140874 -0.198963 -0.679710 -0.079440 -0.995299 0.532907 0.533571 0.322050
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.708142 6.879328 0.444674 -0.383196 -0.199457 -0.613881 -1.071156 -0.284355 0.532818 0.456608 0.293303
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.056080 0.446386 -0.878861 0.386664 -0.643792 0.277943 0.487634 3.678687 0.526641 0.509378 0.314332
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.639455 2.061966 0.169378 1.116700 0.669224 1.289418 -0.023784 0.367125 0.568663 0.555582 0.326725
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.978980 0.124503 -0.959362 -0.193504 -0.236758 0.172988 -0.542043 3.121137 0.585840 0.575525 0.329322
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.147540 0.749445 0.675158 -0.849123 -0.040625 -0.365223 -0.690388 1.657680 0.583001 0.587653 0.326005
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.959739 24.225733 2.950445 7.809542 2.074877 3.022982 2.473988 1.865418 0.600734 0.586776 0.332124
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.073051 0.545792 0.508099 1.422339 0.426731 0.951908 0.368213 0.387916 0.606138 0.600913 0.327896
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.126576 -0.115047 0.498876 0.496145 0.366532 0.445813 0.579743 0.248314 0.611412 0.608396 0.340621
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.147187 0.749897 0.493578 -0.156567 0.322385 -0.067229 0.454883 0.748324 0.608384 0.603471 0.340339
108 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.682608 2.613350 1.725912 2.716725 1.543481 1.827800 2.689507 0.986779 0.598675 0.599159 0.347521
109 N10 digital_ok 100.00% 87.22% 100.00% 0.00% 5.144404 6.124698 14.484867 14.677979 1.854246 1.774025 1.382560 2.057866 0.114946 0.039725 0.059303
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.554282 -0.264410 2.272318 0.102022 -0.223710 0.319800 0.609094 -0.222442 0.498435 0.578693 0.317111
111 N10 digital_ok 100.00% 62.78% 85.56% 14.44% 1.571791 5.920324 11.646633 14.615839 -0.159932 1.500090 1.099725 2.330099 0.180522 0.084296 -0.105043
112 N10 digital_ok 100.00% 0.00% 0.00% 100.00% 1.106253 1.588663 1.678806 11.709691 0.953863 -0.004364 1.359516 1.010247 0.235847 0.187008 -0.243276
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.783879 2.922000 1.977216 2.074549 1.284150 1.259400 -1.107812 -1.242833 0.511833 0.497312 0.308841
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 2.446144 1.035468 1.695606 4.268593 1.040487 0.238396 -1.121394 1.978700 0.501966 0.475139 0.295337
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.927391 -0.366142 -0.698956 -0.319480 -0.299764 -0.935688 -0.339396 -0.937361 0.514437 0.500660 0.311324
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 25.686723 24.003593 32.627846 33.072081 3.632069 5.426365 356.050451 413.159247 0.016971 0.016251 0.000948
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 22.714163 21.126436 32.785202 30.065324 5.898938 6.890257 493.763192 296.195809 0.016217 0.016317 0.000715
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.294876 -0.357032 2.883428 -0.643771 2.388178 -0.183017 2.832046 0.354147 0.576109 0.569634 0.328410
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.663280 2.758858 1.186426 6.692770 0.523143 2.542077 -0.370414 5.864472 0.571629 0.576088 0.324489
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.330227 0.914918 -0.190191 -0.806569 -0.098065 -0.445401 -0.186260 -0.678340 0.602698 0.594674 0.334818
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.414965 0.949789 1.768497 0.677255 1.155647 -0.033336 -0.826501 -1.233721 0.577533 0.592917 0.335454
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 5.313338 0.062260 14.632123 0.793448 1.912797 0.908990 1.428449 0.642947 0.047781 0.612346 0.404011
125 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.861960 0.095880 8.206549 1.653886 0.796146 1.164903 2.505487 1.585793 0.559387 0.604515 0.348401
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.485965 1.278058 0.791361 1.550818 0.697296 1.393434 1.784901 1.239386 0.606695 0.603724 0.353357
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 5.281126 -0.649924 14.421168 -0.524026 1.933396 -0.848736 1.346021 -0.693200 0.040540 0.581564 0.395866
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.303719 -0.235974 -0.430896 -0.295439 0.005572 -0.909553 0.087087 0.377946 0.582525 0.575910 0.357517
131 N11 not_connected 100.00% 0.00% 29.44% 0.00% -0.616809 5.357578 -0.697333 8.722741 -0.932963 0.970317 -0.737856 0.965298 0.535319 0.266228 0.362199
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.579069 -0.677237 -0.603798 -0.601437 -0.905696 -0.402083 -0.679701 -0.464057 0.536342 0.524730 0.313829
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.675064 -0.696152 -0.599302 -0.816643 -0.514679 -1.018318 -0.311196 -0.695536 0.518439 0.505336 0.307714
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.175504 2.139697 3.339731 1.472407 1.022014 0.716531 5.273877 -1.272562 0.461084 0.462794 0.297535
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.855690 -0.957998 -0.611881 -0.956490 -0.708573 -0.551408 -0.150744 -0.458416 0.479507 0.469919 0.307671
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 4.995596 -0.195359 14.126638 -0.065775 1.919925 0.125135 1.713807 0.248195 0.044984 0.492633 0.347233
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 15.059964 37.108933 26.953195 32.518607 2.787461 4.496397 280.748957 324.871547 0.016648 0.016213 0.000856
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.723585 -0.290475 0.288191 -0.891528 -0.321195 -0.696817 -1.020701 0.181373 0.545853 0.537761 0.318187
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.392633 -0.937047 0.317673 -0.786137 0.372759 -0.947377 0.247445 0.300373 0.583883 0.568225 0.324628
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.199083 -0.130283 0.202853 -0.205179 0.419537 -0.692036 -0.001856 -1.053113 0.593396 0.576467 0.329584
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.439209 6.169679 -0.369978 14.914976 -0.128440 1.755845 7.774840 2.103548 0.601706 0.053842 0.465269
143 N14 RF_maintenance 100.00% 84.44% 100.00% 0.00% 5.411877 5.970051 14.119201 14.880474 1.804014 1.764510 1.249666 1.955208 0.153610 0.036349 0.098452
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.420421 -0.377129 -0.377447 -0.075010 0.299142 -0.756877 -0.275781 -0.945763 0.617200 0.600334 0.349705
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.491003 1.350626 0.468865 1.609865 0.601890 1.554029 0.098021 0.539728 0.613847 0.601937 0.341294
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.730047 -0.872102 -0.578467 -0.962005 -0.552874 -0.812131 0.092725 0.274623 0.579981 0.580304 0.345830
147 N15 digital_ok 100.00% 98.61% 98.61% 0.00% 90.829640 90.727766 inf inf 432.444747 437.509070 4005.870551 4096.988420 0.321672 0.417437 0.348301
148 N15 digital_ok 100.00% 97.78% 97.50% 0.00% nan nan inf inf nan nan nan nan 0.408743 0.444100 0.337954
149 N15 digital_ok 100.00% 97.50% 97.78% 0.00% 98.229639 98.142557 inf inf 579.111534 578.804054 6450.499145 6441.226952 0.415595 0.362515 0.362720
150 N15 digital_ok 100.00% 98.61% 98.61% 0.00% nan nan inf inf nan nan nan nan 0.525086 0.457844 0.461118
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 4.165348 0.159304 -0.473025 1.282469 -0.325807 0.633773 1.933811 4.355482 0.472241 0.518908 0.295903
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.159610 -0.472909 14.298524 -0.076255 1.924886 0.303739 2.524013 0.086595 0.045623 0.484489 0.350851
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.873557 6.096783 6.451571 14.752504 2.298246 1.773143 4.246615 2.228305 0.490283 0.044821 0.361594
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.740563 0.743072 0.733050 1.024248 0.672048 0.878680 0.202396 0.213258 0.518120 0.513097 0.313938
158 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.960433 -1.043446 -0.958342 -0.923184 -0.637616 -0.712775 -0.091174 2.682257 0.537155 0.526945 0.321935
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.242131 5.579542 0.394987 0.468634 0.081107 -0.545347 0.027313 -0.043438 0.534746 0.447742 0.295774
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 5.550109 -0.617561 14.382647 -0.357420 1.924149 0.114530 1.463675 -0.357213 0.050166 0.569849 0.437459
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.603231 12.945235 0.549464 0.940736 0.642661 -0.486349 0.119279 -0.141120 0.589191 0.489771 0.297664
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.218220 -0.744807 -0.187787 -0.759255 -0.827910 -0.565437 -0.387194 -0.806214 0.591448 0.585914 0.336855
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.314455 0.905134 0.452867 0.696325 0.848693 0.751514 0.098211 0.262203 0.605373 0.598955 0.340932
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 1.604680 1.245961 2.213509 1.249346 1.413309 1.262036 1.205987 0.765379 0.598724 0.592456 0.331585
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 6.784626 -0.184771 1.456238 -0.130945 -0.046727 0.064959 1.027784 -0.227876 0.529705 0.594848 0.307285
166 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 5.403914 -0.029594 14.595392 0.027021 1.927606 -0.318776 1.910160 -0.565236 0.038505 0.574390 0.400291
167 N15 digital_ok 100.00% 97.50% 97.50% 0.00% nan nan inf inf nan nan nan nan 0.460415 0.479174 0.327966
168 N15 digital_ok 100.00% 98.33% 98.06% 0.00% 92.914770 93.034924 inf inf 467.351866 477.507781 4644.782430 4784.606765 0.458771 0.461937 0.314053
169 N15 digital_ok 100.00% 96.94% 97.50% 0.28% 84.965334 84.712609 inf inf 463.590558 461.339650 4630.814329 4590.245587 0.522932 0.464294 0.428448
170 N15 digital_ok 100.00% 96.67% 96.39% 0.28% 100.218105 100.250774 inf inf 425.890563 419.207517 3889.455717 3699.495250 0.440024 0.440778 0.340363
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.169790 -1.079209 1.420269 -0.690635 0.591573 -0.680932 1.194167 0.167823 0.525700 0.524138 0.321392
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.115340 1.050183 1.455034 0.504326 0.835957 -0.100874 -0.769322 -0.469301 0.502975 0.495065 0.305934
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.779108 2.895599 1.972834 2.060999 1.317677 1.258251 -0.954764 -1.135858 0.475653 0.454579 0.292454
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.054270 -0.458992 0.643343 -0.090917 0.539346 -0.004797 0.167452 -0.288348 0.546871 0.534139 0.329868
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.552953 6.404405 -0.738926 15.013157 -0.300140 1.757372 2.340301 2.252422 0.552985 0.059372 0.435909
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.984144 2.025168 2.164020 2.884323 1.650813 1.901926 1.004965 6.637550 0.571602 0.560402 0.334433
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.222564 6.084971 -0.198970 14.660841 -0.881746 1.760928 -0.482989 2.648713 0.584484 0.056169 0.419409
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.199730 1.269817 0.583772 1.189149 0.852380 1.041515 1.019308 1.180551 0.593631 0.581207 0.331249
184 N14 digital_ok 100.00% 19.72% 0.00% 0.00% 5.248890 0.223586 13.429896 0.531767 0.967321 0.727470 2.117751 1.056085 0.309513 0.587499 0.378879
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.589324 -0.014522 -0.871489 0.229108 -0.500544 0.376538 0.288622 0.725571 0.595305 0.589031 0.334640
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.289677 -0.927458 -0.221971 -0.774094 -0.840873 -0.929642 -0.907316 -0.821604 0.584275 0.577890 0.330184
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.578034 0.030166 -0.590568 -0.137674 -0.177927 -0.759792 0.012903 -0.969264 0.582237 0.570196 0.340330
189 N15 digital_ok 100.00% 98.33% 97.78% 0.00% nan nan inf inf nan nan nan nan 0.548437 0.643793 0.495084
190 N15 digital_ok 100.00% 96.94% 97.50% 0.00% nan nan inf inf nan nan nan nan 0.489824 0.512689 0.396140
191 N15 digital_ok 100.00% 96.67% 96.67% 0.00% nan nan inf inf nan nan nan nan 0.548942 0.588542 0.427951
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.767948 3.161786 1.953661 2.233872 1.297257 1.384328 -0.907987 -1.176035 0.491983 0.465909 0.302702
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.061558 2.824159 2.185364 1.997872 1.474203 1.206665 -1.032833 -1.205511 0.474563 0.455586 0.291234
200 N18 RF_maintenance 100.00% 100.00% 44.17% 0.00% 5.950617 -0.399672 8.757693 -0.952913 1.934578 -0.447387 2.146747 -0.388560 0.051851 0.221180 0.073126
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.540081 2.539494 1.095376 1.848610 0.290432 1.033624 -1.183573 -1.304582 0.546347 0.518507 0.328119
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 0.456989 -0.747281 0.299642 -0.836938 -0.417218 -0.615948 -1.010307 1.753748 0.567502 0.559501 0.330587
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.059482 3.176493 2.067278 -0.591594 1.489721 -0.324303 11.483583 -0.260513 0.579399 0.568329 0.327486
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.050843 -0.698314 6.875398 -0.572951 -0.519822 -0.118669 1.489361 0.956001 0.432095 0.570710 0.373278
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.852298 1.153909 3.635208 4.302984 0.287786 0.502164 0.844543 0.943062 0.525043 0.507454 0.297696
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.279756 -0.359895 -0.909616 0.052974 -0.822385 -0.038556 1.223706 -0.013874 0.553709 0.554256 0.333301
208 N20 dish_maintenance 100.00% 98.33% 98.33% 0.28% nan nan inf inf nan nan nan nan 0.405187 0.401357 0.225750
209 N20 dish_maintenance 100.00% 97.50% 97.50% 0.28% nan nan inf inf nan nan nan nan 0.421026 0.444902 0.347549
210 N20 dish_maintenance 100.00% 96.94% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.479650 0.416846 0.329815
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% -0.571897 6.280392 -0.339455 9.085029 -0.459544 1.761971 -0.034951 1.540983 0.523949 0.042314 0.417838
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.303444 -0.773210 -0.268369 -0.938385 -0.891481 -0.493423 -0.125472 -0.686071 0.555646 0.543042 0.328412
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.732658 -0.670972 -0.920055 -0.962810 -0.760997 -0.807935 0.641621 -0.756476 0.559552 0.548111 0.326923
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.303797 -0.223078 -0.501562 -0.433044 -0.963503 -0.927613 -0.275672 -0.958703 0.561326 0.551130 0.325115
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.488792 0.592102 -0.137185 1.969143 -0.123754 0.794564 -0.240754 1.250844 0.562857 0.536651 0.325036
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.205846 3.002359 2.324433 2.148664 1.596800 1.305105 -1.019951 -1.246707 0.520672 0.509453 0.309346
225 N19 RF_ok 100.00% 0.00% 68.61% 0.00% 0.276341 5.728187 0.068222 8.749239 -0.619732 1.382348 -0.987626 1.892072 0.557086 0.202346 0.429573
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.757366 3.884602 -0.948740 -0.463723 -0.877743 -0.263122 -0.533643 -0.523528 0.552539 0.478360 0.318476
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.340315 -0.239092 3.119035 0.049979 0.782706 -0.078372 9.328247 2.600990 0.509874 0.524529 0.324533
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.308101 -0.539569 0.005729 -0.574919 -0.617549 -0.214976 -0.545498 -0.144997 0.532098 0.517356 0.315040
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.373504 0.610810 -0.073891 0.363217 -0.480757 -0.144708 -0.915330 -1.196910 0.519649 0.494881 0.318187
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.146075 -0.810291 0.805827 -0.762608 0.348949 -0.389429 0.674467 -0.495548 0.521232 0.517479 0.324845
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.293318 0.149552 0.100153 0.099720 -0.531859 -0.621783 -0.996528 -1.155681 0.542203 0.528632 0.330802
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.886944 -0.100642 -0.951705 -0.317621 -0.900384 -0.878340 -0.461168 0.310382 0.549595 0.533178 0.331920
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.326028 -0.396953 -0.252095 -0.953288 -0.837536 -0.660336 -0.710443 -0.449989 0.549925 0.538261 0.327756
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.758946 -0.532570 -0.704887 -0.431182 -0.959835 -0.956615 -0.516503 -0.968989 0.552751 0.538650 0.333551
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.266877 0.529656 -0.575348 0.218748 -0.344127 -0.399019 1.227049 -1.037805 0.477216 0.527347 0.308714
243 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.851519 -0.834605 0.089770 -0.676607 -0.137841 -0.357723 -0.856555 -0.505704 0.498982 0.527801 0.321440
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.057710 -0.147760 0.382352 0.653301 0.114233 0.034921 0.406779 0.944297 0.531258 0.517735 0.315027
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.045547 -0.595718 -0.148031 -0.832332 -0.757624 -0.553323 -0.950888 -0.062804 0.529261 0.511921 0.315916
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.598922 6.540653 -0.989518 8.628029 -0.914511 1.772819 -0.256211 1.066897 0.515506 0.042561 0.409461
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.414672 -0.267920 -0.778489 -0.673823 -1.028863 -0.961343 0.058432 -0.863176 0.521729 0.501245 0.313032
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.292472 4.428302 0.427288 0.688883 0.576285 0.648264 0.156118 0.389223 0.516163 0.494066 0.320154
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.704485 1.957936 1.044322 1.283456 0.465197 0.653315 -1.011916 -1.128911 0.397509 0.329658 0.235005
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.103048 1.357168 0.271686 0.493663 -0.268008 -0.072498 0.287615 -0.442015 0.394399 0.341952 0.237492
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.471538 -0.936692 0.161400 -0.555690 -0.467683 -0.285925 -0.966631 -0.367931 0.437224 0.392790 0.265063
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 5.842756 6.261847 8.603855 9.234419 1.914740 1.757384 1.374061 1.094423 0.045177 0.043315 0.002915
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 0.353783 -0.121557 -0.007048 -0.520104 -0.041616 -0.423149 1.665497 -0.178984 0.390369 0.345246 0.226421
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, 7, 15, 16, 17, 18, 27, 28, 29, 31, 32, 34, 37, 38, 40, 41, 42, 47, 51, 55, 58, 59, 60, 61, 62, 66, 68, 70, 77, 78, 81, 82, 83, 84, 86, 87, 92, 93, 94, 96, 104, 109, 110, 111, 112, 114, 117, 118, 121, 124, 125, 127, 131, 134, 136, 137, 142, 143, 147, 148, 149, 150, 151, 155, 156, 159, 160, 161, 165, 166, 167, 168, 169, 170, 180, 181, 182, 184, 189, 190, 191, 200, 204, 205, 206, 208, 209, 210, 211, 225, 227, 242, 246, 262, 329]

unflagged_ants: [5, 8, 9, 10, 19, 20, 21, 22, 30, 35, 36, 43, 44, 45, 46, 48, 49, 50, 52, 53, 54, 56, 57, 63, 64, 65, 67, 69, 71, 72, 73, 74, 79, 80, 85, 88, 89, 90, 91, 95, 97, 101, 102, 103, 105, 106, 107, 108, 113, 115, 120, 122, 123, 126, 128, 132, 133, 135, 139, 140, 141, 144, 145, 146, 157, 158, 162, 163, 164, 171, 172, 173, 179, 183, 185, 186, 187, 192, 193, 201, 202, 207, 220, 221, 222, 223, 224, 226, 228, 229, 237, 238, 239, 240, 241, 243, 244, 245, 261, 320, 324, 325, 333]

golden_ants: [5, 9, 10, 19, 20, 21, 30, 44, 45, 53, 54, 56, 65, 67, 69, 71, 72, 85, 88, 91, 101, 103, 105, 106, 107, 122, 123, 128, 140, 141, 144, 145, 146, 157, 158, 162, 163, 164, 171, 172, 173, 183, 186, 187, 192, 193, 202]
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_2460088.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 [ ]: