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 = "2460053"
data_path = "/mnt/sn1/2460053"
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: 4-18-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/2460053/zen.2460053.42125.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 361 ant_metrics files matching glob /mnt/sn1/2460053/zen.2460053.?????.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/2460053/zen.2460053.?????.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 2460053
Date 4-18-2023
LST Range 13.321 -- 15.262 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 361
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 40
Total Number of Nodes 19
Nodes Registering 0s N15
Nodes Not Correlating N05, N07, N14
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 179 / 198 (90.4%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 113 / 198 (57.1%)
Redcal Done? ❌
Never Flagged Antennas 4 / 198 (2.0%)
A Priori Good Antennas Flagged 90 / 93 total a priori good antennas:
5, 7, 9, 10, 15, 16, 17, 19, 20, 21, 29, 30,
31, 37, 38, 40, 41, 42, 44, 45, 53, 54, 55,
56, 65, 66, 67, 69, 70, 71, 72, 81, 83, 85,
86, 88, 91, 93, 94, 101, 103, 105, 106, 107,
109, 111, 112, 118, 121, 122, 123, 124, 127,
128, 136, 140, 141, 144, 145, 146, 147, 148,
149, 150, 151, 157, 158, 160, 161, 162, 163,
164, 165, 166, 167, 168, 169, 170, 171, 172,
181, 182, 183, 184, 186, 187, 189, 190, 191,
202
A Priori Bad Antennas Not Flagged 1 / 105 total a priori bad antennas:
224
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_2460053.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 0.00% 100.00% 100.00% 0.00% 1.335645 1.372070 0.016742 -0.011954 -0.780612 -0.691237 0.148782 -0.277180 0.027378 0.027519 0.001329
5 N01 digital_ok 0.00% 100.00% 100.00% 0.00% -0.300224 0.133463 0.273776 0.536483 -0.315654 -0.169443 -0.215067 -0.333858 0.026599 0.025456 0.001157
7 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 0.535469 -0.296827 0.137151 0.289096 3.658504 3.354556 13.468887 21.113241 0.071512 0.078306 0.015041
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.264687 3.809008 0.706507 0.742063 4.075618 1.926193 -5.222741 -5.716980 0.525077 0.529786 0.387706
9 N02 digital_ok 0.00% 100.00% 100.00% 0.00% -0.667488 0.723644 0.454369 0.169161 -0.036372 -0.832088 2.694517 -0.617427 0.061626 0.038839 0.022222
10 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 3.356497 1.503731 -0.731486 -0.242993 5.322153 4.597497 13.303261 8.827696 0.029106 0.028269 0.001650
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.646328 4.206406 -0.179990 -0.324688 13.906154 22.248536 -0.758579 5.540312 0.446264 0.567630 0.401895
16 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 3.852198 4.436405 -0.662524 -0.979444 1.572079 1.773482 1.942322 -0.739720 0.029950 0.036000 0.003314
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 3.355794 2.728586 -0.858374 0.192473 32.828461 9.833238 1.380162 10.993919 0.549860 0.411631 0.419753
18 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.173403 0.838719 -0.139375 -0.700926 38.588807 3.130965 261.503469 17.062659 0.029160 0.029059 0.001710
19 N02 digital_ok 100.00% 100.00% 100.00% 0.00% -0.218748 0.198843 0.225080 0.528216 -0.985226 1.189437 -0.241643 7.073189 0.029607 0.027034 0.001881
20 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 0.467652 0.484670 0.687069 0.098042 2.683167 -0.754036 10.411279 -0.641142 0.026062 0.027807 0.002061
21 N02 digital_ok 0.00% 100.00% 100.00% 0.00% 0.926937 0.326143 0.176927 0.286365 2.022997 1.337475 1.300482 -0.454083 0.028231 0.026461 0.001672
22 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.511450 -0.513185 -1.240772 -1.196685 -0.631018 2.444163 3.373666 4.732222 0.030346 0.029529 0.001689
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.953342 0.823749 0.603235 -0.290066 2.359784 9.400111 5.665025 99.285746 0.025128 0.029021 0.003021
28 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.028847 1.331837 0.585980 -0.534876 1.507651 4.384655 3.175730 5.202096 0.025205 0.029048 0.003259
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 0.422983 0.071983 0.085163 0.147625 -0.330509 -0.687034 5.234595 1.807088 0.028939 0.027591 0.001768
30 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 1.864950 2.433508 -0.119223 -0.313555 10.040858 12.988249 53.625753 55.730821 0.027628 0.028245 0.001642
31 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 2.493641 -0.361793 0.841536 0.400489 0.073368 0.557127 3.042841 7.344342 0.023468 0.026092 0.002127
32 N02 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.602335 1.247936 0.009783 0.077301 0.093182 2.474005 -0.553651 1.969221 0.027127 0.026850 0.001194
34 N06 not_connected 0.00% 100.00% 100.00% 0.00% 0.759669 -0.749948 -0.760724 -0.958576 1.244614 0.827107 1.454665 3.572255 0.029291 0.029439 0.001757
35 N06 not_connected 0.00% 100.00% 100.00% 0.00% -0.577694 -0.105663 -1.253050 -1.010441 -0.571639 -0.376989 2.536637 -1.095047 0.029790 0.029522 0.001509
36 N03 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.603554 0.919324 0.719893 0.635025 0.998924 0.910996 0.984926 0.946360 0.024701 0.024791 0.001107
37 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 3.378523 -0.344791 0.180500 1.436298 1.692437 3.055189 1.812366 9.025824 0.026485 0.020704 0.004461
38 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 2.301554 1.428983 0.588752 0.619709 1.662520 2.292823 10.982466 9.880700 0.024647 0.024493 0.000972
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 3.798292 3.762581 -0.572068 -0.418004 21.518357 24.703819 29.321491 1.668993 0.158345 0.147571 -0.257175
41 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.752160 -0.379343 0.343188 0.382444 -0.816932 2.051520 -0.610286 -0.191893 0.030104 0.028939 0.001820
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 0.960143 1.050453 0.127255 0.148994 0.200442 2.527702 0.899172 24.692309 0.035628 0.037078 0.008858
43 N05 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.933095 -0.826073 0.016628 0.344379 -1.121365 -0.920845 -0.802635 -0.796944 0.027499 0.026492 0.001498
44 N05 digital_ok 0.00% 100.00% 100.00% 0.00% 0.656782 -0.590611 0.153871 0.386973 1.976415 0.084170 -0.363035 -0.317986 0.026895 0.025855 0.001293
45 N05 digital_ok 0.00% 100.00% 100.00% 0.00% -0.330662 -0.553415 0.204108 0.257736 0.186574 0.561528 -0.083435 1.168886 0.027884 0.026585 0.001605
46 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.914917 1.214303 -0.116726 -0.321449 6.916296 14.730126 22.386790 29.517959 0.027563 0.028197 0.001523
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 0.919361 1.106754 -0.786033 -0.821491 1.423655 0.847543 4.519736 -0.016148 0.031015 0.046800 0.006164
48 N06 not_connected 0.00% 100.00% 100.00% 0.00% -0.624177 0.016491 -1.055607 -1.130806 -0.328571 -0.326352 2.580379 -0.244739 0.032915 0.032178 0.001961
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 3.023991 3.743273 -0.760462 -0.087274 26.348333 18.345395 1.695711 30.838053 0.528096 0.560545 0.376146
50 N03 RF_maintenance 0.00% 100.00% 100.00% 0.00% 2.334973 1.140360 0.548062 0.785801 1.365955 0.105487 0.491307 1.557645 0.025311 0.023749 0.001285
51 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 2.892801 2.069724 0.185826 0.243843 52.222570 3.128651 533.190806 0.124333 0.044683 0.026593 0.004162
52 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.287238 0.747276 0.733784 0.686892 2.417302 0.041048 15.514960 2.491205 0.026239 0.024908 0.001305
53 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 1.824006 1.846249 0.562481 0.267398 1.443627 4.399911 15.076893 29.889567 0.050696 0.044342 0.016888
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 4.174332 1.308082 -0.932308 -0.000658 3.658944 1.558880 6.063827 12.120431 0.038981 0.048059 0.009019
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 3.067709 3.004542 -0.387400 -0.321869 1.952776 4.698082 2.863960 -0.396544 0.029740 0.028021 0.001875
56 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 1.064151 -0.508370 0.069444 0.559989 -0.427215 2.791106 0.108274 0.518889 0.030403 0.026714 0.002115
57 N04 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.201837 0.010169 -0.021514 0.173998 3.586863 3.160642 0.362931 -0.204873 0.031484 0.038326 0.004797
58 N05 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.161838 1.246375 0.597098 0.719982 0.996920 0.905444 2.440559 1.513818 0.026000 0.024733 0.001237
59 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.937869 -0.050063 0.607324 0.319331 0.685671 0.710753 0.648593 4.701444 0.027211 0.027113 0.001537
60 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.472622 1.265470 -0.001574 0.733433 0.802977 1.545221 14.578386 5.411342 0.028238 0.024508 0.002350
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 0.800893 3.707733 -0.858672 -0.346088 0.810418 22.016564 -0.982666 0.580198 0.030868 0.566825 0.165685
62 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.368515 0.360904 -1.094715 -1.280872 1.368309 1.137007 1.722785 10.280389 0.031498 0.031874 0.001856
63 N06 not_connected 100.00% 100.00% 100.00% 0.00% 0.123384 1.208971 -1.312150 -0.712145 17.541089 1.690121 39.824974 4.217497 0.038889 0.042788 0.006594
64 N06 not_connected 100.00% 0.00% 0.00% 0.00% 3.049279 3.804648 -0.266941 -0.490595 24.712850 20.435920 1.056899 -0.115771 0.543146 0.559905 0.367151
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% -0.540842 -0.116479 1.399740 1.365765 3.163288 3.780470 10.734316 14.184772 0.022137 0.021158 0.001115
66 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 4.725804 -0.100223 -0.696065 1.416086 2.891555 2.751039 10.289776 14.696599 0.028489 0.020930 0.005090
67 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 2.669987 1.432831 0.407366 0.717514 1.234067 0.905623 12.696056 5.675498 0.025332 0.023905 0.001289
68 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% -0.281333 3.620962 1.423693 -0.163229 4.078369 2.164971 14.239874 2.625534 0.022923 0.028133 0.004234
69 N04 digital_ok 100.00% 100.00% 100.00% 0.00% -0.359521 0.991809 0.267937 0.112301 0.650349 4.956186 1.207916 1.375761 0.030876 0.028654 0.002737
70 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.329263 -0.748261 0.230351 0.448727 -0.271519 -0.228870 1.047709 -0.067541 0.027440 0.027502 0.001190
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.628088 4.076588 -0.502136 -0.629525 29.667531 26.584036 -0.446518 1.545930 0.583321 0.562938 0.415218
72 N04 digital_ok 100.00% 58.17% 100.00% 0.00% 3.475623 1.230818 -1.296718 0.755044 33.919050 -0.338923 41.660872 1.799599 0.192314 0.065040 -0.031374
73 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.130665 0.414961 -0.272245 -0.157138 3.399104 12.240913 0.634962 1.123906 0.027826 0.027740 0.001369
74 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.981420 0.843134 -0.748932 -0.300119 64.693739 60.368342 138.808322 117.474785 0.028628 0.027921 0.001467
77 N06 not_connected 100.00% 100.00% 100.00% 0.00% 0.019507 -0.831561 -1.254114 -1.319847 3.574510 2.656211 23.822268 6.957371 0.030708 0.030480 0.001703
78 N06 not_connected 0.00% 100.00% 100.00% 0.00% -0.638827 -0.043556 -1.150308 -1.274605 -0.355992 -0.204788 -0.534010 2.231733 0.041812 0.038324 0.006777
79 N11 not_connected 0.00% 100.00% 100.00% 0.00% 0.027575 -0.495632 -0.892631 -0.909935 0.382395 -0.484782 0.334299 -0.943025 0.031396 0.030907 0.001555
80 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.287807 2.470595 -1.147979 -1.068345 -0.963285 3.312994 -0.621061 1.446825 0.031440 0.030284 0.002105
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 16.753250 8.741614 9.407918 3.988339 464.129987 78.196446 3306.936105 608.698558 0.017482 0.016675 0.000990
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.126594 8.737498 4.000978 5.109914 105.904728 171.465029 659.728784 1213.459780 0.016947 0.016281 0.000922
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 5.030379 6.850414 3.801078 5.193594 109.308746 286.339597 807.026397 1440.615954 0.016794 0.016267 0.000807
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.797778 0.647522 0.445446 1.439031 12.760989 1.408955 -5.104252 9.715104 0.558508 0.075350 0.437256
85 N08 digital_ok 0.00% 100.00% 100.00% 0.00% 0.694700 -0.627418 -0.203842 0.009954 -0.850317 -0.596159 -0.341624 0.100887 0.030792 0.029268 0.002139
86 N08 digital_ok 100.00% 100.00% 100.00% 0.00% -0.066267 -0.272459 -0.127266 -0.107008 8.891348 2.831135 9.635124 16.553250 0.029425 0.029383 0.001953
87 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.201447 1.697694 0.749422 0.065062 0.818884 11.736425 3.331911 0.999450 0.028209 0.029257 0.001625
88 N09 digital_ok 100.00% 100.00% 100.00% 0.00% -0.792393 -0.529133 0.004447 0.081304 3.595972 4.202272 24.265521 23.830273 0.029698 0.027628 0.001992
89 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.776585 -0.678474 -0.016232 0.062545 0.529556 -1.105034 -0.444615 -0.670361 0.032508 0.028417 0.002331
90 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.079372 0.671424 -0.118421 -0.263347 -0.943765 -0.997780 0.367099 0.706514 0.032246 0.030380 0.002575
91 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.761465 -0.720759 -0.015577 0.059011 -1.205100 -0.674890 -0.157608 -0.380810 0.027295 0.027226 0.001210
92 N10 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.053375 -0.422443 0.601329 0.313405 1.130889 0.009192 0.259789 0.555315 0.027159 0.026271 0.001621
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 0.988423 1.210513 0.627284 0.743937 1.233147 1.220820 4.983532 3.457013 0.024750 0.024143 0.001055
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 0.859522 3.716766 0.662152 -0.756502 1.611117 25.759297 2.701799 8.403952 0.024878 0.562329 0.069550
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 2.209935 3.872416 -0.561168 0.161156 29.232871 12.909901 2.709075 -2.480089 0.530582 0.587795 0.383994
96 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.017221 -0.817547 -1.144082 -0.955706 -0.459467 -0.749999 -0.377986 -0.823588 0.029895 0.029921 0.001676
97 N11 not_connected 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.024850 0.047010 -0.010474
101 N08 digital_ok 0.00% 100.00% 100.00% 0.00% 0.586205 -0.244389 0.491367 0.645471 -1.053749 -0.589309 1.530084 1.664545 0.027749 0.025270 0.001628
102 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.632621 0.072570 0.133693 0.251772 1.237950 0.717177 -0.532473 7.316472 0.030570 0.029098 0.001890
103 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 4.837545 1.279528 -0.886649 0.232558 4.406318 2.402811 20.962225 28.612101 0.028991 0.026191 0.001995
104 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.793335 13.518309 0.460076 3.230623 8.473398 6.984825 4.350368 34.474948 0.025788 0.017702 0.004597
105 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.715916 -0.410923 0.043512 0.180234 -1.073260 0.194300 -0.418889 -0.881335 0.028720 0.026688 0.001812
106 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.758529 -0.749868 -0.074227 0.030923 1.982972 0.980213 2.463623 -0.788652 0.029709 0.027644 0.001979
107 N09 digital_ok 100.00% 100.00% 100.00% 0.00% -0.588289 -0.665254 -0.122956 -0.121242 -0.157244 0.455481 3.463480 5.994941 0.032571 0.031003 0.002293
108 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.371334 -0.315814 0.273033 0.446626 2.192181 -0.988928 7.421036 0.132892 0.026479 0.026277 0.001151
109 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 1.076656 1.231643 0.626326 0.666208 1.120482 1.426341 0.584241 3.313013 0.026883 0.024994 0.001641
110 N10 RF_maintenance 0.00% 100.00% 100.00% 0.00% 3.124104 2.340494 0.304110 0.452926 2.680876 -1.110059 1.039268 0.231262 0.025638 0.025170 0.000940
111 N10 digital_ok 100.00% 100.00% 100.00% 0.00% -0.682956 1.258385 0.323626 0.691624 -0.596395 1.438707 -0.194560 4.269631 0.026069 0.024293 0.001336
112 N10 digital_ok 0.00% 100.00% 100.00% 0.00% -0.836613 1.030027 0.337865 0.724257 -0.339897 1.264706 -0.003706 2.934891 0.027832 0.024392 0.002032
113 N11 not_connected 0.00% 100.00% 100.00% 0.00% 3.637324 3.227108 -0.599409 -0.482441 1.833843 -0.722584 -0.126283 0.673093 0.030734 0.030206 0.001651
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 3.502294 0.671538 -0.962365 -0.693722 4.812796 1.317206 17.234201 -0.807760 0.030209 0.029560 0.001842
115 N11 not_connected 100.00% 0.00% 0.00% 0.00% 3.126065 3.874338 -0.297832 0.086962 23.801085 14.823310 0.089950 -2.977955 0.543281 0.551541 0.386401
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.375604 9.735148 4.354417 6.109127 138.753994 275.023990 836.055221 1661.383810 0.017738 0.016266 0.001599
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 4.832340 5.896245 3.679013 3.905286 106.846582 111.409004 696.197360 731.838373 0.016854 0.016470 0.000792
120 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.188304 1.576623 0.976452 0.533793 2.861956 0.656547 11.391752 5.719111 0.024778 0.025305 0.001175
121 N08 digital_ok 100.00% 3.60% 0.00% 0.00% 3.209300 4.753379 0.616834 -0.787517 7.480103 19.155634 8.768125 25.041967 0.503953 0.540391 0.382750
122 N08 digital_ok 0.00% 100.00% 100.00% 0.00% 1.080722 0.776479 0.417115 0.331308 -0.649364 0.192647 1.308264 1.597616 0.026539 0.025884 0.001228
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.601333 4.625196 0.822643 0.453645 0.400698 5.886957 -7.314146 -5.052134 0.563342 0.562405 0.396222
124 N09 digital_ok 0.00% 100.00% 100.00% 0.00% 1.012303 -0.579800 0.670140 0.406682 0.667718 -0.834220 0.723696 1.593361 0.031992 0.028733 0.003125
125 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.616448 -0.739620 0.096235 0.128983 4.983487 0.105851 -0.602451 -0.279754 0.027036 0.026977 0.001226
126 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.669132 -0.397415 -0.009783 0.187126 3.084766 -0.636309 0.743709 0.124195 0.027668 0.026890 0.001385
127 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 1.112448 0.597184 0.600001 0.073583 1.085238 3.248064 0.106613 -0.665459 0.025113 0.026866 0.001480
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 0.310246 1.341394 0.155103 -0.022567 0.315054 2.114283 2.013623 6.292262 0.026720 0.027332 0.001341
131 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.782327 0.967333 -0.996181 -0.649285 -0.658795 0.838129 0.465661 -0.489529 0.030963 0.032376 0.001576
132 N11 not_connected 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.048206 0.169160 0.104084
133 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.595333 -0.792018 -1.022130 -0.966569 -0.701166 -0.513239 1.002048 0.276654 0.031395 0.030409 0.001896
134 N11 not_connected 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.126805 0.140520 0.056749
135 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.718171 0.624005 0.134538 0.176574 12.207900 0.945097 2.525731 0.002802 0.028493 0.026886 0.001689
136 N12 digital_ok 0.00% 100.00% 100.00% 0.00% 1.223680 0.309466 0.523535 0.108296 1.418088 -0.436112 2.488207 -0.370595 0.025667 0.027043 0.001232
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.883291 9.879593 5.088062 6.610629 223.386099 476.198020 1568.178582 2331.972939 0.016544 0.016185 0.000741
139 N13 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.456168 -0.532203 -1.251858 -0.967359 -0.846212 0.101953 -0.485206 -0.716145 0.032099 0.031215 0.002587
140 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.153377 0.989647 0.187296 0.012810 0.641483 0.156040 3.234504 3.937162 0.030373 0.029123 0.001820
141 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.607720 1.234090 0.338038 0.031628 0.291120 0.100982 -0.260812 -0.604599 0.029363 0.028292 0.001660
142 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.490323 1.245335 -0.043524 0.731589 5.850771 1.220815 46.355486 2.846333 0.028878 0.024975 0.002731
143 N14 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.944083 1.239247 0.563848 0.722116 -1.297471 1.239264 0.304038 2.605063 0.100169 0.024589 0.013394
144 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 0.085406 1.010388 0.176083 -0.066772 0.604982 0.747619 0.203968 1.151684 0.028573 0.027866 0.001623
145 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 0.025415 0.109129 0.240525 0.233402 -0.070876 27.868626 -0.257738 0.739430 0.026846 0.026974 0.001361
146 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.826721 -0.751521 -1.049995 -1.015420 -0.321427 -0.557143 -0.286380 -0.947544 0.029617 0.029403 0.001609
147 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
149 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
150 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
151 N16 digital_ok 0.00% 100.00% 100.00% 0.00% -0.357694 0.274245 -1.081665 -0.797873 0.153963 0.395491 -0.387214 0.418493 0.032002 0.029796 0.002257
155 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.130218 0.539914 0.564740 0.087230 1.505545 5.194847 3.865802 1.021992 0.025577 0.026971 0.001209
156 N12 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.677558 1.294962 0.576028 0.678841 1.523927 1.901892 1.903633 3.949726 0.028889 0.026796 0.001645
157 N12 digital_ok 0.00% 100.00% 100.00% 0.00% -0.520747 -0.824004 0.258384 0.325560 -0.178384 0.337114 -0.564779 -0.654578 0.028700 0.026842 0.001647
158 N12 digital_ok 100.00% 100.00% 100.00% 0.00% 0.293704 0.176419 0.193665 0.298745 0.119676 0.616223 6.587713 13.666262 0.026728 0.026198 0.001253
159 N13 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.540973 -0.679218 -1.053645 -0.992089 0.607016 -0.472452 -0.768360 0.135304 0.032364 0.031283 0.002581
160 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 0.940485 0.533449 0.595630 0.171769 1.080426 0.028437 0.722774 0.257101 0.057763 0.035233 0.009342
161 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 0.275925 1.244522 0.239150 0.046045 -0.047362 -0.311632 -0.375614 0.513437 0.034204 0.030676 0.003038
162 N13 digital_ok 100.00% 100.00% 100.00% 0.00% 2.283246 1.582730 -0.190403 0.019597 1.793325 1.646548 16.426244 -0.094488 0.055383 0.036024 0.007531
163 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.132874 -0.596132 0.227834 0.315076 0.635556 3.716003 5.363751 5.861072 0.029534 0.026627 0.002195
164 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.061414 -0.654184 0.236685 0.392935 7.578788 1.908332 0.396917 1.085925 0.027145 0.026786 0.001444
165 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 0.661513 0.107552 0.032754 0.116990 0.619321 -0.439068 0.521367 -0.348631 0.028287 0.027111 0.001541
166 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.795400 1.822614 0.382023 -0.105875 1.260541 -0.187603 0.184575 0.025637 0.026182 0.027944 0.001517
167 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
168 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
169 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
170 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
171 N16 digital_ok 0.00% 100.00% 100.00% 0.00% 0.111525 -0.647035 -1.096251 -1.148074 -0.674091 -0.381995 -0.832604 -0.392098 0.030210 0.030430 0.001888
172 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 3.079225 0.837396 -0.949037 -1.239165 3.760955 4.791581 2.137242 2.496998 0.030370 0.030696 0.001934
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.333520 3.816487 0.913981 0.944362 -1.697124 -1.748433 -8.967253 -7.893120 0.530346 0.525316 0.357881
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.113418 4.032486 -0.556023 -0.890147 21.933424 27.896334 0.425684 41.767830 0.562838 0.534707 0.384110
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.309988 1.139358 -0.352014 0.760617 24.086708 1.299497 41.104852 4.385427 0.590842 0.034157 0.338186
181 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.881353 -0.853331 0.381812 0.418919 0.588472 0.917618 -0.195361 2.463484 0.067634 0.034082 0.013423
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 3.195289 1.281745 -0.038453 0.660466 24.044294 1.309236 4.322143 3.780674 0.587967 0.036219 0.348861
183 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.016491 -0.241245 0.220668 0.297513 1.010262 0.741189 0.441517 1.978099 0.030352 0.028658 0.001875
184 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 0.768461 0.459453 0.517484 0.079539 0.846599 0.665401 2.141087 -0.291518 0.028738 0.027509 0.001519
185 N14 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.743406 0.525480 -0.195335 0.010333 1.842714 -0.581543 -0.314544 -0.093684 0.028092 0.027708 0.001357
186 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 3.026917 2.275211 -0.428511 -0.296129 4.058213 0.015788 3.447638 1.187397 0.030957 0.029415 0.002065
187 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 1.288522 2.523014 -0.025764 -0.332987 1.546839 11.188360 14.285769 4.904898 0.027439 0.028022 0.001355
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
190 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
191 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.237516 3.793988 0.824398 0.973009 0.470639 -2.013502 -7.985027 -9.381751 0.526618 0.520294 0.362127
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.306754 3.773637 0.952601 0.900686 -2.245566 -1.591666 -9.215278 -8.911626 0.533015 0.530199 0.365786
200 N18 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.759826 -0.361059 -0.808214 -0.899107 1.542041 0.411997 2.973604 3.051442 0.037993 0.037992 0.003687
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.150565 3.797615 0.593519 0.860172 5.216891 -0.559362 -3.971256 -7.725931 0.559222 0.501290 0.386578
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% -0.120739 0.156849 -1.129792 -0.839376 -0.180077 0.063210 -0.580524 11.967692 0.037341 0.066387 0.022315
204 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.368905 0.430565 0.304037 0.109819 0.777912 0.385078 21.029158 1.879293 0.027846 0.027062 0.000970
205 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.593681 -0.335117 -0.965387 -0.965324 0.564489 0.069543 0.519335 1.467438 0.029814 0.029929 0.001990
206 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.169819 0.860599 -0.961212 -0.800628 0.889232 0.802026 -0.132942 -0.902608 0.029846 0.029800 0.001720
207 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.638275 -0.597434 -1.050005 -0.956934 -0.322426 -0.721238 1.765561 0.148979 0.045312 0.038015 0.008032
208 N20 dish_maintenance 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.666463 0.639421 0.376397
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% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.162698 0.205652 0.072097
211 N20 RF_ok 0.00% 100.00% 100.00% 0.00% -0.315946 1.166526 -0.981542 -0.711203 -0.461795 1.027020 -1.121784 1.462976 0.032341 0.030802 0.002462
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.603851 -0.256337 -1.209359 -1.070549 4.583836 4.217859 31.235632 25.240174 0.033143 0.031073 0.002693
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% -0.746675 -0.706935 -1.108148 -1.029080 0.513013 1.041635 5.434433 6.745019 0.031712 0.030002 0.002567
222 N18 RF_ok 0.00% 100.00% 100.00% 0.00% -0.810754 -0.766269 -1.056806 -0.972163 -0.376158 0.670112 3.312383 3.332645 0.029596 0.029423 0.001705
223 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.083964 0.872678 -0.993389 -0.818351 0.383272 0.881542 -0.675888 0.111034 0.070761 0.050197 0.031662
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.333345 3.768981 1.018192 0.959414 -2.641655 -1.971930 -9.608595 -8.775612 0.500291 0.491000 0.379589
225 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.321530 1.178359 -1.110845 -0.748548 -0.628050 1.302206 -0.666767 2.745864 0.030521 0.032186 0.003008
226 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.769256 -0.146554 -1.009918 -1.122439 -0.345118 0.946967 -0.642004 -0.731266 0.029537 0.030058 0.001805
227 N20 RF_ok 0.00% 100.00% 100.00% 0.00% 0.568825 -0.318636 -0.868989 -0.897167 -0.017689 0.266243 -0.245582 -0.805306 0.031395 0.029926 0.002151
228 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.621554 0.333093 -1.187370 -0.925298 -0.433395 -0.122828 -0.173413 -0.998244 0.030252 0.029299 0.001756
229 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.238857 0.538537 -1.293897 -1.268523 2.115724 1.033673 2.789455 -1.015234 0.029776 0.029660 0.001824
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% -0.266394 -0.790334 -0.976939 -0.939008 1.430829 1.643514 1.664469 7.086643 0.029505 0.029275 0.001614
238 N18 RF_ok 0.00% 100.00% 100.00% 0.00% -0.504395 -0.626442 -1.117543 -0.954058 -1.205819 -0.558390 -0.708271 -0.812585 0.029760 0.029371 0.001613
239 N18 RF_ok 0.00% 100.00% 100.00% 0.00% -0.766897 -0.747911 -1.132368 -1.062625 -0.076087 0.295499 -0.149857 2.777710 0.031597 0.029768 0.002199
240 N19 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.219516 -0.621024 -0.946164 -0.900128 0.101515 -0.056643 0.311917 0.021590 0.029437 0.029477 0.001832
241 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.879353 -0.620709 -1.043962 -0.997616 -0.857190 -0.737171 -0.666532 -0.820009 0.031481 0.029513 0.002521
242 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.465058 0.120584 -1.292281 -1.275517 -1.100654 -0.478725 -0.956195 -0.543546 0.029855 0.029664 0.001841
243 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.412222 -0.240126 -1.272230 -0.927084 1.279424 -0.878519 -0.508466 -0.732156 0.029844 0.029290 0.001765
244 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.147123 -0.297013 -0.967211 -0.853283 -0.334858 -0.293609 0.743281 -0.234816 0.031350 0.030311 0.002015
245 N20 RF_ok 0.00% 100.00% 100.00% 0.00% -0.608215 -0.328093 -1.070601 -0.884992 -0.987340 0.222568 -0.513939 0.003706 0.029902 0.029460 0.001770
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 2.953005 1.079611 -0.212474 -0.836122 26.042611 1.095556 -0.763030 -0.154246 0.522075 0.032129 0.257938
261 N20 RF_ok 0.00% 100.00% 100.00% 0.00% -0.853192 -0.476703 -1.054125 -0.947037 -0.741303 -0.009192 2.036248 -0.249561 0.030272 0.029456 0.001932
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% -0.356626 -0.016412 0.252431 0.314078 0.111263 0.694011 3.491689 11.355209 0.025431 0.025468 0.000795
320 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.405531 3.821508 0.521161 0.331720 11.928361 10.819716 -4.810519 0.372758 0.454695 0.450429 0.365575
324 N04 not_connected 100.00% 0.00% 0.00% 0.00% 3.248494 3.927197 0.242945 0.369442 17.458803 9.855332 -1.779709 -3.204448 0.440247 0.438282 0.347067
325 N09 dish_ok 100.00% 0.00% 0.00% 0.00% 3.286042 3.930045 0.213061 -0.292772 16.567564 17.920863 -2.858209 0.655767 0.476104 0.473034 0.378061
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.726844 3.984515 -0.178108 -0.206039 21.399313 17.205757 3.247109 -0.643576 0.439423 0.438599 0.342319
333 N12 dish_maintenance 0.00% 100.00% 100.00% 0.00% -0.268648 -0.237861 -0.929069 -0.835762 0.657898 0.652807 2.984804 -0.752933 0.033162 0.029588 0.002731
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 5, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 131, 132, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 220, 221, 222, 223, 225, 226, 227, 228, 229, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 324, 325, 329, 333]

unflagged_ants: [173, 192, 193, 224]

golden_ants: [173, 192, 193]
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_2460053.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 [ ]: