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 = "2459995"
data_path = "/mnt/sn1/2459995"
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-19-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/2459995/zen.2459995.21311.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

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

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1850 ant_metrics files matching glob /mnt/sn1/2459995/zen.2459995.?????.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/2459995/zen.2459995.?????.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 2459995
Date 2-19-2023
LST Range 4.501 -- 14.458 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
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 75 / 198 (37.9%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 129 / 198 (65.2%)
Redcal Done? ❌
Never Flagged Antennas 69 / 198 (34.8%)
A Priori Good Antennas Flagged 59 / 93 total a priori good antennas:
3, 7, 10, 15, 16, 17, 19, 20, 29, 30, 31, 38,
40, 42, 45, 53, 54, 55, 56, 71, 72, 81, 85,
86, 93, 94, 101, 103, 107, 109, 111, 112, 121,
122, 123, 124, 127, 128, 136, 140, 144, 145,
151, 158, 161, 162, 164, 165, 166, 170, 173,
182, 184, 187, 189, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 35 / 105 total a priori bad antennas:
4, 8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 82, 89, 90, 115, 125, 126, 133, 137, 139,
220, 222, 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_2459995.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% 11.086859 14.607617 11.802178 12.586658 7.894341 9.422113 0.338363 0.870221 0.030795 0.035776 0.005395
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.242253 -0.510400 0.840975 0.005271 -0.018839 2.255412 2.683438 3.790772 0.588791 0.611584 0.404433
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.472831 -0.751550 0.360905 0.074988 0.357132 2.386809 1.012773 0.301009 0.599765 0.609803 0.389862
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.384501 -0.004871 -1.307827 -0.177169 0.029769 0.467611 8.214739 9.590710 0.610751 0.628246 0.386422
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.012838 -1.283030 -0.440547 0.109848 -0.167115 1.007368 0.912534 1.616652 0.611526 0.625901 0.380979
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.522813 -0.442522 3.764908 -1.130939 0.904286 -0.277852 1.869945 -0.450627 0.587941 0.626835 0.391924
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 2.057630 -0.607958 -0.985718 -1.498897 1.859223 0.774446 4.408327 1.807188 0.598972 0.622268 0.382105
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 11.348742 14.320434 11.146490 11.908973 7.910204 9.433395 -0.116544 0.171260 0.027757 0.027035 0.001602
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.381308 -0.808614 11.766373 0.697426 7.901465 2.882777 0.302262 1.389181 0.035572 0.621510 0.493198
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 1.294761 1.817525 0.606776 0.518054 0.871640 1.123481 4.682478 2.616592 0.608681 0.628516 0.390457
18 N01 RF_maintenance 100.00% 100.00% 41.46% 0.00% 12.085053 18.930840 11.752271 -0.243652 8.084590 5.055614 0.342816 15.588865 0.030490 0.225499 0.168531
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.846272 0.560848 -1.053671 -1.064836 -0.532044 26.582874 0.021186 4.234376 0.620388 0.637538 0.380590
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.440407 -1.566178 1.303400 -0.985981 8.765226 -0.320614 0.916142 -0.558013 0.614810 0.634993 0.379420
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.682395 0.358797 -0.654992 0.021736 0.502805 1.626158 -0.130449 -0.153538 0.604466 0.617539 0.371544
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.492459 -0.451692 0.221525 -0.320584 1.242681 3.246640 -0.659600 -0.751589 0.587191 0.602908 0.377505
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.628122 13.628060 11.816030 12.369375 8.053308 9.507581 1.568117 1.306511 0.036179 0.040770 0.005316
28 N01 RF_maintenance 100.00% 0.00% 82.86% 0.00% 10.435302 26.672481 0.801364 3.614964 3.225960 6.322074 3.962432 19.591515 0.356294 0.158089 0.259095
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 11.389126 14.075994 11.367032 11.924324 8.056884 9.499550 0.309850 0.059366 0.030464 0.039770 0.009309
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 1.094234 0.187928 1.203594 -1.524184 11.647021 0.105076 1.190839 -0.405426 0.610792 0.645876 0.390335
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.524536 -0.977954 1.157883 0.770879 1.469062 0.100306 0.427663 4.266204 0.631274 0.641898 0.377298
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.100974 27.509847 0.788481 3.655124 6.297031 0.772150 7.117091 9.757360 0.564618 0.523966 0.287891
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 13.067512 15.304489 5.681861 6.106213 7.992638 9.445515 0.433655 0.251353 0.037248 0.051638 0.009630
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.957257 -1.035387 1.271794 -1.278568 0.487754 -0.750362 1.019772 -0.240427 0.597583 0.598015 0.374539
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 28.307166 28.474151 15.421443 15.422246 8.256972 9.508937 3.252391 3.288799 0.036117 0.032657 0.001785
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.738698 0.757004 -1.280604 0.924739 2.011518 1.507201 -0.640574 3.338245 0.603546 0.613163 0.401610
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.184864 -0.053763 0.539511 0.621247 -0.256130 0.496980 5.193437 1.672618 0.606810 0.611071 0.396514
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 10.668159 1.646254 11.396728 0.698100 8.026618 0.368475 0.265185 2.940070 0.042140 0.611029 0.458498
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.394978 0.545204 -0.260682 0.167625 2.676368 1.017369 1.923592 3.135822 0.609050 0.633355 0.384202
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.376673 2.663364 -0.961181 9.713523 1.022338 2.280155 -0.538909 0.584071 0.632078 0.535828 0.416794
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.258426 0.031240 -0.142303 0.738830 -0.544701 1.170991 -1.051826 0.566991 0.630943 0.644328 0.381186
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.428414 0.387952 -0.841135 -0.419618 -0.703955 0.448644 -1.006155 -0.573851 0.635540 0.653986 0.380472
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.127075 3.546582 0.528134 0.718314 -0.639994 2.608761 0.239517 14.422901 0.626321 0.636869 0.370578
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.977832 -0.017672 -0.603869 -1.129365 -0.606824 -0.312402 -0.399108 -0.871402 0.629622 0.653819 0.388854
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.976211 14.953215 5.570353 5.679376 7.965320 9.358619 1.901926 0.197956 0.032076 0.061520 0.019826
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.009896 0.894489 -0.324555 1.666186 -1.046480 2.277508 -0.813605 -1.789803 0.598575 0.622249 0.383433
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.311008 -0.129490 -0.757803 0.069525 0.020956 0.116735 0.024353 2.423420 0.560860 0.597758 0.379348
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.241288 2.951786 1.258845 1.198943 2.666457 1.553842 66.101330 25.765636 0.529406 0.588641 0.371134
51 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.742517 6.851711 -0.482958 0.686491 0.929258 1.287349 0.915387 0.473145 0.608860 0.622180 0.393291
53 N03 digital_ok 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.650768 0.410790 0.320995
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 28.957156 -0.509124 5.323372 -0.679134 1.170220 -0.184718 2.783787 0.661680 0.441898 0.635140 0.386349
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.717986 15.003457 11.842772 12.507448 8.033336 9.456262 0.286487 1.661829 0.028357 0.033807 0.004575
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 1.539774 0.799298 -0.559925 2.048975 -0.587101 0.563492 0.032823 4.182585 0.619445 0.644203 0.381721
57 N04 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.225398 0.057549 12.152405 -1.192099 7.774518 1.284656 1.336384 3.125798 0.049972 0.648010 0.490649
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.610828 13.970179 11.694922 12.493239 7.895889 9.370973 0.781159 0.532658 0.041512 0.040257 0.002078
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.647564 0.718764 11.189452 0.516026 7.677029 3.839208 -0.059300 2.356087 0.053922 0.644383 0.490771
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.470560 13.909784 -0.420472 12.528205 -0.002282 9.406282 5.557310 1.735604 0.630242 0.079806 0.497865
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.283857 -0.260302 -0.127659 -1.404437 2.051452 -1.187092 -0.443269 -0.083979 0.578253 0.614693 0.373957
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.125526 1.129158 -0.731250 1.187486 1.547380 -0.269693 1.011004 -1.060612 0.577734 0.619460 0.380993
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 1.366771 14.483319 -0.562408 6.141013 0.461067 9.546644 -0.610428 1.747753 0.591807 0.050864 0.461900
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.186435 -0.342572 -0.937923 -0.791279 -0.309561 -0.904570 1.343816 -0.024691 0.585840 0.582488 0.367568
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.512253 1.558083 0.894202 1.249383 -0.368593 1.223226 3.848835 2.134812 0.590113 0.608244 0.400259
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.912469 1.785144 -1.519616 -0.826908 3.049810 -0.199829 -0.646349 0.689381 0.606315 0.622030 0.400259
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.615107 -0.531725 0.063463 1.510199 -0.559695 0.877743 0.245412 1.605059 0.610533 0.619235 0.391557
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 20.498316 29.375005 1.229680 16.186601 3.639325 9.482222 0.047781 6.979467 0.348364 0.033794 0.249346
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.752680 0.038580 0.753947 0.885636 -0.377588 1.985845 -0.222024 -0.009315 0.615206 0.633683 0.390216
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.724825 -0.055838 -0.199251 0.028357 1.384854 2.003957 -0.308524 -0.518574 0.618963 0.639707 0.385204
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.320171 0.046350 0.802627 1.444913 0.362740 -0.327551 2.075685 0.391039 0.618360 0.647699 0.382631
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.766057 15.203704 12.221750 12.930587 7.763651 9.186200 0.285597 0.550212 0.039087 0.044495 0.006851
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.548244 1.041929 -1.461243 -0.691486 1.280052 0.458067 -0.552048 -0.507211 0.642899 0.658634 0.377418
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.888607 0.129110 -0.109051 -0.627075 -0.400969 1.836452 -1.072476 1.276875 0.642956 0.655036 0.374605
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 58.692481 25.166878 0.624796 -0.561563 4.013156 2.245171 4.325918 0.463186 0.322565 0.497121 0.283823
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 31.102708 0.840537 -0.468175 1.451715 1.551493 0.938631 3.089761 0.125543 0.442401 0.626006 0.370565
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.315905 14.724254 -1.408237 6.147857 -0.854635 9.301369 1.311805 -0.129340 0.586692 0.044488 0.445578
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.387543 15.653431 0.295150 6.046173 -0.940324 9.356986 -0.850450 0.675157 0.597808 0.053394 0.459679
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.286072 14.806748 0.180201 10.967981 0.426902 9.004647 -0.257582 1.156767 0.567141 0.044382 0.430211
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.282452 1.205464 -1.033106 -0.244643 0.142310 -1.086706 -0.594969 0.223475 0.597486 0.615387 0.393979
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.334802 0.097431 0.402890 0.657495 0.410597 -0.057817 -0.463928 0.571023 0.598581 0.608073 0.384480
84 N08 RF_maintenance 100.00% 99.73% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.571805 0.473522 0.387208
85 N08 digital_ok 100.00% 99.78% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.337011 0.401129 0.325590
86 N08 digital_ok 100.00% 99.73% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.452622 0.453415 0.302650
87 N08 RF_maintenance 100.00% 99.57% 99.62% 0.00% 232.446339 232.470647 inf inf 3289.149086 3288.012677 7664.603414 7656.152797 0.663932 0.525865 0.374683
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.616249 0.640743 0.590307 1.347318 -0.274257 0.092252 1.903899 0.520012 0.626234 0.643014 0.370890
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.728526 0.612176 0.472990 1.200462 -0.389592 -0.080380 -0.384933 -0.208204 0.629121 0.650455 0.368843
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.063192 -0.225005 -0.896443 -0.598719 2.465392 -0.901278 -0.199371 1.137057 0.636871 0.660604 0.373015
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.584164 -0.076326 0.751858 0.616145 -0.457936 -0.292811 0.903746 0.443476 0.622358 0.650803 0.376361
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.165658 0.408542 11.691416 0.234230 8.128907 1.946094 -0.021106 0.377014 0.040887 0.654067 0.440232
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.590841 14.216545 11.839143 12.609271 7.842935 9.333909 1.557777 1.224150 0.033518 0.025205 0.003809
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.219838 14.449623 11.978094 12.383074 8.001609 9.413756 0.660071 0.335943 0.025374 0.025823 0.001140
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 6.365426 3.873879 -0.862016 0.754248 0.582251 0.513356 0.590042 0.253313 0.543133 0.580479 0.339562
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 4.953811 19.254284 3.830959 1.764517 3.382011 2.447212 -2.512120 -0.964224 0.593456 0.500510 0.355645
97 N11 not_connected 100.00% 99.57% 99.51% 0.00% nan nan inf inf nan nan nan nan 0.439129 0.446827 0.397284
101 N08 digital_ok 100.00% 99.89% 99.84% 0.00% 249.123764 248.157479 inf inf 2619.622988 2615.991759 4944.874159 4924.443838 0.345452 0.446821 0.244592
102 N08 RF_maintenance 100.00% 99.51% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.598396 0.629618 0.475994
103 N08 digital_ok 100.00% 99.62% 99.68% 0.00% 254.205399 253.284453 inf inf 2464.854136 2470.816522 4596.405618 4469.262783 0.663329 0.572825 0.344842
104 N08 RF_maintenance 100.00% 99.46% 99.41% 0.00% nan nan inf inf nan nan nan nan 0.462229 0.491613 0.416043
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.286683 0.501554 0.323866 1.257626 1.234765 -0.180332 -0.104692 -0.125878 0.629426 0.643909 0.374262
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.038536 -0.848155 -0.457695 -0.155906 3.440197 -0.475089 0.368006 0.374433 0.627641 0.639266 0.360349
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 4.481093 3.577464 0.107455 -0.450626 0.839510 0.258821 10.874487 7.395179 0.629736 0.656596 0.362522
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.276149 43.608947 11.747069 1.268344 7.992844 2.900074 1.049351 4.659656 0.039026 0.295788 0.166342
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.030250 14.003734 11.794269 12.236419 8.117560 9.523302 0.090224 1.211270 0.051426 0.036543 0.008038
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.144025 14.241494 7.805862 -0.025267 5.367926 -0.188734 0.283571 -0.531686 0.538154 0.605842 0.341254
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 34.296875 13.865448 1.318695 12.339438 1.816382 9.523638 4.129357 1.359815 0.495506 0.067434 0.330633
112 N10 digital_ok 100.00% 45.19% 97.84% 2.16% 2.957956 13.658520 8.476241 12.440791 0.708865 9.295413 -0.218341 0.263158 0.206296 0.077065 -0.109005
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.286895 15.354870 5.270650 6.141473 7.803975 9.269716 0.984541 0.312031 0.038290 0.031751 0.003236
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.401891 12.158897 14.419939 13.830600 5.509748 10.832268 178.152998 123.115231 0.027110 0.028708 0.001509
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.971540 -0.735542 -1.303141 0.130178 -0.733890 -0.896314 0.219200 -1.041447 0.562569 0.592550 0.390407
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.151468 15.614565 11.879941 12.896401 7.800020 9.361296 0.696252 2.512051 0.029416 0.035155 0.003681
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.590712 1.641160 0.207926 0.757967 -0.289524 0.555661 0.964024 1.168561 0.598574 0.615909 0.392976
120 N08 RF_maintenance 100.00% 99.51% 99.46% 0.00% 220.467073 219.648919 inf inf 2595.184164 2566.255346 5321.946590 5200.271749 0.556002 0.546101 0.409489
121 N08 digital_ok 100.00% 99.73% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.541825 0.432896 0.374886
122 N08 digital_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.402256 0.374523 0.319474
123 N08 digital_ok 100.00% 99.84% 99.78% 0.00% 264.569650 264.579169 inf inf 3285.606115 3285.218094 7550.551626 7437.446277 0.352579 0.451069 0.320766
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 11.395834 0.131974 12.046160 0.845472 7.774116 0.620999 0.163523 1.027516 0.046667 0.654016 0.470174
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.453750 0.237981 0.343991 1.294419 0.341925 1.482356 0.932277 3.419676 0.637676 0.643440 0.365849
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.095634 -0.908830 -0.386813 1.160518 3.682418 0.671230 2.382496 -0.229849 0.639036 0.650670 0.371271
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 10.792833 0.496425 11.681491 0.475624 8.111900 2.158977 -0.056726 0.865393 0.039112 0.660414 0.444817
128 N10 digital_ok 100.00% 0.00% 0.00% 0.00% -0.141912 -0.650664 -1.508576 -0.227785 -0.572370 0.794245 0.638496 4.581867 0.646635 0.657918 0.383469
131 N11 not_connected 100.00% 0.00% 8.97% 0.00% -0.517235 13.683014 -0.037793 5.983374 -0.705915 8.370824 -0.673212 0.016449 0.602322 0.272943 0.424720
132 N11 not_connected 100.00% 99.46% 99.46% 0.00% 251.368927 251.390312 inf inf 3295.470758 3294.782826 7716.389743 7713.477310 0.518077 0.564531 0.326595
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.286542 -1.416038 -1.542999 -0.577215 -0.949490 -0.924337 -0.343222 0.366809 0.568951 0.598197 0.393694
134 N11 not_connected 100.00% 99.41% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.528597 0.499070 0.416792
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.587068 -1.213054 -1.226850 -1.481430 2.210064 0.997174 12.424833 0.008821 0.574481 0.604062 0.404033
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 10.261316 3.893450 11.340187 -0.638362 8.081006 1.213568 0.944236 0.369781 0.046317 0.597410 0.437240
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.154178 -0.520362 0.060916 -1.516857 2.518703 -0.390678 0.065409 0.269134 0.584590 0.615498 0.394000
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.666108 1.532931 1.473621 -1.148881 0.822231 -0.398544 -0.335904 0.703216 0.603551 0.604805 0.379027
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.892555 -1.110141 -0.858328 -0.434107 5.388775 0.260744 38.255755 5.428363 0.610188 0.636300 0.384678
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.032286 -0.647742 -0.289100 0.529168 1.121757 -0.396247 1.172928 -0.874863 0.619618 0.643515 0.383264
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.523807 14.007642 -0.885245 12.540608 2.608369 9.470772 16.285690 1.138255 0.628315 0.053268 0.504762
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.040499 13.921354 11.618993 12.515307 7.404236 9.493984 0.094594 1.023508 0.098112 0.032593 0.047975
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.459809 0.923969 -1.197921 6.966155 0.167944 9.211307 -0.675993 0.023885 0.641470 0.608712 0.383600
145 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.406708 -0.511064 2.116957 0.363518 0.117716 8.568281 -0.040063 -0.948313 0.632048 0.658906 0.377300
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.245477 0.570178 -1.099288 0.189026 -0.501227 -0.771736 -0.582460 -1.250034 0.620271 0.643792 0.373022
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.016878 -1.331071 1.991168 2.794124 1.212678 0.493709 1.545941 0.070356 0.633301 0.642535 0.372491
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.196792 0.167624 -0.608745 -0.630849 1.248217 2.043881 -0.336240 -0.531752 0.639633 0.655984 0.387500
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.392519 -1.190505 -0.493662 -1.316049 1.705445 1.061231 -0.451131 -0.724784 0.634318 0.648396 0.391381
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.470309 2.604129 -1.395087 -1.364655 -0.908100 -0.341169 -0.307638 -0.428194 0.630468 0.626132 0.386056
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 23.191576 0.804858 -0.528498 0.667844 3.938738 -0.690951 3.227113 -0.204249 0.479129 0.575392 0.348232
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.695297 -1.039641 11.516905 -1.182405 8.123473 -0.556431 1.336042 0.488757 0.048056 0.605385 0.455293
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.734153 13.740821 9.584805 12.290171 3.499734 9.559080 1.589386 1.431589 0.424668 0.044175 0.322123
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.418026 -0.062066 0.177522 0.866528 -0.178406 1.007557 0.006871 -0.109032 0.590475 0.614991 0.394818
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.131523 -0.366376 -0.276970 -0.249892 2.610575 2.447770 3.806120 13.310867 0.603147 0.627839 0.397319
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.519726 28.420830 -1.458906 -0.636073 -0.369346 3.234198 0.161502 23.223973 0.575399 0.481653 0.350312
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.485172 -1.059058 -0.378883 -0.816303 -0.432133 2.249411 -0.594561 0.115289 0.616622 0.638036 0.384734
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.590011 31.477722 0.150733 -0.267175 0.528496 0.651987 -0.290988 0.104375 0.622062 0.512440 0.345198
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.336007 -1.199413 0.071192 -1.171361 1.448447 1.243570 6.785056 -0.235551 0.636639 0.655129 0.379139
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.376244 1.724273 -0.005271 0.595800 0.000071 1.493011 -0.372243 1.148559 0.639920 0.656491 0.381100
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.514952 0.230773 0.582315 1.510611 7.676057 2.451159 0.194701 0.999535 0.636228 0.647002 0.372256
165 N14 digital_ok 100.00% 99.78% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.240642 0.469161 0.367985
166 N14 digital_ok 100.00% 99.95% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.266718 0.487002 0.386814
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.635949 -0.760565 -1.546613 -0.886521 1.499231 -0.388205 -0.701203 0.793694 0.645178 0.659491 0.381815
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.803418 -1.035208 0.296846 -0.290854 1.746743 0.609718 -0.439413 0.250942 0.639634 0.650608 0.385439
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.631451 -0.492351 -0.884051 -1.553019 0.785412 1.507270 -0.716406 1.447722 0.637786 0.643453 0.388338
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 12.095313 -0.384175 12.102410 -0.543997 7.804859 0.993504 1.731301 4.861563 0.047309 0.643576 0.493866
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.883819 1.506918 -1.553679 -0.268982 -1.234217 0.484760 -0.157026 2.444572 0.577316 0.573915 0.363977
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 13.507582 14.570353 4.983914 5.720865 8.164597 9.549749 2.103784 4.710334 0.038395 0.046563 0.005301
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.724518 -0.931088 -0.826749 -1.087344 0.714750 6.751043 -0.562043 0.572283 0.600020 0.626349 0.395279
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.249494 14.662515 -1.565246 12.687186 0.837305 9.348437 14.353904 1.574854 0.618868 0.060116 0.503127
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.842660 0.259219 1.293988 0.880284 -0.472888 -0.128890 -0.030932 3.273972 0.623079 0.642409 0.387666
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.173471 13.680941 -0.670386 12.222810 8.981446 9.569925 2.586985 1.366704 0.635259 0.054689 0.477217
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.009896 1.057209 0.074909 1.029420 1.472295 -0.000071 0.535415 0.077048 0.625431 0.645314 0.369113
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 25.631005 -0.294765 6.857420 -1.406303 9.587311 0.812606 8.204832 -0.376439 0.465836 0.654011 0.384501
185 N14 RF_maintenance 100.00% 99.89% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.268193 0.579965 0.450272
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 3.007588 -0.900926 0.486168 -0.399463 -0.443609 -0.260734 -0.551513 -0.951246 0.623023 0.658120 0.381142
187 N14 digital_ok 100.00% 15.41% 0.00% 0.00% 9.325998 -0.669218 11.028677 -0.094292 5.914888 1.996991 0.408575 -0.691484 0.277787 0.650581 0.446933
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.704564 13.531039 11.266506 12.366880 8.711927 9.599350 13.532209 1.895588 0.029404 0.034561 0.002595
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.882773 -1.481441 -0.523679 0.163573 -0.342223 0.018797 -0.353919 -1.259551 0.626215 0.645266 0.395114
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 0.543101 -0.812478 1.662413 -0.356700 -0.047404 1.090659 5.874450 1.198939 0.603678 0.624435 0.390506
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 3.574335 6.870659 3.244255 4.811474 4.677633 7.557052 -0.181014 -2.997051 0.584610 0.569223 0.384755
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.710753 0.973611 5.069522 1.474154 6.345409 2.280108 -2.893541 -0.457018 0.549196 0.588465 0.404000
200 N18 RF_maintenance 100.00% 100.00% 58.32% 0.00% 13.051170 40.529225 5.441601 -0.064820 8.147555 3.812975 0.962495 9.564434 0.044668 0.213190 0.133823
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.311230 5.009403 3.173725 4.140831 3.175233 6.148312 -0.950536 -2.448827 0.605564 0.610785 0.376430
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.883978 2.516088 1.582207 -1.282168 1.079400 0.606583 -0.979885 23.938983 0.620297 0.616114 0.371212
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.145420 15.786604 1.598493 -1.081327 -0.047883 0.451697 12.314952 1.322992 0.622085 0.652953 0.386233
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 9.123553 0.830031 4.454594 -1.320039 5.216897 -0.127822 19.885697 2.461988 0.385298 0.626623 0.441557
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.156812 5.993135 -1.014019 2.955937 10.362091 2.676468 0.103536 0.446051 0.589923 0.518664 0.374470
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.616077 0.596580 -0.802737 -1.106362 -1.102846 3.721999 5.715971 -0.356328 0.610343 0.609643 0.368504
208 N20 dish_maintenance 100.00% 99.68% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.536261 0.456549 0.456902
209 N20 dish_maintenance 100.00% 99.78% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.576001 0.535985 0.340526
210 N20 dish_maintenance 100.00% 99.73% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.451624 0.473416 0.250663
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% -0.081183 14.459953 -1.498314 6.171363 -0.890133 9.326605 0.079213 0.718871 0.574506 0.043840 0.483153
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.122318 -1.278232 0.428403 -0.554814 -0.677752 -0.594417 2.044931 -1.029957 0.610256 0.616768 0.376093
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.420411 -0.662048 -0.590085 -0.909270 8.423932 -0.973242 5.440085 -0.808088 0.596471 0.625226 0.378336
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.174159 -0.371183 -0.133496 0.011223 -0.170672 -0.860002 2.665322 -1.309500 0.608751 0.632198 0.379804
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.617347 -0.698694 -1.425219 0.143460 -0.752258 4.507177 0.511688 2.358657 0.595230 0.632807 0.381872
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.855345 6.179688 5.265429 4.685353 6.531450 7.179506 -2.976053 -2.481137 0.581504 0.604856 0.373225
225 N19 RF_ok 100.00% 0.00% 83.24% 0.00% -0.109490 13.999973 0.844381 5.886205 -0.572624 9.159324 -1.395213 0.970558 0.615921 0.152221 0.497612
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.406073 21.202355 -0.643061 0.504741 -1.170337 3.171971 -0.794492 1.463475 0.605780 0.515685 0.360931
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 3.792767 0.901960 2.327172 -1.141891 0.603906 8.193369 9.385026 7.199739 0.503263 0.597838 0.398726
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.960210 -0.362504 1.015914 -1.490809 0.343041 -0.956320 0.284369 0.548331 0.586419 0.593082 0.373788
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.568580 0.747667 0.818587 1.409973 -0.472684 1.118962 0.702909 -1.812662 0.587427 0.600673 0.395115
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.441130 -0.701240 0.046045 -1.554598 -0.430784 -0.209403 0.937661 -0.577174 0.549183 0.600475 0.390084
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.120309 -0.647007 0.957370 0.526035 -0.465710 -0.351116 -1.187498 -1.508797 0.601019 0.617706 0.385847
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.957145 -0.858856 -0.210865 0.187460 -0.395064 -0.102744 1.767865 3.039570 0.603452 0.620820 0.385554
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.456489 -0.255931 -0.005765 -0.513995 -0.674396 -1.131310 6.595653 2.764598 0.598058 0.617707 0.382621
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.552314 -1.101153 -0.388217 0.083275 -0.931551 -0.640289 0.463709 -1.045507 0.597334 0.623950 0.391186
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 24.607166 0.395887 -0.216592 1.141894 2.335318 1.347076 -0.669576 -0.544292 0.466037 0.619593 0.385436
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 21.580056 -1.166194 1.015272 -1.608310 2.471389 -0.094844 -0.924579 -0.364755 0.466069 0.602312 0.381867
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.181612 -1.272052 -0.900302 -1.233858 -0.900108 -0.403846 2.733053 5.540825 0.560217 0.607218 0.389545
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.955310 0.027253 0.652316 -1.230792 -0.262395 -1.039302 -1.397365 0.314837 0.587531 0.599393 0.385623
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.194342 15.114586 -0.843076 5.599438 -0.539955 9.514264 -0.144302 -0.042526 0.574399 0.042923 0.481082
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.125724 1.689642 0.334278 -0.291486 0.303729 -0.699608 3.698088 -0.006871 0.581307 0.576762 0.379089
262 N20 dish_maintenance 100.00% 0.86% 9.73% 0.00% 12.584101 13.658502 5.968844 6.360498 2.979786 4.095472 0.413722 2.878943 0.277605 0.258050 0.124002
320 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 2.713023 2.908498 1.056221 1.396599 0.553694 1.547467 1.585350 -1.149964 0.479641 0.506002 0.368207
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.551943 -1.029546 1.150128 -1.328252 0.535695 3.929183 -1.068386 0.597019 0.518181 0.522863 0.383769
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.798178 -0.055458 -0.887944 -1.188621 20.738851 -1.103664 6.663638 1.856694 0.474896 0.511830 0.374544
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.836774 3.542468 -1.019619 -1.466326 -1.020941 -0.922013 0.886727 1.324716 0.468055 0.490176 0.356523
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, 10, 15, 16, 17, 18, 19, 20, 27, 28, 29, 30, 31, 32, 34, 36, 38, 40, 42, 45, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 77, 78, 79, 80, 81, 84, 85, 86, 87, 92, 93, 94, 95, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 112, 113, 114, 117, 120, 121, 122, 123, 124, 127, 128, 131, 132, 134, 135, 136, 140, 142, 143, 144, 145, 151, 155, 156, 158, 159, 161, 162, 164, 165, 166, 170, 173, 179, 180, 182, 184, 185, 187, 189, 191, 192, 193, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 221, 223, 224, 225, 226, 227, 240, 242, 243, 244, 246, 262, 320, 329]

unflagged_ants: [4, 5, 8, 9, 21, 22, 35, 37, 41, 43, 44, 46, 48, 49, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 82, 83, 88, 89, 90, 91, 105, 106, 115, 118, 125, 126, 133, 137, 139, 141, 146, 147, 148, 149, 150, 157, 160, 163, 167, 168, 169, 171, 181, 183, 186, 190, 220, 222, 228, 229, 237, 238, 239, 241, 245, 261, 324, 325, 333]

golden_ants: [5, 9, 21, 37, 41, 44, 65, 66, 67, 69, 70, 83, 88, 91, 105, 106, 118, 141, 146, 147, 148, 149, 150, 157, 160, 163, 167, 168, 169, 171, 181, 183, 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_2459995.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 [ ]: