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

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

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

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2459906/zen.2459906.25256.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/2459906/zen.2459906.?????.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/2459906/zen.2459906.?????.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 2459906
Date 11-22-2022
LST Range 23.602 -- 9.559 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 7
dish_ok: 1
RF_maintenance: 52
RF_ok: 19
digital_ok: 98
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 18
Nodes Registering 0s N20
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 72 / 201 (35.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 133 / 201 (66.2%)
Redcal Done? ❌
Never Flagged Antennas 65 / 201 (32.3%)
A Priori Good Antennas Flagged 62 / 98 total a priori good antennas:
3, 7, 9, 10, 15, 19, 20, 21, 29, 30, 31, 37,
38, 42, 45, 51, 53, 54, 55, 56, 59, 68, 71,
81, 84, 86, 93, 94, 101, 103, 107, 108, 109,
111, 117, 121, 122, 123, 130, 136, 140, 142,
143, 146, 155, 158, 161, 164, 165, 167, 169,
170, 181, 182, 183, 185, 186, 187, 189, 190,
191, 202
A Priori Bad Antennas Not Flagged 29 / 103 total a priori bad antennas:
22, 35, 43, 46, 48, 62, 64, 79, 82, 89, 115,
120, 125, 132, 137, 138, 139, 148, 149, 168,
207, 220, 221, 223, 238, 324, 325, 329, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459906.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.403697 -0.317995 9.314435 0.281895 7.914404 1.091762 0.877064 4.236010 0.033296 0.665269 0.544156
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.700025 1.614319 2.001484 0.769899 4.454455 4.540899 13.169186 34.132469 0.659004 0.664054 0.411571
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.642572 0.131162 -0.407858 -0.429966 0.231016 1.935703 0.863827 0.046908 0.657038 0.666758 0.410178
7 N02 digital_ok 100.00% 26.11% 26.11% 0.00% -1.242016 -0.859478 0.635004 2.565267 0.254428 0.398475 15.842524 19.982745 0.513463 0.512420 0.322614
8 N02 RF_maintenance 100.00% 26.11% 26.11% 0.00% 0.578549 -1.434688 -1.074254 -0.380826 0.123972 1.027174 6.247462 4.538092 0.516105 0.519282 0.322058
9 N02 digital_ok 100.00% 26.11% 26.11% 0.00% 4.272988 -0.534805 7.679436 -0.009494 4.649833 0.497084 0.393318 -0.328506 0.385924 0.516480 0.376153
10 N02 digital_ok 0.00% 26.11% 26.11% 0.00% -0.338564 -0.577218 -1.353782 -0.857079 -0.145906 1.190532 -0.545275 0.771809 0.503634 0.507642 0.326202
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.611320 0.058659 8.735449 0.914059 7.917876 0.887720 0.111235 8.589205 0.032920 0.667534 0.533635
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.424590 -1.066537 -0.693837 0.171204 1.638068 1.886593 1.291275 2.199882 0.664362 0.671881 0.409770
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.604430 0.712272 -0.259135 -0.162081 1.213134 0.860160 0.498285 0.408912 0.659665 0.674747 0.408828
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.925236 10.165536 -0.720380 0.081119 0.746718 0.805994 16.167643 26.286750 0.649914 0.452591 0.478737
19 N02 digital_ok 100.00% 26.11% 26.11% 0.00% 0.061301 -1.397805 0.542979 1.010299 0.190269 2.460989 3.618202 8.957111 0.510493 0.523301 0.315368
20 N02 digital_ok 0.00% 26.11% 26.11% 0.00% -1.192406 -1.238488 3.250189 -1.089327 0.118154 -1.093346 1.930311 -0.429927 0.504941 0.529268 0.329397
21 N02 digital_ok 100.00% 26.11% 26.11% 0.00% -0.005750 -0.265513 -0.513468 4.026007 1.414655 0.385745 0.622793 0.132824 0.507054 0.494547 0.329077
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.605999 -0.296547 0.534693 0.042046 1.719252 1.962090 -0.773228 -0.920953 0.616462 0.639492 0.403049
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.142314 11.550807 9.339703 9.899271 8.071076 8.514249 2.754086 2.427538 0.032044 0.036656 0.004880
28 N01 RF_maintenance 100.00% 0.00% 85.78% 0.00% 12.570958 27.202338 1.044899 0.794688 2.948005 4.905869 6.623287 16.945526 0.356825 0.159030 0.254944
29 N01 digital_ok 100.00% 0.00% 100.00% 0.00% -1.406298 12.018556 -0.376717 9.504912 0.156564 8.498260 -0.451613 0.578606 0.664775 0.035687 0.567086
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.654603 -0.293904 -0.815580 0.145566 1.227208 0.300687 38.342295 0.343708 0.664109 0.680088 0.399607
31 N02 digital_ok 0.00% 26.11% 26.11% 0.00% 0.009326 -1.190762 0.782799 0.937254 2.190188 0.717947 3.358736 1.813701 0.526930 0.526964 0.316449
32 N02 RF_maintenance 100.00% 26.11% 26.11% 0.00% 8.671259 23.053170 -0.214090 2.061559 9.673785 4.445270 0.612877 4.999879 0.500841 0.451465 0.286450
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 12.173168 -0.504629 3.925191 0.310343 7.985320 0.208143 1.828689 0.321628 0.043217 0.657282 0.510887
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.620583 0.062541 -0.827901 -1.586078 -0.729603 -0.531357 -0.516836 -0.190944 0.612254 0.633855 0.397013
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.842820 7.855789 -0.270073 0.051822 1.033215 2.191713 0.351606 2.261511 0.650045 0.669179 0.404868
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.582723 0.182526 -1.065001 0.357189 0.622551 1.498392 -0.518990 11.510278 0.663897 0.680470 0.412478
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.015436 -0.110516 -0.274537 0.211195 0.056307 0.638814 7.658366 2.586220 0.666273 0.686737 0.414381
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.282410 0.664854 -0.317821 0.170485 -0.834489 0.567930 -0.266532 0.615379 0.662834 0.678739 0.401553
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.301500 0.555873 -0.965907 -0.377160 1.939914 -0.043666 -0.251515 1.141056 0.667293 0.679026 0.388959
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.246291 12.532913 9.554519 10.349734 7.812723 8.330342 0.777412 1.988078 0.034154 0.031571 0.000927
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.302760 0.405089 0.174504 0.185292 -0.806599 0.585205 -1.424888 1.411198 0.680289 0.685319 0.402154
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.582447 0.162769 -1.007001 -0.285794 -0.510185 0.684492 -0.449562 0.262425 0.677132 0.692245 0.400587
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.550273 2.731446 -0.196178 -0.048178 -0.387072 1.195270 0.092530 4.567282 0.664037 0.669233 0.393615
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.073262 1.735980 1.017817 1.990145 -0.547696 0.775494 0.006196 -1.993116 0.654416 0.689974 0.414246
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.484710 0.627981 3.747951 -1.133049 7.931079 -1.289072 1.131120 3.271366 0.037847 0.648251 0.492253
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.141684 0.838963 0.181408 1.666860 2.509796 1.302732 0.961520 -2.410200 0.624745 0.662492 0.407892
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.011935 0.045284 -1.469769 -0.768882 -0.733786 -1.018381 0.227636 17.234184 0.580011 0.629434 0.398100
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.043221 8.342195 -0.225185 0.687590 0.922120 3.955485 15.350912 22.318943 0.638306 0.646515 0.375574
51 N03 digital_ok 100.00% 100.00% 0.00% 0.00% 24.731987 0.601147 12.010783 -0.172102 8.212915 3.667115 11.335140 6.734157 0.039677 0.685137 0.553398
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.161601 6.230243 -0.732128 0.128763 0.003404 1.084824 0.890188 1.326428 0.669535 0.691156 0.401885
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.258086 2.561471 -0.546723 -0.246735 1.791512 1.929686 3.697075 7.198184 0.674966 0.695087 0.403969
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.413761 12.258199 9.347366 10.123404 7.993967 8.471343 2.957356 2.039097 0.032213 0.031715 0.001284
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 1.217554 12.973790 0.297866 10.030603 1.754723 8.497889 4.771447 4.340297 0.668279 0.034734 0.518646
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% -0.241753 13.050603 -0.079065 10.230458 -0.123201 8.402150 2.252278 1.871015 0.671658 0.037814 0.539437
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 29.642257 0.394028 5.388324 0.178822 3.038286 0.838390 12.349664 2.916918 0.479287 0.687408 0.408014
58 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 22.112702 11.909089 -0.718058 10.003952 6.678702 8.437408 4.196972 1.547211 0.369533 0.035791 0.250102
59 N05 digital_ok 100.00% 100.00% 0.00% 0.00% 11.126590 0.658361 9.267418 1.568868 7.798948 3.322642 1.076550 11.643043 0.051823 0.681991 0.545185
60 N05 RF_maintenance 100.00% 0.00% 99.95% 0.00% 0.553083 11.797553 -0.778331 10.043102 -0.316686 8.453853 1.319349 3.430923 0.664587 0.075936 0.529349
61 N06 not_connected 100.00% 0.00% 0.00% 0.00% 10.608874 0.285346 3.145342 -1.357047 6.952389 -1.719376 -0.377726 0.846380 0.305759 0.650889 0.474970
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.363240 1.122650 -1.397883 1.273342 -0.841637 -0.514434 2.255509 -1.285657 0.613022 0.666168 0.406676
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.586504 12.216642 0.380213 4.414244 -0.054443 8.512050 -0.128067 3.482302 0.608748 0.044156 0.466774
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.178132 0.526224 -0.812948 0.410795 -1.065756 -1.122490 -0.065820 -1.096171 0.589402 0.631116 0.403434
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.215023 0.933847 -0.008144 0.576201 0.267203 1.562723 0.157442 0.925397 0.647501 0.682796 0.414691
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.248176 1.261268 1.650571 1.580156 3.187183 0.449007 -0.418959 1.754115 0.654876 0.684682 0.407193
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -1.070172 -0.768935 1.739892 1.596712 -0.347597 0.611566 1.984453 2.509329 0.661280 0.687791 0.398604
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 0.301457 27.643013 0.188269 13.281173 0.018572 8.450601 0.292579 11.828915 0.670264 0.031472 0.529250
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.104212 -0.311533 -0.094161 0.285967 -0.618304 1.494337 0.660438 1.777512 0.669908 0.695720 0.393890
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.502665 -0.243165 -0.847314 -0.428667 1.354982 1.826777 -0.058697 0.034666 0.679075 0.700249 0.393501
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.531474 -0.220237 0.121762 0.709688 0.710895 -0.240555 0.542516 1.574335 0.686723 0.699892 0.391246
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.167913 0.006737 0.231220 0.693338 -0.188756 -0.423970 2.774117 -0.081967 0.674820 0.695008 0.387716
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.238854 0.569242 -0.680914 1.703187 0.639705 7.160329 -0.494675 0.246924 0.687777 0.691495 0.394623
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.712999 3.635927 0.292442 -1.131088 -0.290804 2.686852 -0.897226 5.432640 0.682357 0.688119 0.385589
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 22.767393 25.898334 0.494500 -0.823792 2.239114 2.658019 10.100237 3.502173 0.524331 0.490466 0.211920
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 32.642866 -0.310582 -0.134983 -0.029583 1.945714 -1.334911 0.920172 1.090107 0.452336 0.648362 0.381928
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.184000 -0.234474 -0.472911 -0.872367 -0.673367 -0.752625 -0.029566 -0.675333 0.616814 0.649184 0.402381
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 9.272148 13.469217 2.620271 4.295883 5.095985 8.396485 19.687058 1.400555 0.301071 0.039101 0.204393
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -0.591521 -0.551404 -0.670198 1.744217 0.132798 27.018771 -0.148275 1.902633 0.627549 0.651577 0.395591
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.759814 -0.466134 -0.216249 1.572195 0.259180 -0.074954 -0.418968 -0.006196 0.642570 0.667021 0.397015
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.701972 -0.150057 -0.474971 -0.057224 -0.287381 -0.474783 -0.887204 0.521013 0.655611 0.683618 0.395896
84 N08 digital_ok 100.00% 34.22% 100.00% 0.00% 20.759520 24.672144 12.101846 12.847491 6.448487 8.379023 5.114804 6.164830 0.233163 0.035249 0.150782
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.110438 0.261599 0.420183 0.917992 -0.458305 0.267466 -0.255582 0.936640 0.668564 0.688291 0.391295
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.120669 -0.451730 1.476502 1.166819 3.497131 -0.852775 -0.148052 19.121210 0.658298 0.688285 0.384851
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.891119 6.747275 0.489176 -0.434701 13.888218 1.855125 0.313219 1.160258 0.635235 0.707422 0.382438
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.205794 0.339199 -0.095739 0.571820 -0.642568 -0.038105 0.307284 -0.111659 0.672608 0.695650 0.379846
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.324899 0.096651 -0.353675 0.456476 -1.035718 -0.490613 -0.784589 -0.253553 0.673911 0.694299 0.385011
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.467756 -0.207434 1.019923 0.835251 -0.273047 -0.966703 0.098850 6.251403 0.664282 0.686445 0.387494
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.590310 -0.218717 -0.144267 -0.055879 -0.948595 -0.346530 -0.361614 -0.196702 0.665554 0.693843 0.398695
92 N10 RF_maintenance 100.00% 0.00% 15.30% 0.00% 39.132848 46.054075 0.238041 0.684792 4.639349 5.871670 1.740766 16.225774 0.289881 0.243750 0.097744
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 1.921693 0.508168 1.680747 -0.023269 0.244192 1.145819 4.917354 -0.310421 0.653245 0.685347 0.404843
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 11.501115 -0.957275 9.473687 -0.401030 7.958609 1.533569 1.103808 7.589513 0.032101 0.681179 0.456220
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.831997 -0.134143 -0.403640 1.002285 -0.435475 -0.438364 0.652318 7.239838 0.621661 0.668534 0.414015
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.661412 13.037955 3.743529 4.469718 7.806543 8.311379 1.191890 1.002420 0.032846 0.037111 0.002416
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.859565 4.026892 0.646561 -0.071249 -0.930789 -0.366877 -1.570078 12.776671 0.610679 0.599438 0.402232
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.780363 0.715105 -0.382153 -0.110075 -0.235377 0.420599 0.357931 3.214444 0.624107 0.655814 0.402456
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.550217 -0.854042 0.427800 0.352185 -0.415693 2.002817 2.744895 -0.302349 0.629296 0.669846 0.403856
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.269734 -0.864255 -0.348114 0.655845 1.330849 -0.419282 0.781400 2.538690 0.647588 0.676371 0.394342
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.522126 7.919226 -0.931965 0.646472 -0.026444 1.431059 -0.346759 -0.160383 0.672505 0.695494 0.391704
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.448993 0.599809 -1.009805 2.453485 0.986489 -0.028853 -0.526140 9.499010 0.678026 0.686540 0.386771
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.778939 5.161749 3.970270 0.142777 1.603003 1.874032 11.702959 4.625270 0.649955 0.699385 0.392625
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.495464 61.272353 6.227207 6.891155 2.000614 5.716007 0.165834 2.052792 0.620743 0.671196 0.391238
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.239318 -0.481253 -0.424993 0.470010 1.135404 -0.722477 -0.531154 -0.227368 0.678277 0.697495 0.377634
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.227694 0.270546 0.645723 0.741247 0.987479 -0.597356 0.052974 -0.131182 0.667975 0.695204 0.381612
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.268270 0.200913 -0.831053 -0.373958 -0.298485 -0.198537 5.277367 6.954717 0.675860 0.698411 0.385096
108 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 10.517631 3.788032 9.276290 -0.589312 7.977435 0.397512 2.075126 0.143770 0.040498 0.696772 0.489671
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.327965 11.863211 9.324818 9.784997 8.088246 8.553065 0.503802 2.392279 0.028713 0.032573 0.001656
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 8.419662 26.154707 0.165801 13.007913 8.579702 8.344523 1.038945 5.583977 0.642783 0.031479 0.425701
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.057392 11.832765 0.000888 9.886447 -0.315255 8.553352 0.812256 2.792092 0.659427 0.035543 0.462580
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.515644 0.869639 -0.334111 -0.348180 0.489541 1.882008 0.134531 -0.255070 0.647277 0.671004 0.410574
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.447133 13.096624 3.530945 4.366468 7.832744 8.345913 2.024239 0.889467 0.034491 0.030737 0.002303
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.534341 0.651576 0.666871 -0.196053 5.020534 -0.767505 1.852655 -0.453264 0.522408 0.640633 0.429719
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.564313 1.391444 2.664182 1.857315 2.051988 0.549964 -3.176125 -1.185455 0.605148 0.639309 0.423395
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.453492 0.073424 -0.188653 0.232620 -0.143527 0.452327 2.098861 -0.105991 0.616132 0.651770 0.404331
117 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 11.394917 13.376315 9.379923 10.359402 7.856043 8.447434 1.715362 5.011283 0.027478 0.031047 0.002236
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.398484 0.999984 -0.530049 0.317743 -0.215337 -0.327787 1.725140 3.685586 0.646687 0.680448 0.399367
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.753012 1.643879 -1.220770 1.736203 0.601923 6.267287 -0.101340 2.614362 0.660967 0.672750 0.387321
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.833189 2.598580 2.146371 2.237440 -0.087760 0.980514 1.363750 -2.689821 0.657255 0.695264 0.382763
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.036356 4.398088 -0.729804 1.951643 1.270621 8.272079 40.356478 19.218356 0.676432 0.697254 0.384979
122 N08 digital_ok 100.00% 100.00% 0.00% 0.00% 25.650943 6.733980 11.011421 0.370952 7.672620 1.511127 6.749675 -0.392634 0.098440 0.706591 0.520893
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.648308 8.788625 0.059787 0.635877 1.159095 0.641144 -0.736063 0.276328 0.687548 0.710097 0.388467
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.963795 -0.442085 -0.527872 0.234195 -0.645383 0.586879 0.216975 0.910620 0.684672 0.709239 0.386053
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.113408 -1.148965 -0.761244 0.491610 -0.005441 -0.836816 -0.427257 -0.352316 0.675656 0.697034 0.385169
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.490421 5.936144 -1.173562 1.077302 2.838880 2.114034 7.353843 2.283358 0.675883 0.693287 0.391614
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.045525 0.022699 -0.322130 -0.038314 2.810539 2.323886 0.590058 3.429154 0.674010 0.700003 0.402496
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.751375 0.129545 1.079349 0.691778 -0.489816 2.154626 -0.514923 0.951512 0.664321 0.690314 0.402880
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.685159 -1.964683 -0.325983 0.008144 -0.586305 -0.087496 -0.387837 2.070219 0.660842 0.685595 0.410535
130 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 0.090874 0.609162 -0.435244 -0.003398 -0.779763 0.727255 1.742540 4.909324 0.643875 0.673533 0.406382
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.485848 13.212406 3.781403 4.595318 7.953853 8.447283 3.277739 0.031608 0.033327 0.038906 0.002086
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.883798 0.616221 0.516007 -1.371175 -0.363891 -0.808725 -0.819160 0.032388 0.612393 0.628665 0.411325
133 N11 not_connected 100.00% 100.00% 83.24% 0.00% 11.928872 17.348359 3.536770 3.120520 7.933894 6.750764 1.739915 1.153325 0.041274 0.177034 0.097055
135 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -1.104036 11.907822 -0.206943 10.106938 0.879191 8.402839 -0.168435 1.740252 0.613800 0.038728 0.482019
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 6.554196 0.421368 7.790861 4.815874 11.833167 20.016981 0.235579 0.735351 0.401531 0.613069 0.429430
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.087116 -0.725155 -0.657204 -0.643961 2.243509 1.231392 1.247195 1.601552 0.630901 0.667982 0.407063
138 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.863075 -0.437325 0.497288 1.291556 0.410436 -0.075144 1.683322 -0.123420 0.652206 0.680542 0.403637
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.923073 -0.478132 1.698502 -0.837639 0.050776 -1.397337 -1.919264 -0.060807 0.657348 0.674234 0.389745
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.852471 3.785075 0.307738 3.123220 -0.762221 3.803955 5.221743 -0.786560 0.673057 0.691411 0.385208
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.300767 -0.620951 -1.019968 0.765843 1.117943 -1.176131 -0.286655 -1.687233 0.673902 0.703368 0.387538
142 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 1.185544 11.746863 -1.471553 10.042702 1.965327 8.499367 23.994731 2.337846 0.678050 0.046605 0.551605
143 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 10.653198 29.912200 9.442857 2.736010 7.773889 4.459600 0.164069 3.743583 0.037007 0.335248 0.243547
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.418929 -0.684127 -0.744688 3.200104 1.428192 0.393137 -0.620993 0.113995 0.682754 0.688240 0.389007
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.224253 2.463289 -0.586321 6.341510 -0.511372 14.506363 0.533357 1.863732 0.677744 0.630183 0.411250
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 11.719955 1.674757 3.546029 1.146386 7.897213 -0.520301 0.165736 -1.873263 0.038048 0.693375 0.555567
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.592603 -1.236073 0.926636 1.805597 1.668541 -0.280210 -0.165598 0.252272 0.662690 0.685741 0.393507
148 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.881839 -0.188019 2.558052 1.329719 0.066072 1.461597 -0.673648 -0.217720 0.648480 0.687319 0.410886
149 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.993774 1.254144 -0.965511 1.881289 -0.675614 -0.018355 0.068182 -1.792096 0.659225 0.682469 0.411726
150 N15 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.942391 11.970938 3.972193 9.953395 6.617278 8.466284 -3.649099 1.360483 0.332400 0.039779 0.250874
155 N12 digital_ok 100.00% 100.00% 8.27% 0.00% 10.165531 0.200888 9.016369 -0.695611 8.058526 1.123881 0.704538 3.398526 0.036115 0.241062 0.008996
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.107573 11.518471 -0.711850 9.762305 0.682803 8.492725 3.036706 0.920447 0.626084 0.058566 0.507979
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.014124 -0.078459 -0.114673 0.296022 -0.336599 0.439457 -0.368817 0.384275 0.634568 0.664715 0.409231
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.589405 -0.364272 -0.985741 -1.087144 2.474385 2.140269 8.755787 25.306092 0.652270 0.678477 0.411836
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.000180 20.081255 -1.279207 -1.039358 -1.344523 6.083433 -0.411757 25.165954 0.627495 0.585658 0.380382
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.590208 -1.078911 -0.820856 -1.146449 -0.155269 1.918343 0.927533 1.373658 0.665709 0.690015 0.394735
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.685181 29.473222 -0.656697 -0.757727 0.247010 0.557946 -0.494036 0.892231 0.668239 0.571773 0.350475
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.691229 -0.006737 2.504166 1.369854 0.469725 -0.852681 -1.886962 -1.666925 0.676828 0.703239 0.384709
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.240223 1.078223 -0.739752 0.066686 0.155280 1.607632 0.245374 2.392033 0.682318 0.701358 0.391569
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.691940 0.271299 1.819855 -0.592576 15.340477 2.432641 1.770901 1.871960 0.665715 0.702562 0.392938
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 31.650402 -0.014138 1.997831 0.180090 3.483363 0.398633 1.601610 -0.058284 0.508941 0.694113 0.390798
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.397748 0.223140 -0.347855 6.148672 0.656741 3.339621 7.243445 8.340946 0.674354 0.616808 0.416650
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.477300 -1.170840 -0.669638 3.302777 1.643349 -0.882437 -0.972633 5.515574 0.679901 0.677654 0.404870
168 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.778583 -1.049803 -0.446975 -0.799796 1.864175 0.962519 -0.134802 1.464701 0.665737 0.692221 0.411449
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.939985 7.610379 -1.443126 -1.262320 0.807391 5.819894 -0.823846 13.421757 0.662700 0.654068 0.407813
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.177045 -0.428761 9.500318 -1.223640 7.850389 0.014903 1.237976 6.283470 0.037238 0.678116 0.556248
179 N12 RF_maintenance 100.00% 100.00% 81.95% 0.00% 11.283549 12.045448 9.493787 10.369149 7.732253 7.528534 0.719931 1.446257 0.076176 0.178357 0.105365
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.334287 12.632268 0.113793 10.170106 0.176083 8.414165 38.582264 3.074187 0.656268 0.053205 0.549971
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.527559 0.026030 -0.724947 0.071434 0.614703 -0.354240 -0.549824 6.983041 0.670694 0.686869 0.396434
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.015958 4.293456 -1.003053 3.271013 -0.080330 3.648427 20.693426 -1.365066 0.677573 0.684112 0.393372
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.133052 1.816593 0.470668 4.568630 1.999855 -0.280301 1.496958 0.200594 0.664110 0.640890 0.383933
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.340123 -0.573650 -0.547825 3.376300 0.371521 -1.131610 2.828066 0.139428 0.670464 0.675410 0.385373
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 15.794351 -1.374355 8.037099 3.998462 7.948271 -0.760076 -0.077599 0.077689 0.322456 0.663309 0.436676
186 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 7.300611 3.477327 0.647824 2.946699 6.066519 2.592840 2.807849 -2.725004 0.644592 0.689145 0.402857
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 1.854808 3.309585 1.999548 2.674312 0.121150 1.593908 0.490203 14.163669 0.671508 0.688277 0.396624
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 8.712367 9.021118 1.443059 -0.081063 1.959426 4.104868 0.469035 0.210980 0.350416 0.373242 0.179392
190 N15 digital_ok 100.00% 0.00% 100.00% 0.00% 44.204254 12.016380 -0.288406 10.138389 5.148308 8.420864 50.639223 3.407088 0.468608 0.034776 0.364322
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.025319 0.415509 3.257149 -0.184788 0.401727 0.526361 14.391689 2.462034 0.613638 0.662150 0.441288
200 N18 RF_maintenance 100.00% 100.00% 44.11% 0.00% 12.156464 36.747195 3.721762 0.698726 8.079245 6.166343 1.974663 -0.521895 0.046650 0.222260 0.153966
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.508783 6.475145 5.027267 4.225748 6.331407 5.714590 -4.551963 -3.709967 0.623388 0.648482 0.388858
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.962232 2.160527 0.998851 -0.415209 -0.708868 -0.193948 -0.187355 5.440774 0.654824 0.634447 0.395683
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.712978 13.958275 3.488997 4.155421 8.019144 8.506386 3.292088 4.072142 0.033597 0.042920 0.002917
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.269227 2.607724 0.851863 -1.389931 -0.738144 -0.397064 -1.296634 17.153820 0.648079 0.644661 0.394101
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.628262 0.674107 0.236076 -0.813980 15.146787 -1.013599 -0.827183 4.627684 0.639232 0.651418 0.395736
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.718045 2.298794 1.573231 -0.459216 0.444212 0.112991 -1.855687 -0.483461 0.628750 0.642040 0.382286
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 262.756335 262.583971 inf inf 3607.882484 3661.330575 8016.396623 8323.616679 nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
219 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.645121 4.554158 5.148831 3.427979 6.619563 4.238812 -4.815480 -2.877943 0.615732 0.652611 0.410697
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.091013 -0.776328 0.224373 -0.137098 -1.437331 -1.290245 2.980683 -1.015656 0.645127 0.655373 0.399009
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.890752 0.257415 -1.010882 -0.306780 -0.083282 -1.098293 2.542709 -0.301565 0.613295 0.660699 0.409796
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.047845 0.818916 0.903768 -0.271175 -0.615673 -1.620995 5.316490 -0.137710 0.646015 0.661439 0.402633
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.794897 1.117781 -1.251082 -0.917643 -0.902848 -1.336395 -0.173248 1.053826 0.628343 0.653216 0.398248
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.640432 7.075473 5.200455 4.706585 6.542782 6.741184 -4.758909 -4.447374 0.619741 0.635504 0.400503
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 252.943234 253.048109 inf inf 3940.477621 3851.806130 9379.191912 8935.103432 nan nan nan
227 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 236.659819 236.401249 inf inf 3790.057501 3735.645423 8642.657870 8419.885016 nan nan nan
228 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 235.355047 235.294898 inf inf 3574.304318 3582.458724 7739.049452 7778.630517 nan nan nan
229 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 225.128111 225.071803 inf inf 3769.991988 3785.684699 8524.163859 8603.849557 nan nan nan
237 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 5.777491 1.688434 1.058199 -1.038736 1.087443 -0.690572 5.411693 -0.288706 0.524501 0.634458 0.439605
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.505277 -0.581038 1.392031 0.830645 -0.526045 -0.903004 -2.106018 -1.761728 0.643593 0.654372 0.412771
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.163229 2.315314 0.415106 0.119918 -0.141771 -0.893671 -0.419497 5.756172 0.635831 0.594733 0.417850
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 245.816253 245.877191 inf inf 4170.499039 3961.711065 9922.335755 9044.004299 nan nan nan
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
244 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 262.829243 262.564971 inf inf 3534.626793 3493.849019 4256.374672 3927.643634 nan nan nan
245 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
246 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.215555 12.996468 -0.756621 6.490576 -0.019195 8.535632 9.480201 4.462624 0.637092 0.048320 0.538828
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.289245 2.607338 1.390647 1.587680 0.891435 0.875847 -0.413458 -1.482551 0.525148 0.543477 0.401986
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.776149 -1.209742 1.468959 -1.155349 0.501972 -0.476992 -2.207467 0.143534 0.557480 0.558436 0.415539
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.744929 -0.889319 -1.077939 -0.219637 0.005441 -0.820754 2.359950 -0.580347 0.493443 0.547381 0.405065
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.558036 0.728264 -1.237212 -1.309576 -1.225451 -0.563650 1.547889 0.562512 0.488767 0.539255 0.401311
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 8, 9, 10, 15, 18, 19, 20, 21, 27, 28, 29, 30, 31, 32, 34, 36, 37, 38, 42, 45, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 63, 68, 71, 73, 74, 77, 78, 80, 81, 84, 86, 87, 90, 92, 93, 94, 95, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 113, 114, 117, 119, 121, 122, 123, 126, 130, 131, 133, 135, 136, 140, 142, 143, 145, 146, 150, 155, 156, 158, 159, 161, 164, 165, 166, 167, 169, 170, 179, 180, 181, 182, 183, 185, 186, 187, 189, 190, 191, 200, 201, 202, 203, 205, 206, 208, 209, 210, 211, 219, 222, 224, 225, 226, 227, 228, 229, 237, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320]

unflagged_ants: [5, 16, 17, 22, 35, 40, 41, 43, 44, 46, 48, 62, 64, 65, 66, 67, 69, 70, 72, 79, 82, 83, 85, 88, 89, 91, 98, 99, 100, 105, 106, 112, 115, 116, 118, 120, 124, 125, 127, 128, 129, 132, 137, 138, 139, 141, 144, 147, 148, 149, 157, 160, 162, 163, 168, 184, 207, 220, 221, 223, 238, 324, 325, 329, 333]

golden_ants: [5, 16, 17, 40, 41, 44, 65, 66, 67, 69, 70, 72, 83, 85, 88, 91, 98, 99, 100, 105, 106, 112, 116, 118, 124, 127, 128, 129, 141, 144, 147, 157, 160, 162, 163, 184]
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_2459906.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.5.dev11+g87299d5
3.1.5.dev171+gc8e6162
In [ ]: