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 = "2459881"
data_path = "/mnt/sn1/2459881"
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-28-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/2459881/zen.2459881.25279.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 2219 ant_metrics files matching glob /mnt/sn1/2459881/zen.2459881.?????.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/2459881/zen.2459881.?????.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 2459881
Date 10-28-2022
LST Range 21.965 -- 9.930 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 2223
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
Total Number of Nodes 18
Nodes Registering 0s N20
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 73 / 201 (36.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 177 / 201 (88.1%)
Redcal Done? ❌
Never Flagged Antennas 24 / 201 (11.9%)
A Priori Good Antennas Flagged 76 / 96 total a priori good antennas:
3, 5, 7, 10, 15, 16, 17, 19, 20, 21, 29, 30,
31, 37, 38, 44, 45, 51, 53, 54, 55, 56, 59,
66, 67, 68, 71, 72, 81, 84, 85, 86, 93, 94,
98, 99, 101, 103, 106, 107, 108, 109, 111,
117, 121, 122, 123, 128, 130, 140, 141, 142,
143, 144, 146, 147, 158, 160, 161, 162, 163,
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_2459881.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% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
4 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
5 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.346904 -0.969328 0.881098 1.048804 -0.725669 1.182017 13.434623 27.174221 0.719080 0.722458 0.333135
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.037592 -0.715956 1.218533 0.671734 -0.705029 -0.254453 18.162034 2.701269 0.712585 0.714907 0.323824
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.010949 -1.195760 -0.214364 -0.212519 1.245357 -0.386057 -0.016609 2.543801 0.716093 0.718362 0.330857
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.097569 -0.156140 7.861898 8.315686 1.114676 4.648773 3.645860 5.143959 0.708843 0.717345 0.335043
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
16 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
17 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.250229 13.041551 1.669510 1.328685 3.435536 10.085632 40.328830 56.125330 0.705317 0.538801 0.405134
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 1.412212 0.620124 0.274751 28.712683 0.794482 4.580629 27.074708 39.330550 0.719457 0.703162 0.336194
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.379538 3.328125 0.236846 21.781269 0.891538 1.402422 2.631780 -0.247959 0.725454 0.722097 0.326666
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.960558 1.167751 -0.709700 10.463330 0.390996 1.924239 3.695507 85.405432 0.714654 0.710527 0.328671
22 N06 not_connected 100.00% 0.00% 0.00% 0.00% 36.910008 13.533606 7.588993 22.694934 13.781020 10.380278 17.417689 6.078930 0.532783 0.665941 0.237889
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 13.670539 14.951524 71.318040 72.125314 22.086693 30.530178 10.373604 16.491416 0.032348 0.037436 0.005319
28 N01 RF_maintenance 100.00% 0.00% 71.97% 0.00% 15.971631 32.839355 9.123599 5.903306 16.370256 28.729894 18.757447 45.264681 0.442582 0.265712 0.255176
29 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -1.115310 -0.099669 -0.831075 -0.517902 -0.995387 -1.074311 0.465606 7.372865 0.724076 0.725852 0.330018
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.554065 -0.623715 3.784863 -0.992209 -0.408884 -0.696592 16.492000 1.233768 0.724859 0.731556 0.326476
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.237989 1.046810 1.004489 -0.759271 1.150845 3.445982 7.008094 2.885829 0.736438 0.731318 0.333217
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.380643 20.409892 3.222706 5.570022 2.472157 25.012711 4.747493 39.024831 0.688276 0.663636 0.279313
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 15.733614 3.544003 29.922695 26.625698 22.009621 8.045772 6.174723 0.844199 0.045701 0.712777 0.519604
35 N06 not_connected 100.00% 0.00% 0.00% 0.00% 6.989685 1.106484 53.237053 15.415144 14.083710 3.102410 -3.844122 4.613069 0.700449 0.695527 0.330198
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.752211 9.982104 1.176072 0.849002 1.073651 2.313772 -0.086999 1.597104 0.722793 0.729165 0.332644
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.549956 0.636886 -0.420602 0.143635 2.093875 2.749580 0.407299 19.006106 0.728209 0.735107 0.334335
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.115440 0.087991 -0.937251 -0.583886 1.795004 0.101759 16.881633 5.484071 0.730717 0.738962 0.335435
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.208262 0.566114 -0.860285 -0.876555 0.332883 -1.195070 -0.642111 -0.981007 0.723485 0.730630 0.331945
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.250761 0.833437 1.719298 2.023376 0.557098 -1.350300 -0.389996 0.341792 0.727285 0.729960 0.322634
42 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.006977 1.175463 -0.461267 1.667249 -0.228079 -0.549046 -0.743397 -0.552444 0.735654 0.739605 0.332982
43 N05 RF_maintenance 100.00% 99.68% 0.00% 0.00% 12.885490 3.708460 70.556693 -0.068679 22.009418 0.083337 7.911304 8.591796 0.051423 0.734786 0.510970
44 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 1.402285 1.859750 2.669992 5.197082 1.573741 0.410479 17.621692 14.008978 0.723866 0.736465 0.317464
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.634195 3.326352 -1.029366 -0.133445 -0.022595 3.604884 1.151916 57.087114 0.729761 0.722686 0.323212
46 N05 RF_maintenance 100.00% 0.00% 99.95% 0.00% -0.663638 15.501116 -0.627256 72.421830 -0.933207 30.465968 0.912055 19.163758 0.724476 0.044907 0.533221
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 14.753135 3.038567 28.571922 16.889617 22.000392 3.306876 6.387422 10.278247 0.038902 0.709002 0.512031
48 N06 not_connected 100.00% 0.00% 0.00% 0.00% 2.634346 3.362071 31.107599 38.024795 3.516526 8.339068 -1.463148 0.232046 0.703252 0.720452 0.333010
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 1.706658 2.269113 10.058774 32.370078 2.133842 5.471806 3.451650 4.924986 0.676503 0.709412 0.331881
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.647043 2.229706 0.027036 1.387916 3.604196 4.549238 27.395345 32.243433 0.709184 0.722968 0.315369
51 N03 digital_ok 100.00% 98.96% 0.00% 0.00% 30.039915 1.299145 91.739346 -0.066966 22.016926 3.426954 26.730478 14.739755 0.054156 0.738702 0.556487
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.259459 8.249232 1.293371 0.533832 1.223335 0.037863 2.660434 0.439202 0.734044 0.742923 0.327037
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.790841 3.219394 -0.620233 0.772044 -0.086585 0.440776 7.994467 15.389834 0.735178 0.745768 0.330340
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 13.725414 15.784158 71.372249 73.866163 22.058470 30.489443 8.941757 14.465040 0.046937 0.050638 0.003414
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 3.955115 16.693770 -0.153738 73.169758 9.870577 30.458344 19.372590 19.290460 0.725311 0.037175 0.543490
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.131761 16.715815 0.498835 74.686126 0.588441 30.479905 2.048605 14.574558 0.732978 0.038153 0.559973
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 40.209859 1.145824 29.269461 -0.705626 11.255776 0.748074 7.977815 3.206537 0.581241 0.744824 0.322781
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 13.249748 15.563365 71.026520 73.538080 22.039846 30.492026 10.493832 17.782456 0.036721 0.034090 0.000553
59 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 28.215852 5.599788 6.355971 0.119909 8.972738 0.405466 54.681722 17.003207 0.667194 0.732424 0.313786
60 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 14.275717 15.261517 71.229685 73.372737 22.092294 30.543985 10.228007 20.816989 0.027718 0.027052 0.001500
61 N06 not_connected 100.00% 0.00% 0.00% 0.00% 4.539409 4.152617 7.102673 0.377943 4.057256 6.728247 0.081457 8.614710 0.688764 0.689420 0.317806
62 N06 not_connected 100.00% 0.00% 0.00% 0.00% 1.689952 3.351647 25.186562 35.250095 2.003723 8.237485 0.811597 1.520110 0.707174 0.724136 0.325834
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 10.577068 15.636397 25.268468 30.198531 5.384457 30.523598 2.346068 18.941847 0.660865 0.045926 0.471670
64 N06 not_connected 100.00% 0.00% 0.00% 0.00% 2.613260 2.095229 15.701148 29.419856 1.604507 4.722056 1.953704 2.233846 0.668021 0.697593 0.330716
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.987781 0.970547 0.709484 2.259764 0.337337 1.309483 -0.799159 -0.859599 0.716532 0.734959 0.336975
66 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.008344 1.698656 15.898040 9.271367 2.947448 -1.307875 0.090050 1.777989 0.720142 0.737088 0.330491
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.994377 -0.324903 8.289918 4.483494 -0.991696 -0.271841 2.800570 6.507764 0.725945 0.739421 0.325421
68 N03 digital_ok 100.00% 0.00% 99.86% 0.00% 2.842259 33.123165 1.797725 98.008303 -0.422467 29.892072 1.272502 36.390293 0.727445 0.041338 0.575380
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.406170 -0.642642 -0.421955 -0.196091 0.746151 2.404366 -0.473842 0.026820 0.730456 0.744838 0.324501
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.726910 -0.215544 1.045779 2.443396 -0.016919 -0.475876 -0.071842 -1.142659 0.735403 0.749333 0.322772
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.717978 -0.458909 3.169987 1.955330 1.620379 0.236563 2.081726 2.063948 0.744466 0.748935 0.318638
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.146676 0.070010 2.147336 1.702121 2.430624 0.237458 11.079625 1.692198 0.729611 0.745116 0.309293
73 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.819460 14.390342 70.098639 71.214547 22.083871 30.481617 12.385956 15.615989 0.027005 0.027003 0.001274
74 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 14.116779 13.083681 73.372772 70.905072 22.091966 26.163973 10.712128 62.477203 0.030549 0.427499 0.280317
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 27.029840 30.368948 26.284901 20.800199 16.829312 17.227828 23.775365 8.393221 0.605115 0.594505 0.173089
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 40.037550 1.014060 19.209511 26.092388 10.710899 3.485764 0.808277 2.561563 0.548873 0.709260 0.309788
79 N11 not_connected 100.00% 0.00% 0.00% 0.00% 4.084973 5.078929 45.832566 47.176684 9.273427 14.724296 -3.966211 1.731650 0.702666 0.720060 0.329619
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 11.950889 17.134457 43.315837 29.341258 17.782567 30.455272 45.693046 14.689472 0.411758 0.041617 0.253031
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -0.068033 0.748521 -0.544843 27.997487 0.801040 34.555670 0.054762 5.569420 0.698802 0.681533 0.327292
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.739662 0.058290 -0.163971 9.483250 1.081510 0.008788 0.397720 -0.600473 0.712051 0.722909 0.323826
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.513296 -0.392820 -0.853140 0.969011 1.681959 1.135598 -1.400839 -0.020804 0.721623 0.736058 0.320242
84 N08 digital_ok 100.00% 0.00% 100.00% 0.00% 2.079139 29.598077 38.776256 94.768116 3.701961 29.795221 78.660033 24.058682 0.700968 0.041539 0.435142
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% 286.243982 286.769048 inf inf 11671.794731 11800.753713 17933.790811 18420.563740 nan nan nan
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.894818 8.872854 1.250350 2.472893 27.013742 0.904852 25.685271 2.120783 0.724945 0.757485 0.314546
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.038714 0.374987 0.710494 -0.141439 -1.378375 0.570684 2.286927 0.016609 0.732074 0.746147 0.307756
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.508942 -0.274349 -0.641230 -0.024565 -0.487587 -0.815215 -1.286136 -1.163543 0.737414 0.745826 0.311818
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.426885 0.099906 0.026704 1.414937 -1.332839 -0.477734 1.281054 12.093446 0.734315 0.743336 0.312243
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.194928 -0.717072 -0.321613 0.946683 -0.680468 -0.645230 1.284970 0.528427 0.730422 0.748973 0.324173
92 N10 RF_maintenance 100.00% 0.00% 10.41% 0.00% 45.877235 52.602978 8.386579 10.115577 18.859674 26.316597 2.115006 22.708972 0.399571 0.357674 0.077199
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.667504 0.666055 12.204046 -0.084738 5.184215 -1.315201 12.393892 -0.576693 0.722572 0.740813 0.325045
94 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -0.963929 -0.344215 3.059413 2.195402 1.488448 3.245712 11.417477 12.251243 0.722671 0.730129 0.325287
95 N11 not_connected 100.00% 0.00% 0.00% 82.20% 6.820248 5.995837 53.276689 52.203485 12.289803 22.737913 -3.953096 5.347069 0.389763 0.388844 -0.249552
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 15.139161 16.672265 28.559713 30.666963 21.997548 30.518098 6.357405 13.820961 0.033020 0.040127 0.004862
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.685660 4.373160 50.785966 4.580467 12.774667 4.875729 -4.887029 32.353040 0.688531 0.680083 0.332946
98 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 1.167188 7.213243 -0.026584 0.676195 -0.756657 2.666319 3.170510 7.163347 0.697760 0.710385 0.323695
99 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 1.592642 -0.756776 1.236431 -1.110067 -1.226393 3.559803 6.613310 -1.004788 0.702551 0.725106 0.326589
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.542189 -1.129235 0.307280 2.747410 0.828710 -0.683520 0.708990 -1.118809 0.714783 0.730004 0.322630
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.522536 11.114310 3.485827 2.250842 -0.554209 0.585839 0.456637 -0.065888 0.735549 0.745214 0.321194
102 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
103 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 28.906145 30.240877 82.028558 83.835881 22.226746 30.238940 27.699730 33.572449 0.026149 0.031416 0.004807
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.144752 72.916249 44.838267 46.294537 3.537565 1.577648 1.325362 1.356651 0.694584 0.727195 0.319246
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.148619 -0.756790 -0.869413 0.166638 -1.071684 -0.218754 -0.800079 -1.328652 0.736638 0.745997 0.306481
106 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.513376 0.773896 4.672967 1.402822 2.164252 -0.198999 2.143658 0.363870 0.728620 0.744636 0.308289
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.718354 3.651007 1.061752 6.165015 0.742390 3.246796 4.621834 9.326735 0.732726 0.744907 0.302939
108 N09 digital_ok 100.00% 44.21% 0.00% 0.00% 13.040398 3.304155 69.746887 0.798722 20.755081 0.608682 7.760660 3.871545 0.289279 0.748270 0.424751
109 N10 digital_ok 100.00% 0.00% 100.00% 0.00% -0.697949 15.376669 1.850404 71.248010 -0.819526 30.477659 1.886544 16.851785 0.735357 0.042412 0.461601
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.368659 31.290918 -0.178899 95.925570 -0.394864 29.816096 0.651433 22.897521 0.741780 0.035109 0.462129
111 N10 digital_ok 100.00% 0.00% 99.95% 0.00% 0.263282 15.251314 1.001697 72.018489 -0.916212 30.445672 -0.184931 17.972094 0.728878 0.043485 0.458486
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.006977 0.061740 -0.838028 1.249978 0.359743 3.848079 1.031785 -1.017583 0.718181 0.736056 0.332045
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 16.054580 16.725859 26.935571 29.872774 22.000013 30.505258 7.956442 13.655484 0.037941 0.031340 0.004046
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 10.324114 6.658155 14.440665 49.800331 12.061897 17.582496 3.370948 1.455455 0.552368 0.708975 0.366770
115 N11 not_connected 100.00% 0.00% 0.00% 0.00% 3.725328 9.204704 42.958934 40.367248 8.305330 14.010207 -3.431364 5.491987 0.686806 0.664978 0.333911
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.759124 0.706339 1.066466 -0.596968 0.469485 1.929723 0.177602 0.382042 0.693427 0.712158 0.329732
117 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 14.870956 17.133487 71.668435 75.712585 22.038647 30.597408 7.472612 21.913037 0.027617 0.031134 0.002310
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.532728 1.065940 0.778974 0.351473 -0.525179 -0.898829 0.386095 2.460273 0.717970 0.735939 0.324305
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.003395 2.804328 4.641573 24.588255 -0.961851 3.950631 0.165283 5.003390 0.728668 0.710066 0.324751
120 N08 RF_maintenance 100.00% 0.00% 90.40% 0.00% 19.439388 29.654473 36.044506 94.325796 17.309248 30.094832 -1.391414 34.362133 0.444932 0.066155 0.255241
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.355378 6.158969 -0.215428 1.434346 1.638462 0.117636 113.073450 40.360628 0.736995 0.750863 0.322542
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.831219 8.580755 5.275076 1.201313 4.656541 -0.515844 2.163199 -1.437352 0.741687 0.753916 0.320387
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.419413 10.684141 1.860897 1.814346 -1.458253 -0.326004 0.110796 1.052811 0.742860 0.754540 0.314751
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.545583 1.096356 0.296197 -0.664968 -1.021107 -1.819835 0.990089 0.706871 0.742762 0.752539 0.312383
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.413872 1.990516 -0.556808 -0.390604 0.014177 1.643980 -0.398896 0.149646 0.731497 0.746503 0.308914
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.367434 5.538776 7.486479 5.717957 12.437630 3.760136 41.801613 7.068147 0.736947 0.740734 0.315440
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.034436 -0.058411 -0.633804 -0.321616 0.420898 0.086899 0.279022 3.521663 0.737877 0.751469 0.322963
128 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -0.718761 0.201948 10.044855 3.314760 1.209136 0.278202 0.067708 -0.198832 0.728911 0.746447 0.322682
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.966146 -1.477355 -0.684013 0.024565 -0.861457 -1.202140 -0.813352 -0.581067 0.729836 0.744208 0.328265
130 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 1.966132 0.236148 -0.425644 -0.042990 0.124401 -0.032809 0.258229 6.910305 0.712428 0.735652 0.328511
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 14.906066 16.822270 28.820432 31.602037 22.038717 30.455702 11.178408 11.494824 0.033169 0.038406 0.001949
132 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.536075 1.247722 50.251821 38.089969 12.799479 8.861076 -4.600928 0.886775 0.691443 0.716638 0.343055
133 N11 not_connected 100.00% 100.00% 69.00% 0.00% 15.564917 20.929902 26.962783 20.614235 22.046591 28.284556 7.838757 13.060369 0.040503 0.296218 0.171870
135 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -1.526153 15.393175 0.022641 73.744268 0.682419 30.513673 1.521017 15.377870 0.688998 0.044006 0.480653
136 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 3.963286 0.899149 0.881254 1.692009 -0.014177 0.338099 0.105323 -0.370026 0.684645 0.712771 0.328993
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.610914 -1.244933 -0.545831 0.033928 3.021139 -0.979388 3.626030 0.226326 0.700050 0.721724 0.329492
138 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.341289 -0.501805 4.432558 6.646815 -1.427577 -0.650384 17.934403 -0.448913 0.718926 0.733745 0.331638
139 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.002903 4.055062 54.537059 47.129606 14.796149 14.298215 -5.027361 1.281351 0.714186 0.736553 0.327193
140 N13 digital_ok 100.00% 0.00% 85.85% 0.00% 5.712509 16.283372 50.540231 72.665605 12.421262 30.450899 -0.103442 18.785884 0.720946 0.087146 0.538110
141 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.587205 7.325105 2.286371 55.864912 0.772346 21.100745 0.627412 1.745175 0.732890 0.735907 0.314282
142 N13 digital_ok 100.00% 0.00% 99.32% 0.00% 1.165465 15.243865 1.645781 73.273806 3.912262 30.536946 3.009316 16.473079 0.730075 0.061432 0.554366
143 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 13.968953 -1.140289 72.155215 -0.942880 22.003900 0.674642 4.458830 -0.831847 0.040135 0.754029 0.567126
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -1.377068 -0.415390 0.253358 14.030732 0.749617 -1.153864 0.533429 1.872083 0.738499 0.743567 0.315637
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.420039 3.266442 -0.658535 42.949093 1.515822 31.129946 2.105246 9.901978 0.735061 0.692983 0.333533
146 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.582591 7.754697 21.797512 54.818014 2.956958 20.338903 0.378033 1.621760 0.724288 0.740194 0.320026
147 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.602821 -0.392376 5.960153 10.866362 -0.705475 -1.744799 4.142467 1.672863 0.730504 0.740680 0.315948
148 N15 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.829864 -0.236632 22.184613 7.955050 -0.057614 0.491334 1.913539 0.529370 0.715351 0.742997 0.328733
149 N15 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.224910 2.548274 14.978163 40.574441 -1.332518 9.192554 -0.998587 0.752367 0.728706 0.743580 0.330738
150 N15 RF_maintenance 100.00% 97.93% 0.00% 0.00% 14.588528 5.160219 71.281776 49.486524 22.008571 20.056809 9.349128 5.853843 0.068321 0.409865 0.232703
155 N12 RF_maintenance 100.00% 88.96% 0.00% 0.00% 13.368755 -0.540980 68.763557 1.800930 21.945414 13.774644 5.353608 12.969442 0.098332 0.711057 0.513346
156 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.174273 -0.035313 64.659322 2.340497 16.357135 -0.015606 7.895888 1.363296 0.458119 0.720105 0.408660
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.106090 -0.179278 0.179828 -0.656658 -0.668514 0.654583 0.124421 0.928462 0.705384 0.723882 0.334199
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.059366 -0.336745 1.042329 5.136069 2.003216 1.269642 17.056676 53.420111 0.718091 0.735518 0.338413
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.804564 29.406272 38.680092 32.975841 7.294977 18.393634 -2.387920 6.991780 0.715503 0.613614 0.314298
160 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.342192 -0.979074 1.824051 6.183898 -1.577188 0.315063 5.974907 5.467625 0.727740 0.743336 0.318476
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.668215 34.825442 -0.266146 9.614200 -1.641767 9.838823 0.838670 7.764864 0.729149 0.638929 0.288595
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.650084 0.442053 4.800046 14.204837 8.640807 1.663383 2.462242 3.482540 0.737736 0.752253 0.314271
163 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.104774 0.546586 1.136483 -0.848898 -1.294111 0.533914 1.589011 6.236088 0.739664 0.748531 0.318668
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.818769 0.077943 5.152143 3.744449 10.617597 1.138237 5.298720 6.013291 0.731278 0.749496 0.315646
165 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 298.663713 298.525860 inf inf 15668.666390 15664.524525 28130.285313 28106.451601 nan nan nan
166 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.574844 -0.761475 16.366091 2.214477 -0.519433 1.736989 -0.670192 21.727073 0.743040 0.745731 0.324251
168 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.786594 -0.997600 -1.029757 2.829105 0.098576 0.457737 -0.370576 0.097881 0.733149 0.747868 0.324265
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 6.493164 4.612754 36.910186 46.280024 20.269169 16.580552 7.138838 9.531154 0.693354 0.717644 0.320441
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 14.599589 -0.715495 72.566114 9.082717 21.981263 17.490769 5.847904 3.656420 0.048185 0.739687 0.581523
179 N12 RF_maintenance 100.00% 96.30% 82.24% 0.00% 14.805365 16.623293 72.607444 76.813779 21.968719 30.561793 5.587743 15.077897 0.072913 0.210386 0.110260
180 N13 RF_maintenance 100.00% 100.00% 98.74% 0.00% 14.095240 16.104469 71.942466 74.229147 21.976152 30.516181 4.972195 17.832238 0.049820 0.064407 0.011229
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.397076 -0.736395 0.985254 -0.797029 -0.027370 0.592856 0.796769 15.620762 0.734695 0.742488 0.319889
182 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.964881 6.188567 40.190128 51.610575 3.522266 17.712444 20.679849 5.956454 0.685411 0.739834 0.330494
183 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 14.036721 -0.543926 66.228562 6.377155 22.020676 -1.036699 3.795761 0.453598 0.046481 0.742232 0.526125
184 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
185 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 13.151734 -1.125690 71.484539 21.307599 21.972270 -0.313260 4.737503 0.984644 0.037026 0.730306 0.521626
186 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 1.075284 1.715503 22.028775 15.767469 16.518271 2.727058 4.669222 2.618952 0.718783 0.749858 0.323220
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 3.638228 2.477877 9.071395 36.253470 38.333610 7.533459 9.823456 14.866232 0.728634 0.747092 0.322894
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 1.463116 2.249418 6.938374 2.234393 0.173105 2.361304 2.358836 6.716510 0.713778 0.734157 0.330210
190 N15 digital_ok 100.00% 0.00% 99.95% 0.00% 53.208012 15.520106 9.936566 73.992617 15.288149 30.589709 117.499531 19.248725 0.559553 0.046176 0.422004
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.081937 0.456647 26.074417 1.525420 0.822927 -1.227442 30.681770 1.244847 0.688568 0.725096 0.353577
200 N18 RF_maintenance 100.00% 100.00% 36.41% 0.00% 15.723871 42.988958 28.317614 28.810802 22.054574 29.246906 8.285375 9.087685 0.046834 0.335764 0.241295
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.724012 8.669586 61.581406 58.999308 18.784424 23.961844 -5.584774 2.721035 0.693569 0.709648 0.320259
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 2.339313 3.887509 29.298138 2.542931 2.874077 6.696105 6.713796 9.182679 0.718121 0.694014 0.325038
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 16.340183 17.625052 26.599091 28.227152 22.065768 30.499943 10.091219 20.558784 0.033501 0.041743 0.002276
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.569829 5.966297 24.717175 8.045725 1.426318 9.591786 0.497195 12.713758 0.713863 0.661750 0.347530
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.326901 2.344382 29.562742 20.374427 21.617898 3.498124 0.693262 15.146771 0.713935 0.713703 0.319674
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.371767 3.710179 34.617996 27.193800 6.334840 7.155446 -0.713901 -0.028091 0.701173 0.706908 0.309096
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% 9.203923 6.526176 61.662215 52.911587 19.112726 19.373263 -5.946870 1.945311 0.668936 0.716177 0.339013
220 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.551965 6.802352 51.349972 52.426983 13.014246 18.925698 0.484716 1.223165 0.714753 0.720728 0.328741
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 3.862991 1.699627 2.720898 24.082477 4.043524 2.665755 7.015690 2.880651 0.679217 0.718781 0.332524
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 6.707690 7.537900 53.491780 53.312000 14.269111 19.384225 2.404076 2.383846 0.709529 0.721167 0.327881
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.735102 2.522607 13.249360 21.222908 1.574350 2.511546 1.806760 19.820373 0.688518 0.717520 0.325401
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 9.853249 9.365257 63.020151 62.678487 19.314913 26.763001 -4.729434 2.132647 0.697223 0.704333 0.324630
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 298.697731 298.614353 inf inf 11789.361704 11374.238473 18286.504575 16559.142790 nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 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% 0.00% 0.00% 0.00% 4.331745 3.141753 1.539422 17.730119 3.630795 3.879318 0.675476 0.701331 0.661907 0.696538 0.339364
238 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.418153 0.583713 32.882664 31.844835 4.202679 7.083379 -2.045289 -0.093810 0.712040 0.715751 0.333758
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.797664 4.961214 21.015523 46.970220 3.980123 14.680262 6.326555 14.225037 0.704002 0.716948 0.331713
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% 259.667643 260.484694 inf inf 12283.120808 11838.424230 19178.748016 17565.489524 nan nan nan
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.900095 5.619179 18.324501 0.016503 1.772651 6.561416 21.578603 64.834467 0.699243 0.669601 0.341938
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 30.493818 3.992550 27.904330 40.115187 12.628168 10.338957 2.738481 3.178604 0.584162 0.715707 0.326501
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 72.645495 3.758335 23.366319 16.332532 20.363668 3.700787 -0.141172 2.956833 0.385175 0.697556 0.444138
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% nan nan inf inf nan nan nan nan nan nan nan
246 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 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.828078 16.132556 0.868275 46.052009 0.485298 30.482184 26.308945 19.236608 0.706026 0.053907 0.580854
324 N04 not_connected 100.00% 0.00% 0.00% 0.00% 2.261617 4.044325 32.943919 38.364055 6.263250 10.461849 1.112294 2.341806 0.620275 0.634065 0.331076
325 N09 dish_ok 100.00% 0.00% 0.00% 0.00% 1.266375 -0.405841 33.248518 17.368049 5.681005 4.232157 -0.300165 6.104636 0.650062 0.645845 0.338292
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.749245 -0.281919 -0.008444 19.999576 5.433382 5.483670 6.281925 4.300972 0.577633 0.642738 0.340129
333 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.578184 2.139987 4.866610 15.992309 3.617760 6.759337 6.132228 4.973161 0.589724 0.630193 0.333086
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 5, 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, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 90, 92, 93, 94, 95, 96, 97, 98, 99, 101, 102, 103, 104, 106, 107, 108, 109, 110, 111, 113, 114, 115, 117, 119, 120, 121, 122, 123, 126, 128, 130, 131, 132, 133, 135, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 155, 156, 158, 159, 160, 161, 162, 163, 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: [9, 40, 41, 42, 65, 69, 70, 83, 88, 89, 91, 100, 105, 112, 116, 118, 124, 125, 127, 129, 136, 137, 157, 168]

golden_ants: [9, 40, 41, 42, 65, 69, 70, 83, 88, 91, 100, 105, 112, 116, 118, 124, 127, 129, 136, 157]
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_2459881.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 [ ]: