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 = "2459883"
data_path = "/mnt/sn1/2459883"
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: 10-30-2022
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

# find the auto_metrics file
glob_str = os.path.join(data_path, f'zen.{JD}*.auto_metrics.h5')
auto_metrics_file = sorted(glob.glob(glob_str))

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2459883/zen.2459883.25268.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 1850 ant_metrics files matching glob /mnt/sn1/2459883/zen.2459883.?????.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/2459883/zen.2459883.?????.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 2459883
Date 10-30-2022
LST Range 22.094 -- 8.050 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 7
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 96
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (0.0%)
Cross-Polarized Antennas 95
Total Number of Nodes 18
Nodes Registering 0s N20
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 79 / 201 (39.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 180 / 201 (89.6%)
Redcal Done? ❌
Never Flagged Antennas 21 / 201 (10.4%)
A Priori Good Antennas Flagged 79 / 96 total a priori good antennas:
3, 7, 10, 15, 16, 17, 19, 20, 21, 29, 30, 31,
37, 38, 44, 45, 51, 53, 54, 55, 56, 59, 66,
67, 68, 70, 71, 72, 81, 83, 84, 85, 86, 88,
93, 94, 98, 101, 103, 106, 107, 108, 109, 111,
117, 118, 121, 122, 123, 127, 128, 130, 136,
140, 141, 142, 143, 144, 146, 147, 158, 160,
161, 162, 164, 165, 167, 169, 170, 181, 183,
184, 185, 186, 187, 189, 190, 191, 202
A Priori Bad Antennas Not Flagged 4 / 105 total a priori bad antennas:
89, 125, 137, 168
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_2459883.csv

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 14.605373 -0.640479 55.840562 -0.587069 7.861867 -0.607788 3.150492 5.955850 0.032653 0.675937 0.536035
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.087091 4.507916 2.580115 -0.128212 -0.931852 -0.153408 6.822437 1.976692 0.681594 0.672545 0.391879
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.049593 0.020730 -0.554575 2.670383 -0.478366 0.887348 1.964189 -0.855308 0.687516 0.680309 0.388087
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.801088 -1.673645 0.156609 0.712016 -0.299258 0.032099 14.395313 26.796437 0.682534 0.680619 0.385425
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.628333 -0.621690 0.793692 0.656117 -0.814475 -0.492928 13.254660 3.801362 0.672936 0.670824 0.376173
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.055431 -1.170207 0.537658 0.199196 0.215007 -0.727827 -0.641492 0.405087 0.675106 0.673307 0.385759
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.469049 -0.516562 5.390809 6.901150 1.998849 2.700351 0.611366 0.144539 0.666051 0.670982 0.394807
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.871680 0.793419 1.446864 -0.495697 -0.471164 0.293935 19.355507 23.543360 0.682524 0.683743 0.390380
16 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.241938 -0.011321 0.622621 -0.758298 0.385879 1.110448 10.951229 9.271589 0.685977 0.685700 0.383452
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.197431 1.542525 -0.374789 0.806047 -0.141084 -0.084886 17.289607 9.104354 0.688606 0.689316 0.380830
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.662564 14.708253 1.123216 1.256069 0.570918 5.155241 42.626308 63.817273 0.672701 0.468056 0.470043
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 1.136199 0.344528 -0.623073 20.298176 3.772309 29.892707 22.339980 41.873487 0.682127 0.661442 0.389087
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.108423 3.804792 0.208141 16.986407 0.062342 1.695766 10.985401 -1.271793 0.683373 0.678805 0.379185
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 1.066670 1.384113 0.008987 9.360662 0.353047 7.052737 0.933077 65.276795 0.672779 0.662306 0.384397
22 N06 not_connected 100.00% 0.00% 0.00% 0.00% 40.044877 13.085789 5.461548 16.024171 6.273850 6.541873 59.611506 81.061556 0.465993 0.613707 0.312757
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 14.649496 16.076763 56.036657 56.429273 7.912839 10.770802 7.081630 5.852039 0.033281 0.037733 0.004780
28 N01 RF_maintenance 100.00% 0.00% 85.08% 0.00% 17.843598 34.817369 6.511683 4.338571 6.609982 12.982068 11.487648 40.254247 0.364201 0.168873 0.256298
29 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -1.633768 -0.057531 -0.582739 -0.359804 -0.699147 -1.013115 -0.187428 8.451866 0.691863 0.686784 0.377478
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.094810 -0.922156 3.927201 -0.943522 1.752881 -0.606525 6.829968 0.439286 0.692231 0.692953 0.374584
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.338484 1.719288 1.158476 -0.206353 -0.182063 1.834010 9.627846 9.503478 0.700931 0.690405 0.382629
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.875420 24.219624 4.709367 4.094995 12.726181 9.668104 47.750258 347.968139 0.612987 0.619034 0.295189
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 16.705406 3.708056 24.180078 18.836968 7.897980 4.294846 4.857804 -0.132773 0.044388 0.664605 0.498092
35 N06 not_connected 100.00% 0.00% 0.00% 0.00% 6.670125 1.527294 39.968892 11.926943 5.183122 2.159771 -5.162022 1.841839 0.651462 0.646836 0.386834
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 187.044850 183.775046 inf inf 3779.147529 3792.048149 16671.056045 16776.787258 nan nan nan
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.052672 0.867569 2.356136 3.651189 1.280832 -0.395871 0.686460 25.705759 0.681045 0.683670 0.401486
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.320612 0.102368 -0.395816 -0.804797 0.508740 0.285495 13.893661 6.315129 0.686573 0.691248 0.399555
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.360647 0.647170 -0.691607 -0.750216 0.283745 -0.672938 -0.039792 0.748557 0.685048 0.686332 0.384143
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.204993 1.036797 2.761946 1.709592 1.267724 -0.810765 0.533493 3.698460 0.692912 0.687622 0.372096
42 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.331103 1.345690 -0.862610 1.407298 0.251478 -0.632886 1.718482 0.804189 0.702347 0.699272 0.381741
43 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 13.719711 3.342049 55.420476 -0.077199 7.961564 1.061273 8.716442 11.578164 0.043747 0.696986 0.491985
44 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 5.606302 2.925080 0.866227 3.837385 3.685446 0.545118 163.372792 67.440167 0.679709 0.693019 0.361936
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -1.017920 2.996950 -0.188426 -0.224858 0.623686 2.770445 2.650585 41.881184 0.692103 0.682795 0.372502
46 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.550290 16.698941 -0.903398 56.653327 -0.271594 10.800507 7.812245 10.803120 0.684864 0.039105 0.499077
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 15.903224 3.924818 23.127733 12.465893 7.898196 1.516048 5.416112 17.221430 0.038424 0.660372 0.477194
48 N06 not_connected 100.00% 0.00% 0.00% 0.00% 2.858980 3.400981 23.951384 28.302547 1.407092 2.801310 2.424550 -2.428771 0.658930 0.672823 0.392213
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 1.792445 2.412245 8.025853 24.901305 1.142124 2.567120 2.071465 0.682112 0.630475 0.659337 0.389662
50 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 124.674971 124.660818 inf inf 3812.816922 3842.955281 18102.772979 18166.961699 nan nan nan
51 N03 digital_ok 100.00% 100.00% 0.00% 0.00% 32.026652 1.747662 71.803967 1.447253 7.945550 3.001539 25.955340 26.374918 0.043851 0.685510 0.535913
52 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 109.726972 108.439130 inf inf 3372.737053 3396.578732 18086.462746 18040.417854 nan nan nan
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.367363 3.145735 0.169839 1.337061 -0.492909 0.287140 9.810283 16.119792 0.693219 0.697661 0.388584
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 14.661994 16.970920 56.040429 57.733077 7.942570 10.806572 8.166578 5.808057 0.049057 0.047911 0.001312
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.463859 17.862838 2.354075 57.204548 5.136735 10.740618 6.445453 8.253605 0.687904 0.035044 0.504877
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.990860 17.983596 0.826249 58.341292 0.717447 10.817291 4.204200 4.820944 0.697031 0.039685 0.522031
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 43.244900 1.284069 22.135053 -0.466694 4.200684 0.634242 12.288191 11.503764 0.535263 0.701013 0.366175
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 14.153126 16.767964 55.770752 57.478891 7.939934 10.876027 10.130486 9.337544 0.038321 0.034883 0.001981
59 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 22.920572 6.681369 5.081067 0.125683 4.372985 0.698494 315.948331 67.889835 0.643056 0.688041 0.363256
60 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 15.235482 16.400237 55.924029 57.352288 7.929593 10.826017 8.509442 10.789247 0.026983 0.027379 0.001441
61 N06 not_connected 100.00% 0.00% 0.00% 0.00% 4.910306 4.599212 5.033621 0.275820 2.083990 1.988058 1.308965 11.640848 0.646792 0.643229 0.369909
62 N06 not_connected 100.00% 0.00% 0.00% 0.00% 1.967371 3.565405 19.369450 27.195195 0.787661 4.027222 0.522335 -2.891785 0.667255 0.679175 0.382251
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 10.590086 16.942282 18.701032 24.199936 2.092523 10.753958 1.745561 8.380679 0.612697 0.044721 0.439384
64 N06 not_connected 100.00% 0.00% 0.00% 0.00% 2.822089 2.185585 12.052752 22.372634 0.849005 2.153188 4.719613 -0.490274 0.619787 0.646597 0.390802
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.865402 0.955558 1.416743 1.284010 1.768934 0.192827 -0.291096 2.197893 0.666363 0.679747 0.407780
66 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.417903 1.803518 9.987803 6.926447 2.589264 -0.133957 0.902012 6.762604 0.671653 0.682970 0.399257
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.840602 -0.387290 6.698847 3.201360 -0.229185 -0.309901 2.619890 7.344383 0.677319 0.687373 0.392718
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 2.660798 35.594964 1.650585 76.367120 -0.296395 10.435501 5.396345 24.416158 0.682741 0.032974 0.527486
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.336394 -0.480258 0.590168 -0.632451 1.124103 1.229358 -0.203109 0.298919 0.688732 0.698513 0.381176
70 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.929658 -0.034885 1.616162 2.389510 0.946705 0.705947 2.701940 9.416955 0.698329 0.704842 0.374544
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.853293 -0.146874 2.622310 2.244701 0.305542 0.232857 5.801839 5.574592 0.709315 0.704964 0.369219
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.514691 -0.205507 2.142413 2.160539 1.041258 0.406280 31.595633 7.471330 0.692937 0.699267 0.359805
73 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 13.585669 15.480005 55.095680 55.728057 7.984945 10.792965 11.407060 6.660789 0.026872 0.026927 0.001278
74 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 15.057849 13.693537 57.519669 55.167054 7.949208 9.651872 9.750422 74.355021 0.031007 0.343793 0.223706
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 29.656236 32.188265 19.902137 15.787181 3.978954 6.426273 21.295895 12.210745 0.549855 0.521998 0.184089
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 41.307264 1.148449 14.829655 19.573293 4.263958 1.239737 6.185125 1.933434 0.483707 0.661204 0.363375
79 N11 not_connected 100.00% 0.00% 0.00% 0.00% 4.241497 5.069555 34.674780 35.857744 3.434674 5.901816 -3.747497 -4.485112 0.654702 0.670075 0.389866
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 12.985946 18.372794 32.313557 23.477641 6.817766 10.796847 29.136829 4.431568 0.308893 0.039600 0.200916
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 235.294529 242.595366 inf inf 4873.722814 5856.782295 17659.614624 22596.301083 nan nan nan
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 234.591436 232.747994 inf inf 5469.965354 5435.877575 18418.885187 18238.757578 nan nan nan
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 219.074725 218.621755 inf inf 5097.218810 5067.189333 16910.159820 16599.540613 nan nan nan
84 N08 digital_ok 100.00% 0.00% 100.00% 0.00% 2.577755 31.666241 28.141700 73.852959 4.893830 10.333431 75.917806 13.330141 0.653274 0.039095 0.426532
85 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
86 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 13.502126 9.402997 5.333243 1.504173 20.118799 0.557112 10.886493 4.376816 0.627950 0.713691 0.344879
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.877508 0.128667 0.455976 1.479552 -0.799339 2.031719 16.974262 7.169365 0.693525 0.699084 0.357128
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.134951 -0.224561 -0.608046 0.307918 0.424903 -0.653157 -1.368402 -0.697593 0.699700 0.701218 0.365132
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.397766 0.065869 -0.188813 1.902849 -1.099706 -0.817031 1.487209 12.246462 0.696456 0.698030 0.363877
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.233036 -0.575582 0.005732 -0.005732 -0.850244 -0.614209 1.689951 -0.625276 0.692700 0.706530 0.379384
92 N10 RF_maintenance 100.00% 0.00% 9.73% 0.00% 49.018853 56.385728 6.559870 7.977210 6.761578 10.838003 3.316716 14.272207 0.298827 0.253580 0.088383
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 3.365370 0.332478 10.959690 0.266753 2.081507 -0.211262 8.368899 0.467231 0.679504 0.697402 0.384462
94 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -0.387736 0.616804 2.436294 0.311540 1.646517 1.361031 19.744238 15.602353 0.677672 0.682053 0.381115
95 N11 not_connected 100.00% 0.00% 0.00% 100.00% 6.611531 5.955657 39.892401 39.854328 4.886329 8.962299 -5.037797 -3.605181 0.272842 0.275858 -0.296722
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.082947 17.898514 23.068877 24.466636 7.855841 10.852847 3.691600 2.882901 0.033404 0.041984 0.005489
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.595798 5.176599 38.290567 2.659650 4.733698 0.275204 -5.384122 27.380236 0.637382 0.624734 0.389471
98 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 1.630621 7.094228 -0.491943 0.721953 0.086006 2.150301 2.043443 8.650940 0.646150 0.656773 0.390865
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 2.125375 -1.042473 0.467488 0.457881 -0.866932 3.429044 2.801343 -1.227450 0.650221 0.669827 0.392879
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.625490 -1.174969 -0.904582 2.038853 0.888503 -1.083267 0.039792 -0.198674 0.665684 0.677320 0.387860
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.488183 11.311021 2.222127 1.432521 -0.625050 0.364561 1.896148 2.197312 0.688841 0.695818 0.384038
102 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 297.504174 297.301268 inf inf 6709.086135 6706.577452 25758.922964 25602.285318 nan nan nan
103 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 30.757107 32.424398 64.128727 65.294059 7.927779 10.770082 22.612400 21.309930 0.026156 0.028702 0.002762
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.954448 75.988423 35.627450 38.039498 1.815610 6.532971 1.623763 9.452814 0.650018 0.674274 0.368173
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.341201 -0.528026 -0.855842 0.762350 -0.038472 -0.292668 -0.481489 -0.591369 0.699931 0.701796 0.357764
106 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.131370 0.549570 5.532245 2.325325 3.708503 1.191160 -0.161155 0.526763 0.688468 0.697553 0.360139
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 3.194070 1.702520 0.335601 1.206752 0.008043 0.353865 11.173835 12.684992 0.694057 0.698874 0.358734
108 N09 digital_ok 100.00% 67.95% 0.00% 0.00% 14.071172 3.285218 54.966543 0.891475 7.559343 -0.110751 5.131089 4.455191 0.191749 0.705034 0.482831
109 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.049451 16.578836 1.886434 55.733011 -0.219792 10.749869 3.773572 5.584676 0.693937 0.036767 0.464385
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.756585 33.691697 0.119150 74.713949 -0.506896 10.417426 4.839517 11.821285 0.700937 0.034745 0.468565
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.339879 16.402588 1.572508 56.330244 -0.437572 10.733268 12.588712 6.883325 0.684471 0.036324 0.458125
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.009719 -0.056068 -0.834542 2.146726 -0.609185 1.634835 0.764714 -0.703513 0.674179 0.690052 0.394614
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 17.077965 17.917969 21.829704 23.866031 7.856229 10.840297 5.681985 3.276008 0.038832 0.031400 0.004720
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 10.861089 6.488178 11.885134 37.924228 3.810179 6.647768 2.271415 -5.013536 0.492987 0.655577 0.431070
115 N11 not_connected 100.00% 0.00% 0.00% 0.00% 3.774452 9.732130 32.351938 30.617186 2.890542 5.773046 -4.075189 -0.545124 0.636919 0.606039 0.390107
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.804683 0.849409 -0.238839 -0.706354 -0.431216 0.676044 -0.318058 -0.564649 0.641829 0.659711 0.392363
117 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 15.859855 18.416887 56.225293 59.132535 7.859202 10.775550 4.209879 10.045477 0.027206 0.031615 0.002742
118 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 0.016882 1.326828 -0.280056 1.056335 1.224689 2.520875 7.637849 9.760443 0.666572 0.684476 0.387517
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.978096 3.604126 3.812737 22.019057 -0.845065 9.094905 1.818839 6.378999 0.681485 0.648563 0.383095
120 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 21.072571 31.842248 26.851507 73.421033 6.612445 10.594949 -1.267809 22.754401 0.347052 0.040946 0.216404
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.871678 6.205254 -0.013962 0.854132 -0.169067 -0.538704 94.359549 44.047756 0.693625 0.704666 0.379126
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.719083 8.832202 9.083839 0.701133 28.135449 -0.480438 6.870937 -0.683273 0.698587 0.709283 0.376114
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.765309 11.081704 1.234039 1.686485 -0.900665 -0.737980 -0.261040 2.309908 0.706184 0.711167 0.367863
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.767047 1.227297 -0.256279 -0.584992 0.038472 -0.782696 1.445149 1.389919 0.706052 0.709271 0.365736
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.590686 0.973212 -0.593994 0.541679 -0.062215 0.998550 -0.165788 1.315000 0.694166 0.699783 0.362257
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.391009 1.680875 2.586275 1.371331 12.850614 0.178844 78.527555 0.064788 0.662355 0.698736 0.371181
127 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 0.315191 -0.073525 -0.555571 0.380837 1.296357 0.685916 0.860468 9.253583 0.698646 0.706596 0.381849
128 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -0.389679 0.350782 7.733098 1.628420 -0.097433 1.786317 -0.364469 -0.180209 0.687972 0.700276 0.382911
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.975049 -1.618979 -0.679615 -0.547648 -0.367014 -0.975467 0.577954 0.561327 0.686489 0.696155 0.391167
130 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 3.030373 0.731817 -0.283866 0.014442 0.154463 0.407679 7.996475 11.683385 0.665014 0.686538 0.390693
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 15.908418 18.034637 23.315863 25.230392 7.880056 10.748870 7.744124 1.010892 0.033123 0.039722 0.002374
132 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.255003 1.304226 37.768048 28.821142 4.680652 3.042506 -4.071949 -2.659885 0.641687 0.665999 0.406389
133 N11 not_connected 100.00% 100.00% 79.08% 0.00% 16.489207 23.357207 21.877685 16.333632 7.869922 10.483961 4.868262 2.437247 0.042051 0.184530 0.103449
135 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -1.374685 16.570326 -0.647855 57.640574 -0.096027 10.841244 1.540440 5.437179 0.640448 0.042186 0.466233
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 5.761143 1.175516 1.350926 3.129334 1.887939 5.752716 1.170594 2.141776 0.630979 0.658618 0.392519
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.665116 -1.352412 0.800920 -0.592358 1.889399 0.685244 2.484014 1.901826 0.651478 0.671031 0.393019
138 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.059148 -0.586639 3.531269 5.524539 -0.196739 -0.880047 14.034042 1.392130 0.670573 0.684524 0.394132
139 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.764173 4.072724 40.963812 35.699041 5.155861 5.244433 -5.801580 -2.669634 0.665645 0.686088 0.389063
140 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 5.493143 17.569571 38.162274 56.873120 4.086307 10.669497 1.755478 7.567772 0.674072 0.057257 0.536546
141 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.309963 6.837939 2.285917 42.167594 -0.230706 7.697364 4.406265 -5.578456 0.690364 0.685449 0.368100
142 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 1.567569 16.438043 0.582026 57.308739 0.983893 10.782641 1.931734 5.982456 0.690521 0.051467 0.543629
143 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 14.875858 -1.104070 56.554720 0.024283 7.855862 1.104213 1.762973 -0.471814 0.040074 0.710346 0.556369
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -1.275740 -0.886795 0.372073 11.505460 -0.263269 0.393165 -0.621648 5.684137 0.702032 0.697576 0.370319
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.720332 4.529835 -1.062022 39.068189 3.659093 22.127145 0.875758 2.967531 0.698561 0.604622 0.408402
146 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 1.057583 7.462584 17.312333 41.419800 1.240675 7.541308 -0.650059 -6.293574 0.685535 0.689737 0.373562
147 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
148 N15 RF_maintenance 100.00% 100.00% 100.00% 0.00% 235.528887 234.578824 inf inf 4843.709661 4890.805348 14794.554209 15227.767156 nan nan nan
149 N15 RF_maintenance 100.00% 100.00% 100.00% 0.00% 286.911736 287.575396 inf inf 4833.936494 4902.455769 14817.837842 15588.714319 nan nan nan
150 N15 RF_maintenance 100.00% 100.00% 0.22% 0.00% 15.589000 4.608405 55.988688 37.525597 7.878007 7.379846 6.395333 -4.264914 0.053954 0.299308 0.150658
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 14.194864 -0.656258 54.092440 3.862716 7.879832 12.584753 3.361326 6.703915 0.069815 0.657280 0.527226
156 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.425404 -0.621201 50.512123 2.535182 6.009040 -0.248079 4.166484 2.550271 0.394647 0.669096 0.476597
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.291885 -0.316303 0.086840 -0.465564 -1.186111 -0.654237 -0.758544 -0.489671 0.656038 0.673989 0.395984
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.217663 -0.626784 2.210985 4.905740 0.864377 1.265980 17.898764 54.636614 0.671742 0.686849 0.400019
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.986347 29.334931 29.353912 25.687535 2.586344 6.289794 -2.886254 8.453725 0.668433 0.541565 0.365518
160 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.022525 -0.930608 1.280063 5.811066 -0.784208 2.069099 3.621694 1.820310 0.682381 0.696281 0.377202
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.495697 37.404151 -0.183747 7.341901 -0.546922 3.687199 -0.343385 3.505842 0.686835 0.573821 0.337904
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.406246 0.680149 6.919344 11.660749 6.718941 5.741966 2.348102 6.142279 0.699134 0.707837 0.370713
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.994580 0.009719 0.833784 -0.669367 -1.278412 0.075526 -0.354855 1.727088 0.700682 0.704273 0.376258
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.259974 -0.416465 7.806887 3.268111 12.010722 1.493292 1.915293 3.873831 0.690475 0.705280 0.374993
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 24.079786 -0.367174 41.596401 3.418879 5.747534 -1.090888 0.049758 -0.368488 0.427266 0.703025 0.425053
166 N14 RF_maintenance 100.00% 0.00% 95.14% 0.00% 38.676852 15.333765 9.359420 54.712881 3.938775 10.666869 35.289843 2.904265 0.554709 0.107472 0.397709
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.770107 -0.932517 13.134197 2.470876 0.832745 0.107525 -1.920537 6.686941 0.703296 0.698669 0.383296
168 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.683866 -1.285068 -0.806181 2.257060 0.426980 0.502420 -0.651388 -0.349691 0.690646 0.699995 0.385827
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 2.517422 6.647470 28.246385 34.823079 1.564873 8.278428 -4.003493 27.816569 0.686743 0.640445 0.400399
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 15.558051 -0.388305 56.927521 10.159190 7.864001 14.424273 3.334772 0.785920 0.045072 0.691737 0.568253
179 N12 RF_maintenance 100.00% 100.00% 91.73% 0.00% 15.766264 17.538831 56.917103 59.709396 7.837027 10.708551 2.792959 4.145086 0.060088 0.127847 0.061495
180 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% 15.031906 17.454224 56.457906 58.013557 7.849578 10.823996 2.302500 7.037017 0.050579 0.055335 0.004788
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.146956 -0.852022 0.679704 -0.784460 -0.931438 1.131414 -0.407145 12.255103 0.691268 0.694669 0.377065
182 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.934994 5.766000 31.121791 39.077202 0.436357 6.452277 12.487869 -2.693924 0.641159 0.690115 0.388382
183 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 14.950159 -0.049503 52.126642 4.023910 7.882445 -0.326065 1.651671 1.393737 0.047237 0.694693 0.507424
184 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 14.828732 16.969749 56.414444 57.364824 7.820208 10.706664 2.904434 3.651930 0.084568 0.060813 0.026526
185 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 13.972191 -0.916537 56.154990 16.191503 7.854821 0.020577 2.190003 -0.430317 0.037735 0.684131 0.502356
186 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 1.047921 1.296565 17.212436 11.620094 10.176867 1.084376 4.481835 4.902676 0.678715 0.703824 0.381207
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 3.921705 2.076995 4.677171 28.062985 23.798360 3.442733 2.782498 9.434226 0.678626 0.699437 0.384090
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 1.780673 2.732805 5.653775 2.628679 0.257814 5.200705 4.289230 8.180394 0.668650 0.684612 0.390901
190 N15 digital_ok 100.00% 0.00% 100.00% 0.00% 54.559672 16.720849 7.087549 57.815942 5.691765 10.877329 141.419061 8.521716 0.492936 0.037166 0.372409
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 0.093263 0.841946 20.257725 0.531307 0.669045 -0.817030 37.252004 1.427170 0.641628 0.673490 0.418904
200 N18 RF_maintenance 100.00% 100.00% 42.59% 0.00% 16.717840 45.898123 22.993488 22.142395 7.890660 10.753621 4.936642 -1.608439 0.048025 0.220829 0.150476
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.409801 8.293980 46.309408 44.502343 6.703122 8.687740 -7.436733 -6.509559 0.642405 0.653222 0.376227
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 2.433567 4.028905 22.553273 2.609670 0.738301 2.906413 0.404387 7.314382 0.671135 0.641078 0.378733
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 17.339687 18.935382 21.640747 22.678502 7.880817 10.744981 7.239629 9.192940 0.032816 0.043784 0.003992
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.534739 6.446432 18.673661 6.250227 0.344176 3.426933 2.280390 12.450798 0.673918 0.606705 0.403624
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.250741 3.315240 20.302443 15.113577 15.994544 1.195644 4.364104 12.407649 0.668841 0.657364 0.373968
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.539198 4.024894 26.247752 21.283448 2.194004 3.412754 -0.492781 -0.852426 0.654246 0.654835 0.362418
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
219 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.783992 6.011359 46.286531 39.754551 6.904741 6.822725 -6.655454 -5.503659 0.614149 0.659442 0.401190
220 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.499012 6.556384 38.672079 39.731235 4.647333 7.025620 -1.528750 -5.735908 0.666030 0.664253 0.390532
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 3.902539 1.882026 2.644552 17.830761 1.660415 0.312666 6.561757 0.031610 0.634409 0.664428 0.394024
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 6.718200 7.202630 40.401415 40.100355 5.090270 6.926397 0.165399 -5.301890 0.661566 0.664777 0.389221
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.131763 3.223867 9.639888 21.458560 0.808554 21.870813 4.295507 8.398476 0.644244 0.668544 0.386400
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 9.454586 8.859262 47.400847 47.310634 6.931961 9.863290 -7.677049 -7.509810 0.652133 0.647332 0.381725
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 233.886019 232.709016 inf inf 5091.225528 5151.845269 16313.589108 16950.259701 nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 323.657622 323.635075 inf inf 6689.795616 6690.087929 25628.847477 25632.861106 nan nan nan
227 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
228 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
229 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
238 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
239 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% 323.633502 323.310869 inf inf 5316.805333 5337.309773 18214.131350 18192.975393 nan nan nan
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.024370 5.875678 14.376286 -0.049862 0.396255 1.854430 16.519673 53.671385 0.656301 0.608840 0.398932
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 58.397240 3.189197 13.570624 27.686698 15.934694 2.795105 101.534441 -2.011685 0.397814 0.662212 0.455050
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 74.812579 3.949004 17.904035 12.675332 7.329061 1.588619 -2.950310 -0.063335 0.312657 0.642439 0.503274
244 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
245 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 261.565515 260.605344 inf inf 5375.894857 5322.522655 18506.752820 18078.580760 nan nan nan
246 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 243.439194 242.775879 inf inf 5378.960005 5365.313993 18132.635322 18197.398163 nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% 317.651417 317.616998 inf inf 6720.143057 6719.912860 16728.768832 16760.504486 nan nan nan
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 0.655516 17.476306 0.989297 36.382015 0.258572 10.790216 28.640966 10.193353 0.656492 0.051324 0.531804
324 N04 not_connected 100.00% 0.00% 0.00% 0.00% 2.490358 4.223598 24.896166 29.365538 1.579547 3.266450 9.582798 2.928831 0.566673 0.564212 0.387791
325 N09 dish_ok 100.00% 0.00% 0.00% 0.00% 1.177842 -0.295082 25.524643 13.147283 1.872571 0.769808 -2.163613 0.711461 0.600645 0.580321 0.395574
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.478036 0.240144 3.633187 18.657699 1.251955 1.675146 18.480824 3.451564 0.526388 0.575782 0.399111
333 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.698343 2.430433 3.939350 12.329893 0.629010 1.668161 3.043695 3.527595 0.533035 0.562329 0.390422
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, 7, 8, 10, 15, 16, 17, 18, 19, 20, 21, 22, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 90, 92, 93, 94, 95, 96, 97, 98, 101, 102, 103, 104, 106, 107, 108, 109, 110, 111, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 126, 127, 128, 130, 131, 132, 133, 135, 136, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 155, 156, 158, 159, 160, 161, 162, 164, 165, 166, 167, 169, 170, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 200, 201, 202, 203, 205, 206, 207, 208, 209, 210, 211, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 324, 325, 329, 333]

unflagged_ants: [5, 9, 40, 41, 42, 65, 69, 89, 91, 99, 100, 105, 112, 116, 124, 125, 129, 137, 157, 163, 168]

golden_ants: [5, 9, 40, 41, 42, 65, 69, 91, 99, 100, 105, 112, 116, 124, 129, 157, 163]
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_2459883.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.4.dev44+g3962204
3.1.5.dev171+gc8e6162
In [ ]: