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 = "2460028"
data_path = "/mnt/sn1/2460028"
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-24-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/2460028/zen.2460028.21313.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/2460028/zen.2460028.?????.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/2460028/zen.2460028.?????.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 2460028
Date 3-24-2023
LST Range 6.670 -- 16.627 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 199
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 94
not_connected: 25
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 199 (0.0%)
Antennas in Commanded State (observed) 0 / 199 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating N07
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 68 / 199 (34.2%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 96 / 199 (48.2%)
Redcal Done? ❌
Never Flagged Antennas 100 / 199 (50.3%)
A Priori Good Antennas Flagged 47 / 94 total a priori good antennas:
3, 5, 15, 16, 17, 37, 40, 42, 54, 55, 65, 66,
70, 72, 81, 83, 93, 94, 101, 106, 109, 111,
112, 118, 121, 122, 123, 124, 127, 136, 147,
148, 149, 150, 151, 161, 165, 167, 168, 169,
170, 182, 184, 187, 189, 190, 191
A Priori Bad Antennas Not Flagged 53 / 105 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 50, 57, 61, 62,
64, 73, 74, 89, 90, 95, 97, 102, 115, 120,
125, 132, 133, 135, 139, 179, 185, 201, 205,
206, 207, 220, 221, 222, 223, 224, 227, 228,
229, 237, 238, 239, 240, 241, 244, 245, 261,
320, 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_2460028.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% 0.304424 11.141163 0.388967 9.896114 0.378268 2.711228 0.467872 1.610543 0.700419 0.050378 0.617521
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.989528 16.765842 -1.014169 -0.447440 -0.646223 -0.034438 -0.838816 -0.212141 0.699851 0.583086 0.273744
5 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 9.338567 10.990747 9.443158 9.677807 2.502261 2.748543 1.310251 1.583255 0.041304 0.035225 0.002215
7 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.756347 0.045871 -0.425011 0.274154 -0.296557 0.515344 0.214263 1.029163 0.703278 0.695393 0.266575
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.766194 2.071226 1.652501 1.737853 0.605249 0.861493 0.530155 0.840812 0.659315 0.646339 0.277750
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.115666 -0.298086 3.036648 -0.353543 1.071438 -0.089412 3.061540 -0.023380 0.692784 0.683249 0.267986
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.110373 -1.095465 -0.566935 -0.596317 -1.283869 -0.198706 -0.783779 -0.024730 0.683662 0.672903 0.274692
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 17.538803 -0.007266 0.382915 -0.101223 0.362088 -0.064171 0.122019 0.042281 0.615629 0.701275 0.251631
16 N01 digital_ok 100.00% 0.00% 100.00% 0.00% 0.253137 11.492220 -0.092149 9.893843 0.543085 2.708707 0.057196 1.644798 0.715385 0.049681 0.616916
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.198062 1.694377 1.002540 8.138051 0.673574 3.021842 1.126664 5.883558 0.717124 0.603150 0.312872
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.511369 7.324966 9.468984 1.016147 2.486078 1.406264 1.306469 3.153951 0.039709 0.536993 0.447973
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.029398 -0.295309 -0.150635 0.229788 -0.033195 -0.849438 -0.014072 -0.551670 0.714477 0.690421 0.275028
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.236029 -0.563768 1.664307 -0.245675 2.674636 -0.059643 1.794496 -0.057293 0.709771 0.698411 0.262374
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.317495 -0.186856 0.138008 0.368332 0.152943 0.577598 0.492367 0.828066 0.699452 0.684514 0.261217
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.027367 -0.681473 -0.631468 -0.768636 -1.275945 -0.279296 -0.487611 -0.549101 0.672216 0.659153 0.269019
27 N01 RF_maintenance 100.00% 54.54% 57.73% 7.30% 7.371740 23.638523 8.892581 5.355269 3.203508 2.902210 2.918737 3.623385 0.234504 0.194656 -0.034769
28 N01 RF_maintenance 100.00% 100.00% 1.51% 0.00% 8.936430 13.306884 9.378314 3.481447 2.498852 1.616957 1.346742 3.033896 0.034137 0.452470 0.364288
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.843640 -0.375464 -0.464692 -0.277378 -0.055731 0.187282 -0.304690 -0.194622 0.725961 0.714372 0.258927
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.014777 -0.593774 0.373351 -0.651988 0.598105 -0.264863 0.389407 -0.626348 0.722832 0.715269 0.257777
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.007467 -0.564607 1.273098 1.980351 1.091736 1.276221 1.295976 3.011546 0.727848 0.714471 0.252955
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.727679 17.713571 -0.504052 0.339803 3.735021 0.182062 -0.484033 0.678908 0.658967 0.656682 0.180076
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.166528 11.655076 5.194332 5.334881 2.510063 2.755861 1.480663 1.816706 0.037829 0.063743 0.017234
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.661400 -0.945272 -0.027506 -0.519344 -1.065615 -0.546196 -0.562436 0.419051 0.677051 0.666822 0.269742
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.732976 5.765960 1.252705 0.967038 1.100487 1.004184 1.280479 1.241923 0.701342 0.685438 0.265779
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 0.671078 17.716956 -0.717454 11.468236 -0.908448 2.754800 -0.970318 1.567953 0.690572 0.041191 0.557116
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.333864 1.042992 -0.062695 0.258557 0.375798 -0.286330 0.138590 0.548767 0.717569 0.688403 0.264062
40 N04 digital_ok 0.00% 0.00% 0.00% 74.05% 0.297060 0.825675 0.233191 -0.355391 0.675431 0.913478 2.103897 0.415643 0.482026 0.470867 -0.195396
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.732068 1.278062 1.421635 1.804938 1.019677 1.145401 1.429738 2.219834 0.732414 0.723099 0.252702
42 N04 digital_ok 0.00% 0.00% 0.00% 75.57% -0.018018 1.712443 -0.121079 -0.532452 0.696614 0.682030 1.226434 0.259403 0.492335 0.477671 -0.195593
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.654250 -0.294221 -1.014406 0.892479 1.841136 0.631656 -0.666108 1.209918 0.726138 0.724632 0.253383
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.531890 0.334573 -0.695523 0.559916 -0.472251 0.502558 -0.376175 0.859426 0.727865 0.727536 0.257236
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.124644 3.502578 0.932231 0.907903 0.281402 0.896808 1.031986 1.690280 0.721216 0.710687 0.247403
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.450996 -0.342974 0.111631 -1.039370 -0.011693 -0.438020 0.438211 -0.716373 0.718975 0.711433 0.261495
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 9.670279 11.352423 5.116921 5.039523 2.525534 2.741919 1.592295 1.764442 0.031331 0.076770 0.029927
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.254184 0.270893 -0.872038 0.558214 -0.872793 -0.294769 -0.522237 0.000042 0.684176 0.668735 0.266859
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.501943 -0.208457 0.649073 -0.730649 -0.576211 -1.001511 1.096663 -0.632521 0.668560 0.660105 0.265121
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.400121 1.192905 0.550593 1.690960 0.455938 1.103327 0.682994 2.090867 0.695763 0.682893 0.266651
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.917020 1.116626 0.469415 -0.249598 1.164406 0.432430 3.976525 -0.090700 0.706169 0.692611 0.262438
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.141815 4.453038 0.774321 0.464028 0.902574 0.824739 0.877338 0.523430 0.721326 0.706493 0.259081
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.012835 0.770156 0.175896 -0.635322 0.327406 -0.310171 0.530436 -1.078579 0.724092 0.709687 0.261669
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 5.180780 2.606511 1.349161 -0.533931 1.489207 1.902141 1.018508 0.419403 0.476766 0.523041 0.142542
55 N04 digital_ok 100.00% 10.92% 100.00% 0.00% -0.050505 38.483529 0.141184 6.666498 0.000416 2.922553 0.100633 1.412293 0.470497 0.052439 0.286054
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.843073 0.575226 -1.055008 2.204141 -0.780037 1.719135 -0.718426 2.742948 0.730503 0.730552 0.252486
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.163030 0.903828 -1.030271 0.030189 -0.231664 0.196948 -0.659077 0.205938 0.735540 0.729434 0.251569
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.407993 10.697195 9.412283 9.826236 2.529051 2.766456 1.636544 1.880400 0.041618 0.040438 0.001446
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.338933 0.339014 9.447289 1.139057 2.480808 1.098753 1.527438 1.630990 0.079135 0.724087 0.514209
60 N05 RF_maintenance 100.00% 0.00% 64.65% 0.00% 0.315351 10.571644 0.274767 9.848072 0.241981 2.756178 0.543608 1.654921 0.721741 0.194093 0.481548
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.855951 -0.740275 0.970106 -0.464279 0.259894 -0.547701 0.666416 -0.089849 0.683581 0.692257 0.257930
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.215680 0.202483 0.501305 0.282401 -0.462768 -0.744392 0.417830 -0.261596 0.675966 0.676659 0.261951
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.203536 11.048146 -1.022023 5.373193 -1.271999 2.776622 -0.629932 1.802605 0.687108 0.052644 0.476029
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.499256 -0.464887 -1.008729 -0.079061 -1.076220 -0.712040 -0.287380 0.664886 0.678554 0.662506 0.265644
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 18.891820 17.536451 11.893562 11.823335 2.494385 2.797152 1.388206 1.732345 0.023872 0.036465 0.012482
66 N03 digital_ok 100.00% 19.19% 79.41% 0.00% 1.351748 18.047602 1.270796 11.956455 0.451627 2.770314 0.327053 1.554331 0.418885 0.117187 0.227673
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.598545 -0.430106 -0.628125 0.931030 -0.438339 0.671225 -0.262862 1.280568 0.713154 0.706267 0.262187
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 20.089885 0.383101 11.968961 0.438275 2.431347 -1.070825 1.339133 -0.232478 0.050707 0.697986 0.538112
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.450709 0.345169 1.414832 -0.471031 0.757141 0.364829 1.580335 -0.224759 0.733974 0.722323 0.250971
70 N04 digital_ok 0.00% 0.00% 0.00% 70.16% 0.000542 1.256421 1.302009 2.649714 1.344523 2.127526 2.749979 2.627766 0.506919 0.493987 -0.188959
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 3.537636 -0.250410 -0.154722 0.402527 0.107996 -0.068232 -0.029418 0.607697 0.738547 0.735287 0.247574
72 N04 digital_ok 100.00% 0.00% 0.00% 69.35% 0.125909 0.506352 2.456463 1.133984 0.695432 1.905431 5.293618 1.474244 0.511673 0.498946 -0.188161
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.425412 1.087285 -0.461749 0.834349 0.305754 1.414652 -0.119950 1.023188 0.741467 0.737440 0.251543
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.732253 -0.083561 -0.664441 -0.032223 -0.716275 0.721304 -0.717471 0.394283 0.732052 0.732349 0.255449
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 33.440893 10.397447 0.308880 -0.636539 0.868292 -0.282055 -0.050212 -0.455702 0.561570 0.634687 0.205536
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 18.323997 0.117203 -0.021558 0.449628 0.178454 -0.589223 0.427028 -0.127883 0.583129 0.680246 0.245994
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 0.326871 11.222517 -0.377935 5.359610 -0.914838 2.680682 -0.051613 1.569078 0.685980 0.043755 0.493520
80 N11 not_connected 100.00% 0.00% 84.81% 0.00% 0.259531 11.858901 -0.463704 5.290318 -1.476188 2.704017 -0.801183 1.573191 0.676483 0.109469 0.470832
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 75.537715 51.704387 24.005709 26.249733 13.230707 10.421519 32.433938 31.595308 0.018579 0.016377 0.001881
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 28.765580 46.444801 24.673739 23.881351 30.721346 28.516147 48.402667 46.074950 0.016509 0.016287 0.000883
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 20.881873 34.521210 20.066693 21.969718 7.874117 8.928346 30.847882 33.966420 0.016791 0.016429 0.000879
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.726617 18.961518 8.356397 12.093240 2.874433 2.696389 5.926003 1.661172 0.660871 0.044549 0.414771
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.220950 -0.136368 -0.360761 -0.676066 -1.154853 -0.150755 -0.873561 -0.598314 0.726812 0.720127 0.253964
86 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.487753 0.694389 0.153488 -0.114850 -0.132759 0.337255 -0.000042 0.537226 0.735754 0.728152 0.243625
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.599125 4.919185 1.237350 0.285795 6.416303 0.717716 1.134153 0.364599 0.679192 0.740997 0.229563
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.735644 0.870066 0.884057 1.261251 0.284492 0.142870 0.804225 1.390884 0.743486 0.737249 0.236304
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.422753 0.632664 0.876028 1.195289 0.213536 0.314696 0.743034 1.343126 0.739941 0.738097 0.241511
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.165951 -0.691934 0.687226 -0.817589 1.314284 -0.331843 0.601391 -1.050220 0.729976 0.730661 0.247698
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.251636 0.185112 1.030122 0.799750 0.262776 0.426261 0.877626 0.847915 0.731398 0.730077 0.249630
92 N10 RF_maintenance 100.00% 95.08% 94.76% 0.05% nan nan inf inf nan nan nan nan 0.588213 0.644994 0.360034
93 N10 digital_ok 100.00% 95.84% 95.84% 0.05% nan nan inf inf nan nan nan nan 0.541717 0.537182 0.293966
94 N10 digital_ok 100.00% 94.49% 95.08% 0.05% 163.983021 163.924416 inf inf 1902.564573 1956.293582 386.037884 383.705947 0.676894 0.549617 0.378335
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.278341 1.106673 -0.995724 0.029889 1.117817 0.163348 -0.378380 -0.008852 0.600374 0.577593 0.180149
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.001484 16.823287 0.327748 -0.454080 -0.904550 -0.318257 -0.636202 -0.397603 0.684517 0.600215 0.256619
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.136203 1.366005 -1.069362 0.784604 -1.275931 -0.380591 -0.352438 1.984989 0.677028 0.656515 0.267853
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 5.708480 6.131041 0.394092 1.226337 0.580309 0.920924 0.386209 1.422581 0.719253 0.711972 0.254750
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.792387 0.345837 -1.053005 -0.633682 -0.168874 0.243488 -0.805652 -0.317802 0.727177 0.717600 0.250949
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.259984 3.033549 1.756054 -0.860836 0.648616 -0.026621 0.619532 -0.760255 0.698424 0.725479 0.258703
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.503844 38.736607 0.762577 6.075498 1.093288 1.958487 0.572210 5.326693 0.741757 0.727126 0.239410
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.038315 0.429844 0.614288 1.225925 0.531847 0.287780 0.648909 1.395095 0.747194 0.738497 0.237794
106 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.837724 0.985873 1.650701 0.294579 4.061280 -0.156171 1.513398 0.317881 0.739806 0.738406 0.240053
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.892230 1.539851 0.537558 0.078062 0.714371 0.079014 0.697794 0.235660 0.740902 0.737015 0.239361
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 8.909219 29.116242 9.456972 1.415096 2.473895 2.013612 1.356598 0.139035 0.038562 0.479364 0.223142
109 N10 digital_ok 100.00% 60.70% 100.00% 0.00% 8.588087 10.716833 9.483168 9.655710 2.464484 2.742747 1.192261 1.636757 0.197287 0.039759 0.113958
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 15.447464 -0.146882 0.659004 0.098062 4.091879 0.267698 0.946600 0.149937 0.668734 0.721073 0.238935
111 N10 digital_ok 100.00% 0.00% 70.22% 0.00% 19.233276 10.607411 1.491651 9.725891 0.453599 2.735922 0.540660 1.530482 0.634369 0.157575 0.353695
112 N10 digital_ok 100.00% 0.32% 0.32% 64.11% 0.203223 3.048735 1.741111 8.495088 1.365050 3.641055 3.237457 3.174106 0.471957 0.380109 -0.156069
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.311165 11.669660 4.891575 5.353611 2.443632 2.679439 1.367975 1.612096 0.036444 0.031107 0.003255
114 N11 not_connected 100.00% 100.00% 0.00% 0.00% 10.945528 0.286600 5.021950 -0.530005 2.425564 -1.304110 1.264008 -1.101574 0.052152 0.670166 0.458279
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.002687 -0.975637 -0.746943 -0.372318 -1.058424 -1.339386 -0.136394 -0.943815 0.669816 0.659892 0.269587
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 23.425784 35.945339 21.053140 22.626125 4.791065 8.419573 24.009870 34.143150 0.017458 0.016292 0.001195
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 17.912059 28.970243 19.301406 23.517770 7.438709 9.880581 27.015880 45.583953 0.025759 0.023221 0.003213
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.113645 0.992488 2.779346 -0.402340 1.067463 0.368062 2.575998 -0.296018 0.722266 0.714053 0.249611
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.397585 3.749442 1.450268 5.320749 0.270338 2.046158 0.453494 7.430894 0.703848 0.717264 0.251965
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 5.231791 3.859037 -0.276653 -0.673926 0.737692 0.207378 -0.127696 -0.613776 0.745181 0.731846 0.243665
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 5.027865 6.125097 1.163833 1.237541 0.920886 0.938464 1.303438 1.590886 0.752251 0.742585 0.238955
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 8.991022 0.182089 9.652163 0.940442 2.437674 0.572503 1.293781 1.159063 0.049239 0.743672 0.423985
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.490274 0.134448 1.632097 1.325422 1.792589 0.251627 1.501015 1.407397 0.745172 0.736921 0.242447
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.617389 1.030881 0.540364 1.119278 0.148279 0.649785 0.009069 1.264392 0.697277 0.738741 0.243868
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 8.620645 0.523082 9.416558 2.579318 2.489395 2.283167 1.299526 3.199793 0.036916 0.729294 0.420710
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.121474 -0.702986 -0.376550 -0.541379 -0.067775 -0.568599 -0.253910 -0.926757 0.727109 0.715256 0.261420
131 N11 not_connected 100.00% 0.00% 16.43% 0.00% -0.962586 9.650053 -0.690676 5.224873 -1.161390 2.414090 -1.013546 0.196554 0.694980 0.439506 0.330614
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.043457 -0.028849 -0.883759 -0.609060 -1.131841 -0.983402 -0.891435 -0.428242 0.685016 0.672967 0.263419
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.294709 -1.076533 -0.566024 -0.863495 -0.914592 -1.423908 -0.232176 -0.963117 0.676754 0.668494 0.268209
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 9.890324 11.936574 5.004000 5.337885 2.450413 2.724907 1.321996 1.610948 0.043871 0.037014 0.003635
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.204961 -0.949484 -0.547293 -0.875683 1.255798 0.194257 -0.279023 -0.703015 0.653149 0.648866 0.284589
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 8.132823 -0.295122 9.175775 -0.147705 2.503835 -0.097456 1.380971 0.026780 0.047500 0.659011 0.426147
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 27.370918 40.847312 24.019025 25.748720 12.593149 12.084044 48.640496 48.211682 0.016295 0.016252 0.000745
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.491419 -0.322611 0.318525 -0.969768 -1.029650 -0.994299 -0.376211 -0.809410 0.694066 0.689098 0.260650
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.233826 -0.823498 0.126342 -0.727416 -0.001243 -1.105083 0.271742 -0.976444 0.724207 0.710574 0.248501
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.474175 -0.777411 0.267127 -0.132168 0.657537 -1.338869 0.436136 -0.746346 0.733681 0.713232 0.248214
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.567919 10.764171 -0.090023 9.858562 0.999077 2.757556 1.116616 1.698310 0.739649 0.066986 0.532367
143 N14 RF_maintenance 100.00% 0.00% 100.00% 0.00% 14.480024 10.509338 7.113816 9.831718 0.928866 2.740347 1.226103 1.750332 0.453667 0.034744 0.324486
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.075527 1.024417 -0.260983 1.605033 0.395722 0.450121 0.001967 2.009616 0.746317 0.739346 0.245299
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.013032 0.230505 0.200076 0.245944 0.266048 2.440368 0.398581 0.110102 0.743071 0.730604 0.245109
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.245877 -0.691153 -0.794614 -0.996392 -1.227108 -1.241049 -0.561129 -1.034091 0.724793 0.721651 0.251076
147 N15 digital_ok 100.00% 93.30% 93.51% 0.22% 95.681183 96.215914 inf inf 1245.003724 1251.412418 417.598909 419.870205 0.681172 0.601714 0.286540
148 N15 digital_ok 100.00% 92.49% 93.24% 0.22% 112.371344 110.101546 inf inf 1141.741524 1107.357743 440.307315 433.906649 0.648440 0.496420 0.304761
149 N15 digital_ok 100.00% 91.30% 92.16% 0.27% 111.623010 111.170743 inf inf 1061.997276 1071.542835 469.318124 465.834388 0.668078 0.570792 0.353581
150 N15 digital_ok 100.00% 91.14% 91.46% 0.16% nan nan inf inf nan nan nan nan 0.653155 0.541926 0.366736
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 13.394063 -0.471565 -0.563663 1.153356 -0.311991 -0.241331 -0.261443 1.639499 0.602608 0.670822 0.227674
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 8.639408 -0.734810 9.302495 -0.383917 2.515925 -0.038715 1.399272 -0.260476 0.047630 0.651374 0.434088
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.305212 10.540733 6.874812 9.691466 3.036412 2.755525 4.622416 1.673026 0.598991 0.043175 0.417218
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.735142 0.058525 0.662881 0.901446 0.443052 0.898552 0.760093 1.192537 0.678244 0.676897 0.269960
158 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.028977 -0.248991 -0.763986 -0.909281 0.348774 0.100129 -0.302990 -0.172895 0.689686 0.680278 0.270040
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.331552 16.577899 -0.179361 -0.061294 -0.684079 0.081155 -0.244385 -0.023582 0.681252 0.587405 0.244216
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.341179 -0.813206 0.300922 -0.202745 0.376607 0.557530 0.416077 -0.012953 0.715823 0.708753 0.255425
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.073315 20.532154 0.625031 0.316768 0.734392 -0.375131 0.661338 0.083993 0.726457 0.633748 0.234052
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.811315 -1.110685 -0.445310 -1.062417 -0.496246 0.161340 -0.886400 -0.915548 0.728434 0.723972 0.254930
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.850386 1.465794 0.514398 0.785501 0.492453 0.808078 0.563994 1.036282 0.741887 0.735390 0.250150
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.005731 0.794369 0.996069 1.342010 1.609798 1.314974 0.955104 1.686745 0.742071 0.736330 0.243201
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 15.612318 0.378413 0.572181 -0.154435 0.047333 0.219668 0.366761 0.093696 0.648443 0.733788 0.229190
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.338535 -0.393765 1.186957 -0.004838 0.873864 -1.075378 1.478437 -0.580216 0.739736 0.719913 0.247162
167 N15 digital_ok 100.00% 92.00% 92.22% 0.49% 86.277249 80.990904 inf inf 1041.570081 982.391121 402.683330 394.391589 0.568455 0.447969 0.328450
168 N15 digital_ok 100.00% 92.16% 91.68% 0.16% 99.299960 91.342524 inf inf 1183.157829 1306.749462 391.062340 419.290000 0.592286 0.650039 0.302138
169 N15 digital_ok 100.00% 92.11% 92.32% 0.27% 64.614587 68.400195 inf inf 1098.537635 1110.511818 426.908727 432.362940 0.583592 0.554173 0.278601
170 N15 digital_ok 100.00% 92.05% 92.27% 0.16% nan nan inf inf nan nan nan nan 0.617315 0.571099 0.306453
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.379716 -1.348677 1.107367 -1.013891 -0.553460 -1.172262 0.841232 -0.682566 0.677967 0.682690 0.259599
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.043423 -0.023605 1.671257 0.355460 0.664556 -0.921412 0.477265 -0.439272 0.666567 0.670550 0.275763
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.174235 3.320915 2.323352 2.395221 1.628057 1.931002 0.943261 1.310094 0.633239 0.614460 0.277096
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.135780 -0.827193 0.127505 -0.603768 -0.498525 0.001243 0.204191 -0.472573 0.682573 0.684806 0.268994
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.026044 11.236833 -0.543553 9.956992 0.537780 2.709661 0.184573 1.709014 0.702060 0.066820 0.519649
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.905048 0.145018 1.404540 0.960148 0.842620 0.469139 1.398442 1.375074 0.719517 0.711712 0.257212
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.490817 10.534607 -0.454978 9.649185 0.224857 2.749949 -0.833774 1.657187 0.719279 0.068052 0.485720
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.246098 0.621494 0.266933 0.636959 0.614736 0.620505 0.263783 0.715647 0.724593 0.720292 0.244687
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 12.060813 -0.202561 6.419331 -0.375233 3.209654 0.007132 4.166625 -0.192410 0.619944 0.726275 0.249248
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.000542 -0.053432 -0.936386 0.113558 -0.485241 0.137870 -0.621843 0.246531 0.734764 0.728068 0.251673
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.155995 -0.945807 -0.324465 -0.747449 -1.243604 -1.137394 -0.792140 -1.058838 0.728761 0.722200 0.253174
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.501365 -0.866692 1.171419 -0.463698 6.438469 -0.296511 1.161564 -0.965456 0.730155 0.715311 0.249602
189 N15 digital_ok 100.00% 92.11% 91.84% 0.16% nan nan inf inf nan nan nan nan 0.599017 0.571020 0.309858
190 N15 digital_ok 100.00% 92.00% 92.16% 0.22% 88.241349 87.089617 inf inf 1222.842936 1238.796705 465.452014 470.034209 0.606599 0.595164 0.279366
191 N15 digital_ok 100.00% 93.03% 93.24% 0.00% nan nan inf inf nan nan nan nan 0.585990 0.527039 0.303789
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.185130 3.611432 1.842083 2.550234 3.476210 2.047737 1.085412 1.396507 0.656809 0.623518 0.279107
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.576396 3.216120 2.533845 2.323805 1.794091 1.848839 0.997361 1.170770 0.629844 0.612309 0.271638
200 N18 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.132674 25.768610 5.038504 0.152352 2.514553 0.925745 1.429873 0.599867 0.044629 0.370868 0.249938
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.295427 2.514118 1.345241 2.108717 0.459807 1.435540 0.262988 1.033436 0.681415 0.657562 0.271892
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 0.046736 0.528800 0.351917 -0.316266 -0.987963 0.036357 -0.419854 1.734751 0.704300 0.694764 0.260129
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.080398 9.104816 1.724844 -0.567079 0.809670 0.159730 2.522050 -0.473791 0.727495 0.716069 0.249120
205 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.899879 -0.977419 3.071838 -0.876731 0.644404 -0.602789 0.747554 -0.514499 0.631498 0.711755 0.280249
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.181687 2.152434 0.747299 2.784623 0.056821 0.618046 0.537953 1.894410 0.696643 0.654718 0.243127
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.065734 0.349095 -1.055696 0.004838 -0.867828 0.157232 -0.477740 0.053963 0.711791 0.699932 0.248714
208 N20 dish_maintenance 100.00% 92.11% 93.03% 0.16% 124.332281 124.705808 inf inf 1232.050886 1115.327204 440.912074 440.097648 0.616775 0.536124 0.330093
209 N20 dish_maintenance 100.00% 91.46% 92.22% 0.43% 134.599866 137.167423 inf inf 1269.860055 1158.814986 489.934456 443.226609 0.595668 0.525401 0.303468
210 N20 dish_maintenance 100.00% 91.46% 91.73% 0.27% 138.101835 134.303797 inf inf 1161.884933 1332.877473 421.903906 449.045609 0.635092 0.588082 0.333146
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% 0.099414 11.039103 -0.504146 5.380692 -0.739206 2.694629 -0.114678 1.639678 0.686098 0.042974 0.583848
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.020513 -1.099032 -0.357576 -0.834817 -1.207253 -1.256821 -0.737361 -1.114653 0.696045 0.683950 0.266409
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.708845 -0.625832 -1.061570 -1.067715 1.302956 -1.017366 -0.641035 -0.916969 0.700681 0.693201 0.260213
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.293998 -0.536565 -0.715165 -0.439539 -1.148840 -1.326788 -0.814469 -1.015221 0.704604 0.695420 0.256481
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.938112 -0.926585 -0.287331 1.076770 -0.812910 2.423314 -0.243184 0.959329 0.707852 0.687115 0.250880
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.841680 3.259252 2.691846 2.462732 1.998271 1.875863 1.089469 1.256539 0.649717 0.656849 0.266870
225 N19 RF_ok 100.00% 0.00% 40.76% 0.00% -0.619766 10.368795 -0.076336 5.148035 -1.092452 2.650345 -0.755916 0.785123 0.709928 0.341345 0.438398
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.677163 12.938346 -1.018163 -0.254763 -1.026063 0.350702 -0.785711 -0.331308 0.708639 0.627756 0.248998
227 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.604990 -0.859001 2.390643 -0.811640 -0.375176 2.763279 1.416472 -0.299222 0.657698 0.692023 0.267470
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.009171 -0.319189 -0.031638 -0.697522 -1.295317 -0.605686 -0.657064 -0.469751 0.687011 0.681374 0.259923
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.151129 0.058769 -0.052300 0.415001 -1.236240 -0.832234 -0.841699 -0.461374 0.687155 0.670033 0.267476
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.443613 -0.667509 0.693633 -0.751834 -0.416243 -0.459165 0.519321 -0.553698 0.665096 0.668548 0.271471
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.527460 -0.351631 -0.030116 -0.119660 -1.182131 -0.940998 -0.731396 -0.879526 0.687946 0.675581 0.274292
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.058080 -0.726225 -0.804539 -0.291131 -1.312503 -1.278719 -0.901797 -0.879182 0.695485 0.681741 0.267931
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.375828 -0.328331 -0.498055 -1.043301 -1.381492 -0.895609 -0.906788 -0.739010 0.695479 0.687545 0.265581
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.405293 -1.028760 -0.874949 -0.425675 -1.032888 -1.355988 -0.779021 -1.019045 0.702471 0.689145 0.264945
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 12.448224 0.222985 -0.451914 0.510562 -0.266583 -0.641953 -0.413233 -0.292917 0.606888 0.683383 0.245658
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 12.577142 -1.196591 0.009910 -0.661821 -0.055375 -0.550540 -0.260221 -0.374708 0.613817 0.687256 0.252201
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.018306 -0.840308 0.038329 -0.672916 -0.818759 -0.598282 0.115767 -0.450222 0.685914 0.686440 0.253372
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.765526 1.703838 -0.210848 -0.895981 -1.426349 -1.219652 -0.900433 -0.683190 0.695715 0.675098 0.261153
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.491191 11.484285 -1.034785 4.991625 -0.772856 2.746468 -0.546855 1.628841 0.686526 0.042473 0.586753
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.707453 -0.539473 -0.404723 -0.689595 -1.092326 -1.312782 -0.886837 -1.041176 0.685993 0.671574 0.260489
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 8.212745 10.150375 0.504472 0.493849 0.833602 0.464038 0.980854 0.914270 0.698876 0.681518 0.263325
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.566562 0.227850 1.095929 0.406331 -0.272227 -0.638727 -0.191494 -0.454419 0.570515 0.553390 0.287739
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.091264 1.469274 0.261878 0.565814 -0.994888 -0.398502 -0.486955 -0.350251 0.573543 0.551138 0.267074
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.180015 -0.963152 0.126881 -0.667265 -1.257663 -0.673550 -0.590071 0.445083 0.614696 0.596268 0.275531
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 0.916340 -0.302480 0.177065 -1.052488 2.524066 -0.806073 -0.366432 -0.046832 0.555489 0.552198 0.280990
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.149740 2.289439 -0.152592 -0.594302 -0.394009 -0.598673 1.015417 0.387024 0.522215 0.514704 0.282655
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, 15, 16, 17, 18, 27, 28, 32, 34, 36, 37, 40, 42, 47, 51, 52, 54, 55, 58, 59, 60, 63, 65, 66, 68, 70, 72, 77, 78, 79, 80, 81, 82, 83, 84, 87, 92, 93, 94, 96, 101, 104, 106, 108, 109, 110, 111, 112, 113, 114, 117, 118, 121, 122, 123, 124, 126, 127, 131, 134, 136, 137, 142, 143, 147, 148, 149, 150, 151, 155, 156, 159, 161, 165, 167, 168, 169, 170, 180, 182, 184, 187, 189, 190, 191, 200, 204, 208, 209, 210, 211, 225, 226, 242, 243, 246, 262]

unflagged_ants: [7, 8, 9, 10, 19, 20, 21, 22, 29, 30, 31, 35, 38, 41, 43, 44, 45, 46, 48, 49, 50, 53, 56, 57, 61, 62, 64, 67, 69, 71, 73, 74, 85, 86, 88, 89, 90, 91, 95, 97, 102, 103, 105, 107, 115, 120, 125, 128, 132, 133, 135, 139, 140, 141, 144, 145, 146, 157, 158, 160, 162, 163, 164, 166, 171, 172, 173, 179, 181, 183, 185, 186, 192, 193, 201, 202, 205, 206, 207, 220, 221, 222, 223, 224, 227, 228, 229, 237, 238, 239, 240, 241, 244, 245, 261, 320, 324, 325, 329, 333]

golden_ants: [7, 9, 10, 19, 20, 21, 29, 30, 31, 38, 41, 44, 45, 53, 56, 67, 69, 71, 85, 86, 88, 91, 103, 105, 107, 128, 140, 141, 144, 145, 146, 157, 158, 160, 162, 163, 164, 166, 171, 172, 173, 181, 183, 186, 192, 193, 202]
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_2460028.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.1.1.dev3+gb291d34
3.2.3.dev149+g96d0dd5
In [ ]: