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 = "2460105"
data_path = "/mnt/sn1/2460105"
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: 6-9-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/2460105/zen.2460105.42115.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 361 ant_metrics files matching glob /mnt/sn1/2460105/zen.2460105.?????.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/2460105/zen.2460105.?????.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 'startTime' 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 2460105
Date 6-9-2023
LST Range 16.736 -- 18.677 hours
X-Engine Status ❌ ✅ ❌ ✅ ✅ ✅ ✅ ✅
Number of Files 361
Total Number of Antennas 202
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
RF_maintenance: 60
RF_ok: 24
digital_ok: 85
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 202 (0.0%)
Antennas in Commanded State (observed) 0 / 202 (0.0%)
Cross-Polarized Antennas 66
Total Number of Nodes 19
Nodes Registering 0s N07
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 44 / 202 (21.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 84 / 202 (41.6%)
Redcal Done? ❌
Never Flagged Antennas 117 / 202 (57.9%)
A Priori Good Antennas Flagged 25 / 85 total a priori good antennas:
7, 9, 15, 17, 21, 31, 37, 38, 40, 41, 42, 51,
53, 55, 66, 86, 112, 121, 136, 147, 151, 153,
161, 164, 202
A Priori Bad Antennas Not Flagged 57 / 117 total a priori bad antennas:
8, 22, 35, 36, 43, 46, 48, 49, 50, 52, 57,
60, 63, 64, 73, 74, 79, 80, 84, 89, 95, 97,
102, 108, 113, 114, 115, 125, 132, 133, 135,
139, 159, 179, 185, 204, 206, 210, 220, 221,
222, 223, 224, 226, 228, 229, 237, 238, 239,
240, 241, 242, 244, 245, 261, 324, 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_2460105.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 0.00% 0.00% 0.00% 0.00% -0.041244 -0.716055 0.096340 -0.982376 0.267099 -0.511503 0.210524 -0.499915 0.690289 0.635482 0.452098
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.967080 1.842922 -0.647109 -0.809625 -0.987842 1.015565 -0.973228 7.821141 0.689605 0.604518 0.446226
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.242166 2.550843 -0.013724 3.834188 0.278261 2.799793 0.160408 2.113423 0.705323 0.654521 0.455550
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.358665 -0.446855 -1.238747 -0.425947 -0.509213 0.291857 0.941647 4.106113 0.707728 0.658985 0.451168
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.219493 2.356236 1.843960 1.885813 1.044424 1.271340 -0.736409 -0.662194 0.681693 0.626658 0.450719
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 2.380071 0.425108 4.147854 0.418629 2.846204 0.742359 3.433313 0.330652 0.709614 0.658733 0.456339
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.102625 -1.303834 0.091035 -1.271684 -0.669318 -0.903254 -1.225119 -0.432249 0.696215 0.644978 0.464599
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 4.757715 -0.721820 0.433053 -0.740251 -0.107995 -0.348031 0.868172 0.667572 0.642784 0.659504 0.406252
16 N01 RF_ok 100.00% 100.00% 100.00% 0.00% 4.248957 4.700774 21.124481 21.826174 2.382229 2.564674 3.103068 3.470510 0.036621 0.116564 0.070829
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.969158 3.040006 1.396683 5.303605 1.260500 3.340650 1.022645 7.959921 0.728802 0.678122 0.452966
18 N01 RF_ok 100.00% 0.00% 0.00% 0.00% 0.060935 5.230209 -0.335906 8.195547 -0.880817 2.362657 5.061188 32.819845 0.659929 0.484545 0.498137
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.951485 0.780226 -0.885728 0.645296 -0.353162 0.164045 -0.309888 -1.040664 0.727650 0.667730 0.462410
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.119022 0.400845 0.385734 0.836023 0.484133 1.107984 0.762506 0.752989 0.728796 0.678268 0.462268
21 N02 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.434256 -1.251494 1.529067 -0.716728 0.525284 -0.116209 0.848735 -0.108799 0.691508 0.635285 0.462932
27 N01 RF_ok 100.00% 100.00% 51.52% 0.00% 7.227344 8.474486 19.576713 8.283615 2.616177 2.937838 7.603596 38.755462 0.047918 0.197015 0.151169
28 N01 RF_ok 100.00% 0.00% 0.00% 0.00% 0.763149 7.407555 1.262193 8.465348 1.237882 1.366249 0.823246 19.345419 0.730752 0.403524 0.596477
29 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.364163 4.783427 20.703273 21.141585 2.381028 2.600766 3.720013 2.888158 0.034454 0.045206 0.011208
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 1.664674 -0.919470 1.277004 -1.265334 0.479122 -0.756403 -0.357093 -0.547491 0.720188 0.694390 0.446463
31 N02 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
32 N02 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 4.693996 0.088058 13.360651 -0.155539 2.398192 -0.691008 3.280985 -0.961899 0.045386 0.652234 0.533465
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.356919 -0.813424 0.246668 -0.969195 -0.495384 -1.179228 -1.228082 -0.899328 0.697819 0.642482 0.457068
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.493527 1.111487 0.829523 0.463910 0.951956 0.642744 0.733770 0.756387 0.675496 0.611924 0.429329
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 5.361734 4.885775 6.511716 8.894409 3.173262 3.809453 2.889473 16.775191 0.697438 0.634932 0.437490
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.573601 0.425712 -0.653560 0.932514 -0.373118 1.086925 1.235165 5.726091 0.704439 0.653333 0.438624
40 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.522381 1.100827 0.883096 0.853456 0.767885 0.859355 1.627001 22.820672 0.732896 0.685515 0.444814
41 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.280711 2.798999 0.039024 4.068168 -0.001592 2.796584 0.057088 2.227727 0.739630 0.697842 0.438902
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.453204 4.104024 0.253581 7.963610 0.263823 3.789789 0.599545 4.461142 0.751338 0.703197 0.456126
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.054965 0.344230 -0.162763 0.556400 1.321709 0.705384 2.881210 1.039219 0.755918 0.710741 0.450025
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.347130 0.183558 -1.268236 0.101387 -0.825915 0.516482 -0.609201 0.284144 0.749644 0.708249 0.457921
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.372356 0.311189 0.622735 0.143899 0.730663 0.359958 0.681624 0.981102 0.751460 0.700826 0.464217
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.518687 -1.080613 -0.335291 -0.855445 -0.118083 -1.236581 0.418036 -0.617604 0.745529 0.690496 0.480661
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.523093 0.587239 -0.563840 0.409994 -0.909721 -0.099746 -0.975787 -1.096541 0.714970 0.648590 0.454468
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.299395 -0.436396 0.508752 -0.528541 0.298328 -1.109988 0.431287 -1.056983 0.703910 0.636505 0.455368
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.291090 0.123226 -0.038221 0.548583 0.255691 0.708896 0.141794 0.401488 0.678478 0.612798 0.433530
51 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.334116 0.322673 -0.347630 1.142846 -0.181644 1.181375 49.132308 0.921499 0.689921 0.637779 0.426297
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.104600 0.533507 0.194158 -0.185615 0.349954 0.029477 1.731707 0.396427 0.710873 0.652667 0.434123
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.270005 -0.411284 -0.117465 -0.299926 0.116311 0.333552 4.622594 3.603423 0.724935 0.675137 0.428493
54 N04 dish_maintenance 100.00% 0.00% 0.00% 0.00% 13.508466 1.253279 6.355255 5.911437 2.681199 2.505518 4.214420 2.742136 0.358185 0.441116 0.199474
55 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 7.218672 2.350314 20.648316 1.647885 2.724315 1.397795 2.735418 -0.062574 0.029621 0.625659 0.478063
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.152284 1.090476 -0.510441 0.671466 -0.058431 1.352168 -0.173157 0.693672 0.757043 0.716659 0.445977
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.474480 -0.071839 -0.676858 -0.557500 0.007396 0.075984 0.420415 0.341317 0.765224 0.717231 0.446269
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.030641 4.549016 21.163159 21.903949 2.375576 2.611740 4.246086 4.444183 0.039326 0.038288 0.003313
59 N05 RF_ok 100.00% 0.00% 100.00% 0.00% 0.825113 4.715660 1.157919 21.883213 0.770951 2.613805 0.673464 3.496364 0.762243 0.035587 0.595503
60 N05 RF_ok 0.00% 0.00% 0.00% 0.00% 0.025282 -0.959577 0.609235 -1.062898 0.387987 -1.172153 0.527481 2.097789 0.753632 0.702447 0.470876
61 N06 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% 0.355494 0.936291 1.959118 0.523718 0.790122 0.088277 2.113258 -1.132721 0.717164 0.658426 0.449877
63 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.261870 3.176287 -0.619245 2.597130 -1.121743 1.934769 -0.644150 -0.316724 0.715984 0.619245 0.466887
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.654984 -0.914739 -1.039840 -0.294285 -1.268863 -0.404876 -0.813614 -0.128828 0.704640 0.640705 0.450558
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.167279 -0.910437 0.193592 -1.146884 0.501759 -0.532023 0.190191 -0.237681 0.680396 0.608487 0.444612
66 N03 digital_ok 0.00% 0.00% 0.00% 100.00% 1.197173 0.130680 1.581849 0.730966 1.927155 0.339036 1.804814 1.035918 0.252158 0.259968 -0.345644
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.994895 0.449672 -0.693385 1.095927 -0.075665 1.413798 2.119976 1.810472 0.713264 0.661733 0.433372
68 N03 RF_ok 100.00% 0.00% 0.00% 0.00% 1.338418 1.285784 1.489781 2.141965 1.256638 1.881452 1.221261 5.302204 0.731688 0.680718 0.436018
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.700254 -0.033800 0.525722 0.099925 0.635580 0.207133 1.878578 0.436834 0.743754 0.695793 0.434896
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.065835 0.895295 2.592298 0.774214 2.423243 1.273171 1.752663 2.083352 0.712125 0.671672 0.417826
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.585283 0.205708 -0.899723 0.131137 -0.012486 0.830628 -0.246639 0.709202 0.719135 0.679326 0.424624
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.068323 -0.164017 -0.249292 -0.193115 -0.204797 0.182995 0.261234 0.030927 0.771667 0.728969 0.452845
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.281308 1.806635 -0.190328 2.080080 0.093990 2.909753 0.399524 2.631027 0.769769 0.724993 0.456061
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.712649 -1.117553 -0.413826 -1.180080 -0.609754 -0.015262 -0.971272 0.177307 0.762684 0.719457 0.455877
77 N06 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 5.370690 0.836110 0.662591 0.651917 0.368233 0.005615 0.733738 -0.996442 0.641207 0.664124 0.389059
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.064402 -1.091697 0.672872 -1.157812 0.170704 -1.157999 0.683263 -0.760164 0.723537 0.664621 0.442306
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.179384 1.987325 -0.226741 1.653535 -0.842905 1.020556 -1.164688 -0.870725 0.706768 0.625184 0.455167
81 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 94.557017 94.511528 inf inf 3.991390 3.774958 41.832027 66.926427 nan nan nan
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 94.528250 94.505532 inf inf 4.847180 4.396731 25.418241 22.392824 nan nan nan
83 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 94.534250 94.507008 inf inf 4.231375 4.295574 20.831612 19.851179 nan nan nan
84 N08 RF_ok 0.00% 0.00% 0.00% 0.00% 1.564340 2.254548 1.302361 1.796366 0.481166 1.172440 -1.068179 -0.786049 0.710241 0.651766 0.430850
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.115203 -1.046157 -0.402182 -0.927613 -1.233683 -0.570414 -1.165638 -0.448839 0.741820 0.698344 0.441549
86 N08 digital_ok 100.00% 100.00% 0.00% 0.00% 4.324136 -0.488003 18.954614 -0.209117 2.379226 0.109528 2.281983 6.292797 0.055821 0.709568 0.536453
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.351138 0.261159 4.437664 -1.002828 1.832014 -0.544211 1.660762 -0.372357 0.727738 0.724345 0.367382
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.015720 0.904629 0.448817 1.611434 0.675394 1.868478 0.466513 1.129185 0.775144 0.730706 0.445540
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.053121 0.395212 0.504078 0.859309 0.666550 1.127365 0.329864 0.638525 0.781558 0.734737 0.456464
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.265478 1.634821 0.092935 2.650050 -0.697051 6.257502 -1.236704 4.917589 0.773283 0.734224 0.447997
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.134317 0.176868 0.584625 0.488394 0.605060 0.673588 0.424622 0.339152 0.778411 0.730301 0.475257
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 3.989095 4.440794 21.269483 21.750925 2.380963 2.613233 4.731031 5.075365 0.026979 0.026032 0.001377
93 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.217363 4.719201 21.183668 22.022837 2.386873 2.621855 4.238619 5.008565 0.027032 0.031356 0.002166
94 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.398993 3.515485 0.543226 6.228059 0.814971 3.641633 1.750619 3.551112 0.754593 0.694443 0.459966
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.850801 -0.092221 -0.675954 -0.018791 -0.926106 -0.579362 -0.187280 -1.115264 0.731806 0.674083 0.445960
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.866725 4.947992 0.690660 -0.309179 0.026302 -0.413668 -1.180653 0.033788 0.716120 0.608326 0.385878
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.076968 1.001119 -0.935957 1.517449 -1.375714 1.069263 -0.947239 3.391874 0.708582 0.641971 0.446352
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.825578 1.546054 -0.380863 0.786615 0.040983 0.803431 -0.027645 0.746669 0.728957 0.675031 0.441576
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.961666 -0.578784 -0.979843 -0.886661 -1.055996 -0.612580 -0.914388 2.664239 0.739281 0.691634 0.437207
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.106467 0.276277 -0.562363 0.141641 -0.822235 0.340464 -0.948964 0.626340 0.746693 0.707519 0.422444
104 N08 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.714772 22.442790 4.690940 9.646898 3.573489 5.032278 4.112818 4.045489 0.765402 0.720259 0.444559
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.752627 0.454933 -0.244588 1.027356 0.413487 1.364994 0.279043 0.656873 0.772122 0.730729 0.434463
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.275546 -0.640781 -0.000932 0.165643 0.888752 0.586115 0.729929 0.212950 0.778858 0.733020 0.448646
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.914579 -0.451756 -0.542158 -1.203006 -0.021815 -0.762286 1.568942 0.322163 0.780240 0.733974 0.443166
108 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.121332 0.678609 -0.801663 0.557262 -0.317505 0.815476 -0.180601 0.493166 0.778808 0.737381 0.464472
109 N10 RF_maintenance 100.00% 6.65% 100.00% 0.00% 2.838388 4.768321 -0.807950 21.535132 26.372503 2.584849 8.819325 3.670238 0.431874 0.045768 0.304779
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.561979 -0.206765 3.393140 0.413211 1.314495 0.587475 1.420258 0.314169 0.721833 0.716865 0.374647
111 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.270809 3.121822 1.746026 6.471546 2.560026 3.280597 32.472589 3.421668 0.741483 0.704823 0.425585
112 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 1.746194 2.492548 18.470482 2.005260 -0.488609 1.402679 1.412284 -0.669306 0.605467 0.664630 0.425556
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.962288 3.035064 2.425637 2.485227 1.535264 1.825528 -0.513116 -0.378433 0.705176 0.644588 0.438694
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.570074 -0.535526 2.073584 -1.065407 1.257654 -1.391662 -0.684579 -0.833960 0.694310 0.657423 0.426818
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.396272 -0.227905 -1.226563 -0.182140 -0.587746 -0.492839 -0.593937 -1.138187 0.699425 0.629413 0.437829
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 94.525409 94.504005 inf inf 5.684430 4.104627 31.343903 17.090081 nan nan nan
118 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 94.527787 94.502938 inf inf 4.564012 4.269934 18.030347 14.701468 nan nan nan
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.140207 -0.503687 3.011912 -0.045936 1.927988 0.116351 7.166381 4.319372 0.733025 0.682289 0.438411
121 N08 digital_ok 100.00% 0.55% 0.00% 0.00% 1.793146 3.859874 1.541326 8.199292 0.797050 3.916105 0.564732 8.957150 0.656779 0.698067 0.433919
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.459073 0.289414 -0.698032 -1.038042 -0.360533 -1.171733 -0.266366 -0.804145 0.759136 0.709154 0.440934
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.713539 1.256626 2.215567 0.919930 1.364939 0.245915 -0.515875 -1.173750 0.743748 0.709264 0.441799
124 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.107731 4.865513 21.542772 22.163797 2.385524 2.630289 3.523161 7.254583 0.046304 0.047844 0.000667
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.625228 0.047756 3.284353 0.673027 3.848592 0.996826 2.817976 0.481967 0.781169 0.737289 0.458402
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.896053 -0.367080 2.445091 0.187334 1.011450 0.357770 3.476402 0.269898 0.755700 0.739219 0.429278
127 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 4.120653 2.369031 21.249372 4.465111 2.371713 2.802441 2.942200 6.050944 0.044308 0.449722 0.298832
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.319382 -0.526775 0.258328 -0.532969 0.494798 -0.159876 1.660963 2.414382 0.777316 0.728902 0.467328
131 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.493823 3.639835 -0.527780 12.934972 -0.701425 0.958333 -1.013661 2.003584 0.734274 0.452529 0.495401
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.550427 -1.272521 -0.560603 -1.251513 -1.117834 -1.101136 -1.042261 -0.668815 0.727681 0.671317 0.429412
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.234332 -0.811159 -1.257234 -0.841942 -1.148505 -1.316900 -0.600182 -0.861299 0.709565 0.644645 0.435798
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.560140 2.290345 3.593090 1.808498 1.221118 1.188624 7.025473 -0.796452 0.669928 0.596188 0.441953
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.285677 -1.273947 -0.444341 -1.265211 -0.742703 -0.705946 -0.680167 -0.385273 0.646768 0.591955 0.443292
136 N12 digital_ok 100.00% 100.00% 3.05% 0.00% 3.820263 8.093033 20.833038 5.376886 2.371899 2.692092 4.565056 4.740349 0.041788 0.291326 0.190370
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 94.533982 94.504379 inf inf 4.658855 5.282431 30.669667 34.113125 nan nan nan
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.916543 -0.533179 0.619450 -1.239894 -0.129639 -1.243805 -1.196830 -0.300989 0.709182 0.664267 0.441123
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.495782 0.325948 0.657976 0.492182 0.760647 0.854484 2.407924 2.087373 0.740913 0.690761 0.436677
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.007818 0.007818 0.196422 0.322870 0.204037 0.553557 0.145040 0.191636 0.751677 0.702521 0.443264
142 N13 RF_ok 100.00% 0.00% 0.00% 0.00% -0.271468 1.036939 0.008033 1.110723 -0.036792 1.062579 7.451965 5.217598 0.761587 0.712873 0.453949
143 N14 RF_maintenance 100.00% 0.00% 100.00% 0.00% 5.078223 4.743413 -0.248728 21.942569 2.300341 2.621742 1.307269 4.867065 0.423504 0.041278 0.338179
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.039547 -0.083265 -1.028860 -0.335337 -0.624680 -0.151847 -0.526374 0.150111 0.781266 0.733279 0.465883
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.391335 1.315270 0.368801 1.611397 0.551382 1.826832 0.341263 1.256556 0.787274 0.739653 0.466076
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.104164 -0.871208 -1.276922 -1.006288 -1.059855 -1.324667 -0.690716 0.054870 0.777112 0.731687 0.470631
147 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 3.352158 1.674557 7.706615 2.792989 3.162773 2.252222 2.807928 1.789035 0.776317 0.735509 0.464531
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.136243 -0.947816 0.083453 -0.824624 -0.007396 -0.707442 0.056185 -0.458717 0.775601 0.725575 0.463025
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.577608 -1.033439 0.572727 -0.843440 0.393327 -1.252311 1.352282 -0.842831 0.766736 0.711421 0.456017
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.895320 -1.028832 -0.958588 -0.965385 -0.615907 -1.312838 -0.247413 -0.924432 0.753282 0.697010 0.440803
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 3.398310 0.189150 -0.678736 0.999116 0.080734 0.542276 1.467815 5.057388 0.679836 0.676344 0.379651
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.147600 -1.248298 -1.265705 -1.147218 -0.898124 -1.093902 0.081019 -0.631586 0.715249 0.649995 0.432509
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 4.103198 -0.663587 12.976896 -0.604686 2.381524 -0.295093 3.000349 -0.193414 0.046906 0.626881 0.467834
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.398804 -0.895110 -0.327874 -1.083612 -0.946471 -1.326160 -1.068961 -0.873928 0.672969 0.598216 0.428733
155 N12 RF_maintenance 100.00% 100.00% 4.16% 0.00% 4.039327 5.048892 20.977750 5.750864 2.379341 3.035967 4.304288 3.051530 0.037817 0.286307 0.191907
156 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.229462 0.228959 5.726781 0.581693 3.017371 0.755006 4.405648 0.440119 0.678397 0.616041 0.448889
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.211814 0.432297 0.074629 0.505201 0.244651 0.447228 0.062586 0.246302 0.693295 0.637387 0.443623
158 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.736989 -0.951748 -0.649470 -0.754586 -0.877312 -1.158826 -0.161486 2.653549 0.705788 0.648891 0.448462
159 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.523222 3.633831 1.056680 1.111914 0.280193 -0.496830 0.500671 1.028485 0.703701 0.593756 0.417226
160 N13 RF_maintenance 100.00% 100.00% 0.00% 0.00% 4.424975 5.058195 21.182095 4.010469 2.399996 2.474937 4.042160 2.258126 0.049707 0.392224 0.307300
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.257564 11.267081 0.445533 0.684475 0.504426 -0.156650 0.348018 -0.050425 0.749411 0.630271 0.380862
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.822339 -0.036364 -1.235715 0.057956 -0.854257 0.314146 -0.648653 0.046604 0.759054 0.710863 0.446831
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.290372 0.260278 -0.090377 0.245462 0.177594 0.467472 0.091742 0.362293 0.773938 0.727148 0.459007
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 2.964138 0.626966 5.154160 0.854937 3.873213 0.796255 4.839866 1.203497 0.775549 0.729747 0.459422
165 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 3.295360 -0.029703 1.191576 0.000932 0.155193 0.239612 2.800419 0.178350 0.737490 0.736068 0.405093
166 N14 RF_maintenance 100.00% 100.00% 0.00% 0.00% 4.368140 12.987465 21.497080 7.073503 2.393739 3.022568 3.804286 2.868534 0.037006 0.383350 0.227427
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.337364 -0.875547 -1.041676 -0.745346 -1.111473 -0.186849 -0.845735 0.591193 0.774646 0.732518 0.462045
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.516741 -0.978076 -0.145340 -0.517652 -0.046013 -0.284528 0.027645 -0.168181 0.772520 0.726371 0.453369
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.232681 -0.999697 -0.987029 -1.257119 -0.715051 -0.259201 -0.557261 1.215208 0.765054 0.707553 0.448835
170 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 2.138515 0.071337 3.038851 0.063115 2.003173 0.308653 3.158469 0.040086 0.754930 0.703052 0.438646
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.321149 -0.397020 1.267618 0.149583 0.509013 0.411435 0.944659 0.435092 0.725765 0.673332 0.433338
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.210696 -0.773537 -0.006526 -0.929331 -0.637537 -0.651228 -0.829875 0.155482 0.705933 0.650798 0.433731
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.946907 3.016698 2.389570 2.423000 1.488148 1.765965 -0.534690 -0.415521 0.661307 0.589625 0.430311
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.377298 0.126742 0.520457 0.236671 0.699298 0.328874 0.389850 0.169868 0.718749 0.658090 0.455637
180 N13 RF_ok 100.00% 0.00% 0.00% 0.00% 1.185838 3.066267 1.254122 0.717015 0.974822 1.307379 7.155699 -0.265717 0.721633 0.590086 0.398112
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.909176 0.487788 0.824122 0.347530 0.729033 0.572547 0.488325 1.428096 0.742187 0.686582 0.451553
182 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.064436 4.670455 0.115661 21.537485 -0.143791 2.573699 -0.522617 4.474141 0.747893 0.056232 0.571984
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.374713 0.462073 0.020887 0.932990 0.008563 0.988378 0.145671 0.787146 0.758053 0.711330 0.447246
184 N14 dish_maintenance 100.00% 0.00% 0.00% 0.00% 10.902993 4.356896 15.726918 7.979320 3.363084 2.574682 3.207715 2.520396 0.304386 0.401157 0.210748
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.743571 0.271016 -0.444773 0.525727 -0.164727 0.603695 -0.163984 0.406846 0.771681 0.727962 0.456135
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.033020 -0.846810 -0.019635 -0.814108 -0.614372 -1.082749 -1.153682 -1.017087 0.761980 0.720151 0.445911
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.247713 -0.489086 -0.285021 -0.107392 0.520315 0.149921 3.130567 0.040634 0.774223 0.730889 0.452115
189 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.763875 2.104184 1.473529 1.660309 0.683068 1.083960 -1.043886 -0.887513 0.727200 0.672866 0.448976
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.592159 -0.205225 -0.623732 -0.324991 -0.254568 -0.850613 -0.066365 -1.111670 0.750259 0.686153 0.445049
191 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.849115 -0.645030 1.331268 -0.538643 1.546585 -0.229219 2.482466 -0.233240 0.739110 0.679296 0.433492
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.966427 3.291364 2.423945 2.674668 1.516007 1.988067 -0.511933 -0.265733 0.678773 0.613463 0.430522
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.165613 2.806361 2.610953 2.299420 1.664251 1.634809 -0.411663 -0.518514 0.658025 0.593260 0.423472
200 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
201 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
204 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.975593 2.379223 0.356744 -0.288192 0.331752 -0.185859 1.459726 -0.039642 0.754051 0.707970 0.446564
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.863738 0.939952 7.887599 1.577146 0.318377 0.994823 5.886650 2.536467 0.701999 0.703977 0.451166
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.925924 0.801337 2.578152 2.518775 2.495309 1.872103 1.386579 1.706719 0.742210 0.696183 0.430105
207 N19 RF_maintenance 100.00% 100.00% 0.00% 0.00% 4.644255 6.915557 12.776199 5.925300 2.402955 2.703538 3.227104 3.814434 0.045971 0.375899 0.298204
208 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 0.640667 4.448419 17.942869 21.671731 -0.270459 2.486240 2.028798 41.415198 0.671043 0.036854 0.571021
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 3.213147 3.592128 19.955441 20.791213 2.413078 2.400229 12.964513 27.725888 0.030009 0.034578 0.001004
210 N20 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.699192 1.787374 -0.008823 0.457749 0.260960 0.725128 0.268762 0.435666 0.733991 0.671691 0.438932
211 N20 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.566207 4.751638 -0.251673 13.657134 -0.214134 2.609847 0.127623 3.341685 0.707352 0.039951 0.595865
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.652342 -1.109429 -0.595937 -1.248233 -0.482122 -0.373186 -0.838336 -0.698746 0.724132 0.666764 0.461243
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.046145 -0.914929 -0.087797 -1.030875 -0.831374 -1.312475 -0.621416 -0.929677 0.729224 0.680435 0.460146
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.616074 -0.244632 -0.718887 -0.344564 -0.929780 -0.925112 0.146222 -1.141542 0.735813 0.685548 0.453663
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.807172 1.083514 -0.470852 2.546569 -0.584865 1.512617 -0.337557 2.157427 0.738581 0.681478 0.453779
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.397313 3.120346 2.820239 2.564922 1.873777 1.886288 -0.264713 -0.344346 0.701642 0.653637 0.442846
225 N19 RF_maintenance 100.00% 0.00% 6.37% 0.00% 0.508462 3.753174 0.376121 12.767976 -0.354514 1.404140 -1.231847 3.999054 0.729187 0.401320 0.569463
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.670373 2.175869 -0.844063 -0.635115 -1.296986 -0.046198 -0.915115 -0.648827 0.732957 0.641188 0.432763
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 0.512671 -0.533633 1.011638 -0.690021 0.425500 -1.042637 14.246487 -0.692566 0.722724 0.666059 0.436896
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.060733 -1.083356 -0.251525 -1.006155 -0.626300 -0.714175 0.459071 0.041591 0.711831 0.653381 0.428646
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.483037 0.728120 0.217673 0.599763 -0.485252 -0.073959 -1.232531 -1.243814 0.695772 0.628130 0.440654
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.178210 -1.270171 0.456071 -1.271708 -0.070796 -0.902524 0.158795 -0.801605 0.703395 0.648769 0.460957
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.487977 0.371322 0.385572 0.359748 -0.376055 -0.264778 -1.174109 -1.237741 0.712685 0.654580 0.463536
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.981422 -0.489551 -0.972978 -0.654610 -1.092056 -1.171097 -0.939772 0.273375 0.722454 0.664325 0.462519
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.188667 -0.885762 1.893935 -1.013945 0.886973 -1.307730 0.916851 -0.232563 0.718733 0.670257 0.452104
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.558275 -0.443942 -0.577070 -0.361595 -1.124104 -0.812886 -0.773737 -1.124074 0.724385 0.668622 0.455494
242 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.354636 0.531047 -0.935957 0.316181 0.105617 -0.281498 0.156262 -1.000120 0.665522 0.657369 0.399707
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.327578 -1.275913 0.566135 -1.291083 0.642657 -1.064904 11.997520 -0.575970 0.689584 0.656471 0.431634
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.428241 0.142121 -0.265307 0.753537 -0.277545 0.364940 0.313797 1.073505 0.713685 0.656954 0.441592
245 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.112813 -1.020454 0.057424 -1.226169 -0.604267 -1.267140 -1.189484 0.367786 0.702313 0.644035 0.441582
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 1.728580 4.989882 9.481838 13.010979 0.561168 2.613580 2.310091 2.451432 0.581082 0.039086 0.484495
261 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.293205 -0.442071 0.039771 -0.580282 -0.597045 -0.947237 -1.191956 -1.084649 0.684836 0.627836 0.440288
262 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.551539 2.589032 0.941248 0.263084 8.626937 0.592452 6.643318 0.554579 0.679471 0.621702 0.445367
320 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.705194 -0.500027 -1.098808 -1.029252 -1.022014 -1.148614 -0.721793 -0.681782 0.529423 0.404407 0.343140
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.198780 1.430240 0.596608 0.742464 0.092861 0.333930 -1.063147 -1.097349 0.511395 0.395322 0.337579
325 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.482521 -1.335280 0.453241 -1.198279 -0.180228 -0.874323 -1.226298 -0.618450 0.560068 0.463951 0.364706
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 4.639621 4.666810 12.892351 13.815353 2.397160 2.609784 2.598637 3.687525 0.043524 0.041046 0.003111
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% -0.056114 -0.375020 0.065643 -1.245148 -0.054575 -0.867547 1.040309 -0.491814 0.481706 0.360564 0.298868
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: [4, 7, 9, 15, 16, 17, 18, 21, 27, 28, 29, 31, 32, 34, 37, 38, 40, 41, 42, 47, 51, 53, 54, 55, 58, 59, 61, 66, 68, 77, 78, 81, 82, 83, 86, 87, 90, 92, 93, 94, 96, 104, 109, 110, 111, 112, 117, 118, 120, 121, 124, 126, 127, 131, 134, 136, 137, 142, 143, 147, 151, 153, 155, 156, 160, 161, 164, 166, 180, 182, 184, 200, 201, 202, 205, 207, 208, 209, 211, 225, 227, 243, 246, 262, 329]

unflagged_ants: [3, 5, 8, 10, 19, 20, 22, 30, 35, 36, 43, 44, 45, 46, 48, 49, 50, 52, 56, 57, 60, 62, 63, 64, 65, 67, 69, 70, 71, 72, 73, 74, 79, 80, 84, 85, 88, 89, 91, 95, 97, 101, 102, 103, 105, 106, 107, 108, 113, 114, 115, 122, 123, 125, 128, 132, 133, 135, 139, 140, 141, 144, 145, 146, 148, 149, 150, 152, 154, 157, 158, 159, 162, 163, 165, 167, 168, 169, 170, 171, 172, 173, 179, 181, 183, 185, 186, 187, 189, 190, 191, 192, 193, 204, 206, 210, 220, 221, 222, 223, 224, 226, 228, 229, 237, 238, 239, 240, 241, 242, 244, 245, 261, 320, 324, 325, 333]

golden_ants: [3, 5, 10, 19, 20, 30, 44, 45, 56, 62, 65, 67, 69, 70, 71, 72, 85, 88, 91, 101, 103, 105, 106, 107, 122, 123, 128, 140, 141, 144, 145, 146, 148, 149, 150, 152, 154, 157, 158, 162, 163, 165, 167, 168, 169, 170, 171, 172, 173, 181, 183, 186, 187, 189, 190, 191, 192, 193, 320, 325]
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_2460105.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.dev158+gd5cadd5
In [ ]: