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 = "2459932"
data_path = "/mnt/sn1/2459932"
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: 12-18-2022
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/2459932/zen.2459932.50804.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 531 ant_metrics files matching glob /mnt/sn1/2459932/zen.2459932.?????.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/2459932/zen.2459932.?????.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 2459932
Date 12-18-2022
LST Range 7.459 -- 10.315 hours
X-Engine Status ✅ ✅ ✅ ✅ ❌ ❌ ✅ ✅
Number of Files 531
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 94
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 18
Nodes Registering 0s N11, N18, N19, N20
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 90 / 201 (44.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 148 / 201 (73.6%)
Redcal Done? ❌
Never Flagged Antennas 53 / 201 (26.4%)
A Priori Good Antennas Flagged 57 / 94 total a priori good antennas:
3, 7, 9, 10, 15, 16, 19, 21, 29, 30, 37, 38,
40, 42, 45, 53, 54, 55, 56, 67, 69, 71, 72,
81, 86, 93, 94, 98, 100, 101, 103, 109, 111,
121, 122, 123, 128, 129, 130, 136, 140, 143,
146, 149, 158, 161, 165, 167, 170, 181, 182,
183, 185, 187, 189, 191, 202
A Priori Bad Antennas Not Flagged 16 / 107 total a priori bad antennas:
4, 22, 43, 46, 48, 49, 61, 62, 64, 77, 82,
89, 137, 139, 325, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459932.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% 100.00% 0.00% 0.00% 12.469129 16.598871 9.448884 0.733142 3.295547 11.095733 2.199416 3.804495 0.035179 0.304889 0.235217
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.681199 2.705170 1.907631 2.347549 -1.038581 -0.128909 -2.456026 -4.185704 0.572027 0.593077 0.353981
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.107041 -0.377235 -0.523853 -0.295523 -0.757207 -0.239431 -0.098611 -0.416817 0.584745 0.604505 0.354909
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.627651 -1.250951 0.428561 3.177921 -0.411312 -0.146229 19.580622 24.389279 0.577615 0.590950 0.333581
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.196533 -1.341581 -1.132787 -0.291650 -0.107555 -0.685213 2.370676 4.799355 0.584525 0.601776 0.335321
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.791254 -0.374214 7.549599 0.067233 -0.434866 -0.187826 0.932798 -0.110586 0.429558 0.596469 0.398534
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 8.348940 -1.062420 -0.203341 -0.974616 -0.092362 1.578996 0.975897 5.632518 0.563600 0.587941 0.340541
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 12.814194 18.235054 8.894184 1.999001 3.265917 8.171277 1.189541 3.519660 0.033400 0.308743 0.230929
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 12.673923 -0.345589 9.419036 0.230100 3.297555 0.441960 2.124746 1.363362 0.033862 0.613242 0.497071
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.789828 2.165670 -0.277712 -0.034126 -0.424131 0.357241 0.842259 0.789488 0.597193 0.619610 0.359364
18 N01 RF_maintenance 100.00% 100.00% 19.59% 0.00% 13.351505 23.995437 9.425981 0.703410 3.163682 10.618772 2.097358 38.619271 0.029988 0.209713 0.159676
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.483560 -0.371584 -0.781478 3.672885 3.962548 6.162272 0.402027 4.385799 0.599989 0.594626 0.333093
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.153297 -1.197199 3.102255 -0.628915 0.811442 1.708255 2.313887 -0.765604 0.579842 0.615388 0.348591
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.328076 0.030559 -0.508616 3.990928 2.168009 1.284920 2.856768 2.680475 0.583119 0.566715 0.334544
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.599395 0.121194 0.397821 0.164745 2.780069 -0.665452 -0.260982 -1.653046 0.531495 0.553002 0.329653
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.057337 14.278700 9.467659 10.152217 3.301721 2.659873 4.714513 3.549403 0.037835 0.042508 0.007259
28 N01 RF_maintenance 100.00% 0.00% 99.44% 0.00% 11.004186 29.155703 -1.053487 1.211075 13.913987 10.686079 4.226696 32.571169 0.334187 0.163430 0.223637
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 12.874586 14.761688 9.094247 9.781942 3.182694 2.577510 1.972497 0.991395 0.030242 0.038165 0.008194
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.270131 0.456575 -1.283572 0.184668 19.736154 -0.886064 5.349090 0.317645 0.604902 0.624537 0.343607
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.198222 -0.765444 0.379646 1.045643 0.233014 3.121939 2.156409 3.555773 0.613611 0.622881 0.336530
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 26.541984 22.773169 0.597699 2.134738 2.850560 13.127789 2.086585 14.992627 0.494444 0.531134 0.235763
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 14.293716 15.908848 4.251270 4.827919 3.232299 2.596586 2.603777 1.678048 0.034442 0.047773 0.007853
35 N06 not_connected 100.00% 0.00% 0.00% 0.00% 1.588335 -0.619770 1.709256 -0.760386 9.662163 -0.352754 -1.006924 -0.534817 0.539859 0.548858 0.324247
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.648613 6.689691 -0.284796 -0.012206 0.800071 0.873904 0.768719 1.869121 0.576979 0.588968 0.354778
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.022292 -0.047130 -0.427711 0.357582 0.884071 1.006077 -1.132392 7.496256 0.596203 0.607061 0.359326
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.094521 -0.518098 -0.260051 0.458561 2.629256 1.899216 11.247518 5.852016 0.597377 0.616182 0.361301
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 12.203650 0.562896 9.118006 0.206159 3.215550 -0.928461 2.059684 0.156128 0.040068 0.610510 0.468542
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.219156 0.245982 -0.894499 -0.200032 2.096630 -0.326225 0.454257 0.453931 0.607590 0.623449 0.346668
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 13.167338 15.151084 9.684345 10.590703 3.377928 2.688332 1.574980 2.402615 0.031862 0.029677 0.002492
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.110198 0.825500 -0.764237 0.245415 -0.220039 -1.055833 -0.242744 1.579106 0.607719 0.617349 0.334699
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.879267 0.561982 -0.573729 -0.256865 0.202813 0.515496 -0.446879 0.186760 0.606228 0.624836 0.334192
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.132622 0.760058 -0.312102 0.162387 0.126752 -0.175802 1.472435 5.468950 0.604235 0.620612 0.334961
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.105586 2.268078 0.951604 2.028376 0.215239 -0.380705 1.026846 -3.069700 0.591701 0.617791 0.349929
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 13.461271 15.613967 4.079764 4.473859 3.985883 3.340722 4.490620 2.534764 0.030201 0.055473 0.015103
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.256319 2.147382 1.126008 1.777003 -0.489381 -0.951724 -2.226272 -3.560456 0.550207 0.571713 0.332464
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.336652 -0.162925 -0.691551 -0.025020 0.118255 -1.074426 0.702422 2.197163 0.506257 0.556252 0.344640
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.246177 26.935377 -0.267787 1.236436 2.289766 5.863186 5.433887 6.465935 0.570729 0.511804 0.319326
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 27.230430 3.842747 12.043812 -1.044813 3.679204 6.905212 16.767477 0.846929 0.044287 0.475081 0.359217
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.706288 6.110086 -1.040665 0.175167 1.258556 0.510116 2.668262 2.429759 0.605663 0.621731 0.354881
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.159050 2.226016 -0.612427 -0.133805 0.347676 0.761386 4.839263 14.488273 0.620254 0.631803 0.363266
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.465735 14.911352 9.477580 10.368944 4.620911 4.054081 8.948681 6.936510 0.031703 0.030018 0.001430
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 13.046818 15.611236 9.497263 10.278365 3.202018 2.701369 2.259439 4.834132 0.027880 0.031976 0.003426
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.159536 15.728561 -0.071538 10.476386 0.687445 3.350363 2.376746 4.069699 0.612453 0.042925 0.502707
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.918115 0.632028 8.216192 0.191708 4.274372 5.130690 9.839650 10.578885 0.287765 0.636642 0.414990
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.084135 14.550495 9.357415 10.256474 3.336920 2.665626 3.235168 2.270408 0.038329 0.037404 0.001649
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 13.118479 0.800360 9.406670 0.896679 3.775245 3.388201 3.575409 21.567557 0.055963 0.618307 0.482085
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.547495 14.485363 -0.876569 10.288522 1.437606 3.988086 5.310087 9.128560 0.594912 0.082571 0.456083
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.409841 0.193024 -0.680060 -1.374175 -1.250059 0.668547 -0.092591 0.674033 0.537063 0.576376 0.332677
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.102146 1.963005 -1.048581 1.332523 3.118313 -0.333564 0.745402 -2.328545 0.521971 0.572043 0.334648
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.109053 14.898010 0.138629 4.860905 -0.247819 2.675822 -0.475148 4.897786 0.535598 0.046472 0.403136
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.379197 0.215788 -0.114568 -1.096785 -0.615070 -1.568139 -0.788288 -0.363656 0.510869 0.516317 0.317714
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.378569 0.366713 0.030030 0.728698 0.872428 1.062358 0.743804 1.246900 0.581349 0.601856 0.359843
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.310895 1.053687 1.622334 1.708513 -0.106892 0.423983 0.310801 1.744425 0.597416 0.614684 0.355951
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -1.070056 -1.145566 1.584938 1.580290 0.557871 1.093687 2.414254 6.740251 0.611982 0.624077 0.351250
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 22.931118 30.983592 0.856939 13.411641 12.787669 3.450694 2.087647 18.188382 0.352078 0.031688 0.253847
69 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.881790 -0.137765 -0.086320 0.386894 -0.781079 4.414110 1.501865 1.551660 0.611007 0.628457 0.339246
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.504100 -0.116128 -0.830003 -0.400534 0.355161 -0.295287 -0.335772 -0.353282 0.611465 0.637959 0.347715
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.865597 -0.098190 -0.023760 0.793353 -1.154820 -0.503132 0.125423 1.726193 0.628295 0.636599 0.335371
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.757063 15.749240 0.316286 10.620354 2.694799 3.803042 5.803737 5.715843 0.623417 0.038272 0.504608
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.444729 1.126027 -0.268299 1.998094 1.623918 9.270876 2.069201 3.060332 0.629920 0.627198 0.330058
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.790421 1.139078 0.624225 -0.942553 1.228774 8.142247 0.064805 4.634382 0.612088 0.625637 0.330220
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.667782 1.348648 1.004415 0.140242 -1.006131 -0.587285 -2.164676 -1.935103 0.573406 0.577663 0.331283
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 32.482104 0.923512 -0.196764 1.325190 3.852777 0.877588 1.048244 0.577406 0.351902 0.567154 0.344447
79 N11 not_connected 100.00% 100.00% 100.00% 0.00% 17.519872 18.091288 -0.767507 0.172025 0.705565 -1.270154 -0.012798 -1.924893 nan nan nan
80 N11 not_connected 100.00% 100.00% 100.00% 0.00% 19.541111 27.257405 2.767450 5.099278 1.384936 2.650901 0.598817 2.576051 nan nan nan
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.640637 15.268481 -0.553566 8.940558 -1.091744 2.817164 -0.016746 3.399454 0.563253 0.040426 0.417682
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.557413 -0.877028 -0.201535 1.764214 -0.832656 -0.057007 -0.257145 -0.085285 0.586547 0.594858 0.340304
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.183809 -0.330845 -0.404015 0.118465 -0.752482 0.040268 -0.337447 0.942236 0.601626 0.619322 0.350469
84 N08 RF_maintenance 100.00% 0.19% 100.00% 0.00% 22.307590 28.023761 12.051800 12.996736 2.444636 2.507984 7.325375 8.193642 0.225630 0.040588 0.149509
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.214535 -0.348011 0.015727 1.013627 -1.549489 -0.837606 -0.324948 -0.202585 0.625770 0.631712 0.343970
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.133704 2.293041 1.378787 1.368525 6.974026 -0.599541 1.394982 23.272637 0.610694 0.611068 0.318075
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 23.685127 7.217655 0.493752 -0.259940 34.170741 0.726756 0.737630 0.605751 0.536049 0.652887 0.323114
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.469218 -0.092421 -0.187601 0.639155 -1.756201 0.609050 0.041446 -0.117362 0.624614 0.641627 0.333985
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.591683 -0.404947 -0.295249 0.645735 -0.108102 -0.342359 -0.351016 -0.332868 0.630754 0.641146 0.331966
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.978832 -0.880140 0.966177 1.073867 6.977128 -0.480958 0.992092 5.757153 0.611660 0.629349 0.333595
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.775252 -0.586539 -0.100596 0.078231 -0.505688 0.134317 0.217193 -0.146413 0.609429 0.632501 0.346919
92 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 39.187023 47.464668 0.484907 1.338752 11.312841 12.908694 1.737699 14.284209 0.277365 0.236091 0.066725
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.312442 0.311417 1.781613 0.048213 3.375079 -0.130341 5.492820 -0.477221 0.586486 0.610709 0.349370
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 13.461337 14.998959 9.611727 10.162005 3.309888 2.626793 2.194142 1.557607 0.032171 0.026797 0.003284
95 N11 not_connected 100.00% 100.00% 100.00% 0.00% 17.905494 18.204343 -0.179577 0.638273 0.148352 -1.012070 -0.952195 -1.381407 nan nan nan
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 25.271248 26.870680 4.427328 5.269045 3.410716 2.814537 3.233224 2.340142 nan nan nan
97 N11 not_connected 100.00% 100.00% 100.00% 0.00% 17.442811 20.469127 -0.210710 3.256510 23.538910 0.581756 3.811472 6.031227 nan nan nan
98 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 0.751473 5.659871 -0.324843 -0.412333 0.617983 1.015484 0.269541 4.722595 0.556797 0.575781 0.338196
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 2.632049 -1.089480 0.489015 0.422335 -1.586449 3.964434 3.278948 -0.193659 0.558932 0.602164 0.356061
100 N07 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.520567 8.334460 -0.887513 0.686793 -1.041497 -0.450183 -0.327039 -0.057281 0.616843 0.626750 0.341590
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.464234 1.242893 -0.657080 2.599963 -1.142971 0.395008 -0.975503 7.792947 0.631708 0.625792 0.336132
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.777037 4.754335 -0.167327 -0.676919 118.834964 -0.565407 10.067587 3.111729 0.631691 0.642658 0.334983
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.325620 65.497762 6.388892 6.799123 0.173450 10.772698 1.097559 2.257451 0.573677 0.615100 0.339336
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.612721 -0.968968 -0.482452 0.568792 0.860764 -0.397852 0.151144 -0.252015 0.632426 0.637127 0.326636
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.251048 -0.048689 0.724224 0.855542 2.385058 0.638195 0.963664 -0.233101 0.625091 0.639914 0.333164
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.889956 2.419067 -0.675649 -0.452452 0.234089 0.212567 0.408389 3.995203 0.624790 0.641803 0.332200
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.572975 43.222472 9.419185 0.740941 3.270390 7.920998 3.868387 3.021908 0.040344 0.278871 0.127387
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.458113 14.535917 9.456069 10.045352 3.178873 2.641455 1.714612 2.978645 0.026711 0.026974 0.001554
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 29.448800 29.359346 12.554826 13.151471 3.264095 2.536543 7.638104 7.522032 0.024624 0.027678 0.000883
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.381853 14.568244 -0.023300 10.141447 -0.429831 2.815943 0.582074 4.921413 0.579288 0.038375 0.426692
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.699387 -0.148287 -0.367824 -0.223705 0.635742 -0.283746 0.724410 -0.070907 0.564459 0.585484 0.358402
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 25.900030 26.975235 4.225497 5.171026 3.287183 2.649144 3.939817 1.663748 nan nan nan
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 17.693005 18.161573 -0.544724 0.079184 -1.055348 0.300122 0.817385 -0.603164 nan nan nan
115 N11 not_connected 100.00% 100.00% 100.00% 0.00% 18.701047 18.990237 1.434134 1.866418 -0.921083 0.305553 -2.133808 -3.034777 nan nan nan
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.688389 0.078939 -0.670382 0.406607 1.792890 0.350176 0.000179 0.146970 0.547547 0.566590 0.337953
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 13.346841 16.238671 9.519564 10.607778 3.369308 2.714399 2.754510 6.217647 0.027775 0.032965 0.002969
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.359662 0.915744 -0.532638 0.461562 0.905252 0.166090 -0.324979 0.184392 0.591371 0.613388 0.354532
119 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.216370 4.760699 1.949936 2.299436 4.626480 0.729189 20.240152 0.016883 0.596810 0.617714 0.330341
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.101027 4.169878 -1.054248 2.757745 -0.843478 0.722022 3.067345 24.495007 0.631116 0.633649 0.330894
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.515731 6.058537 -0.111847 0.483387 -0.838909 -0.377579 2.472451 -0.234296 0.634402 0.643587 0.335512
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.743788 8.377700 0.051057 0.710814 -1.114529 -0.335514 -0.129337 0.921493 0.641209 0.646876 0.338009
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -1.078363 0.094544 -0.461088 0.335586 -1.513386 -1.039275 1.072996 0.674948 0.637158 0.647151 0.339898
125 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.065646 6.830121 -0.840645 0.603306 5.203202 6.344876 -0.248992 3.482315 0.630019 0.635144 0.333132
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.238760 3.822117 -1.160460 1.063508 4.442161 -0.244982 6.626286 0.025115 0.613508 0.627458 0.337912
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.564045 0.614189 -0.296915 0.117896 0.513340 1.746193 -0.067301 0.478964 0.607175 0.631799 0.353233
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.710854 14.006655 9.509449 10.251604 3.319351 2.660936 1.332905 1.527502 0.031818 0.026564 0.003265
129 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
130 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 17.980156 25.664993 0.325001 5.121731 1.007693 2.055963 -1.329399 0.248505 nan nan nan
132 N11 not_connected 100.00% 100.00% 100.00% 0.00% 17.820296 17.317497 0.113241 -0.988372 0.527610 0.504337 -1.134699 -0.190762 nan nan nan
133 N11 not_connected 100.00% 100.00% 100.00% 0.00% 25.304971 17.519130 4.228652 -1.048039 3.346689 -1.253960 3.824942 0.268935 nan nan nan
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.742429 -1.292622 -0.633930 -0.711638 8.012881 -0.938505 4.412614 -0.106953 0.545671 0.579811 0.360278
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 11.797443 0.189133 9.067465 2.771740 3.198674 45.190598 3.289516 2.506099 0.043390 0.566981 0.446566
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.297486 -1.342093 -0.575352 -1.379442 1.137761 1.380316 1.519264 3.696869 0.572958 0.603003 0.353804
138 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.084447 -0.366368 1.869378 -0.703780 0.433230 -0.955247 -2.438004 -0.727847 0.597574 0.606629 0.333059
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.174285 -0.884171 -1.382285 0.010845 -0.270041 0.143220 3.383791 4.766048 0.620036 0.640093 0.342163
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.548934 0.031141 -1.040562 0.832491 0.942327 -0.921263 -0.334030 -2.651199 0.622400 0.639880 0.338167
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.221052 14.463497 -1.350096 10.297111 1.043250 2.657488 30.592920 3.403248 0.626540 0.054566 0.530485
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% 0.813169 14.964587 5.549404 10.269912 -0.361963 2.684279 0.316593 2.065071 0.571280 0.040957 0.499625
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.195228 0.332158 -0.806244 0.512659 -0.663505 1.210089 -0.397288 2.466054 0.626391 0.641128 0.341561
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.279628 2.258186 -0.647379 5.738639 1.186020 2.474871 0.179276 1.157012 0.623801 0.586576 0.361619
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 13.788753 -0.917333 3.883240 0.233492 3.282230 0.252321 1.124508 -1.501022 0.039183 0.618283 0.510809
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.181277 -1.048786 0.723209 1.903918 3.250888 -1.219382 0.259144 0.207217 0.586841 0.605851 0.346942
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.576260 0.203826 2.393534 1.279588 0.314546 -0.024620 0.038352 -0.000179 0.557489 0.597964 0.359751
149 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.974408 2.099074 -0.975330 1.942170 7.315414 -0.175639 -0.414835 -2.830961 0.570509 0.592185 0.364567
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.571285 0.190426 1.825884 0.974314 -0.627945 -0.982749 -2.738539 -2.138689 0.559476 0.586364 0.375531
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.399502 -1.152493 9.154278 -1.392401 3.174646 2.265315 1.824298 2.549284 0.039394 0.577355 0.449762
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.711950 14.357763 7.274049 10.057939 4.271358 2.704656 3.651026 3.666728 0.420436 0.042748 0.336653
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.449950 -0.153947 -0.620680 0.264403 -0.836686 1.479592 0.054683 0.423351 0.564730 0.592816 0.351953
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.365640 -0.503125 -0.955817 -1.332101 1.530093 -0.051585 6.971925 27.663356 0.588477 0.610653 0.350429
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.266294 31.785519 -0.932552 -0.559821 -1.214138 3.372123 -0.228666 3.296383 0.564757 0.454369 0.302061
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.660882 -1.420656 -0.717319 -1.066718 0.207616 0.951431 -0.086684 1.819537 0.606989 0.623451 0.345915
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.834238 33.512699 -0.577684 -0.474155 -1.138616 0.612266 -0.068927 1.353527 0.609326 0.501840 0.307553
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 3.184188 1.032997 2.647295 1.551665 1.065863 0.723459 -2.777618 -2.712870 0.607894 0.625846 0.341416
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.031141 1.307230 -0.717895 0.120569 -0.657882 3.128630 0.100927 1.562086 0.617838 0.628478 0.348817
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.664288 0.478185 1.096719 -0.421344 2.919155 2.233056 1.708515 2.566058 0.595622 0.619753 0.347711
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 29.698071 0.509400 2.023993 0.284338 1.132532 -0.293405 2.564044 0.032576 0.449072 0.618049 0.351015
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.215499 0.818258 0.023310 0.318479 1.009178 -0.514778 6.086802 0.515187 0.593147 0.616037 0.360485
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.628981 -0.842582 -0.200853 3.361197 1.089908 0.632087 -1.096385 4.821517 0.594903 0.593168 0.356666
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.699724 -1.186259 -0.473668 -0.673332 -0.680434 0.024620 -0.034203 0.731089 0.580138 0.606330 0.366446
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.984701 -1.678703 -1.394821 -0.971604 -0.826509 -0.937048 -0.686271 -1.424000 0.576178 0.601248 0.370098
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 13.172505 -0.464237 9.631147 -1.182325 3.384761 1.355880 2.283545 2.173876 0.041740 0.590289 0.504425
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.107577 -0.018523 0.744592 2.009736 3.014747 8.637270 2.082959 1.958271 0.572651 0.589026 0.338651
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.023272 15.363139 -0.693492 10.421532 0.637416 2.711127 21.525981 4.207923 0.589740 0.061795 0.512169
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.598052 0.529837 -0.550797 0.095340 0.226175 0.941904 0.055657 9.352373 0.594585 0.608220 0.344766
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.087887 5.733327 -1.288957 3.125375 9.118011 0.683825 8.940568 -3.090860 0.608330 0.603334 0.345031
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.681689 1.412230 0.660135 4.652340 -0.275713 -0.828028 0.874424 0.108140 0.583014 0.563786 0.326910
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.511069 -0.068662 0.249069 3.200230 0.280908 -0.621215 0.503428 1.275637 0.593558 0.604612 0.340871
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 19.220044 -1.324133 7.722381 4.122457 1.849355 -1.064902 0.275726 0.088452 0.303509 0.579559 0.379764
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.077082 -1.683431 -0.681342 -0.015727 0.702195 0.064591 -0.660789 -2.098937 0.592702 0.610637 0.363879
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.081571 0.088704 -0.566029 0.099534 -0.693540 1.784000 0.990460 23.104743 0.595251 0.613080 0.363577
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 11.475597 14.100970 8.962993 10.088343 3.716700 2.622277 33.423739 2.469835 0.028645 0.032280 0.001675
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.006868 -1.178059 -1.178953 0.495177 0.609143 -0.422121 0.375530 -1.628491 0.558059 0.589678 0.378674
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.547274 1.115240 0.723062 -0.760871 0.559770 -1.077481 14.388237 0.826770 0.543646 0.573223 0.377906
200 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 25.639042 48.833207 4.394909 0.263638 3.141766 6.072404 3.847461 -1.080645 nan nan nan
201 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 19.631544 21.156011 2.780901 3.478954 -0.599999 1.751798 -1.985891 -4.913444 nan nan nan
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% 18.553034 17.604074 1.593019 -0.673394 -0.945058 2.760118 -2.245837 54.337508 nan nan nan
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
205 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 18.512264 18.232214 0.419654 -0.208841 -0.793789 0.561681 -0.844882 17.582768 nan nan nan
206 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 18.769484 18.215903 1.108122 -0.458316 0.053680 -0.978753 -1.999298 6.130331 nan nan nan
207 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 19.387330 18.470679 1.369116 0.009369 0.526914 13.104777 -1.588793 -1.040547 nan nan nan
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 21.712275 27.130059 9.097273 11.498621 4.341649 13.026977 27.869487 180.341877 nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 21.725569 22.660858 8.898578 9.484139 2.610114 3.943268 15.919688 31.205484 nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 25.299025 25.411245 2.073080 3.679542 1.393086 -0.275016 0.569796 0.220351 nan nan nan
211 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 17.825847 18.235682 -0.312458 0.173148 1.290537 -1.106781 -0.465782 -1.718369 nan nan nan
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 18.129686 17.867140 0.632084 -0.184990 -1.080729 -0.165678 4.927955 -1.440076 nan nan nan
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 17.835475 17.719451 -0.388724 -0.419601 8.009789 0.179154 6.480997 -0.180113 nan nan nan
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 17.909604 18.194516 0.297651 0.254281 1.715203 -1.382790 3.596340 -1.804479 nan nan nan
223 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 18.403627 18.533505 -0.745250 -0.718160 -1.300060 180.588114 0.685466 12.908108 nan nan nan
224 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 22.645147 22.336711 4.687459 4.050425 3.263957 2.107723 -5.752757 -5.995897 nan nan nan
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 18.753574 26.091948 1.139009 4.977197 -0.369361 2.529486 -1.756250 2.001240 nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 18.372942 18.682427 0.456671 0.977730 -0.956629 -0.254501 -1.292704 -1.852540 nan nan nan
227 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 18.159137 18.220519 -0.572191 0.199592 2.720360 0.212495 27.837394 -0.475392 nan nan nan
228 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 27.283972 31.034929 -0.552222 -0.383369 12.398720 2.140146 25.120294 1.978814 nan nan nan
229 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 18.752925 18.530758 1.604372 1.090984 4.673790 -0.745658 0.302231 -2.809728 nan nan nan
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 17.295401 17.259669 -0.266377 -0.867338 -1.197281 0.448978 0.130980 -0.627425 nan nan nan
238 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 18.280193 17.779584 1.086656 0.468189 -0.028569 0.937374 -1.813200 -2.267070 nan nan nan
239 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 17.895329 18.100667 0.253793 0.392491 -1.385057 0.478786 -0.010946 1.437162 nan nan nan
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% 25.940063 54.188080 2.548769 1.048462 1.532158 1.922537 -2.142634 0.334948 nan nan nan
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 18.442454 18.820056 -0.109481 0.778148 -0.112393 0.864930 7.887924 28.720860 nan nan nan
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 72.333614 18.831917 0.502582 1.056298 16.514569 -0.612665 1.057400 -1.697461 nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 69.969748 18.338894 0.635936 -0.769775 3.521618 -0.132725 -1.212419 0.228724 nan nan nan
244 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 18.335402 17.744927 1.322288 -0.342973 0.969278 0.854746 4.111212 10.789816 nan nan nan
245 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 19.809895 18.560507 2.895415 0.704825 0.825841 0.095543 -3.781030 -0.537738 nan nan nan
246 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 22.558144 22.479666 0.093090 -0.014820 10.606508 8.034024 6.010364 -1.185777 nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 18.993944 18.410849 0.926428 -0.107563 -0.328817 -0.632166 0.146908 0.610667 nan nan nan
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 21.760490 22.783713 8.937910 9.861333 2.803968 5.112875 20.366025 34.536267 nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 11.012023 15.900376 4.590578 6.859106 2.834685 3.148824 36.966910 6.884451 0.330839 0.050932 0.238444
324 N04 not_connected 100.00% 0.00% 0.00% 0.00% 2.575254 4.224899 1.491929 1.579371 0.181177 -0.352638 -0.837935 -2.168006 0.459261 0.486143 0.335351
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.302449 -0.682548 1.606784 -0.991580 -1.132328 -0.474824 -2.071859 0.459261 0.471961 0.492664 0.333958
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.384041 -0.858224 -0.949572 -0.580493 38.379237 -0.132865 2.837897 -0.695710 0.447540 0.489954 0.339898
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.866205 1.851056 -1.059811 -1.037490 -0.895744 -0.630446 3.020328 0.324536 0.421374 0.467056 0.322115
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, 7, 8, 9, 10, 15, 16, 18, 19, 21, 27, 28, 29, 30, 32, 34, 35, 36, 37, 38, 40, 42, 45, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 67, 68, 69, 71, 72, 73, 74, 78, 79, 80, 81, 84, 86, 87, 90, 92, 93, 94, 95, 96, 97, 98, 100, 101, 102, 103, 104, 108, 109, 110, 111, 113, 114, 115, 117, 119, 120, 121, 122, 123, 125, 126, 128, 129, 130, 131, 132, 133, 135, 136, 138, 140, 142, 143, 145, 146, 149, 155, 156, 158, 159, 161, 165, 166, 167, 170, 179, 180, 181, 182, 183, 185, 187, 189, 191, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 211, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 324, 329]

unflagged_ants: [4, 5, 17, 20, 22, 31, 41, 43, 44, 46, 48, 49, 61, 62, 64, 65, 66, 70, 77, 82, 83, 85, 88, 89, 91, 99, 105, 106, 107, 112, 116, 118, 124, 127, 137, 139, 141, 144, 147, 148, 150, 157, 160, 162, 163, 164, 168, 169, 184, 186, 190, 325, 333]

golden_ants: [5, 17, 20, 31, 41, 44, 65, 66, 70, 83, 85, 88, 91, 99, 105, 106, 107, 112, 116, 118, 124, 127, 141, 144, 147, 148, 150, 157, 160, 162, 163, 164, 168, 169, 184, 186, 190]
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_2459932.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.5.dev11+g87299d5
3.1.5.dev197+g9b7c3f4
In [ ]: