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 = "2460065"
data_path = "/mnt/sn1/2460065"
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-30-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/2460065/zen.2460065.21270.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 1852 ant_metrics files matching glob /mnt/sn1/2460065/zen.2460065.?????.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/2460065/zen.2460065.?????.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 2460065
Date 4-30-2023
LST Range 9.091 -- 19.058 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1852
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, 112
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating N07
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 65 / 198 (32.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 117 / 198 (59.1%)
Redcal Done? ❌
Never Flagged Antennas 80 / 198 (40.4%)
A Priori Good Antennas Flagged 58 / 93 total a priori good antennas:
7, 15, 17, 19, 31, 37, 38, 40, 42, 53, 54,
55, 65, 66, 67, 70, 72, 81, 83, 86, 93, 94,
103, 109, 111, 112, 118, 121, 123, 124, 127,
136, 140, 147, 148, 149, 150, 151, 158, 160,
161, 162, 164, 165, 167, 168, 169, 170, 173,
181, 182, 184, 189, 190, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 45 / 105 total a priori bad antennas:
22, 35, 36, 43, 46, 48, 49, 50, 52, 57, 62,
64, 73, 74, 79, 80, 89, 90, 95, 115, 120, 125,
126, 133, 135, 139, 185, 206, 220, 221, 222,
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_2460065.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 100.00% 0.00% 0.00% 0.00% -1.235223 10.172150 -0.542973 -0.580215 -1.051686 0.861361 -1.037227 6.525923 0.585220 0.473057 0.387809
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.536798 2.065618 0.021404 3.344453 1.030580 3.108745 -0.511082 0.960058 0.594240 0.571371 0.390787
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.309956 -0.000611 -0.993566 -0.123371 -0.249132 0.441251 1.189773 11.084149 0.601036 0.589118 0.382604
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.057632 2.811969 2.216086 2.063631 2.590426 2.393504 -1.074582 -0.921469 0.576460 0.566308 0.370590
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.948558 -0.779195 3.005386 -0.728055 2.773289 -0.123818 2.814890 -0.530002 0.580882 0.587850 0.383422
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.036592 -0.697770 0.285310 -0.962883 -0.251907 -0.375846 -1.074515 0.226663 0.586093 0.573447 0.378746
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 11.850861 -0.350528 -0.469271 -0.406446 0.452913 0.296088 0.093906 1.962769 0.482586 0.588602 0.373129
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 1.043289 2.408324 1.105492 1.753953 1.004777 1.904556 -1.249723 -1.598478 0.595964 0.578661 0.384482
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.096794 2.735972 0.539788 10.021580 1.627361 0.099286 -0.058443 4.621818 0.607873 0.466393 0.430024
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.245597 4.735751 0.570724 1.684791 0.905944 0.289847 6.743970 19.083671 0.587445 0.394405 0.440677
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.904681 1.828848 -0.743628 4.057528 -0.022357 2.804105 -0.195594 11.286964 0.613233 0.594876 0.380286
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.443853 -1.350032 1.675102 -0.735314 2.296428 -0.173004 1.826611 -0.250889 0.601746 0.605933 0.380746
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.043215 -0.105897 -0.460702 0.018595 0.227566 0.975756 0.603049 0.338451 0.600777 0.595442 0.379866
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.091311 -0.866989 -1.113376 -1.053340 -0.399032 -0.126869 -0.441777 -0.494970 0.566591 0.566016 0.380097
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.738294 17.268964 11.501621 7.278478 4.122831 2.410067 7.683069 49.661164 0.064474 0.060702 -0.037545
28 N01 RF_maintenance 100.00% 100.00% 10.96% 0.00% 6.803602 11.252518 11.766615 4.754493 4.598055 0.606323 1.609194 18.684496 0.028984 0.296411 0.233715
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.346338 -0.257638 -0.609188 -0.223136 0.325605 0.849508 1.121982 1.895954 0.624721 0.615074 0.383413
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.217932 -1.164498 -0.305363 -1.028466 0.704607 -0.507481 0.386798 -0.286375 0.624418 0.620866 0.380772
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.372022 1.494603 0.747146 3.081887 2.006249 2.364197 0.576687 22.927340 0.630245 0.612924 0.379068
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 13.181875 12.843876 -0.329481 -0.320255 -0.583024 -0.445543 1.212626 3.137399 0.525083 0.538856 0.221354
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.817846 0.219366 6.652779 -0.239469 4.561767 -0.663151 1.266511 -0.020509 0.039140 0.584669 0.427294
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.425513 -0.907098 0.408036 -0.877588 0.069013 -0.533700 -1.369651 -0.113642 0.582362 0.571636 0.380320
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.029189 3.024707 0.683063 0.568383 1.732819 1.641172 0.151586 0.862036 0.576209 0.555878 0.393423
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.235736 15.164561 -0.134194 14.564608 -0.804098 4.285064 -0.784030 3.388099 0.588449 0.030714 0.476261
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.455423 -0.450963 -0.493626 0.310225 0.083085 0.707666 4.225758 10.839437 0.593793 0.581054 0.386987
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.019652 0.446685 -0.152873 -0.682924 0.217939 0.374037 33.028328 1.152971 0.238111 0.231230 -0.298671
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.661986 1.692717 0.917655 2.204183 1.872831 1.703425 0.009135 0.551861 0.619686 0.612833 0.381751
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.851595 0.524192 -0.710544 -1.050656 -0.025173 0.366529 0.155536 2.008847 0.260995 0.248482 -0.297419
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.934700 0.311235 -0.477777 0.641648 -1.147524 1.251671 -0.908007 0.803243 0.634196 0.628026 0.378393
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.322166 0.532113 -1.146256 0.299277 -0.696978 0.890021 -0.591864 0.097668 0.636235 0.635037 0.381786
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.469684 1.176929 0.511241 0.455006 1.215108 1.369871 0.754820 2.838443 0.627557 0.622093 0.380408
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.718893 -0.993233 -0.280460 -0.956029 0.439307 -0.794840 0.601064 0.185568 0.621383 0.626214 0.391194
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 7.234956 8.944363 6.557343 6.674273 4.564062 4.229259 2.776819 1.470092 0.030908 0.049957 0.013752
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.200768 0.877422 -0.375052 0.705222 -0.889495 0.686097 -1.026449 -1.375863 0.586307 0.585272 0.378363
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.816817 0.207156 -0.324113 -0.122819 -0.514161 -0.555695 -0.191218 0.783059 0.560976 0.568106 0.381801
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.052568 0.531061 0.104471 1.392342 1.003101 2.329844 0.312303 0.663244 0.576811 0.554396 0.391763
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.014108 0.090946 -0.588222 -0.442379 0.243258 0.254667 100.126920 0.701285 0.582349 0.573465 0.388662
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.779030 1.977970 0.173066 0.056425 1.370176 1.015627 2.834699 0.714788 0.606777 0.588706 0.388700
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.492730 0.399413 -0.531300 -0.409703 0.877987 -0.827487 6.775612 5.971999 0.616508 0.603206 0.389086
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.456485 2.398252 1.750643 -0.396880 3.031236 1.453231 -0.843650 -0.003011 0.317836 0.373393 0.175796
55 N04 digital_ok 100.00% 17.82% 100.00% 0.00% 1.090289 32.502767 0.648372 8.719451 0.446613 4.472277 2.131253 1.496480 0.258274 0.038826 0.094101
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.620501 3.807682 -0.690323 2.016748 -1.056303 2.446851 -0.632841 2.681173 0.635417 0.613100 0.367701
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.747032 0.725533 -0.335554 -0.766911 -0.884921 -0.020818 0.594662 2.045856 0.641158 0.628348 0.372511
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.591114 8.363835 11.785625 12.507155 4.561022 4.243735 3.102996 3.188641 0.034992 0.034994 0.002429
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 7.081142 0.797341 11.307989 0.384286 4.523795 1.379435 1.470070 12.434337 0.047879 0.630574 0.477540
60 N05 RF_maintenance 100.00% 0.00% 91.31% 0.00% 0.971148 8.244826 -0.233680 12.538291 0.207358 4.187215 1.045489 3.644043 0.615633 0.095927 0.496186
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.723610 -0.812200 6.277383 -0.816814 4.554134 -0.815495 0.740239 0.618146 0.033348 0.596525 0.422984
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.480090 1.226783 0.059338 0.580476 -0.505789 0.314315 1.500390 -0.973488 0.572008 0.590430 0.380758
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.223665 8.530785 -0.619609 7.104104 -0.974063 4.268436 0.534056 4.181525 0.591164 0.041608 0.467551
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.332856 -0.643156 -0.956779 -0.324403 -1.183041 -0.496407 -0.345961 0.437620 0.574312 0.559745 0.373999
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 16.056194 15.126076 14.887673 15.012040 4.623207 4.318589 4.394128 5.730575 0.023360 0.029250 0.006524
66 N03 digital_ok 100.00% 29.37% 100.00% 0.00% 2.639938 15.629054 1.812371 15.170225 2.126359 4.218896 -1.438566 5.647968 0.210612 0.047182 0.093818
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.974515 0.292903 -0.647532 1.320768 -0.092159 1.783679 4.291961 1.962524 0.606420 0.590644 0.386062
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 17.021212 -0.450066 14.941257 -0.675816 4.564973 -1.132141 5.029244 -0.065463 0.029473 0.607059 0.474893
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.148984 2.549004 1.074524 -0.880448 1.698933 -0.040313 2.511250 1.980563 0.626446 0.617229 0.377771
70 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.094012 2.643176 0.909732 2.582645 1.203653 3.050195 4.213712 1.553599 0.267037 0.246388 -0.289799
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.579094 0.000119 -0.713336 0.202888 0.043706 0.843877 -0.301264 1.166847 0.645503 0.639179 0.376494
72 N04 digital_ok 100.00% 10.69% 91.36% 8.64% 0.773964 8.582279 2.007346 12.666851 2.207551 3.790935 12.411287 2.703804 0.284659 0.082687 0.004077
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.868815 1.369341 -1.131252 1.059233 -0.236186 2.603377 0.294735 3.343392 0.648074 0.641284 0.379992
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.444962 -0.913352 0.183329 -0.924203 -0.415677 -0.056163 -0.849719 1.096618 0.638822 0.639967 0.382220
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 19.562709 7.101725 -0.061768 -0.677602 2.556453 0.166443 7.326632 0.162875 0.435145 0.514219 0.237537
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 13.305456 0.866745 -0.244645 0.699134 0.561292 0.452697 0.476104 -0.672139 0.456434 0.593317 0.353169
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.741546 -0.803796 0.410371 -1.158991 0.061123 -0.979353 2.490373 0.000324 0.567435 0.578598 0.380869
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.026663 2.296462 -0.067927 1.805927 -0.587827 2.138897 -1.250121 -1.599541 0.580662 0.559230 0.386848
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 111.096599 25.895697 41.269602 25.230855 13.019829 4.726030 814.905573 241.886068 0.017427 0.016462 0.001294
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 27.489840 35.168284 28.427800 32.746294 6.770564 7.800580 491.605948 748.489721 0.016623 0.016141 0.000820
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 20.971481 32.156669 24.617112 24.932308 4.439106 4.842923 374.252607 335.561820 0.016568 0.016465 0.000743
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.124296 17.372623 1.424722 15.235186 1.317520 4.064975 -1.584378 4.503643 0.606846 0.047808 0.462078
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.471343 -0.529033 0.011249 -1.127946 -0.450288 -0.506794 -1.216149 1.302375 0.625380 0.618644 0.378532
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.028808 -0.109214 0.460096 -0.144394 0.755326 0.558079 -0.005030 9.217024 0.634900 0.625931 0.369288
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 19.754766 2.047050 3.022242 -0.412044 3.882606 -0.847896 108.516735 4.518229 0.523665 0.641929 0.345399
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.027757 0.562427 0.403380 1.230299 0.980174 1.395137 -0.116116 0.129481 0.643352 0.637364 0.369209
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.142900 0.366395 0.382187 0.939835 1.018256 1.497403 -0.437537 0.014942 0.645337 0.639016 0.375242
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.887951 -0.480621 -0.542772 -0.511284 0.119452 -1.078469 -0.039610 0.127317 0.639555 0.640422 0.380095
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.207573 0.172423 0.524919 0.445856 1.250429 1.077360 -0.215966 -0.095765 0.630529 0.634065 0.386319
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.918903 0.004520 11.817888 0.246741 4.589159 1.066008 0.617924 0.639618 0.032521 0.627197 0.435210
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 7.020858 8.519318 11.891515 12.590165 4.545433 4.228987 2.220663 2.156879 0.029089 0.025060 0.002205
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 7.402731 2.434943 12.011373 9.415628 4.556177 1.103495 1.893349 2.238722 0.027092 0.501725 0.344065
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.672519 0.052726 -0.628891 0.066137 -0.614233 -0.402896 0.670161 -1.009594 0.573483 0.587249 0.387165
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.245912 11.628943 0.887368 -0.534705 0.628603 0.320348 -1.366820 2.481179 0.585026 0.488152 0.360126
97 N11 not_connected 100.00% 99.95% 99.95% 0.00% 148.145303 148.253815 inf inf 1375.700892 1375.689812 8071.369040 8070.594295 0.202565 0.433307 0.250254
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 3.161275 3.368860 -0.240415 0.937761 0.620838 1.635504 -0.157134 0.474844 0.614315 0.601565 0.381444
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.737789 -0.050281 -0.509246 -1.028488 -0.926224 -0.447357 -0.971851 7.032584 0.629300 0.617784 0.377065
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.471430 1.867588 -0.150769 -0.923514 -0.770962 -0.079303 2.466845 14.337164 0.632482 0.627219 0.365184
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.672743 35.178954 1.392226 7.051608 1.581361 2.904554 2.395230 1.903631 0.634055 0.616472 0.364708
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.402320 0.249197 0.022399 0.983159 1.035701 1.497703 -0.033845 0.142537 0.644708 0.637872 0.367923
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.151847 -0.038764 -0.215465 0.037049 0.143808 0.535440 0.672837 0.030886 0.643373 0.641658 0.372656
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.273746 -0.701636 -0.565942 -0.983260 0.052884 -0.480212 0.724902 0.950109 0.640423 0.639465 0.375085
108 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.318333 2.456275 0.969702 2.280437 1.359094 2.484296 8.256525 0.501226 0.633168 0.634808 0.381360
109 N10 digital_ok 100.00% 91.14% 100.00% 0.00% 6.746572 8.409500 11.894698 12.319932 4.533565 4.269303 0.735740 1.937943 0.085681 0.034149 0.044268
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.620839 -0.293777 0.098831 -0.233232 -0.164853 0.355282 0.491663 -0.337845 0.529776 0.623828 0.350098
111 N10 digital_ok 100.00% 0.00% 94.49% 0.00% 8.957819 8.391859 0.972301 12.402024 1.173700 4.223238 28.729513 2.496034 0.547294 0.075319 0.408140
112 N10 digital_ok 100.00% 0.16% 0.16% 99.84% 0.422703 3.280737 1.143817 10.325254 1.459608 0.244877 1.132578 0.941050 0.232442 0.156478 -0.256369
113 N11 not_connected 100.00% 0.00% 0.00% 0.00% 4.144619 3.674549 2.856540 2.677413 3.468025 3.263074 -2.168344 -1.865608 0.566999 0.552059 0.378284
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 3.569881 2.748097 2.487869 3.911608 2.929108 0.294869 -1.590809 1.654389 0.555277 0.478131 0.374244
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.211644 -0.376502 -1.113029 -0.144910 -1.053341 -0.588114 -0.649269 -0.977774 0.557577 0.549607 0.382806
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 23.975192 32.999225 25.934352 29.338866 6.254896 7.284308 316.703179 456.478851 0.017375 0.016271 0.001270
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 22.249065 23.563891 26.867766 25.577593 12.116717 5.869269 468.900378 375.939883 0.016518 0.016389 0.000801
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.088656 0.143217 2.467044 -0.851013 2.574452 -0.011802 1.894828 -0.396883 0.615770 0.615953 0.379030
121 N08 digital_ok 100.00% 2.48% 0.00% 0.00% 2.652879 2.671459 1.947705 5.834580 2.201823 2.758611 0.774835 8.983558 0.561810 0.608241 0.368434
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.891312 2.370158 -0.733160 -1.013156 -0.633157 -0.538856 -0.506204 -0.742463 0.643781 0.634966 0.372142
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.798955 2.193700 2.621924 1.018545 3.190024 0.938402 -1.652436 -1.351342 0.620313 0.633888 0.374022
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 6.900148 -0.056035 12.039981 0.554373 4.534120 1.397059 1.167904 0.937895 0.039200 0.644481 0.438586
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.743702 0.183799 2.900659 1.155910 0.812686 1.197201 1.245007 0.273663 0.633218 0.636917 0.377174
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.025770 0.290874 0.065596 0.936873 0.461148 1.491612 1.372751 0.082246 0.640661 0.636556 0.382243
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 6.784153 -0.967009 11.818427 -0.537799 4.588312 -0.702545 0.587754 -0.481205 0.032829 0.632161 0.433574
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.684462 -0.347947 -0.955535 -0.211915 -0.186720 -0.819603 1.035149 2.029709 0.625897 0.622309 0.394984
131 N11 not_connected 100.00% 0.00% 43.09% 0.00% -0.327621 7.927614 -0.223533 6.855328 -0.740573 3.128415 -1.133996 0.797906 0.589932 0.262021 0.437810
132 N11 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.631965 -0.761026 -1.132968 -0.616302 -1.085281 -1.130169 -0.379817 -0.147989 0.563829 0.556970 0.384331
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 130.703370 130.764407 inf inf 1099.693255 1099.852253 5461.222565 5396.835031 nan nan nan
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.550547 -1.209119 -1.037548 -1.073434 -0.286826 -0.505249 -0.000324 -0.229330 0.553872 0.546671 0.393182
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 6.443337 0.134858 11.532754 -0.367081 4.590812 0.131120 1.308182 0.921083 0.035188 0.548988 0.398360
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 20.333706 33.592124 25.146365 24.542660 4.790113 4.254082 417.902290 286.236633 0.016536 0.016459 0.000731
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.309831 -0.250484 0.792483 -1.070653 0.583550 -1.160411 -1.389372 0.771524 0.598236 0.588057 0.370690
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.499170 -1.079993 -0.279252 -0.613976 1.463581 -1.007086 21.706802 3.786399 0.618812 0.617830 0.372355
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.645975 0.031973 -0.285238 0.047496 0.424269 -0.337406 -0.270714 -1.169626 0.630364 0.622307 0.371760
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.492382 8.392727 -0.803541 12.557567 0.316856 4.244143 15.544494 2.270260 0.637367 0.041602 0.519383
143 N14 RF_maintenance 100.00% 91.36% 100.00% 0.00% 7.255383 8.352655 11.621773 12.518934 4.290010 4.236483 0.731883 1.906769 0.120672 0.030657 0.077664
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.145267 -0.510365 -0.850586 0.115808 -0.056384 0.082070 -0.646619 -0.895852 0.646763 0.638794 0.379070
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.237919 0.777631 -0.273866 0.818764 0.396973 1.038769 -0.010803 1.206141 0.641647 0.633142 0.374465
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.589044 -0.829862 -1.093080 -0.869207 -1.257345 -1.254772 -0.585361 -0.444272 0.617827 0.620179 0.381863
147 N15 digital_ok 100.00% 100.00% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.175662 0.247382 0.216296
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.063452 0.052738 0.020495
149 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 148.280416 148.306604 inf inf 1376.889098 1376.146196 6493.697999 6876.819996 0.176762 0.082506 0.118213
150 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 144.863122 144.791939 inf inf 1044.438062 1039.983379 5277.506454 5299.240050 nan nan nan
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 9.240181 -0.165110 -0.608595 0.937085 0.607694 0.539331 -0.495862 6.163152 0.480433 0.549615 0.339018
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.655753 -1.136282 11.692962 -0.594375 4.595750 0.089139 1.962469 0.440953 0.036113 0.551632 0.411595
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.781122 8.337573 7.720331 12.377897 0.366691 4.275623 5.740368 2.326733 0.492933 0.036203 0.389523
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.350562 0.421928 0.187034 0.725864 1.022839 1.534424 -0.279747 0.180313 0.578024 0.574943 0.387120
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -1.140858 -1.392360 -0.785561 -0.939793 -0.414692 -0.530596 3.068300 12.104711 0.595325 0.591592 0.388149
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.216989 10.700241 -0.290289 -0.291693 -0.764404 0.386030 -0.321373 1.788073 0.574325 0.482777 0.348575
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 7.229687 -0.957238 11.791289 -0.611843 4.567915 0.395288 0.810086 -0.235775 0.042856 0.613373 0.489436
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.083317 18.923139 0.084360 0.298534 1.076137 -0.444659 -0.248545 0.029986 0.624048 0.513520 0.343012
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.031244 -0.999762 0.013206 -0.811036 -0.664103 -0.683887 4.472234 -0.618277 0.633398 0.630162 0.377028
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.224898 0.707132 -0.011249 0.463084 0.904514 1.347343 -0.245238 0.749656 0.639939 0.636352 0.379494
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 1.162600 1.137325 1.590896 1.008182 1.376411 1.983318 8.941149 1.546212 0.635841 0.632529 0.372727
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 11.343806 -0.511644 0.362126 -0.517803 0.167685 0.164957 2.006437 -0.204895 0.540002 0.632444 0.351591
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.144228 -0.025957 0.714084 0.273823 1.460395 -0.284002 0.093073 -1.238922 0.631065 0.624900 0.373419
167 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.031404 0.144112 0.061799
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 nan nan nan
170 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.455691 -0.803484 0.211045 -0.761350 -0.476821 -1.073974 -0.233956 -0.196616 0.555699 0.563361 0.386106
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.178372 1.236192 2.216123 0.740512 2.586557 0.399285 -2.146851 -0.576202 0.564626 0.552181 0.382622
173 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 4.188424 3.855613 2.881088 2.737498 3.590616 3.384925 -2.416221 -1.643310 0.533455 0.511218 0.370364
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.288609 0.035380 0.138797 0.369248 0.140928 0.747117 -0.242602 8.237878 0.596916 0.591522 0.390883
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.489862 8.802560 -1.135212 12.654896 -0.364837 4.221064 15.431859 2.283487 0.609017 0.048952 0.506933
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.497667 1.003341 1.258842 0.953089 1.386460 1.501758 -0.050575 4.473951 0.617379 0.613114 0.384990
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.456147 8.282205 -0.086694 12.297677 -0.839901 4.261141 2.381312 2.590628 0.627866 0.044507 0.479139
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.788768 0.923122 0.197631 0.843832 1.125641 1.358701 0.045572 0.372173 0.631530 0.620155 0.369768
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 8.224185 -0.401001 9.906898 -0.194752 2.719902 0.081446 2.773217 -0.127930 0.396287 0.628183 0.404258
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.508100 -0.336024 -0.905306 -0.165562 -0.837626 0.336509 -0.299308 0.212420 0.636400 0.627354 0.378710
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.220763 -0.900558 0.126534 -0.640759 -0.313309 -0.855880 -1.016297 -0.738369 0.630269 0.623768 0.376753
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.256636 0.003380 -0.665919 -0.060803 0.333024 -0.643099 1.806587 -0.817960 0.622790 0.613654 0.381833
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
190 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 136.756918 136.987388 inf inf 1087.306008 1084.895430 5444.519142 5429.969862 nan nan nan
191 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 136.141763 136.123470 inf inf 913.616010 922.423751 5800.844194 5908.585201 nan nan nan
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 3.657775 4.138329 2.612924 2.931916 3.119570 3.571278 -2.178290 -2.121427 0.548738 0.518140 0.371931
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 4.531777 3.652779 3.123802 2.670662 3.818593 3.299626 -2.440845 -2.220791 0.530033 0.511501 0.368498
200 N18 RF_maintenance 100.00% 100.00% 20.79% 0.00% 7.809061 21.484592 6.491005 0.434045 4.588591 2.583150 1.476089 7.094999 0.039174 0.240795 0.163344
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.430911 3.262864 1.787164 2.474443 2.208481 2.967923 -1.501110 -2.137368 0.596894 0.571658 0.381894
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 1.142731 -0.301754 0.820330 -0.766172 0.720421 -0.300493 -1.408566 37.510082 0.609675 0.594908 0.372493
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.684803 6.153610 1.420069 -0.818779 1.782915 -0.129227 14.462980 0.601738 0.622437 0.615465 0.375185
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.821611 -0.912467 4.506699 -1.086473 1.507052 -0.858016 2.028450 8.935961 0.424130 0.605417 0.427139
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.859884 2.308007 1.440579 3.410568 -0.265199 0.069523 0.003794 0.943922 0.559094 0.516629 0.352955
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.184684 -0.857854 -0.818372 -0.824373 -0.937476 -0.946247 4.727265 -0.721214 0.581525 0.591739 0.377436
208 N20 dish_maintenance 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.131135 0.150477 0.045882
209 N20 dish_maintenance 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.213603 0.416883 0.254939
210 N20 dish_maintenance 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.270180 0.306146 0.223274
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% -0.716530 8.667968 -1.147302 7.082956 -0.852380 4.220342 -0.100015 1.333684 0.563838 0.036757 0.475172
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.000119 -0.676462 0.078387 -0.900130 -0.341497 -0.866916 -0.023039 -0.676145 0.599396 0.582156 0.377903
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.575732 -0.506308 -0.850718 -0.847301 -0.969050 -1.247332 2.718558 -0.585942 0.597447 0.591558 0.376904
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.076851 0.013950 -0.237256 -0.207242 -0.759304 -0.662885 2.802336 -0.958345 0.601957 0.597165 0.377221
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.126978 0.379062 -0.766400 1.564165 -0.893759 0.182389 -0.306768 14.552413 0.597601 0.561632 0.377002
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.742908 3.837722 3.292876 2.822877 4.029694 3.428261 -2.454207 -2.002765 0.567907 0.559463 0.368553
225 N19 RF_ok 100.00% 0.00% 75.05% 0.00% 0.681738 8.118451 0.450064 6.819542 -0.122231 3.879664 -1.347857 1.913560 0.599015 0.180370 0.495066
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.595334 8.997961 -0.652678 -0.192576 -1.178243 0.993893 -0.903539 -0.568816 0.591771 0.496178 0.365934
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.366701 -0.457624 2.331794 -0.943273 -0.086731 -1.027678 13.136000 6.040619 0.520303 0.561992 0.387961
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.785692 -0.604309 0.404887 -1.004718 0.019110 -0.802937 0.099845 0.376606 0.573807 0.553440 0.374061
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.822317 0.869928 0.368881 0.699607 -0.013806 0.401827 -0.933181 -1.514016 0.566968 0.548463 0.386711
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.751365 -0.959109 0.255811 -1.152186 -0.213611 -0.770492 1.983828 -0.640317 0.551857 0.565957 0.389342
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.632304 0.099488 0.511114 0.262582 0.120717 -0.268357 -1.352810 -1.342575 0.590803 0.577051 0.386685
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.166582 0.281389 -0.136108 0.024902 -0.240645 -0.280935 -0.865277 0.318694 0.591624 0.577971 0.383236
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.033810 -0.394517 0.916824 -0.966163 0.011802 -1.169048 2.519956 0.910866 0.558293 0.580163 0.390428
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.585304 -0.558635 -0.415378 -0.265310 -0.998595 -0.645895 -0.114985 -1.067576 0.592538 0.580448 0.387954
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 8.431248 0.748566 -0.514977 0.496559 0.605796 0.269460 0.173026 -1.052551 0.474148 0.573415 0.363993
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.175990 -0.989550 0.660070 -1.108244 1.300577 -0.800256 3.214996 -0.386855 0.518651 0.565340 0.372253
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.822042 -0.206653 -0.304139 -0.022928 -0.394762 -0.236502 1.490556 2.780151 0.563848 0.557089 0.373325
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.803884 -0.464827 0.582200 -0.721323 0.334858 -1.228263 -1.597765 0.307870 0.574636 0.555389 0.380798
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.191093 9.043642 -0.680502 6.633212 -1.049511 4.251368 -0.615001 0.749099 0.558957 0.036410 0.469938
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.230428 -0.121179 0.025326 -0.465982 -0.505703 -0.995394 3.017443 -0.842702 0.564292 0.544768 0.379729
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.157195 6.883687 -0.136229 0.301968 1.001293 0.989090 -0.325731 1.142918 0.570071 0.549568 0.393882
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.746284 1.127668 1.693577 0.691412 1.718020 0.532270 -1.792036 -0.036212 0.459000 0.420461 0.348166
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.948805 2.035558 0.740182 0.794858 0.478004 0.708941 -1.133526 -1.129054 0.450425 0.413709 0.337513
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.216732 -0.977708 0.615754 -0.967074 0.245557 -0.810976 -1.550957 -0.256978 0.487754 0.452051 0.365017
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 7.667808 8.626804 6.387382 7.239019 4.530148 4.206204 1.077384 1.094814 0.037879 0.036489 0.001970
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.005056 0.321742 -0.558569 -0.999935 -0.378099 -0.556205 2.120130 -0.122802 0.436038 0.410814 0.329695
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 7, 8, 15, 17, 18, 19, 27, 28, 31, 32, 34, 37, 38, 40, 42, 47, 51, 53, 54, 55, 58, 59, 60, 61, 63, 65, 66, 67, 68, 70, 72, 77, 78, 81, 82, 83, 84, 86, 87, 92, 93, 94, 96, 97, 102, 103, 104, 108, 109, 110, 111, 112, 113, 114, 117, 118, 121, 123, 124, 127, 131, 132, 134, 136, 137, 140, 142, 143, 147, 148, 149, 150, 151, 155, 156, 158, 159, 160, 161, 162, 164, 165, 167, 168, 169, 170, 173, 179, 180, 181, 182, 184, 189, 190, 191, 192, 193, 200, 201, 202, 204, 205, 207, 208, 209, 210, 211, 223, 224, 225, 226, 227, 242, 243, 246, 262, 329]

unflagged_ants: [5, 9, 10, 16, 20, 21, 22, 29, 30, 35, 36, 41, 43, 44, 45, 46, 48, 49, 50, 52, 56, 57, 62, 64, 69, 71, 73, 74, 79, 80, 85, 88, 89, 90, 91, 95, 101, 105, 106, 107, 115, 120, 122, 125, 126, 128, 133, 135, 139, 141, 144, 145, 146, 157, 163, 166, 171, 172, 183, 185, 186, 187, 206, 220, 221, 222, 228, 229, 237, 238, 239, 240, 241, 244, 245, 261, 320, 324, 325, 333]

golden_ants: [5, 9, 10, 16, 20, 21, 29, 30, 41, 44, 45, 56, 69, 71, 85, 88, 91, 101, 105, 106, 107, 122, 128, 141, 144, 145, 146, 157, 163, 166, 171, 172, 183, 186, 187]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2460065.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 [ ]: