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 = "2460031"
data_path = "/mnt/sn1/2460031"
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-27-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/2460031/zen.2460031.21274.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 1851 ant_metrics files matching glob /mnt/sn1/2460031/zen.2460031.?????.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/2460031/zen.2460031.?????.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 2460031
Date 3-27-2023
LST Range 6.858 -- 16.820 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
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 40, 42, 70, 72, 112
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 122 / 199 (61.3%)
Redcal Done? ❌
Never Flagged Antennas 76 / 199 (38.2%)
A Priori Good Antennas Flagged 61 / 94 total a priori good antennas:
3, 5, 7, 15, 16, 17, 31, 37, 38, 40, 42, 45,
53, 54, 55, 65, 66, 67, 69, 70, 72, 81, 83,
86, 93, 94, 101, 103, 109, 111, 112, 118, 121,
122, 123, 124, 127, 136, 140, 147, 148, 149,
150, 151, 158, 161, 165, 167, 168, 169, 170,
173, 181, 182, 184, 189, 190, 191, 192, 193,
202
A Priori Bad Antennas Not Flagged 43 / 105 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 50, 57, 61, 62,
64, 73, 74, 89, 90, 95, 115, 125, 132, 133,
135, 139, 185, 201, 206, 220, 222, 223, 228,
229, 237, 238, 239, 240, 241, 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_2460031.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.588815 11.743852 0.324350 11.243443 0.919549 4.066329 -0.402991 1.538642 0.535428 0.041132 0.464266
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.175273 18.955558 -0.888218 -0.414398 -0.640804 0.849181 -0.984291 0.322922 0.548843 0.424075 0.355286
5 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 9.314959 11.613344 10.676016 10.999664 3.955988 4.127111 0.990596 0.859837 0.036513 0.031256 0.001665
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.838067 0.110360 -0.618444 0.184254 -0.031093 0.779760 10.914006 13.976513 0.560594 0.568862 0.352043
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.918174 3.110298 2.262743 2.299570 1.865761 2.038428 -2.197023 -1.916875 0.535348 0.544127 0.334662
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.677683 -0.392456 3.430555 -0.495556 1.109856 0.188025 2.485714 -0.506902 0.538646 0.564351 0.350691
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.048645 -1.165275 -0.098918 -0.764766 -0.956468 -0.040596 -1.124457 -0.097740 0.552877 0.554727 0.346297
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 20.984219 0.360637 1.174388 0.335048 1.028987 0.878855 0.392967 2.643583 0.424885 0.562290 0.357203
16 N01 digital_ok 100.00% 0.00% 100.00% 0.00% 0.215250 12.112913 -0.265259 11.242478 0.883682 4.056540 2.108424 2.459932 0.564291 0.038125 0.475798
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.168403 4.092671 1.090136 9.495312 1.267046 0.557334 0.013444 4.235460 0.566888 0.405556 0.406077
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.484945 4.814671 10.694121 1.182649 3.930062 1.094250 0.866154 46.581253 0.035180 0.360739 0.287235
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.155570 -0.890611 -0.289215 -0.870106 0.198231 0.512647 -0.449162 1.367400 0.575148 0.587530 0.350673
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.680304 -0.968636 2.372402 -0.355180 1.154922 0.473193 1.746948 0.030081 0.562268 0.581475 0.346140
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.245433 0.525313 0.004185 0.416410 0.714947 0.595973 0.922019 0.775204 0.557245 0.560725 0.338940
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.002973 -0.691563 -0.486309 -0.711448 -0.557834 0.199991 -0.394770 -0.656465 0.531126 0.540109 0.342420
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 7.463413 25.390511 10.204647 6.211186 3.222678 2.641102 8.805665 43.685948 0.076229 0.073356 -0.029050
28 N01 RF_maintenance 100.00% 100.00% 6.21% 0.00% 8.823106 15.096553 10.598546 4.152343 3.945304 0.491508 1.763773 20.679335 0.030201 0.256992 0.192880
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.051040 -0.502889 -0.623042 -0.404480 0.193492 0.457281 1.960224 0.930999 0.582666 0.587861 0.353646
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.314839 -0.705043 0.803377 -0.841315 1.575939 -0.344881 3.679305 -0.535818 0.576699 0.595692 0.353660
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.566031 -0.602189 1.380626 3.030976 1.584447 0.370921 0.838050 26.431601 0.586698 0.582333 0.344130
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.968702 18.557079 -0.199389 -0.082354 -0.256255 -0.426111 1.758502 3.303721 0.471701 0.497976 0.202820
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.166256 12.281964 5.774856 5.995121 3.898903 4.078051 1.530761 2.820751 0.033425 0.050161 0.010513
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.484793 -0.936535 0.057198 -0.654243 -0.755008 -0.548676 2.427669 -0.198209 0.542710 0.539255 0.340323
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.793735 6.207637 1.348818 1.048227 1.515899 1.556794 0.827778 1.411942 0.537483 0.539183 0.365112
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 0.844472 19.337697 -0.496348 13.069619 -0.763118 4.086741 -0.084198 4.149354 0.533611 0.031872 0.423673
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.360506 1.657800 -0.095141 0.341019 0.776878 -0.441445 4.153619 11.299106 0.562208 0.542449 0.362008
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.351541 1.310680 0.178781 -0.428482 0.903690 0.540744 18.729583 2.027769 0.228114 0.221375 -0.276360
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.857942 1.205103 1.584662 2.290823 1.764845 0.289228 0.588281 0.727207 0.576922 0.584192 0.353665
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% 0.030645 3.610834 -0.221235 1.772224 1.041927 2.318252 0.190341 2.984939 0.250662 0.235113 -0.275009
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.672752 0.159549 -0.734852 0.984932 -0.811004 0.966219 -0.305660 1.382567 0.589695 0.597312 0.346000
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.564824 0.571495 -0.893113 0.584662 -0.260840 0.606178 -0.603794 -0.137393 0.591180 0.605419 0.348751
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.053796 4.048967 0.995175 0.941651 0.663812 1.477050 1.619510 8.482448 0.577943 0.586192 0.337942
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.344262 -0.361376 0.102035 -1.041876 0.367755 -0.358977 0.469062 -0.088818 0.580531 0.599099 0.356032
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 9.493691 11.963306 5.684113 5.654531 3.900982 4.054291 3.187073 1.183430 0.031502 0.052973 0.013951
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.413174 0.717348 -0.680935 0.890782 -0.983931 0.564498 -1.151071 -1.997537 0.541805 0.557453 0.344304
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.443013 -0.153735 0.651548 -0.651348 -0.515803 -0.970252 0.171257 2.470064 0.509665 0.536377 0.342500
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.676229 0.976989 0.546599 1.890879 0.752281 1.570120 0.401501 0.417487 0.536457 0.536926 0.361449
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.724337 1.356280 0.234295 -0.299397 1.317977 0.706741 84.989503 1.265696 0.546997 0.555167 0.360960
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.439714 4.521655 0.786917 0.451372 1.549473 1.255694 2.635550 0.331359 0.564202 0.568832 0.360984
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.364613 1.146224 0.102405 -0.484209 1.547823 -0.293361 11.248683 5.410523 0.568885 0.582099 0.361803
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 5.475115 3.081761 1.950270 -0.336650 2.016506 1.500372 -1.458553 -0.125210 0.306464 0.349489 0.148775
55 N04 digital_ok 100.00% 15.61% 100.00% 0.00% 0.494317 42.602102 0.501964 7.525319 0.033552 4.174188 4.015938 2.147466 0.245057 0.040059 0.097486
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.762367 0.941284 -0.986732 2.412105 -0.452616 2.404489 -0.848821 0.454473 0.590992 0.593814 0.341260
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.239342 -0.025417 -0.584084 -0.520549 -0.293565 0.438413 0.432408 0.728043 0.596967 0.602387 0.341843
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.286464 11.228119 10.631011 11.165084 3.884324 4.060929 1.851961 1.572967 0.035880 0.035553 0.001798
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.257049 0.715566 10.664641 1.298909 3.832561 1.676667 1.309127 4.042773 0.046223 0.596322 0.447182
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.792364 11.146123 0.183697 11.197720 0.537553 4.053977 1.223748 3.094548 0.578198 0.073435 0.458265
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.451089 -0.921416 0.976547 -0.671745 0.055549 -0.522942 0.458908 0.933847 0.523703 0.564652 0.346882
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.357362 0.848745 0.190625 0.627364 -0.687378 -0.429143 0.798582 -1.453844 0.523665 0.558931 0.344648
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.194643 11.544552 -0.867713 6.041611 -0.983439 4.108931 -0.688706 2.548467 0.542874 0.044398 0.416789
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.434946 -0.521269 -1.141672 -0.134265 -0.802081 -0.787674 0.529296 0.588050 0.530764 0.525857 0.337583
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 20.232555 19.138906 13.505881 13.481925 3.945520 4.134894 5.108362 6.399600 0.023612 0.030921 0.007757
66 N03 digital_ok 100.00% 44.30% 100.00% 0.00% 2.427738 19.798736 1.824854 13.641311 1.306880 4.055355 -1.628621 6.517651 0.202824 0.047334 0.098473
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.583670 -0.214532 -0.296222 1.680874 -0.018264 1.171150 5.226172 1.727808 0.564384 0.567984 0.357099
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 21.630412 1.304739 13.583807 1.087795 3.855529 0.267192 5.797559 -0.391275 0.034122 0.578140 0.444349
69 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.879228 5.000040 1.588131 -0.655311 0.766001 0.585332 2.956098 0.304768 0.583145 0.591355 0.347164
70 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.051107 2.012574 1.436332 3.056842 1.781459 1.647660 5.035298 1.971960 0.252390 0.236453 -0.272578
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 3.811135 0.084133 -0.268260 0.467342 0.309864 0.199073 0.752884 2.009166 0.594466 0.609413 0.344838
72 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.303233 1.415976 2.718363 1.273009 0.723096 1.146361 17.364080 2.078213 0.259675 0.251689 -0.273947
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.632002 1.400905 -0.672143 1.597158 0.645186 0.647927 0.602859 1.374253 0.602023 0.608982 0.345148
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.779583 0.152814 -0.434553 -0.100596 -0.740054 0.282916 -0.978345 1.517755 0.597582 0.611494 0.349502
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 37.692378 10.700593 0.428845 -0.594286 2.167671 -0.203202 0.963844 -0.818878 0.331682 0.489693 0.272714
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 21.170360 0.595106 -0.102825 0.801748 0.692952 -0.012064 0.071205 -0.387550 0.395887 0.565140 0.337060
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 0.370156 11.806016 -0.562539 6.019601 -0.749835 4.027029 0.223144 0.105382 0.535822 0.039519 0.422648
80 N11 not_connected 100.00% 0.00% 54.94% 0.00% -0.139266 11.167531 -0.177850 5.639232 -0.904071 1.391278 -1.217231 1.186968 0.537046 0.166491 0.408352
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 76.030329 32.787397 38.551156 22.949911 31.206558 5.537295 1365.668261 277.966161 0.016628 0.016528 0.000717
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 23.683354 43.141810 22.225904 23.136169 4.739912 10.013440 261.478053 428.219300 0.016772 0.016489 0.000804
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 27.603004 39.594108 24.562002 22.937832 10.838517 7.680309 494.989255 414.898478 0.016462 0.016483 0.000756
84 N08 RF_maintenance 100.00% 68.94% 100.00% 0.00% 15.013563 20.888806 13.088178 13.773708 2.530568 4.019494 3.832944 4.730890 0.199122 0.047047 0.134832
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.480643 1.372718 -1.105203 -0.909597 -0.577031 0.603355 -0.840373 1.425732 0.591293 0.592892 0.345560
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.279214 1.045750 0.701856 0.234600 0.279271 0.984380 0.232511 15.681232 0.590214 0.601853 0.339969
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 20.958371 5.239687 1.886228 0.287800 3.750528 1.458704 10.095737 0.389913 0.493655 0.618221 0.323606
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.875488 0.802756 0.944356 1.455711 0.664574 0.202732 0.000693 -0.140217 0.595075 0.605818 0.335061
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.397220 0.475190 0.912773 1.282359 0.549398 0.888932 -0.374832 -0.139931 0.591505 0.609360 0.341205
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.121691 -0.448813 -0.340815 -0.614095 -0.272195 -1.003344 -0.278614 1.110503 0.582320 0.612399 0.346659
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.182099 0.432037 1.081268 0.810751 0.938990 0.753881 -0.258202 -0.305852 0.580542 0.602649 0.350331
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 8.840719 0.176411 10.652805 0.604727 3.944174 0.932340 0.635615 0.744293 0.034845 0.596955 0.399763
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.040736 11.418844 10.740057 11.251946 3.862901 4.037207 2.357512 1.868458 0.029710 0.024969 0.002461
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.680470 11.655386 10.853487 11.080888 3.893279 4.066075 1.045078 0.857145 0.025367 0.025206 0.001014
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.112721 1.330183 -0.911921 0.372705 1.262755 0.673898 -0.810746 -0.728255 0.410115 0.405930 0.178407
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.474961 19.584103 0.733504 -0.405077 -0.193436 0.524230 -1.278225 -0.237760 0.546499 0.448941 0.334047
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.161028 2.169089 -1.150599 0.680725 -0.875180 -0.797842 1.977964 9.665853 0.528931 0.514842 0.340032
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.271952 6.423855 0.323233 1.383856 1.049047 1.538269 0.021251 -0.074889 0.572712 0.579498 0.350702
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.691418 0.634690 -0.919340 -0.811088 -0.018299 0.161757 -0.866769 5.955348 0.588758 0.595237 0.346173
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.524929 3.553127 2.388990 -0.640742 1.989241 0.589620 -2.591090 14.916938 0.573360 0.605110 0.344675
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.397940 45.640125 0.919424 7.131053 0.900606 0.245005 1.809202 0.083764 0.593990 0.584459 0.330919
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.252864 0.589753 0.610397 1.379852 0.999567 0.629842 -0.039243 -0.201415 0.599866 0.608814 0.336338
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.614996 1.076118 0.110933 0.241766 0.044392 0.244910 0.360468 -0.245063 0.598605 0.614372 0.339555
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 3.633530 1.713447 0.440270 -0.004185 1.478578 0.360902 3.195864 2.592772 0.587627 0.610352 0.335761
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 8.844224 32.226632 10.677122 1.421721 3.896027 1.645523 1.774599 1.077252 0.034043 0.300083 0.155372
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 8.575442 11.274594 10.723724 10.975237 3.905332 4.111635 0.575423 1.702127 0.065730 0.034836 0.021510
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 23.629428 -0.048500 0.906727 0.006074 1.411897 0.600307 1.039974 -0.390711 0.474658 0.593369 0.333277
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 18.227388 11.226214 1.399205 11.058536 1.756436 4.091321 8.868327 2.209732 0.472624 0.060417 0.334728
112 N10 digital_ok 100.00% 2.05% 2.05% 97.95% 0.357418 5.927735 1.934462 9.873031 1.941578 1.594674 1.429133 1.005369 0.227559 0.135565 -0.222539
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.352894 12.305531 5.421080 6.011527 3.848809 4.023964 2.188207 1.411029 0.033039 0.030442 0.001620
114 N11 not_connected 100.00% 100.00% 0.00% 0.00% 11.043254 0.665106 5.569799 -0.299689 3.832329 -0.981582 0.661402 -0.683208 0.044404 0.543132 0.413731
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.246133 -0.921560 -0.965286 -0.216718 -0.841406 -1.047351 -0.546579 -1.240805 0.515841 0.532500 0.348798
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 28.367620 41.397969 23.479823 26.363547 6.632864 12.713138 354.405995 485.958859 0.017510 0.016263 0.001284
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 22.266526 33.709896 21.846515 26.787263 8.723467 10.382456 359.152952 597.276816 0.021988 0.019744 0.002145
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.215780 0.801108 3.038756 -0.635079 1.529376 0.754711 5.239186 3.689037 0.567718 0.589759 0.344113
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.207846 2.627703 1.951596 6.087680 1.364805 0.571253 -0.708244 16.466459 0.581694 0.581276 0.330837
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 5.833609 4.313795 -0.492860 -0.863492 0.312759 0.096807 -0.527776 -0.811950 0.605457 0.612228 0.340154
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.177992 3.472836 2.713659 1.135842 2.440546 0.553114 -2.884378 -1.885751 0.582520 0.611473 0.343456
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 8.878426 0.412366 10.895447 0.979748 3.839672 1.054910 0.642218 0.382064 0.041061 0.618355 0.414981
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.249276 1.027905 2.131383 1.445153 1.654696 0.542715 0.370757 0.406304 0.593515 0.606025 0.340586
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.735906 3.837399 0.279149 1.520659 0.075591 1.778667 1.711185 2.595770 0.594903 0.606751 0.345638
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 8.551995 0.782993 10.645225 1.109088 3.941545 1.800073 0.630698 0.806663 0.032708 0.601184 0.395542
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.168775 -0.564563 -0.548057 -0.318201 0.226356 -0.561159 1.280159 3.049950 0.582802 0.592982 0.361596
131 N11 not_connected 100.00% 0.00% 57.27% 0.00% -1.084545 11.094068 -0.462422 5.944432 -0.726241 3.286411 -1.063975 0.345469 0.545114 0.214003 0.394675
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.840127 -0.027787 -0.522906 -0.820900 -1.025287 -0.308544 -0.961005 -0.483497 0.537368 0.534324 0.343020
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.428950 -1.121007 -0.788343 -0.732698 -0.518610 -1.245137 -0.456350 0.341062 0.521945 0.537271 0.349636
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 9.936901 12.509870 5.556549 6.001636 3.848344 4.067868 1.238150 1.702478 0.039945 0.033944 0.003315
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.655626 -1.080798 -0.607392 -1.081137 0.366066 0.351317 -0.000693 -0.187815 0.513655 0.532926 0.363767
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 8.049037 -0.386991 10.367286 -0.183366 3.935244 -0.030313 1.480393 0.193489 0.039120 0.538222 0.391966
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 28.015349 48.144252 25.855030 24.983776 8.946918 7.798708 539.333811 420.296659 0.016377 0.016324 0.000731
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.003216 -0.133624 0.698006 -1.119846 0.040596 -0.990046 -1.393197 0.685885 0.560751 0.566313 0.337943
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 3.456982 -1.050911 -0.305515 -0.604866 6.332688 -0.488803 93.378396 11.164275 0.564495 0.596848 0.339735
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.342695 -0.562122 0.250902 0.107050 0.642523 -0.749947 -0.209796 -1.485218 0.592276 0.602921 0.338399
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.241138 11.256722 -0.224556 11.206603 1.059871 4.069294 21.017496 2.119470 0.597411 0.046557 0.486219
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.421143 11.173567 10.526985 11.173433 3.530159 4.085788 0.751907 1.840482 0.102453 0.030826 0.058469
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.451648 -0.091916 -0.416749 -1.100651 0.596085 0.553124 -0.604812 -0.527790 0.605463 0.618825 0.347303
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.140167 0.482074 0.266195 0.528011 0.273593 2.976213 -0.079903 0.779534 0.600364 0.607984 0.345118
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.467685 -0.790037 -1.052488 -0.921784 -1.059534 -1.272828 -0.645973 -0.931668 0.567391 0.588346 0.345395
147 N15 digital_ok 100.00% 98.87% 98.76% 0.00% nan nan inf inf nan nan nan nan 0.437827 0.462325 0.318462
148 N15 digital_ok 100.00% 99.03% 99.14% 0.00% nan nan inf inf nan nan nan nan 0.507036 0.467311 0.346991
149 N15 digital_ok 100.00% 98.65% 98.81% 0.00% nan nan inf inf nan nan nan nan 0.625490 0.497236 0.409017
150 N15 digital_ok 100.00% 98.97% 99.35% 0.00% nan nan inf inf nan nan nan nan 0.397059 0.265431 0.345869
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 15.359204 -0.592264 -0.541201 1.229551 0.401369 -0.071663 -0.326611 11.371625 0.423695 0.517259 0.308432
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 8.445482 -0.956901 10.514429 -0.495410 3.943334 0.287613 2.065186 0.304556 0.040815 0.537836 0.404069
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.438911 11.118344 9.315530 11.018386 1.526298 4.118286 2.590616 2.114873 0.335077 0.037749 0.251570
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.764426 0.060146 0.709619 1.051784 0.744724 1.310766 0.062821 0.031363 0.536651 0.555079 0.353988
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.224973 -0.054385 -1.078540 -1.110733 0.412154 -0.007972 4.898558 14.564169 0.555748 0.564858 0.348570
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.428236 18.577507 -0.192048 -0.193205 -0.678780 0.415661 0.469408 0.980998 0.531754 0.435874 0.307899
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.419097 -0.799761 0.272771 -0.290230 0.801347 0.900331 -0.411671 -0.016300 0.576691 0.590035 0.345519
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.259826 23.998579 0.639916 0.310806 1.038054 -0.370740 -0.066256 0.216798 0.586325 0.481744 0.315693
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.737776 -1.027390 -0.271617 -1.035101 -0.452389 0.060638 3.123158 -0.614283 0.596537 0.608431 0.346245
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.613385 1.412686 0.517752 0.820041 0.867420 1.275891 0.199036 1.075652 0.600847 0.611479 0.349142
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.317712 1.069326 1.272883 1.504372 0.971882 1.898592 0.439926 1.543252 0.595218 0.605631 0.341088
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 18.981715 0.118234 0.576478 -0.264914 0.447694 0.387017 0.729017 -0.435490 0.473306 0.607098 0.334137
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.422004 -0.242152 1.274515 0.278588 0.906820 -0.882529 0.129220 -1.568559 0.585875 0.599092 0.340664
167 N15 digital_ok 100.00% 98.76% 98.87% 0.05% nan nan inf inf nan nan nan nan 0.366481 0.285738 0.261180
168 N15 digital_ok 100.00% 98.87% 98.87% 0.00% nan nan inf inf nan nan nan nan 0.432669 0.401016 0.293817
169 N15 digital_ok 100.00% 99.03% 99.24% 0.00% 183.836560 184.365453 inf inf 1906.005931 1882.798428 7535.183046 7383.722682 0.329979 0.340180 0.262060
170 N15 digital_ok 100.00% 98.92% 98.97% 0.00% nan nan inf inf nan nan nan nan 0.494911 0.481761 0.386412
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.363432 -1.371760 1.175792 -1.172306 -0.662965 -1.249291 -0.093062 0.663096 0.501593 0.540192 0.353029
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.232865 0.506790 2.279069 0.747639 1.858060 -0.393766 -2.569212 0.031210 0.530158 0.541283 0.355075
173 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 4.640976 4.539889 3.021312 3.056585 3.042404 3.227957 -3.209047 -2.077289 0.497665 0.498010 0.338365
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.747242 -0.017674 0.235327 1.084762 0.253023 2.580318 -0.441593 6.222706 0.541032 0.568940 0.351663
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.080659 11.816876 -0.794421 11.315004 0.778842 4.038604 17.606470 2.678388 0.572787 0.052808 0.472738
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.404434 0.612165 1.614041 1.094580 1.113238 0.817977 -0.093441 4.107026 0.579486 0.590472 0.351462
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.376753 11.070727 -0.623901 10.960646 -0.746050 4.114074 6.581922 2.471979 0.592605 0.048296 0.445989
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.025417 0.975666 0.747962 1.204719 1.435705 1.268455 0.207290 0.024609 0.585435 0.595396 0.337550
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 15.212685 -0.218752 8.126495 -0.274481 2.811786 0.017389 2.313755 -0.293561 0.378109 0.604184 0.369734
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.117487 -0.033215 -1.118521 0.100952 -0.329245 0.297789 -0.336682 0.487338 0.595479 0.602167 0.346359
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.957954 -0.995837 -0.052678 -0.612460 -0.882791 -0.848725 -0.948479 -0.863077 0.591486 0.600129 0.347331
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.387457 -0.565607 0.137052 -0.213614 0.916230 -0.356104 3.697888 -0.704398 0.579743 0.590009 0.350831
189 N15 digital_ok 100.00% 98.97% 99.03% 0.00% nan nan inf inf nan nan nan nan 0.445109 0.439109 0.325499
190 N15 digital_ok 100.00% 98.81% 98.87% 0.00% 174.383713 174.281077 inf inf 1792.321669 1780.359055 6896.975745 6845.660590 0.449569 0.444987 0.392497
191 N15 digital_ok 100.00% 99.14% 99.19% 0.00% 168.853334 169.214633 inf inf 1647.793183 1628.629134 6010.251330 5834.997768 0.371719 0.448291 0.367095
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 2.441016 4.821200 1.967185 3.189501 1.502491 3.288542 -2.120084 -3.266691 0.524876 0.504569 0.342651
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 4.987962 4.202589 3.212176 2.885639 3.062669 3.050889 -3.311091 -3.112910 0.495557 0.489257 0.333946
200 N18 RF_maintenance 100.00% 100.00% 38.74% 0.00% 10.183231 29.173453 5.600830 0.140242 3.932672 1.213454 1.719421 3.337486 0.040437 0.219252 0.141986
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.197406 3.619964 1.886585 2.733840 1.299692 2.673625 -1.739585 -3.007310 0.556048 0.552199 0.340737
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.460222 0.730659 0.739196 -0.476904 0.108094 0.291418 -1.576140 43.320834 0.573042 0.566140 0.337955
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.015782 10.739833 1.919819 -0.684169 0.828784 0.127087 16.951613 0.673936 0.581159 0.593782 0.345987
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 5.437592 -0.567981 4.155435 -0.534612 1.016668 0.504490 2.734421 16.344501 0.410700 0.578549 0.393702
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.666842 3.498448 1.058314 3.243791 -0.116294 -0.242791 0.076040 0.379475 0.520572 0.476450 0.324299
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.942232 0.880609 -1.029668 0.267683 -0.724218 0.147115 5.726181 -0.218030 0.555601 0.547295 0.340065
208 N20 dish_maintenance 100.00% 98.76% 98.76% 0.00% nan nan inf inf nan nan nan nan 0.484463 0.446532 0.402335
209 N20 dish_maintenance 100.00% 98.81% 98.65% 0.00% nan nan inf inf nan nan nan nan 0.461127 0.443647 0.438792
210 N20 dish_maintenance 100.00% 98.76% 98.65% 0.00% nan nan inf inf nan nan nan nan 0.563751 0.479559 0.496220
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% -0.041369 11.609807 -0.715614 6.045565 -0.458786 4.032667 -0.050928 1.100816 0.518163 0.038421 0.428574
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.913222 -1.047616 -0.088858 -0.780108 -1.108423 -0.940321 1.414980 -1.092586 0.561617 0.562751 0.344166
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.805232 -0.679383 -1.095686 -0.983362 -0.181251 -1.029070 5.471000 -0.767513 0.555649 0.569687 0.343933
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.454118 -0.242759 -0.491960 -0.280484 -0.798182 -0.046645 2.801161 -1.180195 0.559616 0.573633 0.344129
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.230287 -0.981209 -0.437659 0.078621 -0.675083 -0.885050 -0.023526 3.313145 0.551842 0.555684 0.336659
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 5.409670 4.472731 3.456404 3.132198 3.367353 3.185823 -3.498052 -3.022101 0.515959 0.539405 0.336141
225 N19 RF_ok 100.00% 0.00% 90.82% 0.00% -0.258060 11.220151 0.243845 5.815559 -0.765410 3.862605 -1.278186 1.628007 0.560649 0.139230 0.454291
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.158281 14.723229 -0.872601 -0.037957 -0.975189 0.955390 -0.943253 -0.867998 0.550633 0.470407 0.332838
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 2.173885 -1.204865 2.657531 -0.953620 -0.667750 -1.104488 10.382918 -0.212728 0.458760 0.548177 0.375546
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.325303 -0.323846 0.277794 -0.883615 -0.554401 -0.412813 0.408747 0.474286 0.530893 0.528317 0.338838
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.311839 0.571328 0.255356 0.766971 -0.396615 -0.083174 -1.627258 -1.958824 0.529611 0.533174 0.355262
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.874010 -0.726487 0.676839 -0.939681 -0.102096 -0.331325 0.332653 -0.725381 0.506055 0.542939 0.353397
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.068860 -0.443126 0.317914 0.186886 -0.612047 -0.814569 -1.542767 -1.651096 0.553242 0.558000 0.352434
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.721752 -0.184585 -0.218119 0.145687 -0.548163 -0.829129 -0.718880 0.336363 0.551926 0.559966 0.350567
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.629066 -0.253418 -0.287493 -1.088665 -0.949843 -0.920905 -0.556205 1.534796 0.549709 0.558483 0.349405
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.141931 -0.980989 -0.671475 -0.240705 -1.117693 -0.933421 0.569977 -1.259234 0.552705 0.560388 0.357433
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 15.013628 0.224462 -0.500510 0.548312 0.369560 -0.183963 -0.927829 -1.105627 0.419433 0.554776 0.348837
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 12.908875 -1.225009 0.461845 -0.884569 1.250966 -0.494089 2.646969 -0.313723 0.443020 0.543529 0.348528
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.046317 -0.736240 -0.094877 -0.593489 -0.542025 -1.002961 2.265602 4.359472 0.512773 0.540601 0.347938
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.202049 1.870936 0.458970 -0.795402 -0.346909 -1.031686 -1.796004 0.411832 0.537272 0.525624 0.345746
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.528290 12.094433 -1.034340 5.604156 -0.609020 4.090458 -0.609297 0.323340 0.520072 0.037686 0.429508
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.302094 -0.204946 -0.167608 -0.523999 -0.849654 -1.098959 0.704342 -0.446402 0.526094 0.527049 0.347629
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 9.198887 11.657689 0.428919 0.531727 1.195202 0.525824 -0.168271 1.475773 0.535879 0.535436 0.365386
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.715440 0.822872 1.584086 0.729790 0.779486 -0.093851 -2.087606 -0.297196 0.440267 0.445641 0.337414
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.704151 2.221584 0.594789 0.909665 -0.186940 0.221957 -1.124626 -1.575485 0.427250 0.430113 0.322060
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.834530 -0.970345 0.453048 -0.813720 -0.325352 -0.836637 -1.199801 0.053737 0.458694 0.452846 0.342105
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.129916 -0.182239 -0.857249 -1.128691 -0.880304 -0.768210 0.835751 -0.743451 0.430976 0.436814 0.326194
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.968286 2.847412 -0.098154 -0.616859 -0.628078 -0.825337 1.465993 0.432867 0.408517 0.413070 0.304821
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, 27, 28, 31, 32, 34, 36, 37, 38, 40, 42, 45, 47, 51, 52, 53, 54, 55, 58, 59, 60, 63, 65, 66, 67, 68, 69, 70, 72, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 92, 93, 94, 96, 97, 101, 102, 103, 104, 108, 109, 110, 111, 112, 113, 114, 117, 118, 120, 121, 122, 123, 124, 126, 127, 131, 134, 136, 137, 140, 142, 143, 147, 148, 149, 150, 151, 155, 156, 158, 159, 161, 165, 167, 168, 169, 170, 173, 179, 180, 181, 182, 184, 189, 190, 191, 192, 193, 200, 202, 204, 205, 207, 208, 209, 210, 211, 221, 224, 225, 226, 227, 242, 243, 244, 246, 262]

unflagged_ants: [8, 9, 10, 19, 20, 21, 22, 29, 30, 35, 41, 43, 44, 46, 48, 49, 50, 56, 57, 61, 62, 64, 71, 73, 74, 85, 88, 89, 90, 91, 95, 105, 106, 107, 115, 125, 128, 132, 133, 135, 139, 141, 144, 145, 146, 157, 160, 162, 163, 164, 166, 171, 172, 183, 185, 186, 187, 201, 206, 220, 222, 223, 228, 229, 237, 238, 239, 240, 241, 245, 261, 320, 324, 325, 329, 333]

golden_ants: [9, 10, 19, 20, 21, 29, 30, 41, 44, 56, 71, 85, 88, 91, 105, 106, 107, 128, 141, 144, 145, 146, 157, 160, 162, 163, 164, 166, 171, 172, 183, 186, 187]
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_2460031.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 [ ]: