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 = "2459922"
data_path = "/mnt/sn1/2459922"
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: 12-8-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/2459922/zen.2459922.21290.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

# get a list of all ant_metrics files
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{ant_metrics_ext}')
ant_metrics_files = sorted(glob.glob(glob_str))

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1851 ant_metrics files matching glob /mnt/sn1/2459922/zen.2459922.?????.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/2459922/zen.2459922.?????.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 2459922
Date 12-8-2022
LST Range 23.699 -- 9.661 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 7
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 96
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 N14
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 77 / 201 (38.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 133 / 201 (66.2%)
Redcal Done? ❌
Never Flagged Antennas 68 / 201 (33.8%)
A Priori Good Antennas Flagged 53 / 96 total a priori good antennas:
3, 7, 9, 15, 16, 17, 29, 30, 37, 38, 42, 51,
54, 55, 56, 68, 71, 72, 81, 86, 88, 94, 100,
101, 103, 106, 109, 111, 121, 122, 123, 128,
136, 140, 143, 144, 146, 158, 161, 163, 164,
165, 169, 170, 181, 182, 183, 184, 185, 186,
187, 189, 191
A Priori Bad Antennas Not Flagged 25 / 105 total a priori bad antennas:
22, 35, 43, 46, 48, 61, 62, 73, 79, 82, 89,
90, 95, 115, 120, 125, 137, 139, 179, 221,
238, 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_2459922.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% 10.083003 -0.381780 7.422043 0.283515 9.877546 0.230999 0.658422 4.311294 0.033262 0.666037 0.561600
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.536727 0.253660 5.681407 3.938721 33.910376 21.092632 40.047615 35.984241 0.498339 0.625136 0.435665
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.252636 0.073559 -0.295991 -0.129675 -0.351720 1.806150 0.987356 -0.310574 0.655271 0.667403 0.409540
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.393640 -1.384922 0.527375 2.492602 -0.232350 -0.322410 13.376896 7.645755 0.651518 0.654963 0.403000
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.333946 -1.734566 -0.962092 -0.272534 0.012618 0.669281 4.443452 0.863201 0.656953 0.667512 0.401302
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.181503 -0.910941 6.107347 -0.008540 4.883932 0.411837 -0.106983 -0.654288 0.480186 0.664917 0.477531
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.900762 -0.554550 -1.315818 -0.765675 -0.649862 2.063061 -0.537604 1.291070 0.644094 0.660532 0.410216
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.324908 -0.173361 6.931032 0.765844 9.881443 2.771418 0.161721 3.744956 0.034082 0.668975 0.554776
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.318190 -1.453749 7.393656 0.364388 9.874504 1.767380 0.632241 2.008559 0.032833 0.674116 0.552767
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.347645 0.711021 -0.154095 -0.062072 1.805969 0.860104 5.858706 3.109329 0.661347 0.676868 0.405392
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.974515 9.882417 7.376121 -0.168606 10.018520 5.091557 0.575330 24.179374 0.029305 0.478310 0.388705
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.121028 -1.258694 -0.809304 3.071465 0.334292 0.213440 0.019463 2.223703 0.659739 0.653399 0.398989
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.779580 -1.030630 2.727324 -0.801284 0.042624 -0.029340 0.769818 -0.952044 0.642050 0.683782 0.415398
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.071759 0.023375 -0.375064 3.489559 0.509819 1.084504 -0.176046 -0.281113 0.647144 0.628365 0.404618
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.739933 -0.519843 0.477875 0.162166 0.729349 -0.455083 -0.506771 -1.064816 0.619970 0.640313 0.402619
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.653042 11.119629 7.423246 7.950738 9.995943 10.034377 1.835711 1.509425 0.036232 0.039601 0.004683
28 N01 RF_maintenance 100.00% 0.00% 85.95% 0.00% 12.581364 26.039251 -1.168427 0.442021 4.662227 10.088220 5.538152 19.224688 0.354797 0.157371 0.264150
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.362632 11.611025 7.087795 7.619580 9.984493 10.018047 0.537791 0.267633 0.029687 0.035058 0.005583
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.514353 -0.575562 0.493762 0.184604 1.929019 1.083964 10.426002 0.308655 0.655479 0.682501 0.397311
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.384991 -1.605461 0.584727 0.585638 1.870267 1.009375 1.110949 1.781122 0.674931 0.684075 0.398204
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.038479 25.802459 -0.571083 1.888065 -0.139025 2.090827 0.046625 16.977988 0.645162 0.570861 0.365925
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.860225 -0.517347 2.855003 0.503954 9.951851 -0.382966 0.769325 0.180410 0.043026 0.660577 0.512629
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.190289 0.183697 0.710490 -1.438123 1.228540 -1.183780 0.817192 -0.247600 0.628086 0.628031 0.397130
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.366746 8.025865 -0.209858 0.087342 0.814408 2.142161 1.006983 2.003970 0.656258 0.670706 0.401694
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.746827 0.331330 -1.132022 0.408142 1.076172 1.829738 -0.712892 4.194164 0.667608 0.680611 0.411792
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.140859 0.100165 -0.386382 0.129999 0.468117 1.144978 4.473572 1.029326 0.669609 0.685341 0.413398
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.055415 0.212336 -0.473054 0.149752 -0.464404 -0.379615 -0.649741 -0.569443 0.664025 0.676317 0.402215
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.130859 0.057771 -0.575380 -0.277286 2.373671 -0.180787 -0.667230 0.589272 0.668355 0.680642 0.393981
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.899152 12.103094 7.645856 8.367809 9.755939 9.863058 0.350231 1.010831 0.031065 0.029372 0.002184
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.008606 0.250225 0.110805 0.233974 -0.632825 0.466226 -1.124195 -0.014765 0.681824 0.686879 0.401425
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.359666 -0.117824 -0.835354 -0.214598 -0.453077 0.773176 -0.923211 -0.647359 0.678314 0.696979 0.397909
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.382275 1.748384 -0.317962 0.248587 -0.223688 3.851645 -0.187975 3.450073 0.667474 0.673955 0.389499
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.442061 1.933713 0.704541 1.626335 0.034473 0.174944 -0.549295 -1.684144 0.658723 0.694315 0.414744
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.178564 0.776754 2.710623 -0.930176 9.917959 0.379519 0.816759 1.418608 0.039340 0.647667 0.496449
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.083094 0.490676 0.561975 1.452880 -0.757198 1.112338 -0.504986 -1.717460 0.632664 0.663222 0.404964
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.152478 0.166804 -1.397053 -0.747994 0.700118 -0.760049 0.854429 8.469750 0.579416 0.625652 0.395636
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.666815 5.464467 -0.301776 0.495434 1.762541 3.487371 25.204101 67.760858 0.645148 0.654058 0.384094
51 N03 digital_ok 100.00% 100.00% 0.00% 0.00% 23.172594 0.629301 9.648299 0.217564 10.105285 4.117460 6.858272 5.146318 0.038085 0.684367 0.551871
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.527434 6.841375 -0.768522 0.151167 0.795791 0.991049 1.615830 0.849297 0.672051 0.690035 0.402579
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.656714 2.853929 -0.344758 -0.003548 1.823212 1.913371 1.823838 3.270900 0.677191 0.694419 0.404893
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.071223 11.789872 7.437871 8.144788 9.928198 9.977917 1.432242 0.699142 0.030880 0.029442 0.001363
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.571406 12.455315 7.446050 8.058681 9.948530 9.994218 0.614733 1.911520 0.028068 0.030999 0.002735
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.822005 12.594662 -0.136141 8.249018 -0.247669 9.927174 0.628073 0.752552 0.672160 0.038226 0.553762
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 27.359110 -0.741832 5.056779 0.687217 5.238361 0.669411 4.514538 0.707342 0.454668 0.693021 0.423982
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.731396 11.525518 7.342074 8.052659 9.877309 9.963670 0.985906 0.760534 0.035900 0.035940 0.001769
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.802322 0.495898 7.403260 1.160694 9.752986 3.013936 0.373692 2.060323 0.046866 0.684718 0.542033
60 N05 RF_maintenance 100.00% 0.00% 99.95% 0.00% 0.578659 11.401323 -0.718360 8.076691 -0.821925 9.971095 0.534646 1.919769 0.666786 0.068320 0.529756
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 3.020670 0.739553 -1.097962 -0.784745 0.868337 -1.703307 -0.770569 0.272648 0.609692 0.640979 0.386812
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.769906 0.381272 -1.058001 0.883152 -0.040432 -0.626242 1.632630 -0.409330 0.597494 0.663810 0.408607
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.186688 11.862115 -0.112333 3.308890 0.270939 10.061205 -0.026397 2.196988 0.624719 0.043954 0.481941
64 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.060961 0.876757 -0.686455 -0.707818 4.035745 -0.959053 4.449646 -0.267943 0.607087 0.607915 0.386487
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.289698 0.594543 -0.202759 0.550884 0.934249 1.224077 0.591677 0.472531 0.651660 0.678722 0.411450
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.164659 1.607140 1.784990 1.360742 3.168582 0.369372 -0.062566 0.532816 0.655195 0.683049 0.406249
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.787638 -0.862289 0.749187 0.853334 -0.817792 1.126765 0.461487 1.743958 0.662640 0.685876 0.399032
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 0.635217 26.178156 0.067991 10.786893 0.163619 9.945260 1.458503 7.071393 0.675585 0.031375 0.540673
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.179998 -0.659651 -0.300125 0.375170 -0.133961 1.899404 -0.527929 -0.435662 0.673438 0.693388 0.392658
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.486543 0.003149 -0.593357 -0.176580 1.634936 1.680604 0.705937 1.730632 0.679525 0.697057 0.392670
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 6.575596 -0.479053 0.037234 0.499505 0.998607 -0.061938 2.722377 0.279424 0.684019 0.699667 0.389567
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 1.849266 12.663004 0.103056 8.385189 0.171131 9.880263 6.051609 0.751440 0.673884 0.035315 0.547784
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.127210 1.003915 -0.830290 0.726113 0.255763 1.233297 -0.675564 -0.453185 0.687220 0.695090 0.394561
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.503096 8.676898 0.037265 -0.790680 0.383281 6.999424 -0.348222 6.159430 0.682222 0.683706 0.379537
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.735125 0.563814 0.429167 -1.370573 -1.068054 -0.615066 6.609822 -0.620273 0.648964 0.631733 0.395489
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 33.534650 -0.357463 -0.636753 0.899179 3.380875 -0.584453 0.279538 -0.280991 0.430056 0.666613 0.403054
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.506260 -0.703597 -1.106105 -0.186374 -0.665540 -1.680363 1.721507 -0.993156 0.609449 0.652906 0.407922
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 3.277006 13.052964 2.627885 3.229936 3.571797 9.944873 4.885496 0.878213 0.610809 0.043373 0.491922
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.713640 12.289964 -0.460169 6.930837 -0.883439 9.832242 -0.080419 1.369987 0.627513 0.036613 0.476668
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.229568 -0.562922 -0.181351 1.482955 -0.351656 -0.519401 -0.199801 1.546196 0.644981 0.658118 0.395815
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.787265 -0.430254 -0.346903 -0.023310 0.107270 -0.712591 -0.496856 0.349574 0.655434 0.678794 0.397208
84 N08 RF_maintenance 100.00% 54.84% 100.00% 0.00% 20.493917 23.058960 9.803076 10.419730 8.421399 9.912206 3.228291 4.461835 0.215518 0.036566 0.143340
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.050219 0.387402 0.889900 0.839303 -0.168693 -0.704881 -0.079172 -0.549213 0.665651 0.686993 0.393254
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.398593 -0.651214 0.593017 1.009947 4.661442 -0.487388 2.563382 18.477191 0.663089 0.683058 0.382138
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.682352 6.994724 -0.971237 -0.357397 0.378226 2.270768 0.037094 1.234380 0.686389 0.706405 0.388871
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.489342 0.204282 -0.114810 0.283583 -0.234626 0.240248 6.929218 1.471524 0.667177 0.692146 0.381970
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.172886 0.179694 -0.470533 0.363802 0.027408 -0.563061 -0.673417 -0.363941 0.676911 0.692534 0.386258
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.385166 -0.770090 0.512894 0.697232 -1.558120 -0.529811 -0.037120 2.857900 0.662742 0.685944 0.391695
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.872495 -0.343289 -0.180195 -0.095508 -0.907721 -0.965394 1.159608 0.118143 0.660531 0.686701 0.399980
92 N10 RF_maintenance 100.00% 0.00% 19.50% 0.00% 37.932449 44.638181 0.083597 0.692942 6.009317 7.977085 0.727428 7.205105 0.283422 0.237710 0.093221
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.015758 0.268183 1.200291 0.089351 0.961486 0.415001 2.523754 -0.659412 0.655656 0.682945 0.404299
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.096223 11.888516 7.556357 7.964931 9.908885 9.966562 0.733547 0.549755 0.031408 0.026371 0.002865
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.010801 -0.748011 -0.922505 0.635627 -0.231849 -1.102100 1.060945 1.365702 0.615944 0.664464 0.411324
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.368064 12.644630 2.728902 3.394627 9.794152 9.880190 0.717178 0.537439 0.034072 0.038578 0.002932
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.309025 2.778964 -0.232270 -0.510252 1.754250 1.839583 3.317611 8.931618 0.555048 0.606009 0.402979
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.080029 0.107241 -0.420270 -0.154945 -0.494017 0.786695 2.706773 2.823013 0.627413 0.654602 0.399091
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.110096 -0.821618 0.380260 -0.172054 -1.124056 1.590615 2.921452 -0.329032 0.630224 0.669490 0.408372
100 N07 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.240105 7.688140 -0.825708 0.689351 -0.176502 1.527939 0.554740 0.264585 0.675960 0.688195 0.394253
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.135542 1.276284 -1.159637 2.189677 1.131677 -0.388947 0.734359 8.721456 0.680381 0.678261 0.384110
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.060927 5.128266 3.721164 -0.404570 12.648000 1.893684 7.210921 7.459297 0.641111 0.696485 0.395626
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.285781 61.091326 4.984790 5.476615 2.902294 -0.544765 -0.354482 0.138736 0.622239 0.669528 0.390811
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.003149 -0.615259 -0.221125 0.374791 0.151749 -0.466757 -0.597961 -0.462098 0.676097 0.690847 0.377799
106 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.141101 -0.879856 0.456577 0.452833 5.135416 0.058995 -0.350460 -0.295314 0.664942 0.684973 0.379674
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.580025 -0.020533 -1.167511 -0.960523 -0.608873 -0.700598 3.574566 1.870442 0.672028 0.693262 0.391063
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.214835 10.998780 7.382404 -0.592731 9.962434 7.130567 1.283756 3.138839 0.038400 0.372007 0.235187
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.005909 11.465281 7.405523 7.852502 9.999928 10.015113 0.345222 1.403135 0.029676 0.034130 0.001989
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.458992 24.698803 -0.340244 10.575805 1.395259 9.790465 1.763737 3.217606 0.678086 0.032331 0.482392
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.072651 11.358097 -0.118354 7.934281 -0.252422 10.030457 -0.420780 1.600133 0.663500 0.035067 0.475523
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.804489 1.469659 -0.293399 -0.070456 0.968674 2.100512 0.151739 -0.752782 0.652611 0.667105 0.405176
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.137070 12.702627 2.544093 3.300163 9.828767 9.910434 1.175755 0.398962 0.035488 0.030868 0.002834
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 22.605002 15.212691 14.503657 10.614204 23.366712 14.962633 349.380742 167.799942 0.017893 0.023120 0.003452
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.544522 1.384532 1.402153 1.837238 0.281425 1.420935 -1.320741 -1.118478 0.608772 0.641520 0.428220
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.251970 -0.161243 -0.656118 0.318815 0.446924 -0.201895 0.734280 0.727612 0.623738 0.651983 0.399759
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.025055 12.937794 7.488469 8.355240 9.847877 10.023936 0.919651 2.839089 0.027249 0.031846 0.002794
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.689331 0.972282 -0.635479 0.217435 -0.530096 -0.027408 -0.126696 1.205291 0.651021 0.677659 0.401124
119 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 219.754336 219.869696 inf inf 4235.233293 3936.604667 4667.771725 4621.607768 nan nan nan
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.729574 2.449920 1.750864 1.803856 -0.610928 0.900528 3.189988 -1.300944 0.660229 0.690193 0.384316
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.102869 4.508775 -1.428945 0.104924 3.049220 6.255711 17.920581 14.648398 0.684821 0.698799 0.385614
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.341721 6.425425 0.655967 0.489616 9.803409 1.075256 -0.059815 -0.631000 0.684525 0.697512 0.387807
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.054049 9.072921 0.116943 0.523543 0.370798 0.565530 -0.485981 -0.312640 0.687289 0.702142 0.390872
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -1.130230 -0.460893 -0.535771 0.277298 -0.763827 0.035469 0.695120 0.603105 0.679922 0.695937 0.389262
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.102663 -0.269187 -1.020348 0.300755 -0.351450 -0.288608 -0.069470 -0.460959 0.671206 0.685033 0.390914
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.698903 6.351872 -1.454199 1.237811 3.900543 1.054252 12.783066 3.741634 0.671852 0.681664 0.400942
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.145774 0.100845 -0.096647 0.090378 1.593462 1.209203 -0.258329 0.157968 0.671050 0.694933 0.410368
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.862017 11.043469 7.484136 8.053206 9.883364 9.931395 0.216906 0.514788 0.030868 0.026227 0.002676
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.561278 -1.863202 -0.421312 0.003548 -0.431252 0.067328 0.046879 1.536662 0.664544 0.683510 0.409092
130 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.086778 0.509149 -0.411194 0.087603 -0.721689 0.534639 0.035865 1.296353 0.646355 0.673198 0.401380
131 N11 not_connected 100.00% 0.00% 89.84% 0.00% 3.541873 12.627908 2.973331 3.431428 3.632819 9.750467 -2.029062 -0.178732 0.637867 0.131844 0.483419
132 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.287651 1.756704 -0.828425 -1.374683 18.111280 -1.073357 2.059193 -0.106667 0.594858 0.626337 0.407456
133 N11 not_connected 100.00% 100.00% 0.00% 0.00% 11.675169 -0.066216 2.533414 -1.442317 9.940806 -1.717108 1.208905 -0.785048 0.056241 0.621856 0.502268
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.909639 -0.694437 0.184347 -1.442275 5.652144 0.602447 10.895522 0.240979 0.622341 0.660322 0.418161
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 2.190565 -0.063060 2.415712 0.561099 24.714542 13.165668 0.731370 0.201202 0.593918 0.654954 0.404675
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.159415 -0.796239 -0.303430 -1.267668 2.449919 -0.841227 0.823517 0.063615 0.631032 0.666828 0.407374
138 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 263.418417 263.297581 inf inf 6351.544580 6351.578270 8081.151008 8082.594903 nan nan nan
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.536530 -0.272545 1.421871 -0.854364 0.470238 -1.800684 -1.343350 -0.827369 0.660329 0.666833 0.388507
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.779050 -0.411854 -1.377841 -0.244739 -0.467123 -0.542296 4.945478 3.111789 0.673883 0.697866 0.387813
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.664512 -0.974754 -0.692863 0.517045 2.510777 -1.697951 0.613503 -0.800513 0.674802 0.696202 0.385548
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.647788 11.323963 -0.946160 8.079392 4.671671 10.007268 26.437573 1.288023 0.676484 0.044784 0.567285
143 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 10.322913 11.910931 7.553367 8.086303 9.745796 9.858421 0.168745 0.829616 0.025378 0.025223 0.001104
144 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 9.776721 10.317051 7.376950 7.942916 9.981067 10.015549 0.893296 1.087821 0.026793 0.025368 0.001532
145 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.297094 11.916352 7.446414 8.116467 9.910287 10.047310 0.513567 2.645324 0.025574 0.024912 0.001150
146 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 11.391322 12.056324 2.544101 3.124013 9.899384 9.966662 0.319566 0.117199 0.029612 0.029405 0.001130
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.598331 -1.592979 0.433635 1.606519 -0.344495 -0.626202 -0.143606 0.910388 0.662569 0.677349 0.398718
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.986899 -0.425090 2.205189 1.242218 0.450102 0.501015 -0.433112 -0.502030 0.644295 0.681800 0.410546
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.869336 0.716479 -0.999441 1.423704 -0.382626 -0.321317 -0.301814 -1.123135 0.663197 0.683056 0.411507
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.118627 -0.017321 1.391141 0.557846 -0.248319 -1.546524 -1.217608 -0.108305 0.655433 0.675832 0.422334
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.907019 -0.587276 7.144490 -1.108555 9.987770 1.268352 0.502209 1.948050 0.035969 0.660912 0.507698
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.309115 11.101015 2.760641 7.836751 -1.181250 10.005062 0.857446 0.447895 0.596768 0.038860 0.478572
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.020774 -0.388316 -0.522486 0.326369 -0.805848 0.785965 -0.158407 0.473491 0.640392 0.662641 0.405429
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.782172 0.376472 -0.583549 -0.629608 1.949334 1.945934 2.970176 19.811050 0.655145 0.675777 0.405704
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.174414 17.177710 -1.125502 -1.053828 -0.719445 9.796419 -0.443794 68.404830 0.627230 0.586876 0.371778
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.492391 -1.169655 -0.746868 -0.779741 -0.432375 2.006966 0.787388 0.485387 0.669930 0.685155 0.389573
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.113578 27.783717 -0.523034 -0.748974 0.208046 1.404724 -0.214187 1.746023 0.671595 0.552465 0.346359
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.926952 -0.407011 1.972947 0.959432 0.593085 -1.215870 0.112733 -0.524884 0.678781 0.693362 0.387692
163 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 9.792233 10.752438 7.297499 7.940048 10.049010 10.056476 0.490872 0.843631 0.027491 0.025476 0.001798
164 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 10.508494 11.729461 7.365815 8.125883 9.869513 9.975885 0.554874 1.282555 0.025730 0.025231 0.001201
165 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 10.626014 10.830615 7.022586 7.672724 10.022023 10.002758 0.163914 0.602489 0.026705 0.025713 0.001382
166 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.138859 10.439599 7.194634 7.705596 10.079680 10.050012 0.299209 0.921221 0.025848 0.025605 0.001090
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.213390 -1.571151 -0.855324 2.831718 1.938743 0.166925 -0.695006 2.644861 0.678108 0.663266 0.410840
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.050911 -1.063030 -0.228781 -0.567596 1.637757 0.872476 -0.397780 0.671048 0.666276 0.686310 0.408504
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.574577 3.945418 -1.189734 -1.319581 0.583079 1.836748 -0.569034 7.327307 0.666747 0.665614 0.406805
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.844957 -0.614331 7.593297 -0.991578 9.800555 2.554111 0.666119 0.372049 0.037400 0.677163 0.556380
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.060597 -0.254824 1.115257 1.857948 0.705534 2.775589 0.220523 -0.148835 0.639548 0.658614 0.400071
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.322175 12.197264 -0.552622 8.197978 2.077427 9.963723 17.555702 1.814907 0.664139 0.052199 0.564141
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.503750 -0.288436 -0.592404 -0.049973 0.304771 0.037072 -0.274803 3.980671 0.673969 0.682979 0.393943
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.004647 4.135316 -0.355821 2.793449 -0.369219 3.884039 14.806717 0.036926 0.679333 0.676699 0.398185
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.519837 1.940130 0.591866 3.694639 0.373582 -0.503069 0.927713 -0.182320 0.655550 0.624523 0.386172
184 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 10.341900 11.732011 7.495027 8.077534 9.999484 10.049832 0.766562 0.951327 0.025379 0.024982 0.001060
185 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 10.008521 11.120149 7.197833 7.827492 10.079573 10.038006 0.625274 0.900888 0.027045 0.025532 0.001641
186 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 9.667019 11.977398 7.464065 8.007336 9.965873 10.002255 1.258833 0.765001 0.027466 0.025733 0.001649
187 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 10.260283 10.874340 6.795505 7.519667 10.024809 10.022681 0.601045 0.287255 0.026393 0.025837 0.001129
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 9.090509 9.295296 0.346435 -0.510571 2.838102 7.951068 1.932322 2.221786 0.348927 0.368221 0.176048
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.469116 -1.351267 -1.034033 0.285017 -0.337300 -0.292409 -0.579344 -1.340077 0.654594 0.675373 0.424568
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.598263 0.638127 0.558303 -0.575080 -0.396847 1.530774 11.144459 5.545173 0.633406 0.661275 0.427306
200 N18 RF_maintenance 100.00% 100.00% 47.06% 0.00% 11.907818 37.225542 2.664937 0.485343 10.046421 8.663060 1.415805 0.823015 0.046972 0.214674 0.150990
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.593569 6.402345 4.437413 3.677281 7.802303 6.829879 -2.405844 -1.848545 0.624140 0.642221 0.392643
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 0.739025 2.487106 0.723760 -0.219608 -0.683442 -0.645543 1.645604 1.554000 0.651279 0.616482 0.399216
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.230177 2.557388 0.189849 -0.581031 -1.131624 -0.046995 0.074895 4.875743 0.640083 0.627820 0.400307
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.190133 1.143004 1.780190 -0.741964 13.592901 -1.306070 -1.110238 3.952913 0.645192 0.637549 0.401421
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.681136 3.525852 1.280171 -1.332138 0.992071 5.591774 0.069301 -0.094243 0.626483 0.613870 0.385863
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 250.054890 249.923843 inf inf 5021.694195 4984.222120 5701.808601 5569.109251 nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 237.220260 237.123134 inf inf 4809.832921 4762.276363 5343.045173 5217.598166 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% 239.882265 240.145324 inf inf 4715.192446 4738.914464 4869.097572 4951.686593 nan nan nan
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 256.588780 256.881221 inf inf 4748.555665 4716.791902 5091.849605 5019.142759 nan nan nan
220 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.668634 -0.584556 0.085318 -0.170700 -1.054403 0.290282 4.712699 -0.193175 0.638872 0.646719 0.397339
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.449663 0.216475 -0.781947 -0.359453 -0.323299 -1.168177 1.361860 0.004724 0.598341 0.653142 0.420350
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.057525 1.267377 0.565069 -1.267623 -0.237897 43.879999 3.901184 -0.061960 0.638724 0.631131 0.409461
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.828817 1.650557 -1.064512 -0.365288 -0.317714 13.520533 0.233692 18.058705 0.622319 0.610343 0.393531
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.719423 7.052352 4.561001 4.101916 7.838784 7.842701 -2.539946 -2.490504 0.620031 0.631745 0.398088
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 265.545785 265.728994 inf inf 3944.244591 4041.692571 6144.327947 6232.014456 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% 6.402442 2.038950 0.907787 -1.127315 4.076782 -0.906158 1.086840 -0.703899 0.498316 0.626866 0.449286
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.555637 -0.244573 1.436641 0.789890 0.400729 -0.225932 -1.236161 0.827575 0.639298 0.643645 0.414341
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.127727 -0.400701 0.253166 0.194626 5.050904 0.558428 0.581192 5.863247 0.631521 0.645441 0.409047
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% 233.170306 233.653646 inf inf 4831.543584 4754.086383 4662.317822 4387.315833 nan nan nan
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.830979 3.879318 -0.595357 0.075002 -0.501038 -0.380898 7.285694 15.208597 0.621329 0.597513 0.404345
242 N19 RF_ok 100.00% 0.27% 0.00% 0.00% 56.921594 1.208580 0.176125 1.080932 10.522354 -0.331999 9.808762 -0.314666 0.324609 0.649819 0.511417
243 N19 RF_ok 100.00% 18.48% 0.00% 0.00% 60.243061 2.490456 0.703310 -1.343740 10.046618 -0.574601 4.154401 -0.019229 0.268059 0.621662 0.512760
244 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 208.609531 208.553338 inf inf 4777.567044 4776.436201 4701.402585 4715.368482 nan nan nan
245 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 237.236571 237.180070 inf inf 5053.358451 5156.283969 4625.829665 4731.042422 nan nan nan
246 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 237.526598 237.202382 inf inf 5063.194367 5139.088748 5768.662551 5905.608786 nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.312736 12.183842 -0.665845 5.062479 -0.356869 10.028848 12.137604 2.252209 0.638281 0.048061 0.536757
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.182584 2.338896 1.104427 1.279321 1.028080 0.217647 0.913248 -0.984162 0.523177 0.543499 0.396569
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.370774 -1.225176 1.206579 -1.091303 1.128661 0.237232 -1.132460 0.443474 0.553815 0.552264 0.407771
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.222968 -0.882615 -0.984349 -0.793484 -1.073016 -0.876329 3.454876 -0.004724 0.488099 0.557295 0.409087
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.483638 1.323119 -1.076760 -1.325042 -1.063401 -0.426013 0.790238 1.050712 0.478368 0.535896 0.399848
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, 8, 9, 15, 16, 17, 18, 27, 28, 29, 30, 32, 34, 36, 37, 38, 42, 47, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 63, 64, 68, 71, 72, 74, 77, 78, 80, 81, 84, 86, 87, 88, 92, 94, 96, 97, 100, 101, 102, 103, 104, 106, 108, 109, 110, 111, 113, 114, 117, 119, 121, 122, 123, 126, 128, 131, 132, 133, 135, 136, 138, 140, 142, 143, 144, 145, 146, 155, 156, 158, 159, 161, 163, 164, 165, 166, 169, 170, 180, 181, 182, 183, 184, 185, 186, 187, 189, 191, 200, 201, 203, 205, 206, 207, 208, 209, 210, 211, 219, 220, 222, 223, 224, 225, 226, 227, 228, 229, 237, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320]

unflagged_ants: [5, 10, 19, 20, 21, 22, 31, 35, 40, 41, 43, 44, 45, 46, 48, 53, 61, 62, 65, 66, 67, 69, 70, 73, 79, 82, 83, 85, 89, 90, 91, 93, 95, 98, 99, 105, 107, 112, 115, 116, 118, 120, 124, 125, 127, 129, 130, 137, 139, 141, 147, 148, 149, 150, 157, 160, 162, 167, 168, 179, 190, 202, 221, 238, 324, 325, 329, 333]

golden_ants: [5, 10, 19, 20, 21, 31, 40, 41, 44, 45, 53, 65, 66, 67, 69, 70, 83, 85, 91, 93, 98, 99, 105, 107, 112, 116, 118, 124, 127, 129, 130, 141, 147, 148, 149, 150, 157, 160, 162, 167, 168, 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_2459922.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 [ ]: