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 = "2459985"
data_path = "/mnt/sn1/2459985"
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-9-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/2459985/zen.2459985.21297.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

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

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1850 ant_metrics files matching glob /mnt/sn1/2459985/zen.2459985.?????.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/2459985/zen.2459985.?????.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 2459985
Date 2-9-2023
LST Range 3.841 -- 13.797 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
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 122 / 198 (61.6%)
Redcal Done? ❌
Never Flagged Antennas 76 / 198 (38.4%)
A Priori Good Antennas Flagged 50 / 93 total a priori good antennas:
3, 7, 15, 16, 29, 30, 37, 38, 40, 42, 45, 53,
54, 55, 65, 67, 71, 72, 81, 86, 88, 94, 101,
103, 107, 109, 111, 121, 122, 123, 128, 136,
140, 144, 149, 151, 158, 161, 165, 170, 173,
181, 182, 185, 187, 189, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 33 / 105 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 89, 115, 125, 132, 133, 137, 139, 166,
179, 223, 228, 229, 237, 238, 239, 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_2459985.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% 11.343057 14.985243 9.974267 10.719051 7.156198 8.578457 1.038693 1.641559 0.029125 0.030997 0.002421
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.665758 0.752441 2.737789 -0.207084 0.405154 0.305669 18.620526 7.365168 0.580525 0.609457 0.401695
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.016749 -0.936035 0.246950 0.163642 0.105988 1.307827 0.468216 -0.133602 0.606645 0.609983 0.389229
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.968820 0.076260 -1.194559 -0.163684 0.312254 0.011692 15.511643 16.029377 0.612807 0.625109 0.384071
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.184056 -1.387657 -1.027981 0.170702 0.068518 0.630989 -0.030537 3.040968 0.614171 0.623231 0.382431
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.208590 -0.695312 3.145253 -0.968340 -0.565810 -0.021929 3.553359 -0.778670 0.587988 0.626072 0.396332
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.886323 -0.326635 0.904725 -1.259133 0.819833 0.635434 -0.082081 -0.615245 0.603481 0.621984 0.385524
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 11.811743 15.283478 9.918253 10.652425 7.186243 8.601040 0.502871 0.826389 0.026485 0.025616 0.001323
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.624792 -0.738201 9.941806 0.725028 7.158202 1.680595 1.044360 5.354158 0.031592 0.620438 0.502833
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 1.237235 2.019694 0.508683 0.551890 0.457388 1.081297 0.921704 2.110324 0.615691 0.628660 0.389803
18 N01 RF_maintenance 100.00% 100.00% 51.19% 0.00% 12.364061 19.847702 9.932025 -0.133507 7.278299 4.474237 0.951656 23.720745 0.029739 0.217405 0.166295
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.576704 0.850442 -1.008937 0.868710 -0.379909 -0.714378 1.023082 -0.631833 0.623258 0.638824 0.383744
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.473130 -1.591510 0.487981 -0.900375 1.845351 -0.204672 2.315851 -0.197746 0.616941 0.631626 0.380387
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.593866 0.360520 -0.552473 0.112181 0.278131 0.066146 0.079080 0.216430 0.609899 0.615286 0.376636
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.744239 -0.402051 0.122991 -0.261942 0.805063 1.259608 -0.253812 -1.214986 0.575927 0.589641 0.373365
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.408813 13.935110 9.993185 10.526459 7.255821 8.642461 3.120223 2.149682 0.033801 0.036988 0.004441
28 N01 RF_maintenance 100.00% 0.54% 88.00% 0.00% 11.696300 28.686807 -0.173552 3.127210 8.268498 5.108652 6.017452 25.444999 0.360413 0.150197 0.266495
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 11.673496 14.447803 9.597182 10.142721 7.247751 8.627456 0.914978 0.279220 0.029628 0.035203 0.005859
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.784074 0.369181 1.093692 -1.378200 7.255845 0.072277 5.755472 -0.253713 0.615890 0.644959 0.389296
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.093954 -1.317903 0.409795 0.614364 0.468780 -0.116185 -0.060371 2.858297 0.634276 0.639001 0.379260
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.786483 28.986671 0.594335 3.259287 2.017310 0.235202 39.504790 9.110816 0.545764 0.514929 0.276768
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 13.400280 15.772232 4.632831 5.017271 7.213465 8.498678 1.628380 0.967079 0.033382 0.072081 0.027096
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.233803 -0.895975 0.779153 -1.223465 -0.191197 -0.951827 -0.085600 -0.203459 0.590052 0.583520 0.372117
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 29.605847 29.887344 13.125967 13.190686 7.319815 8.527010 7.436144 7.180107 0.031366 0.029210 0.001383
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.472422 0.824171 -1.142213 0.869669 2.226235 1.494253 -0.668177 5.310596 0.614772 0.618649 0.399062
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.683878 0.117275 0.372227 0.707551 -0.244354 0.148243 5.650194 2.739923 0.619316 0.615147 0.394366
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 10.946807 2.153404 9.626215 0.650129 7.256110 0.086834 3.105009 2.588027 0.036803 0.611112 0.471286
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.552314 0.601506 -0.177224 0.203018 1.253006 0.590322 0.849527 2.750002 0.618260 0.636334 0.376699
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.195178 2.773658 -1.338189 8.348109 1.062658 1.876346 -0.092599 1.155227 0.637509 0.533623 0.418226
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.175134 -0.008544 -0.238278 0.738525 0.160886 0.472900 -0.747995 1.744897 0.621118 0.627375 0.374411
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.508068 0.462750 -1.275806 0.247969 -0.732881 0.484306 -0.870363 -0.510148 0.628013 0.640433 0.375866
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.006988 4.538512 0.356730 0.742498 -0.521681 1.949686 1.694641 15.962441 0.619651 0.622457 0.368830
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.778811 0.198046 -0.675687 -1.071288 -0.472635 -0.394320 -0.078297 -0.782468 0.621630 0.640606 0.386250
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.438472 15.358945 4.537308 4.692170 7.215462 8.530995 3.685445 0.771001 0.030947 0.052929 0.015465
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.057692 1.578542 -0.350049 1.471238 1.070859 1.280298 -0.497144 -2.752312 0.587717 0.608443 0.379803
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.290391 -0.064499 -0.768315 0.028685 -0.321114 -0.597569 0.376592 1.306285 0.548691 0.587064 0.376989
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.016214 23.508064 0.515526 1.619644 0.036904 1.784909 18.711205 86.813390 0.595112 0.531279 0.372974
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 11.665547 5.017981 0.091672 1.809779 3.906339 3.564587 57.248630 5.503310 0.497058 0.507999 0.256077
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.762909 7.654463 -0.432283 0.676048 0.849786 0.807979 3.871457 3.633748 0.622346 0.629473 0.390199
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.367048 3.650056 -1.380055 -1.339112 0.715985 12.694155 3.761813 3.354934 0.634493 0.641827 0.394004
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 30.598344 -0.646206 4.611091 -0.581810 1.312836 0.505374 5.242663 2.050674 0.454720 0.642716 0.381549
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.968681 15.422419 10.014013 10.654569 7.248992 8.605047 2.245609 4.287468 0.028017 0.030600 0.002538
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.402517 0.564114 -0.575262 1.492652 -0.545390 0.139666 -0.056389 0.372425 0.627933 0.648664 0.376245
57 N04 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.896002 0.391388 9.764767 -1.404434 7.038797 0.066014 2.650349 2.721613 0.044194 0.652946 0.513739
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.896457 14.360271 9.882751 10.639926 7.160097 8.550483 3.166454 2.531553 0.034870 0.034680 0.001436
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.151657 0.948604 9.940528 1.162536 7.058226 2.244393 2.070097 4.017172 0.045446 0.629378 0.497169
60 N05 RF_maintenance 100.00% 0.00% 99.95% 0.00% 0.192332 14.258961 -1.020288 10.669923 -0.511938 8.558881 0.268695 3.495947 0.619011 0.067957 0.502558
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.702118 0.056689 0.084014 -1.197158 1.947327 -1.368106 -0.533574 0.918217 0.562415 0.601645 0.373514
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.196319 1.151287 -0.762353 0.955366 1.339431 -0.210195 1.164030 -1.134851 0.567214 0.607176 0.378923
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 1.797759 14.799878 -0.462255 5.092533 -0.055563 8.656714 0.248329 3.430468 0.583488 0.043562 0.467525
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.109197 -0.193479 -0.836488 -0.743662 -0.663788 -1.335460 0.254890 -0.191588 0.579322 0.573657 0.364504
65 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.061618 1.893530 0.674708 0.144025 -0.422742 0.278028 1.043160 13.911452 0.600413 0.608666 0.396738
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.201080 2.121194 -1.400123 -0.948399 1.598057 -0.054327 -0.006813 0.800957 0.616231 0.631018 0.398400
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.355977 -0.245767 -0.657543 0.718050 -0.627954 0.213750 1.092606 5.501695 0.624948 0.628580 0.386160
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 21.021551 30.464353 0.906856 13.848856 4.089599 8.513852 0.291743 11.823459 0.365099 0.028849 0.274131
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.020028 -0.539259 0.525811 0.856947 -0.708282 1.070919 0.801994 0.628247 0.625859 0.642941 0.373893
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.026611 -0.336273 -0.172026 0.089233 0.841584 1.326132 1.826555 1.573110 0.635891 0.650145 0.374542
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.935725 0.040583 0.632818 1.212503 0.128843 -0.180376 1.883952 2.371699 0.631090 0.654035 0.372368
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.086422 15.613901 10.343930 11.019454 7.091060 8.449516 1.889703 2.066490 0.034045 0.037504 0.004721
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.640186 0.934469 -1.311671 -0.689406 0.758830 -0.185265 0.094718 -0.161690 0.636763 0.646852 0.372772
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.571204 0.071660 -0.123291 -0.412632 -0.685193 1.325732 -1.124588 3.068185 0.631877 0.638021 0.370369
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 61.912742 22.326964 0.502595 -0.484615 4.427797 3.436644 -0.216355 14.873141 0.320253 0.511582 0.322820
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 34.731824 0.982230 -0.457262 1.236438 1.588198 0.238647 3.642595 0.634328 0.431191 0.620287 0.374243
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 0.351295 15.117791 -0.730804 5.099831 -1.167786 8.499671 -0.598951 -0.383588 0.599990 0.040440 0.470496
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.671213 16.089751 0.252150 5.009527 -0.952759 8.525984 -1.500293 1.348904 0.602499 0.050058 0.470744
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.005875 15.221719 0.100532 9.310852 -0.230939 8.323926 -0.226979 2.075559 0.578239 0.037135 0.449645
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.387786 5.846292 0.467057 2.498426 0.077234 -0.720287 -0.583960 -0.038315 0.597985 0.592766 0.377563
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.103486 0.411861 0.271466 0.496309 0.344611 -0.658578 -0.647626 0.551877 0.612991 0.618768 0.381163
84 N08 RF_maintenance 100.00% 66.00% 100.00% 0.00% 21.979760 27.280308 12.674097 13.424402 5.784320 8.474439 4.976752 5.616583 0.203825 0.036103 0.131923
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.130166 0.682063 0.901058 1.439610 0.761824 0.345565 -0.478245 0.347140 0.626944 0.638184 0.374507
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.574399 0.057899 1.874931 1.827546 1.841301 -0.010930 0.678792 21.333013 0.613655 0.635182 0.361069
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.053250 8.235078 -0.032772 -0.113163 8.739812 1.013404 15.371947 4.509373 0.600503 0.659770 0.360156
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.549133 0.512508 0.406291 1.015679 -0.712434 -0.937028 6.767400 2.249529 0.635530 0.649143 0.365316
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.026727 0.713320 0.284106 1.053812 -0.923185 -0.413722 -0.471914 -0.457431 0.636818 0.651765 0.367566
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.405793 0.099962 -0.254060 -1.368373 3.217347 6.306777 0.523382 12.447902 0.640272 0.658243 0.375728
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.270911 -0.157996 0.551336 0.522967 -0.945089 -0.398777 0.395839 0.232705 0.627425 0.649781 0.379623
92 N10 RF_maintenance 100.00% 0.00% 16.81% 0.00% 37.042834 46.386381 0.541096 1.658985 3.520750 3.989963 1.578246 10.290890 0.289164 0.247093 0.070092
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.247906 0.524603 2.474432 -1.010516 0.050620 0.700173 3.550482 1.201222 0.622663 0.643900 0.383886
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.523412 14.809572 10.086183 10.539825 7.205934 8.561897 1.226319 0.746877 0.031127 0.026204 0.002318
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 7.688266 4.282466 -0.821990 0.616464 0.626543 0.153531 0.971797 -0.087849 0.549299 0.593250 0.349873
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.003667 21.339326 3.462352 1.545643 3.173141 2.284380 -3.860962 -2.606521 0.601346 0.508293 0.357374
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.314969 4.979743 -1.083617 1.215777 7.515448 1.360703 2.627372 10.665558 0.580590 0.547658 0.371665
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.858109 8.721156 -0.225327 1.250141 0.154933 1.173100 0.750509 1.042834 0.630235 0.635494 0.377031
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.557463 1.328938 -1.355923 -0.791730 0.217039 0.500927 -0.590449 6.261858 0.633133 0.648344 0.375882
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.718693 4.031180 3.224744 -1.288225 2.734811 0.454124 -2.855794 6.082005 0.627778 0.646256 0.368047
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.380658 65.899868 -0.709090 7.126842 0.542941 -0.551961 0.427609 1.582580 0.645217 0.625715 0.372357
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.041794 0.263213 0.205568 1.078375 0.603986 -0.423101 -0.463304 -0.346582 0.643644 0.651123 0.365768
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.982934 -0.598634 -0.985816 -0.209860 -0.318370 -1.019736 -0.225815 0.360551 0.643543 0.640681 0.362166
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 5.179183 3.498715 -0.881707 -0.276200 -0.308078 -0.034560 16.289800 12.184012 0.640300 0.657202 0.363854
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.525893 45.913178 9.929228 1.041365 7.215492 3.372369 2.105896 2.586017 0.033953 0.284451 0.162003
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.293807 14.383510 9.968577 10.415000 7.281663 8.630265 0.644563 2.044443 0.026149 0.028694 0.001745
110 N10 RF_maintenance 100.00% 33.35% 0.00% 63.14% 17.820367 18.613710 10.866348 5.454503 2.925710 8.083576 2.412832 3.841618 0.163021 0.285711 -0.167515
111 N10 digital_ok 100.00% 0.00% 99.95% 0.00% 36.948314 14.227802 1.207240 10.502703 1.200186 8.620191 -0.086699 2.479065 0.486211 0.061796 0.317484
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.426038 -0.767240 0.289044 0.215626 0.399977 1.730375 0.368648 -0.248511 0.625942 0.632686 0.385120
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.628170 15.791226 4.275133 5.094373 7.102147 8.479108 2.020171 0.700819 0.035291 0.031247 0.002107
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 4.362973 1.208679 0.549650 -0.214146 3.723966 -0.927384 -1.155314 -0.034244 0.572747 0.603730 0.375200
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.338845 -0.921099 -1.137286 -0.015260 -0.829330 -0.965309 -0.207489 -1.171685 0.570057 0.598170 0.387954
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.458567 16.002827 10.043809 10.990208 7.103616 8.548919 1.451402 4.549099 0.028293 0.031514 0.002341
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.467421 1.840864 0.044193 0.730640 -0.813940 0.360912 0.067775 0.698765 0.610042 0.625312 0.388512
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.636808 1.811395 2.739703 -0.783729 -0.388341 -0.247672 1.760194 -1.424885 0.621172 0.648494 0.380681
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.346917 5.331122 -1.178210 1.654083 -0.271381 0.743594 6.701024 21.678807 0.643467 0.651842 0.371461
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.750987 7.732067 -1.020414 -1.164887 0.440711 0.637809 0.503792 -0.960348 0.643923 0.660726 0.373361
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.787564 9.657935 0.838934 1.173905 0.194686 0.552386 0.231091 1.713686 0.650810 0.658541 0.373326
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.224629 0.458750 0.267167 0.786922 -0.706505 0.348457 1.867668 1.253428 0.650622 0.657964 0.374728
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.190525 -0.850520 0.229440 1.126177 -0.330061 -0.907748 0.461614 -0.310161 0.644703 0.652090 0.372533
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.656565 5.786947 -0.657215 1.767283 2.808329 0.275033 41.227204 2.004064 0.638692 0.645883 0.372289
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.624543 0.598208 0.455632 0.493078 1.658369 1.091691 2.086332 3.998748 0.641837 0.658506 0.380654
128 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -0.459945 -0.627539 -1.335758 -0.320942 -0.642841 -0.130862 0.137441 6.251930 0.645995 0.656208 0.384139
131 N11 not_connected 100.00% 0.00% 7.08% 0.00% -0.045065 14.213866 -0.063235 4.979726 -0.775436 7.570711 -1.081897 -0.036325 0.606531 0.273866 0.428342
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.816103 0.312475 -0.528669 -1.358213 0.559127 -1.162484 0.006813 -0.430300 0.590430 0.599423 0.374087
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.660341 -1.532969 -1.386465 -0.601903 -1.253996 -1.185528 -0.540833 1.817337 0.575414 0.602256 0.390304
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.175282 16.044324 4.418368 5.067649 7.102955 8.559827 0.442634 0.791091 0.040246 0.034432 0.003043
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.757187 -1.178792 -1.046888 -1.431926 1.566667 0.489158 14.912489 -0.162475 0.583912 0.608587 0.401229
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 10.533786 4.626973 9.567834 -0.473939 7.279150 0.811017 1.950550 0.020446 0.039647 0.594159 0.447235
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.051685 -0.403227 0.095025 -1.433674 1.187618 -0.349540 1.450823 2.732023 0.593204 0.621303 0.391349
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.534989 1.500301 1.336053 -0.833124 0.238524 -1.167339 -0.619552 0.179973 0.618414 0.615597 0.371763
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 12.085532 -1.366284 -1.078421 -0.356615 7.246334 -0.465279 158.457144 20.527561 0.595270 0.644000 0.369297
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.985760 -0.580611 -0.257552 0.409764 0.827253 -0.899141 2.207185 -0.953803 0.635807 0.654716 0.372683
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.456912 14.300886 -0.770831 10.675858 1.680094 8.598208 20.549597 1.926432 0.642759 0.045972 0.526490
143 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.351680 -0.674629 -1.047241 -0.248806 0.206079 2.910099 1.279445 0.904266 0.650240 0.658409 0.374828
144 N14 digital_ok 100.00% 0.00% 0.05% 0.00% -0.315244 9.858806 -1.199083 10.029506 -0.111949 10.291353 -0.795968 2.472964 0.652633 0.318292 0.481865
145 N14 RF_maintenance 100.00% 72.27% 100.00% 0.00% 15.874524 14.436071 8.805109 10.713487 5.182641 8.633778 0.234332 3.849291 0.189923 0.030232 0.126683
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.543801 0.459645 -0.944192 0.296358 -0.956464 -0.136463 -0.743958 -2.139210 0.624365 0.644451 0.370433
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.118678 -0.745789 1.398902 2.367461 -0.485456 -0.656978 -0.082551 0.627567 0.631391 0.633307 0.369807
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.140775 0.285193 -0.564638 -0.484092 0.727286 1.262333 -0.512720 -0.657573 0.634866 0.649867 0.384398
149 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 0.083014 -1.182641 -0.905369 -1.308670 9.753804 0.490897 17.952916 -0.364356 0.629577 0.643653 0.389027
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.280017 3.334285 -1.219647 -1.320821 -0.837656 -0.916345 0.565641 1.144649 0.625442 0.618405 0.382811
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 26.989471 0.887584 -0.364208 0.628672 2.199332 -1.100411 2.966323 -0.390428 0.472235 0.575716 0.341627
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.197824 -1.030999 9.722209 -0.951794 7.303152 3.213728 2.706043 3.786307 0.041263 0.610151 0.469981
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.149243 13.991533 7.823937 10.425452 2.397417 8.659236 1.677296 2.463065 0.449574 0.038602 0.351414
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.640336 -0.190986 0.064133 0.759424 -0.099736 1.036625 -0.216444 -0.157993 0.599613 0.618965 0.387916
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.545979 -0.637559 -0.187222 -0.740931 1.622766 1.348372 4.266819 15.019246 0.613831 0.634492 0.389944
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.358450 31.408510 -1.373274 -0.579426 -0.664261 3.612942 -0.534838 35.366233 0.587046 0.483848 0.349422
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.533571 -1.090081 -0.415334 -0.651392 -0.473991 1.342899 -0.626671 1.218670 0.627056 0.643093 0.378753
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.742360 32.255039 0.104427 -0.342822 -0.089037 0.720099 -0.391900 1.577891 0.633876 0.517319 0.345465
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.392834 -1.029635 0.003492 -1.181868 0.070961 0.640520 3.162645 -0.235726 0.646664 0.657694 0.376558
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 1.076425 1.949896 -0.076327 0.566678 -0.019026 1.232021 -0.090864 2.485038 0.647510 0.657363 0.379390
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.033837 0.046679 -0.018834 0.797813 1.851808 1.820320 -0.043052 0.332383 0.645097 0.649037 0.370994
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 33.284031 0.510791 -0.397538 -0.911344 4.185455 0.094667 7.316796 -0.224908 0.508946 0.657593 0.367496
166 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.936914 3.527125 -1.321239 2.765175 -0.076518 3.559799 1.498829 -2.912050 0.630049 0.643191 0.370157
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.860571 -1.190250 -1.388016 -0.820481 0.493632 0.286420 -0.723943 1.758197 0.638671 0.650024 0.377777
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.255329 -1.000973 0.249704 -0.145906 1.116096 0.612816 0.068859 1.212415 0.633150 0.640934 0.381731
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.405292 -0.785234 -0.837913 -1.424886 0.370453 0.268652 -0.794059 -1.196245 0.631145 0.644354 0.385756
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 12.390820 -0.578313 10.235351 -0.545815 7.106737 1.795500 3.643889 8.904704 0.039736 0.637131 0.501866
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.822776 1.610959 -1.413466 -0.244877 -1.060231 -0.102197 -0.517615 0.900129 0.577840 0.571489 0.362462
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 13.852973 15.289979 4.022393 4.731149 7.318547 8.683600 4.036824 7.531977 0.036060 0.041161 0.003801
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.674353 -0.880638 -0.647693 -1.129436 -1.035765 1.067986 -0.265798 -0.396121 0.607988 0.630035 0.389662
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.219152 15.039710 -1.429882 10.804673 0.449839 8.518054 19.413062 2.743716 0.627676 0.051894 0.522692
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.764623 0.036164 1.077574 0.837663 -0.585270 2.711467 -0.023637 27.552240 0.629828 0.641530 0.383871
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.434438 14.017117 -0.872422 10.400560 11.584559 8.657785 10.414465 2.287985 0.641806 0.046858 0.494636
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.357945 0.900233 -0.003492 0.966313 0.379678 0.233288 1.916946 1.019817 0.630730 0.642962 0.369207
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.555068 -0.776826 -0.993743 -0.207024 -0.510646 0.209492 -0.658078 -0.021704 0.648861 0.654425 0.365462
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 38.861307 -0.168317 0.370180 -1.186891 7.547957 0.270563 9.934084 -0.482460 0.511639 0.653567 0.370678
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 3.543265 -0.765210 0.364775 -0.418226 -0.480504 -1.024998 -0.658397 -0.978517 0.626352 0.658108 0.378953
187 N14 digital_ok 100.00% 23.95% 0.00% 0.00% 10.195688 -0.882982 9.444070 -0.268650 5.708635 0.646741 1.223121 -0.151236 0.236874 0.650709 0.465409
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 10.266266 13.880249 9.536717 10.523630 7.337679 8.681833 7.320084 3.590081 0.028381 0.031127 0.001259
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.081152 -1.467225 -0.562304 0.124986 -0.161086 -0.767430 -0.140306 -1.634186 0.624415 0.641273 0.392268
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 0.523716 -0.054981 1.381995 -0.320759 -0.336069 0.594815 11.026835 1.087101 0.603214 0.626973 0.392266
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 4.044758 7.586598 3.117202 4.308932 5.018913 6.953438 -0.363376 -4.927725 0.587575 0.572314 0.385612
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 8.047768 0.963848 4.600755 1.302809 5.758297 1.446943 -4.692021 0.299210 0.554876 0.589054 0.401298
200 N18 RF_maintenance 100.00% 100.00% 65.03% 0.00% 13.360224 41.903499 4.420747 -0.158631 7.296683 4.064723 2.089494 14.242494 0.041169 0.205992 0.137105
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.287389 5.523690 2.868136 3.687748 2.428518 5.588369 -1.265031 -3.839534 0.610101 0.611237 0.376633
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.599900 3.822533 1.407868 -1.298148 0.693483 -0.793299 -0.769955 39.653522 0.624357 0.612428 0.374109
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.452478 17.477661 1.277231 -0.986402 -0.524777 0.491682 22.843202 1.962370 0.624239 0.651116 0.381225
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 10.521771 1.464660 3.276829 -1.302352 5.378643 -0.991532 0.268374 6.685114 0.341196 0.619586 0.450992
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.065252 6.521904 -0.529085 2.407300 1.592052 2.331001 0.013129 1.287680 0.581613 0.512484 0.371372
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.659230 -0.077391 -0.747222 -1.332043 -0.887655 7.224708 9.533002 -0.711312 0.611999 0.615297 0.371405
208 N20 dish_maintenance 100.00% 98.86% 98.76% 0.00% 196.407896 194.669572 inf inf 2742.725692 2799.597884 7288.594755 7868.909349 0.395634 0.457176 0.295125
209 N20 dish_maintenance 100.00% 98.22% 98.00% 0.00% 230.294772 229.675188 inf inf 3177.394760 3161.089932 9019.715539 8965.613336 0.490422 0.507551 0.316930
210 N20 dish_maintenance 100.00% 98.59% 98.49% 0.00% 229.819665 229.045881 inf inf 3029.814554 3031.305911 7899.709995 7960.749814 0.500095 0.503213 0.308718
211 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 0.103305 6.663863 -1.394721 -0.275712 -1.091301 -0.434182 -0.268825 0.053004 0.574034 0.569108 0.367813
220 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.501961 -1.349097 0.397616 -0.516652 -0.792660 -1.196529 4.792693 -1.285368 0.613138 0.615272 0.377421
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.411537 -0.647110 -0.730614 -0.858111 6.635533 -1.333078 11.175069 -0.757285 0.597603 0.622420 0.379244
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.156012 -0.255635 -0.168729 -0.012419 -0.848962 -1.085096 5.006342 -1.218745 0.609591 0.629906 0.377704
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.689231 -0.097124 -1.310635 0.305124 -0.752035 -0.018191 1.356959 0.690585 0.592668 0.630437 0.382097
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 8.154091 6.793453 4.773605 4.193219 5.963354 6.633364 -4.655356 -3.894175 0.583760 0.603252 0.372031
225 N19 RF_ok 100.00% 0.00% 89.08% 0.00% -0.461000 14.390586 0.680884 4.875191 -0.995882 8.345335 -1.637674 1.865166 0.617070 0.141198 0.505587
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.440444 3.902791 -0.532844 0.903417 -1.331823 3.444734 -1.151125 12.621327 0.606022 0.603280 0.376127
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 4.435008 0.106431 1.967420 -1.091713 1.128845 6.479981 8.640402 2.998805 0.496773 0.604981 0.412878
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.820036 -0.286390 0.984379 -1.405959 0.215859 -1.145110 1.178076 1.405305 0.588018 0.591380 0.375010
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.237884 0.736782 0.508171 1.189600 -0.171068 0.575413 -0.398907 -2.732644 0.588503 0.602513 0.393439
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.907689 -0.488022 0.019905 -1.440164 -0.697734 -0.978832 0.108218 -1.168335 0.548433 0.598612 0.392779
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.546223 -0.598224 1.292284 0.771967 0.034529 -1.061546 -2.237545 -2.509523 0.602335 0.615534 0.385459
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.587099 -0.449785 0.333312 0.515699 0.018191 -0.894148 -0.327810 -0.472205 0.605927 0.619227 0.384705
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.839655 -0.169514 -0.610936 -1.048795 -0.582231 -1.573679 11.185773 6.335391 0.593805 0.615100 0.383620
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.350882 -1.120153 -0.398036 -0.009751 -1.235085 -1.165797 1.430036 -1.123156 0.595923 0.621851 0.392222
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 18.423803 0.506891 0.253598 0.981403 2.624849 0.547721 4.515534 -0.319019 0.510788 0.617653 0.390838
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 23.719510 -1.001541 1.021288 -1.405942 2.406059 -1.174430 -0.486365 -0.025118 0.467688 0.598319 0.379659
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.556703 -1.354583 -0.831789 -1.056895 -0.561258 -0.268809 3.454778 9.769156 0.558206 0.606086 0.391082
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.390586 0.008544 1.022225 -0.673295 0.069553 -1.355143 -2.085956 0.359999 0.585381 0.598044 0.385027
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.174971 15.563391 -0.795471 4.625803 -0.885920 8.628127 -0.028432 0.028804 0.575440 0.038376 0.495049
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.216221 2.296910 0.269034 -0.405058 -0.789908 -0.994693 1.339303 2.875621 0.583131 0.574270 0.381325
262 N20 dish_maintenance 100.00% 0.11% 1.89% 0.00% 12.742170 13.628475 5.132571 5.386861 3.622211 4.172299 0.590611 3.214265 0.272839 0.258949 0.122766
320 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 16.286757 15.070397 6.731964 7.144193 7.264903 8.653383 1.779321 3.695431 0.055134 0.047073 0.006353
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 2.715459 2.758972 0.966905 0.901745 0.548662 0.560096 2.739750 0.443536 0.487054 0.507703 0.370703
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.474934 -0.914751 1.048589 -1.462238 0.321150 -1.382029 -1.783439 -0.151880 0.523663 0.526757 0.387481
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.854201 -0.437212 -1.309860 -1.008151 29.586883 -1.282018 5.926773 0.181972 0.471634 0.517262 0.378360
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.859376 3.659403 -1.105556 -0.832202 -0.940720 -0.857818 1.400290 2.821170 0.476513 0.499010 0.362080
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, 15, 16, 18, 27, 28, 29, 30, 32, 34, 36, 37, 38, 40, 42, 45, 47, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 63, 65, 67, 68, 71, 72, 77, 78, 79, 80, 81, 82, 84, 86, 87, 88, 90, 92, 94, 95, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 113, 114, 117, 120, 121, 122, 123, 126, 128, 131, 134, 135, 136, 140, 142, 144, 145, 149, 151, 155, 156, 158, 159, 161, 165, 170, 173, 180, 181, 182, 185, 187, 189, 191, 192, 193, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 220, 221, 222, 224, 225, 226, 227, 240, 242, 243, 244, 246, 262, 320, 329]

unflagged_ants: [5, 8, 9, 10, 17, 19, 20, 21, 22, 31, 35, 41, 43, 44, 46, 48, 49, 56, 61, 62, 64, 66, 69, 70, 73, 74, 83, 85, 89, 91, 93, 105, 106, 112, 115, 118, 124, 125, 127, 132, 133, 137, 139, 141, 143, 146, 147, 148, 150, 157, 160, 162, 163, 164, 166, 167, 168, 169, 171, 179, 183, 184, 186, 190, 223, 228, 229, 237, 238, 239, 241, 245, 261, 324, 325, 333]

golden_ants: [5, 9, 10, 17, 19, 20, 21, 31, 41, 44, 56, 66, 69, 70, 83, 85, 91, 93, 105, 106, 112, 118, 124, 127, 141, 143, 146, 147, 148, 150, 157, 160, 162, 163, 164, 167, 168, 169, 171, 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_2459985.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 [ ]: