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 = "2459910"
data_path = "/mnt/sn1/2459910"
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: 11-26-2022
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/2459910/zen.2459910.25257.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 1850 ant_metrics files matching glob /mnt/sn1/2459910/zen.2459910.?????.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/2459910/zen.2459910.?????.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 2459910
Date 11-26-2022
LST Range 23.865 -- 9.822 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 7
dish_ok: 1
RF_maintenance: 48
RF_ok: 19
digital_ok: 102
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 18
Nodes Registering 0s N20
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 62 / 201 (30.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 116 / 201 (57.7%)
Redcal Done? ❌
Never Flagged Antennas 85 / 201 (42.3%)
A Priori Good Antennas Flagged 47 / 102 total a priori good antennas:
3, 7, 9, 15, 29, 30, 37, 42, 51, 54, 55, 56,
59, 68, 71, 72, 81, 84, 86, 88, 94, 101, 103,
108, 109, 111, 117, 121, 122, 123, 129, 130,
136, 142, 143, 146, 155, 158, 161, 164, 165,
170, 182, 183, 185, 189, 191
A Priori Bad Antennas Not Flagged 30 / 99 total a priori bad antennas:
8, 22, 43, 46, 62, 74, 77, 79, 82, 89, 90,
95, 102, 115, 120, 125, 132, 137, 138, 139,
205, 220, 221, 223, 238, 239, 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_2459910.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% 0.00% 0.00% 9.589876 -0.126032 8.807479 0.299247 8.693339 0.495818 0.113661 0.803610 0.033430 0.670181 0.564441
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.026708 2.129768 -0.714761 -1.188501 14.469455 23.566022 106.009096 147.492262 0.669230 0.666820 0.417785
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.321254 0.062922 -0.317836 -0.362805 -0.253598 1.419331 0.383190 -0.441866 0.666647 0.672883 0.415380
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.886234 -0.862426 0.661427 2.490691 -0.147806 0.307367 9.626066 7.311589 0.660140 0.663758 0.409606
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.479857 -1.122117 -0.921035 -0.297511 0.161799 1.135053 0.951448 1.521498 0.663868 0.673507 0.407945
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 3.959139 0.299414 7.281616 0.064630 4.919151 0.522464 -0.352684 -0.769756 0.489422 0.666270 0.476940
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.426806 -0.487697 -1.333681 -0.740126 -0.659436 1.419716 -0.479951 0.002519 0.648846 0.661144 0.414456
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 9.801816 0.126817 8.268339 1.250821 8.698881 1.695061 -0.315446 19.288161 0.032655 0.669005 0.547479
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.145201 -1.422396 -0.578533 0.212503 1.381189 1.707077 3.435568 1.670214 0.672347 0.679851 0.414372
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.576093 0.756303 -0.223123 -0.109223 0.818387 0.733116 3.573441 0.922950 0.669277 0.680619 0.413323
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.479185 9.617636 8.780411 0.098185 8.869390 1.148722 0.057497 19.754033 0.028836 0.460314 0.371974
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 3.123386 -0.978973 0.608227 0.970658 1.221595 1.841955 1.103480 2.999424 0.656866 0.679526 0.403244
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.316935 -1.072326 3.120271 -1.273497 0.254117 -1.054955 1.010219 -0.552955 0.647716 0.685759 0.418659
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.480134 -0.071775 -0.374357 3.828865 0.242931 -0.683901 -0.221659 -0.192429 0.650995 0.638523 0.408342
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.533896 -0.508370 0.167413 -0.275770 2.131473 0.534824 -0.709718 -1.213620 0.627387 0.646879 0.406960
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.214124 10.268239 8.828343 9.322362 8.837815 7.762423 1.268361 0.628741 0.032415 0.036823 0.004017
28 N01 RF_maintenance 100.00% 0.00% 85.30% 0.00% 11.745338 24.663925 1.083739 0.794101 4.340385 5.556870 2.896148 9.631921 0.358342 0.156758 0.262526
29 N01 digital_ok 100.00% 0.00% 100.00% 0.00% -1.228835 10.670115 -0.101085 8.954286 -0.181120 7.748195 -0.291347 -0.463835 0.671711 0.035249 0.584628
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.019627 -0.308170 -0.632763 0.196342 0.898740 -0.575505 9.744641 0.385504 0.669424 0.685977 0.402328
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.079156 -1.034565 0.794614 0.950029 1.362130 0.645065 0.718921 1.144815 0.678776 0.685544 0.405512
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.228232 20.786267 -0.215740 1.974752 10.640436 5.125904 5.175829 7.973005 0.632123 0.583313 0.354957
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.226384 -0.752264 3.781518 -0.646661 8.778269 24.346536 0.456179 3.264098 0.042885 0.656170 0.514484
35 N06 not_connected 100.00% 0.00% 0.00% 0.00% -1.156170 -0.522272 -0.613003 -1.258059 7.051996 -1.478699 -0.040299 -0.434334 0.620758 0.641651 0.401416
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.928173 7.215608 -0.203445 0.124814 0.841519 2.449808 0.772440 2.308918 0.658697 0.673279 0.410404
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.561451 0.168362 -1.583236 0.989641 1.048803 1.365871 -0.043105 6.747131 0.671400 0.682204 0.416330
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.004180 0.159842 -0.156202 0.220663 0.478753 0.127563 2.643228 1.286760 0.673749 0.688771 0.416834
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.182248 0.761142 -0.200144 0.234586 -0.520694 -0.261854 -0.405045 -0.205467 0.670229 0.680987 0.405700
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.272100 0.436207 -0.856766 -0.276791 1.736075 0.158049 -0.175174 0.314849 0.675404 0.682722 0.394326
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.392278 11.188759 9.033418 9.743368 8.610414 7.609561 0.510271 0.845742 0.034081 0.031880 0.000877
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.511817 0.577808 -0.173172 0.217866 -1.483204 0.479553 -0.874448 0.154446 0.688078 0.690547 0.405359
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.469208 0.198769 -1.309147 -0.207891 -0.039181 0.568410 -0.680225 -0.668756 0.683378 0.697961 0.402098
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.548946 1.045420 -0.081848 0.046111 0.110889 1.783683 0.025356 1.737354 0.671206 0.678743 0.396436
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.843124 1.579125 1.051199 1.524503 -0.369440 -0.617624 -0.345929 -1.795960 0.663068 0.696120 0.416678
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 10.454895 1.097365 3.615625 -1.376624 8.767956 -1.639375 0.724522 7.267697 0.038087 0.652056 0.503942
48 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.033011 0.802148 0.099960 1.233915 6.477645 -0.171995 -0.305565 -1.904485 0.635490 0.666534 0.409333
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.110034 -0.344449 -0.680088 -1.468688 -0.593321 -1.352409 -0.243784 6.937375 0.590427 0.637652 0.404101
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.921950 7.148045 -0.074927 0.722179 1.923096 5.799204 22.691412 59.592221 0.649367 0.643510 0.385258
51 N03 digital_ok 100.00% 100.00% 0.00% 0.00% 22.597620 0.848762 11.327023 -0.119707 9.120437 3.349351 6.652562 6.562709 0.039327 0.686756 0.562234
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.306004 5.851345 -0.662552 0.190567 0.238957 1.485336 1.349558 0.399124 0.676707 0.693448 0.406308
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.220312 2.429603 -0.453465 -0.181457 2.194861 1.762316 2.454674 3.171186 0.683098 0.697418 0.408029
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.638840 10.882637 8.836933 9.530106 8.829068 7.770714 1.635418 0.791610 0.032373 0.032178 0.001282
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 1.153702 11.536395 0.437574 9.443313 1.361119 7.757556 4.806129 1.390922 0.676240 0.034459 0.530860
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.253771 11.610065 0.051986 9.628243 -0.186215 7.665123 1.264572 0.197132 0.679459 0.037482 0.552345
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 26.201579 0.224828 5.356215 0.223108 3.275928 0.703320 3.463698 2.221337 0.465348 0.692507 0.407066
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.172493 10.566395 8.720829 9.419948 8.758607 7.736866 1.189584 0.718868 0.034572 0.034863 0.001506
59 N05 digital_ok 100.00% 100.00% 0.00% 0.00% 10.264745 0.585961 8.765592 1.539037 8.619594 3.591002 0.653812 5.073282 0.048089 0.686371 0.545518
60 N05 RF_maintenance 100.00% 0.00% 99.57% 0.00% 0.762251 10.481126 -0.622638 9.452762 -0.280498 7.723505 0.128924 1.312134 0.671280 0.074828 0.535407
61 N06 not_connected 100.00% 0.00% 0.00% 0.00% 8.217135 0.169002 2.517536 -1.187405 5.544780 -1.769721 -0.514625 0.158955 0.427159 0.655254 0.453839
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.538537 1.018193 -1.629749 0.863318 -1.046002 -1.424735 0.120104 -1.257980 0.619637 0.669275 0.408211
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.157002 10.844674 -0.497096 4.204063 -0.222489 7.787269 -0.099176 1.297392 0.618076 0.042525 0.480066
64 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.160614 0.443629 -1.211297 -0.640234 4.698559 -1.840960 2.341474 -0.474322 0.598092 0.603462 0.384668
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.261196 1.111379 0.121835 0.614772 0.665081 1.961963 0.012374 0.119566 0.655978 0.684859 0.418258
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.088357 1.349194 1.650760 1.541408 2.625157 0.499306 -0.059512 1.013251 0.662641 0.686976 0.411150
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.983755 -0.689062 1.022925 0.935384 -0.135633 0.243326 0.345670 1.636726 0.671058 0.691153 0.403507
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 1.007148 24.900226 0.216571 12.478391 0.098458 7.805632 1.772754 5.908587 0.680043 0.031480 0.541618
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.285794 -0.106140 0.022083 0.316876 -0.467397 1.625770 0.074371 0.187213 0.678495 0.697432 0.396093
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.607269 -0.125918 -0.724751 -0.351586 1.704074 1.509683 1.151158 0.430673 0.686952 0.702043 0.396479
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 6.429394 0.044909 0.183950 0.758767 0.654980 0.069493 1.963615 0.883968 0.693678 0.702672 0.394192
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 2.526185 0.073761 0.310507 0.721642 0.276747 0.241519 8.025818 1.830085 0.682065 0.697982 0.390418
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.186030 0.718424 -0.961060 1.649119 0.422384 6.712935 0.144533 0.128707 0.693719 0.694265 0.397218
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.880908 2.235448 -0.064531 -0.949844 -0.662807 3.418061 -0.703336 3.311900 0.687700 0.696885 0.391382
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.358880 0.169117 0.257680 -1.335788 -1.114202 -2.099179 -1.272325 -0.881086 0.652981 0.642210 0.399693
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 29.816953 0.258472 -0.709401 0.842982 2.733778 -1.680673 0.766453 -0.959588 0.435678 0.659990 0.397596
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.838972 -0.412734 -0.812426 -1.131689 -0.793456 -1.301331 0.347902 -0.906676 0.624688 0.653239 0.408471
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 8.419180 12.002992 2.077568 4.095987 5.908197 7.661708 10.496312 0.232820 0.303466 0.038986 0.209517
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -0.469911 -0.819787 -0.554255 1.935982 -0.373999 32.456052 -0.535047 -0.002959 0.636257 0.652130 0.399919
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.146099 -0.345754 -0.143988 1.529613 -0.334574 0.192994 -0.642361 -0.744858 0.653852 0.669933 0.401640
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.684557 -0.004180 -0.372417 0.023189 -0.534994 -1.410813 -0.755637 0.385024 0.664128 0.686004 0.400877
84 N08 digital_ok 100.00% 34.65% 100.00% 0.00% 18.729236 21.932761 11.408916 12.079484 7.055533 7.649431 2.321133 2.748654 0.235600 0.034380 0.156219
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.855107 1.118589 1.955731 0.307980 -0.464687 0.380874 -0.656749 0.198093 0.659047 0.691349 0.399689
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.438367 -0.450167 0.927461 0.604774 4.326227 -0.859827 0.098629 12.484690 0.668718 0.690840 0.388122
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.618980 6.480927 0.742607 -0.328609 17.898943 0.367309 2.991130 1.272832 0.625314 0.712362 0.379583
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.167335 0.320536 -0.005682 0.633338 -1.011295 0.429343 4.837566 1.271456 0.681703 0.697174 0.382833
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.305495 0.254147 -0.216540 0.511422 -0.664874 -0.329044 -0.791184 -0.747213 0.682568 0.698041 0.387123
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.620539 -0.070169 1.088403 0.890709 -1.216331 -0.647664 0.175861 3.208116 0.670193 0.689013 0.389443
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.667175 -0.086389 -0.029349 0.025360 -0.534828 -0.012520 -0.002519 -0.655560 0.670947 0.695790 0.400966
92 N10 RF_maintenance 100.00% 0.32% 17.78% 0.00% 35.891136 41.108476 0.243828 0.698760 5.747576 5.402504 0.891003 6.596868 0.289307 0.243604 0.099320
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.201139 0.556796 1.744131 0.022240 0.134471 0.785990 2.114737 -0.122827 0.656706 0.686858 0.407319
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 10.606709 -0.727651 8.955816 -0.323539 8.740750 1.305857 0.311108 4.039009 0.032322 0.683477 0.474320
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.296705 -0.120361 -0.731325 0.599843 -0.430772 -2.059145 -0.723906 0.305078 0.629590 0.668324 0.415918
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.758133 11.608277 3.612467 4.257635 8.601044 7.578053 0.410622 -0.040357 0.032972 0.036857 0.002276
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.836975 3.545443 0.243367 0.171530 -0.958209 -1.098357 -1.048013 5.351347 0.620700 0.603098 0.408146
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.516483 0.973753 -0.250287 -0.077025 0.154936 0.437054 0.393189 1.032067 0.631468 0.660545 0.408970
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.389514 -0.702033 0.470692 0.403593 -0.772970 2.595465 0.776188 -0.900631 0.637708 0.673215 0.410396
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.198595 -0.696482 -0.865255 0.089035 0.586031 -0.488107 0.572987 0.614309 0.655675 0.679628 0.400516
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.782325 7.207741 -0.984035 0.659491 3.149797 1.499100 5.760537 0.019386 0.675378 0.697176 0.395639
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.213255 0.731586 -0.728716 1.798999 0.141444 0.012520 -0.917251 3.407450 0.688032 0.690974 0.391094
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.385202 4.669751 3.535655 0.164456 5.054348 4.219357 3.064091 1.813533 0.662456 0.701432 0.394491
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.113765 55.565523 5.941964 6.495407 2.053730 4.064028 -0.341716 0.642809 0.630994 0.672249 0.392222
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.471563 -0.391390 -0.305404 0.542466 0.664978 -0.602744 -0.293743 -0.403641 0.688798 0.698286 0.379404
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.407758 0.473787 0.818421 0.809163 1.714253 -0.239686 -0.418977 0.049094 0.676070 0.697187 0.382793
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.236590 0.128360 -1.251766 -0.877765 0.166316 -0.275946 3.659769 3.057541 0.684130 0.700397 0.385657
108 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 9.741085 3.145401 8.770623 -0.480057 8.779629 -0.442328 0.841156 0.071042 0.040918 0.701069 0.501921
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.536282 10.556627 8.815441 9.212143 8.889417 7.793693 -0.058561 0.678657 0.029367 0.033224 0.001872
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.037633 23.507008 -0.189924 12.224645 6.063345 7.578867 34.211741 2.275676 0.665267 0.032179 0.453685
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.005371 10.482410 0.115016 9.308131 -0.552140 7.794130 0.584085 0.821596 0.662413 0.035245 0.473204
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.113604 0.506132 -0.242090 -0.311935 0.150623 1.228946 -0.061810 -0.732722 0.652449 0.673678 0.417005
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.484528 11.660726 3.415153 4.162981 8.621964 7.597235 0.701313 -0.217178 0.034692 0.030825 0.002298
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 4.976250 0.499544 0.669617 -0.528133 4.920801 -1.710273 0.523519 -0.806924 0.532824 0.644379 0.432293
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.331375 1.168835 2.114794 1.391630 2.087093 -0.384948 -1.783364 -1.042034 0.613940 0.643163 0.426131
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.591359 0.100838 -0.721342 -0.316796 0.408469 0.030510 0.776975 -0.472821 0.624740 0.653822 0.409739
117 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 10.512211 12.008935 8.868505 9.750951 8.637739 7.678900 0.453314 1.799261 0.027750 0.030572 0.001913
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.493321 0.953630 -0.383735 0.397853 -0.055448 -0.125955 0.555987 1.070042 0.656890 0.685388 0.406490
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.488121 1.387080 -1.613808 1.176976 0.157208 4.613071 1.173038 3.370499 0.670072 0.676262 0.394207
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.406494 2.388350 2.099600 1.769665 0.320065 -0.119419 0.173119 -2.300555 0.665601 0.697479 0.388143
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.915747 3.622148 -0.495567 2.780547 1.293939 41.589370 19.633154 10.963552 0.684828 0.689525 0.385878
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.061214 6.071174 0.907462 0.406126 1.715427 1.404501 0.566126 -0.790813 0.692814 0.708164 0.391898
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 5.859011 7.910770 0.133326 0.671216 0.866678 1.015566 -0.674167 -0.559027 0.698578 0.711395 0.389787
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.951040 -0.764441 -0.421158 0.304571 -0.233120 0.470623 0.969127 0.436303 0.689849 0.706037 0.378262
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.141225 -0.589335 -0.590931 0.567290 -0.244908 -0.275838 -0.094255 -0.829481 0.685286 0.701211 0.388757
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.082451 2.819858 -0.943079 0.694544 3.808976 0.548109 12.415922 -0.400497 0.681816 0.699140 0.395963
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.054355 0.061372 -0.242641 0.048391 2.180529 1.646701 1.244260 2.741766 0.680066 0.702349 0.405890
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.628268 0.124752 1.102302 0.700921 -0.655917 1.879820 -0.265708 0.777366 0.668812 0.692675 0.407025
129 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 228.505507 228.365307 inf inf 9.929009 8.400636 -3.601873 -3.946454 nan nan nan
130 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 228.529757 228.379522 inf inf 9.488683 8.123077 -3.971268 -4.179869 nan nan nan
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.587549 11.758994 3.645751 4.374693 8.763938 7.693837 1.774008 -0.765913 0.033933 0.038526 0.001958
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.716238 0.578487 0.083890 -1.201449 -0.043522 -1.247123 0.207566 -0.394215 0.615605 0.631407 0.411195
133 N11 not_connected 100.00% 100.00% 82.76% 0.00% 11.053847 15.705378 3.418910 2.996412 8.735853 6.350019 0.631267 -0.147112 0.041394 0.176419 0.098809
135 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -1.007373 10.577403 -0.119382 9.515869 0.538933 7.659280 0.123470 0.404998 0.620929 0.038278 0.491859
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 6.605703 0.311967 7.674965 4.946370 10.815098 26.020123 -0.206596 -0.454202 0.360455 0.605555 0.436168
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.066599 -0.805121 -0.522120 -0.665667 2.060127 -0.881624 0.526994 0.526149 0.638428 0.671221 0.413046
138 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.672382 -0.378091 -0.094343 0.667977 0.438194 0.161680 0.780846 -0.072828 0.660591 0.683635 0.409024
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.816683 -0.439587 1.227277 -1.143887 0.391249 -1.616808 -1.242933 0.054773 0.665674 0.677071 0.394562
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.705812 3.376862 -0.074222 2.573605 -0.890090 2.456184 2.141765 -1.448738 0.681071 0.693274 0.388674
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.374215 -0.551363 -0.905955 0.372906 1.484468 -2.317259 -0.023585 -1.386278 0.683714 0.705578 0.389156
142 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 1.009528 10.490091 -1.294467 9.455270 1.749570 7.740869 13.588801 0.736037 0.688069 0.046372 0.560667
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.612636 -0.445820 5.237288 -0.271100 -0.696932 2.243511 -0.471422 -0.672930 0.634708 0.710620 0.418249
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.454462 -0.602431 -0.584372 3.027317 -0.405561 -1.087022 -0.558640 -0.614877 0.691176 0.690018 0.391267
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.111139 2.027789 -0.287132 5.970478 -0.303406 13.554015 -0.314967 0.307350 0.685070 0.634300 0.414401
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 10.777480 1.496790 3.431589 0.746911 8.664141 -1.791458 -0.313343 -1.664522 0.037852 0.695882 0.567692
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.569077 -1.180514 0.915550 1.755525 0.585779 -0.206112 -0.413450 -0.709608 0.667763 0.688426 0.400410
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.634023 -0.171677 2.432286 1.311954 -0.318959 1.612654 -0.554826 -0.661323 0.651017 0.688820 0.416949
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.701733 1.035566 -1.262394 1.435384 -0.695889 -0.895094 -0.660332 -1.880677 0.661177 0.685300 0.420807
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.676600 -0.107852 1.138611 0.496865 0.480580 -2.311046 -1.536973 -1.550825 0.652859 0.679217 0.432846
155 N12 digital_ok 100.00% 100.00% 14.81% 0.00% 9.395121 0.466990 8.530738 -0.600961 8.878097 0.823878 0.239695 0.716261 0.036150 0.238763 0.000503
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.151321 10.198420 -0.064284 9.195488 18.849618 7.746785 0.650185 -0.171913 0.631794 0.057719 0.512295
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.048620 -0.004364 -0.022083 0.328189 -0.315912 0.654525 -0.547087 -0.610455 0.642844 0.667897 0.413460
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.067270 -0.139576 -0.850877 -0.920065 1.946472 1.592666 2.708585 8.774306 0.660644 0.681434 0.415173
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.151130 27.684910 -1.534108 -0.826827 -1.052072 2.731165 -0.303685 22.258414 0.636478 0.527681 0.366426
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.817614 -0.974128 -0.673468 -1.050309 -0.580898 1.893359 -0.162863 0.010762 0.674126 0.693096 0.397534
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.684469 26.773038 -0.540038 -0.763915 0.219542 -0.463217 -0.520344 0.264205 0.678937 0.574178 0.351999
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.706398 -0.027914 2.004144 0.966079 0.919555 -1.607822 -0.562710 -1.567623 0.686427 0.705209 0.385824
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.273522 0.951621 -0.598215 0.128004 -0.140822 1.184565 -0.345122 0.525026 0.692756 0.702867 0.394784
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.385532 0.342890 1.593214 -0.478087 10.621170 3.277545 0.285269 0.383696 0.676623 0.703983 0.392955
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 27.058837 0.073921 2.036265 0.240082 4.034051 0.507468 0.411089 -0.663778 0.518990 0.696856 0.392213
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.608444 0.248054 -0.166996 -0.433860 0.308022 4.751884 1.808715 -0.873664 0.682427 0.701738 0.400775
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.502270 -1.142985 -0.947322 3.460562 1.052144 -1.044600 -1.071970 1.636049 0.684483 0.676553 0.410431
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.597142 -0.867849 -0.344458 -0.675513 1.715051 1.393338 -0.368464 0.603942 0.669646 0.694781 0.417519
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.918079 1.426577 -1.269721 -1.519421 0.351786 -1.009740 -0.852205 -1.259011 0.664396 0.677106 0.416065
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.316796 -0.324870 8.981185 -1.165080 8.605969 6.306775 0.206035 1.714010 0.037486 0.682071 0.568830
179 N12 RF_maintenance 100.00% 100.00% 85.78% 0.00% 10.422541 10.940483 8.976625 9.797780 8.467473 7.185940 0.097879 0.194153 0.070575 0.157630 0.091553
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.203876 11.270062 0.128670 9.576232 0.616439 7.659508 12.345653 1.006398 0.664967 0.051616 0.558147
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.456914 0.060102 -0.581557 0.151818 0.793149 -0.142248 -0.524939 3.045828 0.679667 0.690420 0.399408
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.082874 3.861344 -1.269484 2.709914 -0.040172 2.688402 7.327608 -1.688111 0.688493 0.687144 0.397295
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.348191 1.635802 1.100846 4.895210 0.693083 -1.899317 0.528529 -0.056605 0.667267 0.640406 0.381609
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.290987 -0.536263 -0.385389 3.138050 0.340604 -0.333145 0.016438 -0.018934 0.676579 0.679229 0.390360
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 15.081930 -1.238237 7.507066 3.748245 9.434915 -1.155132 -0.254893 0.203867 0.339781 0.666527 0.435826
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.189088 3.125802 0.468248 2.436356 -1.045510 1.604686 -0.469485 -2.434437 0.686425 0.691444 0.408092
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 1.072807 2.903395 1.118187 2.125323 -0.509774 0.604038 -0.167773 0.407599 0.679107 0.691976 0.402677
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 7.669023 8.204115 2.392719 1.057056 3.512218 3.630650 0.652604 0.202499 0.343309 0.369966 0.181076
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.651355 3.542870 -1.078525 2.807840 -0.856325 2.820454 -0.745500 -2.705764 0.658399 0.669724 0.432955
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.480721 0.259799 0.706252 -0.676397 0.545351 1.134565 9.764360 -0.320099 0.637097 0.668217 0.438968
200 N18 RF_maintenance 100.00% 100.00% 42.16% 0.00% 11.215417 33.390531 3.591636 0.349730 8.897287 6.142904 0.705347 -0.939456 0.046452 0.221066 0.157388
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.797896 5.847469 4.325962 3.595295 7.038546 4.841080 -2.902050 -2.847094 0.631154 0.652264 0.393690
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 0.857652 1.810238 0.566447 -0.329683 -0.726157 -0.388409 0.121264 1.671381 0.664391 0.639260 0.399763
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.725113 12.471647 3.375224 3.964979 8.814607 7.760118 1.197853 1.503351 0.034084 0.042099 0.002228
205 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.101103 2.284195 0.435072 -1.301859 -0.842888 -0.789526 -0.627922 3.887027 0.653786 0.648273 0.396969
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.752160 0.660050 0.111726 -1.077498 16.777580 -2.141267 2.605159 2.427213 0.647158 0.654647 0.400628
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.572969 1.776734 1.113706 -0.441731 0.621413 7.441421 -0.370347 -0.869187 0.632932 0.647229 0.387943
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 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
219 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.802857 4.074135 4.419827 2.852674 7.276656 3.049184 -3.014923 -2.505708 0.622819 0.657120 0.414820
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.957742 -0.801333 -0.142883 -0.448618 -1.537947 -2.142119 1.964471 -1.012045 0.655292 0.659893 0.405189
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.680781 0.085789 -0.850066 -0.640332 -0.308442 -1.976125 0.955697 -0.776064 0.622079 0.664283 0.413597
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.040598 0.635849 0.485353 -0.536407 -0.881282 6.794003 3.717813 0.683030 0.653340 0.664304 0.406819
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.772563 1.000864 -1.506771 -1.075582 -0.830508 2.072432 0.186147 0.661672 0.633398 0.656506 0.401295
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.869720 6.363263 4.493072 4.050824 7.072013 5.881158 -3.001947 -3.198520 0.623805 0.637395 0.404463
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
227 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
228 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
229 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
237 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 5.165878 1.577097 1.117079 -1.310865 1.872630 -1.064217 1.742641 -0.820947 0.534559 0.639636 0.445323
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.353949 -0.706673 0.947529 0.458451 -0.419216 -1.324649 -0.796733 -1.079272 0.651392 0.657958 0.417916
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.291121 2.515819 -0.300935 1.137519 1.788457 3.373282 -0.514681 1.627508 0.645307 0.588972 0.429181
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% 231.887672 232.084657 inf inf 4548.410628 4534.647989 4549.804130 4510.560538 nan nan nan
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 212.280594 212.502925 inf inf 4467.555510 4484.124029 4329.846280 4362.153161 nan nan nan
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
244 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 230.195573 230.190272 inf inf 6042.329721 6040.560747 6951.040715 6946.774637 nan nan nan
245 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 226.855297 226.813889 inf inf 5061.256840 5100.697626 4015.576522 4114.079899 nan nan nan
246 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 233.076582 233.148407 inf inf 5583.979347 5470.005566 3723.390541 3741.879609 nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 240.696541 240.712407 inf inf 6034.351048 6033.107868 4542.888441 4516.729973 nan nan nan
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.224224 11.608466 -0.624172 6.143450 0.291072 7.804611 6.152941 1.783910 0.644949 0.048092 0.550109
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.100390 2.207324 0.930626 1.148488 1.029325 -0.397745 2.065700 0.213520 0.531536 0.547047 0.406051
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.800924 -1.028006 1.015871 -1.429001 0.969009 -0.607671 0.131533 0.233857 0.564643 0.563193 0.418877
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.652720 -0.747683 -1.516221 -1.002312 -0.161908 -1.055633 3.687618 -0.029161 0.500320 0.551893 0.411977
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.535474 0.708911 -1.068741 -1.516638 -1.306326 -0.697519 0.699445 0.434385 0.496108 0.543608 0.406446
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, 15, 18, 27, 28, 29, 30, 32, 34, 35, 36, 37, 42, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 63, 64, 68, 71, 72, 73, 78, 80, 81, 84, 86, 87, 88, 92, 94, 96, 97, 101, 103, 104, 108, 109, 110, 111, 113, 114, 117, 119, 121, 122, 123, 126, 129, 130, 131, 133, 135, 136, 142, 143, 145, 146, 155, 156, 158, 159, 161, 164, 165, 166, 170, 179, 180, 182, 183, 185, 189, 191, 200, 201, 203, 206, 207, 208, 209, 210, 211, 219, 222, 224, 225, 226, 227, 228, 229, 237, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320]

unflagged_ants: [5, 8, 10, 16, 17, 19, 20, 21, 22, 31, 38, 40, 41, 43, 44, 45, 46, 53, 62, 65, 66, 67, 69, 70, 74, 77, 79, 82, 83, 85, 89, 90, 91, 93, 95, 98, 99, 100, 102, 105, 106, 107, 112, 115, 116, 118, 120, 124, 125, 127, 128, 132, 137, 138, 139, 140, 141, 144, 147, 148, 149, 150, 157, 160, 162, 163, 167, 168, 169, 181, 184, 186, 187, 190, 202, 205, 220, 221, 223, 238, 239, 324, 325, 329, 333]

golden_ants: [5, 10, 16, 17, 19, 20, 21, 31, 38, 40, 41, 44, 45, 53, 65, 66, 67, 69, 70, 83, 85, 91, 93, 98, 99, 100, 105, 106, 107, 112, 116, 118, 124, 127, 128, 140, 141, 144, 147, 148, 149, 150, 157, 160, 162, 163, 167, 168, 169, 181, 184, 186, 187, 190, 202]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2459910.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.dev11+g87299d5
3.1.5.dev171+gc8e6162
In [ ]: