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 = "2460130"
data_path = "/mnt/sn1/2460130"
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-4-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/2460130/zen.2460130.42139.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 359 ant_metrics files matching glob /mnt/sn1/2460130/zen.2460130.?????.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/2460130/zen.2460130.?????.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 'startTime' 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 2460130
Date 7-4-2023
LST Range 18.384 -- 20.314 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 359
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 83 / 205 (40.5%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 117 / 205 (57.1%)
Redcal Done? ❌
Never Flagged Antennas 88 / 205 (42.9%)
A Priori Good Antennas Flagged 40 / 83 total a priori good antennas:
7, 15, 17, 31, 37, 38, 40, 42, 44, 45, 51,
53, 86, 88, 91, 105, 106, 107, 112, 121, 140,
141, 144, 145, 146, 151, 153, 158, 161, 163,
164, 165, 168, 169, 170, 183, 186, 187, 202,
325
A Priori Bad Antennas Not Flagged 45 / 122 total a priori bad antennas:
4, 8, 16, 22, 35, 36, 48, 49, 50, 52, 57, 63,
64, 68, 79, 80, 84, 95, 97, 102, 113, 114,
115, 120, 127, 132, 133, 135, 136, 139, 155,
156, 159, 175, 195, 228, 229, 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_2460130.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.408875 -0.382534 0.147623 -0.815293 0.592231 -0.231568 0.017967 -0.382930 0.791728 0.521291 0.568257
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.373884 1.217269 -1.591604 -1.234379 -1.557107 -1.575093 -0.739663 0.168236 0.790589 0.513741 0.564056
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.253559 1.344233 0.004729 3.093016 0.290410 0.912085 -0.013434 0.580049 0.797123 0.515990 0.564737
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.937104 -0.230063 -1.056784 -0.385623 0.018139 0.420798 2.421998 6.006310 0.792983 0.536035 0.549569
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.213564 1.560268 0.740981 0.841017 0.015751 0.090854 -1.349809 -1.497869 0.776200 0.498163 0.551529
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.416488 0.112668 3.033264 0.321270 1.897837 0.277878 2.337374 -0.068161 0.791254 0.531784 0.558055
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.475044 -1.343546 -0.277224 -1.172954 0.269284 -0.637281 0.917778 0.544635 0.789415 0.512316 0.564134
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 10.761473 5.171860 0.365560 -0.111410 -0.374934 -0.187194 0.556674 1.249642 0.661915 0.515363 0.426744
16 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.157791 -0.709948 -1.166697 -1.214805 -1.637576 -1.724338 -0.954038 -1.007985 0.797299 0.542320 0.550983
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.283878 0.724188 1.383878 3.628845 1.768444 1.244207 0.506558 6.711521 0.802137 0.526693 0.562559
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.927566 4.831536 -0.080491 1.937914 3.910501 1.934323 56.364314 23.886939 0.749364 0.308121 0.608837
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.694116 -0.365174 -0.787919 -0.177328 0.129958 0.694035 -0.302929 2.349326 0.800561 0.549657 0.548057
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 2.477867 -0.135925 1.312817 0.581483 0.820088 1.230225 2.235374 0.417835 0.790915 0.542272 0.540524
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.251705 -0.045283 -0.484617 -0.176767 -0.234501 0.108008 0.410108 0.129773 0.794615 0.531908 0.559566
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.635005 -1.296668 1.003051 -0.996661 0.163458 0.008235 0.303904 -0.392620 0.757846 0.495520 0.548560
27 N01 RF_ok 100.00% 100.00% 88.58% 0.00% 10.547110 12.385716 10.512885 3.315686 1.283145 -0.051955 4.275555 33.021615 0.048475 0.186369 0.136822
28 N01 RF_ok 100.00% 0.00% 20.89% 0.00% -0.431007 8.981476 0.487536 4.735375 -0.035145 -0.046145 0.038628 21.977099 0.801308 0.228653 0.688119
29 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.118920 6.940770 11.255239 11.456040 1.246778 1.109095 2.355286 1.639054 0.034185 0.041755 0.008413
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.067409 -1.188118 -0.439274 -1.273817 -1.452982 -0.715155 -0.811365 -0.342101 0.794031 0.552010 0.541323
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.001164 0.386547 -0.103959 0.831711 0.848174 2.765718 0.232020 4.743703 0.802998 0.553156 0.550067
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 13.057924 6.645323 0.233945 -0.388166 -0.325467 1.434417 5.189046 16.823002 0.717661 0.511720 0.395351
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 6.935383 -0.303441 6.630350 -0.864597 1.257109 -1.637528 1.040428 -0.790782 0.046064 0.514767 0.379938
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.713729 -1.149594 -0.841057 -1.651993 -1.521103 -1.201831 -0.001110 0.380664 0.782434 0.508994 0.561317
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.361534 2.329807 0.714044 0.381991 1.273572 0.801596 0.353937 0.462081 0.791924 0.516658 0.559571
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 6.149385 5.706313 4.718812 6.082982 1.674097 1.306556 0.810463 9.519780 0.799153 0.522196 0.560566
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.681631 -0.257026 -0.531061 0.644385 0.210386 1.396083 1.370387 7.081803 0.801026 0.538226 0.556185
40 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.371134 0.844791 0.771321 0.648499 0.633773 0.724674 0.607615 28.168746 0.803581 0.551437 0.548341
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.076726 0.903817 0.124300 2.975306 0.218088 1.636300 0.052983 0.605127 0.803110 0.545787 0.549306
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.727231 1.496232 0.302029 5.375917 0.470320 1.029023 0.550970 2.140796 0.805316 0.537043 0.555415
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% 105.167052 105.162524 inf inf 645.861779 669.064837 3364.903099 3698.431636 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% nan nan inf inf nan nan nan nan nan nan nan
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.819211 -0.074006 -1.503176 -0.454800 -1.659918 -1.602115 -0.215223 -1.285205 0.789368 0.513544 0.551396
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.236158 -0.450584 -0.189411 -1.076513 -0.657957 -1.732926 0.061233 0.323781 0.777415 0.502254 0.552958
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.103408 -0.236778 0.623839 0.447485 -0.018674 0.881260 1.335224 0.002619 0.797806 0.518639 0.565582
51 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.689321 0.336966 -0.391280 0.884198 -0.118384 1.705010 54.978424 1.146294 0.795737 0.534069 0.546907
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.382229 1.443353 0.456320 -0.173938 0.962817 0.067265 1.603950 0.113110 0.805292 0.541102 0.547604
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.017063 0.244821 -0.113776 -0.171650 -0.160535 -0.123464 4.352573 3.901194 0.806272 0.558377 0.536537
54 N04 dish_maintenance 100.00% 0.00% 0.00% 0.00% 7.703176 2.213159 1.955309 2.792345 0.845452 -0.210966 2.342996 0.953649 0.375928 0.400412 0.162031
55 N04 RF_maintenance 100.00% 100.00% 0.00% 0.00% 25.797872 -1.433877 7.968867 -1.621849 1.030485 -0.855105 0.604134 1.368604 0.043345 0.541698 0.395701
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.194905 0.243005 -0.675182 -0.186235 0.296420 -0.557605 -0.059140 0.001110 0.803609 0.556812 0.546557
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.489192 0.074169 -0.022869 -0.137369 0.182467 0.167218 0.663250 0.416097 0.802761 0.555028 0.549918
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% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% -0.902964 0.165844 0.460963 -0.415168 0.236160 -1.006837 1.324612 -0.776357 0.775795 0.519022 0.532025
63 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.737425 2.450045 -1.479358 1.512606 -1.479645 0.716737 -0.691006 -1.719146 0.794432 0.482796 0.560171
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.988396 -1.163000 -1.092234 -0.523082 -0.881286 -0.554285 0.124002 -0.306639 0.783403 0.506761 0.542477
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.113432 -0.532622 0.291137 -0.639865 0.756080 -0.608456 0.054368 -0.185198 0.795613 0.515006 0.570526
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.445923 0.027158 0.399422 0.609051 0.155600 1.196965 0.018244 0.489555 0.781397 0.532077 0.537393
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.698052 -0.144090 -0.649972 0.887077 0.602281 1.354286 2.463546 1.169028 0.799022 0.551005 0.537821
68 N03 RF_ok 0.00% 0.00% 0.00% 0.00% 0.579214 -0.166439 1.200362 0.656435 1.046885 0.689265 1.583829 1.336166 0.803914 0.553013 0.535838
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.552147 -0.293157 0.337200 -0.088422 1.184793 0.204043 1.277027 0.566648 0.809431 0.559284 0.540187
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.679682 0.135394 1.928867 0.572003 1.013555 0.846910 0.531325 1.970393 0.798038 0.564045 0.531740
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.891502 -0.223410 -0.826122 -0.015898 0.002768 0.549203 -0.375567 0.364439 0.804389 0.559904 0.542688
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.144456 0.152668 -0.204091 -0.015350 0.344800 -0.016545 0.677908 -0.035104 0.801045 0.557548 0.551771
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% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 10.078874 0.015858 -0.202414 -0.299234 -1.090574 -1.228947 0.067429 -1.126974 0.651605 0.530193 0.384770
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.161901 -1.142025 0.417635 -1.506704 -0.317616 -1.236537 0.365781 -0.671073 0.786069 0.533122 0.533366
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.643933 1.243993 -1.248361 0.636339 -1.842229 -0.156365 -0.865266 -1.525369 0.786761 0.497815 0.550008
84 N08 RF_ok 0.00% 0.00% 0.00% 0.00% 0.183338 1.343695 0.200214 0.765762 -0.599963 -0.043575 -1.092883 -1.315781 0.788315 0.516283 0.527211
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.669300 -1.020267 -1.254981 -1.302684 -1.442410 -0.800558 -0.898567 -0.599284 0.802450 0.559612 0.530640
86 N08 digital_ok 100.00% 100.00% 0.00% 0.00% 6.152138 -0.114598 10.115029 0.112518 1.296613 0.313096 0.421868 5.749643 0.051898 0.557350 0.378820
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.041211 1.280029 2.409072 -1.245767 2.803736 -0.192638 36.554794 1.730055 0.674269 0.560504 0.388369
88 N09 digital_ok 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.654518 0.062891 0.599442
89 N09 RF_maintenance 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 1.000000 1.000000 0.000828
90 N09 RF_maintenance 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.956410 0.043309 0.902498
91 N09 digital_ok 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.592151 0.087389 0.587847
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.020026 6.751255 11.539368 11.772175 1.239851 1.110223 2.090101 1.735785 0.028172 0.037307 0.005699
93 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.586350 7.095415 -0.386115 11.917809 -1.241390 1.077746 -0.763126 2.337739 0.267886 0.060354 -0.051457
94 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.074099 1.102827 0.556977 4.061403 0.416590 4.545014 0.690056 1.513010 0.810729 0.536071 0.547454
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.336766 -0.663776 -0.704957 -0.903557 -1.041036 -1.745523 0.041498 -1.059929 0.781325 0.538414 0.523861
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.085450 9.436990 -0.370598 -0.200490 -1.116440 -0.922372 -1.178979 0.051852 0.794859 0.425968 0.522443
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.330345 -0.252565 -1.061489 -0.508538 -0.689088 -0.233486 0.226833 2.541445 0.785288 0.511992 0.542753
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.237480 2.624162 -0.262615 0.660338 -0.002768 0.335564 -0.171448 0.130344 0.802952 0.538252 0.545671
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.284112 -0.135804 -1.422932 -0.771685 -1.218610 -0.359878 -0.627938 3.704308 0.807027 0.545839 0.538403
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.336425 1.606822 -1.445845 0.343304 -0.990721 0.003753 -0.251057 3.844115 0.796764 0.553093 0.521449
104 N08 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.844079 25.545139 2.697625 6.568122 4.341895 1.649006 2.932272 0.670182 0.804595 0.533446 0.557976
105 N09 digital_ok 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.587212 0.046673 0.565838
106 N09 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.997051 0.995533 0.299957
107 N09 digital_ok 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.929257 0.077292 0.875782
108 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.095257 0.051000 0.045122
109 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.730247 6.930746 -1.327819 11.650509 0.661216 1.115552 0.789239 1.361792 0.441144 0.044727 0.315324
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.252608 -0.544523 -0.841432 -0.629677 -1.289604 -0.191219 -0.908374 -0.389233 0.721282 0.554462 0.438044
111 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.726560 0.914661 0.482651 1.211509 0.968247 0.350674 16.184588 0.681452 0.795522 0.557261 0.525885
112 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.396099 -0.652419 9.639429 -0.778214 -1.384958 -1.678567 0.404558 -1.150350 0.661851 0.553317 0.436826
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.946714 2.323652 1.272173 1.407726 0.561459 0.592164 -1.577528 -1.686792 0.773561 0.508468 0.530920
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.598213 -0.756366 0.928994 -1.520773 0.331500 -1.425543 -1.468154 -0.586556 0.776154 0.533777 0.526062
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.549200 1.262333 0.055003 0.569985 -0.546182 -0.157067 -1.282091 -1.567331 0.768823 0.494429 0.539288
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.251568 0.304037 2.358224 0.071101 0.935619 0.057054 2.188394 0.413396 0.798062 0.539914 0.534565
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.977940 1.293346 0.374136 5.609738 -0.427921 1.367426 -1.181507 5.802479 0.785659 0.529346 0.528068
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.393310 1.135735 -0.619406 -1.395724 -0.570528 -0.839376 -0.181734 -0.686115 0.800030 0.550724 0.537871
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.456382 0.410281 1.066785 -0.041346 0.353973 -0.921893 -1.379104 -1.353680 0.779025 0.533739 0.543993
124 N09 RF_maintenance 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.619521 0.128374 0.589255
125 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.057177 0.018789 0.003497
126 N09 RF_maintenance 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.822291 0.127476 0.761014
127 N10 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.933727 0.026029 1.124408 -0.004729 2.872619 0.396949 1.409903 0.461022 0.800144 0.551549 0.555308
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.253986 -0.346551 0.188447 -0.428290 0.837909 -0.115223 0.795317 2.469407 0.806146 0.556632 0.549171
131 N11 not_connected 100.00% 0.00% 11.98% 0.00% 0.963494 6.570578 0.456356 2.123500 -0.361508 0.313934 -1.449964 0.362515 0.776604 0.237522 0.591391
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.133135 -1.075955 -1.405375 -1.212261 -1.733336 -0.845981 -0.842226 -0.407326 0.794643 0.539746 0.530683
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.359334 1.117806 0.035806 0.394466 -0.631424 -0.463419 -1.282452 -1.447588 0.776029 0.510797 0.538408
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.153850 1.551444 2.387605 0.789346 -0.216840 -0.110234 4.961216 -1.570046 0.738595 0.494813 0.531957
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.226897 -0.003932 -1.463884 0.805321 -0.653868 0.633716 -0.710858 0.576661 0.768386 0.479164 0.561195
136 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.948212 3.033703 -1.413495 0.523170 -1.042652 0.659894 -0.425628 1.748632 0.785045 0.476085 0.562031
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.045296 -0.928037 -0.437065 -1.461535 -1.478335 -0.916421 -1.045387 -0.063828 0.780182 0.504182 0.540573
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 2.955727 0.408862 0.048026 0.213644 2.593193 0.917889 76.773382 11.546878 0.761068 0.532418 0.503221
141 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 6.353398 -0.104515 11.522836 0.161177 1.243159 1.167000 1.045587 0.273559 0.064725 0.535284 0.436556
142 N13 RF_ok 100.00% 0.00% 0.00% 0.00% -0.309600 0.023874 0.149923 -0.077142 0.175710 0.856231 9.372433 2.158116 0.794966 0.535815 0.550460
143 N14 RF_maintenance 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.066558 0.474813 0.402594
144 N14 digital_ok 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.099189 0.550340 0.477337
145 N14 digital_ok 100.00% 99.72% 99.72% 0.00% 84.321700 84.193004 inf inf 648.350060 656.631711 3305.233744 3429.904201 0.718180 0.352468 0.610328
146 N14 digital_ok 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.026619 0.507950 0.471829
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.805579 0.007435 1.486661 0.808380 2.419753 0.969091 0.745214 0.120019 0.804752 0.546552 0.558662
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.171031 0.003932 -0.017655 0.479906 0.821999 0.593971 0.017155 0.071427 0.807701 0.548617 0.556883
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.138987 -0.114634 0.617792 0.017777 1.038444 0.122848 0.302556 -0.052052 0.804699 0.555261 0.546627
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.128664 -0.226811 0.211578 0.078694 1.189340 0.265360 0.445690 -0.115028 0.808383 0.556164 0.542229
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.486668 -0.611732 -1.149721 0.759491 -1.093315 -0.119072 -0.423716 3.431045 0.678852 0.531297 0.411071
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.028652 -1.215569 -1.137858 -1.097925 -1.079487 -1.247554 0.212645 -0.536273 0.796508 0.528344 0.540488
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 6.254727 -0.640095 6.395522 -0.740501 1.273279 -0.342189 0.980309 0.367088 0.045792 0.524595 0.362651
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.143039 -1.186386 -1.318865 -1.580544 -1.662919 -1.309655 -0.805529 -0.628964 0.780559 0.503977 0.555326
155 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.300659 -1.452945 0.158579 -1.236777 -0.642055 -0.701051 -1.238939 -0.150522 0.780349 0.473843 0.583867
156 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.967688 0.053360 3.867783 0.456904 0.996867 0.419565 2.767927 -0.029779 0.777465 0.487568 0.565835
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.417871 0.078867 0.040099 0.397743 0.808332 0.622941 0.031570 0.056621 0.786913 0.501621 0.560793
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.582491 -0.486845 -0.101239 0.098956 0.366383 0.266510 0.801551 4.960637 0.793736 0.508727 0.561426
159 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.269083 -0.598517 0.573717 -0.798319 0.349042 -0.632201 0.251044 -0.283572 0.765548 0.495297 0.543184
160 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.846401 0.233853 0.481092 4.908771 -0.276339 0.712307 -1.148222 4.602278 0.780468 0.501464 0.551103
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.017492 14.345300 0.384988 -0.048138 1.064522 -0.601588 0.130808 -0.347073 0.791864 0.410571 0.531417
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.110056 -0.120279 -0.835883 0.265685 -0.605896 0.101374 1.638601 0.092470 0.796424 0.529462 0.561451
163 N14 digital_ok 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.066531 0.713192 0.666145
164 N14 digital_ok 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.045941 0.884710 0.810339
165 N14 digital_ok 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.120314 0.374045 0.300631
166 N14 RF_maintenance 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.080297 0.844526 0.772632
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.363378 0.249815 0.388273 0.495749 0.233438 0.642717 0.073181 1.729149 0.796098 0.538738 0.561241
168 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
169 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
170 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.976438 0.299409 0.764513
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.722384 -0.572641 0.443818 0.747029 0.063159 -0.118200 0.023731 0.743727 0.779083 0.512594 0.528181
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.697667 -0.497504 -0.996929 -0.251553 -1.774460 -0.504525 -0.852645 0.079298 0.790856 0.520551 0.543911
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.889954 2.276561 1.248701 1.368671 0.492508 0.498581 -1.585222 -1.646576 0.764413 0.489939 0.545420
174 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 6.972069 7.570618 6.316132 6.379734 1.259533 1.128823 0.859651 0.406294 0.030438 0.031000 0.001496
175 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.064182 2.000294 0.499983 1.030620 -0.338212 0.176720 -1.431966 -1.641296 0.763302 0.459346 0.570446
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.233937 0.639942 0.734793 2.223175 1.634739 6.190175 0.439792 2.449370 0.785726 0.497375 0.563561
180 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.579365 5.087629 1.137301 -0.062951 0.954819 -0.367047 4.240903 -0.662624 0.788201 0.446004 0.549954
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.488388 0.204335 0.173451 0.170819 1.766613 0.573333 0.224256 1.018349 0.794839 0.513750 0.561752
182 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.976771 6.812039 -1.346070 11.665421 -1.476375 1.094622 0.167555 1.803850 0.791564 0.050605 0.675626
183 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.755399 7.341817 0.131806 11.756319 0.114053 1.104547 0.148742 1.766854 0.790892 0.042583 0.664492
184 N14 dish_maintenance 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.027199 0.643553 0.606296
185 N14 RF_maintenance 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.125806 0.639088 0.614267
186 N14 digital_ok 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.046642 0.840885 0.772394
187 N14 digital_ok 100.00% 100.00% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.031915 0.812664 0.742638
189 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.619270 1.472630 0.376349 0.807086 -0.454568 0.089892 -1.444138 -1.623340 0.771413 0.488540 0.553545
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.219730 -0.529110 0.168657 -0.321800 0.546709 0.015256 0.215531 -0.210322 0.801375 0.543628 0.548053
191 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.133023 0.220317 0.408627 1.178243 0.887129 1.100128 1.582038 0.202922 0.801950 0.539702 0.548032
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.159221 2.552787 1.449764 1.573210 0.738498 0.763122 -1.583524 -1.727642 0.757663 0.480718 0.535284
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.183385 2.186747 1.479386 1.318892 0.773923 0.472487 -1.584575 -1.715752 0.755175 0.479338 0.541636
194 N16 digital_maintenance 100.00% 100.00% 0.00% 0.00% 6.225067 -1.416704 6.283395 -1.467094 1.238217 -1.409901 0.527495 -0.692105 0.039704 0.505760 0.405990
195 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.359475 0.051892 0.673799 -0.572495 -0.239165 -1.493262 -1.385607 -0.932546 0.756833 0.487178 0.560119
200 N18 RF_maintenance 100.00% 99.44% 99.44% 0.00% nan nan inf inf nan nan nan nan 0.862690 0.710286 0.536117
201 N18 RF_maintenance 100.00% 99.44% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.725042 0.214383 0.603610
202 N18 digital_ok 100.00% 99.44% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.838022 0.161622 0.757253
204 N19 RF_maintenance 100.00% 99.16% 99.44% 0.00% nan nan inf inf nan nan nan nan 0.777599 0.338890 0.704248
205 N19 RF_ok 100.00% 99.44% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.549075 0.328325 0.746793
206 N19 RF_ok 100.00% 99.44% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.550140 0.156858 0.470325
207 N19 RF_maintenance 100.00% 99.16% 99.44% 0.00% nan nan inf inf nan nan nan nan 0.781016 0.294900 0.670469
208 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 2.899218 4.043648 6.515496 12.137917 1.241841 0.776763 1.224366 42.890968 0.772281 0.039445 0.666288
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 2.674969 3.148272 10.711571 11.446445 1.377624 1.208819 8.602569 20.727996 0.033864 0.035582 0.000974
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.192824 4.033635 -0.032170 0.297994 0.337943 0.217709 0.073416 0.038581 0.800800 0.520222 0.546960
211 N20 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.478524 6.907118 -0.389041 6.813098 -0.254287 1.143186 0.102352 1.783473 0.779606 0.042296 0.663335
213 N16 digital_maintenance 100.00% 0.00% 100.00% 0.00% 1.804824 7.619618 1.184621 6.501228 0.475084 1.011077 2.218689 1.171486 0.760031 0.097723 0.670507
214 N21 not_connected 100.00% 100.00% 0.00% 0.00% 6.597884 -0.058653 6.435191 -1.603497 1.252279 -0.375982 0.779302 0.835400 0.049354 0.477056 0.409563
220 N18 RF_maintenance 100.00% 99.44% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.851908 0.164823 0.751795
221 N18 RF_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.439892 0.213995 0.394933
222 N18 RF_ok 100.00% 99.44% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.880178 0.258343 0.797479
223 N19 RF_ok 100.00% 99.16% 99.44% 0.00% nan nan inf inf nan nan nan nan 0.684013 0.418589 0.569314
224 N19 RF_maintenance 100.00% 99.16% 99.44% 0.00% nan nan inf inf nan nan nan nan 0.752836 0.376403 0.598486
225 N19 RF_maintenance 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.641260 0.383939 0.623448
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 0.040266 -1.215741 0.611203 -1.330360 -0.107719 -1.211929 14.682268 6.355394 0.766276 0.502540 0.544138
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.393175 -0.924306 -1.193216 -0.942300 -1.793830 -1.047408 0.113053 0.270757 0.783911 0.500252 0.548493
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.292874 -0.044017 -0.773560 -0.320490 -1.836303 -1.232105 -1.033310 -1.347170 0.785646 0.497707 0.557483
237 N18 RF_ok 100.00% 99.16% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.824080 0.319989 0.714469
238 N18 RF_ok 100.00% 99.16% 99.44% 0.00% nan nan inf inf nan nan nan nan 0.806724 0.353844 0.733728
239 N18 RF_ok 100.00% 99.44% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.682549 0.257407 0.566622
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
243 N19 RF_ok 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.962417 0.143389 0.857938
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.005496 -0.560415 -0.438319 0.499010 -0.073974 2.138537 0.461570 2.001278 0.776300 0.475427 0.562063
245 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.568799 -0.907768 -0.938078 -1.453060 -1.782470 -1.078911 -1.018551 0.507600 0.788366 0.494933 0.561385
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 1.182467 7.070327 3.490884 6.379314 0.046665 1.111217 1.599483 1.072957 0.698484 0.039987 0.590276
261 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.680864 -0.848697 -1.016337 -1.346315 -1.826278 -1.476994 1.133395 -0.939672 0.779571 0.479323 0.568448
262 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.937605 5.443013 -0.646081 0.101626 -0.109533 0.712495 -0.175561 0.387597 0.782435 0.487554 0.569812
320 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.839221 -0.826906 -1.332055 -1.078288 -0.819536 -0.326610 -0.437302 1.562658 0.749020 0.383240 0.587876
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.541294 0.795453 -0.446288 -0.229446 -1.352850 -1.148414 -0.876684 -1.318864 0.732446 0.366283 0.571290
325 N09 digital_ok 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.627763 0.021269 0.575448
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.836208 6.971210 6.420918 6.867266 1.284346 1.162125 1.263828 1.364656 0.041521 0.039999 0.002219
332 N21 not_connected 0.00% 0.00% 0.00% 0.00% 0.922770 1.269484 0.201603 0.357839 -1.161421 -0.607743 -1.372880 -1.451140 0.719437 0.366197 0.579827
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% -0.366000 -0.106985 0.840349 -0.745359 0.455719 -0.393997 1.614774 0.168507 0.703389 0.360561 0.555457
336 N21 not_connected 0.00% 0.00% 0.00% 0.00% 0.920387 0.828641 -0.606717 -0.570406 -1.482270 -1.336645 -0.558139 -1.145251 0.711410 0.348998 0.566419
340 N21 not_connected 0.00% 0.00% 0.00% 0.00% 2.028317 1.789373 1.135091 0.733250 0.348550 -0.146031 -1.531281 -1.565351 0.684548 0.347109 0.538903
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: [7, 15, 17, 18, 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, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96, 104, 105, 106, 107, 108, 109, 110, 111, 112, 121, 124, 125, 126, 131, 134, 140, 141, 142, 143, 144, 145, 146, 151, 153, 158, 160, 161, 163, 164, 165, 166, 168, 169, 170, 174, 179, 180, 182, 183, 184, 185, 186, 187, 194, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 213, 214, 220, 221, 222, 223, 224, 225, 226, 227, 237, 238, 239, 240, 241, 242, 243, 246, 262, 325, 329]

unflagged_ants: [3, 4, 5, 8, 9, 10, 16, 19, 20, 21, 22, 30, 35, 36, 41, 48, 49, 50, 52, 56, 57, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 79, 80, 84, 85, 95, 97, 101, 102, 103, 113, 114, 115, 120, 122, 123, 127, 128, 132, 133, 135, 136, 139, 147, 148, 149, 150, 152, 154, 155, 156, 157, 159, 162, 167, 171, 172, 173, 175, 181, 189, 190, 191, 192, 193, 195, 228, 229, 244, 245, 261, 320, 324, 332, 333, 336, 340]

golden_ants: [3, 5, 9, 10, 19, 20, 21, 30, 41, 56, 62, 65, 66, 67, 69, 70, 71, 72, 85, 101, 103, 122, 123, 128, 147, 148, 149, 150, 152, 154, 157, 162, 167, 171, 172, 173, 181, 189, 190, 191, 192, 193, 320]
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_2460130.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 [ ]: