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 = "2459987"
data_path = "/mnt/sn1/2459987"
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: 2-11-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/2459987/zen.2459987.21285.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/2459987/zen.2459987.?????.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/2459987/zen.2459987.?????.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 2459987
Date 2-11-2023
LST Range 3.969 -- 13.931 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 25
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 58 / 198 (29.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 118 / 198 (59.6%)
Redcal Done? ❌
Never Flagged Antennas 80 / 198 (40.4%)
A Priori Good Antennas Flagged 52 / 93 total a priori good antennas:
3, 7, 15, 16, 19, 20, 29, 30, 37, 38, 40, 42,
45, 53, 54, 55, 71, 72, 81, 85, 86, 94, 101,
103, 109, 111, 121, 122, 123, 128, 136, 144,
147, 148, 149, 151, 158, 161, 162, 165, 170,
171, 173, 181, 182, 185, 187, 189, 191, 192,
193, 202
A Priori Bad Antennas Not Flagged 39 / 105 total a priori bad antennas:
4, 8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
82, 89, 114, 115, 120, 125, 126, 132, 133,
135, 137, 139, 166, 179, 222, 226, 228, 229,
237, 238, 239, 241, 245, 261, 324, 325, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459987.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% 9.873177 13.500845 9.828621 10.662675 6.319746 7.940419 0.727201 1.651845 0.029894 0.032569 0.003230
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.868539 -0.214669 2.389533 -0.070471 1.737525 -0.290356 0.302515 -1.454390 0.585065 0.613977 0.395184
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.162470 -0.437436 0.198739 0.272319 0.344024 1.582264 0.126563 0.002427 0.607393 0.611762 0.379832
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.914254 -0.084254 -1.228918 -0.130954 0.456950 0.403829 12.062229 12.394039 0.615169 0.627433 0.375031
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.192297 -1.440304 -0.522707 0.208287 -0.067664 0.670322 1.127472 1.844171 0.614847 0.625526 0.372719
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.013386 -0.626555 3.012221 -0.950235 -0.472953 0.010095 1.327892 -0.790130 0.588977 0.628140 0.386364
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.816325 -0.328004 1.120328 -1.220814 0.595746 0.758029 -1.568942 -0.393412 0.604031 0.622277 0.373440
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.113280 13.242327 9.260927 10.073327 6.337237 7.954481 0.538220 1.155436 0.027230 0.026378 0.001488
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.128066 -0.728777 9.797077 0.794521 6.327234 1.771893 0.755795 1.629786 0.032976 0.622425 0.501411
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 1.339557 1.607149 0.465332 0.562157 0.630919 0.967787 -0.040350 0.702232 0.616352 0.630813 0.380702
18 N01 RF_maintenance 100.00% 100.00% 49.49% 0.00% 10.778859 17.586716 9.785501 -0.111182 6.421602 4.607104 0.615140 20.631718 0.029499 0.227523 0.172808
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.164215 1.426713 -1.028265 -1.351763 -0.263673 42.764457 -0.605596 2.971281 0.624543 0.629598 0.373004
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.397110 -1.532272 1.058951 -0.762239 7.784754 -0.351013 0.844914 -0.754430 0.617243 0.634989 0.372935
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.266141 0.255620 -0.619218 0.175873 0.387146 1.412482 0.137151 0.180979 0.612379 0.617774 0.367602
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.571782 -0.410804 0.350710 -0.107153 0.495137 0.856874 -0.227010 -0.679352 0.584450 0.598958 0.367963
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.488319 12.566610 9.838097 10.468336 6.405015 7.994966 2.392497 2.188294 0.034650 0.038149 0.004414
28 N01 RF_maintenance 100.00% 0.00% 85.85% 0.00% 9.750689 25.066502 -0.080547 3.135188 5.132030 5.545451 3.332426 22.858606 0.367930 0.158051 0.268512
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.165210 13.023057 9.452410 10.088421 6.397936 7.985347 0.580332 0.509502 0.029653 0.036795 0.007166
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.513791 0.113514 0.679294 -1.330173 4.039883 0.479490 1.853986 0.111260 0.618877 0.648122 0.380586
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.802843 -1.363475 0.992236 0.616637 1.015564 -0.299685 -0.115745 0.019814 0.636545 0.644267 0.371463
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.782914 26.529180 0.411301 3.328758 5.731185 1.068200 3.343332 4.258585 0.578957 0.523059 0.301109
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.675442 14.207623 4.515026 5.035365 6.402073 7.973636 2.882945 2.948024 0.035687 0.045600 0.006788
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.862421 -0.986712 1.343432 -1.233152 1.059742 -0.723704 0.433797 1.000617 0.595410 0.590753 0.364448
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 25.862520 26.492850 12.959316 13.114866 6.440103 7.877463 5.448925 5.749940 0.032898 0.030602 0.001647
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.182744 0.374585 -1.116464 0.914174 2.103617 1.641744 0.900010 4.921604 0.616226 0.620568 0.392643
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.317197 -0.078388 0.310857 0.736502 0.287114 0.802403 5.910790 2.475566 0.621109 0.617504 0.387176
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 9.514758 0.391181 9.479685 0.721852 6.387683 -0.355458 1.388345 0.305915 0.038823 0.622579 0.475849
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.406211 0.262117 -0.136606 0.204043 1.269696 0.482556 0.039213 0.440959 0.620049 0.638484 0.369213
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.297078 2.648585 -1.278213 8.346006 1.043464 2.361924 0.294609 1.694650 0.639412 0.535447 0.408931
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.160480 -0.063627 -0.253604 0.780305 3.387341 0.797126 0.723869 1.550078 0.634589 0.641643 0.370675
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.730362 0.163476 -1.112887 0.275494 -0.455326 0.798203 0.032872 0.357663 0.636765 0.651589 0.371568
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.010036 2.168077 0.276562 0.869148 -0.445864 1.788101 0.560239 17.871980 0.627989 0.635264 0.366649
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.861492 0.023572 -0.758738 -1.042251 -0.266246 -0.014071 0.115544 -0.275789 0.630184 0.650526 0.381579
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.918473 13.855115 4.421545 4.668217 6.408348 7.924481 5.151369 3.041934 0.031526 0.054329 0.016008
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.134490 0.814139 -0.230716 1.507241 -0.801897 1.506969 0.505154 -0.669629 0.595586 0.618143 0.375669
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.298655 -0.132487 -0.799150 0.166178 0.195524 -0.178204 1.682981 1.924559 0.556447 0.596178 0.374080
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.829533 2.252112 0.378435 1.105637 0.036990 1.292747 12.372361 15.295593 0.588863 0.595225 0.371223
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 9.860834 4.160895 0.142020 1.873290 3.748032 3.355355 44.607472 0.743372 0.502341 0.511349 0.251089
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.976505 6.378900 -0.436167 0.702270 0.679342 1.074496 1.742371 2.388211 0.624474 0.631765 0.383046
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.007263 2.818602 -1.352130 -1.235830 0.592725 5.225466 2.137346 3.762240 0.636571 0.644582 0.386705
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 26.678220 -0.687220 4.572733 -0.536768 1.313859 0.233636 4.012980 1.821976 0.459278 0.646135 0.373880
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.417264 13.893612 9.866919 10.597121 6.414008 7.977142 2.311373 4.547223 0.028296 0.031779 0.003241
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.548140 0.441812 -0.615209 1.517149 -0.531678 1.361676 -0.443417 0.040181 0.630542 0.652306 0.369143
57 N04 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.347093 -0.553712 9.624468 -1.371263 6.227019 0.066658 2.211597 1.668455 0.046778 0.652674 0.506608
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.501118 12.957261 9.738802 10.584951 6.372723 7.960224 3.750279 3.660393 0.036879 0.036603 0.001864
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.613305 0.664340 9.799388 1.284395 6.257127 2.354151 2.353085 6.886320 0.046244 0.638898 0.498162
60 N05 RF_maintenance 100.00% 0.00% 98.00% 0.00% 0.060122 12.875711 -0.466460 10.613143 -0.013115 7.928339 6.699752 3.585369 0.630005 0.076473 0.504705
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.788767 -0.125002 -0.319842 -1.124855 0.904975 -0.874266 1.134639 2.419815 0.574795 0.608412 0.366108
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.169623 0.795114 -0.757448 0.971465 1.276854 -0.159565 1.480858 -0.476327 0.574280 0.615897 0.375442
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 1.203026 13.412502 -0.324345 5.064483 -0.318756 8.026254 0.747752 4.322000 0.588648 0.045550 0.465296
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.254204 0.004332 -0.678139 -0.700589 -0.970438 -0.851019 0.725391 0.335022 0.584875 0.577077 0.359154
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.216600 1.333061 0.579834 1.181248 -0.262557 0.862222 -0.407270 0.008938 0.599196 0.615136 0.392709
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.126094 1.532421 -1.346781 -0.875264 1.650263 -0.131354 -0.437924 0.745485 0.619388 0.632867 0.391525
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.405044 -0.653386 -0.713982 0.732240 -0.399022 0.760437 0.912788 2.431623 0.628384 0.632239 0.379130
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 18.492557 27.169762 0.910371 13.779504 4.099410 7.875864 1.357575 11.273360 0.372450 0.030854 0.278250
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.965964 -0.507818 0.436600 0.927582 -0.501146 1.805013 0.698046 1.022195 0.627985 0.646123 0.366988
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.841743 -0.369009 -0.166418 0.169980 0.908629 1.329170 2.102865 2.055385 0.638676 0.653217 0.366667
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.074930 -0.276661 0.641474 1.219802 0.132542 0.293585 0.972534 1.133904 0.632582 0.657963 0.365705
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.540833 14.106145 10.198986 10.963987 6.257465 7.820383 1.273009 1.818103 0.035420 0.038752 0.004574
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.403297 0.781415 -1.306071 -0.661291 0.962514 -0.024333 1.134672 0.728598 0.646280 0.657473 0.367927
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.478053 0.119238 -0.034688 -0.399727 -0.206639 1.309626 0.219750 4.533075 0.644076 0.651782 0.367423
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 51.962875 12.723302 0.444674 -0.276593 5.097496 1.879296 1.734070 2.904085 0.360463 0.554270 0.346607
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 30.644557 0.647038 -0.377908 1.278273 1.554610 0.563786 -0.179595 0.287633 0.436422 0.624820 0.368055
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 0.808813 13.639893 -1.357269 5.074069 -1.009814 7.884074 -0.276962 -0.070507 0.589016 0.040798 0.460889
80 N11 not_connected 100.00% 0.00% 99.51% 0.00% -0.599215 14.499850 0.335945 4.982958 -1.075300 7.906972 -1.344148 1.421590 0.601789 0.052137 0.470404
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.314331 13.702395 0.125890 9.267065 0.104397 7.736835 0.604786 2.929452 0.578496 0.039772 0.441168
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.577265 -0.307823 0.469284 2.288912 -0.006638 -0.712701 0.700632 1.219441 0.600578 0.603761 0.373425
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.043654 0.219285 0.270790 0.591061 0.614347 0.570299 0.995640 2.005306 0.614697 0.621618 0.373628
84 N08 RF_maintenance 100.00% 69.42% 100.00% 0.00% 19.230552 24.161855 12.523174 13.343741 5.114549 7.859349 4.577065 5.389070 0.206656 0.037148 0.130632
85 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.199008 0.743486 0.391384 0.856802 5.023252 0.448777 -0.017047 0.359425 0.628842 0.641899 0.366966
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.268162 -0.162217 1.026875 1.208498 1.295236 -0.195369 0.168886 19.652791 0.617843 0.639340 0.352575
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.560880 7.573317 -0.088455 0.097217 8.535840 1.967049 12.397368 1.375787 0.599226 0.663666 0.352246
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.243761 0.231930 0.405142 0.990637 -0.366466 -0.819042 -0.120415 -0.424606 0.638290 0.653621 0.359202
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.844781 0.370613 0.197147 1.049242 -0.758837 -0.201197 -0.417329 -0.087551 0.638944 0.654884 0.360602
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.301134 -0.173274 -0.737325 -1.388251 2.687858 6.796941 -0.241351 5.096029 0.643113 0.660632 0.368159
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.672398 -0.269075 0.490106 0.544970 -0.384129 -0.146920 -0.468781 -0.286986 0.624592 0.647599 0.367919
92 N10 RF_maintenance 100.00% 0.00% 17.83% 0.00% 32.419295 39.488249 0.488137 1.728107 4.065137 3.591663 0.220663 9.000046 0.295867 0.257581 0.068115
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.499116 0.318381 2.337262 -0.942214 0.342533 0.531115 3.838632 -0.495089 0.621088 0.642050 0.378185
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.881929 13.352732 9.977598 10.483824 6.370739 7.928872 0.940326 0.925035 0.032722 0.026622 0.003061
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 6.600418 3.676216 -0.747653 0.657439 0.189548 0.239865 -0.142090 -0.407404 0.548912 0.591382 0.346481
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 4.401063 19.522256 3.549614 1.509646 2.627410 2.050454 -3.349587 -1.881287 0.601428 0.508282 0.354454
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.270469 4.457694 -0.610577 1.207272 -0.808522 1.335436 -0.946795 7.824358 0.586401 0.547106 0.368120
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.789426 7.606398 -0.282403 1.287493 0.267297 1.358621 -0.230351 -0.220919 0.631786 0.638579 0.369751
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.995751 0.779330 -0.704945 -1.270371 -0.133132 0.387027 -0.912991 4.668296 0.636812 0.652968 0.369805
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.664609 3.406466 3.591609 -1.279412 3.070143 1.147010 -3.442047 2.160097 0.627795 0.650766 0.361876
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.827809 58.516281 -0.764033 7.027324 0.578827 -0.284752 0.758865 0.521978 0.646845 0.630703 0.362974
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.484832 -0.130768 0.212204 1.088394 0.718910 -0.216213 -0.388487 -0.296588 0.644928 0.654938 0.358129
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.753445 -1.057753 -1.128223 -0.242636 -0.576957 -0.968465 -0.213919 -0.271779 0.644864 0.644992 0.354192
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 2.479085 0.933774 -0.564312 -0.820285 0.226335 -0.045946 3.112749 2.732076 0.636487 0.659235 0.360995
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.025405 40.613472 9.784654 1.126931 6.387764 3.097431 1.855988 2.352122 0.034878 0.293997 0.161962
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.831044 12.968804 9.819990 10.356207 6.427632 7.987203 0.311290 2.022822 0.026311 0.030212 0.002369
110 N10 RF_maintenance 100.00% 11.35% 0.00% 83.90% 14.920585 9.172135 10.588559 5.195435 2.610526 8.213184 2.693735 1.050374 0.173757 0.281770 -0.185792
111 N10 digital_ok 100.00% 0.00% 98.00% 0.00% 32.973823 12.785210 1.080876 10.443937 1.292093 7.984577 1.551138 2.371465 0.488215 0.068320 0.318384
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.995061 -0.738556 0.282661 0.374838 0.528003 1.694115 0.534992 -0.018932 0.623808 0.631386 0.381905
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.854300 14.233273 4.161593 5.069705 6.283483 7.861719 1.677790 0.762153 0.036714 0.031304 0.002923
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 3.760000 0.550386 0.343147 -0.211314 2.362002 -0.893401 -0.571693 -0.448240 0.572820 0.606588 0.372729
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.215265 -0.932927 -1.011617 0.061019 -0.839551 -0.822781 -0.740969 -1.534922 0.569794 0.598322 0.380282
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.860095 14.482356 9.901541 10.934780 6.299948 7.935818 2.395676 5.432501 0.028156 0.032970 0.003182
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.288411 1.364849 -0.000608 0.761594 -0.294885 0.610262 -0.012017 0.594506 0.611569 0.627650 0.381024
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.442406 1.218477 2.707867 -0.783273 0.119149 -0.248063 2.196934 0.323290 0.623232 0.651347 0.372670
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.095646 2.834264 -1.225295 6.484850 0.330725 1.665626 5.917722 18.346305 0.644922 0.624517 0.360365
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.305015 6.765879 -1.116736 -1.107557 0.044139 0.669222 -0.392371 -0.551189 0.646712 0.663487 0.365068
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.320431 8.757776 0.803801 1.212127 0.436109 0.719319 -0.235421 0.648857 0.653285 0.663617 0.366397
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.344579 0.095908 0.207524 0.816860 -0.291051 0.470652 0.925632 0.416557 0.651172 0.660290 0.366384
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.262661 -0.944873 0.166147 1.096857 -0.469401 -0.790833 -0.540998 -0.445336 0.643758 0.650878 0.362755
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.238501 0.438017 -0.861282 1.170279 0.750557 0.174010 3.651964 -0.344070 0.645371 0.650470 0.366144
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.698329 0.377131 0.562425 0.670843 1.720886 1.608178 -0.389402 0.003612 0.636557 0.656392 0.377470
128 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -0.126189 -0.410380 -1.273151 -0.374508 -0.710724 0.092000 -0.272647 6.034825 0.643017 0.652497 0.384040
131 N11 not_connected 100.00% 0.00% 12.64% 0.00% -0.250321 12.833213 -0.010642 4.962346 -0.960167 7.011113 -1.229156 0.036532 0.604157 0.270911 0.418224
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.972076 0.228336 -0.211240 -1.310179 -0.542778 -0.652055 -0.853090 -0.013743 0.591815 0.597628 0.367002
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.004332 -1.412450 -1.292553 -0.557766 -0.826977 -1.040784 -0.441199 1.927288 0.570606 0.601491 0.383216
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.292669 14.245540 4.300848 5.037018 6.302125 7.896352 0.411853 1.187381 0.041127 0.035279 0.003183
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.629717 -1.099812 -0.994783 -1.412514 3.113228 0.681541 1.096252 -0.002427 0.581032 0.610058 0.396734
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 9.145320 -0.337375 9.421753 -0.590823 6.418315 0.375380 1.579876 -0.560062 0.042547 0.607570 0.457575
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.314502 -0.676583 0.135531 -1.402342 1.236563 0.021250 0.933177 2.109878 0.594095 0.623061 0.383707
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.333949 1.417755 1.447912 -1.085154 -0.081421 -0.355512 -1.942236 -1.010282 0.620470 0.616333 0.363086
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.034501 -0.937608 -0.766214 -0.348363 -0.641192 -0.957226 3.084662 2.510098 0.637071 0.651982 0.366898
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.463807 -0.717750 -0.252882 0.439423 1.498104 -0.734981 -0.345369 -1.576863 0.635978 0.657931 0.365407
142 N13 RF_maintenance 100.00% 0.00% 99.46% 0.00% 1.721564 12.920023 -0.706702 10.618807 1.842219 7.979937 17.181857 2.534595 0.643036 0.048363 0.525828
143 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.274535 -0.580630 -1.345202 -0.409856 -0.431798 0.698996 -0.386303 -0.429979 0.649281 0.659245 0.368281
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.554852 6.645771 -1.090577 9.400950 0.125937 9.848070 -0.828276 1.799303 0.651699 0.423993 0.446234
145 N14 RF_maintenance 100.00% 98.54% 100.00% 0.00% 10.262699 13.046457 9.787055 10.646436 6.194673 7.978299 0.510932 3.792566 0.076403 0.030865 0.034464
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.605628 0.352480 -0.861097 0.329660 -0.856961 -0.010153 -0.792942 -1.885073 0.619058 0.641270 0.366063
147 N15 digital_ok 100.00% 93.57% 93.46% 0.00% 187.522815 187.346905 inf inf 2253.911778 2268.475644 7437.160968 7348.517979 0.437888 0.429940 0.404360
148 N15 digital_ok 100.00% 93.08% 93.95% 0.00% nan nan inf inf nan nan nan nan 0.497150 0.459158 0.372843
149 N15 digital_ok 100.00% 93.95% 94.33% 0.00% 240.879383 240.818764 inf inf 1968.504582 2003.208327 7869.886912 7678.308313 0.399636 0.409460 0.389240
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.082137 2.760510 -1.100396 -1.294429 -0.542803 -0.329300 0.072970 0.424604 0.628682 0.621025 0.380988
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 23.785288 0.954672 -0.305695 0.695764 1.739329 -0.705589 0.459180 0.574065 0.472218 0.571432 0.333294
155 N12 RF_maintenance 100.00% 99.57% 0.00% 0.00% 9.806463 -1.037759 9.576143 -1.077304 6.430232 -0.052513 2.281730 1.661760 0.044290 0.610308 0.467528
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.219743 12.631734 7.504429 10.368511 3.478798 8.014167 1.527689 2.388913 0.462188 0.039807 0.359829
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.533780 -0.290271 0.008719 0.740670 -0.208771 0.678660 -0.427428 0.115731 0.600429 0.621183 0.380696
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.221112 -0.620194 -0.126913 -0.004073 1.451307 1.358559 2.983701 18.096814 0.613396 0.632610 0.379603
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.424738 27.335078 -1.383706 -0.571282 -0.832162 2.832640 -0.150900 6.424853 0.586959 0.499190 0.340542
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.463662 -1.058429 -0.455112 -0.533924 -0.313577 1.005060 -0.832619 0.889804 0.628540 0.645543 0.370938
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.658559 28.919864 0.081660 -0.281705 0.257580 0.812559 0.111346 1.358406 0.634558 0.519147 0.338122
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.401571 -1.124393 0.027781 -1.199063 1.716899 0.805475 4.428769 -0.382556 0.647642 0.659439 0.368652
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 1.059380 1.410950 -0.102442 0.625303 0.123833 0.756921 0.278780 2.310549 0.645882 0.657239 0.370715
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.094962 -0.058462 -0.210594 1.507157 1.637801 1.157659 -0.235763 1.205877 0.641926 0.645613 0.362478
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 29.172890 0.458571 -0.438860 -0.594763 2.229127 0.138075 2.447918 -0.421763 0.516334 0.654425 0.364586
166 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.726880 2.866646 -1.302591 2.788667 0.006775 3.356853 0.718878 -2.354971 0.626356 0.640028 0.365280
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.268681 -1.117483 -1.401807 -0.792062 0.867064 -0.237891 -0.680479 1.367079 0.634789 0.647788 0.377950
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.917900 -1.376139 0.237577 -0.196980 1.091285 0.475131 -0.401563 0.350853 0.629252 0.637900 0.384564
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.329123 -0.872014 -0.843369 -1.396879 0.443482 0.457686 -0.835282 -1.057779 0.630210 0.642802 0.387758
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.804889 -0.665325 10.090676 -0.511393 6.294987 2.602456 3.958569 7.569885 0.042349 0.637748 0.500314
171 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 0.736103 1.667590 -1.001755 0.588762 -0.821312 1.579089 0.498397 5.633868 0.574107 0.561367 0.353937
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 12.026478 13.417325 3.904754 4.698766 6.505071 8.033250 4.765124 7.770903 0.037852 0.043729 0.004265
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.191954 -0.937173 -0.818438 -0.975717 0.193086 2.042605 -0.572610 -0.552283 0.609520 0.631888 0.381086
180 N13 RF_maintenance 100.00% 0.00% 99.30% 0.00% -0.238933 13.588147 -1.391195 10.749132 0.899097 7.905734 15.280766 2.844933 0.629320 0.054011 0.524163
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.604778 -0.037659 0.999037 0.788431 0.071885 -0.170710 -0.519345 4.927359 0.630652 0.643591 0.375328
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.169927 12.638774 -1.381799 10.345162 15.496596 8.017265 4.431810 2.594379 0.640685 0.048591 0.492372
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.746139 -0.345106 -0.628342 0.360861 1.010737 0.062983 0.701422 -0.163608 0.632027 0.646191 0.364576
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.549082 -0.689518 -0.892468 -0.133463 -0.563703 0.006638 -0.490258 -0.063976 0.644872 0.651450 0.363352
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 26.598153 -0.169433 0.095535 -1.060290 7.767140 0.347679 10.875595 0.031952 0.540944 0.652015 0.363694
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 2.723868 -0.786831 0.457209 -0.370997 -0.714079 -0.882798 -0.832412 -0.693165 0.621546 0.653629 0.376824
187 N14 digital_ok 100.00% 34.63% 0.00% 0.00% 8.732993 -1.015053 9.258594 -0.379138 4.849517 0.846085 1.112854 0.368308 0.242287 0.645518 0.466789
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.063728 12.497105 9.407379 10.465866 6.425106 8.041072 4.455397 3.388174 0.028486 0.032234 0.001709
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.211678 -1.424702 -0.593173 0.184708 0.011847 -0.693206 -0.546882 -1.353125 0.623384 0.639764 0.390345
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 0.380255 -0.273570 1.330761 -0.291250 -0.322469 0.530179 6.293521 0.405763 0.599563 0.619476 0.381511
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 3.828031 6.385222 3.282710 4.266479 11.885905 6.286781 -0.947902 -3.733046 0.584428 0.573466 0.374723
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.068682 0.405098 4.646431 0.974506 4.908259 0.779671 -3.946446 0.059378 0.556925 0.590123 0.393751
200 N18 RF_maintenance 100.00% 100.00% 64.45% 0.00% 11.684528 37.776006 4.301443 -0.104836 6.458004 3.885554 2.229438 12.194998 0.041758 0.213952 0.143062
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.617830 4.629191 2.924737 3.713049 2.056438 5.306905 -1.273252 -3.192181 0.612004 0.612675 0.368549
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.475552 3.454579 1.523143 -1.289557 0.287472 -0.341958 -0.655326 34.793735 0.623338 0.611600 0.365169
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.683172 15.348108 1.236350 -0.943067 -0.433297 0.816038 17.483123 2.747577 0.621552 0.647525 0.377075
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 9.486414 1.184444 3.277788 -1.338652 4.956093 -0.833110 0.382339 4.626873 0.311774 0.613405 0.453452
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.525473 5.568688 -0.788316 2.383871 2.552718 2.356491 -0.730977 0.171758 0.576880 0.505252 0.370764
207 N19 RF_ok 100.00% 93.19% 93.14% 0.00% 158.339932 158.911148 inf inf 2731.189098 2733.674982 7619.362193 7551.329015 0.430545 0.473608 0.410613
208 N20 dish_maintenance 100.00% 93.68% 93.95% 0.11% nan nan inf inf nan nan nan nan 0.453736 0.429226 0.374646
209 N20 dish_maintenance 100.00% 94.44% 94.17% 0.05% nan nan inf inf nan nan nan nan 0.406182 0.426600 0.360093
210 N20 dish_maintenance 100.00% 93.41% 94.11% 0.00% nan nan inf inf nan nan nan nan 0.499113 0.424984 0.339090
211 N20 RF_ok 100.00% 0.00% 0.00% 0.00% -0.130315 5.754463 -1.319246 -0.263444 -1.083173 -0.307728 -0.286452 0.394579 0.571876 0.568885 0.359560
220 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.275868 -0.877382 0.480807 -0.521095 -0.895363 -0.989896 4.717751 -1.122993 0.612981 0.614761 0.368002
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.747243 -0.545981 -0.601196 -0.849628 7.905678 -0.923788 4.926265 -0.275366 0.595827 0.620635 0.371510
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.335609 -0.341086 -0.122166 0.016240 -0.641568 -0.929282 1.644398 -1.611868 0.604457 0.625977 0.371203
223 N19 RF_ok 100.00% 93.03% 92.87% 0.05% 171.502172 169.374511 inf inf 2552.646447 2579.382600 4935.691719 5411.927519 0.389840 0.394391 0.331181
224 N19 RF_ok 100.00% 92.44% 92.87% 0.05% 193.417094 192.656209 inf inf 2302.156203 2312.748224 5576.676936 5729.101859 0.529007 0.510875 0.341365
225 N19 RF_ok 100.00% 0.00% 89.52% 0.00% -0.562505 13.053163 0.738944 4.852280 -0.790846 7.754582 -1.342791 1.820509 0.610962 0.141655 0.492757
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.477379 0.201413 -0.466187 0.994869 -1.038268 0.847172 -0.666312 -0.799203 0.600162 0.622842 0.382872
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 3.824976 0.437276 1.932860 -1.381259 1.170799 7.145328 6.283015 1.750427 0.489072 0.598001 0.402249
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.629655 -0.280841 1.073643 -1.377693 0.122817 -0.923791 -0.207019 1.014063 0.586164 0.589267 0.366350
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.106476 0.416134 0.756668 1.220572 -0.244712 0.725623 -1.578542 -2.400204 0.588163 0.602282 0.385822
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.283265 -0.402768 0.000608 -1.387458 -0.466671 -0.868384 -0.612219 -0.912902 0.547449 0.597593 0.383308
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.251961 -0.595439 0.938088 0.282838 -0.647501 -0.814822 -1.815446 -1.891592 0.602558 0.614978 0.378449
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.097753 -1.310431 -0.037075 0.006085 -0.555247 -0.470340 0.353368 1.640042 0.603308 0.616384 0.378981
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.229031 -0.202169 0.002801 -0.502324 -0.530965 -1.075570 10.814967 5.087493 0.588446 0.610124 0.380025
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.525443 -1.147414 -0.311598 0.042787 -0.850520 -0.941715 1.387174 -0.328311 0.589593 0.616808 0.390350
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 22.368433 0.772192 0.383166 1.423683 1.803183 1.149411 -1.311912 -0.135201 0.452408 0.611114 0.380240
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 21.045447 -0.973141 1.084995 -1.322734 2.197197 -0.563488 -1.045006 0.351328 0.462694 0.595468 0.374091
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.949388 -1.048534 -0.850940 -1.041502 -0.389847 -0.766672 2.503357 7.402845 0.553918 0.602379 0.382994
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.942188 0.244411 0.653880 -1.208118 -0.440697 -1.117227 -1.807667 0.025194 0.585206 0.596382 0.376523
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.189818 14.032342 -0.704281 4.598712 -0.704093 7.987850 -0.523968 0.251619 0.574006 0.039529 0.490028
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.162980 1.987105 0.346066 -0.382319 -0.561799 -0.872026 -0.221257 2.665338 0.580796 0.573113 0.371594
262 N20 dish_maintenance 100.00% 1.24% 5.46% 0.00% 10.310900 12.274842 5.110630 5.446165 3.497036 3.778188 0.013949 2.299935 0.281113 0.262992 0.123427
320 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 14.126487 13.449537 6.601176 7.103889 6.443568 8.028753 3.196983 5.575754 0.056324 0.049237 0.006699
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 2.461227 2.591568 1.041270 1.258375 0.430221 0.910491 0.035785 -0.774657 0.490973 0.512504 0.363122
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.354537 -1.066452 1.148469 -1.319811 0.161860 2.718339 -1.772659 0.961175 0.524799 0.527214 0.376423
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.543770 -0.481553 -0.831840 -1.010809 20.296382 -0.910110 2.080448 -0.103424 0.484161 0.517684 0.369258
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.335218 3.852628 -1.146164 -1.285207 -0.964029 -0.678735 0.404022 -0.343844 0.474642 0.494057 0.347725
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, 7, 15, 16, 18, 19, 20, 27, 28, 29, 30, 32, 34, 36, 37, 38, 40, 42, 45, 47, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 63, 68, 71, 72, 74, 77, 78, 79, 80, 81, 84, 85, 86, 87, 90, 92, 94, 95, 96, 97, 101, 102, 103, 104, 108, 109, 110, 111, 113, 117, 121, 122, 123, 128, 131, 134, 136, 142, 144, 145, 147, 148, 149, 151, 155, 156, 158, 159, 161, 162, 165, 170, 171, 173, 180, 181, 182, 185, 187, 189, 191, 192, 193, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 220, 221, 223, 224, 225, 227, 240, 242, 243, 244, 246, 262, 320, 329]

unflagged_ants: [4, 5, 8, 9, 10, 17, 21, 22, 31, 35, 41, 43, 44, 46, 48, 49, 56, 61, 62, 64, 65, 66, 67, 69, 70, 73, 82, 83, 88, 89, 91, 93, 105, 106, 107, 112, 114, 115, 118, 120, 124, 125, 126, 127, 132, 133, 135, 137, 139, 140, 141, 143, 146, 150, 157, 160, 163, 164, 166, 167, 168, 169, 179, 183, 184, 186, 190, 222, 226, 228, 229, 237, 238, 239, 241, 245, 261, 324, 325, 333]

golden_ants: [5, 9, 10, 17, 21, 31, 41, 44, 56, 65, 66, 67, 69, 70, 83, 88, 91, 93, 105, 106, 107, 112, 118, 124, 127, 140, 141, 143, 146, 150, 157, 160, 163, 164, 167, 168, 169, 183, 184, 186, 190]
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_2459987.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

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