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 = "2460012"
data_path = "/mnt/sn1/2460012"
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: 3-8-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/2460012/zen.2460012.21263.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

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

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1852 ant_metrics files matching glob /mnt/sn1/2460012/zen.2460012.?????.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/2460012/zen.2460012.?????.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 2460012
Date 3-8-2023
LST Range 5.607 -- 15.574 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1852
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 25
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas 42, 66, 70
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 76 / 198 (38.4%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 143 / 198 (72.2%)
Redcal Done? ❌
Never Flagged Antennas 54 / 198 (27.3%)
A Priori Good Antennas Flagged 69 / 93 total a priori good antennas:
3, 5, 7, 15, 16, 17, 19, 29, 31, 37, 38, 40,
42, 45, 53, 54, 55, 56, 65, 66, 67, 69, 70,
71, 72, 81, 85, 86, 93, 94, 101, 103, 107,
109, 111, 112, 121, 122, 123, 124, 127, 128,
136, 140, 145, 147, 148, 149, 150, 151, 158,
161, 164, 165, 167, 168, 169, 170, 173, 181,
182, 184, 187, 189, 190, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 30 / 105 total a priori bad antennas:
22, 35, 43, 46, 48, 50, 57, 61, 62, 64, 73,
89, 90, 115, 125, 132, 133, 137, 139, 179,
220, 228, 229, 237, 238, 241, 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_2460012.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% 0.00% 100.00% 0.00% 13.086973 14.549915 -0.105660 11.448944 5.868540 7.683555 0.736146 2.544700 0.312137 0.039607 0.254158
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.076191 6.903542 1.740092 2.287637 3.061452 4.002320 -2.779856 -3.327816 0.294936 0.304453 0.136129
5 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 11.181465 14.341025 10.871299 11.166413 6.506643 7.765693 1.068767 0.924306 0.040147 0.034657 0.002567
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.044241 -0.179758 -1.060287 -0.220096 0.387618 1.313711 5.748329 23.695043 0.574652 0.585529 0.356328
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.018395 4.023050 2.867194 2.953534 3.203639 4.171099 -3.480646 -2.629867 0.558359 0.566516 0.341353
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.616938 -0.705137 3.492276 -1.079968 0.417618 0.208464 2.631817 -0.780206 0.552068 0.582837 0.355896
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.910617 -1.064329 -0.082335 -1.390627 -0.671309 0.439814 -0.523993 -0.629770 0.567057 0.579760 0.352813
15 N01 digital_ok 100.00% 6.10% 16.47% 0.00% 33.079358 31.397156 3.795691 4.297585 3.468134 2.655686 5.640335 6.936794 0.264738 0.246735 0.106716
16 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.925704 14.508585 10.751281 11.415908 6.435729 7.661391 1.249476 1.604442 0.085961 0.034507 0.036892
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.628868 7.425855 0.745995 10.241995 1.141115 3.922891 0.103666 4.575650 0.576733 0.350948 0.432550
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.383342 7.655806 10.899947 0.544992 6.471393 3.380622 1.418416 66.308719 0.036282 0.370779 0.294834
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.152995 -0.327691 -0.841585 0.032123 0.439843 0.382034 0.161124 7.278402 0.587569 0.602725 0.353804
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.228562 -1.157513 2.132590 -0.961594 2.102561 -0.067807 1.152720 -0.697442 0.577105 0.599316 0.351335
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.608593 0.084066 -0.447505 -0.029617 0.734302 1.264535 0.133367 0.159472 0.571094 0.578887 0.343351
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.046587 -0.430579 -0.309290 -0.545111 -0.050255 2.053610 0.041761 -0.584041 0.545211 0.557510 0.344680
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.018856 13.589467 10.954717 11.255733 6.463248 7.756629 4.023918 3.221366 0.030398 0.031630 0.000633
28 N01 RF_maintenance 100.00% 100.00% 88.98% 0.00% 10.441582 28.372389 10.715752 3.452854 6.480538 2.820401 0.942231 22.318602 0.029037 0.147687 0.102383
29 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.723448 -0.282923 2.790202 0.497689 -0.037949 1.381129 6.189164 2.667360 0.568348 0.588464 0.351820
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.005825 -0.844556 0.169926 -1.480824 1.634051 0.039534 1.211673 -0.819610 0.586912 0.607554 0.357648
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.841576 -0.999766 1.123949 1.461097 2.047338 -0.676863 0.456431 8.088839 0.597402 0.600988 0.349519
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 22.508189 26.397515 1.519147 3.195368 0.470392 0.566971 4.688437 9.732242 0.476585 0.482449 0.200726
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.335992 15.221628 5.456210 5.644928 6.433166 7.710531 4.367443 3.852038 0.034962 0.046477 0.007221
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.005825 -0.475866 0.449670 -1.201718 -0.514781 -0.901042 -0.581213 0.073715 0.554833 0.553570 0.341535
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.197243 8.110170 1.064697 0.659285 2.104296 2.232627 0.558066 1.608346 0.551406 0.558284 0.374793
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 0.097643 23.767608 -0.386155 13.448617 -0.412835 7.727278 -1.757474 5.024995 0.566466 0.033341 0.452905
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.736913 0.552961 -1.392782 2.845097 -0.126804 -0.338033 2.970894 15.750417 0.572659 0.558398 0.369312
40 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.102212 0.799537 2.863116 -0.454067 -0.398471 0.529913 1.719030 8.528405 0.562384 0.589443 0.365627
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.656631 1.038306 1.327880 1.540476 2.401200 0.011056 0.577185 0.746426 0.583256 0.594462 0.359379
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.784748 2.373504 3.072242 -1.319740 2.116131 0.616000 1.814668 2.350344 0.234452 0.230210 -0.276865
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.328409 0.105816 -0.571282 0.575558 -0.901420 1.203360 -0.714373 1.874488 0.597774 0.605966 0.350201
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.196483 0.104439 -0.987497 -0.483763 -0.677673 0.636220 -0.427689 0.357928 0.602326 0.617167 0.351699
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.945525 2.189743 0.610483 0.601132 0.083294 1.970986 1.532177 17.558454 0.592078 0.601397 0.345067
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.817628 -0.612661 -0.437623 -1.033933 -0.290995 -0.526664 -0.304635 -0.889583 0.592857 0.613341 0.357062
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.316612 14.845527 5.356184 5.259040 6.440113 7.671630 6.505191 3.042672 0.031615 0.054511 0.014381
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.223649 1.062422 -0.840286 1.355256 1.218677 1.845944 1.032642 -3.250839 0.555032 0.577280 0.350350
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.690729 0.049532 -0.526388 -0.036955 -0.640843 -0.240264 0.511458 8.533002 0.521822 0.554683 0.347039
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.777570 1.200462 0.094734 1.635030 -0.128502 1.843926 0.021708 -0.021708 0.553106 0.555282 0.372096
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.914161 1.754641 -0.163537 -0.076659 2.128807 1.483767 122.465705 2.691846 0.561290 0.570229 0.368329
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.526755 5.803575 0.355500 -0.006894 1.878550 1.690144 3.570115 1.017727 0.571106 0.582261 0.366327
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.929813 1.821277 -0.299998 -0.337726 2.013597 0.223362 18.038986 1.601708 0.579341 0.594394 0.369614
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 11.134513 4.444703 2.331315 0.042550 3.779072 2.639280 -2.338710 0.602121 0.291667 0.349398 0.153076
55 N04 digital_ok 100.00% 5.51% 100.00% 0.00% 0.473359 54.222765 0.730107 7.316717 0.460912 8.039290 4.679000 1.537386 0.241533 0.041774 0.074448
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.251109 0.734668 -1.018276 2.466391 -0.668987 5.930655 -1.049883 2.135478 0.595599 0.600302 0.349485
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.879035 -0.037533 2.318464 -0.984455 2.112321 -0.011056 -3.078797 0.797882 0.593453 0.614027 0.349074
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.929328 13.938416 10.841088 11.365873 6.405489 7.695563 3.817465 3.315435 0.037615 0.036900 0.002119
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.151003 0.675547 10.892362 1.041747 6.317397 2.953641 5.446171 9.051862 0.048342 0.608170 0.454210
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.407701 13.894298 -0.242154 11.400661 0.754426 7.709722 4.307500 7.484120 0.591276 0.073266 0.463242
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.143039 -0.255976 0.431463 -1.317243 1.629249 -0.688129 0.323671 1.275438 0.533900 0.575058 0.345286
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.545160 1.167982 -0.543094 0.946902 -0.916567 0.137721 1.011819 -1.759536 0.540402 0.577097 0.348706
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 1.388859 14.433776 -0.798528 5.678592 -0.275368 7.760087 -0.827602 4.640127 0.548681 0.046518 0.423775
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.454630 -0.315685 -1.319066 -0.781806 -0.891584 -0.972315 1.856247 0.237040 0.543663 0.539536 0.339404
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 24.667275 23.563509 13.984136 13.894777 6.576353 7.801293 7.681827 9.770243 0.022670 0.028376 0.005711
66 N03 digital_ok 100.00% 0.00% 0.00% 100.00% 0.886430 0.073533 -1.330778 4.367779 1.716211 2.060308 -0.118813 2.411242 0.208330 0.184839 -0.280185
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.342030 0.395562 -1.067606 0.784710 0.293445 1.254131 11.804581 3.592048 0.573159 0.571961 0.361344
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 26.500035 0.912507 14.094598 0.893844 6.415163 -0.597598 9.705974 -1.229568 0.034771 0.590247 0.454044
69 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.487402 -0.535154 0.484160 2.688913 0.243204 2.385165 4.720888 0.986755 0.581757 0.587355 0.358203
70 N04 digital_ok 100.00% 0.00% 0.00% 100.00% -0.077507 1.642588 1.139917 3.086794 3.380803 1.185920 7.071588 1.475397 0.235052 0.218381 -0.277753
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.395187 -0.513854 -0.051132 4.494628 0.636188 -0.552755 -0.639965 1.058043 0.590872 0.588348 0.346371
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 1.288841 0.145109 1.571843 7.478118 0.945272 0.522003 2.054949 12.280559 0.601402 0.553155 0.357738
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.487486 0.692351 -1.202848 -0.022650 1.007009 2.596395 -0.047485 0.445386 0.610872 0.619819 0.348811
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.709533 -0.099725 -0.363875 -0.644829 -0.395466 1.553735 0.268321 4.990479 0.609588 0.623134 0.350781
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 56.879629 20.800596 0.587387 -0.559432 3.595604 1.514530 7.801606 0.469781 0.299856 0.477931 0.285332
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 28.412853 0.978359 -0.532936 1.189709 1.392430 0.940548 0.567657 -0.174587 0.409093 0.580779 0.339891
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 0.763566 14.661583 -1.141274 5.674534 -0.628033 7.613648 0.078748 0.069218 0.547417 0.041099 0.436542
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.663677 15.556484 -0.044016 5.579836 -0.978942 7.628259 -1.698809 2.267262 0.556739 0.062990 0.437950
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.529352 14.768123 0.367420 10.017529 1.150051 7.493159 1.885926 4.987375 0.522282 0.038851 0.398640
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.574889 0.784752 -0.748103 2.149054 0.508118 37.261200 0.459704 5.150200 0.555892 0.529056 0.360040
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.020980 0.080931 0.507977 0.527443 1.046828 0.478200 -0.386697 0.994419 0.560532 0.563322 0.358770
84 N08 RF_maintenance 100.00% 99.95% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.132253 0.100031 0.054048
85 N08 digital_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.327340 0.279045 0.207086
86 N08 digital_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.620010 0.654584 0.448623
87 N08 RF_maintenance 100.00% 99.78% 99.84% 0.00% 250.314177 250.629006 inf inf 2507.932597 2531.462174 10146.902046 10318.296477 0.388928 0.445894 0.342297
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.880351 1.016571 0.577611 1.011081 0.313154 -0.696746 -0.188684 -0.180118 0.596084 0.609431 0.341331
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.974707 0.287526 0.497003 0.911114 -0.237314 0.589704 -0.478696 -0.262659 0.601124 0.614898 0.342018
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.008271 -0.410815 -0.799075 -0.526359 -0.438617 -1.097747 -0.240321 2.362783 0.603799 0.623004 0.345645
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.524141 -0.096691 0.732832 0.387298 0.320101 0.422409 -0.341312 -0.185841 0.584588 0.609537 0.345692
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.491384 -0.118926 10.850123 0.192032 6.499906 1.820710 0.730848 0.965395 0.037135 0.611279 0.401524
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.829595 14.119577 10.964656 11.464057 6.353759 7.645385 4.244563 3.382623 0.031120 0.025011 0.003183
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 157.558566 44.211914 48.414740 27.720638 51.395926 16.167862 2023.790004 898.874371 0.016482 0.016231 0.000782
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.097966 1.797355 -1.076931 0.589033 2.241796 1.866839 -1.071669 -1.380668 0.420327 0.428160 0.191887
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 4.342335 18.150711 3.043545 1.359204 3.120994 2.766879 -4.684731 -2.860234 0.550281 0.461268 0.332235
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.384603 4.083724 -1.226694 1.038683 -0.690253 -0.378712 0.305195 13.797827 0.539615 0.507209 0.345125
101 N08 digital_ok 100.00% 99.84% 99.84% 0.00% 182.267560 182.736668 inf inf 2248.188244 2248.817672 8186.486843 8166.757031 0.740734 0.672554 0.595199
102 N08 RF_maintenance 100.00% 99.84% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.285409 0.124343 0.289212
103 N08 digital_ok 100.00% 99.84% 99.89% 0.00% 175.096848 175.470570 inf inf 2539.889622 2513.648827 10083.328726 9610.355433 0.365594 0.253385 0.276224
104 N08 RF_maintenance 100.00% 99.84% 99.84% 0.00% 203.847024 203.208296 inf inf 2657.234283 2684.180904 11062.773092 11273.012721 0.331526 0.365875 0.336931
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.105674 0.139563 0.295404 1.000322 1.419707 0.614882 -0.316106 -0.394753 0.596068 0.605254 0.344395
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.992573 1.184481 -0.450110 -0.333538 -0.530432 -0.488082 0.254300 -0.503878 0.602475 0.616238 0.341776
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 5.037711 2.197511 0.029257 -0.540451 1.709671 0.538055 5.838867 6.990151 0.598297 0.620434 0.336321
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.603063 42.487660 10.888607 0.962583 6.420021 3.031742 2.980348 4.075283 0.036004 0.292586 0.152442
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.331228 13.955941 10.934338 11.141583 6.494862 7.776532 1.463518 3.622458 0.060764 0.034651 0.016797
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.222396 10.872372 6.354198 -0.186416 6.840344 -0.168008 3.929095 -0.656151 0.496431 0.566283 0.320215
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 26.823253 13.866180 1.158761 11.234584 4.033659 7.749700 46.021203 3.627424 0.475473 0.060542 0.329955
112 N10 digital_ok 100.00% 63.77% 100.00% 0.00% 1.799889 13.462983 7.660878 11.299502 0.105343 7.508974 0.373458 1.299977 0.193783 0.070933 -0.101575
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.568726 15.293610 5.080699 5.667307 6.311805 7.596218 3.222941 2.118428 0.034261 0.031112 0.001923
114 N11 not_connected 100.00% 100.00% 0.00% 0.00% 13.422130 1.073647 5.245586 -0.188952 6.290689 -0.946699 0.698904 -0.895602 0.046866 0.558346 0.420537
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.364136 -0.705583 -1.449498 0.000651 -0.966047 -0.788080 -0.829380 -0.397886 0.522780 0.546916 0.354936
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.444587 15.584874 10.984389 11.709618 6.336570 7.675190 3.445478 7.710277 0.027956 0.032455 0.002614
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.591976 1.498983 0.281673 0.583098 -0.231046 0.996302 -0.196261 0.534288 0.558601 0.567698 0.363090
120 N08 RF_maintenance 100.00% 99.78% 99.95% 0.00% 231.230885 231.546448 inf inf 2491.731518 2480.973428 9817.721411 9636.225387 0.445159 0.157364 0.319468
121 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.055209 0.119730 0.020300
122 N08 digital_ok 100.00% 99.84% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.515948 0.368968 0.352647
123 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.116233 0.092485 0.039085
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 10.693835 0.774719 11.144749 0.640781 6.309105 1.039076 1.091018 1.048107 0.042852 0.611950 0.428741
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.337961 0.014618 0.953847 1.014647 -0.075277 0.075943 0.129642 0.214068 0.605184 0.610956 0.343466
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 13.502408 6.237905 -0.054977 1.508155 4.789865 1.249882 19.098169 -0.002323 0.547276 0.613343 0.337650
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 10.144323 -0.029046 10.840074 1.255211 6.485058 1.514797 0.686600 2.014235 0.034462 0.612063 0.392437
128 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 0.265245 -0.396409 -1.154348 -0.236837 -0.037464 -0.286910 1.051310 6.977069 0.596437 0.606253 0.362528
131 N11 not_connected 100.00% 0.00% 57.61% 0.00% -0.751983 14.010197 -0.388199 5.617884 -0.349340 6.678037 -1.594447 0.741283 0.555214 0.213173 0.399062
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.301787 -0.161551 -0.486829 -1.459222 -0.754782 -0.250714 -0.745751 -0.616751 0.546967 0.548688 0.350548
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.971968 -1.174479 -1.358690 -0.616939 -0.580522 -0.999006 -0.508619 1.946518 0.522190 0.551200 0.359978
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.008992 15.314519 5.232396 5.649989 6.307358 7.611924 1.454896 2.280842 0.041023 0.035192 0.003367
135 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.025121 0.076116 0.020630
136 N12 digital_ok 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 1.000000 1.000000 0.005503
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.278941 -0.401261 0.249890 -1.471233 1.823569 -0.071322 1.453779 3.401752 0.544566 0.563679 0.362776
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.201351 1.595928 0.987809 -1.076697 0.501616 -0.867209 -1.913060 0.585422 0.564012 0.559131 0.348620
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.743093 -1.048048 -0.493782 -0.455515 -0.198589 -0.706715 4.661340 4.879753 0.579728 0.595397 0.354538
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.909750 -0.581588 -0.219075 0.395166 1.229085 -0.290855 1.583972 -1.684900 0.582814 0.602225 0.352396
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.171535 13.947857 -0.676442 11.406556 2.189163 7.736019 31.992897 5.043442 0.592558 0.048080 0.480187
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.389626 13.920634 10.741348 11.373278 5.828254 7.702443 0.777669 2.586550 0.097413 0.030875 0.052581
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.589653 0.635914 -0.948619 3.618715 0.046697 1.526728 -0.651539 0.493645 0.610025 0.604657 0.347027
145 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.126330 -0.614509 2.250662 -0.028141 -0.132696 5.519618 0.718467 -0.118269 0.598824 0.621602 0.347791
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.446233 -0.612800 -1.329986 -0.858705 -0.777117 -0.885933 -0.279795 -0.205611 0.579116 0.599141 0.344119
147 N15 digital_ok 100.00% 99.84% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.291469 0.170684 0.234286
148 N15 digital_ok 100.00% 99.84% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.196045 0.230080 0.293196
149 N15 digital_ok 100.00% 99.89% 99.89% 0.00% 251.876749 252.726485 inf inf 3367.865454 3379.643386 15810.365890 15969.019029 0.214621 0.220966 0.221631
150 N15 digital_ok 100.00% 99.78% 99.89% 0.00% 186.724513 186.912912 inf inf 2420.371878 2439.469325 11523.705998 11685.052948 0.279860 0.314021 0.268043
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 21.907497 0.729566 -0.683964 0.538989 1.619934 -0.078216 0.377319 0.063681 0.432149 0.525105 0.316139
155 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.076485 13.767423 8.806172 11.188866 2.096299 7.772756 3.777142 3.662337 0.392510 0.040558 0.302075
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.820784 -0.351465 0.265062 0.595313 0.583314 1.338061 0.097439 0.233526 0.550295 0.565097 0.364148
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.765737 -0.411602 -0.162255 -0.370535 2.289061 2.405085 6.263578 30.589698 0.562512 0.578947 0.364155
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.495660 26.803848 -0.965295 -0.612233 -0.536701 1.701014 -0.038044 4.080818 0.536431 0.434306 0.318177
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.281779 -1.110635 -0.214098 -0.854702 0.436625 1.594040 -0.509422 1.081760 0.576726 0.596431 0.353735
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.035980 30.913428 0.251700 -0.277414 1.244901 0.635701 0.492082 1.820618 0.585158 0.475309 0.318673
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.395915 -1.071903 -0.172954 -1.016410 -0.210960 0.617308 0.081697 -0.857392 0.599968 0.616544 0.348789
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.789608 1.422269 0.097768 0.408291 0.783402 1.836627 0.061644 2.461931 0.606770 0.620107 0.350562
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.125842 0.177218 0.457164 1.236094 4.334124 2.289103 1.003006 2.246550 0.604070 0.612073 0.341093
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 26.948730 0.058260 -0.121143 -0.845014 1.619381 0.458769 3.192079 -0.218762 0.477841 0.618327 0.336724
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.862952 0.047407 0.942618 0.564874 0.740180 -0.240932 0.344161 -2.309787 0.598618 0.612516 0.340320
167 N15 digital_ok 100.00% 99.95% 99.95% 0.00% 200.167470 201.297537 inf inf 2617.079034 2637.011589 10747.489029 10821.064109 0.255202 0.252566 0.204684
168 N15 digital_ok 100.00% 99.95% 99.89% 0.00% 181.327658 182.965817 inf inf 2426.962421 2414.663855 8679.508425 8460.871714 0.154340 0.332003 0.268356
169 N15 digital_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.143641 0.097837 0.118040
170 N15 digital_ok 100.00% 99.84% 99.89% 0.05% nan nan inf inf nan nan nan nan 0.334081 0.126771 0.176692
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.724950 1.451154 -0.751248 0.386783 -0.806745 -0.452973 0.301444 1.460257 0.530136 0.517571 0.339337
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 12.788417 14.918201 4.837056 5.305387 6.518111 7.792659 5.699775 10.717960 0.036071 0.042374 0.003832
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.651742 -0.622710 -0.475271 0.075560 0.043378 1.692872 -0.759292 1.205588 0.553622 0.579311 0.361432
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.083577 14.654790 -1.338424 11.532989 1.224702 7.641624 26.631121 3.940350 0.580402 0.054789 0.477310
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.332644 0.102887 1.274441 0.629635 0.161328 0.262706 -0.208024 8.056521 0.585224 0.600382 0.355558
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.145023 13.698909 -0.489099 11.128421 -0.714162 7.776294 8.352995 4.287897 0.600486 0.050151 0.452182
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.365984 0.939645 0.323566 0.830270 1.634492 0.711865 0.574410 0.319808 0.593068 0.607273 0.338247
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 22.955646 -0.618800 7.438611 -1.216011 5.774738 1.024852 4.112513 0.152155 0.401138 0.618158 0.364720
185 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.544332 -0.179663 3.101284 0.666477 3.662109 0.296112 -4.153032 -1.304048 0.576776 0.615767 0.353647
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.995691 -1.009413 0.129741 -0.434940 -0.645412 -0.443425 -1.538387 -1.395931 0.605827 0.616103 0.349398
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.256340 -0.664257 -1.368389 -0.141272 0.198457 0.441041 9.380848 -0.552970 0.589738 0.603405 0.350808
189 N15 digital_ok 100.00% 99.84% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.353751 0.436769 0.384382
190 N15 digital_ok 100.00% 99.89% 99.84% 0.00% 171.532788 172.643463 inf inf 2567.263661 2568.495299 10350.609509 10393.738612 0.250908 0.614248 0.517208
191 N15 digital_ok 100.00% 99.78% 99.84% 0.00% 250.284960 250.655728 inf inf 3377.863721 3378.598310 16019.802746 16035.536046 0.491742 0.310135 0.464006
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 1.156442 6.395834 1.474919 4.000687 1.646090 6.247034 0.876923 -5.571015 0.539919 0.512042 0.357568
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.713699 0.517207 4.027786 0.829970 5.086946 1.082986 -5.589838 -0.838676 0.504850 0.539683 0.371125
200 N18 RF_maintenance 100.00% 100.00% 49.57% 0.00% 12.335291 38.019787 5.250485 -0.125007 6.490765 3.042388 3.058248 8.989754 0.042175 0.217224 0.138344
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.621237 4.777953 2.428562 3.486710 2.240279 5.209103 -2.139682 -4.384735 0.566447 0.567032 0.342773
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.385900 0.654862 1.069172 -1.382528 0.715915 0.312332 -1.776351 71.872089 0.583412 0.583958 0.340293
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.184732 14.218853 1.525768 -1.044245 0.209154 0.225999 31.606949 2.915612 0.591813 0.611931 0.350266
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 8.275173 0.094529 3.645147 -0.683688 3.764298 -0.887884 74.559724 5.137001 0.368935 0.591127 0.409088
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.298747 5.929675 0.185193 2.805215 1.103984 1.654234 0.875740 1.265368 0.534819 0.477008 0.334609
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.059810 1.272247 -1.019014 -0.952262 -0.869489 -0.167280 11.014706 0.120890 0.565286 0.564094 0.343253
208 N20 dish_maintenance 100.00% 99.62% 99.57% 0.00% 245.150760 245.359967 inf inf 2604.127761 2590.536254 9262.444690 9178.492976 0.402814 0.381961 0.282878
209 N20 dish_maintenance 100.00% 99.84% 99.73% 0.00% nan nan inf inf nan nan nan nan 0.231192 0.482313 0.411258
210 N20 dish_maintenance 100.00% 99.78% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.298663 0.384589 0.167598
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% 0.059890 14.439049 -1.381786 5.699231 -0.643582 7.632456 0.253289 2.581842 0.524805 0.040442 0.442988
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.294144 -0.552866 0.070354 -0.618846 -0.690148 -0.102175 2.905478 -1.769501 0.572884 0.575409 0.344390
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.423646 -0.446883 -1.410294 -0.875040 0.420031 -1.176018 10.860658 -0.933175 0.563150 0.584783 0.345243
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.544147 -0.185691 -0.421996 -0.028119 -0.689778 -0.571663 5.788741 -1.638072 0.572455 0.591208 0.346569
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.420909 -0.876901 -1.090543 -0.421621 -0.846697 -0.809665 1.019251 12.780218 0.564143 0.588601 0.348528
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.012164 5.898762 4.272254 3.963185 5.450241 6.097451 -5.861625 -4.816738 0.537281 0.559138 0.342842
225 N19 RF_ok 100.00% 0.00% 89.79% 0.00% -0.595805 13.934788 0.417917 5.442044 -0.920160 7.430887 -2.169220 2.837564 0.573545 0.140380 0.462620
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.561466 19.242180 -0.838046 0.424862 -1.059162 3.283180 -1.342875 -0.781932 0.560518 0.489498 0.335958
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 3.176974 1.240459 2.338604 -0.684471 -0.079533 -0.798352 16.748591 19.626371 0.459710 0.543184 0.364415
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.161070 0.046744 0.528327 -1.471321 0.051793 -0.798857 1.290393 1.653096 0.543248 0.539212 0.345523
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.212123 0.829141 0.441262 1.125238 -0.333052 0.708281 -1.745491 -3.079556 0.539928 0.548007 0.362325
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.923423 -0.602927 0.249599 -1.459689 -0.279607 -0.389227 0.643272 -1.080125 0.511928 0.556797 0.356822
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.187563 -0.388490 0.511896 0.378538 -0.524457 -0.986101 -2.498373 -2.680520 0.563836 0.573996 0.353797
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -1.071159 -0.883672 -0.491477 -0.295743 -0.846007 -1.013475 -0.208040 4.914835 0.565343 0.574872 0.351527
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.540614 0.017237 0.177646 -1.036080 -0.975616 -1.188452 9.235739 5.802430 0.518574 0.573822 0.363829
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.860907 -1.027399 -0.636443 -0.000651 -1.162514 -0.562070 1.066220 -1.768817 0.556771 0.578153 0.361814
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 21.943924 0.519570 -0.499116 0.964577 1.591744 0.895135 -0.501438 -0.300317 0.427383 0.571013 0.354653
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 20.000055 -1.090988 0.589798 -1.505508 1.753706 -0.295663 -1.272303 -0.251606 0.432052 0.556166 0.352040
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.633231 -0.750813 -0.584104 -1.473830 -0.554005 0.094292 3.456149 8.522943 0.514022 0.555850 0.355241
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.378266 0.271000 0.254730 -1.164947 -0.497464 -0.848404 -2.586506 0.497909 0.547541 0.549140 0.353752
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.543551 15.027916 -1.059692 5.198894 -0.536105 7.724616 -1.006352 0.547429 0.529667 0.039706 0.447056
261 N20 RF_ok 100.00% 0.00% 0.00% 0.00% -0.426926 -0.114792 -0.145266 -0.379813 -0.763461 -1.170744 22.407271 5.103174 0.536266 0.540088 0.351408
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 11.308270 14.130828 5.452872 5.451588 0.420236 -0.316037 0.127403 3.147632 0.515737 0.521831 0.352902
320 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.609952 1.412426 2.031900 1.066886 1.381321 0.505980 -2.579101 0.407685 0.460384 0.470946 0.351449
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.965141 3.122067 0.845748 1.287316 0.464405 1.629276 -1.232936 -2.239381 0.445969 0.451469 0.333918
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.120927 -0.831820 0.712545 -1.491985 0.262876 -1.147837 -2.669711 0.650077 0.472911 0.469962 0.349867
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.242294 -0.154319 -0.934205 -1.107416 0.044188 -0.788910 4.587690 -0.283876 0.443785 0.456415 0.335507
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.899224 1.257994 -0.712538 -1.407028 -0.784309 -0.648938 1.679014 0.612793 0.422507 0.445911 0.325206
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, 5, 7, 8, 15, 16, 17, 18, 19, 27, 28, 29, 31, 32, 34, 36, 37, 38, 40, 42, 45, 47, 49, 51, 52, 53, 54, 55, 56, 58, 59, 60, 63, 65, 66, 67, 68, 69, 70, 71, 72, 74, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 92, 93, 94, 95, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 112, 113, 114, 117, 120, 121, 122, 123, 124, 126, 127, 128, 131, 134, 135, 136, 140, 142, 143, 145, 147, 148, 149, 150, 151, 155, 156, 158, 159, 161, 164, 165, 167, 168, 169, 170, 173, 180, 181, 182, 184, 185, 187, 189, 190, 191, 192, 193, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 221, 222, 223, 224, 225, 226, 227, 239, 240, 242, 243, 244, 246, 261, 262, 320, 329]

unflagged_ants: [9, 10, 20, 21, 22, 30, 35, 41, 43, 44, 46, 48, 50, 57, 61, 62, 64, 73, 83, 88, 89, 90, 91, 105, 106, 115, 118, 125, 132, 133, 137, 139, 141, 144, 146, 157, 160, 162, 163, 166, 171, 179, 183, 186, 220, 228, 229, 237, 238, 241, 245, 324, 325, 333]

golden_ants: [9, 10, 20, 21, 30, 41, 44, 83, 88, 91, 105, 106, 118, 141, 144, 146, 157, 160, 162, 163, 166, 171, 183, 186]
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_2460012.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

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