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 = "2459986"
data_path = "/mnt/sn1/2459986"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 2-10-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/2459986/zen.2459986.21269.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 1852 ant_metrics files matching glob /mnt/sn1/2459986/zen.2459986.?????.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/2459986/zen.2459986.?????.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 2459986
Date 2-10-2023
LST Range 3.900 -- 13.867 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1852
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 25
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 53 / 198 (26.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 114 / 198 (57.6%)
Redcal Done? ❌
Never Flagged Antennas 84 / 198 (42.4%)
A Priori Good Antennas Flagged 45 / 93 total a priori good antennas:
3, 7, 15, 16, 19, 20, 29, 30, 40, 42, 45, 53,
54, 55, 71, 72, 81, 86, 94, 101, 103, 107,
109, 111, 121, 122, 123, 127, 136, 144, 149,
151, 158, 161, 165, 170, 173, 182, 185, 187,
189, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 36 / 105 total a priori bad antennas:
4, 8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 89, 102, 115, 125, 126, 132, 133, 137,
220, 222, 223, 226, 228, 229, 237, 238, 239,
241, 244, 245, 261, 324, 325
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_2459986.csv

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 12.378246 16.560663 10.768446 11.508187 9.285808 11.213822 5.424803 9.473313 0.029295 0.031426 0.002754
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.107590 0.295348 2.594039 0.167078 1.456606 0.561391 3.055573 -0.158488 0.602315 0.631482 0.360629
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.252230 -1.099496 0.242132 0.154325 0.363786 1.923126 0.366318 0.626304 0.623433 0.632288 0.345691
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.220676 0.130469 -1.301761 -0.305887 0.212359 0.160542 6.522750 6.559927 0.627203 0.644415 0.345450
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.389276 -1.542344 -0.558278 0.066864 -0.291039 0.469997 0.971548 2.052838 0.626118 0.640940 0.342785
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.640484 -0.603012 3.286211 -1.206941 0.677077 -0.428379 3.140038 0.194318 0.602792 0.642904 0.356036
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 2.537492 -0.217048 1.240166 -1.467677 2.170456 0.467745 -0.142575 1.132195 0.612359 0.637491 0.351780
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 12.855833 16.865851 10.704816 11.434037 9.327376 11.245597 5.236636 9.192620 0.026995 0.025579 0.001653
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 12.659079 -0.873260 10.732571 0.735956 9.289405 2.081587 5.434396 1.894610 0.031667 0.644361 0.525209
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 1.338065 2.098303 0.555645 0.476763 0.738702 0.946683 0.404971 0.452387 0.632133 0.650172 0.346076
18 N01 RF_maintenance 100.00% 100.00% 35.37% 0.00% 13.427751 20.220950 10.714686 -0.259506 9.446239 7.056657 5.399794 17.014200 0.028798 0.244937 0.189039
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.874086 0.539356 -1.089981 -1.250530 -0.470912 34.990950 -0.699084 1.758559 0.638287 0.656692 0.342966
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.288845 -1.652357 1.227251 -1.070325 6.626431 -0.166627 1.807197 -0.279954 0.632220 0.650682 0.342221
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.715632 0.334301 -0.595442 -0.005999 0.395672 1.229297 1.098107 2.040337 0.625549 0.633898 0.337445
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.442346 -0.075910 0.356695 0.121935 1.374378 1.951805 0.097330 -0.941613 0.592837 0.612925 0.338936
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.907127 15.456235 10.774957 11.297413 9.415073 11.289829 6.254041 9.732616 0.033813 0.037170 0.004394
28 N01 RF_maintenance 100.00% 0.00% 73.27% 0.00% 11.680612 30.028822 -0.177756 3.307160 6.816145 8.714662 3.946246 18.339004 0.391823 0.172624 0.281732
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 12.737957 15.981156 10.351597 10.878490 9.409049 11.280250 5.398854 9.061539 0.029570 0.035690 0.006328
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 1.562895 0.249848 0.750254 -1.489309 4.330506 0.461035 1.011312 -1.543351 0.635803 0.666023 0.345734
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.710313 -1.504183 1.088837 0.450999 1.721115 -0.307288 1.099166 1.851409 0.650104 0.661308 0.335740
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.345814 31.412542 0.648282 3.418329 4.636307 1.140939 6.644119 5.675024 0.577777 0.550968 0.249835
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 14.557605 17.396192 4.956300 5.356461 9.404877 11.264378 6.316895 9.912072 0.034174 0.044857 0.007419
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.236096 -1.038955 0.960424 -1.400573 0.925460 -0.798802 0.766003 2.946872 0.606305 0.608912 0.330695
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 31.435673 32.008882 14.175789 14.181677 9.478261 11.171645 7.799028 11.291118 0.031932 0.029423 0.001678
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.462542 0.773930 -1.280003 1.539602 1.881074 1.658374 -0.666453 2.790111 0.638846 0.646432 0.342017
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.277715 -0.032529 0.344222 0.651463 -0.054660 0.509781 3.081818 0.996880 0.643154 0.643722 0.338320
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 11.959282 0.739496 10.383730 0.621284 9.370044 -0.698955 5.632668 -0.223490 0.037062 0.645894 0.496136
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.388938 0.617462 -0.098003 0.081825 1.815095 0.841478 -0.026434 0.659756 0.638894 0.661759 0.328754
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.208173 3.266405 -1.372900 8.953544 1.258550 4.029871 -0.752234 0.752089 0.655933 0.568491 0.364317
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.042448 -0.028540 -0.021029 0.712224 -0.634497 0.539112 0.047200 1.641979 0.640203 0.653479 0.329745
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.278396 -0.029401 -0.575257 -0.516753 -0.995758 0.440200 -0.616253 -0.121292 0.646568 0.665727 0.333770
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.109357 4.642249 0.326163 0.802724 -0.439831 1.879915 1.169368 12.474192 0.637363 0.647117 0.324791
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.082526 0.153137 -0.800668 -0.950864 -0.383593 -0.223738 0.499185 -0.845677 0.638321 0.660463 0.342851
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 13.373326 16.994771 4.852378 4.955426 9.382890 11.177469 6.899817 9.568464 0.030712 0.054929 0.016679
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.402236 1.382886 -0.231229 1.871140 -0.975592 2.579377 -0.773249 0.764554 0.602239 0.627026 0.341536
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.348808 0.013578 -0.874606 -0.067584 1.064277 1.532325 1.200154 2.647379 0.567157 0.606331 0.332404
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.985773 4.627003 0.466545 1.164101 0.229678 3.343319 11.712360 23.595476 0.618851 0.615815 0.319745
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 11.450322 5.116341 0.201874 1.923145 5.689827 4.621762 22.913180 1.507016 0.529200 0.544671 0.227748
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.151524 7.914034 -0.446380 0.626562 1.129778 0.889932 0.781841 1.517219 0.645759 0.657016 0.335178
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.129393 3.696903 -1.457989 -1.169971 0.833697 6.039520 0.712712 0.760509 0.656880 0.668340 0.339805
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 32.365854 -0.740839 5.045538 -0.750962 1.900122 -0.093020 3.341732 -0.700602 0.492082 0.669262 0.331815
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 13.001395 16.998741 10.806467 11.436070 9.387003 11.232223 6.057880 10.674611 0.027915 0.030715 0.002686
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.303494 0.575306 -0.642895 1.568665 -0.366751 1.069256 -0.842758 1.258139 0.648097 0.674383 0.329688
57 N04 RF_maintenance 100.00% 100.00% 0.00% 0.00% 13.525058 4.512502 11.104306 -1.175580 9.198028 2.207488 6.160837 0.481759 0.043377 0.672329 0.519726
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.958676 15.899295 10.668562 11.424051 9.310346 11.198927 6.666009 10.286499 0.035340 0.035229 0.001715
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.965594 0.990387 10.194979 0.653273 9.140619 2.787166 6.011843 2.454289 0.047900 0.656153 0.510498
60 N05 RF_maintenance 100.00% 0.00% 97.25% 0.00% 0.135703 15.829878 -1.158845 11.454359 -0.459648 11.209828 0.715719 10.775062 0.639108 0.087192 0.499507
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.677415 0.129882 -0.381878 -1.397723 1.654085 -1.165395 -0.465317 -0.727514 0.591550 0.627961 0.331898
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.156844 1.281705 -0.965359 1.242181 0.119352 0.063825 0.022863 0.502734 0.587395 0.627193 0.338550
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 1.939110 16.392582 -0.323323 5.385243 0.441372 11.320465 -0.678536 10.131235 0.600634 0.043806 0.458148
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.140338 0.112824 -0.767338 -0.936046 -0.025915 -0.608897 1.986774 2.623773 0.597153 0.599870 0.318937
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.758332 2.014802 0.671241 1.148958 -0.252321 0.373118 0.399226 0.598283 0.625713 0.644507 0.341909
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.049339 2.087282 -1.446838 -1.162032 2.464244 -0.269408 -0.757897 -1.250872 0.640434 0.658247 0.342834
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.531604 -0.349412 -0.792929 0.669500 -0.750868 0.619226 -0.146486 1.899910 0.649163 0.657672 0.329634
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 22.417870 32.749746 1.057126 14.902780 5.410780 11.133310 2.157410 12.699393 0.404937 0.029072 0.306093
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.149580 -0.225748 0.481267 0.861189 -0.799126 1.680994 -0.223883 0.057405 0.649292 0.669678 0.321003
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.214292 -0.237395 -0.147653 0.050627 1.276690 1.156323 0.390135 0.619987 0.658278 0.676769 0.324154
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.801148 -0.148825 0.725289 1.144105 -0.072064 -0.209445 2.133993 1.427307 0.651652 0.680655 0.323636
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 13.143868 17.237694 11.175816 11.843252 9.175272 11.019078 5.480528 9.357682 0.034201 0.037899 0.004784
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.443503 0.984033 -1.402737 -0.958965 1.305340 -0.361806 -0.409460 -1.020992 0.656677 0.672019 0.324756
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.675309 0.181181 -0.015865 -0.568146 -0.162129 1.618217 -0.426019 1.787351 0.651587 0.664776 0.324196
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 60.693499 6.907526 0.554146 -0.091045 3.952388 2.316870 3.771266 4.783647 0.382583 0.606318 0.356424
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 37.231917 1.013579 -0.424285 1.524819 2.259761 0.146277 2.585436 1.645165 0.460214 0.639822 0.335814
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.611884 16.718774 -1.449967 5.401132 -1.072085 11.130030 -0.188798 8.757909 0.609717 0.039879 0.460838
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.498989 17.755083 0.372490 5.300026 -1.004782 11.161771 -0.791079 9.324355 0.620228 0.053939 0.466941
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.240500 16.800340 0.179803 9.989242 -0.114820 10.885006 -0.594235 9.537142 0.604397 0.037269 0.457821
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.354653 0.576742 0.537859 3.018598 -0.339459 26.059968 -0.300999 -0.074315 0.625906 0.609067 0.326529
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.018224 0.298291 0.304610 0.449872 0.171093 -0.005469 -0.629596 -0.176562 0.637909 0.648675 0.325870
84 N08 RF_maintenance 100.00% 52.48% 100.00% 0.00% 23.217015 29.321253 13.714718 14.445610 7.625678 11.111194 5.671519 10.634502 0.241939 0.035182 0.149613
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.113797 0.255139 0.825817 1.494805 -0.723745 0.132376 -0.526381 0.453944 0.652378 0.667734 0.321589
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.112485 0.110705 1.817510 1.890307 3.149556 -0.473687 0.109585 10.415823 0.640433 0.664157 0.309794
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.523898 9.164097 -0.371224 -0.116695 6.896492 2.254750 2.703323 0.533373 0.649252 0.686150 0.310401
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.162136 0.342056 0.460501 0.912738 -0.737745 -0.594656 2.561241 0.600948 0.656383 0.676187 0.315257
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.016766 0.641376 0.230628 1.000194 -0.835329 -0.625902 -0.565690 0.007499 0.659758 0.679084 0.317485
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.290652 0.035420 -0.930534 -1.456655 2.471865 7.849319 -0.429868 6.641947 0.662946 0.682735 0.325094
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.656971 -0.201703 0.575868 0.437730 -0.732149 -0.602947 0.006545 -0.063397 0.647113 0.673171 0.326476
92 N10 RF_maintenance 100.00% 0.00% 12.15% 0.00% 39.189754 48.027187 0.529168 1.717462 5.832803 5.104848 3.105854 9.362757 0.330823 0.285195 0.073405
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.545517 0.314741 2.589336 -1.168702 0.868358 0.587715 3.096269 -1.139558 0.644495 0.666238 0.333001
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 13.564204 16.373220 10.926698 11.313650 9.399353 11.203120 5.513583 9.169906 0.031506 0.026116 0.002576
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 8.276924 4.730131 -0.808734 0.917409 0.457117 0.979067 0.753551 1.564909 0.568306 0.615433 0.312159
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.555384 23.521306 3.897869 1.831522 4.122794 3.644248 1.129553 2.056870 0.617702 0.539826 0.315868
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.310251 5.199175 -0.703220 1.126752 -0.526946 3.460065 0.820634 8.641175 0.607959 0.585112 0.321519
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 10.510440 9.439782 -0.285117 1.271135 -0.090890 1.243448 -0.205690 1.032197 0.652709 0.663235 0.323650
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.814738 1.341977 -1.389802 -0.940443 0.569424 0.801653 -1.026240 1.497459 0.654920 0.674344 0.324677
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 5.996137 4.294382 3.951781 -1.289641 4.485640 1.513409 2.125458 1.196543 0.642300 0.672962 0.327842
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.936467 70.085667 -0.894388 7.487128 2.361753 -0.416600 -0.640576 2.104980 0.666179 0.660502 0.317711
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.599315 0.131588 0.264028 1.025578 0.601222 -0.581023 -0.435274 0.030892 0.665084 0.678848 0.313886
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 2.096123 -0.958285 -1.208726 -0.434511 0.036747 -0.701821 -0.679703 -1.224673 0.665110 0.669888 0.311551
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 6.059315 3.572054 -0.229538 -0.395384 6.289632 -0.084534 5.685463 2.417590 0.660335 0.682665 0.313656
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.539939 49.291417 10.715619 1.112814 9.361911 4.396200 5.862567 6.351336 0.034070 0.326253 0.178326
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.326254 15.891519 10.753213 11.171855 9.448144 11.279762 5.289769 9.730889 0.026209 0.029334 0.001964
110 N10 RF_maintenance 100.00% 3.56% 0.00% 91.74% 17.898537 6.962428 11.521450 5.271111 4.318606 9.089090 3.733232 2.710566 0.242510 0.359033 -0.172898
111 N10 digital_ok 100.00% 0.00% 97.52% 0.00% 40.012680 15.759733 1.188032 11.289027 2.791294 11.273826 2.890096 9.847831 0.515481 0.080520 0.323238
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.610538 -0.711602 0.331162 0.250428 0.671905 1.658013 1.153033 0.671840 0.645934 0.658686 0.333027
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 14.744690 17.428374 4.572095 5.396638 9.225667 11.106106 5.836201 9.098421 0.035598 0.031143 0.002253
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.077370 1.227762 0.604524 -0.047570 2.775226 -0.951895 -0.537090 -1.359662 0.594809 0.630276 0.327868
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.923456 -0.882208 -1.081214 0.204322 -0.517550 -0.269250 1.142238 -1.459637 0.594179 0.626348 0.336073
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 13.515598 17.630434 10.847468 11.804913 9.226816 11.187635 5.561313 10.537254 0.028039 0.031742 0.002668
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.401827 1.913959 0.005999 0.682175 -0.312670 0.124912 -0.435337 -0.064586 0.631669 0.651393 0.337201
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.995894 1.703723 2.927069 -0.622708 0.235683 -0.590812 2.577678 0.007789 0.642802 0.671130 0.328634
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.748177 6.011993 -1.305757 1.628703 0.022896 0.610477 2.555936 10.598511 0.667185 0.678975 0.321662
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.290556 8.333450 -1.168257 -1.253867 1.252495 0.605401 -0.899557 -1.959900 0.665795 0.685365 0.322301
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.519291 10.657434 0.895686 1.168769 0.194700 0.092136 0.375565 1.435074 0.673554 0.686577 0.321254
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.041138 0.381264 0.225876 0.742746 -0.403863 0.234431 0.443873 0.327300 0.671537 0.684393 0.321001
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.438166 -0.659804 0.146252 1.031037 -0.401283 -0.690331 -0.048791 -0.189143 0.667270 0.677839 0.318719
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.235422 1.090194 -0.932454 1.140184 1.549698 -0.054909 3.808193 0.132708 0.666797 0.676724 0.319621
127 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 1.232464 0.484080 0.606085 0.582681 1.881619 1.418730 1.245193 4.138486 0.661825 0.683324 0.327988
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.114113 -0.591508 -1.381463 -0.244289 -0.912190 0.054393 -0.763446 1.444403 0.666621 0.679690 0.333922
131 N11 not_connected 100.00% 0.00% 4.64% 0.00% -0.832242 15.563129 0.012548 5.251768 -0.913677 10.149022 -0.973336 5.918461 0.632125 0.338685 0.385122
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.976993 0.597970 -0.226936 -1.486124 1.087773 -0.727994 -0.576139 -1.547479 0.615644 0.628667 0.323993
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.273017 -1.454774 -1.400137 -0.401369 -1.206675 -0.713872 -0.874830 -0.713850 0.596381 0.630467 0.339624
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 14.277238 17.520079 4.727680 5.361223 9.225895 11.158721 5.162027 9.167860 0.040643 0.034587 0.003302
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.245734 -1.177707 -1.174966 -1.431366 2.478889 0.646596 6.640441 -1.469016 0.593663 0.628223 0.354487
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 11.524738 1.172137 10.319562 -0.701592 9.433541 0.722387 5.820237 -0.656770 0.039911 0.626448 0.443820
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.246708 -0.423241 0.204277 -1.363913 1.440968 -0.359829 0.624534 -0.471616 0.613834 0.645096 0.342602
139 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.556257 1.814030 1.595988 -1.023002 0.654999 6.808308 0.614950 14.006658 0.635620 0.634118 0.327458
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.492414 -0.901082 -0.794782 -0.192032 -0.683045 -0.553591 1.963631 0.707923 0.655290 0.671725 0.326752
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.345019 -0.501231 -0.235137 0.680401 1.614946 -0.369298 0.194104 -0.199307 0.657248 0.677091 0.325154
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.266101 15.870448 -0.711982 11.461019 2.568363 11.244842 9.293835 9.609154 0.662624 0.046582 0.514699
143 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.485042 -1.081231 -1.491356 -0.721897 1.021201 0.653070 -0.160608 -0.840982 0.670142 0.681300 0.321974
144 N14 digital_ok 100.00% 0.00% 0.05% 0.00% -0.480618 10.245046 -1.197019 10.625469 0.110986 11.786199 -0.989024 5.017304 0.671849 0.404828 0.418503
145 N14 RF_maintenance 100.00% 99.95% 100.00% 0.00% 12.811818 15.987788 10.719881 11.497566 9.418895 11.293896 5.330224 10.419789 0.085861 0.029959 0.042285
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.201065 0.723504 -0.882672 0.577541 -0.314477 0.650000 -1.054136 -0.625317 0.646412 0.669676 0.322051
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.252509 -1.028829 1.458979 2.485698 -0.632998 -0.169477 0.795378 2.264695 0.654372 0.661458 0.315532
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.545903 0.386543 -0.570623 -0.592161 1.275136 1.543121 -0.309451 -0.791486 0.655080 0.674437 0.329905
149 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 0.375455 -1.326803 -0.309604 -1.249940 1.111852 0.496091 12.425016 -1.514840 0.650946 0.669552 0.335523
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.261915 3.461691 -1.188197 -1.228907 -0.734652 -0.550244 -0.110455 -0.807525 0.648687 0.648057 0.329504
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 22.879081 1.272244 -0.046324 0.614508 3.521719 -0.698408 3.126895 -0.981384 0.525699 0.606854 0.303548
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.137831 -1.021981 10.486533 -1.335005 9.482703 0.154501 6.087507 -0.809212 0.041368 0.630156 0.459688
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.481062 15.535400 8.366438 11.186942 4.246772 11.317789 1.346033 9.899216 0.479213 0.038222 0.349942
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.548013 -0.227798 0.043239 0.735025 -0.257339 0.586048 -0.158401 0.381977 0.616994 0.642053 0.342091
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.256789 -0.394441 -0.109823 -0.158678 2.066225 1.541393 1.858147 8.628635 0.630816 0.654920 0.342261
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.707015 29.452730 -1.492274 -0.716382 -0.385559 5.610013 -0.074228 20.203353 0.604864 0.540884 0.311462
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.510605 -1.042637 -0.461592 -0.711942 -0.724155 1.291329 -0.688166 -0.316387 0.645236 0.666318 0.331834
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.732925 34.676290 0.113200 -0.418362 0.239047 1.446510 -0.270256 1.084192 0.652396 0.555596 0.298745
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.562334 -1.209525 0.106293 -1.116404 0.482203 1.015122 0.456200 -1.747561 0.663517 0.680015 0.330778
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 1.080690 2.016130 -0.091376 0.536896 -0.019939 0.611955 -0.135872 1.074072 0.666385 0.681508 0.328995
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.182932 -0.040712 -0.261601 0.806800 1.873303 1.438695 -0.130766 0.845702 0.664984 0.674528 0.319409
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 35.006187 0.505575 -0.493026 -1.078706 4.216021 -0.111947 4.110912 -0.735753 0.540678 0.681959 0.327909
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.678167 3.771282 -1.405451 3.257501 0.226965 4.854176 0.391877 4.302820 0.649932 0.662162 0.330326
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.094156 -1.255935 -1.488952 -1.025912 1.215702 -0.031235 -0.672864 -0.243819 0.660684 0.675921 0.324319
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.926120 -1.125463 0.305670 -0.344263 1.545474 0.566981 0.214127 -0.031405 0.658464 0.672669 0.330301
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.656482 -0.928619 -0.881936 -1.379734 0.646414 0.310550 -0.578193 -2.044249 0.655980 0.672148 0.332536
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 13.467238 -0.720371 11.057116 -0.686599 9.227082 0.777713 6.329534 3.794240 0.040798 0.666632 0.523114
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.112962 1.985811 -1.436936 -0.429163 -0.966054 0.728738 -0.586736 -0.734148 0.601167 0.605110 0.311025
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 15.010907 16.788763 4.286565 4.991728 9.482713 11.248947 6.780664 11.316561 0.035067 0.040872 0.003971
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.775874 -0.917060 -0.993733 -0.940474 0.917312 16.495948 -0.656197 -0.148618 0.625362 0.650193 0.343696
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.091176 16.594780 -1.485995 11.604706 1.283931 11.145698 9.307592 9.865932 0.642384 0.052296 0.508608
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.662653 -0.013578 1.104170 0.677740 0.040722 -0.385027 0.158557 3.193082 0.647294 0.664737 0.337656
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.483274 15.499530 -1.105219 11.158024 3.626443 11.316802 2.595480 9.886906 0.658082 0.046540 0.478953
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.087593 0.877477 -0.626754 0.233143 0.799349 -0.152457 0.247128 -0.154932 0.649471 0.666839 0.324550
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.673673 -0.795679 -0.921814 -0.312545 -0.591419 -0.202148 -0.676117 0.490560 0.669807 0.680785 0.314334
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 32.663687 -0.156982 -0.097012 -1.373958 10.272239 0.070772 6.061531 -1.514027 0.569346 0.676539 0.322767
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 3.808356 -0.787342 0.532750 -0.181110 -0.582959 -0.798847 0.173829 -1.074718 0.645891 0.680260 0.333473
187 N14 digital_ok 100.00% 18.84% 0.00% 0.00% 11.248226 -0.964246 10.202623 -0.227860 7.847051 1.491499 4.748341 -1.289441 0.267563 0.675087 0.445007
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 11.380766 15.365376 10.297719 11.291256 9.599112 11.353255 7.423896 10.307540 0.028197 0.031104 0.001338
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.918181 -1.367817 -0.624817 0.426881 -0.324978 -0.160348 -0.081635 -0.737475 0.647007 0.664470 0.339387
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 0.632723 0.061823 1.413112 -0.473194 -0.276104 0.235219 5.496359 0.495872 0.628347 0.652336 0.332855
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 2.639485 8.231242 2.518238 4.921499 9.535107 9.074924 1.113905 6.450558 0.613491 0.597511 0.342757
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 8.976285 1.281484 5.183012 1.689362 7.484575 2.561951 2.744061 1.669378 0.573697 0.616867 0.353369
200 N18 RF_maintenance 100.00% 100.00% 42.98% 0.00% 14.516310 44.543120 4.719492 -0.111375 9.468850 5.096066 5.881672 11.987264 0.040739 0.236325 0.158081
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.793734 5.977657 3.259618 4.250043 3.309878 7.606508 2.010834 5.603441 0.623279 0.628492 0.344968
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.966976 4.132432 1.687391 -1.295110 1.028421 -0.688826 0.633045 13.163940 0.639093 0.635791 0.331955
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.330808 18.436099 1.249414 -1.019471 -0.271568 0.921522 7.903177 -0.417586 0.645056 0.672709 0.335005
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 11.483955 1.761996 4.212554 -1.257388 7.482034 -0.892078 3.476736 1.093013 0.359715 0.645479 0.427376
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.052134 6.864186 -0.910431 2.483146 5.580969 4.164394 -0.852241 -0.223165 0.611833 0.551935 0.325111
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.473464 1.080271 -0.672075 -1.153378 -1.016237 4.686698 3.637030 -1.737288 0.634091 0.638046 0.318558
208 N20 dish_maintenance 100.00% 97.46% 97.62% 0.00% nan nan inf inf nan nan nan nan 0.661543 0.629608 0.217136
209 N20 dish_maintenance 100.00% 97.52% 97.62% 0.05% nan nan inf inf nan nan nan nan 0.640174 0.614766 0.166008
210 N20 dish_maintenance 100.00% 97.03% 96.76% 0.16% nan nan inf inf nan nan nan nan 0.654431 0.664314 0.211468
211 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 0.250880 7.040383 -1.417040 -0.091829 -1.245058 -0.012461 -0.877080 -0.619323 0.601695 0.603363 0.317130
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.267346 -1.078877 0.537753 -0.364619 -0.768421 -0.682836 2.480956 -1.086350 0.626535 0.635546 0.339879
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.804015 -0.411704 -0.965786 -0.722463 5.199690 -0.567108 2.299983 -1.173762 0.611570 0.643125 0.342116
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.163110 -0.189295 -0.156637 0.202234 -0.890075 -0.691712 0.718970 -1.047430 0.625543 0.650609 0.337632
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.398709 -0.153834 -1.448384 0.566557 -0.332904 -0.165545 0.204840 0.502997 0.611530 0.651368 0.340676
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 9.106796 7.344715 5.365796 4.798839 7.721588 8.702223 3.044705 6.542095 0.598723 0.622283 0.340736
225 N19 RF_ok 100.00% 0.00% 67.87% 0.00% -0.411426 15.975549 0.824322 5.155710 -0.845666 10.956474 -0.767693 9.022449 0.636890 0.188790 0.495373
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.419474 1.072737 -0.491289 1.316893 -1.057271 2.481548 -1.043167 1.298378 0.629329 0.645389 0.333243
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 5.033675 -0.097493 2.124066 -1.033932 1.681411 3.410598 3.611980 -0.404385 0.526430 0.632874 0.366114
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.084300 -0.171169 1.207282 -1.323719 0.527198 -1.371386 0.513099 -0.880466 0.611819 0.622340 0.324493
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.529312 0.914361 0.845137 1.544685 0.005469 1.428154 -0.566261 0.034831 0.614957 0.630987 0.340917
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 3.326018 -0.277807 0.042815 -1.475620 -0.431149 -1.205405 -0.629095 -1.904744 0.562010 0.616914 0.358136
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.063959 -0.411287 1.029063 0.486705 -0.375459 -0.721252 -0.547925 -0.950014 0.615962 0.633935 0.350593
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.851108 -1.232656 -0.014330 0.154558 -0.726053 -0.702570 -0.236128 -0.006545 0.620389 0.637973 0.347181
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.069576 0.094321 -0.542810 -0.928643 -0.634618 -1.263400 6.445808 1.836637 0.610830 0.636056 0.344482
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.228601 -1.141406 -0.338466 0.229351 -1.013706 -0.774569 0.134596 -0.613492 0.613971 0.643052 0.351287
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 29.196751 0.522043 -0.074174 1.322161 2.823097 1.496255 0.729708 0.977175 0.481568 0.638620 0.342531
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 25.629063 -0.955506 1.203189 -1.537571 3.656961 -1.334684 1.246472 -1.293508 0.491021 0.626142 0.335865
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.828688 -1.156623 -0.909425 -0.857540 0.289965 -0.599221 0.694706 2.276353 0.584814 0.633336 0.342010
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.585642 0.145610 1.249396 -0.501294 0.313150 -0.626005 -0.707868 -1.356926 0.609788 0.627302 0.336639
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 0.165956 17.195367 -0.750927 4.877187 -0.888642 11.267779 -1.068745 8.815457 0.601712 0.038439 0.518829
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.090178 2.528751 0.375549 -0.218326 -0.219762 -0.835764 1.017152 -0.751087 0.606489 0.604318 0.332792
262 N20 dish_maintenance 100.00% 0.05% 2.70% 0.00% 13.088404 14.779207 5.602191 5.791840 5.114073 5.885085 2.505821 7.329627 0.313343 0.298767 0.117838
320 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 17.477515 16.488439 7.234012 7.615338 9.433162 11.319436 5.736590 10.495550 0.055609 0.047884 0.006145
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 3.109820 3.418786 1.187096 1.446847 1.057317 1.408352 0.936537 -0.772849 0.512216 0.537513 0.331714
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.887144 -0.925265 1.278816 -1.415076 0.841037 -0.871230 -0.983534 3.704255 0.537506 0.547661 0.351248
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.975933 -0.301579 -1.093871 -0.909816 30.335223 -1.113040 5.322540 1.967598 0.500887 0.552349 0.323172
333 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.547121 4.849885 -1.169252 -1.380021 -0.592721 0.559258 2.271921 2.912274 0.486421 0.514704 0.321172
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, 7, 15, 16, 18, 19, 20, 27, 28, 29, 30, 32, 34, 36, 40, 42, 45, 47, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 63, 68, 71, 72, 77, 78, 79, 80, 81, 82, 84, 86, 87, 90, 92, 94, 95, 96, 97, 101, 103, 104, 107, 108, 109, 110, 111, 113, 114, 117, 120, 121, 122, 123, 127, 131, 134, 135, 136, 139, 142, 144, 145, 149, 151, 155, 156, 158, 159, 161, 165, 166, 170, 173, 179, 180, 182, 185, 187, 189, 191, 192, 193, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 221, 224, 225, 227, 240, 242, 243, 246, 262, 320, 329, 333]

unflagged_ants: [4, 5, 8, 9, 10, 17, 21, 22, 31, 35, 37, 38, 41, 43, 44, 46, 48, 49, 56, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 83, 85, 88, 89, 91, 93, 102, 105, 106, 112, 115, 118, 124, 125, 126, 128, 132, 133, 137, 140, 141, 143, 146, 147, 148, 150, 157, 160, 162, 163, 164, 167, 168, 169, 171, 181, 183, 184, 186, 190, 220, 222, 223, 226, 228, 229, 237, 238, 239, 241, 244, 245, 261, 324, 325]

golden_ants: [5, 9, 10, 17, 21, 31, 37, 38, 41, 44, 56, 65, 66, 67, 69, 70, 83, 85, 88, 91, 93, 105, 106, 112, 118, 124, 128, 140, 141, 143, 146, 147, 148, 150, 157, 160, 162, 163, 164, 167, 168, 169, 171, 181, 183, 184, 186, 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_2459986.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 [ ]: