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 = "2459983"
data_path = "/mnt/sn1/2459983"
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: 2-7-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/2459983/zen.2459983.21284.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 1851 ant_metrics files matching glob /mnt/sn1/2459983/zen.2459983.?????.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/2459983/zen.2459983.?????.sum.known_good.omni.calfits. Skipping redcal chisq.

Figure out some general properties¶

In [9]:
# Parse some general array properties, taking into account the fact that we might be missing some of the metrics
ants = []
pols = []
antpol_pairs = []

if use_auto_metrics:
    ants = sorted(set(bl[0] for bl in auto_metrics['modzs']['r2_shape_modzs']))
    pols = sorted(set(bl[2] for bl in auto_metrics['modzs']['r2_shape_modzs']))
if use_ant_metrics:
    antpol_pairs = sorted(set([antpol for dms in ant_metrics_dead_metrics.values() for antpol in dms.keys()]))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))
if use_redcal:
    antpol_pairs = sorted(set([ant for cspa in cspa_med_dict.values() for ant in cspa.keys()]) | set(antpol_pairs))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))

# Figure out remaining antennas not in data and also LST range
data_files = sorted(glob.glob(os.path.join(data_path, 'zen.*.sum.uvh5')))
hd = io.HERAData(data_files[0])
unused_ants = [ant for ant in hd.antpos if ant not in ants]    
hd_last = io.HERAData(data_files[-1])

Load a priori antenna statuses and node numbers¶

In [10]:
# try to load a priori antenna statusesm but fail gracefully if this doesn't work.
a_priori_statuses = {ant: 'Not Found' for ant in ants}
nodes = {ant: np.nan for ant in ants + unused_ants}
try:
    from hera_mc import cm_hookup

    # get node numbers
    hookup = cm_hookup.get_hookup('default')
    for ant_name in hookup:
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in nodes:
            if hookup[ant_name].get_part_from_type('node')['E<ground'] is not None:
                nodes[ant] = int(hookup[ant_name].get_part_from_type('node')['E<ground'][1:])
    
    # get apriori antenna status
    for ant_name, data in hookup.items():
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in a_priori_statuses:
            a_priori_statuses[ant] = data.apriori

except Exception as err:
    print(f'Could not load node numbers and a priori antenna statuses.\nEncountered {type(err)} with message: {err}')

Summarize auto metrics¶

In [11]:
if use_auto_metrics:
    # Parse modzs
    modzs_to_check = {'Shape': 'r2_shape_modzs', 'Power': 'r2_power_modzs', 
                      'Temporal Variability': 'r2_temp_var_modzs', 'Temporal Discontinuties': 'r2_temp_diff_modzs'}
    worst_metrics = []
    worst_zs = []
    all_modzs = {}
    binary_flags = {rationale: [] for rationale in modzs_to_check}

    for ant in ants:
        # parse modzs and figure out flag counts
        modzs = {f'{pol} {rationale}': auto_metrics['modzs'][dict_name][(ant, ant, pol)] 
                 for rationale, dict_name in modzs_to_check.items() for pol in pols}
        for pol in pols:
            for rationale, dict_name in modzs_to_check.items():
                binary_flags[rationale].append(auto_metrics['modzs'][dict_name][(ant, ant, pol)] > mean_round_modz_cut)

        # parse out all metrics for dataframe
        for k in modzs:
            col_label = k + ' Modified Z-Score'
            if col_label in all_modzs:
                all_modzs[col_label].append(modzs[k])
            else:
                all_modzs[col_label] = [modzs[k]]
                
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
else:
    mean_round_modz_cut = 0

Summarize ant metrics¶

In [12]:
if use_ant_metrics:
    a_priori_flag_frac = {ant: np.mean([ant in apxa for apxa in ant_metrics_apriori_exants.values()]) for ant in ants}
    dead_ant_frac = {ap: {ant: np.mean([(ant, ap) in das for das in ant_metrics_dead_ants_dict.values()])
                                 for ant in ants} for ap in antpols}
    crossed_ant_frac = {ant: np.mean([np.any([(ant, ap) in cas for ap in antpols])
                                      for cas in ant_metrics_crossed_ants_dict.values()]) for ant in ants}
    ant_metrics_xants_frac_by_antpol = {antpol: np.mean([antpol in amx for amx in ant_metrics_xants_dict.values()]) for antpol in antpol_pairs}
    ant_metrics_xants_frac_by_ant = {ant: np.mean([np.any([(ant, ap) in amx for ap in antpols])
                                     for amx in ant_metrics_xants_dict.values()]) for ant in ants}
    average_dead_metrics = {ap: {ant: np.nanmean([dm.get((ant, ap), np.nan) for dm in ant_metrics_dead_metrics.values()]) 
                                 for ant in ants} for ap in antpols}
    average_crossed_metrics = {ant: np.nanmean([cm.get((ant, ap), np.nan) for ap in antpols 
                                                for cm in ant_metrics_crossed_metrics.values()]) for ant in ants}
else:
    dead_cut = 0.4
    crossed_cut = 0.0

Summarize redcal chi^2 metrics¶

In [13]:
if use_redcal:
    cspa = {ant: np.nanmedian(np.hstack([cspa_med_dict[cal][ant] for cal in redcal_files])) for ant in antpol_pairs}
    redcal_prior_flag_frac = {ant: np.mean([np.any([afd[ant, ap] and not ant in flagged_by_redcal_dict[cal] for ap in antpols])
                                            for cal, afd in post_redcal_ant_flags_dict.items()]) for ant in ants}
    redcal_flagged_frac = {ant: np.mean([ant in fbr for fbr in flagged_by_redcal_dict.values()]) for ant in ants}

Get FEM switch states¶

In [14]:
HHautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.sum.autos.uvh5"))
diffautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.diff.autos.uvh5"))

try:
    db = mc.connect_to_mc_db(None)
    session = db.sessionmaker()
    startJD = float(HHautos[0].split('zen.')[1].split('.sum')[0])
    stopJD = float(HHautos[-1].split('zen.')[1].split('.sum')[0])
    start_time = Time(startJD,format='jd')
    stop_time = Time(stopJD,format='jd')

    # get initial state by looking for commands up to 3 hours before the starttime
    # this logic can be improved after an upcoming hera_mc PR
    # which will return the most recent command before a particular time.
    search_start_time = start_time - TimeDelta(3*3600, format="sec")
    initial_command_res = session.get_array_signal_source(starttime=search_start_time, stoptime=start_time)
    if len(initial_command_res) == 0:
        initial_source = "Unknown"
    elif len(command_res) == 1:
        initial_source = initial_command_res[0].source
    else:
        # multiple commands
        times = []
        sources = []
        for obj in command_res:
            times.append(obj.time)
            sources.append(obj.source)
        initial_source = sources[np.argmax(times)]
    
    # check for any changes during observing
    command_res = session.get_array_signal_source(starttime=start_time, stoptime=stop_time)
    if len(command_res) == 0:
        # still nothing, set it to None
        obs_source = None
    else:
        obs_source_times = []
        obs_source = []
        for obj in command_res:
            obs_source_times.append(obj.time)
            obs_source.append(obj.source)

    if obs_source is not None:
        command_source = [initial_source] + obs_source
    else:
        command_source = initial_source
    
    res = session.get_antenna_status(starttime=startTime, stoptime=stopTime)
    fem_switches = {}
    right_rep_ant = []
    if len(res) > 0:
        for obj in res:
            if obj.antenna_number not in fem_switches.keys():
                fem_switches[obj.antenna_number] = {}
            fem_switches[obj.antenna_number][obj.antenna_feed_pol] = obj.fem_switch
        for ant, pol_dict in fem_switches.items():
            if pol_dict['e'] == initial_source and pol_dict['n'] == initial_source:
                right_rep_ant.append(ant)
except Exception as e:
    print(e)
    initial_source = None
    command_source = None
    right_rep_ant = []
name 'command_res' is not defined

Find X-engine Failures¶

In [15]:
read_inds = [1, len(HHautos)//2, -2]
x_status = [1,1,1,1,1,1,1,1]
s = UVData()
s.read(HHautos[1])

nants = len(s.get_ants())
freqs = s.freq_array[0]*1e-6
nfreqs = len(freqs)

antCon = {a: None for a in ants}
rightAnts = []
for i in read_inds:
    s = UVData()
    d = UVData()
    s.read(HHautos[i])
    d.read(diffautos[i])
    for pol in [0,1]:
        sm = np.abs(s.data_array[:,0,:,pol])
        df = np.abs(d.data_array[:,0,:,pol])
        sm = np.r_[sm, np.nan + np.zeros((-len(sm) % nants,len(freqs)))]
        sm = np.nanmean(sm.reshape(-1,nants,nfreqs),axis=1)
        df = np.r_[df, np.nan + np.zeros((-len(df) % nants,len(freqs)))]
        df = np.nanmean(df.reshape(-1,nants,nfreqs),axis=1)

        evens = (sm + df)/2
        odds = (sm - df)/2
        rat = np.divide(evens,odds)
        rat = np.nan_to_num(rat)
        for xbox in range(0,8):
            xavg = np.nanmean(rat[:,xbox*192:(xbox+1)*192],axis=1)
            if np.nanmax(xavg)>1.5 or np.nanmin(xavg)<0.5:
                x_status[xbox] = 0
    for ant in ants:
        for pol in ["xx", "yy"]:
            if antCon[ant] is False:
                continue
            spectrum = s.get_data(ant, ant, pol)
            stdev = np.std(spectrum)
            med = np.median(np.abs(spectrum))
            if (initial_source == 'digital_noise_same' or initial_source == 'digital_noise_different') and med < 10:
                antCon[ant] = True
            elif (initial_source == "load" or initial_source == 'noise') and 80000 < stdev <= 4000000 and antCon[ant] is not False:
                antCon[ant] = True
            elif initial_source == "antenna" and stdev > 500000 and med > 950000 and antCon[ant] is not False:
                antCon[ant] = True
            else:
                antCon[ant] = False
            if np.min(np.abs(spectrum)) < 100000:
                antCon[ant] = False
for ant in ants:
    if antCon[ant] is True:
        rightAnts.append(ant)
            
x_status_str = ''
for i,x in enumerate(x_status):
    if x==0:
        x_status_str += '\u274C '
    else:
        x_status_str += '\u2705 '

Build Overall Health DataFrame¶

In [16]:
def comma_sep_paragraph(vals, chars_per_line=40):
    outstrs = []
    for val in vals:
        if (len(outstrs) == 0) or (len(outstrs[-1]) > chars_per_line):
            outstrs.append(str(val))
        else:
            outstrs[-1] += ', ' + str(val)
    return ',<br>'.join(outstrs)
In [17]:
# Time data
to_show = {'JD': [JD]}
to_show['Date'] = f'{utc.month}-{utc.day}-{utc.year}'
to_show['LST Range'] = f'{hd.lsts[0] * 12 / np.pi:.3f} -- {hd_last.lsts[-1] * 12 / np.pi:.3f} hours'

# X-engine status
to_show['X-Engine Status'] = x_status_str

# Files
to_show['Number of Files'] = len(data_files)

# Antenna Calculations
to_show['Total Number of Antennas'] = len(ants)

to_show[' '] = ''
to_show['OPERATIONAL STATUS SUMMARY'] = ''

status_count = {status: 0 for status in status_colors}
for ant, status in a_priori_statuses.items():
    if status in status_count:
        status_count[status] = status_count[status] + 1
    else:
        status_count[status] = 1
to_show['Antenna A Priori Status Count'] = '<br>'.join([f'{status}: {status_count[status]}' for status in status_colors if status in status_count and status_count[status] > 0])

to_show['Commanded Signal Source'] = ', '.join(command_source if hasattr(command_source, '__iter__') else [str(command_source)])
to_show['Antennas in Commanded State (reported)'] = f'{len(right_rep_ant)} / {len(ants)} ({len(right_rep_ant) / len(ants):.1%})'
to_show['Antennas in Commanded State (observed)'] = f'{len(rightAnts)} / {len(ants)} ({len(rightAnts) / len(ants):.1%})'

if use_ant_metrics:
    to_show['Cross-Polarized Antennas'] = ', '.join([str(ant) for ant in ants if (np.max([dead_ant_frac[ap][ant] for ap in antpols]) + crossed_ant_frac[ant] == 1) 
                                                                                 and (crossed_ant_frac[ant] > .5)])

# Node calculations
nodes_used = set([nodes[ant] for ant in ants if np.isfinite(nodes[ant])])
to_show['Total Number of Nodes'] = len(nodes_used)
if use_ant_metrics:
    node_off = {node: True for node in nodes_used}
    not_correlating = {node: True for node in nodes_used}
    for ant in ants:
        for ap in antpols:
            if np.isfinite(nodes[ant]):
                if np.isfinite(average_dead_metrics[ap][ant]):
                    node_off[nodes[ant]] = False
                if dead_ant_frac[ap][ant] < 1:
                    not_correlating[nodes[ant]] = False
    to_show['Nodes Registering 0s'] = ', '.join([f'N{n:02}' for n in sorted([node for node in node_off if node_off[node]])])
    to_show['Nodes Not Correlating'] = ', '.join([f'N{n:02}' for n in sorted([node for node in not_correlating if not_correlating[node] and not node_off[node]])])

# Pipeline calculations    
to_show['  '] = ''
to_show['NIGHTLY ANALYSIS SUMMARY'] = ''
    
all_flagged_ants = []
if use_ant_metrics:
    to_show['Ant Metrics Done?'] = '\u2705'
    ant_metrics_flagged_ants = [ant for ant in ants if ant_metrics_xants_frac_by_ant[ant] > 0]
    all_flagged_ants.extend(ant_metrics_flagged_ants)
    to_show['Ant Metrics Flagged Antennas'] = f'{len(ant_metrics_flagged_ants)} / {len(ants)} ({len(ant_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Ant Metrics Done?'] = '\u274C'
if use_auto_metrics:
    to_show['Auto Metrics Done?'] = '\u2705'
    auto_metrics_flagged_ants = [ant for ant in ants if ant in auto_ex_ants]
    all_flagged_ants.extend(auto_metrics_flagged_ants)    
    to_show['Auto Metrics Flagged Antennas'] = f'{len(auto_metrics_flagged_ants)} / {len(ants)} ({len(auto_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Auto Metrics Done?'] = '\u274C'
if use_redcal:
    to_show['Redcal Done?'] = '\u2705'    
    redcal_flagged_ants = [ant for ant in ants if redcal_flagged_frac[ant] > 0]
    all_flagged_ants.extend(redcal_flagged_ants)    
    to_show['Redcal Flagged Antennas'] = f'{len(redcal_flagged_ants)} / {len(ants)} ({len(redcal_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Redcal Done?'] = '\u274C' 
to_show['Never Flagged Antennas'] = f'{len(ants) - len(set(all_flagged_ants))} / {len(ants)} ({(len(ants) - len(set(all_flagged_ants))) / len(ants):.1%})'

# Count bad antennas with good statuses and vice versa
n_apriori_good = len([ant for ant in ants if a_priori_statuses[ant] in good_statuses.split(',')])
apriori_good_flagged = []
aprior_bad_unflagged = []
for ant in ants:
    if ant in set(all_flagged_ants) and a_priori_statuses[ant] in good_statuses.split(','):
        apriori_good_flagged.append(ant)
    elif ant not in set(all_flagged_ants) and a_priori_statuses[ant] not in good_statuses.split(','):
        aprior_bad_unflagged.append(ant)
to_show['A Priori Good Antennas Flagged'] = f'{len(apriori_good_flagged)} / {n_apriori_good} total a priori good antennas:<br>' + \
                                            comma_sep_paragraph(apriori_good_flagged)
to_show['A Priori Bad Antennas Not Flagged'] = f'{len(aprior_bad_unflagged)} / {len(ants) - n_apriori_good} total a priori bad antennas:<br>' + \
                                            comma_sep_paragraph(aprior_bad_unflagged)

# Apply Styling
df = pd.DataFrame(to_show)
divider_cols = [df.columns.get_loc(col) for col in ['NIGHTLY ANALYSIS SUMMARY', 'OPERATIONAL STATUS SUMMARY']]
try:
    to_red_columns = [df.columns.get_loc(col) for col in ['Cross-Polarized Antennas', 'Nodes Registering 0s', 
                                                          'Nodes Not Correlating', 'A Priori Good Antennas Flagged']]
except:
    to_red_columns = []
def red_specific_cells(x):
    df1 = pd.DataFrame('', index=x.index, columns=x.columns)
    for col in to_red_columns:
        df1.iloc[col] = 'color: red'
    return df1

df = df.T
table = df.style.hide_columns().apply(red_specific_cells, axis=None)
for col in divider_cols:
    table = table.set_table_styles([{"selector":f"tr:nth-child({col+1})", "props": [("background-color", "black"), ("color", "white")]}], overwrite=False)

Table 1: Overall Array Health¶

In [18]:
HTML(table.render())
Out[18]:
JD 2459983
Date 2-7-2023
LST Range 3.706 -- 13.668 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
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: 93
not_connected: 25
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
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 53 / 198 (26.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 106 / 198 (53.5%)
Redcal Done? ❌
Never Flagged Antennas 92 / 198 (46.5%)
A Priori Good Antennas Flagged 43 / 93 total a priori good antennas:
3, 7, 9, 10, 15, 16, 19, 29, 30, 40, 42, 54,
55, 71, 72, 81, 85, 86, 94, 101, 103, 107,
109, 111, 121, 122, 123, 128, 136, 144, 151,
158, 161, 165, 170, 173, 182, 185, 189, 191,
192, 193, 202
A Priori Bad Antennas Not Flagged 42 / 105 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 82, 89, 90, 95, 102, 114, 115, 125, 132,
133, 137, 139, 207, 211, 220, 222, 223, 228,
229, 237, 238, 239, 240, 241, 244, 245, 324,
325, 329, 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_2459983.csv

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.567675 14.099277 9.910680 10.517037 9.193554 11.128224 2.818204 5.982450 0.030548 0.032515 0.002785
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.591221 1.727276 2.150536 -0.001567 1.135980 -0.275444 6.053263 -0.418997 0.613539 0.640042 0.348607
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.524937 -0.002944 0.393663 0.130867 -0.261673 1.097402 1.602187 3.076364 0.629926 0.649328 0.331835
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.177349 -0.155557 -1.088237 -0.222976 -0.305227 0.396649 8.931704 8.533177 0.637575 0.661038 0.322620
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.121920 -1.381228 -0.403262 0.055514 -0.507799 0.083465 3.164122 3.590808 0.639338 0.660637 0.315916
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.396500 -0.611497 3.064181 -1.114007 1.581595 -0.479747 4.318483 1.525289 0.624087 0.661727 0.323837
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 1.438056 -0.786145 0.237453 -1.347805 11.913440 0.010826 1.907569 2.159366 0.629449 0.659689 0.315910
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.809157 13.839953 9.331938 9.920330 9.200454 11.120916 2.436796 5.496889 0.027654 0.026413 0.001574
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.837405 -0.849476 9.877306 0.745004 9.187044 1.539856 2.781101 1.884019 0.033153 0.653108 0.531688
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.952091 1.713792 0.517664 0.380745 0.454440 0.280011 1.787219 1.057844 0.638520 0.661361 0.334346
18 N01 RF_maintenance 100.00% 100.00% 38.68% 0.00% 11.506145 19.025755 9.855880 -0.420769 9.348449 7.781732 2.748548 18.437818 0.030811 0.255422 0.198143
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.798102 -0.620916 -0.998428 -0.335713 -0.740440 13.071176 -0.282242 2.436597 0.645979 0.669903 0.323878
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.228093 -1.009774 2.560038 -1.020399 -0.154081 0.351181 2.029457 -0.322500 0.641833 0.672484 0.321090
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.306914 0.147546 -0.560824 -0.010130 -0.156588 -0.057294 0.848463 2.152697 0.638821 0.657040 0.306494
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.611768 -0.307349 0.435144 0.194522 0.544273 1.500342 -0.035795 -0.773726 0.610367 0.636032 0.308342
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.098072 13.099537 9.912714 10.319918 9.313680 11.186673 3.872819 6.379010 0.034601 0.037768 0.004233
28 N01 RF_maintenance 100.00% 0.00% 78.01% 0.00% 10.447418 27.337157 -0.013304 2.797882 6.388491 9.998958 3.320621 22.269075 0.396117 0.176541 0.283708
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.858272 13.588152 9.518185 9.929912 9.305910 11.178839 2.736760 5.457480 0.030444 0.036360 0.006249
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 1.421367 -0.115718 1.118787 -1.396308 5.479998 -0.212778 5.560717 -1.374926 0.642757 0.676970 0.330078
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.677603 -1.201261 1.175005 1.171323 0.813029 -0.497946 0.432466 1.972991 0.659593 0.673031 0.313101
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.022389 28.024813 0.183198 2.897088 4.046194 1.272759 8.925425 5.007363 0.631166 0.577311 0.273190
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.469096 14.824944 4.520629 4.814115 9.308541 11.163355 4.053816 6.681322 0.035184 0.046778 0.008040
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.113954 -0.651690 0.798673 -1.325529 1.596388 -0.865831 -0.428253 1.925876 0.621712 0.632806 0.297411
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 27.055249 27.435414 13.051777 12.979509 9.408699 11.073044 6.190692 8.753462 0.032753 0.030366 0.001364
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.225769 0.492872 -1.204866 0.793202 1.593697 1.046302 -1.037687 2.961720 0.627973 0.648275 0.347589
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.023984 0.112546 0.326101 0.519696 0.358524 0.895500 3.599117 0.958826 0.637940 0.657003 0.342714
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 10.186762 4.425444 9.541620 0.492294 9.274287 -0.505292 2.824126 -0.435668 0.038398 0.639609 0.475170
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.800206 0.324103 -0.019396 0.105258 1.448289 0.200347 -0.119087 1.145090 0.646704 0.669407 0.318418
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.135268 2.699837 -0.846922 8.215166 0.986371 3.759985 -0.147058 1.557724 0.661528 0.581974 0.345111
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.082577 0.448696 0.032732 0.649589 -0.730404 0.358664 0.163299 2.044568 0.653128 0.668551 0.314361
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 1.193473 0.066542 -1.073164 0.143667 -0.162992 0.016519 -0.251947 -0.012594 0.644106 0.676676 0.318019
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.917000 3.548655 0.339293 0.558107 -0.849591 1.097197 -0.097160 1.954688 0.647596 0.664262 0.306470
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.015315 0.062418 -0.665231 -0.885847 -0.486521 -0.332465 -0.081674 -1.325460 0.652238 0.678972 0.319672
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.435620 14.485115 4.425643 4.443143 9.281033 11.087571 4.941586 6.332835 0.030440 0.055872 0.017432
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.002944 0.854672 0.545468 1.803028 -0.304304 2.593406 -0.294674 -0.476995 0.625770 0.648889 0.313419
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.132854 -0.209521 -0.799897 0.337741 1.151072 -0.397235 0.326471 -0.592560 0.590392 0.638442 0.310702
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.558690 9.183405 0.497208 1.172967 0.518820 5.489205 14.624361 38.969532 0.613097 0.603867 0.313723
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 10.301358 4.365523 0.197267 1.787136 4.493608 5.070493 37.131119 2.892642 0.522252 0.543187 0.230550
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.053798 6.692134 -0.348401 0.542604 0.665815 0.627957 0.909620 0.643739 0.643542 0.662002 0.333350
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.864027 3.076649 -1.336510 -1.191654 0.784357 1.037352 1.379460 1.971407 0.655773 0.673844 0.336006
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 28.820050 -0.795497 4.667766 -0.730806 1.827400 0.130621 3.413909 -0.573710 0.495431 0.675589 0.326253
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.858844 13.900161 9.387525 9.882454 9.267392 11.120220 2.879458 6.686860 0.029437 0.032716 0.003134
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.328618 0.143410 -0.588942 1.227669 -0.158050 1.072951 -0.261364 1.098477 0.666090 0.684796 0.314842
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 15.656880 0.112701 7.516793 -1.255974 8.905839 2.705109 39.642933 0.840435 0.476508 0.682706 0.371204
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.173565 13.509377 9.817795 10.440021 9.185506 11.076279 3.362841 5.990977 0.035841 0.035476 0.001372
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.343064 0.482412 9.887372 1.519922 9.074726 1.267602 3.520367 5.047200 0.047340 0.670725 0.510284
60 N05 RF_maintenance 100.00% 0.00% 89.41% 0.00% 1.403565 13.432830 -0.297166 10.469464 -0.096614 11.152064 1.881101 8.250383 0.649452 0.100956 0.496389
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.386285 -0.125594 -0.416420 -1.344187 1.083197 -1.062703 -0.154697 -0.251939 0.603142 0.645560 0.310564
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.149291 0.858227 -1.065726 1.194212 1.836606 0.403149 1.109916 0.215001 0.607078 0.648269 0.316773
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.012918 14.031221 -0.293466 4.843514 0.372418 11.252745 1.491650 8.542844 0.627552 0.046194 0.476859
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.025823 0.132620 -0.791500 -0.863992 0.855019 -0.007482 1.890766 3.284179 0.614468 0.626866 0.291664
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.380419 1.306501 0.628145 1.116077 -0.534215 1.134123 0.157339 0.838932 0.621534 0.648324 0.341018
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.766469 1.619037 -1.284360 -1.115753 2.004645 -0.313592 -0.618665 -0.919318 0.637214 0.663075 0.342869
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.476507 1.724521 -0.695923 0.609424 -0.553798 0.316136 -0.174542 1.458284 0.650486 0.658873 0.324789
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 20.149831 28.213086 1.098761 13.660440 5.116929 11.046255 1.442077 10.605368 0.403062 0.030075 0.295123
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.348167 -0.761333 0.463403 0.775026 -0.345280 1.722864 0.483441 0.490590 0.649067 0.677506 0.315284
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.705933 -0.356571 -0.050087 0.100210 0.404500 1.300379 0.007190 0.200957 0.662634 0.685165 0.313852
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.041234 -0.189164 0.745384 1.038356 0.350002 0.014580 0.853436 0.166369 0.671059 0.690518 0.306455
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.309060 14.721234 10.290826 10.829803 9.101698 10.963634 3.248712 6.240245 0.035537 0.038515 0.004411
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.670585 0.950306 -1.250596 -0.958186 0.894967 0.370354 -0.509245 -1.117912 0.666991 0.687040 0.310497
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.796750 0.060741 -0.067891 -0.525677 -0.172419 1.425663 -0.167067 2.407142 0.662373 0.684049 0.312753
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 63.219148 9.431093 0.752740 -0.219672 5.447846 5.765141 5.116805 19.486808 0.333744 0.602756 0.355069
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 32.841434 0.017107 -0.380738 1.174815 2.457828 0.372592 2.428701 0.561796 0.480229 0.655924 0.315390
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.582136 14.262065 -1.316623 4.857571 -0.968723 11.036876 0.357028 5.165544 0.624329 0.040710 0.441797
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.636399 15.137884 0.355813 4.762109 -1.096252 11.059886 -0.814174 5.947458 0.632617 0.054192 0.448956
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.454147 14.340403 0.217804 9.117403 -0.643022 10.828914 -0.416295 6.192743 0.603809 0.038907 0.430978
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.840771 -0.232651 0.531443 2.159029 -0.468399 -0.562085 0.808247 2.257033 0.625789 0.640743 0.317298
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.290874 0.102009 0.339844 0.444139 0.080049 0.265510 0.337709 0.983117 0.638694 0.662520 0.323956
84 N08 RF_maintenance 100.00% 58.45% 100.00% 0.00% 20.430261 25.017614 12.645255 13.218168 7.703423 10.996400 3.924286 7.429729 0.241794 0.037864 0.150876
85 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.041362 1.419788 1.340680 1.510234 8.261252 -0.544381 0.678343 -0.311747 0.654075 0.676979 0.312279
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.542532 -0.076478 1.677750 1.683547 2.715467 -0.375898 0.232728 11.847890 0.645309 0.675683 0.300442
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.041786 4.364161 -0.653696 -0.428204 6.196989 5.708603 31.041944 28.921184 0.659741 0.689282 0.299824
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.414494 0.740137 0.495731 0.848255 -0.499440 -0.718718 1.743077 -0.059610 0.665792 0.690376 0.303913
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.345026 0.372026 0.245976 0.926985 -0.803361 -0.592579 -0.793710 -0.487033 0.670545 0.691303 0.303880
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.245976 -0.420589 -1.092498 -0.859103 1.954840 -0.709665 -0.507001 1.694987 0.672416 0.692967 0.310434
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.346531 0.199321 0.560462 0.372959 -0.940602 -0.802627 -0.084649 -0.157447 0.660058 0.685449 0.310402
92 N10 RF_maintenance 100.00% 0.00% 6.81% 0.00% 35.384593 39.703273 0.697991 1.572066 4.874681 5.332012 10.193036 9.047531 0.344504 0.294986 0.067019
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.892108 -0.724567 2.437070 -1.030237 0.817410 0.264800 3.379624 -0.557412 0.650760 0.678010 0.315566
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.665672 13.952781 10.040986 10.339395 9.250946 11.091054 2.893462 5.622654 0.032681 0.027046 0.002621
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 3.838610 3.774379 -0.870818 0.899049 0.585510 0.808076 -0.165606 0.023046 0.593510 0.628333 0.294251
96 N11 not_connected 100.00% 0.00% 0.00% 93.19% 24.634930 2.738422 0.811018 2.854558 2.564138 5.035964 3.381826 1.822341 0.344191 0.329147 -0.228179
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.027631 5.919075 -0.631477 1.686143 25.170697 4.185947 1.135670 5.838472 0.596815 0.588654 0.283946
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.579080 9.147658 -0.220116 1.168538 0.135471 1.472531 -0.185124 0.619954 0.655607 0.678674 0.316232
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.631412 1.310029 -1.339404 -0.807485 0.631088 0.847198 -0.515072 2.777755 0.664866 0.684471 0.313651
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.660045 5.713457 5.459529 -1.162953 56.162982 0.738675 8.132775 2.459212 0.608710 0.689943 0.329677
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.673918 60.981395 -1.098378 7.002298 1.402943 -0.463431 0.879439 1.850389 0.671472 0.674081 0.301998
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.572219 0.018613 0.360033 0.950041 0.226299 -0.740045 -0.671130 -0.620066 0.671193 0.689678 0.300983
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.770774 1.567681 -1.123854 -0.405052 -0.212715 -0.987398 -0.633711 -0.950654 0.673108 0.693426 0.303589
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 3.020074 2.116255 -0.628077 -0.974046 0.438474 -0.130046 6.295589 3.334275 0.668625 0.693382 0.304855
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.705542 43.357569 9.857574 1.021079 9.282236 4.850784 3.275835 4.561486 0.035585 0.337187 0.185690
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.309598 13.149898 9.376724 9.686304 9.294923 11.135537 2.500249 6.154492 0.027558 0.030283 0.002049
110 N10 RF_maintenance 100.00% 80.17% 41.00% 5.46% 19.990522 24.317950 10.771407 4.570486 5.383303 3.766444 3.107744 2.850178 0.163825 0.261099 -0.047585
111 N10 digital_ok 100.00% 21.93% 100.00% 0.00% 41.752795 13.510041 1.735032 10.292621 4.416704 11.116559 1.814702 6.471497 0.282881 0.061075 0.144119
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.231225 -0.450213 0.371131 0.233138 0.396951 1.911312 1.030625 0.061413 0.649548 0.672587 0.319168
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.675144 14.857114 4.166316 4.852768 9.145652 11.021211 3.489995 5.709565 0.036650 0.031490 0.002778
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.399898 0.889875 0.830438 -0.035522 2.391935 -0.947203 -0.934370 -0.906050 0.619213 0.645110 0.309851
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.969535 -0.961716 -1.010037 -0.393614 -0.478280 -0.852284 0.263930 -0.305256 0.602912 0.638179 0.314838
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.602375 15.031687 9.984217 10.792402 9.156472 11.101273 3.206158 7.494642 0.028562 0.032790 0.002881
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.510420 1.469594 0.005744 0.591863 -0.144120 0.109900 0.069791 0.099200 0.635302 0.665035 0.324910
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.860292 1.302347 2.723553 -0.972482 2.062799 1.395797 5.677973 4.072105 0.648573 0.684367 0.314654
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.056551 3.244306 -1.136724 5.872640 2.012525 0.098614 9.085284 11.711748 0.666404 0.669421 0.296476
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.709090 7.197294 -1.164139 -1.166691 1.319008 0.414880 -0.819427 -1.744265 0.665858 0.695826 0.309268
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.393337 9.332810 0.877368 1.048351 0.233587 0.078409 -0.090433 0.646062 0.680646 0.698513 0.306371
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.187504 0.043151 0.192195 0.673965 -0.737491 0.271295 0.357921 0.124349 0.678306 0.699003 0.311093
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.354216 0.671378 -0.103895 0.868174 0.676824 1.600921 -0.018361 1.617989 0.674963 0.688251 0.305010
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.147480 1.753390 -0.877522 1.603192 0.877184 11.086428 2.527641 1.933221 0.672620 0.682192 0.301666
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.382624 0.432463 0.630361 0.419345 1.403957 1.205034 -0.091130 0.231394 0.665045 0.691434 0.315373
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.756171 12.969014 9.972711 10.441806 9.177569 11.042746 2.744396 6.156116 0.031683 0.043110 0.006134
131 N11 not_connected 100.00% 0.00% 0.05% 0.00% -0.876459 13.210908 0.032062 4.699887 -1.146183 9.925664 -1.181454 3.238671 0.635936 0.360951 0.370370
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.858002 2.229185 -0.235428 -1.329347 0.434885 -0.640816 0.012368 -1.109357 0.618939 0.634761 0.308846
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.451217 -1.313018 -1.357577 -0.305799 -1.401872 -0.812455 -0.182714 -0.038668 0.604806 0.643345 0.324227
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.261649 14.795902 4.321552 4.833032 9.136510 11.042532 3.161428 6.324916 0.041115 0.035143 0.003208
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.533041 -1.259115 -1.001289 -1.311821 1.906465 0.311379 5.023170 -0.273584 0.598243 0.645061 0.338375
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 9.767980 0.433497 9.488424 -0.698342 9.310478 -0.147872 3.571554 -0.640262 0.042374 0.645184 0.466396
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.201978 -0.596173 0.255195 -1.278601 0.805344 -0.527001 0.311634 -0.448768 0.622035 0.661523 0.326104
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.114408 -0.176024 1.470231 -0.839423 0.808179 -0.438120 -0.368120 -0.428077 0.641577 0.661116 0.315543
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.263152 -1.004207 -0.794211 -0.141711 -0.478698 -0.793563 2.746935 1.127600 0.662305 0.684155 0.313960
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.307214 -0.712902 -0.147187 0.701801 1.599707 -0.508796 0.309421 -0.310414 0.666902 0.689196 0.312986
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.926935 13.470395 -0.551626 10.473226 1.550687 11.137227 11.481686 6.155150 0.660668 0.048163 0.514457
143 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.680912 -0.798807 -1.396845 -0.808838 -0.087483 0.169959 -0.744559 -1.170921 0.675561 0.693518 0.312044
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.472419 0.736583 -1.188470 1.873919 -0.441241 5.981215 -0.654544 0.664362 0.677744 0.690779 0.307703
145 N14 RF_maintenance 100.00% 99.57% 100.00% 0.00% 11.017770 13.658219 9.871064 10.507702 9.075204 11.220927 3.241908 7.653292 0.080915 0.031272 0.038104
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.448896 -0.635033 -0.790510 0.531912 -0.827322 -0.626746 -0.954635 -1.477666 0.649254 0.683173 0.317787
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.478440 -1.723763 1.316969 2.243764 -0.985026 -0.432333 0.110614 1.084413 0.654162 0.674024 0.305935
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.322009 0.080236 -0.488397 -0.549489 1.325203 1.253121 -0.395781 -0.692013 0.655266 0.681036 0.321552
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.038623 -1.340234 -0.877669 -1.177174 0.672158 0.607266 -0.124188 -0.972250 0.649343 0.674542 0.328323
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.570111 -0.730430 -1.112458 -1.100448 -0.406785 -0.011425 0.553445 0.131764 0.641779 0.665051 0.328438
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 23.822202 1.016442 -0.211722 0.509503 5.138736 -0.669478 3.418004 -0.721041 0.511711 0.616398 0.300131
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.502166 -0.852020 9.644726 -1.261934 9.335004 -0.101045 3.708240 -0.074340 0.043794 0.653713 0.477169
156 N12 RF_maintenance 100.00% 90.17% 100.00% 0.00% 10.045402 13.154877 9.876355 10.214315 9.266661 11.189577 3.425093 6.814421 0.107448 0.039391 0.051573
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.198861 -0.342510 0.133057 0.732004 -0.687332 0.169570 0.187409 0.433099 0.629843 0.663454 0.318983
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.220468 -0.340354 -0.032218 -0.579039 1.295977 1.600119 2.085018 8.680578 0.643967 0.676711 0.320305
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.412718 27.084041 -1.392037 -0.626627 -0.286196 6.315442 -0.329396 20.044162 0.616709 0.552764 0.288872
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.592338 -1.162858 -0.105025 -0.664669 -0.645004 1.337588 0.009908 -0.294956 0.655640 0.681494 0.313410
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.091898 30.412828 0.171010 -0.392760 -0.219363 1.583206 -0.302400 1.061725 0.662716 0.571985 0.285136
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 2.070184 -1.258039 -0.727887 -1.054021 0.815863 0.810051 2.011643 -0.677852 0.660956 0.692574 0.318907
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.648572 1.373327 -0.056469 0.524285 -0.115337 0.784301 -0.324911 0.679704 0.673065 0.692786 0.313232
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.105929 0.471988 0.675016 1.390835 0.007482 1.846297 0.152538 0.720011 0.666539 0.687941 0.308011
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 29.782234 0.080332 -0.447694 -0.878538 5.799712 -0.171978 7.127782 -0.978581 0.547678 0.688887 0.316445
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.106831 2.934374 -1.336802 3.102680 1.158690 4.702026 1.955050 2.572468 0.665463 0.669412 0.320815
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.067717 -1.073990 -1.304543 -0.075263 1.504399 0.117202 -0.312076 1.184034 0.656138 0.675278 0.313483
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.085433 -1.156445 0.379235 -0.304819 0.849290 0.661918 0.012666 -0.341936 0.651709 0.675684 0.320747
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.668484 -0.881569 -0.758179 -1.304798 0.492227 0.283179 -0.684937 -1.537806 0.649362 0.672825 0.327693
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.540525 -0.648257 10.180712 -0.813555 9.132258 0.882433 4.531506 1.938710 0.041621 0.666483 0.508650
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.701670 2.545537 -1.344013 0.207877 -0.823130 1.423776 -0.198623 0.106752 0.599645 0.596793 0.305384
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 12.872521 14.023249 3.893414 4.469364 9.399060 11.206263 5.376537 8.962277 0.040533 0.045009 0.003972
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.605162 -0.765820 -0.777898 -1.142340 1.039197 0.687294 -0.558709 -1.215738 0.625771 0.670335 0.324397
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.300635 14.134948 -1.402808 10.610752 0.091164 11.061104 10.359978 6.922607 0.653717 0.054223 0.513644
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.275671 -0.256738 0.759420 0.567528 -0.455573 0.016535 0.207181 2.902989 0.656970 0.680827 0.318388
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.152347 13.174448 0.093819 10.188555 3.348273 11.211746 0.335167 6.314968 0.667443 0.050392 0.480557
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.113811 0.798727 0.011895 0.815765 0.748350 0.286465 1.088888 0.482401 0.656310 0.679062 0.309543
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.226976 -0.785923 -1.428897 -0.311058 -0.473403 0.045885 -0.623016 -0.303383 0.667436 0.689796 0.303165
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 35.431632 -0.364186 -0.242642 -1.368820 10.004185 0.802675 3.789838 -1.387963 0.554728 0.686884 0.314117
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.920663 -0.843349 0.492232 -0.133513 -0.504388 -0.880934 -0.526425 -1.005668 0.665309 0.686170 0.321501
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.678992 -1.041939 1.573369 -0.199680 1.603538 1.694255 1.869108 -0.007190 0.651736 0.680835 0.320851
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.707073 12.997472 9.475783 10.313899 9.322297 11.213705 4.915355 7.032728 0.028582 0.031959 0.001666
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.324656 -1.476231 -0.499408 0.415623 -0.421771 -0.072670 -0.536946 -1.046076 0.639958 0.663723 0.337885
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.570209 0.012609 1.403511 -0.367286 0.355128 0.467919 7.146742 0.572889 0.627017 0.650227 0.327688
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.142028 6.655315 4.561193 4.604482 6.924200 8.789474 0.095827 3.241834 0.585943 0.606474 0.343187
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.075019 0.151184 4.763457 1.212833 7.227003 1.813994 0.257415 0.913359 0.570405 0.621745 0.364051
200 N18 RF_maintenance 100.00% 100.00% 50.73% 0.00% 12.498699 39.336137 4.298067 0.189765 9.366390 5.256011 3.300152 16.910054 0.041348 0.237782 0.161653
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.947714 4.855455 3.038306 4.052985 2.768377 7.297171 0.141504 2.496213 0.637617 0.641982 0.329539
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.626248 2.232759 1.591622 -1.202895 1.090914 -0.560431 -0.286083 19.509643 0.646790 0.654463 0.315490
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.940781 15.761856 1.179431 -0.957230 -0.191051 1.070948 12.078833 -0.125436 0.657680 0.682128 0.321159
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 9.508304 -1.031620 3.080009 -1.117598 6.664239 -0.813929 1.304194 0.743488 0.398792 0.661510 0.420850
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.771878 7.582569 -1.429225 2.202667 10.069473 3.956650 -0.088062 0.388942 0.618569 0.556880 0.319904
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.495394 2.019407 -0.638012 0.300182 -1.101102 1.288996 3.049303 -0.935092 0.630151 0.626471 0.309192
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.339287 2.266152 -1.296004 -0.040776 -1.091339 -0.584857 -0.749628 -0.762610 0.592147 0.615031 0.326957
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.449972 -1.318168 0.468131 -0.307672 -0.770029 -0.952984 1.782750 -1.225189 0.635740 0.652731 0.320725
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.324964 -0.256988 -0.793273 -0.611509 10.083529 -0.378835 1.575583 -1.033804 0.624315 0.656949 0.323502
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.153976 -0.189269 -0.176394 0.241103 -0.696682 -0.562581 1.707239 -0.857146 0.629942 0.660496 0.324724
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.182316 -0.281893 -1.368164 0.527987 -1.038544 -0.086296 -0.054116 -0.018780 0.619857 0.660352 0.331745
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.481257 6.118006 5.015881 4.561698 7.600479 8.562675 0.326808 3.215136 0.606187 0.628046 0.339696
225 N19 RF_ok 100.00% 0.00% 73.04% 0.00% -0.669788 13.628506 0.728838 4.631454 -1.114246 10.863366 -0.999414 5.711964 0.632825 0.185279 0.494265
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.600400 21.381331 -0.474830 0.855240 -1.452241 3.620349 -1.017142 0.526091 0.623470 0.568726 0.309774
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 4.918176 -0.341090 1.948820 -0.693037 2.025578 6.186473 3.865350 -0.405588 0.509463 0.633480 0.372080
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.361680 -0.169035 1.113704 -1.187572 0.031202 -0.698306 -0.571277 -0.447189 0.608079 0.619722 0.331527
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.271263 0.355463 0.732732 1.475860 0.537714 1.253963 -0.992703 -0.748410 0.603409 0.625781 0.349609
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.505932 -0.265671 0.026540 -1.349656 -0.835654 -0.930125 -0.232572 -1.248467 0.581279 0.635583 0.336036
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.265297 -0.315075 0.944831 0.465245 -0.633809 -1.056534 -1.085035 -1.245306 0.627763 0.648554 0.331660
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.927614 -1.195696 -0.005744 0.301463 -0.681228 -0.352424 -0.466994 0.084071 0.626206 0.649942 0.333154
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.665979 0.092427 -0.721240 -0.831313 -0.631795 -1.451039 1.965488 1.772339 0.619360 0.646478 0.333648
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.498216 -1.112039 -0.325160 0.264521 -1.300952 -0.930247 0.106769 -0.943380 0.621839 0.649856 0.343063
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 24.400782 0.862677 0.375485 1.688789 3.191917 1.929649 -0.201202 0.236528 0.475254 0.640152 0.340699
243 N19 RF_ok 100.00% 6.59% 0.00% 0.00% 44.289744 -0.696904 0.374740 -1.428225 17.179438 -1.226231 23.155922 -0.934530 0.371968 0.625362 0.386411
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.332346 -0.786290 -0.815193 -0.712927 -0.547768 -0.544480 0.984135 2.716747 0.581568 0.628797 0.338994
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.273831 0.595841 1.144291 -0.433950 -0.177943 -0.796269 -1.196286 -1.080046 0.606989 0.616469 0.339891
246 N20 dish_maintenance 100.00% 0.00% 88.82% 0.00% 0.482784 10.973549 -0.750840 3.054233 -0.672682 82.061210 -0.769824 3.835909 0.575702 0.129871 0.439674
261 N20 RF_ok 100.00% 0.00% 0.00% 0.00% -0.870285 -0.089447 -0.284876 -0.141381 -0.594466 -1.033002 7.322196 -0.755692 0.591022 0.607616 0.337705
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.625194 7.713119 9.025929 10.036022 9.059358 10.729665 8.477843 25.604136 0.033316 0.028145 0.004720
320 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 14.981718 14.040799 6.625236 6.905389 9.332391 11.230663 3.093139 6.914089 0.056453 0.048660 0.006271
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.763404 2.777077 1.057731 1.528225 0.937420 1.689830 1.403582 -0.164690 0.503860 0.524864 0.349288
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.300258 -0.997648 1.171638 -1.251683 1.135721 -0.337448 -0.334329 1.813258 0.532518 0.543000 0.354461
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.265240 -0.352641 1.126333 -0.339668 3.188744 -0.579372 2.155960 1.076423 0.513035 0.536347 0.347322
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.169349 3.078688 -1.021321 -1.312067 -0.322269 -0.591609 2.094355 1.882217 0.487925 0.523594 0.328377
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 9, 10, 15, 16, 18, 19, 27, 28, 29, 30, 32, 34, 36, 40, 42, 47, 50, 51, 52, 54, 55, 57, 58, 59, 60, 63, 68, 71, 72, 77, 78, 79, 80, 81, 84, 85, 86, 87, 92, 94, 96, 97, 101, 103, 104, 107, 108, 109, 110, 111, 113, 117, 120, 121, 122, 123, 126, 128, 131, 134, 135, 136, 142, 144, 145, 151, 155, 156, 158, 159, 161, 165, 166, 170, 173, 179, 180, 182, 185, 189, 191, 192, 193, 200, 201, 202, 204, 205, 206, 208, 209, 210, 221, 224, 225, 226, 227, 242, 243, 246, 261, 262, 320]

unflagged_ants: [5, 8, 17, 20, 21, 22, 31, 35, 37, 38, 41, 43, 44, 45, 46, 48, 49, 53, 56, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 82, 83, 88, 89, 90, 91, 93, 95, 102, 105, 106, 112, 114, 115, 118, 124, 125, 127, 132, 133, 137, 139, 140, 141, 143, 146, 147, 148, 149, 150, 157, 160, 162, 163, 164, 167, 168, 169, 171, 181, 183, 184, 186, 187, 190, 207, 211, 220, 222, 223, 228, 229, 237, 238, 239, 240, 241, 244, 245, 324, 325, 329, 333]

golden_ants: [5, 17, 20, 21, 31, 37, 38, 41, 44, 45, 53, 56, 65, 66, 67, 69, 70, 83, 88, 91, 93, 105, 106, 112, 118, 124, 127, 140, 141, 143, 146, 147, 148, 149, 150, 157, 160, 162, 163, 164, 167, 168, 169, 171, 181, 183, 184, 186, 187, 190]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2459983.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

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