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 = "2460019"
data_path = "/mnt/sn1/2460019"
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-15-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/2460019/zen.2460019.21271.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/2460019/zen.2460019.?????.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/2460019/zen.2460019.?????.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 2460019
Date 3-15-2023
LST Range 6.069 -- 16.036 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, 70, 112
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating N07
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 65 / 198 (32.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 140 / 198 (70.7%)
Redcal Done? ❌
Never Flagged Antennas 57 / 198 (28.8%)
A Priori Good Antennas Flagged 69 / 93 total a priori good antennas:
3, 5, 7, 15, 16, 17, 20, 31, 37, 38, 40, 42,
45, 53, 54, 55, 56, 65, 66, 67, 70, 71, 72,
81, 83, 86, 88, 93, 94, 101, 103, 107, 109,
111, 112, 118, 121, 122, 123, 124, 127, 128,
136, 140, 144, 147, 148, 149, 150, 151, 158,
161, 162, 165, 167, 168, 169, 170, 173, 181,
182, 184, 187, 189, 190, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 33 / 105 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 50, 57, 61, 62, 64,
73, 74, 89, 90, 95, 110, 115, 125, 132, 133,
139, 185, 222, 228, 229, 237, 238, 239, 241,
245, 324, 325
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_2460019.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.767654 16.734324 0.304853 12.580162 0.440484 7.612107 -0.136415 1.706042 0.551959 0.039046 0.486186
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.576643 28.784027 -0.745403 -0.379262 -1.022386 3.702750 -0.944859 13.922731 0.564637 0.439773 0.355428
5 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 13.165977 16.464389 11.696839 12.261564 6.776093 7.662939 0.729284 0.621471 0.036619 0.031597 0.001549
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.309288 0.056548 -0.827917 0.209028 -0.005812 0.686015 8.730440 10.724462 0.575888 0.578147 0.349928
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.001008 -1.514163 0.021592 0.557280 -0.069011 0.801865 1.372183 1.506214 0.574262 0.574900 0.344186
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.668110 -0.534962 3.875278 -0.714297 0.587764 -0.171000 2.371651 -0.497332 0.553187 0.572509 0.347799
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.016310 -0.977911 0.096526 -0.936263 -0.364725 0.143123 -1.179733 -0.301630 0.571160 0.567966 0.346984
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 32.783900 0.217324 0.048832 0.319769 1.527278 0.931357 0.269316 3.097111 0.436424 0.572529 0.354538
16 N01 digital_ok 100.00% 0.00% 100.00% 0.00% 0.264436 17.209761 -0.433091 12.583986 0.851090 7.588189 2.422536 3.010061 0.581833 0.037734 0.499194
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.953822 7.645881 1.080624 10.993425 0.604505 3.144205 0.249121 3.861735 0.581037 0.376555 0.419480
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 13.401470 10.645036 11.734226 0.982626 6.768068 3.713188 0.913146 40.932824 0.035238 0.387127 0.311884
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.199908 -0.051383 -0.605439 0.511129 -0.304918 1.210822 -0.554579 -0.054793 0.590295 0.593926 0.349438
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.531778 -1.350594 2.323340 -0.715337 4.481176 0.883003 1.881629 -0.140713 0.574972 0.589487 0.344534
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.096929 -0.088471 -0.088246 0.551784 0.071035 1.403503 -0.094276 0.068421 0.565994 0.566530 0.335420
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.640970 -0.141007 0.165420 -0.055410 0.283016 0.693301 -0.134853 -1.049203 0.544695 0.548618 0.339837
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.875641 15.633636 11.798742 12.364604 6.756468 7.657627 2.888517 2.422623 0.030030 0.030156 0.000623
28 N01 RF_maintenance 100.00% 100.00% 8.91% 0.00% 12.533864 22.496280 11.612413 4.719862 6.779140 4.296226 2.188386 39.524709 0.029613 0.255163 0.194300
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.213035 -0.771058 -0.917960 -0.626462 -0.021296 0.447300 2.538345 2.359551 0.597623 0.596346 0.350979
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.336920 -1.363135 0.550009 -1.114233 1.208293 0.252334 0.691447 -0.100915 0.589088 0.600038 0.348455
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.662672 -1.206571 1.654520 1.582919 1.128745 -0.513168 1.062333 10.786679 0.598485 0.595648 0.343874
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 22.111175 27.675827 -0.595873 -0.038227 1.355752 -0.025847 9.510429 7.537160 0.496639 0.503676 0.216960
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 14.506432 17.519108 5.895963 6.326346 6.724705 7.623731 1.130632 2.811185 0.034818 0.048786 0.008868
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.111137 -0.547929 0.602049 -1.380395 2.620682 -1.122398 0.298629 -0.183023 0.550133 0.538782 0.335427
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.723571 9.129956 1.487935 1.325465 1.381073 1.870275 0.838108 1.044549 0.553089 0.550787 0.365091
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 1.974090 28.522804 -0.937189 15.455062 -0.579977 7.605746 -0.590457 4.472351 0.551440 0.030613 0.435909
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.692795 3.713496 -0.531849 -0.187012 0.295650 -0.650850 1.828049 9.248128 0.577168 0.551165 0.363203
40 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.048387 0.585491 -0.069588 -0.731122 -0.495493 0.759956 2.226548 43.809298 0.587377 0.584996 0.350955
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.549695 1.155053 1.992911 1.354083 1.678595 -0.478944 -0.047510 0.079071 0.590803 0.596742 0.351217
42 N04 digital_ok 100.00% 0.00% 0.00% 100.00% -0.647857 4.045676 -0.617639 1.695814 1.490392 26.356409 -0.361616 1.248956 0.248822 0.238905 -0.276025
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.523738 0.045534 -0.330116 1.214269 -1.060012 1.069180 -0.810993 0.825046 0.604258 0.602253 0.342378
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.319255 0.036350 -0.727302 -0.020634 -0.874300 0.495859 -1.040683 -0.409950 0.604008 0.611914 0.345602
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.189645 4.696582 0.824806 1.361027 -0.265264 1.444829 0.602560 13.268773 0.588806 0.590836 0.336465
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.991204 -0.161508 -0.294668 -1.171315 -0.089482 -0.376083 -0.397074 -0.650025 0.591053 0.604692 0.352518
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 13.383656 17.156625 5.792607 5.932149 6.720881 7.584069 3.302164 0.962255 0.031896 0.053565 0.014101
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.161773 1.334145 -0.543234 1.584276 -0.928326 1.819801 -0.527433 -2.307576 0.551521 0.564824 0.342299
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.269491 0.472883 -0.291338 -0.130701 -0.100708 -0.997728 0.292781 5.310790 0.514658 0.539517 0.338179
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.162582 1.360854 0.250149 2.330572 -0.107855 1.297175 0.016849 0.127989 0.552226 0.549042 0.360651
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.695019 2.378174 0.353861 -0.349359 1.211063 1.614459 64.942971 1.450719 0.562689 0.567049 0.358064
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.468094 6.733586 0.797896 0.554391 1.212335 1.078066 2.283901 1.288975 0.577664 0.580321 0.358431
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.707242 2.184677 0.128850 -0.592827 2.347878 0.165290 11.046037 0.939672 0.586355 0.595231 0.359067
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 15.915654 5.062121 2.538644 0.157815 3.639801 2.226165 -1.075388 0.036874 0.298374 0.356762 0.148107
55 N04 digital_ok 100.00% 4.86% 100.00% 0.00% 0.811644 61.449160 0.965052 7.954841 0.437524 7.683771 1.382790 0.352094 0.259231 0.039765 0.093787
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.821389 0.479619 -0.839917 2.953673 -0.683806 4.002492 -1.006840 2.379014 0.605606 0.599839 0.337510
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.310611 2.724888 -1.005622 0.087985 -0.104171 1.000643 -0.336064 3.176124 0.612676 0.605566 0.336128
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.938664 16.054160 11.692842 12.493873 6.685896 7.592351 1.908559 1.613537 0.035681 0.035677 0.001911
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.912693 0.920443 11.212531 1.488485 6.588207 2.176719 0.442740 11.524422 0.046255 0.597585 0.456854
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.545445 15.974530 0.025941 12.523114 0.195533 7.589332 1.235073 3.228366 0.590180 0.068268 0.465718
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.522678 -0.401769 0.292956 -0.887179 0.653882 -0.824157 -0.187359 1.021647 0.532539 0.563148 0.337718
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.152861 1.045564 -0.355149 0.926730 -0.384116 0.114841 0.912203 -0.506809 0.528366 0.565104 0.344166
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.205074 16.601949 -0.562537 6.368109 0.003047 7.681321 0.364739 3.365182 0.554131 0.044809 0.433674
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.024241 -0.134143 -1.197879 -0.307428 -0.294020 -1.081515 2.437993 0.026610 0.538265 0.523723 0.332470
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 27.230442 11.830604 15.003131 1.825648 6.795672 4.273457 5.908322 168.199865 0.022794 0.017346 0.004809
66 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.668370 1.601866 1.436755 1.296277 2.238553 -0.052459 6.155443 3.479970 0.564765 0.570266 0.363354
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.275609 -0.743067 -0.854315 2.100146 -0.397035 1.473345 5.980201 2.299480 0.580936 0.579402 0.357039
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 29.489656 0.766307 15.154178 0.805316 6.656291 0.364766 6.007598 -0.692813 0.033777 0.595555 0.464269
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.574165 0.222120 1.464428 -0.639531 -0.022407 0.934319 3.276785 -0.042489 0.595872 0.606256 0.348390
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.650090 2.138592 1.608362 3.912222 2.520944 1.170089 3.921356 0.769851 0.254779 0.242552 -0.273460
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 6.198627 -0.525078 -0.531767 0.278398 0.254860 0.788276 -0.294001 0.410881 0.609053 0.617996 0.340059
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.159468 1.812891 -0.567639 1.790660 0.208994 0.855350 0.896794 15.497707 0.616091 0.615726 0.338003
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.791219 0.991225 -0.885097 -0.530097 0.766137 0.564050 -0.380247 -0.565848 0.614763 0.620404 0.343943
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.182571 0.101580 -0.275467 -0.120935 -0.337268 1.541686 -1.304455 3.486731 0.610058 0.614907 0.346374
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 63.405025 10.996350 0.853587 -0.458553 4.675486 3.973602 4.884434 10.729729 0.298984 0.502121 0.322003
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 33.506157 0.713225 -0.251693 1.264235 1.753075 0.758120 1.937358 0.012322 0.391595 0.569301 0.338774
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.676687 16.922258 -0.893663 6.384224 -0.842492 7.570208 0.846242 0.049088 0.539960 0.039690 0.433654
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 0.176735 17.936145 0.118399 6.280447 -0.567556 7.593415 -0.935288 1.612428 0.548149 0.050802 0.437807
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 52.734329 53.998366 30.393546 25.940226 18.012464 12.621726 741.960703 403.348793 0.025352 0.017021 0.005846
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 37.920949 47.175253 27.814000 28.557897 10.673107 12.979351 523.842049 572.821715 0.025181 0.022161 0.002813
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 28.731580 65.283919 23.678151 27.787744 6.861511 12.355516 383.197806 545.888173 0.028404 0.023717 0.003913
84 N08 RF_maintenance 100.00% 78.13% 100.00% 0.00% 22.148858 28.731160 14.735649 15.554077 5.298859 7.552196 4.255445 5.225746 0.184570 0.035062 0.118478
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.844601 -0.493990 -1.260589 -1.059886 -0.040253 -0.241616 0.090715 -0.352185 0.600729 0.595107 0.342844
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.214204 1.295575 -0.792460 -0.377081 1.121813 0.228701 0.203513 24.564540 0.603797 0.607847 0.336100
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.174140 8.235548 -0.026380 0.229717 -0.004593 1.057304 15.715074 7.973879 0.616386 0.624955 0.339443
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.446527 -0.054365 0.960330 1.436917 0.259791 -0.610761 4.772779 1.267900 0.604408 0.609061 0.328510
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.893792 0.510449 0.695419 1.485292 -0.436241 0.427874 -0.385203 0.087446 0.603318 0.613425 0.336073
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.695550 -0.499794 -0.566831 -0.653563 -0.921539 -1.166373 0.731221 3.312410 0.589173 0.616871 0.341284
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.228168 0.257661 1.087778 0.896499 0.021296 -0.085965 0.671281 0.607250 0.586769 0.605292 0.345867
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.524502 0.051912 11.676286 0.821571 6.784107 1.908047 0.481248 0.993595 0.035471 0.600109 0.403810
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.877129 16.264744 11.833459 12.607231 6.663879 7.574237 2.770373 2.258139 0.030488 0.025055 0.002910
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 13.659838 16.575297 11.951211 12.386169 6.652228 7.608635 1.289968 0.973249 0.025455 0.025365 0.001038
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.983538 1.833994 -1.067846 0.703480 2.390911 1.869121 -0.584969 0.137960 0.419216 0.414001 0.182638
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.588395 30.961308 1.179145 -0.391654 0.002752 1.060824 -1.159363 -0.256508 0.558053 0.442857 0.338028
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.345934 3.608540 -1.077579 0.088086 -0.535889 0.676040 -0.375861 14.021334 0.536253 0.516603 0.338714
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.308034 9.239193 0.154240 1.754587 0.475141 1.579434 0.101193 1.163599 0.585098 0.587365 0.348880
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.768656 1.135618 -1.038838 -1.050018 -0.276305 0.541485 -0.387754 6.266970 0.599399 0.602892 0.343560
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.072785 5.655516 -0.967378 -0.856851 64.034553 4.634803 1.879105 14.778004 0.586194 0.611167 0.340105
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.357349 65.915448 -0.538938 8.043684 1.265858 -0.287653 0.974811 2.502958 0.614599 0.589339 0.341602
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.189257 0.323698 0.803001 1.559622 0.745581 0.126013 -0.207522 0.089142 0.607825 0.612078 0.331320
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.321330 1.576092 -0.421157 0.007981 1.245525 -0.467672 -0.075127 0.275042 0.609693 0.617299 0.335355
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 3.330497 1.317308 0.481542 -0.069523 0.700700 0.574259 8.146849 5.920164 0.601762 0.616528 0.335545
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.547743 45.885941 11.734861 1.680525 6.731538 2.738116 1.914809 2.822207 0.034132 0.292659 0.152248
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.119126 15.697581 11.204868 11.672256 6.733133 7.644082 0.466583 1.954850 0.061220 0.038642 0.016876
110 N10 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.864819 0.101046 -0.523698 -0.015480 1.562775 1.857890 0.098967 -0.458431 0.592128 0.598217 0.358628
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 22.602967 15.990539 1.236952 12.358267 5.318099 7.643940 58.475947 2.518763 0.502560 0.056352 0.366759
112 N10 digital_ok 100.00% 3.73% 4.91% 95.09% -0.403315 9.414273 2.313631 11.191841 2.695494 4.834895 1.032860 0.913331 0.230113 0.135964 -0.215216
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 14.777961 17.641206 5.508022 6.379089 6.647614 7.556792 1.932306 0.922007 0.033975 0.031132 0.001757
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.254484 12.517996 16.625948 12.719661 7.728749 8.640395 373.460827 104.104713 0.020822 0.026787 0.003587
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.118386 -0.889663 -1.330567 -0.014838 -0.702067 -0.619824 1.107203 -0.937033 0.519965 0.531733 0.344626
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 32.793319 52.879435 25.054231 26.889166 8.085506 12.482347 351.707076 427.361149 0.017791 0.016530 0.001222
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 35.093663 35.220409 27.016103 25.442101 8.422973 10.417520 391.096528 406.473561 0.021568 0.024019 0.002214
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.263136 1.950319 3.407403 -0.668122 0.604714 0.870120 8.417876 7.269155 0.578395 0.597388 0.341837
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.898714 3.336106 -1.248533 7.160612 0.424791 -0.487527 4.981636 24.532344 0.603215 0.580609 0.333818
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.091850 7.147217 -0.807367 -0.964872 0.341804 0.465174 -0.364241 -0.645010 0.616771 0.618372 0.337591
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.747907 9.425442 1.392792 1.637983 0.799118 0.481139 -0.072835 0.412430 0.615739 0.620934 0.338046
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 12.676995 0.507897 12.033168 1.213285 6.638098 0.949405 0.785289 0.710439 0.040956 0.621725 0.426278
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.214312 0.049317 0.970087 1.488664 -0.448406 0.174391 1.480586 1.579915 0.605358 0.610654 0.339548
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.698228 8.957388 -0.313460 2.467605 2.057561 0.482080 40.105011 0.832260 0.549125 0.601382 0.333842
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 12.127383 0.420627 11.669972 0.575975 6.765822 2.131420 0.426093 6.375464 0.034185 0.606059 0.402886
128 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -0.500578 -0.672812 -1.289504 -0.003340 -0.568127 -0.912288 0.076997 4.711920 0.593015 0.596880 0.360284
131 N11 not_connected 100.00% 0.00% 40.60% 0.00% -1.158613 15.726926 -0.264160 6.206093 -0.612982 6.542400 -0.889896 0.536569 0.553592 0.228784 0.392439
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.938582 0.863395 -0.389163 -1.010265 -0.172855 -0.845114 -0.751754 0.382862 0.543460 0.531605 0.340752
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.398883 -1.085069 -1.191800 -0.594564 -0.964671 -1.047923 -0.274826 1.709608 0.527350 0.538159 0.349625
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.881096 17.596539 5.660172 6.340420 6.647190 7.576056 0.560082 1.171881 0.040018 0.034617 0.003093
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.205175 -1.346798 -0.808570 -1.263127 2.570118 0.424707 7.524554 0.409804 0.527397 0.545493 0.363157
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 11.604337 6.182179 11.338666 -0.002742 6.766647 1.130077 2.017634 1.645182 0.039027 0.538365 0.392788
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 37.422442 63.224058 28.474067 28.619981 16.266357 10.248112 638.224468 451.122037 0.023734 0.022660 0.001870
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.318388 -0.030317 1.330487 -1.220609 0.713036 -0.776219 -1.341253 -0.322898 0.573113 0.570865 0.336009
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 7.596564 -0.935234 -0.897399 -0.323470 7.149792 -0.523940 82.192048 10.340566 0.573121 0.603223 0.337046
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.899640 -0.737820 0.231816 0.446687 1.472301 -0.345279 0.879515 -1.037295 0.600992 0.610231 0.336052
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.793600 16.063764 -0.183619 12.531413 1.862226 7.625536 20.180263 2.070053 0.606007 0.045093 0.499312
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 13.220556 15.983624 11.619480 12.500686 6.262915 7.642429 0.486297 1.893080 0.098951 0.030135 0.055576
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.184231 0.539473 -0.688731 4.291184 0.066715 3.450514 -0.549272 0.138664 0.614188 0.601407 0.345229
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.680871 0.454417 -0.361674 -1.283352 0.095115 0.529936 -0.040299 -0.190585 0.609933 0.608500 0.343235
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.322294 -0.614768 -1.099255 -0.900783 -0.786111 -1.318217 -0.501907 -0.559749 0.575379 0.588684 0.340638
147 N15 digital_ok 100.00% 99.73% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.211536 0.173557 0.159299
148 N15 digital_ok 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.087596 0.208859 0.156443
149 N15 digital_ok 100.00% 99.89% 99.84% 0.00% 228.826088 229.182752 inf inf 3254.275332 3252.298142 5301.848477 5324.666144 0.341932 0.339112 0.235848
150 N15 digital_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.306595 0.240576 0.146003
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 25.413390 0.377374 -0.481042 1.406044 1.512065 -0.598578 0.508127 15.257508 0.421990 0.506763 0.299779
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.011698 -1.457375 11.506423 -0.858352 6.783482 0.111412 2.594186 1.357932 0.040314 0.550959 0.417578
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.261998 15.834863 9.663303 12.287228 3.162463 7.681688 1.349186 2.534377 0.383060 0.038331 0.295424
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.386522 -0.458060 0.592938 1.294392 0.162576 1.149547 0.677701 0.733177 0.549945 0.562723 0.350349
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.183211 0.513820 -1.245245 -1.244657 2.063777 0.405495 10.932628 22.836708 0.568167 0.572663 0.345107
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.555135 25.966908 -0.968534 -0.550232 -0.297066 3.122283 -0.001718 23.952603 0.542730 0.465457 0.317717
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.026669 -0.995439 0.007239 -0.170408 -0.021469 1.115209 -0.465060 1.611071 0.587449 0.593587 0.340989
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.418580 33.275353 0.597636 0.183597 0.531410 0.411708 -0.014814 1.442087 0.595508 0.481113 0.316286
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.742164 -1.011246 -0.306744 -1.298795 0.199032 0.407290 6.314203 0.197505 0.609278 0.613617 0.342596
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.543052 1.539533 0.383090 1.012822 0.309895 0.986407 0.009293 1.600447 0.609851 0.613605 0.345637
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.616316 1.005838 -0.024812 1.971714 -0.040382 2.448795 0.406380 1.621317 0.605318 0.604568 0.336132
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 29.154621 -0.080172 -0.155763 -0.409254 3.830151 0.345632 11.375293 0.080935 0.488932 0.608771 0.337204
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.770150 -0.001008 1.261484 0.609849 0.414018 -0.297812 0.250946 -1.426252 0.595597 0.604074 0.338563
167 N15 digital_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.136821 0.067840 0.074511
168 N15 digital_ok 100.00% 99.84% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.334067 0.389973 0.233978
169 N15 digital_ok 100.00% 99.84% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.540234 0.523373 0.478295
170 N15 digital_ok 100.00% 99.62% 99.62% 0.00% nan nan inf inf nan nan nan nan 0.538403 0.541172 0.456939
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.198477 -1.179942 0.382942 -0.349359 -0.570436 -0.499064 -0.175666 -0.312741 0.500252 0.541592 0.353602
173 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.355764 7.044566 4.474720 4.318722 5.397598 6.187382 -3.706148 -1.658717 0.508491 0.498017 0.338990
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.503217 -1.087811 -0.187862 0.272482 1.872228 13.300682 -0.190058 0.567487 0.567682 0.574817 0.348091
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.182075 16.825846 -1.043226 12.679624 0.452745 7.570396 16.567028 2.880652 0.586082 0.051429 0.487242
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.153303 0.161433 1.295703 1.084114 0.026016 0.642206 -0.036231 5.866134 0.592054 0.595301 0.347546
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.151984 15.743614 -0.293612 12.219646 -0.343907 7.666338 5.041584 2.332246 0.605214 0.047101 0.460903
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.121087 1.055465 0.129559 0.647030 0.942121 0.340894 0.870718 -0.009293 0.593303 0.599520 0.334255
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 19.715748 -0.591824 7.082291 -0.716224 4.969343 0.574026 11.676057 0.174588 0.465335 0.607538 0.355605
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.431315 -0.383070 -1.215626 -0.125182 0.588753 0.291650 0.744051 2.188649 0.606883 0.604745 0.344920
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.095469 -1.210740 0.336191 -0.364307 -0.608132 -0.700263 -0.501030 -0.732978 0.602883 0.605068 0.346887
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.291543 -0.859139 -1.142345 0.034957 5.326025 -0.380035 8.749847 -0.090862 0.589543 0.592841 0.347339
189 N15 digital_ok 100.00% 99.57% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.516654 0.470146 0.439571
190 N15 digital_ok 100.00% 99.57% 99.62% 0.00% nan nan inf inf nan nan nan nan 0.530802 0.588736 0.481223
191 N15 digital_ok 100.00% 99.68% 99.62% 0.00% nan nan inf inf nan nan nan nan 0.534227 0.586191 0.538620
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 2.067630 7.481130 2.326981 4.491666 2.436087 6.327192 0.906639 -3.561957 0.538689 0.508073 0.348692
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.956499 6.532280 4.766132 4.188219 5.574886 5.957486 -3.680514 -3.597692 0.504151 0.503439 0.339662
200 N18 RF_maintenance 100.00% 100.00% 45.84% 0.00% 14.495612 42.087658 5.657852 0.055119 6.781902 2.816257 2.038765 9.057773 0.040223 0.218977 0.143777
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.562057 5.438279 2.935396 3.834557 2.543244 5.222706 -1.155791 -2.960981 0.568440 0.560614 0.339240
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 1.027399 1.627201 1.434155 -0.408086 0.873798 -0.059152 -1.143515 46.052237 0.584400 0.565361 0.340980
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.527944 15.822908 1.668162 -0.879294 0.185244 0.398697 18.015657 3.195570 0.593506 0.599960 0.346320
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.713823 -0.297038 3.672241 -0.719477 2.663698 0.313499 50.587244 4.492274 0.446839 0.575521 0.376786
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.988015 6.129004 -1.248418 3.408851 3.911468 1.708130 -0.555967 0.465788 0.555363 0.464636 0.353935
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.655551 2.546361 -0.922341 -0.261057 -0.826425 -0.955396 6.890298 -0.075482 0.560564 0.545862 0.337769
208 N20 dish_maintenance 100.00% 99.73% 99.73% 0.05% nan nan inf inf nan nan nan nan 0.454656 0.414409 0.228169
209 N20 dish_maintenance 100.00% 99.73% 99.62% 0.05% nan nan inf inf nan nan nan nan 0.339984 0.428459 0.247932
210 N20 dish_maintenance 100.00% 99.78% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.575024 0.702506 0.368601
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% 0.496260 16.629605 -1.226586 6.410093 -0.663121 7.573337 0.266577 1.517241 0.523054 0.038947 0.443749
220 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.123349 -0.669916 0.267076 -0.581581 -0.446706 -0.525022 5.252181 -0.946151 0.572409 0.567125 0.341643
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.311268 -0.189463 -1.363464 -0.943719 0.937216 -1.007426 7.677058 -0.342334 0.559583 0.572664 0.340339
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.231146 -0.300119 -0.450063 -0.049451 -0.679079 -0.669902 2.173901 -1.353256 0.568241 0.578954 0.342523
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.931855 -0.976877 -0.952260 -0.533679 -0.836650 -0.756453 1.741416 8.222193 0.557291 0.573913 0.341511
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 8.321239 6.752866 4.938569 4.343213 5.792392 6.041628 -3.607162 -3.095042 0.526566 0.547803 0.335707
225 N19 RF_ok 100.00% 0.00% 91.36% 0.00% -0.514595 16.098928 0.523905 6.124799 -0.781502 7.366208 -1.285143 1.879419 0.571352 0.133175 0.460471
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.547288 23.561655 -0.728640 0.368681 -1.109720 2.698413 -0.793741 -0.135768 0.557710 0.456020 0.333291
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 4.837856 0.577021 2.830854 -0.114511 0.749983 0.401849 6.931984 6.729965 0.447510 0.532519 0.360798
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.711747 -0.253461 0.808944 -1.164944 0.166437 -0.791418 0.735968 1.558906 0.544152 0.527104 0.341743
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.503579 0.808957 0.720812 1.247854 -0.170310 1.014221 -1.626297 -1.844614 0.539412 0.538483 0.354071
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.273345 -0.333582 0.651520 -1.137614 -0.768608 -0.903100 0.210188 -0.725426 0.507298 0.544813 0.349676
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.414720 -0.085854 1.159657 0.652768 0.241846 -0.690046 -1.759209 -1.800417 0.563098 0.561715 0.349121
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.536688 -0.725269 0.304894 0.034237 -0.174925 -1.135980 0.696322 1.431677 0.563406 0.563135 0.347390
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.824202 0.318507 0.410506 -1.140964 -0.283981 -1.292055 9.605274 7.857362 0.527584 0.561887 0.355074
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.576599 -1.024848 -0.581544 -0.007239 -1.082863 -0.800851 1.091857 -0.527495 0.561336 0.566224 0.356105
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 23.925633 1.423485 0.069138 1.519143 1.991130 1.325270 -1.117278 -0.187136 0.422205 0.557306 0.345333
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 21.585724 -0.894004 0.986282 -1.019176 3.725017 -0.703323 31.010814 0.504318 0.451131 0.542523 0.343201
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.620914 -0.726309 -0.337825 -1.245454 -0.831737 -0.725699 2.908544 6.939636 0.517000 0.545587 0.347974
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.198516 1.068924 0.959187 -0.750316 0.236519 -0.782690 -1.878234 0.121489 0.547875 0.535828 0.348597
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.405139 17.334286 -1.019617 5.847271 -0.777716 7.651726 -0.854211 0.446917 0.526403 0.038097 0.445181
261 N20 RF_ok 100.00% 0.00% 0.00% 0.00% -0.767195 -0.138960 -0.131636 -0.476329 -0.698881 -1.029316 15.939676 4.588371 0.533324 0.528227 0.344169
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 13.230618 16.780175 0.438607 0.393250 0.551595 0.328885 0.367742 3.176053 0.548490 0.542196 0.366231
320 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.917345 1.437652 2.364512 1.168138 1.626573 0.652862 -0.391925 1.656460 0.458932 0.459737 0.339741
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 2.542709 3.318057 1.103623 1.420621 0.621157 1.474809 1.092329 -0.958660 0.442574 0.441497 0.322541
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.424464 -0.927339 0.968478 -1.200365 0.706157 -1.051115 -1.349313 0.666929 0.467249 0.459303 0.337662
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.588327 -0.099743 -0.703447 -1.240924 3.144838 -0.783160 4.861414 0.933726 0.425858 0.446158 0.322248
333 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.873538 4.776784 -0.435577 -0.960480 -0.964955 -0.859580 1.462591 1.977152 0.417841 0.422877 0.304362
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, 15, 16, 17, 18, 20, 27, 28, 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, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 92, 93, 94, 96, 97, 101, 102, 103, 104, 107, 108, 109, 111, 112, 113, 114, 117, 118, 120, 121, 122, 123, 124, 126, 127, 128, 131, 134, 135, 136, 137, 140, 142, 143, 144, 147, 148, 149, 150, 151, 155, 156, 158, 159, 161, 162, 165, 167, 168, 169, 170, 173, 179, 180, 181, 182, 184, 187, 189, 190, 191, 192, 193, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 220, 221, 223, 224, 225, 226, 227, 240, 242, 243, 244, 246, 261, 262, 320, 329, 333]

unflagged_ants: [8, 9, 10, 19, 21, 22, 29, 30, 35, 41, 43, 44, 46, 48, 50, 57, 61, 62, 64, 69, 73, 74, 85, 89, 90, 91, 95, 105, 106, 110, 115, 125, 132, 133, 139, 141, 145, 146, 157, 160, 163, 164, 166, 171, 183, 185, 186, 222, 228, 229, 237, 238, 239, 241, 245, 324, 325]

golden_ants: [9, 10, 19, 21, 29, 30, 41, 44, 69, 85, 91, 105, 106, 141, 145, 146, 157, 160, 163, 164, 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_2460019.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.dev133+g7c00d5f
In [ ]: