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 = "2460055"
data_path = "/mnt/sn1/2460055"
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: 4-20-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/2460055/zen.2460055.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/2460055/zen.2460055.?????.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/2460055/zen.2460055.?????.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 2460055
Date 4-20-2023
LST Range 13.450 -- 15.391 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 361
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 25
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas 40, 72
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating N05, N07, N10, N14
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 179 / 198 (90.4%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 120 / 198 (60.6%)
Redcal Done? ❌
Never Flagged Antennas 5 / 198 (2.5%)
A Priori Good Antennas Flagged 90 / 93 total a priori good antennas:
5, 7, 9, 10, 15, 16, 17, 19, 20, 21, 29, 30,
31, 37, 38, 40, 41, 42, 44, 45, 53, 54, 55,
56, 65, 66, 67, 69, 70, 71, 72, 81, 83, 85,
86, 88, 91, 93, 94, 101, 103, 105, 106, 107,
109, 111, 112, 118, 121, 122, 123, 124, 127,
128, 136, 140, 141, 144, 145, 146, 147, 148,
149, 150, 151, 157, 158, 160, 161, 162, 163,
164, 165, 166, 167, 168, 169, 170, 171, 172,
181, 182, 183, 184, 186, 187, 189, 190, 191,
202
A Priori Bad Antennas Not Flagged 2 / 105 total a priori bad antennas:
201, 224
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_2460055.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
4 N01 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.063228 1.099004 0.051172 0.059515 1.538833 -0.190199 0.335182 0.216558 0.027669 0.027777 0.001364
5 N01 digital_ok 0.00% 100.00% 100.00% 0.00% -0.290936 -0.079773 0.303262 0.587845 -0.600537 -0.687663 0.212672 -0.218869 0.026814 0.025750 0.001314
7 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 0.553461 -0.263904 0.141708 0.338191 5.865787 5.834806 26.193373 25.840217 0.072917 0.079125 0.013971
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.913002 3.277138 0.417748 0.432429 4.664221 2.803522 -6.897109 -6.818436 0.512120 0.509469 0.370831
9 N02 digital_ok 0.00% 100.00% 100.00% 0.00% -0.518504 0.546498 0.507406 0.237165 0.192360 -0.421879 3.006381 -0.473477 0.066102 0.041922 0.023585
10 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 2.652492 1.333093 -0.619960 -0.215078 7.449624 14.073365 39.959155 31.004329 0.028874 0.028455 0.001466
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.562396 3.582622 -0.470205 -0.506183 12.266496 22.762597 -0.546065 1.049511 0.443251 0.553127 0.391733
16 N01 digital_ok 0.00% 100.00% 100.00% 0.00% 3.260505 3.806310 -0.621905 -1.019400 2.667158 -0.912959 -0.291534 -1.274202 0.030469 0.036663 0.003433
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 2.965135 2.512966 -0.987767 0.168733 29.816602 12.254425 1.306254 10.103377 0.543722 0.422719 0.401803
18 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.179333 0.853579 -0.248351 -0.659155 27.678403 4.749489 79.002814 10.207520 0.029329 0.029518 0.001923
19 N02 digital_ok 100.00% 100.00% 100.00% 0.00% -0.269093 0.065497 0.265469 0.593522 0.832396 2.135904 0.124839 5.324721 0.029529 0.026927 0.001908
20 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 0.634846 0.291281 0.624717 0.188217 8.239322 4.861989 7.232333 -0.479803 0.026493 0.027760 0.001692
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 100.00% 100.00% 100.00% 0.00% -0.732920 -0.662147 -1.071684 -0.981722 7.929050 12.340086 2.544044 3.589094 0.030795 0.029554 0.002091
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.914139 0.612539 0.647003 -0.299967 0.386271 14.438140 5.503999 187.282184 0.025164 0.029421 0.003437
28 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.954598 1.160223 0.639184 -0.497230 0.925606 2.449816 3.250396 7.626090 0.025149 0.029519 0.003611
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 0.295387 0.040247 0.126964 0.210899 1.584519 0.448449 6.454479 2.060762 0.028798 0.027832 0.001877
30 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 1.833455 2.042485 -0.142833 -0.235666 19.456358 19.953379 58.644505 68.367372 0.027846 0.028426 0.001578
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 0.00% 100.00% 100.00% 0.00% 0.723827 -0.759468 -0.658320 -0.834322 0.176247 0.754941 1.820031 3.933742 0.029247 0.029444 0.001595
35 N06 not_connected 0.00% 100.00% 100.00% 0.00% -0.671908 -0.181268 -1.002548 -0.747184 -0.818644 -0.981477 -0.599777 -1.028379 0.029665 0.029393 0.001608
36 N03 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.293125 0.808167 0.715208 0.651065 2.127988 -0.785095 1.555261 1.246287 0.024931 0.025077 0.001142
37 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 2.893388 -0.398516 0.175697 1.483850 -0.734663 0.753063 0.325862 8.886795 0.026770 0.020750 0.004699
38 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 1.850871 1.091057 0.620066 0.709863 11.305321 14.261341 11.440609 23.420872 0.024723 0.024518 0.001063
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 3.284698 3.277673 -0.771100 -0.620395 19.907350 33.822869 104.062642 1.366922 0.161336 0.164832 -0.251861
41 N04 digital_ok 100.00% 100.00% 100.00% 0.00% -0.740328 -0.215998 0.356683 0.485724 -0.734947 4.859596 -0.560884 0.069903 0.030002 0.028820 0.001679
42 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 0.686105 1.110972 0.166967 0.148395 -0.562586 3.336438 0.051469 0.456197 0.035792 0.036889 0.005940
43 N05 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.678892 -0.838864 0.064979 0.397970 -0.080307 -0.562560 -0.623246 -0.664147 0.027546 0.026900 0.001345
44 N05 digital_ok 0.00% 100.00% 100.00% 0.00% 0.332555 -0.620547 0.216781 0.448164 1.230917 0.278296 -0.266383 -0.310674 0.026850 0.025866 0.001254
45 N05 digital_ok 0.00% 100.00% 100.00% 0.00% -0.478915 -0.376278 0.265284 0.291595 1.029009 0.357783 -0.072895 1.665162 0.028115 0.026965 0.001615
46 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.450924 0.852177 -0.075689 -0.308183 6.390165 8.750047 22.457752 30.192028 0.027694 0.028345 0.001436
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 0.823580 0.949851 -0.682438 -0.696342 1.181193 -0.339644 5.430445 0.172122 0.030790 0.050370 0.007170
48 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.812620 -0.161531 -0.990031 -1.005247 -0.205376 3.319471 1.988903 5.344442 0.032703 0.032362 0.001843
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 2.780819 3.303088 -0.904154 -0.251137 32.421236 27.934831 0.087131 2.861983 0.526557 0.538633 0.369048
50 N03 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.824911 0.978571 0.605108 0.807188 0.142696 0.133614 0.845261 1.498207 0.025278 0.023968 0.001199
51 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 2.122099 1.823452 0.207014 0.258439 44.097354 10.419350 352.338269 0.498876 0.049203 0.027034 0.004461
52 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.908910 0.523019 0.581150 0.562603 3.879311 0.713352 8.822041 2.470222 0.027375 0.026111 0.001370
53 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 1.564921 1.651347 0.543577 0.243000 5.586847 7.224300 16.913995 39.645869 0.054622 0.048844 0.018667
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 3.545888 1.091734 -0.917154 0.062482 7.132286 2.523764 6.789373 12.938606 0.039841 0.039701 0.008456
55 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 2.620619 2.266533 -0.357896 -0.152627 1.303601 3.614942 3.242160 -0.130579 0.029741 0.027795 0.001924
56 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 0.761616 -0.566296 0.116628 0.610939 1.244546 5.812400 0.211299 0.692316 0.030137 0.027290 0.001664
57 N04 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.852765 -0.182318 0.150625 0.375324 2.341724 1.586357 0.183940 -0.144007 0.031096 0.039891 0.005044
58 N05 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.070976 1.070004 0.642517 0.782274 0.152595 -0.001197 2.557467 2.128057 0.025990 0.024678 0.001255
59 N05 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.880211 0.106862 0.647448 0.333011 -0.510516 -0.067637 0.753818 1.078246 0.027217 0.027162 0.001403
60 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.282723 1.081983 -0.005583 0.798165 2.383683 1.243238 23.061760 5.833296 0.028960 0.024503 0.002766
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 0.758893 3.260405 -0.754021 -0.528144 -0.360004 25.435003 -0.840848 1.143185 0.030934 0.537208 0.170196
62 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.125672 0.300053 -0.953160 -1.261983 2.995771 2.431856 1.786835 12.280533 0.032088 0.032070 0.001817
63 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.174074 1.035052 -1.283750 -0.586503 3.570403 0.885870 8.991129 5.156964 0.038801 0.043934 0.007366
64 N06 not_connected 100.00% 0.00% 0.00% 0.00% 2.804757 3.362131 -0.409774 -0.674143 37.593851 18.136528 -1.673091 -0.544365 0.533475 0.528721 0.357728
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% -0.595183 -0.206699 1.429683 1.418047 1.200986 2.132202 11.248509 14.570699 0.022254 0.021127 0.001130
66 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 3.933218 -0.193000 -0.657808 1.464546 4.433453 1.754225 20.925328 15.571914 0.028701 0.020946 0.005293
67 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 2.128616 1.121768 0.326182 0.584268 0.825617 0.766223 4.575719 3.050007 0.026065 0.024955 0.001292
68 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% -0.425049 3.103149 1.443057 -0.122173 0.957815 -1.177848 12.966173 0.385353 0.023364 0.028388 0.004049
69 N04 digital_ok 100.00% 100.00% 100.00% 0.00% -0.549339 1.043073 0.326858 0.126104 0.626251 6.174098 0.871385 1.872011 0.031328 0.029836 0.003051
70 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.281182 -0.725840 0.241149 0.472851 -0.188741 -0.859342 1.016910 -0.103927 0.027499 0.028379 0.001311
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.068925 3.522337 -0.626488 -0.822314 25.080432 17.848443 -1.392624 1.240037 0.571945 0.554778 0.406873
72 N04 digital_ok 100.00% 6.93% 6.93% 93.07% 3.160837 2.230908 -1.406460 0.275358 20.312570 117.352377 27.456205 2.792603 0.161235 0.124094 -0.235511
73 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.732337 -0.223557 -0.279138 0.069870 7.029430 14.471405 1.346969 1.418460 0.028110 0.027548 0.001525
74 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.229934 0.493592 -0.938298 -0.410916 14.717250 27.928588 50.885604 43.018257 0.029129 0.028711 0.001622
77 N06 not_connected 100.00% 100.00% 100.00% 0.00% 0.111841 -0.760469 -1.200378 -1.225908 1.516786 1.001266 8.697302 5.706787 0.030736 0.030666 0.001591
78 N06 not_connected 0.00% 100.00% 100.00% 0.00% -0.640401 0.007962 -1.047178 -1.184951 -0.673771 -0.619031 0.103816 2.772645 0.043459 0.038850 0.006997
79 N11 not_connected 0.00% 100.00% 100.00% 0.00% 0.018573 -0.584935 -0.798960 -0.801538 -0.473396 -1.050282 0.639804 -0.754787 0.030977 0.031345 0.001469
80 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.288949 2.161169 -1.068073 -1.153805 0.373359 -0.710569 -0.806948 0.464342 0.031203 0.030215 0.002078
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 6.083179 5.677213 4.440528 4.162909 219.342839 114.239133 1270.870627 712.477583 0.018665 0.016671 0.001594
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.306437 10.104929 3.648571 5.397281 126.313495 254.116773 764.479834 1414.976461 0.017064 0.016205 0.001002
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 4.933654 5.554061 4.697817 4.321658 235.088441 133.086544 1608.669790 985.972374 0.016349 0.016289 0.000786
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.313618 0.501069 0.228177 1.479839 11.610949 0.571844 -5.972964 11.008484 0.552084 0.077879 0.418693
85 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 0.276452 -0.589681 -0.120579 0.069399 16.410174 0.894536 0.367893 0.244462 0.031030 0.029338 0.002381
86 N08 digital_ok 100.00% 100.00% 100.00% 0.00% -0.797356 -0.390138 0.032619 -0.011676 4.355499 4.521712 8.322133 24.293857 0.029695 0.029302 0.001829
87 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.850929 1.432007 0.806055 0.140676 2.256562 1.147688 3.672873 1.100263 0.027016 0.028583 0.001575
88 N09 digital_ok 100.00% 100.00% 100.00% 0.00% -0.587316 -0.552952 -0.041553 0.092365 22.481865 21.114010 85.671977 75.719542 0.029737 0.028032 0.001925
89 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.829697 -0.660135 0.045482 0.138852 -0.615214 -1.118042 -0.385951 -0.662348 0.033272 0.028980 0.002624
90 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.423149 0.574196 -0.035287 -0.203117 1.000965 1.543904 0.526381 1.013370 0.031824 0.030160 0.002399
91 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.820916 -0.745713 0.035287 0.132092 0.233742 -0.965050 0.009623 -0.250905 0.027359 0.027401 0.001272
92 N10 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.971701 -0.253910 0.653435 0.345224 0.190271 -0.427228 0.504520 0.984904 0.026582 0.026416 0.001518
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 0.924698 1.037892 0.669214 0.804087 0.593088 -0.020650 5.426653 4.109354 0.024665 0.024106 0.001039
94 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 0.810416 0.809363 0.701079 0.736494 0.005205 1.734302 1.606713 1.064162 0.024565 0.024468 0.001099
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 2.245990 3.321517 -0.655337 -0.092326 29.365441 13.657348 -1.033705 -3.966035 0.528989 0.543603 0.376874
96 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.025862 -0.820349 -1.073081 -0.847610 -0.706225 0.494425 0.009692 -0.629754 0.029889 0.029912 0.001524
97 N11 not_connected 100.00% 100.00% 100.00% 0.00% -0.466345 0.172965 -0.852634 -0.700638 -0.383697 0.707389 -0.347881 7.510819 0.029702 0.029500 0.001521
101 N08 digital_ok 0.00% 100.00% 100.00% 0.00% 0.343626 -0.288865 0.524934 0.672283 -0.296467 -0.321664 1.935176 1.950228 0.026793 0.025427 0.001274
102 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.606646 0.053360 0.137086 0.299130 -0.706653 3.192084 -0.341522 11.055189 0.030944 0.029247 0.001859
103 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 4.346373 1.169508 -1.009165 0.221507 3.917002 8.334522 1.956783 3.746922 0.029436 0.026551 0.002065
104 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.172397 11.715084 0.625227 3.233336 25.982700 14.731805 5.941882 51.332185 0.025397 0.017686 0.004523
105 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.728889 -0.405361 0.076605 0.250569 -0.380716 -1.077480 -0.169010 -0.835335 0.028609 0.026987 0.001823
106 N09 digital_ok 100.00% 100.00% 100.00% 0.00% -0.495832 -0.650133 0.042518 0.127330 6.157628 0.332087 2.940584 1.050795 0.029426 0.027516 0.001681
107 N09 digital_ok 100.00% 100.00% 100.00% 0.00% -0.768729 -0.741461 0.063538 0.085243 -0.331830 -0.387592 2.786557 5.234154 0.032212 0.030816 0.002198
108 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.476235 -0.439915 0.314727 0.495946 0.779928 -0.781514 13.988627 0.377960 0.026421 0.026604 0.001225
109 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 0.992856 1.055127 0.676699 0.735928 0.263694 0.489949 0.927582 3.460237 0.026482 0.025120 0.001428
110 N10 RF_maintenance 0.00% 100.00% 100.00% 0.00% 2.795829 1.941872 0.222564 0.504813 1.640954 2.297294 2.021662 0.366965 0.026494 0.025551 0.001261
111 N10 digital_ok 100.00% 100.00% 100.00% 0.00% -0.731762 1.067704 0.368005 0.761032 0.400738 0.610306 -0.071228 5.403281 0.026148 0.024381 0.001383
112 N10 digital_ok 0.00% 100.00% 100.00% 0.00% -0.807976 0.861716 0.364943 0.789788 -0.722933 1.169800 0.117522 3.475439 0.027333 0.024444 0.001902
113 N11 not_connected 0.00% 100.00% 100.00% 0.00% 2.897734 2.601018 -0.770037 -0.703561 1.536778 -0.696650 0.084700 1.809143 0.030549 0.030230 0.001575
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 2.981439 0.558227 -1.053647 -0.579737 2.181897 -0.744987 15.854427 -0.625178 0.030339 0.029687 0.001770
115 N11 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.989622 5.820165 4.547487 3.642508 158.492307 144.457815 994.144402 793.148911 0.017388 0.016761 0.000921
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 4.302241 5.296601 3.832505 3.771653 166.698681 110.369417 975.826928 713.035480 0.016694 0.016576 0.000830
120 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.906736 1.382549 0.959846 0.516257 7.183855 12.283704 33.061416 49.742786 0.025494 0.025926 0.001215
121 N08 digital_ok 100.00% 1.11% 0.00% 0.00% 2.891508 4.144140 0.353771 -0.737751 7.175395 25.254780 0.125992 29.959717 0.541808 0.544468 0.369772
122 N08 digital_ok 0.00% 100.00% 100.00% 0.00% 0.714567 0.651246 0.469948 0.355004 1.183219 -0.856669 1.737854 1.597752 0.026933 0.026429 0.001487
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.163252 3.939662 0.522833 0.162035 2.099940 7.406653 -7.459114 -5.852904 0.557737 0.554776 0.384619
124 N09 digital_ok 0.00% 100.00% 100.00% 0.00% 0.945240 -0.560942 0.709186 0.454594 -0.433250 -0.658468 0.941767 2.074438 0.033753 0.029848 0.003667
125 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.089637 -0.620386 0.204516 0.215168 -0.547334 -0.039357 -0.503475 -0.399936 0.026761 0.026886 0.001120
126 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.649074 -0.380744 0.093151 0.253060 0.144255 -0.631497 0.766164 0.368530 0.027438 0.026962 0.001222
127 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 0.995004 0.708281 0.651367 0.077503 0.385730 6.775888 0.389677 0.968633 0.024973 0.027069 0.001484
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 0.145251 1.357118 0.198506 -0.029033 -0.075313 1.971109 3.210022 5.616788 0.026770 0.027636 0.001273
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
132 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.677074 -0.331251 -0.959888 -0.740808 -0.422311 0.173560 -0.634917 -0.013541 0.029457 0.029385 0.001578
133 N11 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 0.189634 2.771650 -0.791866 -0.997886 1.382917 30.564393 5.879418 114.076923 0.030792 0.030126 0.002100
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.711310 3.420057 -0.548273 -0.384085 44.024598 23.561920 0.899834 -1.133553 0.528793 0.550905 0.374426
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 1.118129 2.928187 0.578865 -0.700719 0.494760 13.117978 2.361080 3.598995 0.032581 0.537475 0.172898
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.585107 7.514374 4.018060 6.098710 181.164339 368.970233 1225.502570 2157.202391 0.016438 0.016178 0.000780
139 N13 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.316450 -0.522946 -1.167125 -0.834203 -0.299941 0.418262 -0.104209 -0.381675 0.031984 0.031253 0.002620
140 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.387536 0.723925 0.255601 0.101649 2.452407 3.017700 2.260657 3.039433 0.030144 0.029304 0.001701
141 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.576854 0.914862 0.367348 0.127394 0.708147 3.927774 -0.074499 -0.366689 0.029362 0.028348 0.001602
142 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.659776 1.069407 -0.055411 0.795972 4.189515 0.389059 25.201652 3.481609 0.028989 0.025228 0.002891
143 N14 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.864274 1.088020 0.597470 0.787263 -0.902602 -0.029987 0.260426 2.895316 0.111145 0.024671 0.015545
144 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.007365 1.099014 0.210914 -0.058961 2.225141 27.061331 0.493935 1.727493 0.028585 0.028204 0.001473
145 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.226884 -0.841104 0.290224 0.474143 2.434934 8.907384 -0.413935 0.343531 0.026702 0.026497 0.001225
146 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.710357 -0.769818 -0.942932 -0.893586 -0.744461 0.862574 -0.236820 -0.858395 0.029605 0.029451 0.001651
147 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.070344 0.133745 0.041016
149 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.198389 0.044505 0.136424
150 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.257051 0.352505 0.319381
151 N16 digital_ok 0.00% 100.00% 100.00% 0.00% -0.561292 0.136808 -0.968944 -0.684400 1.111519 -0.588986 -0.452932 0.164197 0.032186 0.030080 0.002373
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 1.028348 3.597526 0.619406 -0.604718 0.764231 13.384016 4.868069 -0.762506 0.032869 0.558956 0.200901
156 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.618082 1.097488 0.627068 0.750617 1.174041 0.678529 2.447789 4.353340 0.028424 0.026347 0.001513
157 N12 digital_ok 0.00% 100.00% 100.00% 0.00% -0.563469 -0.805459 0.300681 0.386658 -0.535771 0.603970 -0.552031 -0.656382 0.028090 0.026622 0.001421
158 N12 digital_ok 100.00% 100.00% 100.00% 0.00% 0.338136 0.180382 0.198411 0.322590 -0.116229 2.461715 4.990778 24.064914 0.026931 0.026477 0.001155
159 N13 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.439174 -0.772414 -0.938543 -0.882498 0.972866 -0.556341 -0.609811 0.353758 0.032081 0.031333 0.002657
160 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 0.879627 0.656992 0.644314 0.191179 0.049611 -0.724578 1.131465 -0.009623 0.060276 0.036935 0.010881
161 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 0.168305 1.046375 0.271086 0.111771 0.713336 -0.847337 -0.368066 -0.134620 0.035324 0.032334 0.003572
162 N13 digital_ok 100.00% 100.00% 100.00% 0.00% 2.129852 1.485817 -0.209427 0.043716 3.089374 -1.153726 2.380110 -0.432208 0.056947 0.038862 0.008643
163 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.268943 -0.578963 0.286656 0.387261 3.930844 4.823100 5.158300 4.901289 0.028908 0.026581 0.001814
164 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.773532 -0.485499 0.420971 0.422628 17.663154 1.353477 0.093616 0.879400 0.026287 0.026545 0.001238
165 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
166 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
167 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.146749 0.184186 0.130122
168 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
169 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.127588 0.123925 0.044596
170 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.034002 0.023115 -0.053759
171 N16 digital_ok 0.00% 100.00% 100.00% 0.00% 0.137826 -0.552160 -0.843877 -0.869017 0.028896 -0.860819 -0.711727 -0.759612 0.029690 0.030421 0.001716
172 N16 digital_ok 0.00% 100.00% 100.00% 0.00% 2.528330 1.019191 -1.060810 -1.242855 0.635214 0.085340 1.217432 1.714508 0.030285 0.030833 0.002085
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.956515 3.293309 0.579004 0.595377 -1.597671 -2.300973 -9.556664 -9.484581 0.516560 0.498343 0.344760
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.813285 3.495629 -0.886656 -0.526443 12.817722 15.162112 -0.523164 -1.564910 0.564680 0.549046 0.371045
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.966629 0.973837 -0.497228 0.820500 27.403846 0.400985 28.660315 4.562626 0.591712 0.036620 0.349484
181 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.806582 -0.830107 0.434828 0.495032 2.332865 0.811006 -0.060802 2.671953 0.069565 0.036243 0.015437
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 2.823564 1.092311 -0.220380 0.732415 25.077689 0.345629 -1.630175 4.581867 0.589526 0.038614 0.363135
183 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.007962 -0.353441 0.244262 0.379080 -0.428036 0.989339 -0.684835 1.546929 0.030158 0.028391 0.001766
184 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 0.841056 0.393888 0.592452 0.133230 0.467735 6.652265 2.764157 -0.268877 0.029021 0.027591 0.001745
185 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
186 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 2.525918 1.751149 -0.407499 -0.184925 0.040508 3.823147 3.793484 3.497901 0.030509 0.028961 0.002100
187 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 0.630482 2.415388 0.113361 -0.351541 23.062683 1.001318 3.687210 6.043846 0.027095 0.028312 0.001453
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.101650 0.042645 0.060301
190 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.105752 0.114881 0.050716
191 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.888222 3.274704 0.505969 0.636071 0.325946 -2.113775 -8.823446 -10.297981 0.518318 0.495478 0.354654
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.935466 3.266025 0.635223 0.559201 -1.120766 -1.469869 -9.983151 -9.695988 0.522889 0.506075 0.353644
200 N18 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.724132 -0.437375 -0.699143 -0.781180 0.607421 -0.489280 2.989275 0.297278 0.040464 0.040949 0.004507
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.843634 3.286596 0.336716 0.532951 2.025507 -0.820074 -7.293172 -9.479086 0.556471 0.501593 0.377023
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% -0.300753 -0.011929 -1.030557 -0.744389 -1.040720 2.241021 -0.647430 28.690289 0.040145 0.069086 0.024722
204 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.375445 0.355096 0.360778 0.161335 3.589182 -0.665695 24.858166 2.451155 0.026746 0.027024 0.000709
205 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.625610 -0.412968 -0.716216 -0.718501 -0.294770 -0.654208 0.589657 1.950274 0.029393 0.029514 0.001727
206 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.184295 0.725459 -0.841085 -0.671735 1.030291 0.001197 0.089962 -0.799260 0.029382 0.029609 0.001682
207 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.661771 -0.468075 -0.955303 -0.811005 0.756553 3.159487 2.281921 0.819620 0.047451 0.039329 0.008937
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_ok 0.00% 100.00% 100.00% 0.00% -0.296971 1.002593 -0.884973 -0.592459 -0.421903 -0.144531 -0.993204 1.795606 0.031821 0.030566 0.002366
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.377441 -0.594019 -1.107775 -0.906633 7.456371 4.503673 35.958043 25.168995 0.032493 0.030821 0.002259
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% -0.487452 -0.653618 -1.099256 -0.932182 6.214265 1.181839 8.996225 7.989657 0.031354 0.029931 0.002140
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% -0.825237 -0.812715 -0.994630 -0.866310 4.729354 6.024943 23.117229 25.326561 0.029458 0.029296 0.001563
223 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.079250 0.787017 -0.884443 -0.681929 0.220789 1.335853 -0.642987 -0.352380 0.073917 0.055159 0.031270
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.951739 3.258153 0.694881 0.622678 -2.228393 -2.023620 -10.453115 -10.039562 0.490506 0.479161 0.366629
225 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.213585 1.019832 -1.037135 -0.622979 -0.675211 0.464259 -0.616308 2.979382 0.030822 0.032756 0.003335
226 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.743277 -0.324237 -0.913574 -0.979990 -0.011705 -0.144910 -0.403382 -0.853312 0.029527 0.030081 0.001891
227 N20 RF_ok 0.00% 100.00% 100.00% 0.00% 0.502488 -0.190630 -0.771941 -0.753952 -0.314993 3.463991 0.157977 -0.533577 0.031331 0.029851 0.002131
228 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.686738 0.220833 -1.081636 -0.797890 0.215816 -0.898255 1.171866 -0.949767 0.030079 0.029420 0.001875
229 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.051564 0.302923 -1.265850 -1.277155 1.543947 -0.934590 0.078286 -0.303912 0.029606 0.029788 0.001682
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% -0.266974 -0.730672 -0.880361 -0.835086 0.718781 2.360565 2.872161 9.600063 0.029484 0.029188 0.001600
238 N18 RF_ok 0.00% 100.00% 100.00% 0.00% -0.564913 -0.472615 -1.032482 -0.879833 -0.456844 -1.173008 -0.374950 -0.613946 0.029748 0.029365 0.001599
239 N18 RF_ok 0.00% 100.00% 100.00% 0.00% -0.630885 -0.782296 -0.879353 -0.813977 0.806326 1.743665 -0.470087 -0.384185 0.031198 0.029607 0.001963
240 N19 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.181953 -0.724474 -0.992981 -0.936631 0.122426 -0.161391 0.313661 -0.272911 0.029662 0.029625 0.001720
241 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.863127 -0.660595 -0.958149 -0.876114 -0.077689 0.478262 -0.473997 -0.907345 0.030877 0.029464 0.002165
242 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.609380 -0.125436 -1.039223 -1.013800 -0.419275 1.732535 -0.731315 -0.835502 0.029756 0.029589 0.001840
243 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.208802 -0.360445 -1.198527 -0.817728 0.693790 -0.098864 -0.519623 -0.654692 0.029791 0.029386 0.001562
244 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.115643 -0.136376 -0.868110 -0.710139 0.695557 3.797718 0.807824 -0.616837 0.030940 0.030295 0.002145
245 N20 RF_ok 0.00% 100.00% 100.00% 0.00% -0.667996 -0.361472 -0.984131 -0.771776 -0.432590 -0.628463 -0.263531 0.380921 0.029933 0.029472 0.001928
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 2.714348 0.924967 -0.352202 -0.705833 33.632353 -0.159006 -0.590681 -0.104508 0.518372 0.032803 0.259382
261 N20 RF_ok 0.00% 100.00% 100.00% 0.00% -0.842044 -0.541037 -0.965926 -0.825922 -0.693812 0.378101 0.934269 -0.161031 0.030292 0.029590 0.001953
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% -0.389696 -0.084378 0.299769 0.407637 -0.300494 1.765313 3.205925 11.824304 0.025539 0.025544 0.000904
320 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.019040 3.334773 0.288665 0.081250 10.376616 7.921188 -6.188511 -2.929923 0.449725 0.441669 0.356056
324 N04 not_connected 100.00% 0.00% 0.00% 0.00% 2.919443 3.418765 0.038558 0.107588 17.247332 7.755123 -3.204446 -5.556413 0.438541 0.431943 0.339202
325 N09 dish_ok 100.00% 0.00% 0.00% 0.00% 2.923540 3.433847 -0.003934 -0.496196 15.768846 17.988404 -4.173655 -1.430178 0.472447 0.464539 0.369959
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.563310 3.508566 -0.286352 -0.382685 65.244536 14.037495 3.373881 -0.732959 0.442211 0.437720 0.336705
333 N12 dish_maintenance 0.00% 100.00% 100.00% 0.00% -0.278636 -0.302519 -0.841287 -0.728170 0.125541 1.247532 2.861164 -0.789919 0.035281 0.029769 0.003302
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, 5, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 131, 132, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 200, 202, 204, 205, 206, 207, 208, 209, 210, 211, 220, 221, 222, 223, 225, 226, 227, 228, 229, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 324, 325, 329, 333]

unflagged_ants: [173, 192, 193, 201, 224]

golden_ants: [173, 192, 193]
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_2460055.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 [ ]: