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 = "2459975"
data_path = "/mnt/sn1/2459975"
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: 1-30-2023
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

# find the auto_metrics file
glob_str = os.path.join(data_path, f'zen.{JD}*.auto_metrics.h5')
auto_metrics_file = sorted(glob.glob(glob_str))

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2459975/zen.2459975.21328.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 1849 ant_metrics files matching glob /mnt/sn1/2459975/zen.2459975.?????.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/2459975/zen.2459975.?????.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 2459975
Date 1-30-2023
LST Range 3.191 -- 13.142 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1849
Total Number of Antennas 196
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 196 (0.0%)
Antennas in Commanded State (observed) 0 / 196 (0.0%)
Cross-Polarized Antennas 96
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 54 / 196 (27.6%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 110 / 196 (56.1%)
Redcal Done? ❌
Never Flagged Antennas 86 / 196 (43.9%)
A Priori Good Antennas Flagged 44 / 93 total a priori good antennas:
3, 7, 9, 10, 15, 16, 29, 40, 42, 54, 55, 56,
71, 72, 81, 86, 94, 101, 103, 107, 109, 111,
121, 122, 123, 127, 128, 136, 140, 143, 144,
151, 158, 161, 165, 170, 173, 182, 185, 189,
191, 192, 193, 202
A Priori Bad Antennas Not Flagged 37 / 103 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 61, 62, 64, 73, 74,
82, 89, 90, 95, 115, 125, 132, 133, 137, 139,
207, 211, 220, 221, 222, 223, 237, 238, 239,
240, 241, 245, 261, 324, 325, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459975.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.539155 13.719114 10.094476 -0.901960 10.461318 4.324973 0.047874 5.245962 0.031619 0.335213 0.270182
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.836345 1.526621 2.264505 -0.175373 3.257144 4.346286 14.498106 4.886411 0.593411 0.620329 0.403021
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.560023 -0.145767 0.321206 0.034100 -0.085138 1.986301 3.291358 -0.144519 0.609746 0.624118 0.395984
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.970583 0.333544 -1.225160 -0.226896 -0.083527 0.637321 10.568063 11.725336 0.616658 0.632844 0.390452
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.071601 -1.270263 -0.637176 -0.092419 -0.176940 0.599173 2.671649 0.959282 0.615708 0.629289 0.385976
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.741336 -0.223411 8.394824 -0.531117 6.284931 -0.123309 -0.185909 -0.554053 0.440326 0.625943 0.458123
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 3.063891 -0.766742 6.793408 -1.601895 2.522953 1.392047 0.667551 -0.236292 0.513800 0.627228 0.432925
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.768672 13.225258 9.485215 10.096220 10.466028 12.073311 -0.399289 -0.213969 0.027233 0.026104 0.001499
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.795963 -0.867018 10.059923 0.660918 10.463387 1.971611 0.033355 3.001024 0.030530 0.630633 0.513918
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.899991 1.682259 0.379798 0.309523 0.464028 0.526756 1.877771 0.965198 0.619598 0.636555 0.393670
18 N01 RF_maintenance 100.00% 100.00% 47.11% 0.00% 11.446298 18.540643 10.033915 -0.754521 10.645323 7.498828 -0.035904 14.100513 0.029455 0.226312 0.175519
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.950961 -0.756576 -1.235920 -1.003127 -0.412113 1.590416 -0.743481 0.936217 0.624864 0.644087 0.386767
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.752750 -0.985873 2.471399 -1.255847 1.067585 0.914219 1.720329 -0.813783 0.609123 0.642312 0.393185
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.179089 0.836693 -0.730954 -0.122228 0.497902 1.308279 -0.389096 -0.222799 0.611925 0.618948 0.381969
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.687569 -0.412795 0.303079 0.057490 1.102062 1.405792 -0.501145 -1.112434 0.580931 0.597727 0.385828
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.094109 12.493313 10.096555 10.516926 10.615699 12.160423 1.045024 0.833533 0.032607 0.035313 0.003867
28 N01 RF_maintenance 100.00% 0.00% 87.78% 0.00% 11.661142 26.329439 -0.259313 2.635799 6.398345 11.352811 4.315571 17.041475 0.358778 0.153429 0.269670
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.822453 13.010015 9.679256 10.105726 10.599707 12.129777 -0.032864 -0.300721 0.029561 0.033819 0.004732
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.221088 0.071486 -0.647261 0.458355 0.953198 -0.005426 0.673561 -0.170551 0.627858 0.646662 0.385029
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.265221 -1.212465 1.101473 0.948955 1.428532 -0.717405 1.077175 3.100159 0.634563 0.643296 0.381475
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.102573 26.529721 -0.190788 2.774811 -0.001189 0.595474 2.051965 5.887930 0.623640 0.532252 0.365425
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.378460 14.221468 4.422236 4.724278 10.563200 12.095378 0.488672 0.244374 0.032522 0.042126 0.006912
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.003765 -0.258544 0.803623 -1.558598 0.330835 -1.043021 -0.469178 0.409482 0.593903 0.587296 0.380673
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.847161 26.896521 13.394735 13.316592 10.752780 12.056420 2.848654 2.844440 0.029984 0.027822 0.001776
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.291838 0.454791 -1.519961 0.711800 0.518565 1.030104 -0.967672 2.755342 0.614312 0.625910 0.402123
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.045580 -0.222933 0.143026 0.468826 -0.019594 0.804413 3.229610 0.548843 0.618565 0.630663 0.397060
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 10.165566 5.305457 9.707659 0.297414 10.546855 -0.404187 -0.038277 0.184282 0.035212 0.613773 0.474572
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.662073 0.254415 -0.177739 -0.080285 1.870755 0.480465 -0.485740 2.832638 0.626327 0.645546 0.380042
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.892206 -0.244906 4.825800 5.971981 -0.561994 -0.022597 -0.227612 -0.392600 0.603915 0.611673 0.368721
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.100556 0.622185 -0.220952 0.535431 -0.873081 0.307215 -0.861220 0.870251 0.635862 0.640413 0.378842
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.727088 0.342120 -1.306476 -0.000737 -0.422247 0.164294 -0.774996 -0.472644 0.629092 0.648355 0.379860
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.785040 3.171494 0.153580 0.440416 -0.617502 1.782538 -0.096618 1.804237 0.620347 0.631038 0.373563
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.252118 0.089369 -0.878617 -1.142940 -0.088588 -0.362030 -0.765699 -0.963191 0.627098 0.649047 0.396308
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.550886 13.915081 4.242852 4.347125 10.547508 12.053241 1.435053 0.788202 0.029813 0.043952 0.010130
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.031166 0.893797 0.352527 1.781967 -0.925313 2.662238 -0.505938 -1.857651 0.594598 0.613521 0.389225
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.108654 -0.336715 -1.078051 -0.006100 0.972765 -0.508939 0.143811 6.561722 0.545654 0.591397 0.390870
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.794724 6.272518 0.316905 1.006375 0.714042 4.889610 17.751380 52.764033 0.595470 0.579399 0.375956
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 23.723502 4.375274 12.852301 -0.682175 10.783955 4.530140 5.862646 1.276277 0.036322 0.517304 0.396945
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.769193 6.501744 -0.465842 0.420643 1.339281 0.694571 1.994851 0.899021 0.624536 0.637254 0.394005
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.819121 3.249269 0.024735 0.257862 1.530253 2.259882 2.058734 3.357222 0.635380 0.648404 0.397010
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 28.333842 -0.910197 5.143331 3.115726 2.513933 -1.149289 2.804743 0.518609 0.446003 0.633588 0.380165
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.828200 13.338910 9.564584 10.080266 10.538732 12.054658 0.399042 1.632062 0.028144 0.030271 0.002171
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.109262 1.999310 5.730038 7.750978 1.270137 2.785080 -0.282146 0.497872 0.590196 0.564413 0.356060
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 21.549044 11.514383 7.254732 0.399445 6.609219 4.223903 47.896072 3.553136 0.427511 0.644426 0.402541
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.151585 12.924466 9.996521 10.643174 10.461376 12.029722 0.564721 0.371493 0.032893 0.032743 0.001732
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.291963 0.661201 10.070638 1.477289 10.268673 1.459585 -0.066372 4.077934 0.041917 0.636554 0.504545
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.250375 12.834532 -0.493568 10.672171 -0.293451 12.087682 0.982700 2.036440 0.622414 0.061806 0.507532
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.390207 0.088054 -0.742444 -1.600872 1.831743 -1.296011 -0.466770 0.330729 0.571186 0.602686 0.378776
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.656715 0.606064 -0.794677 1.089896 -0.358735 -0.090292 1.968245 -0.406237 0.560507 0.612477 0.394053
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.061345 13.375938 -0.434893 4.751626 0.729674 12.201727 0.318598 1.647064 0.592951 0.041669 0.481099
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.064019 0.123531 -0.926346 -1.090085 -0.760342 -0.900197 3.170903 0.485292 0.577070 0.570792 0.371874
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.725610 1.204258 0.421039 1.050892 -0.181736 0.398793 0.255523 -0.364776 0.602199 0.621566 0.405752
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.628216 1.387669 -1.313387 -1.464965 2.392612 -0.839517 -0.675420 -0.472989 0.618885 0.639570 0.404733
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.469687 2.036846 -0.918197 0.568399 -0.500085 -0.043822 -0.002083 2.655577 0.630900 0.631616 0.389420
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 20.742347 27.471311 1.069818 14.026275 5.222292 12.066608 -0.273320 6.110036 0.361550 0.027220 0.270965
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.865951 -0.197048 0.284039 0.689861 -0.364688 1.427247 -0.623450 -0.560602 0.628233 0.650512 0.378643
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.670833 -0.269455 -0.249383 -0.053255 1.308533 1.245688 0.942309 0.967742 0.639924 0.656663 0.376967
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.051613 -0.232519 0.608057 0.913730 0.670862 -0.308472 0.426371 0.380664 0.649164 0.662090 0.370312
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.605111 14.106335 10.481759 11.055579 10.309421 11.834080 -0.014318 0.182161 0.030312 0.032057 0.002513
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.663917 1.045375 -1.464988 -1.176903 0.834506 -0.218510 -0.711748 -0.829647 0.643972 0.658171 0.377551
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.303194 -0.003765 -0.194312 -0.670262 0.005426 1.191132 -1.125783 2.403400 0.643225 0.653648 0.376893
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 61.118556 0.909309 0.507773 -0.467394 9.200674 -1.113901 9.992288 -0.948277 0.293111 0.605773 0.440339
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 34.466408 -0.152269 -0.516009 1.012878 2.551348 0.249775 1.305344 1.242583 0.427538 0.619689 0.381619
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.734664 13.665337 -1.583497 4.772443 -0.835216 11.963293 0.902393 -0.658926 0.587026 0.037700 0.465807
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.609839 14.517845 0.226279 4.671947 -0.480184 12.003953 -0.644528 0.360015 0.594388 0.044361 0.475101
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.250323 13.779226 0.041395 9.256684 -0.169147 11.676529 0.308661 0.951849 0.580042 0.035519 0.454903
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.971298 -0.246322 0.372075 2.302014 -0.176056 0.871537 -0.070265 1.154575 0.600729 0.606244 0.385331
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.369068 0.199618 0.139701 0.354510 0.621939 -0.269772 -0.572627 0.347297 0.613592 0.631711 0.390209
84 N08 RF_maintenance 100.00% 77.23% 100.00% 0.00% 20.210011 24.431030 12.999428 13.573440 8.906857 12.040692 2.361219 2.782276 0.190598 0.033227 0.125831
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.105797 0.492957 1.463581 1.340499 -0.849626 -0.275202 -0.491308 -0.499664 0.626332 0.645334 0.381478
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.558574 -0.310819 1.513866 1.607947 4.228602 -0.816121 0.173343 12.829451 0.617672 0.642106 0.365466
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.481947 4.454931 -0.827826 -0.577089 2.216625 1.504390 59.669707 62.580939 0.637591 0.659679 0.357355
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.563686 0.157217 0.304029 0.693698 -0.145306 -0.505099 3.464798 1.199412 0.638544 0.655629 0.364880
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.553318 0.373110 0.033179 0.786697 -0.597950 -0.838725 -0.855954 -0.668954 0.645783 0.657813 0.370191
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.096903 -0.717865 0.819105 3.253996 -0.719774 -0.087504 -0.134853 1.915539 0.636582 0.631064 0.369257
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.142586 -0.022737 0.379979 0.185961 -0.820960 -0.835761 0.136194 0.031440 0.637748 0.655805 0.385075
92 N10 RF_maintenance 100.00% 0.00% 17.69% 0.00% 35.571485 38.138385 0.376098 1.332086 5.973832 4.742135 6.298981 6.525875 0.283188 0.246715 0.066791
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.012854 -0.361718 2.303561 -1.243221 0.693895 0.258922 2.133080 -0.254819 0.624237 0.644841 0.391811
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.608487 13.337403 10.226007 10.536657 10.535870 12.066035 0.402157 0.240536 0.029882 0.025850 0.002172
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.582901 -0.486892 -1.055558 0.775756 -0.826950 0.339108 0.133230 0.742392 0.598464 0.626390 0.396825
96 N11 not_connected 100.00% 0.00% 0.00% 100.00% 12.347679 6.799483 3.336382 4.794400 4.447909 9.700474 -2.099908 -2.911496 0.255960 0.207431 -0.252467
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.918308 5.823824 -1.304163 1.322288 -0.938178 2.911051 2.723959 6.338460 0.579818 0.529334 0.382913
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.784303 8.979454 -0.436996 1.091770 0.249939 1.612205 0.660093 1.108476 0.632029 0.645293 0.382992
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.692468 1.203583 -1.606059 -1.003873 1.051800 1.513632 1.419867 8.218583 0.641005 0.654152 0.378757
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.212042 5.558125 2.523701 -1.473793 2.939033 0.591445 12.275520 5.184677 0.629972 0.661328 0.376591
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.050130 61.345272 -0.856736 7.140982 2.122016 -0.274082 0.954672 3.731874 0.648055 0.631220 0.370457
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.610371 -0.071583 0.183959 0.810248 0.467269 -0.801190 -0.622116 -0.390284 0.644894 0.658275 0.367132
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.630519 1.485560 -1.414902 -0.614338 0.640934 -0.684839 -0.211666 0.298829 0.647389 0.661528 0.367302
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.556364 1.066419 -0.821654 -1.201865 0.011094 -0.191929 4.606770 4.064450 0.646355 0.663335 0.372764
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.653012 43.100979 10.037554 0.790064 10.551636 5.428711 0.599825 6.936358 0.032792 0.288573 0.168907
109 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 3.768167 12.900648 7.735843 10.393376 3.882730 12.153768 -0.720164 0.844809 0.507041 0.028891 0.352470
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.021788 26.090470 13.455301 13.777389 10.506272 11.885259 2.468954 2.609746 0.023734 0.025134 0.000994
111 N10 digital_ok 100.00% 0.00% 82.10% 0.00% -0.026266 11.803692 -0.496213 10.309269 0.238347 11.365463 2.389482 0.925582 0.635587 0.177548 0.465390
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.347565 -0.383096 0.167681 0.075094 0.927050 3.092348 0.015755 -0.785207 0.623512 0.637591 0.397071
113 N11 not_connected 100.00% 0.00% 100.00% 0.00% 4.323167 14.260528 3.655272 4.756031 4.439435 11.889988 -2.604551 -0.085930 0.610377 0.066470 0.477281
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.410527 12.106556 15.396700 10.717395 12.276576 13.778515 251.314699 74.655816 0.020756 0.027676 0.004035
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.105185 -0.864547 -1.215959 -0.599208 -0.103519 -1.115055 -0.698199 -0.277856 0.567693 0.594186 0.394531
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.524463 14.411992 10.172631 11.013651 10.369533 12.030486 0.604221 2.528634 0.027786 0.030289 0.002040
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.101626 1.526168 -0.214292 0.469766 -0.410916 0.069550 0.107415 0.908083 0.609955 0.631889 0.396379
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.553619 2.178691 2.756618 -1.077522 0.156293 1.280657 2.657729 0.991138 0.621330 0.656991 0.387927
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.132529 3.111423 -1.434580 5.992731 0.828246 -0.581442 6.615523 13.135474 0.641439 0.631333 0.366355
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.935166 6.756232 0.141874 0.808730 1.120060 1.401792 -0.164499 -0.430343 0.636444 0.661772 0.375098
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.200828 9.025078 0.731514 0.938925 0.234090 -0.007832 -0.250522 0.546872 0.653133 0.666676 0.376596
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.173205 -0.141120 -0.035810 0.544959 -0.477359 0.255481 0.643565 0.279670 0.653004 0.667480 0.378058
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.670571 0.483484 -0.308004 0.725639 0.600649 0.118359 0.133566 0.101170 0.648678 0.655550 0.371986
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.693771 -1.131944 -0.883575 0.897281 9.424192 -0.666042 33.732049 -0.551190 0.597752 0.652420 0.375767
127 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.307755 0.161979 0.533383 0.318747 1.594820 0.700903 7.359067 1.679294 0.641766 0.658142 0.384214
128 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 1.397967 12.467231 7.272262 10.646317 1.289541 11.964935 -0.920590 -0.006851 0.543555 0.030696 0.385969
131 N11 not_connected 100.00% 0.00% 5.41% 0.00% -0.814353 12.710192 -0.136429 4.600240 -0.862526 10.682637 -1.025818 -0.295002 0.611303 0.284718 0.434917
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.388660 3.058646 -0.593214 -1.556733 2.541630 -0.269701 0.279438 -0.095181 0.589947 0.587961 0.376843
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.052740 0.435746 -1.007041 1.789442 -0.738303 1.601511 -0.804663 -0.352218 0.580026 0.613558 0.407336
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.859398 -1.072266 -0.967556 -1.632859 2.309961 0.721674 9.780435 -0.297751 0.573826 0.614875 0.413911
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 9.754486 1.440156 9.651020 -0.847604 10.644794 0.649536 0.598446 -0.282825 0.037044 0.607223 0.457663
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.133375 -0.667373 0.096487 -1.541703 1.719353 -0.581619 0.398667 0.771098 0.590587 0.626901 0.401538
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.948239 -0.133374 1.425190 -1.007388 1.200337 -1.124369 -0.833615 -0.280837 0.619472 0.628374 0.379027
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.497310 -0.896257 -1.043874 -0.318964 -0.721697 -0.521858 4.343858 3.086958 0.635991 0.657410 0.380562
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.264676 -0.798432 -0.324718 0.586107 1.529190 -0.741905 1.167896 -0.677489 0.638799 0.663266 0.377697
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.874248 12.875278 -0.751033 10.679780 2.856356 12.125756 16.228885 0.670682 0.635338 0.042224 0.523064
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -1.404161 -0.010964 -0.881522 1.159417 -0.321356 5.233266 -0.615819 -1.132607 0.654762 0.661973 0.375624
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.049038 -0.447155 -1.292357 5.784193 0.454193 4.145492 -0.849005 -0.537907 0.653807 0.612262 0.388497
145 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.951113 12.982579 10.055085 10.715699 10.332374 12.210691 -0.191172 1.791892 0.065780 0.029786 0.027688
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.022206 -0.678149 1.396103 0.522271 1.129490 0.045386 -1.404574 -1.553325 0.642702 0.654830 0.379668
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.569150 -1.691920 1.152566 2.329444 -0.712695 -0.760354 0.048556 0.082067 0.631609 0.638433 0.378028
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.226354 0.126896 -0.676065 -0.691854 1.826946 1.641807 -0.010302 -0.704008 0.634126 0.649566 0.391076
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.063637 -1.228336 -1.205176 -1.463435 -0.037588 1.252442 -0.299494 -0.130880 0.627346 0.643360 0.395630
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.453184 -0.631000 -1.351876 -1.391110 -0.599490 0.491187 0.338028 1.050381 0.621248 0.633888 0.395466
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 26.425741 1.014214 -0.385175 0.325683 4.081596 -0.815759 4.056072 0.026332 0.470090 0.575795 0.351008
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.111195 -0.776636 9.810362 -1.500273 10.685042 -0.220103 0.938394 0.917531 0.038314 0.615358 0.476261
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.737134 12.602815 8.140939 10.407883 5.015834 12.177094 0.403107 0.939109 0.425792 0.036566 0.336255
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.046524 -0.299212 -0.056689 0.618994 -0.441162 0.633445 -0.290325 -0.177691 0.597549 0.623897 0.398750
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.365212 0.089476 -0.234550 -0.655586 2.287396 2.501178 3.051276 12.387667 0.614231 0.640378 0.400150
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.318296 29.134533 -1.647631 -0.780066 0.123642 5.771830 -0.614525 17.373064 0.586663 0.491456 0.352834
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.652046 -0.929391 -0.338158 -0.811702 -0.389498 1.630626 0.370571 0.707056 0.627127 0.647053 0.384505
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.982926 29.455576 -0.032891 -0.642967 0.096563 1.541903 -0.375258 0.354093 0.633824 0.522169 0.345448
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 2.528023 -0.918581 -0.929129 -1.307516 1.312857 1.133142 3.607607 0.013739 0.636357 0.662933 0.383360
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.543735 1.170974 -0.256252 0.358011 -0.209363 1.023482 -0.501350 0.809612 0.647832 0.660530 0.384064
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.049822 0.458159 0.435358 1.376356 0.352233 2.308743 0.796936 0.624967 0.643080 0.655474 0.373276
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 32.849400 0.030761 -0.582249 -1.084858 3.638532 -0.058269 4.697326 0.374595 0.506998 0.660560 0.376521
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.446413 3.018155 -0.470394 3.146285 0.548767 4.912299 3.690974 0.495692 0.640822 0.648774 0.378674
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.851192 -1.073751 -1.512349 -0.130967 1.825917 0.130981 -0.025685 3.059801 0.637728 0.645114 0.381765
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.968767 -1.170853 0.210129 -0.457974 1.373246 0.455461 -0.556974 1.867423 0.631540 0.645402 0.390805
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.723037 -0.892629 -0.975371 -1.571461 0.664142 0.424348 -0.700658 -0.547812 0.630093 0.645490 0.393549
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.452423 -0.481814 10.379160 -0.958903 10.368018 0.095055 1.422341 5.463449 0.036896 0.639673 0.505886
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.777194 2.676181 -1.567664 0.000737 -0.484582 1.900281 -0.547435 0.485111 0.575817 0.557574 0.369126
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 12.821317 13.557985 3.762115 4.361456 10.725411 12.197411 2.802960 4.693135 0.037923 0.041803 0.003599
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.459106 -0.636228 -0.130562 -0.865133 -0.641278 7.805105 -0.659585 4.042121 0.581350 0.635346 0.398883
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.232559 13.538862 -1.658621 10.822638 0.847293 11.998551 15.856764 1.152529 0.627849 0.048037 0.526106
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.518510 -0.107722 0.422683 0.434584 0.220138 -0.146332 -0.538813 3.276682 0.632037 0.646366 0.388080
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.409769 12.555421 -1.173192 10.377210 -0.164125 12.192627 7.739574 0.779212 0.642016 0.042613 0.498860
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.232148 0.725462 -0.182769 0.672916 1.390387 -0.511080 0.628635 0.022837 0.631637 0.646738 0.373041
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.025661 -0.640772 -1.660221 -0.460973 -0.434965 0.015003 -0.099856 0.002083 0.645932 0.659929 0.371447
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 36.300366 -0.270053 -0.471595 -1.593251 9.737852 0.885232 7.200758 -0.220635 0.513728 0.657403 0.378971
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.992180 -0.721621 0.345633 -0.319337 -0.154554 -1.161401 -0.167861 0.549528 0.647990 0.661705 0.383280
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.919992 0.368511 0.023790 1.440120 0.942346 0.584367 0.499415 -1.094430 0.636509 0.652542 0.379932
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.644392 12.435259 9.631080 10.509775 10.775963 12.220951 2.752265 1.573174 0.027315 0.029681 0.001143
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.222462 -1.392157 -0.717950 0.294440 -0.377780 -0.050277 -0.498710 -1.203670 0.622199 0.644134 0.401516
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.739568 0.357921 1.252556 -0.529487 0.639130 0.711845 8.998398 0.265040 0.608539 0.627228 0.397625
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.173316 6.872287 4.720179 4.782866 7.600291 9.442328 -2.970740 -3.053077 0.575126 0.590402 0.388731
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.172290 0.193872 4.950109 1.165305 8.138927 2.094002 -2.913433 -0.251144 0.559305 0.600777 0.414616
200 N18 RF_maintenance 100.00% 100.00% 74.96% 0.00% 12.408239 36.390169 4.187512 0.806399 10.685693 6.302954 0.714997 16.452870 0.039181 0.178554 0.115062
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.957349 5.024180 3.076187 4.189103 2.976461 7.796888 -0.618258 -2.295428 0.617478 0.617322 0.383664
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.641814 3.461198 1.551077 -1.335993 1.268198 -0.493480 -0.740741 20.152231 0.625519 0.610814 0.379890
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.047754 1.069333 2.517040 0.375789 4.726877 -0.828833 0.593860 9.793177 0.474880 0.599254 0.400484
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.243653 7.369254 -0.905316 1.952128 6.353314 4.208903 -0.799958 -0.129730 0.605952 0.515359 0.399222
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.760613 2.792617 1.293447 -1.571432 1.289992 3.815811 -0.750576 0.569760 0.600472 0.596766 0.357793
208 N20 dish_maintenance 100.00% 99.51% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.780961 0.608676 0.639064
209 N20 dish_maintenance 100.00% 99.68% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.462714 0.399449 0.285396
210 N20 dish_maintenance 100.00% 99.68% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.692653 0.780227 0.641691
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.916466 2.318775 -1.342831 -0.036587 -0.612753 -0.022039 2.703873 -0.325157 0.572184 0.588758 0.379198
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.484761 -1.280809 0.343141 -0.480785 -0.589539 -0.488793 2.468123 -1.274451 0.611082 0.619982 0.381934
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.956961 -0.200977 -1.385803 -0.791518 -0.111236 -0.881690 3.302996 -0.898581 0.594939 0.625059 0.386432
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.265603 -0.367995 -0.372385 0.077838 -0.578287 -0.780678 3.096975 -1.156249 0.606376 0.634160 0.390200
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.240835 -0.037269 -1.574875 0.288161 -0.301433 -0.663969 0.702999 2.072773 0.594463 0.635183 0.394739
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.576823 6.300064 5.212437 4.726195 8.574686 9.178470 -2.775382 -2.399303 0.593562 0.612616 0.382545
225 N19 RF_ok 100.00% 0.00% 91.62% 0.00% -0.310111 13.077315 0.653340 4.537481 -0.389752 11.813009 -0.977463 0.564990 0.599072 0.134954 0.497099
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.097268 6.793299 0.009140 1.307745 -0.676553 4.112773 -0.777119 -0.933806 0.609339 0.596712 0.379552
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 2.161258 0.395644 -1.590589 -0.015218 -0.124833 -0.214540 10.556225 2.198949 0.570103 0.608663 0.375809
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.239624 22.270809 -0.621673 -0.475733 4.955403 4.752620 73.402556 36.301835 0.483780 0.480347 0.272820
229 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.861136 0.011789 1.429960 1.307778 0.384728 1.373190 6.999891 -1.531740 0.592003 0.609479 0.396756
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.751651 -0.060703 -0.169118 -1.595400 -0.444654 -0.943296 -0.716248 -1.044009 0.547914 0.600826 0.401050
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.332070 -0.302528 0.842186 0.316657 -0.509796 -0.797483 -1.483466 -1.575425 0.606970 0.620426 0.393187
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.955509 -1.457672 -0.159264 0.017864 -0.531595 -0.997615 0.138538 1.191719 0.605050 0.622942 0.391291
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.627373 0.856827 1.366964 1.794970 0.966748 1.770516 3.329324 3.530831 0.595919 0.621412 0.385566
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.828623 1.370357 -0.389044 0.791628 1.377579 0.159670 1.454895 -0.461557 0.484237 0.510374 0.259337
242 N19 RF_ok 100.00% 63.93% 0.00% 0.00% 64.978053 1.100493 0.605349 1.543629 6.629279 2.901602 -0.282236 0.082791 0.209332 0.610464 0.492161
243 N19 RF_ok 100.00% 26.50% 0.00% 0.00% 61.739991 2.301881 0.793907 -1.532178 7.624674 -0.910207 -1.198349 -0.455370 0.247147 0.598861 0.481267
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.763646 2.061835 1.365761 -0.844243 2.791404 1.591567 2.298536 5.988930 0.477131 0.572297 0.383393
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.513900 1.883451 0.073421 -1.032112 -0.342734 -0.837473 -1.140054 -0.007527 0.583757 0.589420 0.387248
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.783231 7.557276 -1.213980 -0.440634 5.057350 5.179757 2.252485 -0.464548 0.314961 0.315386 0.159503
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.530708 1.558539 0.599214 -0.538984 -0.625900 -1.200367 -0.456824 1.541918 0.582650 0.587188 0.390876
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.723946 7.684647 9.199528 10.363842 10.387966 11.103623 7.181628 21.962742 0.030216 0.026377 0.003549
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 6.391876 13.458064 2.518778 6.923804 1.032645 12.180450 26.019675 1.483399 0.437510 0.042520 0.352984
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.453878 2.581800 1.023652 1.491155 1.362422 1.520100 0.579092 -0.867894 0.490416 0.507649 0.380294
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.543957 -1.089361 1.154813 -1.428762 1.248103 -0.844383 -1.354956 -0.247674 0.522574 0.527091 0.397741
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.015790 -0.572089 0.510761 -0.497656 2.734684 -0.629282 3.226519 0.121493 0.418350 0.521144 0.388942
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.592129 2.240802 -0.670055 -1.596492 -0.157159 -0.832607 0.417435 0.384575 0.455302 0.500048 0.373218
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 9, 10, 15, 16, 18, 27, 28, 29, 32, 34, 36, 40, 42, 47, 49, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 77, 78, 79, 80, 81, 84, 86, 87, 92, 94, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 113, 114, 117, 120, 121, 122, 123, 126, 127, 128, 131, 135, 136, 140, 142, 143, 144, 145, 151, 155, 156, 158, 159, 161, 165, 166, 170, 173, 179, 180, 182, 185, 189, 191, 192, 193, 200, 201, 202, 205, 206, 208, 209, 210, 224, 225, 226, 227, 228, 229, 242, 243, 244, 246, 262, 320, 329]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

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