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 = "2459952"
data_path = "/mnt/sn1/2459952"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 1-7-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/2459952/zen.2459952.21318.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

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

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1849 ant_metrics files matching glob /mnt/sn1/2459952/zen.2459952.?????.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/2459952/zen.2459952.?????.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 2459952
Date 1-7-2023
LST Range 1.677 -- 11.628 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1849
Total Number of Antennas 196
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 196 (0.0%)
Antennas in Commanded State (observed) 0 / 196 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 59 / 196 (30.1%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 127 / 196 (64.8%)
Redcal Done? ❌
Never Flagged Antennas 69 / 196 (35.2%)
A Priori Good Antennas Flagged 53 / 93 total a priori good antennas:
3, 7, 9, 10, 15, 16, 29, 31, 37, 38, 40, 42,
45, 53, 54, 55, 56, 71, 72, 81, 86, 88, 93,
94, 101, 103, 109, 111, 121, 122, 123, 128,
136, 140, 143, 146, 151, 157, 158, 161, 165,
167, 170, 173, 181, 182, 185, 187, 189, 191,
192, 193, 202
A Priori Bad Antennas Not Flagged 29 / 103 total a priori bad antennas:
4, 22, 35, 43, 46, 48, 61, 62, 64, 73, 82,
89, 95, 114, 115, 125, 132, 135, 137, 139,
207, 211, 226, 237, 238, 245, 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_2459952.csv

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.988420 14.253959 10.123712 -0.879788 8.468567 4.847759 1.172472 9.765479 0.031843 0.354903 0.285154
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.513281 2.159871 0.719688 -0.303235 -0.236475 -0.823305 1.813684 -0.632355 0.622701 0.645301 0.407401
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.003996 -0.158256 0.118759 0.218041 -0.592240 1.220255 -0.557319 -0.308820 0.629987 0.647253 0.405786
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.080652 -0.123788 -1.279069 -0.192974 -0.458870 0.415356 23.183277 22.652810 0.635815 0.651844 0.397399
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.319168 -1.385793 -0.632826 0.126453 -0.462333 0.530482 5.624557 3.833781 0.635935 0.649185 0.393967
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.810561 -1.202590 8.422013 -0.317410 4.536391 0.003761 0.191278 -0.445648 0.463387 0.648981 0.470662
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.012164 -0.569940 -0.790317 -1.276239 -0.448289 0.783155 -0.554606 9.193296 0.626889 0.648258 0.404082
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.216604 17.879720 9.514798 -0.742383 8.468722 5.046939 0.221381 3.179702 0.032560 0.355619 0.276335
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.280497 -0.836057 10.091088 0.837674 8.465425 1.572881 0.950498 4.502484 0.030862 0.652804 0.533593
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.874200 1.786277 0.457263 0.478091 -0.116759 0.373374 0.299002 1.069771 0.637739 0.654095 0.403280
18 N01 RF_maintenance 100.00% 100.00% 55.92% 0.00% 11.959310 20.224554 10.076618 -0.266749 8.598487 7.343156 0.996163 25.368266 0.029198 0.221437 0.171081
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.399848 -0.918084 -1.169046 -0.788805 2.328705 1.871874 3.183227 2.014990 0.638982 0.661363 0.394400
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.775363 -1.490657 2.453216 -0.826850 0.563903 0.162665 0.981537 0.409933 0.635186 0.658212 0.399331
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.023867 0.452297 -0.676190 0.006923 0.041846 1.189266 0.227127 0.177392 0.632034 0.640473 0.393170
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.492787 -0.123085 0.935334 0.538643 0.699177 1.186019 -0.535816 -1.252197 0.600914 0.619071 0.396633
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.500417 12.294603 10.135129 10.657795 8.585605 9.809415 3.483426 2.647174 0.034649 0.037697 0.005295
28 N01 RF_maintenance 100.00% 0.00% 84.59% 0.00% 12.235773 29.625352 -0.436384 1.363678 5.727903 7.217871 9.338746 24.483353 0.366376 0.157906 0.277107
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 11.262435 12.760557 9.718959 10.244572 8.566538 9.786627 1.011531 0.639423 0.029647 0.033976 0.004810
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.000799 -0.060363 -0.289448 0.665757 0.776075 0.747856 3.083070 0.233503 0.645692 0.661308 0.394437
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.374854 0.136641 1.134154 1.392004 0.692991 0.021723 0.978654 5.031113 0.653649 0.654496 0.387819
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.246823 0.079101 -0.104190 1.579911 1.255954 -0.007236 2.095535 16.055033 0.627047 0.646466 0.380399
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.855648 13.990884 4.446276 4.849495 8.570719 9.799414 2.661720 2.306115 0.032693 0.043281 0.007535
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.217440 -0.277666 1.063950 -1.328617 -0.777543 -0.909579 0.757355 0.376581 0.611232 0.608531 0.390820
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.759704 8.658802 0.311530 0.480141 0.437100 1.225025 0.559936 1.919600 0.625272 0.638700 0.407726
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.256527 0.455536 -1.195519 1.582248 0.518794 1.061914 -0.841866 5.971510 0.638385 0.647463 0.408789
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.309851 0.298547 0.262220 0.848623 -0.015250 0.432569 8.569365 2.694797 0.642475 0.655526 0.409735
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 10.559503 0.633632 9.757110 0.635677 8.577845 -0.020315 2.762271 1.321954 0.035439 0.653631 0.518174
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.955291 0.036987 -0.173000 0.128884 1.337276 -0.051749 -0.660516 -0.030243 0.644579 0.660980 0.389743
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.866983 13.283153 10.390599 11.154554 8.361747 9.601982 1.458083 2.855163 0.026884 0.026067 0.001302
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.071327 0.234437 -0.128313 0.738691 -0.460297 -0.003394 -0.284368 1.060123 0.651746 0.660608 0.391324
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.950220 0.129788 -0.119218 -0.468265 -0.581551 0.510318 -0.440310 0.216506 0.654992 0.668785 0.388845
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.051264 4.238845 0.259399 0.582208 -0.720830 1.390544 0.066372 5.686876 0.645428 0.649072 0.378259
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.274943 0.226740 -0.820049 -0.665341 -0.391402 -0.241343 -0.571444 -0.723341 0.646403 0.668976 0.403722
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.972098 13.679960 4.263050 4.466933 8.535015 9.736216 3.488168 2.469516 0.030887 0.047284 0.011810
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.081988 1.426029 1.118892 2.286465 -0.914381 2.058579 -1.169438 -2.733074 0.616386 0.637206 0.398694
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.107074 -0.079459 -1.061917 0.208413 0.611496 -0.884004 0.300716 5.088561 0.564676 0.608666 0.396627
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.535585 3.772969 0.246389 1.080345 0.739856 3.080153 4.908601 20.350880 0.610859 0.618284 0.384528
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 25.536039 4.710021 12.923422 -0.457839 8.701120 5.164342 13.149945 1.127944 0.036871 0.537888 0.415138
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.710127 7.100259 -0.433990 0.651427 0.287088 0.408182 0.890966 0.741845 0.645671 0.657379 0.399448
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.957170 3.369912 0.047832 0.371403 1.104048 1.291185 3.178852 9.190222 0.652625 0.664626 0.404605
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.015811 12.985802 10.151898 10.896862 8.546603 9.765479 3.779069 2.608306 0.026837 0.025895 0.001203
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.545703 13.725086 10.168658 10.796476 8.558496 9.764634 1.589339 4.340142 0.027868 0.029677 0.001970
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% -0.156883 13.828841 0.479055 11.018423 -0.523931 9.681774 1.542327 2.207949 0.651707 0.035515 0.539832
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 27.294912 -0.240812 7.040393 0.657983 5.033759 0.132315 5.054662 2.139564 0.427921 0.669589 0.413368
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.554410 12.632180 10.025641 10.778554 8.513029 9.756065 3.661391 3.423364 0.032871 0.033044 0.001799
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.515496 0.837984 9.556154 1.826492 8.357782 1.298606 1.979855 14.427883 0.045015 0.654049 0.531159
60 N05 RF_maintenance 100.00% 0.00% 99.35% 0.00% 0.604704 12.529871 -0.364202 10.813032 -0.526642 9.741291 3.293169 4.966793 0.646782 0.067665 0.529428
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.982380 -0.056613 -0.475914 -1.326748 1.573935 -1.215884 -0.477479 1.085731 0.587446 0.626261 0.390283
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.568513 1.273418 -0.777158 1.630596 -0.719213 0.482767 2.257681 -1.144180 0.584350 0.634948 0.399813
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.237238 13.032460 0.175775 4.882307 0.076802 9.865584 0.719860 5.183765 0.610676 0.043098 0.488600
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.271536 0.300576 -0.249515 -0.894481 -1.132195 -0.848443 0.727519 -0.237815 0.595117 0.591885 0.381686
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.971048 1.274560 0.548182 1.287067 0.032681 0.106497 -0.520164 -0.028686 0.620296 0.642713 0.415772
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.463831 1.606315 -1.240203 -1.145177 2.140837 -0.407314 -0.259095 1.420661 0.638120 0.656799 0.409372
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.304243 -0.531238 -0.186735 1.421216 -0.597657 0.225830 0.676103 3.149760 0.645860 0.658019 0.401728
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 23.801476 28.789943 1.307997 14.198531 4.782864 9.705194 -0.283524 13.411568 0.364593 0.027543 0.267265
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.473950 -0.629777 0.346416 0.886419 -0.242371 1.420023 -0.053629 0.313121 0.647103 0.664407 0.388899
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.442476 -0.443062 -0.233222 0.106812 0.758012 0.970802 0.366460 0.211906 0.652991 0.669236 0.385856
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.370168 0.058727 0.637121 1.165670 0.139666 -0.702834 1.135857 0.542762 0.665889 0.666471 0.379715
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.021867 13.907006 10.501638 11.181889 8.401214 9.631239 2.198829 2.747574 0.027000 0.025371 0.001626
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.606344 0.870440 -1.304722 -0.365677 0.841144 1.678899 -0.084109 -0.293345 0.663845 0.673001 0.383770
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.561723 1.475884 0.516924 -0.605450 -0.377512 2.163803 -0.759391 6.633869 0.662167 0.668622 0.379620
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 53.454531 1.239486 0.559439 0.266393 7.718802 -0.005473 21.659235 -0.178647 0.386218 0.631145 0.413384
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 36.531427 0.379211 -0.196687 1.578419 2.308915 0.633343 1.114180 5.593906 0.436993 0.639739 0.387854
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.451423 13.377872 -1.160611 4.889662 -0.911153 9.682911 1.870300 0.249841 0.600408 0.038449 0.474092
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -1.049084 14.300316 0.420346 4.792672 0.578677 9.703007 8.314455 1.939127 0.598790 0.046840 0.472117
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% 0.046332 13.546154 -0.031158 9.357200 -1.193850 9.511609 1.462019 2.663585 0.594553 0.036186 0.464956
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.008030 -0.115476 0.384240 2.249106 -0.763153 -0.966191 -0.267230 0.627686 0.615835 0.626509 0.395274
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.568085 0.294122 0.149640 0.550682 -0.214832 -0.568765 -0.625461 0.996369 0.627100 0.647872 0.399155
84 N08 RF_maintenance 100.00% 69.66% 100.00% 0.00% 22.115053 25.555342 13.049003 13.723083 7.067920 9.661545 5.696749 6.783173 0.204431 0.034240 0.133117
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.513385 0.390457 0.001037 0.814922 -1.063452 -0.537952 -0.510060 -0.557269 0.648618 0.661566 0.391575
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.498676 -0.053795 0.954522 1.089291 3.526853 -0.793588 0.559652 26.018368 0.631584 0.649186 0.367738
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.687263 8.055020 -0.373657 -0.019827 7.958137 0.006931 2.057355 0.443255 0.643949 0.680081 0.376774
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.784830 0.624567 0.362161 0.933238 -0.883008 0.011232 4.857534 1.708296 0.655502 0.670082 0.372586
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.150292 0.469466 0.114001 0.967401 -0.560906 -0.935931 -0.626280 -0.184486 0.660480 0.672079 0.375581
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.004569 -0.798177 1.002379 1.495700 -1.069783 -0.476763 0.073233 5.882264 0.654133 0.664107 0.377294
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.195143 -0.101194 0.453332 0.418816 -1.184451 -0.842867 -0.226685 0.070796 0.651523 0.671371 0.389702
92 N10 RF_maintenance 100.00% 0.00% 21.04% 0.00% 38.587578 46.520717 0.606321 1.311605 6.090284 6.816354 0.771727 14.903874 0.285943 0.242160 0.088561
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.070397 0.691554 2.327013 -0.290569 0.874748 0.436710 4.789138 -0.399686 0.637270 0.661538 0.395696
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.127791 13.086653 10.290027 10.671852 8.500344 9.739511 1.679286 1.563203 0.029526 0.026140 0.001764
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.436655 -0.062789 -0.354612 1.282494 -0.908007 0.469767 -1.047187 1.203914 0.612562 0.643616 0.402766
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.342131 13.844735 4.275189 4.967814 8.370102 9.607027 1.361879 1.471703 0.032850 0.037316 0.002247
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.097964 8.872457 -0.885349 3.088655 -1.291346 5.615771 9.001530 4.392337 0.594503 0.471607 0.400683
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.170655 9.430843 -0.423057 1.252213 -0.075217 1.193259 -0.062713 -0.043124 0.647421 0.660025 0.392623
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.720396 1.079886 -0.379915 -1.281192 0.203541 0.236917 -0.347012 9.664069 0.655921 0.669485 0.390228
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.978581 5.974102 4.380649 -0.588209 1.577622 0.660432 9.672794 14.678126 0.630829 0.673154 0.388895
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.762035 65.266155 -0.900137 7.352072 1.251853 0.638032 1.783447 6.093814 0.664428 0.643912 0.377606
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.265764 -0.265679 0.116367 0.989211 0.071466 -0.784310 -0.554708 -0.247856 0.662693 0.671132 0.369742
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.045509 0.940556 3.970704 1.188566 1.546873 -0.285714 0.086335 -0.247758 0.612428 0.667289 0.378780
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.677980 0.011377 -0.883382 -0.880687 0.096179 -0.558542 3.626392 3.635459 0.661403 0.679187 0.377957
108 N09 RF_maintenance 100.00% 100.00% 0.05% 0.00% 11.142630 44.075251 10.075959 0.864743 8.528893 6.909274 2.509498 2.123297 0.034069 0.275390 0.146440
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.902335 12.596920 10.116976 10.535863 8.600738 9.806207 0.714574 2.862206 0.026816 0.026647 0.001350
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 27.870552 27.132169 13.504359 13.924344 8.465370 9.577719 5.972689 6.411509 0.023614 0.025195 0.000914
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.039807 12.514809 0.573925 10.639287 -0.675626 9.811669 2.735336 3.168421 0.648791 0.033839 0.466643
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.238002 -0.750026 0.268170 0.307377 0.375536 2.170207 1.106666 -0.315292 0.639788 0.655096 0.402160
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.198298 13.918983 4.050118 4.857054 8.395003 9.651956 2.180574 0.895916 0.033734 0.030983 0.001646
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.144208 1.017247 -0.869339 0.298759 1.550465 -0.504356 0.684993 -0.491008 0.589499 0.629801 0.401360
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.196456 -0.785098 -0.488478 -0.105969 -0.609074 -0.832663 -1.118484 -0.321294 0.586109 0.614111 0.406471
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.021838 14.224465 10.196746 11.149656 8.422645 9.745330 2.585266 6.179526 0.027639 0.030038 0.001843
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.552094 1.355072 -0.189349 0.711669 -0.625832 -0.271680 0.597392 2.247576 0.611567 0.643366 0.404748
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.571131 1.341461 2.732076 -0.972110 1.205920 1.081007 14.899672 7.928806 0.630027 0.665238 0.389139
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.610920 3.700384 -1.243467 6.154939 -0.018779 0.276170 11.244419 22.461597 0.656574 0.645418 0.372769
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.040306 7.335497 0.334461 0.974019 2.427027 0.738270 -0.404521 -0.545383 0.664030 0.676173 0.380367
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.408940 9.471321 0.715633 1.150836 -0.025596 -0.107792 -0.233139 0.765941 0.669949 0.680308 0.380561
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.661730 0.152381 -0.001037 0.768834 -0.813678 -0.250012 0.980180 0.744995 0.671106 0.679075 0.377156
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.104717 -0.683559 -0.150392 0.958298 0.195620 -0.467428 -0.097896 -0.564627 0.666403 0.676812 0.377842
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.430785 6.977812 -1.012862 1.663513 2.585018 0.372617 3.934578 0.866720 0.665725 0.671516 0.381462
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.027552 -0.192945 0.486365 0.619509 1.128679 0.649805 -0.119855 0.311752 0.659468 0.676862 0.392971
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.123531 12.118366 10.192046 10.775165 8.447366 9.675392 0.437217 1.150325 0.028770 0.027467 0.000957
131 N11 not_connected 100.00% 0.00% 30.67% 0.00% -0.750091 13.070102 0.477816 4.814896 -0.358470 8.849702 -1.331808 -0.079765 0.628338 0.259585 0.447859
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.658225 1.735771 -0.257971 -1.197297 0.231584 -0.784856 2.535188 0.008392 0.604743 0.615888 0.387692
133 N11 not_connected 100.00% 100.00% 0.00% 0.00% 12.661052 -0.357730 4.042804 -1.318904 8.519593 -1.210825 2.259828 -0.544542 0.053548 0.612185 0.482926
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.756708 -1.107183 -0.227499 -1.150275 3.550139 0.452256 2.611321 -0.365130 0.592194 0.627462 0.425639
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 10.119292 0.384733 9.695287 1.314625 8.612078 10.512537 2.279402 0.628794 0.036980 0.619048 0.475602
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.434644 -0.633749 0.048810 -1.301060 0.830399 -1.000119 2.083712 2.591141 0.596128 0.637748 0.412681
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.076186 -0.453844 2.065518 -0.541329 0.615662 -0.744709 -2.237088 -1.059143 0.632286 0.641494 0.388841
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.201198 -0.430509 -1.009734 0.121693 -0.650750 -0.072232 7.422437 5.349442 0.647720 0.672627 0.388148
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.267607 -0.527896 -0.386023 1.086368 0.914984 -0.392129 0.214519 -1.176772 0.653703 0.676271 0.382670
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.353113 12.556920 -0.776318 10.817527 1.840792 9.763061 26.428090 2.931265 0.659158 0.044487 0.532392
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% -1.232602 13.018175 0.885097 10.871203 0.668104 9.603915 0.296535 4.117673 0.661481 0.037714 0.550506
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.130885 0.010389 -1.142718 0.473744 -0.214175 0.543610 -0.672879 -0.248507 0.670663 0.679817 0.377288
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.199141 1.613474 -1.035962 5.459850 -0.216101 11.156839 0.100609 1.389506 0.668134 0.639090 0.388028
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 12.405806 -1.097197 4.054556 0.287204 8.532258 -0.870160 0.636203 -0.606721 0.036405 0.666410 0.520566
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.807620 -1.774191 1.256055 2.476850 -0.947870 -0.874189 -0.256963 0.848043 0.647371 0.659689 0.384632
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.388132 0.099441 -0.646733 -0.521152 1.218366 1.317505 -0.150266 -0.604524 0.652884 0.670936 0.398150
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.467673 -1.483346 -1.166795 -0.957544 -0.459181 0.420803 2.848867 2.736808 0.644655 0.664306 0.401667
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.234296 -0.664714 -0.724254 -0.880914 -1.073944 0.162023 0.146950 1.557260 0.641862 0.657140 0.404082
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 29.423193 0.870835 0.182302 0.521235 2.393396 -0.157246 -0.117557 -0.385520 0.479593 0.597496 0.356066
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.654120 -0.764891 9.789744 -1.267165 8.613900 0.368754 0.933464 2.365725 0.034367 0.627606 0.480781
156 N12 RF_maintenance 100.00% 98.97% 99.24% 0.00% 205.705702 204.532352 inf inf 3851.517137 3856.679451 9399.779952 9437.673655 0.452446 0.377368 0.277826
157 N12 digital_ok 100.00% 98.86% 98.92% 0.00% nan nan inf inf nan nan nan nan 0.529163 0.528158 0.307450
158 N12 digital_ok 100.00% 98.70% 98.76% 0.00% nan nan inf inf nan nan nan nan 0.582977 0.603981 0.317183
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.249578 24.434661 -1.061362 -0.644623 -0.540795 6.586060 -0.131151 32.047916 0.601619 0.546719 0.366129
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.918863 -1.242385 -0.244372 -0.598612 -0.806862 0.787207 1.263309 2.169163 0.641799 0.661945 0.391626
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.068290 30.303305 -0.024132 -0.411172 -0.667350 1.611582 -0.436451 0.947896 0.648597 0.539503 0.343609
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.634074 -1.234443 -0.255895 -0.843253 0.924150 0.833608 2.734086 0.402952 0.663849 0.678575 0.384301
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.601964 1.369009 -0.181086 0.622779 -0.521983 0.154322 0.015333 2.775016 0.666902 0.677273 0.387308
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.172690 0.476157 0.897320 0.003860 3.398811 1.838576 1.465243 2.421252 0.660063 0.678367 0.381057
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 32.543013 0.014471 2.383712 0.709967 3.539535 -0.201396 2.501640 -0.123487 0.505769 0.672630 0.377267
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.172489 0.624507 0.603447 2.881735 0.144948 0.335297 8.596388 11.866762 0.659585 0.661890 0.381932
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.844243 -1.199962 -1.297968 0.113818 0.579674 0.882983 0.476918 6.907753 0.659238 0.670560 0.389550
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.042684 -1.300621 0.210283 -0.278642 0.792869 0.481412 -0.277908 1.951143 0.651876 0.668881 0.398757
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.557956 -0.869330 -0.936204 -1.103279 0.394798 -0.003679 -0.895904 -1.040351 0.652024 0.669358 0.400307
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.808757 -0.862810 10.329287 -1.118044 8.381280 -0.427738 1.355466 2.535059 0.035752 0.664454 0.523164
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.712732 2.627117 -1.228556 0.870639 -1.076267 1.651621 0.002485 0.520376 0.595001 0.577587 0.375663
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 13.374681 13.682750 3.801438 4.501757 8.659574 9.842229 4.471645 9.043175 0.038520 0.042037 0.003418
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.008211 -0.584653 -0.282092 1.073919 -1.027718 8.929860 0.310521 51.852677 0.620642 0.640772 0.402542
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.064997 13.273480 -0.158567 10.953030 0.887355 9.691074 30.666700 3.585599 0.639306 0.049948 0.530238
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.541428 -0.286106 0.103250 0.509424 -0.356417 -0.260785 -0.454305 7.945898 0.649974 0.662802 0.394666
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.322370 12.296147 -1.086822 10.520214 -0.657995 9.825116 20.811427 3.153617 0.660213 0.044845 0.506358
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.539979 0.302582 -0.981761 0.194870 1.161943 0.240138 1.039985 -0.002485 0.653102 0.665221 0.379685
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.131360 -0.813904 -0.734500 -0.250614 0.023455 0.324290 2.790328 0.683236 0.660786 0.676592 0.377741
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 37.119760 -0.203123 3.458568 0.255678 9.547952 -0.201357 1.552911 0.238163 0.498603 0.670269 0.385147
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.787588 -1.235752 -1.108532 -0.093489 0.474728 -0.861364 0.574068 3.866496 0.667867 0.684284 0.395194
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.098783 -0.050904 -1.202575 -0.780381 -0.109894 -0.091945 3.464377 26.948223 0.662599 0.679312 0.389346
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 10.125988 12.109177 9.619724 10.584667 8.675262 9.831845 2.976043 1.939394 0.027958 0.029714 0.000789
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.423141 -1.413559 -0.655509 0.759506 -0.510161 0.003394 -0.312442 -1.489721 0.644153 0.666965 0.409329
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.723605 0.387854 1.338368 -0.318782 0.153282 0.210004 20.749770 1.467454 0.630541 0.652631 0.408386
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.495621 8.367174 5.651698 5.467262 6.715739 8.035133 -5.013203 -4.868410 0.589182 0.607661 0.397132
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 8.065593 0.811645 5.732581 2.100175 6.832706 1.941058 -5.130520 0.361359 0.575674 0.618810 0.421417
200 N18 RF_maintenance 100.00% 100.00% 53.54% 0.00% 12.890929 38.329320 4.220626 1.173506 8.646277 7.644080 2.423677 1.301544 0.038332 0.217057 0.147801
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.112933 6.142252 3.637272 4.758802 4.113217 6.491635 -1.004627 -3.608827 0.635044 0.634733 0.390083
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.605387 1.685075 2.201206 -1.184970 0.692040 0.397333 -1.659172 36.370279 0.645648 0.634028 0.383747
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.801699 2.921368 1.174872 -0.944442 -0.507675 -0.603697 -0.869911 9.682777 0.637288 0.629773 0.376930
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.825179 1.577067 1.808511 -0.459987 11.120000 -0.430572 -1.878363 4.069237 0.640044 0.638861 0.380218
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.222244 3.923910 1.954312 0.033975 0.887522 -0.013561 -1.352890 -1.204503 0.623576 0.625024 0.358742
208 N20 dish_maintenance 100.00% 98.76% 98.70% 0.00% nan nan inf inf nan nan nan nan 0.515312 0.473467 0.411658
209 N20 dish_maintenance 100.00% 98.54% 98.59% 0.00% nan nan inf inf nan nan nan nan 0.546420 0.545536 0.358120
210 N20 dish_maintenance 100.00% 98.38% 98.59% 0.00% nan nan inf inf nan nan nan nan 0.541484 0.453000 0.378559
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.804497 -0.597085 -0.622173 0.476775 -0.401425 -0.354816 3.462867 -0.667340 0.591601 0.624379 0.399069
220 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.479505 -0.740719 0.987137 -0.069066 -0.435700 -0.399607 5.407065 -1.173727 0.629627 0.638827 0.389660
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.387268 -0.224995 -0.594842 -0.316934 0.325230 -0.775613 7.353755 -0.417259 0.617472 0.643947 0.394149
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.198380 -0.087321 0.336904 0.093242 -0.047005 17.366915 3.879312 -0.578004 0.626163 0.646693 0.395028
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.987968 1.329359 -0.958636 -0.996723 -0.533439 -1.011847 0.200100 11.070142 0.616666 0.641992 0.386853
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 8.129827 7.860241 5.859479 5.442615 6.948429 7.820666 -5.387940 -5.061337 0.611593 0.630304 0.386732
225 N19 RF_ok 100.00% 0.00% 90.27% 0.00% 1.761948 13.116442 1.488472 4.648261 -0.709996 9.653443 -1.162238 1.482363 0.638013 0.114498 0.537132
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.074855 1.531724 0.668084 1.796996 -0.838428 1.844394 -1.580086 -1.745478 0.629910 0.652786 0.400273
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.936734 0.737958 -0.949233 0.503775 0.008708 -0.369740 22.848869 -0.898322 0.598714 0.638050 0.392493
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 23.619044 25.333798 -0.385204 0.010354 3.893540 3.458875 24.593256 10.609978 0.477036 0.500283 0.236157
229 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.866357 0.412873 1.937626 1.825103 0.074833 1.051920 6.973736 -2.447012 0.613910 0.634083 0.406118
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.271863 0.000799 -0.143854 -1.156384 -0.229898 -0.619927 -0.545621 -0.805100 0.566510 0.620527 0.412955
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.066741 -0.486245 1.511827 0.867261 -0.425343 0.341824 -2.028578 -2.031813 0.626522 0.640979 0.402592
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.953322 -1.252224 0.464496 0.671425 -0.750209 -0.284981 0.358972 5.199350 0.625320 0.644569 0.400445
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 32.449549 50.152944 0.886891 1.870790 2.968973 6.206474 30.526428 4.510234 0.491046 0.418084 0.244762
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.247461 3.985700 -0.246177 0.656665 -0.939223 0.502930 7.020107 29.368716 0.616443 0.596905 0.392325
242 N19 RF_ok 100.00% 0.27% 0.00% 0.00% 60.483945 2.593131 0.967943 2.188033 6.927672 1.838555 8.119936 -1.245982 0.295268 0.643382 0.493611
243 N19 RF_ok 100.00% 1.46% 0.00% 0.00% 63.710065 2.672812 1.315874 -1.038488 5.016933 -0.609034 -1.706070 0.002841 0.282656 0.622991 0.491060
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.024896 2.039983 1.392963 -0.613829 2.959512 1.296684 3.279326 13.803190 0.503284 0.596766 0.394470
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.665423 2.547377 0.201579 -1.108278 -1.002792 -0.971721 -1.331396 0.782497 0.606766 0.612932 0.395838
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.975647 8.750535 -0.738575 -0.038978 4.595974 5.625463 8.159350 -0.236777 0.321676 0.331018 0.163077
261 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.715528 1.616777 1.302418 -0.013325 -0.328269 -0.521312 -0.212227 13.207995 0.605900 0.613913 0.397750
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 7.233889 8.830782 9.188199 10.063748 8.266642 9.405021 17.946239 24.337323 0.030632 0.027085 0.003204
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 11.790714 13.550249 5.394713 7.065189 4.263481 9.810672 15.669578 4.045751 0.344081 0.043156 0.264363
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.408802 3.044706 1.735062 2.018519 0.292545 1.457782 -1.467177 -2.263159 0.510320 0.531697 0.390100
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.832227 -0.592904 1.830601 -0.927817 1.002312 -0.230218 -2.030225 0.601145 0.534978 0.541361 0.395994
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.150441 -1.079312 1.253623 -0.585621 1.986411 -0.445951 5.662822 -0.008396 0.430601 0.539402 0.399860
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.186211 2.911016 -0.672792 -1.116871 -0.386170 -0.818145 1.007699 -0.172049 0.472899 0.516631 0.384314
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, 8, 9, 10, 15, 16, 18, 27, 28, 29, 31, 32, 34, 36, 37, 38, 40, 42, 45, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 74, 77, 78, 79, 80, 81, 84, 86, 87, 88, 90, 92, 93, 94, 96, 97, 101, 102, 103, 104, 108, 109, 110, 111, 113, 117, 120, 121, 122, 123, 126, 128, 131, 133, 136, 140, 142, 143, 145, 146, 151, 155, 156, 157, 158, 159, 161, 165, 166, 167, 170, 173, 179, 180, 181, 182, 185, 187, 189, 191, 192, 193, 200, 201, 202, 205, 206, 208, 209, 210, 220, 221, 222, 223, 224, 225, 227, 228, 229, 239, 240, 241, 242, 243, 244, 246, 261, 262, 320, 329]

unflagged_ants: [4, 5, 17, 19, 20, 21, 22, 30, 35, 41, 43, 44, 46, 48, 61, 62, 64, 65, 66, 67, 69, 70, 73, 82, 83, 85, 89, 91, 95, 105, 106, 107, 112, 114, 115, 118, 124, 125, 127, 132, 135, 137, 139, 141, 144, 147, 148, 149, 150, 160, 162, 163, 164, 168, 169, 171, 183, 184, 186, 190, 207, 211, 226, 237, 238, 245, 324, 325, 333]

golden_ants: [5, 17, 19, 20, 21, 30, 41, 44, 65, 66, 67, 69, 70, 83, 85, 91, 105, 106, 107, 112, 118, 124, 127, 141, 144, 147, 148, 149, 150, 160, 162, 163, 164, 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_2459952.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.1.5.dev215+gd2b157e
In [ ]: