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

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

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

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2460128/zen.2460128.21269.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

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

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1851 ant_metrics files matching glob /mnt/sn1/2460128/zen.2460128.?????.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/2460128/zen.2460128.?????.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 2460128
Date 7-2-2023
LST Range 13.230 -- 23.192 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
Total Number of Antennas 205
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
RF_maintenance: 62
RF_ok: 18
digital_maintenance: 3
digital_ok: 83
not_connected: 30
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 205 (0.0%)
Antennas in Commanded State (observed) 0 / 205 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s N05
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 65 / 205 (31.7%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 101 / 205 (49.3%)
Redcal Done? ❌
Never Flagged Antennas 101 / 205 (49.3%)
A Priori Good Antennas Flagged 37 / 83 total a priori good antennas:
5, 7, 15, 17, 31, 37, 38, 40, 42, 44, 45, 51,
53, 86, 112, 121, 123, 140, 141, 144, 145,
146, 151, 153, 158, 161, 162, 163, 164, 165,
169, 170, 181, 183, 186, 187, 202
A Priori Bad Antennas Not Flagged 55 / 122 total a priori bad antennas:
8, 16, 35, 36, 48, 49, 50, 52, 57, 63, 64,
68, 79, 80, 89, 90, 94, 95, 97, 108, 113, 114,
115, 120, 125, 126, 127, 132, 133, 135, 136,
139, 155, 156, 159, 175, 179, 195, 206, 207,
223, 224, 228, 229, 240, 241, 243, 244, 245,
261, 324, 332, 333, 336, 340
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_2460128.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 0.00% 0.00% 0.00% 0.00% -0.044650 -0.534469 0.134295 -0.964032 0.584648 -0.512089 -0.088812 -0.510556 0.676075 0.564049 0.426943
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.554632 7.863309 -1.441967 -1.017420 -1.393441 -0.275179 -0.982173 5.226510 0.681641 0.487768 0.428984
5 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 1.545429 5.740807 0.121298 3.139711 0.478689 1.313576 -0.183578 0.625840 0.683192 0.540923 0.436178
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.166801 -0.387445 -0.954182 -0.484771 -0.387401 -0.082526 3.338590 9.676971 0.653194 0.533992 0.418213
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.686045 1.922041 0.930150 1.116474 -0.190266 0.111996 -1.654709 -1.281749 0.631729 0.501492 0.410032
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.418226 0.016328 2.844402 0.124432 1.418616 0.453207 2.027290 0.187325 0.642376 0.528904 0.417649
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.560738 -1.442429 -1.107330 -1.270984 -0.716888 -0.949542 -0.132856 0.042380 0.642226 0.513542 0.421428
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 11.801688 6.811088 0.281214 -0.131439 -1.125425 -0.065329 0.554649 1.543518 0.596984 0.557920 0.369833
16 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.922072 -0.532593 -1.020807 -0.931424 -1.693701 -1.673957 -1.223248 -1.131097 0.691104 0.580662 0.421995
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.673657 1.818517 1.359436 3.275404 1.506641 1.809187 0.353022 7.868884 0.692710 0.568108 0.425116
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.331948 5.684393 0.362184 2.203165 0.931253 0.485702 24.585040 26.863296 0.616281 0.338408 0.467461
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.899948 -0.789674 -0.735177 -0.532073 -0.381631 0.234267 -0.032554 3.002868 0.657620 0.544350 0.418378
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.318445 -0.366151 1.142219 0.336299 1.594462 0.500712 2.340287 0.523567 0.652430 0.539634 0.415834
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.247377 -0.246720 -0.469319 -0.264056 0.100978 0.098625 0.349454 0.250014 0.654052 0.533412 0.419711
22 N06 not_connected 0.00% 0.38% 0.00% 0.00% -0.023902 -1.391539 0.942241 -1.091957 0.040237 -0.537913 1.551376 0.670825 0.482101 0.372185 0.348996
27 N01 RF_ok 100.00% 100.00% 81.74% 0.00% 10.427191 14.069428 10.228798 3.742248 1.094291 1.211718 3.988936 32.568839 0.044515 0.167421 0.122528
28 N01 RF_ok 100.00% 0.00% 41.49% 0.00% -0.075861 10.589547 0.395859 4.671007 0.691491 -0.578339 0.092367 14.325371 0.694329 0.252650 0.576566
29 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.773405 7.098385 10.938134 11.086878 1.149490 1.238595 2.732807 1.851445 0.030651 0.038576 0.008493
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.244474 -1.259842 -0.293755 -1.336265 -1.562602 -0.931072 -0.888050 -0.476068 0.693042 0.592158 0.421559
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.248906 0.447275 -0.076992 0.707746 0.514978 1.093088 0.631879 5.342696 0.673094 0.552175 0.424526
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.009459 3.558710 0.167248 -0.833654 -0.668736 1.181042 2.779172 10.065333 0.565517 0.516942 0.295537
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 6.710102 -0.085385 6.387057 -0.592623 1.147205 -1.556865 2.437324 0.291411 0.029242 0.391153 0.286550
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.406498 -1.091818 -0.672974 -1.406442 -1.814681 -1.488470 -0.140294 0.260717 0.522845 0.386572 0.367052
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.193422 2.349728 0.676008 0.236084 0.807552 0.564276 0.168789 0.376940 0.675190 0.554435 0.415688
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 6.302679 5.821335 4.487265 5.681657 2.377386 2.122855 0.834085 17.471358 0.681250 0.560838 0.412657
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.693203 -0.310538 -0.507809 0.489207 0.135583 0.914708 2.673924 7.178002 0.692051 0.578052 0.416122
40 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.373039 0.889755 0.675903 0.492162 0.850106 0.669996 1.300369 34.134330 0.689787 0.580321 0.413251
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.095265 1.578035 0.116575 2.656713 0.551527 1.565928 -0.010778 0.644813 0.696308 0.579711 0.418516
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.707857 2.661462 0.218420 4.943724 0.733444 1.434055 0.489940 2.470891 0.701130 0.571477 0.430577
43 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
44 N05 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
45 N05 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
46 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 5.978889 7.399899 6.194709 6.077060 1.150955 1.246722 -1.546653 -1.782808 0.030448 0.023987 0.007254
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.822651 0.207844 -1.347984 -0.164840 -1.622666 -1.126911 -0.157384 -0.802189 0.583061 0.449170 0.392149
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.671721 -0.666427 0.288064 -1.153956 0.008921 -1.619113 0.829081 0.715887 0.559942 0.437252 0.382224
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.115443 -0.276427 0.286651 0.252485 1.570818 0.605596 1.379181 -0.116625 0.673586 0.554755 0.412680
51 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.883221 0.172162 -0.352278 0.685334 0.268493 1.118231 51.668401 1.373025 0.682245 0.570375 0.406615
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.384975 1.470592 0.465487 -0.345457 0.981127 0.025056 2.910552 0.322986 0.692645 0.581193 0.407068
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.128616 0.176651 -0.168784 -0.382785 0.453032 0.146891 5.235177 4.327015 0.700821 0.595933 0.406356
54 N04 dish_maintenance 100.00% 0.00% 0.00% 0.00% 8.726357 3.057859 1.945864 3.041568 0.161909 0.539157 2.442168 0.983576 0.343324 0.371972 0.147327
55 N04 RF_maintenance 100.00% 100.00% 0.00% 0.00% 28.440884 -1.254904 7.695417 -1.382369 1.245399 -1.370525 0.681064 2.231635 0.038571 0.580109 0.438964
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.677261 0.038432 -0.610439 -0.107850 -0.149524 1.023835 -0.405355 0.062386 0.702375 0.591267 0.417322
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.649791 -0.530110 -0.546861 -0.782573 -0.091695 -0.522032 0.537848 0.508718 0.702776 0.600014 0.418229
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
59 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
60 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
61 N06 not_connected 100.00% 100.00% 86.98% 0.00% 6.589418 -0.819690 6.032591 -0.736592 1.149075 1.230787 -1.775153 -1.862495 0.021316 0.085066 0.055124
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% -0.543390 0.541411 0.475587 -0.149120 -0.040209 -1.182547 1.784775 -0.830012 0.565286 0.454002 0.380428
63 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.649392 2.861332 -1.314490 1.793554 -1.699552 0.787667 -0.032106 -1.938061 0.577948 0.410457 0.390695
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.039064 -1.065357 -1.066981 -0.664374 -0.849303 -0.696800 1.692830 0.598107 0.564130 0.425767 0.377493
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.297336 -0.575373 0.255900 -0.928357 0.663365 -0.432085 -0.159703 0.005575 0.674644 0.553006 0.419398
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.962627 -0.165180 0.359938 0.400449 0.561851 0.697402 -0.127036 0.481045 0.670243 0.569996 0.405835
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.940671 -0.072885 -0.583020 0.653059 -0.012878 0.958563 2.765706 0.968600 0.691375 0.586156 0.405781
68 N03 RF_ok 0.00% 0.00% 0.00% 0.00% 1.061129 -0.007419 1.099749 0.536796 1.168711 0.659382 1.218804 2.379669 0.699614 0.594091 0.404896
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.624857 -0.176621 0.379950 -0.209375 0.710965 0.242413 1.830120 0.782424 0.696190 0.594119 0.404641
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.120890 0.141268 1.858920 0.384462 1.528394 0.673524 0.675692 2.196490 0.689202 0.599571 0.403833
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.014346 -0.360107 -0.779396 -0.147820 -0.274809 0.254427 -0.437481 0.611229 0.708747 0.604353 0.414316
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.112982 -0.194194 -0.218111 -0.336101 0.178315 0.023223 0.578310 -0.055012 0.707585 0.607071 0.417587
73 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
74 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
77 N06 not_connected 100.00% 86.98% 86.98% 0.00% 8.565776 1.262010 -1.040920 -1.243599 1.139072 1.216783 -1.904767 -1.996465 0.070883 0.084597 0.043907
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 11.070406 0.353318 -0.222391 -0.032570 -1.204612 -1.088211 0.770403 -0.495884 0.445612 0.453260 0.284746
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.190559 -1.127840 0.288920 -1.536713 -0.202988 -1.363708 0.672125 -0.769803 0.677774 0.577721 0.412790
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.599580 1.599273 -1.067923 0.915260 -1.885937 -0.057002 -1.166075 -1.769783 0.682268 0.551044 0.424064
84 N08 RF_ok 0.00% 0.00% 0.32% 0.00% 0.977618 1.722671 0.352506 1.020582 -0.859416 0.031479 -1.537948 -1.319559 0.686582 0.551331 0.409317
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.771853 -0.926631 -1.476570 -1.011415 -1.361154 -0.643976 -0.995089 -0.493581 0.702323 0.604461 0.404251
86 N08 digital_ok 100.00% 100.00% 0.00% 0.00% 5.821559 -0.194296 9.807288 -0.025184 1.152973 0.207893 0.314516 8.262667 0.046747 0.606050 0.438174
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.580393 5.201381 1.531417 -1.135548 0.358916 -0.943194 56.375219 3.851406 0.593026 0.610523 0.328325
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.032235 0.195822 0.290384 0.786838 0.422145 0.581436 0.034669 0.118766 0.706276 0.606223 0.410917
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.195030 0.050954 0.330219 0.446286 0.571967 0.451911 -0.149395 -0.015616 0.711226 0.607173 0.418515
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.213394 0.001500 0.766599 1.199976 0.875739 0.675829 0.374476 0.968672 0.705869 0.601702 0.419402
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.179711 -0.185671 0.403847 0.078690 0.546520 0.162009 0.463137 0.032800 0.705946 0.603083 0.429141
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.649663 6.890811 11.216776 11.396441 1.144219 1.240748 3.075222 3.192072 0.022245 0.028186 0.003824
93 N10 RF_maintenance 100.00% 46.25% 94.00% 6.00% -0.078374 7.288795 -0.224989 11.529132 -1.152296 1.185878 -0.504750 3.592710 0.237191 0.052392 -0.053156
94 N10 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.114717 2.279403 0.463254 3.958955 0.903154 3.099329 1.321496 1.938397 0.643326 0.499038 0.412229
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.044987 -0.366880 -0.714015 -0.640435 -0.887081 -1.633882 -0.334225 -1.116827 0.681403 0.585344 0.411388
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.343447 11.269529 -0.182211 -0.378922 -1.432650 -1.262108 -1.473540 0.434097 0.687261 0.476630 0.396299
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.477313 0.025928 -1.025125 -0.604848 -0.796880 -0.798359 -0.422218 3.260029 0.679719 0.557509 0.417199
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.384551 2.517766 -0.291783 0.410893 0.124629 0.572445 -0.319920 0.109050 0.695452 0.581742 0.411069
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.365181 -0.149567 -1.402046 -0.902404 -0.953125 -0.446057 -0.773856 5.466571 0.704165 0.594919 0.410448
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.296834 1.451491 -1.482616 -0.097968 -1.114782 0.286287 0.348238 0.536623 0.701165 0.603242 0.401558
104 N08 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.740638 30.577222 2.790876 5.963231 1.394545 1.567389 2.057113 1.563561 0.702710 0.591793 0.415800
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.588617 -0.103025 -0.220448 0.457610 -0.074533 0.444314 0.029253 -0.030443 0.698911 0.605711 0.407048
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.459500 -0.282892 1.308271 -0.284820 0.887953 -0.106083 1.078588 -0.235373 0.705299 0.609281 0.416251
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.099240 0.322920 -0.662316 -1.181640 -0.442911 -0.853325 2.222784 1.924853 0.696227 0.602074 0.407271
108 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.825361 1.396661 -0.833904 0.223215 -0.584270 0.449112 -0.178902 0.383154 0.713274 0.605275 0.423462
109 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.260316 7.082934 -1.243891 11.272669 0.142694 1.238508 0.452924 2.504242 0.324401 0.032751 0.219903
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.403782 -0.801615 -0.776952 -0.764030 -1.282044 -0.340938 -0.535150 0.233718 0.526206 0.517289 0.318296
111 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.892187 0.984185 0.534935 0.909851 0.993527 1.186589 12.997035 1.586205 0.598506 0.512759 0.387440
112 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.662438 -0.371707 9.409370 -0.519458 -1.346003 -1.567172 1.296820 -0.713593 0.462389 0.506820 0.348281
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.601093 2.716302 1.481343 1.684244 0.399349 0.669622 -2.172161 -2.127255 0.676795 0.555624 0.409388
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.140330 -0.552561 1.129428 -1.548894 0.034002 -1.311165 -1.984046 -0.758670 0.665108 0.575702 0.403218
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.518717 -0.713531 -1.149525 -0.831438 -1.068550 -1.537107 -0.576686 -0.898475 0.672274 0.559959 0.409699
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.861311 0.146621 2.218344 -0.144788 1.680510 0.284136 1.771984 0.123623 0.693120 0.587553 0.409132
121 N08 digital_ok 100.00% 0.43% 0.00% 0.00% 1.437294 2.308184 0.578000 5.192330 -0.634444 1.717186 -0.662762 7.227142 0.674620 0.578649 0.406409
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.200620 1.501099 -0.613914 -1.397845 -0.123870 -1.062008 -0.351942 -0.822312 0.701904 0.606410 0.408139
123 N08 digital_ok 0.00% 0.00% 2.05% 0.00% 2.269382 1.313121 1.278212 0.221795 0.204644 -0.841559 -1.879469 0.837073 0.684250 0.539220 0.429106
124 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.882680 7.578960 11.385489 11.652328 1.155772 1.254568 1.317672 4.697939 0.039146 0.040843 0.003089
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.898609 -0.269441 2.850682 0.201528 1.560423 0.326684 1.154629 -0.056061 0.696116 0.600697 0.417537
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.086170 1.492241 0.251496 0.207727 0.226688 0.553376 1.742033 0.055112 0.707738 0.601709 0.424961
127 N10 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.239056 -0.143321 1.129395 -0.204512 1.362040 0.268037 1.484687 1.172236 0.632298 0.518906 0.403682
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.326773 -0.386859 0.166542 -0.601207 0.484478 -0.203541 2.182740 2.969368 0.638706 0.520155 0.405129
131 N11 not_connected 100.00% 0.00% 42.95% 0.00% -1.184976 6.783147 -1.267597 6.354706 -1.713368 0.595922 -1.073838 0.603166 0.698984 0.251898 0.494186
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.080226 -1.291879 -1.281463 -1.346369 -1.773542 -1.189325 -1.028163 -0.638967 0.691726 0.581850 0.404325
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.088968 -1.139038 -1.138067 -1.251432 -1.050448 -1.459471 -0.522515 -0.592985 0.682699 0.572888 0.408022
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.968518 1.917126 2.176220 1.052656 0.364840 -0.030806 5.085453 -1.874185 0.622215 0.540088 0.403746
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.001500 0.241738 -1.332660 0.568449 -1.704204 0.612525 -0.824677 0.624109 0.654192 0.525998 0.417966
136 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.866645 3.422876 -1.349696 0.302338 -0.653068 0.324222 -0.531489 2.023890 0.670038 0.523905 0.428967
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.479325 -0.813786 -0.320591 -1.484336 -1.574759 -1.230836 -1.314062 -0.106506 0.670950 0.549245 0.412271
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.713768 -0.047101 0.470137 0.138144 0.662886 0.457376 6.463652 3.175182 0.685776 0.581675 0.410228
141 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 6.058581 -0.285646 11.198093 0.067638 1.141450 0.451854 0.850006 -0.114542 0.062387 0.584611 0.474801
142 N13 RF_ok 100.00% 0.00% 0.00% 0.00% -0.369710 0.045050 0.149533 -0.215090 0.686993 0.193030 11.346780 2.548440 0.697221 0.589328 0.415451
143 N14 RF_maintenance 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.487367 0.264911 0.373640
144 N14 digital_ok 100.00% 99.95% 100.00% 0.00% 122.020686 122.030453 inf inf 795.220655 788.088469 4302.706493 4222.795466 0.519387 0.063143 0.471113
145 N14 digital_ok 100.00% 99.95% 99.95% 0.00% 110.462776 110.355725 inf inf 779.237427 782.409292 4076.865632 4144.084696 0.576005 0.617996 0.553478
146 N14 digital_ok 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.473693 0.522835 0.430990
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.351559 -0.042231 1.386379 0.600181 1.276044 0.856373 0.514657 0.211835 0.696176 0.588802 0.416735
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.260353 -0.049062 -0.078932 0.264557 0.454850 0.406835 -0.140218 0.161124 0.700040 0.588818 0.415587
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.371254 -0.351632 0.589322 -0.189629 1.183740 0.302940 0.250274 0.097168 0.698435 0.590675 0.415134
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.205196 -0.335262 0.226421 -0.104957 0.461226 0.244763 0.470156 -0.051765 0.694858 0.583457 0.410296
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.744399 -0.493576 -1.132114 0.516231 -1.025039 0.022383 -0.062754 5.285199 0.617116 0.573809 0.356088
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.255542 -1.375179 -1.149934 -1.238896 -1.097262 -1.015119 2.212531 -0.527654 0.687265 0.572603 0.407680
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 5.902973 -0.664079 6.154224 -0.883354 1.151909 -0.342311 1.036070 -0.279823 0.041392 0.559542 0.390699
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.013783 -1.122795 -1.127675 -1.497590 -1.712334 -1.377073 -1.028224 -0.673289 0.664620 0.546274 0.410573
155 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.654620 -1.488055 0.327399 -1.344197 -0.865777 -0.843565 -1.500334 0.003925 0.642297 0.526072 0.418706
156 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.883364 -0.167311 3.953269 0.255068 1.723972 0.393740 3.368109 -0.027619 0.651931 0.534633 0.415631
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.343311 -0.034882 0.092886 0.184169 0.454092 0.365819 -0.149945 -0.088639 0.670012 0.546001 0.419081
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.405253 -0.503305 -0.045500 -0.094130 0.533553 0.141713 2.302571 10.433591 0.678503 0.554467 0.422380
159 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.108782 1.459066 0.587387 -0.705871 -0.033098 -0.250387 -0.003925 0.167177 0.646338 0.518300 0.409582
160 N13 RF_maintenance 100.00% 99.95% 99.84% 0.00% 67.973417 67.623208 inf inf 803.309669 799.736981 4428.493880 4362.802589 0.223233 0.471211 0.393587
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.277479 16.054213 0.386552 -0.138754 0.805671 -1.151130 -0.074735 -0.308522 0.689800 0.464220 0.400888
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.645382 0.087375 -0.916891 0.069830 -0.322494 0.433271 4.403872 0.020346 0.699105 0.580104 0.426082
163 N14 digital_ok 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.542528 0.559977 0.515114
164 N14 digital_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.715311 0.610810 0.589183
165 N14 digital_ok 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.306638 0.162284 0.375791
166 N14 RF_maintenance 100.00% 99.95% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.208843 0.597916 0.514544
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.477828 0.042606 0.348000 0.296279 1.007456 0.558559 0.158485 1.703790 0.693697 0.580827 0.424418
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.494498 -0.492489 0.468196 -0.046222 0.931216 0.280312 0.283843 0.118710 0.693077 0.582717 0.414858
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 1.049874 5.740100 0.454661 0.026195 0.777058 -0.057566 0.126020 0.168168 0.691485 0.566143 0.411548
170 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 2.993984 0.166629 2.427467 0.518103 2.047931 0.648788 7.294741 0.205634 0.667312 0.575901 0.399470
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.550678 -0.359604 0.428184 0.540531 -0.012492 -0.008921 -0.092787 0.783740 0.677976 0.563126 0.401126
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.417242 -0.191535 -0.854283 -0.434144 -1.867016 -0.341467 -1.001707 0.210508 0.688067 0.563744 0.412622
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.596737 2.724383 1.461955 1.651993 0.399014 0.638217 -2.151151 -1.982093 0.654739 0.533279 0.406478
174 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 6.757208 7.818682 6.080835 6.103388 1.150394 1.244980 0.875388 0.464647 0.029171 0.029472 0.001346
175 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.629376 2.379534 0.688160 1.212453 -0.494938 0.250389 -1.805041 -1.597698 0.647023 0.506974 0.419881
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.445849 0.791739 0.586694 1.692953 0.737526 1.727350 0.005816 2.913424 0.670878 0.548954 0.421781
180 N13 RF_maintenance 100.00% 99.95% 99.84% 0.00% 77.468884 76.573624 inf inf 802.655566 790.397940 4411.498769 4202.654496 0.150280 0.378553 0.281407
181 N13 digital_ok 100.00% 99.95% 99.89% 0.00% 97.626547 97.563208 inf inf 820.554159 811.003766 4580.425660 4478.007497 0.214910 0.335998 0.380864
182 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -1.064212 6.953243 -1.131185 11.297014 -1.646042 1.231062 1.928893 2.149492 0.690883 0.046652 0.569712
183 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.744580 7.555533 0.100251 11.382593 0.467255 1.246216 0.376783 2.098595 0.686148 0.039722 0.554059
184 N14 dish_maintenance 100.00% 99.89% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.180935 0.513477 0.444996
185 N14 RF_maintenance 100.00% 99.95% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.322066 0.523382 0.413734
186 N14 digital_ok 100.00% 99.89% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.413243 0.692614 0.617223
187 N14 digital_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.404401 0.452150 0.412116
189 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.099330 1.874438 0.553460 1.083508 -0.640685 0.056612 -1.776523 -1.851959 0.668911 0.542559 0.408813
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.067622 -0.663706 0.100862 -0.474200 0.505553 -0.156834 0.280905 -0.132527 0.694683 0.584985 0.410648
191 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.259360 0.175666 0.446358 0.922686 0.867336 0.888616 2.373088 0.494086 0.685360 0.571364 0.406686
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.748007 2.935940 1.605738 1.815770 0.554016 0.809290 -2.187029 -2.200102 0.655964 0.534690 0.402942
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.838286 2.476944 1.653402 1.530828 0.598380 0.546337 -2.215350 -2.119400 0.649419 0.531326 0.403339
194 N16 digital_maintenance 100.00% 100.00% 0.00% 0.00% 6.107183 -0.913615 5.525547 -1.199074 1.141613 -1.654980 0.477641 -0.841276 0.035742 0.548845 0.437074
195 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.890796 0.350651 0.823483 -0.407082 -0.320194 -1.412480 -1.907726 -1.316067 0.645127 0.530409 0.414263
200 N18 RF_maintenance 100.00% 99.95% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.371571 0.662088 0.404564
201 N18 RF_maintenance 100.00% 99.78% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.496617 0.566468 0.436167
202 N18 digital_ok 100.00% 99.84% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.375837 0.341728 0.233204
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.734181 5.878159 0.340410 -0.340565 0.652073 0.075373 1.626063 0.972364 0.687811 0.569994 0.429398
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.938097 1.254633 4.271117 1.950648 -1.383066 0.072312 1.660452 7.062566 0.565164 0.535308 0.401271
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.722122 0.296324 1.650335 1.307650 0.572125 0.070518 0.493025 0.939845 0.647765 0.542366 0.404197
207 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.948805 0.590421 1.694839 0.922915 0.667945 0.085266 -2.224179 0.124831 0.645698 0.552872 0.406096
208 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 2.274433 4.846756 6.672693 11.925233 1.065825 1.502191 1.388502 62.717466 0.667374 0.035638 0.576551
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 3.282402 3.873909 10.718715 10.771525 1.110526 1.253200 16.651640 18.000865 0.029673 0.032357 0.000602
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.221784 4.329164 0.003161 0.110902 0.369706 0.333707 0.050573 -0.048257 0.700673 0.581852 0.410000
211 N20 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.391987 7.060677 -0.335652 6.515676 -0.371493 1.248410 0.035050 1.973796 0.673635 0.037923 0.573325
213 N16 digital_maintenance 100.00% 0.00% 92.06% 0.00% 2.468384 7.901672 1.396972 6.227051 0.318613 1.111699 3.348170 1.311566 0.642725 0.110752 0.538607
214 N21 not_connected 100.00% 100.00% 0.00% 0.00% 6.372831 0.267698 6.193950 -1.321879 1.146113 -1.252004 0.802530 0.884011 0.043284 0.521042 0.457362
220 N18 RF_maintenance 100.00% 99.89% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.288885 0.379573 0.254962
221 N18 RF_ok 100.00% 99.84% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.443398 0.319119 0.401818
222 N18 RF_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.486016 0.366359 0.378683
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.234845 -1.159555 -0.612050 -0.598495 -0.675458 -0.377148 -0.463630 0.608481 0.676922 0.553503 0.421065
224 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.079966 2.771962 1.848716 1.760098 0.810100 0.761668 -2.249261 -2.166814 0.647666 0.528679 0.407110
225 N19 RF_maintenance 100.00% 0.00% 72.34% 0.00% -0.133546 6.424444 -0.511946 6.114464 -1.753805 0.727580 -1.399268 1.564197 0.689709 0.209867 0.552754
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.278215 4.933549 -1.536290 -0.783784 -1.319900 -0.972701 -0.807896 -0.963715 0.688747 0.494344 0.416184
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 0.442427 -1.248819 0.595153 -1.416592 -0.028527 -1.272332 13.694999 7.231423 0.670511 0.568407 0.411184
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.270653 -0.967367 -0.990196 -1.078560 -1.917285 -1.079415 0.259233 0.296305 0.679699 0.561228 0.410002
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.017265 0.309261 -0.652345 -0.064188 -1.833350 -1.086468 -0.933664 -1.520607 0.680406 0.555618 0.417473
237 N18 RF_ok 100.00% 99.84% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.506510 0.467123 0.445479
238 N18 RF_ok 100.00% 99.89% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.664776 0.610099 0.352606
239 N18 RF_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.348797 0.331909 0.328897
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.186472 -1.024256 -1.277909 -1.466923 -1.156845 -1.536669 0.748001 -0.548635 0.675412 0.551447 0.427082
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.255206 -1.026488 -1.365513 -0.933534 -1.458682 -1.552403 -0.352362 -1.164754 0.681581 0.554838 0.427151
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.339152 -0.554457 -1.132612 -0.821486 -1.167927 -1.704345 -0.068406 -1.076157 0.594100 0.557586 0.370205
243 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.545358 -1.437178 -0.022762 -1.306796 -1.225682 -1.075383 -1.178490 -0.537687 0.678809 0.557520 0.417172
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.538979 -0.147231 -0.413189 0.410767 -0.451785 0.688110 0.580218 1.732001 0.671474 0.544177 0.414639
245 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.363842 -1.016920 -0.790736 -1.497070 -1.873286 -1.154890 -1.290255 0.866491 0.681631 0.556649 0.414982
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 1.926281 7.226841 3.353984 6.097882 -0.912287 1.238442 1.628518 1.321539 0.586857 0.036097 0.495626
261 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.419810 -0.634860 -0.870265 -1.123358 -1.832883 -1.666824 1.946430 -0.997249 0.670726 0.542933 0.418771
262 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.994840 5.797535 -0.611098 0.016633 -0.069796 0.379006 -0.317287 0.661043 0.668196 0.547848 0.420806
320 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.710327 -0.701192 -1.223700 -1.431344 -1.086523 -1.195883 -0.550059 0.830350 0.593521 0.427398 0.394447
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.884199 1.217754 -0.298118 0.022762 -1.378935 -0.883739 -1.245846 -1.460027 0.567722 0.403288 0.378789
325 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.148985 -1.392281 -0.435401 -1.252809 -1.572074 -1.209703 -1.381666 -0.492136 0.603548 0.447149 0.401036
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.592837 7.127323 6.171548 6.561034 1.154341 1.254640 1.271419 1.632557 0.038137 0.036172 0.002052
332 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.524579 1.777138 0.369082 0.617590 -0.830214 -0.494123 -1.387211 -1.605111 0.572399 0.415857 0.386844
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 0.208162 -0.299506 0.653879 -0.998164 -0.064467 -0.805938 2.745289 0.409150 0.547501 0.408999 0.365712
336 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.124631 2.558989 -0.469391 -0.596491 -1.489223 -0.641470 0.887674 0.560794 0.550525 0.330817 0.374209
340 N21 not_connected 0.00% 0.00% 0.00% 0.00% 2.811626 2.266571 1.336610 0.999898 0.295256 0.030504 -2.019685 -1.865587 0.539965 0.391623 0.364129
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 5, 7, 15, 17, 18, 22, 27, 28, 29, 31, 32, 34, 37, 38, 40, 42, 43, 44, 45, 46, 47, 51, 53, 54, 55, 58, 59, 60, 61, 73, 74, 77, 78, 84, 86, 87, 92, 93, 96, 102, 104, 109, 110, 111, 112, 121, 123, 124, 131, 134, 140, 141, 142, 143, 144, 145, 146, 151, 153, 158, 160, 161, 162, 163, 164, 165, 166, 169, 170, 174, 180, 181, 182, 183, 184, 185, 186, 187, 194, 200, 201, 202, 204, 205, 208, 209, 210, 211, 213, 214, 220, 221, 222, 225, 226, 227, 237, 238, 239, 242, 246, 262, 329]

unflagged_ants: [3, 8, 9, 10, 16, 19, 20, 21, 30, 35, 36, 41, 48, 49, 50, 52, 56, 57, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 79, 80, 85, 88, 89, 90, 91, 94, 95, 97, 101, 103, 105, 106, 107, 108, 113, 114, 115, 120, 122, 125, 126, 127, 128, 132, 133, 135, 136, 139, 147, 148, 149, 150, 152, 154, 155, 156, 157, 159, 167, 168, 171, 172, 173, 175, 179, 189, 190, 191, 192, 193, 195, 206, 207, 223, 224, 228, 229, 240, 241, 243, 244, 245, 261, 320, 324, 325, 332, 333, 336, 340]

golden_ants: [3, 9, 10, 19, 20, 21, 30, 41, 56, 62, 65, 66, 67, 69, 70, 71, 72, 85, 88, 91, 101, 103, 105, 106, 107, 122, 128, 147, 148, 149, 150, 152, 154, 157, 167, 168, 171, 172, 173, 189, 190, 191, 192, 193, 320, 325]
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_2460128.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.1.1.dev3+gb291d34
3.2.3.dev158+gd5cadd5
In [ ]: