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 = "2460021"
data_path = "/mnt/sn1/2460021"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 3-17-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/2460021/zen.2460021.21283.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

# get a list of all ant_metrics files
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{ant_metrics_ext}')
ant_metrics_files = sorted(glob.glob(glob_str))

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1851 ant_metrics files matching glob /mnt/sn1/2460021/zen.2460021.?????.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/2460021/zen.2460021.?????.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 2460021
Date 3-17-2023
LST Range 6.203 -- 16.165 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
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, 42, 70, 72
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating N07
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 68 / 198 (34.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 116 / 198 (58.6%)
Redcal Done? ❌
Never Flagged Antennas 79 / 198 (39.9%)
A Priori Good Antennas Flagged 58 / 93 total a priori good antennas:
3, 5, 15, 16, 17, 20, 37, 40, 42, 45, 54, 55,
65, 66, 70, 71, 72, 81, 83, 86, 93, 94, 101,
103, 109, 111, 112, 118, 121, 122, 123, 124,
127, 136, 140, 145, 147, 148, 149, 150, 151,
158, 161, 165, 167, 168, 169, 170, 173, 182,
184, 187, 189, 190, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 44 / 105 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 50, 57, 61, 62,
64, 73, 74, 89, 90, 95, 102, 115, 132, 133,
135, 139, 185, 207, 220, 221, 222, 223, 227,
228, 229, 237, 238, 239, 240, 241, 244, 245,
261, 320, 324, 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_2460021.csv

Build DataFrame¶

In [20]:
# build dataframe
to_show = {'Ant': [f'<a href="{ant_to_report_url(ant)}" target="_blank">{ant}</a>' for ant in ants],
           'Node': [f'N{nodes[ant]:02}' for ant in ants], 
           'A Priori Status': [a_priori_statuses[ant] for ant in ants]}
           #'Worst Metric': worst_metrics, 'Worst Modified Z-Score': worst_zs}
df = pd.DataFrame(to_show)

# create bar chart columns for flagging percentages:
bar_cols = {}
if use_auto_metrics:
    bar_cols['Auto Metrics Flags'] = [float(ant in auto_ex_ants) for ant in ants]
if use_ant_metrics:
    if np.sum(list(a_priori_flag_frac.values())) > 0:  # only include this col if there are any a priori flags
        bar_cols['A Priori Flag Fraction in Ant Metrics'] = [a_priori_flag_frac[ant] for ant in ants]
    for ap in antpols:
        bar_cols[f'Dead Fraction in Ant Metrics ({ap})'] = [dead_ant_frac[ap][ant] for ant in ants]
    bar_cols['Crossed Fraction in Ant Metrics'] = [crossed_ant_frac[ant] for ant in ants]
if use_redcal:
    bar_cols['Flag Fraction Before Redcal'] = [redcal_prior_flag_frac[ant] for ant in ants]
    bar_cols['Flagged By Redcal chi^2 Fraction'] = [redcal_flagged_frac[ant] for ant in ants]  
for col in bar_cols:
    df[col] = bar_cols[col]

# add auto_metrics
if use_auto_metrics:
    for label, modz in all_modzs.items():
        df[label] = modz
z_score_cols = [col for col in df.columns if 'Modified Z-Score' in col]        
        
# add ant_metrics
ant_metrics_cols = {}
if use_ant_metrics:
    for ap in antpols:
        ant_metrics_cols[f'Average Dead Ant Metric ({ap})'] = [average_dead_metrics[ap][ant] for ant in ants]
    ant_metrics_cols['Average Crossed Ant Metric'] = [average_crossed_metrics[ant] for ant in ants]
    for col in ant_metrics_cols:
        df[col] = ant_metrics_cols[col]   

# add redcal chisq
redcal_cols = []
if use_redcal:
    for ap in antpols:
        col_title = f'Median chi^2 Per Antenna ({ap})'
        df[col_title] = [cspa[ant, ap] for ant in ants]
        redcal_cols.append(col_title)

# sort by node number and then by antenna number within nodes
df.sort_values(['Node', 'Ant'], ascending=True)

# style dataframe
table = df.style.hide_index()\
          .applymap(lambda val: f'background-color: {status_colors[val]}' if val in status_colors else '', subset=['A Priori Status']) \
          .background_gradient(cmap='viridis', vmax=mean_round_modz_cut * 3, vmin=0, axis=None, subset=z_score_cols) \
          .background_gradient(cmap='bwr_r', vmin=dead_cut-.25, vmax=dead_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .background_gradient(cmap='bwr_r', vmin=crossed_cut-.25, vmax=crossed_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .background_gradient(cmap='plasma', vmax=4, vmin=1, axis=None, subset=redcal_cols) \
          .applymap(lambda val: 'font-weight: bold' if val < dead_cut else '', subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val < crossed_cut else '', subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .applymap(lambda val: 'color: red' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .bar(subset=list(bar_cols.keys()), vmin=0, vmax=1) \
          .format({col: '{:,.4f}'.format for col in z_score_cols}) \
          .format({col: '{:,.4f}'.format for col in ant_metrics_cols}) \
          .format({col: '{:,.2%}'.format for col in bar_cols}) \
          .applymap(lambda val: 'font-weight: bold', subset=['Ant']) \
          .set_table_styles([dict(selector="th",props=[('max-width', f'70pt')])])

Table 2: RTP Per-Antenna Metrics Summary Table¶

This admittedly very busy table incorporates summary information about all antennas in the array. Its columns depend on what information is available when the notebook is run (i.e. whether auto_metrics, ant_metrics, and/or redcal is done). These can be divided into 5 sections:

Basic Antenna Info: antenna number, node, and its a priori status.

Flag Fractions: Fraction of the night that an antenna was flagged for various reasons. Note that auto_metrics flags antennas for the whole night, so it'll be 0% or 100%.

auto_metrics Details: If auto_metrics is included, this section shows the modified Z-score signifying how much of an outlier each antenna and polarization is in each of four categories: bandpass shape, overall power, temporal variability, and temporal discontinuities. Bold red text indicates that this is a reason for flagging the antenna. It is reproduced from the auto_metrics_inspect.ipynb nightly notebook, so check that out for more details on the precise metrics.

ant_metrics Details: If ant_metrics is included, this section shows the average correlation-based metrics for antennas over the whole night. Low "dead ant" metrics (nominally below 0.4) indicate antennas not correlating with the rest of the array. Negative "crossed ant" metrics indicate antennas that show stronger correlations in their cross-pols than their same-pols, indicating that the two polarizations are probably swapped. Bold text indicates that the average is below the threshold for flagging.

redcal chi^2 Details: If redcal is included, this shows the median chi^2 per antenna. This would be 1 in an ideal array. Antennas are thrown out when they they are outliers in their median chi^2, usually greater than 4-sigma outliers in modified Z-score.

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 0.00% 100.00% 0.00% 0.701192 14.981176 0.362243 12.197608 0.430915 7.544746 -0.649504 2.851966 0.603807 0.053681 0.524436
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.336636 22.244998 -0.403990 -0.197413 -1.011117 3.845047 -1.102339 11.864850 0.609468 0.516116 0.331487
5 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 11.710906 14.756972 11.400664 11.902233 6.922946 7.625246 1.813176 2.369927 0.046587 0.039078 0.003234
7 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.149882 -0.049773 -0.681919 0.217617 -0.003491 0.597235 1.971757 2.810246 0.616198 0.638547 0.338310
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.165998 -1.149641 0.123480 0.551940 0.020162 0.883827 0.098619 0.431296 0.615613 0.637401 0.331600
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.522081 -0.413791 3.821017 -0.562590 0.603378 -0.309583 1.596269 -0.466992 0.598861 0.637490 0.341160
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.941118 -0.847468 0.383581 -0.837705 -0.293756 0.316607 0.390626 0.180181 0.605797 0.639894 0.345158
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 26.841582 0.364283 0.418316 0.387521 3.291079 0.670076 0.099927 0.420436 0.492087 0.641356 0.342416
16 N01 digital_ok 100.00% 0.00% 100.00% 0.00% 0.349989 15.336937 -0.322997 12.202150 0.844274 7.530945 0.114269 3.425340 0.625346 0.051222 0.528743
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.652381 6.722162 1.121463 10.548683 0.702139 3.040472 -0.003903 0.981590 0.627092 0.475945 0.400139
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.939913 29.271008 11.433309 1.011263 6.895017 7.041564 1.883235 27.884875 0.045647 0.453348 0.357460
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.153624 0.541158 -0.460163 0.049179 -0.327199 3.050930 -0.420293 0.828050 0.631133 0.659443 0.345862
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.500754 -1.030428 2.242582 -0.552086 4.115035 -0.074210 1.521276 -0.326542 0.621457 0.653786 0.337695
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.708149 0.261100 -0.040427 0.572645 0.596075 0.805937 -0.005428 0.406319 0.609004 0.633388 0.327612
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.606128 -0.071850 0.319556 0.062294 0.737874 2.310339 0.382123 0.062274 0.585867 0.615815 0.335027
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.546999 13.995668 11.493373 11.997559 6.876484 7.623182 2.709877 3.153922 0.038145 0.036590 0.001616
28 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.090704 49.630604 11.319112 4.119742 6.915384 11.028853 2.556880 27.158912 0.038394 0.319178 0.239349
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.942150 -0.653468 -0.739828 -0.511880 -0.183207 0.439309 0.084688 -0.444662 0.640382 0.660829 0.338145
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.923665 -0.571633 0.919046 -0.965852 2.460237 0.000023 3.823725 -0.657244 0.625431 0.665648 0.342011
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.984600 -0.841301 1.567610 1.933146 1.809746 0.691369 0.099044 2.275333 0.641032 0.661132 0.329560
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 20.979066 22.466756 -0.261146 -0.093847 1.571370 0.315940 11.811060 11.176109 0.542678 0.580353 0.216798
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.841379 15.654581 5.938083 6.316056 6.856145 7.583007 3.693049 5.201631 0.042725 0.062262 0.012389
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.057934 -0.739484 0.713456 -0.961325 1.242707 -0.758179 0.072883 0.417603 0.591550 0.620725 0.333156
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.999835 8.398222 1.448533 1.212370 1.580368 1.893449 1.536301 1.504749 0.613468 0.639820 0.348224
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 1.280187 23.455915 0.029502 14.189802 -0.962705 7.612676 -0.903966 3.821628 0.603375 0.043327 0.475922
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.378902 2.839602 -0.340091 -0.020176 -0.000023 -0.408906 0.470362 2.532645 0.630175 0.630971 0.344932
40 N04 digital_ok 0.00% 0.00% 0.00% 100.00% 0.090876 0.985706 -0.098134 -0.522039 1.374451 0.307747 3.410331 1.967042 0.318804 0.310391 -0.260063
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.696527 1.389866 1.840975 1.585180 2.581907 0.284686 0.429984 0.515180 0.642489 0.665445 0.337035
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.659691 2.973419 -0.432345 -0.461644 0.946159 2.098134 1.646995 1.979603 0.331587 0.320489 -0.259405
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.195994 -0.248933 0.006926 1.142486 -0.505371 1.297546 -0.482130 0.666283 0.643298 0.669007 0.330208
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.786090 0.488147 -0.971137 0.674179 -0.543439 0.639192 -0.316602 0.492677 0.643865 0.676536 0.336941
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.395914 3.781561 0.938111 1.232539 -0.339430 2.258906 1.007089 5.162532 0.636391 0.661893 0.325927
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.543662 -0.081954 -0.110051 -0.735178 -0.340651 -0.554061 0.015802 -0.619577 0.635120 0.674244 0.345443
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.925456 15.340316 5.838896 5.940274 6.837894 7.510963 3.848347 3.114520 0.033056 0.067648 0.022338
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.210679 1.268949 -0.203106 1.730099 -0.657612 2.162890 -0.718099 -1.121398 0.596682 0.631287 0.336059
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.401136 0.150260 0.515608 -0.740081 -0.512499 -0.096401 0.461070 0.508407 0.570351 0.621260 0.339479
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.840437 1.403792 0.421547 2.206630 -0.243450 1.486414 1.321772 1.848259 0.610931 0.640832 0.350210
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.761625 2.074146 0.258653 -0.320188 2.532142 1.368994 25.641015 1.833649 0.621603 0.646899 0.348399
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.830066 6.421021 0.769066 0.545565 1.166422 1.002455 1.378539 0.663332 0.634689 0.658756 0.346389
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.552555 2.141013 0.122255 -0.102384 1.901689 0.009630 2.973152 1.319225 0.639892 0.673176 0.354863
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 12.155925 4.437092 2.670205 0.430593 3.438811 1.620261 0.917441 1.518719 0.328155 0.395597 0.160970
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.962494 55.115055 1.662068 7.331394 0.909606 8.038376 2.346209 2.628278 0.324489 0.053742 0.151166
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.480681 0.811194 -0.468608 2.843842 -0.863454 2.186870 -0.456629 3.770452 0.645654 0.674118 0.329891
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.441347 -0.921594 -0.098409 -0.408865 -0.726607 0.218553 -1.032705 -0.339266 0.651009 0.671235 0.328638
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.529790 14.370479 11.388018 12.117409 6.802748 7.546110 3.239229 3.600061 0.046692 0.045236 0.001911
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.711199 0.853928 11.455143 1.837069 6.680930 3.349234 3.081403 4.224797 0.059725 0.669967 0.490717
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.441945 14.237868 0.131345 12.144593 0.165680 7.554314 0.730191 4.493868 0.636212 0.101052 0.480431
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.078898 -0.417507 0.558056 -0.767794 1.259945 -0.582175 0.080856 0.006402 0.586186 0.640381 0.338307
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.858715 1.096598 -0.179375 1.226911 -0.163451 0.162505 0.005428 -0.804148 0.580278 0.634256 0.338481
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.076806 14.816273 -0.238798 6.358059 -0.027656 7.643191 -0.200915 4.209965 0.602278 0.057758 0.438899
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.158622 -0.104929 -0.735799 -0.181141 -0.636906 -0.861581 1.068660 1.302051 0.588653 0.622637 0.339450
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 24.344050 23.191133 14.529889 14.642184 6.980334 7.699913 3.823299 5.075337 0.025782 0.041926 0.015158
66 N03 digital_ok 100.00% 0.86% 100.00% 0.00% 5.449995 24.029967 2.934997 14.825515 2.377626 7.596407 1.806880 5.743007 0.284164 0.069041 0.154493
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.352702 -0.301210 -0.614397 1.960457 -0.597726 1.381475 1.276318 0.695267 0.636557 0.662914 0.345404
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 26.260836 1.913862 14.668308 1.155321 6.805382 0.092531 4.651109 0.353063 0.046528 0.669132 0.514062
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.603384 -0.572191 1.553779 -0.617043 -0.321311 0.786536 0.492416 -0.619237 0.648822 0.678227 0.336897
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.432256 2.058709 1.517768 3.659157 2.287656 1.502423 3.326106 2.992351 0.347764 0.329546 -0.254561
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 5.825781 -0.311130 -0.414864 0.421969 0.273324 -0.351622 -0.345463 0.051427 0.652690 0.683416 0.328014
72 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.140053 1.175697 3.044876 1.441007 1.535239 0.741310 5.855622 2.268362 0.354116 0.338410 -0.255949
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.602969 0.981454 -0.778684 -0.280534 0.826778 0.356127 -0.130309 -0.065006 0.657029 0.685816 0.331768
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.786534 -0.021464 0.078833 -0.074465 -0.444562 1.469096 -0.034456 1.658808 0.649162 0.681355 0.335954
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 52.817836 17.658348 0.947233 -0.281850 3.669356 1.803719 4.996891 1.743541 0.384257 0.565984 0.296603
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 27.805875 0.979845 -0.050874 1.501551 1.280900 1.100296 1.410286 -0.650868 0.457095 0.641296 0.336910
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 0.886068 15.112288 -0.743624 6.365393 -1.041112 7.472675 -0.461720 2.142685 0.593332 0.050354 0.446270
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 0.346063 15.966022 0.409157 6.266531 -0.367657 7.479189 -1.143002 2.865414 0.594460 0.077155 0.451942
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 53.592965 43.578455 28.697844 23.817824 18.701622 10.843478 339.423834 209.288110 0.039194 0.019797 0.012110
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 30.791449 37.991906 27.494957 27.368681 12.171538 12.284800 348.876008 376.103962 0.041334 0.041934 0.004014
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 23.628738 67.534530 23.304355 31.474702 9.986395 33.245627 219.434979 454.812216 0.045251 0.039723 0.007321
84 N08 RF_maintenance 100.00% 21.34% 100.00% 0.00% 19.227203 25.673833 14.190286 14.987655 5.201225 7.537942 2.671473 4.304481 0.242212 0.048124 0.145272
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.039372 -0.156582 -1.002617 -0.919759 1.426737 -0.411721 -0.927015 -1.176313 0.651847 0.672171 0.330782
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.015641 1.238911 -0.317586 -0.284684 2.515053 0.202199 -0.534208 7.318853 0.651375 0.681617 0.324451
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.881730 7.301641 0.663241 0.313839 7.290083 0.294577 23.257597 5.278750 0.636154 0.692974 0.326004
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.069797 0.877835 1.004610 1.560954 0.119070 -0.865018 -0.242535 -0.205648 0.656389 0.682690 0.316030
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.865996 0.711337 0.844863 1.486608 -0.786133 0.150253 -0.699416 -0.266396 0.651245 0.687473 0.325208
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.314218 0.008514 -0.379324 -0.242529 -0.030477 -0.942926 -0.519222 0.139507 0.639714 0.693833 0.337507
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.191220 0.309064 1.149905 0.928634 -0.059058 -0.073258 -0.194188 -0.346096 0.636489 0.679609 0.335464
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.123410 0.215675 11.378016 0.727883 6.917068 1.944219 1.677752 -0.224145 0.048109 0.678365 0.436354
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.399703 14.572748 11.519671 12.221141 6.756461 7.492134 2.854671 3.083890 0.038808 0.025796 0.006682
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.150588 14.832116 11.627438 12.016411 6.844593 7.547980 2.058461 2.510392 0.026095 0.026489 0.001092
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.032779 1.680250 -0.601502 0.959831 2.063793 1.693939 0.017554 0.650941 0.462387 0.495393 0.217283
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.697653 25.446276 1.430564 -0.155131 0.020235 0.710152 -1.174895 -0.147337 0.601152 0.540672 0.313661
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.215119 2.643938 -0.631822 0.152250 -1.082894 0.051119 -0.064193 4.590223 0.591075 0.625474 0.346392
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.255324 8.469683 0.266971 1.647817 -0.014043 1.646873 -0.516476 0.173623 0.636285 0.669680 0.342089
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.698278 0.610933 -0.552906 -0.921533 -0.106673 0.153165 -1.291397 0.849748 0.645221 0.676396 0.335452
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.190281 5.404786 2.483119 -0.861035 1.165099 0.776211 0.399059 0.846558 0.635591 0.685402 0.334307
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.625504 58.607881 -0.124414 7.839788 2.426231 0.905720 -0.248028 3.233967 0.659848 0.681735 0.318694
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.060066 0.786242 0.802178 1.575168 1.050522 -0.184878 -0.446462 -0.235216 0.658024 0.687496 0.320097
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.371051 1.627614 -0.158473 0.175541 1.517848 -0.950311 -0.466298 -0.628978 0.657108 0.688711 0.322367
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.420536 1.175501 0.552580 -0.006926 0.544729 0.196272 2.514056 1.169090 0.652783 0.687940 0.323916
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.108107 41.133732 11.429694 1.694661 6.828568 2.565297 2.404538 2.558339 0.044800 0.332216 0.165969
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.899318 14.316095 11.463301 11.880346 6.879176 7.617910 1.798972 3.164041 0.079667 0.045230 0.022745
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.937074 0.100712 0.367121 0.034611 6.382345 0.537097 -0.053842 -0.621933 0.586550 0.676858 0.335447
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 25.620098 14.276118 1.608824 11.970274 3.539053 7.612985 19.552911 3.254948 0.531321 0.081762 0.348020
112 N10 digital_ok 100.00% 0.00% 0.00% 99.95% -0.517088 8.078332 2.181653 10.751789 2.548048 4.337092 2.445896 1.644545 0.324825 0.207106 -0.203950
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.092220 15.724700 5.567031 6.360822 6.715646 7.453930 2.440295 2.540389 0.040862 0.031590 0.005665
114 N11 not_connected 100.00% 100.00% 0.00% 0.00% 13.944019 1.251800 5.742533 0.064686 6.689992 -0.852880 1.734696 -0.713232 0.056965 0.633257 0.464727
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.044299 -0.477481 -0.932803 0.330463 -0.742270 -0.363101 -0.555406 -1.300426 0.577969 0.630951 0.352121
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 23.999034 46.901524 22.403531 31.208483 5.929882 16.194017 153.630458 482.621241 0.018213 0.016228 0.001644
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 24.602949 38.440999 24.299434 28.666941 7.425108 16.535520 259.758547 461.895914 0.032960 0.039934 0.005946
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.305369 1.540130 3.331418 -0.599109 0.449718 0.940259 6.780079 3.662949 0.632494 0.674365 0.336218
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.788036 3.716980 -0.872239 6.844751 -0.495234 -0.538067 0.034542 9.079221 0.648489 0.665948 0.320928
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.317690 6.501029 -0.613399 -0.774170 0.011439 0.651522 -0.887372 -0.929427 0.663307 0.694674 0.327339
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.171908 8.852886 1.355822 1.598662 0.975033 0.388877 -0.158006 0.156907 0.668342 0.696510 0.322057
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 11.276063 0.503401 11.706445 1.185842 6.698062 0.885016 1.823456 0.110873 0.053247 0.694951 0.439340
125 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.352079 5.091850 1.294165 1.453259 1.025964 2.789026 1.390071 1.534191 0.654220 0.681833 0.319923
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.559224 3.491967 0.406269 1.676554 5.646675 2.526841 16.640008 0.158219 0.574488 0.684169 0.329151
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 10.834494 0.688334 11.372245 1.172433 6.904446 2.986772 1.671305 3.190692 0.046062 0.681119 0.431040
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.232505 -0.752897 -0.752122 -0.021821 -0.735180 -0.086708 -0.835813 1.677892 0.639038 0.677123 0.357486
131 N11 not_connected 100.00% 0.00% 1.67% 0.00% -0.828875 13.805399 0.102234 6.184922 -0.875246 6.756544 -1.241132 1.123829 0.603528 0.344979 0.380565
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.798635 0.315423 -0.033002 -0.880303 -0.049351 -0.693644 -1.142258 -0.815139 0.593612 0.631471 0.345555
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.291044 -1.025073 -0.940448 -0.249562 -1.299884 -0.711625 -0.833992 -0.836950 0.583571 0.632134 0.352479
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.323429 15.861620 5.710430 6.327263 6.713992 7.488998 1.710957 2.644718 0.049491 0.040874 0.004652
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.121522 -1.035349 -0.794421 -1.043463 2.428558 1.004898 3.086404 -0.045837 0.574860 0.634064 0.372881
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 10.243921 -0.545386 11.058408 -0.267618 6.896568 0.644025 2.404483 -0.744683 0.053829 0.636716 0.445592
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 38.490691 59.641986 31.942853 25.724112 14.358181 13.928571 430.900323 207.447375 0.037665 0.044639 0.006120
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.427616 0.068342 1.517996 -0.767400 1.006504 -0.912015 -0.611233 -0.445301 0.611243 0.642223 0.332588
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 5.327183 -0.741222 -0.741059 0.050226 16.377059 2.988407 67.387974 13.855334 0.623203 0.674570 0.326520
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.639260 -0.000564 0.226721 0.749020 1.779366 -0.151283 0.326778 -0.464555 0.649055 0.679894 0.327827
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.817198 14.345434 -0.204878 12.155920 2.288726 7.571811 7.161265 3.103098 0.652851 0.060052 0.506322
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.823809 14.215215 11.298396 12.123412 6.267033 7.549553 1.830891 3.103537 0.120603 0.038638 0.064812
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.164434 0.837101 -0.564647 3.724949 0.246501 1.065678 -0.623829 1.175819 0.661445 0.682836 0.322325
145 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.308546 0.534083 -0.095972 -0.731595 -0.589021 4.179081 -0.254597 -0.649206 0.657172 0.676023 0.322793
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.331879 -0.506775 -0.776954 -0.548449 -0.530476 -1.073759 -0.967071 -1.194583 0.627251 0.664947 0.332295
147 N15 digital_ok 100.00% 99.78% 99.78% 0.00% 188.876630 184.875491 inf inf 2382.043266 2371.476909 4983.495076 4873.980868 0.450506 0.418785 0.443071
148 N15 digital_ok 100.00% 99.68% 99.68% 0.00% 159.123014 156.772799 inf inf 2204.086587 2173.395864 4537.404567 4416.182736 0.357897 0.417726 0.389052
149 N15 digital_ok 100.00% 99.51% 99.46% 0.00% 199.057628 199.120687 inf inf 2214.663826 2222.727172 4286.372495 4034.628058 0.523122 0.401620 0.480542
150 N15 digital_ok 100.00% 99.57% 99.46% 0.00% 213.775603 211.666517 inf inf 1882.549787 1914.559085 4486.030685 4111.266904 0.523325 0.536785 0.559431
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 20.767936 -0.180115 -0.276756 1.399132 1.682262 -0.266169 0.385625 3.418567 0.479361 0.614339 0.317843
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.614887 -0.722112 11.217473 -0.706933 6.921800 0.335687 2.828869 0.704777 0.055008 0.638128 0.459956
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.267542 14.140903 9.188963 11.923740 1.965276 7.630680 1.307643 3.797603 0.452799 0.051930 0.327261
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.774632 -0.153236 0.657415 1.248218 0.157283 1.422437 -0.083101 0.049207 0.595430 0.643065 0.351728
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.228315 -0.148006 -1.018898 -1.028333 1.359071 0.818116 0.091619 4.982678 0.608587 0.651097 0.352049
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.561719 18.908960 -0.701977 -0.422338 -0.166225 1.726480 -0.312434 12.341784 0.585326 0.554401 0.310940
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.121155 -1.166095 0.115378 -0.218526 -0.173451 1.734163 -0.384125 -0.385237 0.632091 0.666389 0.335740
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.028201 29.780028 0.621346 0.346541 0.726452 0.341522 -0.410564 -0.099810 0.641384 0.556570 0.291232
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.763451 -1.316030 0.234432 -0.775187 -0.154431 0.612298 -0.454803 -0.972298 0.647421 0.682375 0.336922
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.892458 1.626725 0.447131 0.939947 0.319105 1.025308 -0.585682 0.037056 0.655470 0.684429 0.332038
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.212949 1.129070 0.674803 1.827152 3.228363 2.488690 0.502256 0.394039 0.651986 0.678969 0.324476
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 24.281968 0.258079 0.078216 -0.312220 3.496354 0.293024 2.115958 -0.429877 0.539749 0.681205 0.327251
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.528841 2.954308 1.282159 0.965769 0.314597 1.014812 0.357127 1.127035 0.650246 0.679202 0.333772
167 N15 digital_ok 100.00% 99.41% 99.51% 0.00% 238.119618 238.650643 inf inf 2117.854350 2176.734423 3908.192066 4083.634608 0.475759 0.447548 0.477745
168 N15 digital_ok 100.00% 99.68% 99.62% 0.00% 213.351663 213.046142 inf inf 1538.062533 1509.489357 3582.042524 3648.271173 0.576995 0.438867 0.496687
169 N15 digital_ok 100.00% 99.51% 99.46% 0.00% 201.604950 201.469402 inf inf 1905.554942 1893.710452 4116.816512 4103.787267 0.459175 0.439688 0.379297
170 N15 digital_ok 100.00% 99.30% 99.03% 0.05% 238.188733 238.627261 inf inf 2851.246431 2852.247693 6314.416167 6321.868662 0.472017 0.537702 0.404235
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.041127 -0.806236 0.494389 -0.033160 -0.785677 0.056184 -0.760183 -1.176247 0.563539 0.628289 0.352030
173 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.233725 6.337126 4.334353 4.242721 5.662744 6.057759 -0.350874 1.142534 0.549636 0.582219 0.352616
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.590717 -0.750501 0.208041 0.514038 0.321763 9.419709 -0.398470 0.704085 0.609385 0.653640 0.351796
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.236028 15.017837 -0.937023 12.290382 0.325774 7.506143 4.821786 3.760184 0.622928 0.067643 0.488354
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.303654 0.145555 1.444707 1.063234 0.185919 0.267528 0.218630 1.361375 0.635553 0.666060 0.338692
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.075512 14.086173 -0.062084 11.861929 -0.418557 7.628826 1.717608 3.169022 0.645072 0.061203 0.463025
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.618638 1.174799 0.147324 0.698797 1.291922 0.010697 -0.288680 -0.255255 0.639755 0.669380 0.321997
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 20.109147 -0.454239 7.355611 -0.680296 7.459708 0.731206 4.462382 -0.772533 0.509895 0.678754 0.343663
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.354712 -0.361086 -0.721767 -0.012111 -0.503685 -0.146482 -1.038026 -0.432736 0.651446 0.673378 0.329940
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.676680 -0.672301 0.640110 -0.028615 -0.805437 -0.544489 -1.162771 -0.961317 0.646220 0.676538 0.338070
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.149169 1.596550 -0.984972 0.558803 5.725660 0.756160 3.046033 0.528458 0.637638 0.671239 0.342506
189 N15 digital_ok 100.00% 99.30% 99.30% 0.00% nan nan inf inf nan nan nan nan 0.482302 0.496888 0.425473
190 N15 digital_ok 100.00% 99.41% 99.35% 0.00% 195.946485 196.086568 inf inf 2375.954322 2389.378731 4141.206652 4214.563093 0.569093 0.498191 0.470179
191 N15 digital_ok 100.00% 99.35% 99.57% 0.00% 162.085860 162.096188 inf inf 1889.954714 1857.162583 3901.916418 3647.435280 0.591278 0.482268 0.506892
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 2.570467 6.751087 2.751993 4.409877 3.088065 6.175647 -0.372928 0.975797 0.581065 0.579554 0.351477
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.822617 5.854207 4.622084 4.130358 5.661917 5.823246 -0.081922 0.775473 0.542822 0.586522 0.350591
200 N18 RF_maintenance 100.00% 100.00% 18.69% 0.00% 12.848209 37.481896 5.718139 0.321191 6.921551 2.331593 2.483168 4.315749 0.051599 0.252901 0.157675
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.191368 4.982000 2.976047 3.822606 2.674152 5.130380 -0.575116 0.553796 0.600335 0.622937 0.341555
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.967442 0.595421 1.606461 -0.444378 1.174880 0.570914 -0.622531 16.044770 0.620454 0.633927 0.328281
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.121906 12.862714 1.708869 -0.632392 -0.363162 0.190560 6.403506 -0.134969 0.642103 0.668641 0.330235
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 5.964130 -1.102889 3.176913 -1.073590 2.522814 -0.093796 4.509552 0.998454 0.509187 0.647273 0.375534
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.296884 5.151933 -0.194834 3.423454 7.114914 1.597175 -0.771520 -0.351087 0.601761 0.560741 0.321711
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.717573 1.511365 -0.550421 -0.350971 -1.019620 -0.505077 1.064027 -0.989568 0.612652 0.630207 0.325319
208 N20 dish_maintenance 100.00% 99.46% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.392248 0.418302 0.398181
209 N20 dish_maintenance 100.00% 99.62% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.274932 0.433812 0.360206
210 N20 dish_maintenance 100.00% 99.57% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.300094 0.494362 0.340829
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% 0.258398 14.869181 -1.019954 6.388066 -1.007653 7.481083 -0.671157 2.815421 0.581675 0.049902 0.481058
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.864805 -0.615382 0.555819 -0.190372 -0.393807 -0.450967 0.682699 -1.225982 0.610490 0.630062 0.333294
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.627804 -0.266616 -0.915780 -0.527365 2.195496 -0.971317 0.332342 -1.346130 0.606114 0.636002 0.332345
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.183098 -0.032232 -0.010132 0.295629 -0.858868 -0.271744 0.297177 -1.369914 0.611437 0.637580 0.328832
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.415088 -0.767087 -0.767149 -0.111087 -1.054431 -0.370186 -0.608271 1.234951 0.609210 0.638811 0.330379
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.119158 6.116054 4.786499 4.281672 5.912317 5.887112 0.092504 0.895252 0.557750 0.609531 0.344067
225 N19 RF_ok 100.00% 0.00% 50.73% 0.00% -0.268284 14.247566 0.849524 6.118976 -0.867370 7.288408 -1.491026 2.667300 0.618827 0.195210 0.475647
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.488761 19.261620 -0.363739 0.557086 -1.196533 3.066640 -1.290288 0.040860 0.609870 0.532380 0.305637
227 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 3.861833 0.020428 2.801943 -0.233843 0.166530 0.151425 2.649614 1.346364 0.521831 0.618030 0.359665
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.391486 -0.102866 1.019018 -1.000272 0.324540 -0.979031 -0.768706 -0.434829 0.594866 0.615102 0.331839
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.597130 0.918143 0.962753 1.460585 0.109836 1.345391 -1.593642 -1.351234 0.593179 0.614896 0.345335
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.759430 -0.530176 0.749257 -1.025892 -0.832549 -0.615070 -0.543621 -1.227019 0.559029 0.610485 0.343515
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.166906 -0.206763 0.975878 0.610490 -0.166993 -0.974826 -1.406914 -1.489742 0.602788 0.620429 0.339569
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.808850 -0.771409 0.053387 -0.041066 -0.018086 -0.948108 -0.884418 0.196948 0.605419 0.624030 0.335886
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.876490 0.046101 0.954733 -0.734399 -0.804947 -1.272757 1.861982 1.061262 0.575021 0.626022 0.345280
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.291631 -0.765722 -0.172321 0.323637 -1.302992 -0.380180 -0.696984 -1.266705 0.609558 0.628547 0.341012
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 19.122999 1.402722 0.325440 1.691542 2.086749 1.811111 -0.584887 -0.629950 0.484238 0.622300 0.329034
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.608943 -1.046493 1.530061 -0.914782 4.149957 -0.580592 11.721532 -0.900529 0.560320 0.617460 0.338914
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.009328 -0.998352 -0.217904 -0.901743 -1.142273 -0.464573 0.286120 1.139092 0.578779 0.620354 0.335771
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.422659 0.313323 1.186294 -0.334742 0.184912 -1.021911 -1.552977 -1.105113 0.598212 0.613005 0.335673
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.307401 15.485418 -0.602551 5.863859 -0.838918 7.595117 -1.244918 2.307721 0.585632 0.049629 0.484698
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.484536 0.000564 0.084626 -0.078730 -0.885325 -0.922949 3.139022 0.389298 0.588047 0.603719 0.328947
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 11.540413 13.767822 0.417378 0.419727 0.911099 0.448311 0.014753 1.069886 0.610002 0.627181 0.342944
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.457415 1.396724 2.492545 1.392858 1.701784 0.848222 -0.554646 0.105876 0.514130 0.529719 0.324652
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 2.191621 3.129328 1.345963 1.654642 0.541928 1.675553 -0.388453 -0.978546 0.499365 0.522635 0.313768
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.313316 -0.643571 1.214973 -1.042634 0.558200 -1.120189 -1.148791 1.115489 0.537215 0.536503 0.317931
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.065928 0.332054 -0.423224 -0.793011 12.800045 -1.068881 4.323897 1.242556 0.468797 0.526165 0.327009
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.825911 3.866465 -0.303035 -0.824058 -0.941363 -0.846667 1.583223 0.740316 0.468248 0.531053 0.345584
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 5, 15, 16, 17, 18, 20, 27, 28, 32, 34, 36, 37, 40, 42, 45, 47, 51, 52, 54, 55, 58, 59, 60, 63, 65, 66, 68, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 92, 93, 94, 96, 97, 101, 103, 104, 108, 109, 110, 111, 112, 113, 114, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 131, 134, 136, 137, 140, 142, 143, 145, 147, 148, 149, 150, 151, 155, 156, 158, 159, 161, 165, 167, 168, 169, 170, 173, 179, 180, 182, 184, 187, 189, 190, 191, 192, 193, 200, 201, 202, 204, 205, 206, 208, 209, 210, 211, 224, 225, 226, 242, 243, 246, 262, 329]

unflagged_ants: [7, 8, 9, 10, 19, 21, 22, 29, 30, 31, 35, 38, 41, 43, 44, 46, 48, 49, 50, 53, 56, 57, 61, 62, 64, 67, 69, 73, 74, 85, 88, 89, 90, 91, 95, 102, 105, 106, 107, 115, 128, 132, 133, 135, 139, 141, 144, 146, 157, 160, 162, 163, 164, 166, 171, 181, 183, 185, 186, 207, 220, 221, 222, 223, 227, 228, 229, 237, 238, 239, 240, 241, 244, 245, 261, 320, 324, 325, 333]

golden_ants: [7, 9, 10, 19, 21, 29, 30, 31, 38, 41, 44, 53, 56, 67, 69, 85, 88, 91, 105, 106, 107, 128, 141, 144, 146, 157, 160, 162, 163, 164, 166, 171, 181, 183, 186]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2460021.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.5.dev13+gd6c757c
3.2.3.dev133+g7c00d5f
In [ ]: