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 = "2460075"
data_path = "/mnt/sn1/2460075"
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: 5-10-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/2460075/zen.2460075.42098.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 362 ant_metrics files matching glob /mnt/sn1/2460075/zen.2460075.?????.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/2460075/zen.2460075.?????.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 2460075
Date 5-10-2023
LST Range 14.760 -- 16.706 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 362
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: 94
not_connected: 24
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 40, 42, 70, 112
Total Number of Nodes 19
Nodes Registering 0s N15
Nodes Not Correlating N07
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 66 / 198 (33.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 107 / 198 (54.0%)
Redcal Done? ❌
Never Flagged Antennas 90 / 198 (45.5%)
A Priori Good Antennas Flagged 55 / 94 total a priori good antennas:
7, 15, 17, 19, 31, 37, 38, 40, 42, 53, 55,
65, 66, 67, 70, 72, 81, 83, 86, 91, 93, 94,
103, 105, 109, 111, 112, 118, 121, 124, 127,
136, 140, 147, 148, 149, 150, 151, 158, 160,
161, 164, 165, 166, 167, 168, 169, 170, 181,
182, 184, 189, 190, 191, 202
A Priori Bad Antennas Not Flagged 51 / 104 total a priori bad antennas:
8, 22, 35, 36, 43, 46, 48, 49, 50, 52, 57,
64, 73, 74, 79, 80, 89, 90, 95, 113, 114, 115,
120, 125, 126, 132, 133, 135, 139, 185, 201,
206, 207, 220, 221, 222, 224, 228, 229, 237,
238, 239, 240, 241, 244, 245, 261, 320, 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_2460075.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
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.126099 7.471534 -0.990912 -0.650187 -0.433418 0.301267 -0.860069 3.294011 0.436907 0.346402 0.281323
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.089459 0.586942 0.526809 3.256455 0.852500 1.226121 0.552330 1.729781 0.449225 0.434031 0.289647
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.887098 -0.102034 -0.426935 0.172058 -0.189277 0.390820 0.641880 8.344483 0.454494 0.449981 0.283799
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.481563 1.642142 1.148183 1.157988 0.399439 0.327491 -1.802862 -1.473915 0.422517 0.419795 0.261954
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.893311 -0.296006 3.092903 -0.355156 2.063048 0.335492 1.666546 -0.173306 0.429310 0.440239 0.273852
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.771070 -0.755715 -0.378383 -0.540995 -1.241444 -0.088441 -1.250478 -0.027527 0.427134 0.424790 0.270218
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 7.804699 -0.474875 -0.583275 -0.551824 -0.489935 0.006796 -0.387613 1.006266 0.349551 0.448409 0.285946
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.052311 1.338220 0.302699 0.927010 -0.721581 0.057389 -1.313945 -1.685848 0.447077 0.437222 0.284292
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.139941 1.977263 0.899273 8.493109 1.303536 -0.802445 0.123587 4.555436 0.464245 0.352559 0.319148
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.349239 3.440634 0.980482 1.738425 0.635795 0.239245 5.652118 15.691888 0.433165 0.275162 0.311328
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.442396 0.453324 -0.220465 3.729231 0.196601 0.398136 -0.422296 9.834389 0.466999 0.460983 0.286196
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.939708 -1.020320 1.933501 -0.437437 1.507090 0.488625 1.681128 -0.205646 0.455699 0.461541 0.280209
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.112789 0.026236 0.026841 0.329970 0.725520 1.058212 0.097399 0.360832 0.443870 0.450762 0.275317
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.890458 -0.993425 -0.424420 -0.954535 -0.393605 -0.607060 0.261133 -0.000631 0.410133 0.414869 0.266068
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.419312 14.791512 9.855372 6.314544 1.133459 0.383510 2.963907 42.815085 0.064681 0.063143 -0.017161
28 N01 RF_maintenance 100.00% 100.00% 42.82% 0.00% 6.375792 8.731588 10.070949 4.235966 1.744125 0.001838 1.351989 13.847537 0.029364 0.204501 0.153160
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.738958 -0.044199 -0.133996 0.068375 0.658471 0.580912 1.001170 1.322851 0.473298 0.477324 0.291409
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.222502 -0.786528 0.161109 -0.625046 0.357512 -0.276979 0.269560 -0.117888 0.477566 0.484474 0.289346
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.488270 0.264086 1.107445 2.987671 0.861205 0.727042 0.251246 20.580948 0.480945 0.475236 0.287468
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.468720 11.263290 0.091281 -0.004610 -0.874027 -0.258874 0.454755 2.143907 0.374073 0.405626 0.160418
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.185140 -0.535081 5.910767 -0.654429 1.729905 -0.860762 1.120554 -0.010990 0.042661 0.436510 0.299282
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.239066 -0.878540 -0.087772 -0.768034 -0.839796 -0.304230 -0.229120 0.838636 0.425665 0.424128 0.268165
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.756334 2.959972 1.025940 0.759623 0.587436 0.702504 1.174559 1.998148 0.426682 0.416939 0.272183
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.833313 12.952136 -0.665358 12.214129 -1.060194 1.393502 -0.902389 2.688801 0.431473 0.032807 0.338229
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.138401 -0.254066 -0.071949 0.510456 0.028247 0.260188 3.718718 9.389962 0.443553 0.443799 0.278609
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.238350 0.282443 0.273074 -0.304981 -0.141469 0.767768 28.733197 1.193796 0.195062 0.187440 -0.253222
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.584043 1.220635 1.233305 2.099521 1.346082 0.645510 1.624292 1.987750 0.472849 0.476980 0.295217
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.276077 0.592625 -0.243360 -0.564809 -0.595691 0.842558 -0.048118 1.297769 0.213961 0.202564 -0.253907
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.194368 0.018166 -0.980731 0.824189 -0.494482 0.727496 0.445997 2.104182 0.488503 0.492055 0.298350
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.858782 0.452251 -0.674816 0.512514 -0.095458 0.368167 0.187240 0.971679 0.484107 0.495626 0.296550
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.573222 0.764176 0.892510 0.674166 0.994259 0.743367 2.072646 3.847994 0.479202 0.486134 0.291861
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.214269 -0.840727 0.173058 -0.992723 0.545093 -0.310663 0.221125 -0.084608 0.471140 0.483224 0.294165
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 6.851783 7.939090 5.837020 5.790356 1.866574 1.539193 3.779964 2.781112 0.030908 0.054656 0.016214
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.607610 0.113652 -0.934881 0.113582 -0.775840 -0.612194 -0.991118 -1.270518 0.432215 0.438159 0.265648
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.628585 -0.420617 0.211378 -0.606671 -0.086413 -1.061407 -0.143831 1.076732 0.413039 0.424895 0.264650
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.067027 -0.018166 0.527615 1.467144 1.013451 1.266166 2.200596 2.636769 0.420063 0.413684 0.268313
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 0.921893 0.178854 0.075197 -0.162490 0.730517 -0.044230 63.748060 0.078774 0.434088 0.435574 0.276191
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.623949 2.033524 0.576712 0.300361 0.599575 0.524789 2.961286 0.484942 0.458837 0.452763 0.282774
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.317114 -0.382306 -0.095485 -0.671923 1.243325 -0.773816 5.465945 4.565525 0.468411 0.464975 0.290392
54 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.908260 1.386543 0.911018 -0.524120 1.037445 0.775129 -1.369112 -0.653784 0.275938 0.323350 0.147342
55 N04 digital_ok 100.00% 80.11% 100.00% 0.00% -0.124520 26.604287 -0.082271 7.446675 -0.460371 1.410656 0.855937 0.719765 0.191327 0.040636 0.055652
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.142982 3.143652 -0.999081 2.090769 -0.870525 2.004176 -0.848910 1.278742 0.486891 0.472885 0.281227
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.822403 0.462692 -1.031068 0.021589 -0.105040 0.318130 0.470758 0.464293 0.490529 0.495985 0.295233
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.029554 7.517948 10.083092 10.533814 1.769421 1.439315 1.683294 1.835904 0.037746 0.037309 0.002564
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.614700 0.831065 10.098290 0.951495 1.851359 1.042919 2.503186 12.671425 0.045259 0.490779 0.346665
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.434413 7.413539 0.237303 10.561063 0.334998 1.362112 0.249804 2.424364 0.463390 0.068681 0.351771
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.066339 -0.953357 5.605180 -0.410680 1.808987 0.039003 2.018593 1.837162 0.034345 0.456266 0.303072
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% -0.371909 0.119192 0.427320 -0.000876 0.018623 -0.751102 0.603479 -1.164311 0.424164 0.446796 0.267082
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.735842 7.698018 -1.048744 6.142906 -0.856340 1.423620 -0.451731 2.485442 0.440690 0.044849 0.323287
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.734364 -0.625872 -0.822049 0.034168 -0.605791 0.161471 0.173921 0.695197 0.430010 0.420475 0.264951
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 13.829456 12.920952 12.612510 12.578806 1.746669 1.447615 4.362552 5.646319 0.023353 0.031418 0.008566
66 N03 digital_ok 100.00% 99.72% 100.00% 0.00% 1.082993 13.277226 0.834066 12.707496 0.408925 1.368946 -1.722834 4.864833 0.163645 0.045411 0.072412
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.679736 0.134924 -0.145461 1.429971 -0.030436 0.769979 4.269950 2.955711 0.458824 0.455560 0.282290
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 14.583069 -0.384857 12.653802 -0.383896 1.697467 -1.052984 3.987507 -0.651294 0.032069 0.465888 0.360285
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.775252 3.046627 1.380522 -0.498218 1.025544 0.196465 1.507731 0.521425 0.482960 0.481256 0.281571
70 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.229249 1.171478 1.193102 2.530648 0.191567 2.112650 4.566467 1.405540 0.218210 0.200734 -0.252939
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.316984 0.022001 -0.177329 0.390867 0.118768 0.277918 0.960137 2.411482 0.494169 0.502309 0.298127
72 N04 digital_ok 100.00% 40.61% 100.00% 0.00% 0.368622 7.714454 2.120002 10.688923 0.377386 1.159251 6.096650 2.265819 0.207691 0.074286 0.010428
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.790110 1.246048 -0.589860 1.322425 -0.033055 0.598254 -0.167335 2.744558 0.499501 0.503126 0.303320
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.839410 -0.074787 -0.749361 -0.057261 -0.538508 0.248267 1.242273 2.896083 0.486623 0.500459 0.302153
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 18.050675 5.181844 -0.001947 -0.762870 0.295615 -0.251411 3.363154 0.939103 0.298977 0.380743 0.180778
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 10.983346 0.015790 0.209146 0.082500 -0.307576 -0.568688 0.366178 0.577424 0.326746 0.451586 0.266019
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.614479 -0.801303 0.889348 -0.727441 0.232540 -0.549613 3.359800 -0.098358 0.424697 0.440496 0.268912
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.686036 1.267209 -0.651157 0.959092 -1.207838 0.267988 -1.071941 -1.551288 0.434917 0.417805 0.274144
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 41.013928 23.361484 24.462929 23.783983 7.340091 6.726735 310.518091 310.198831 0.017596 0.016216 0.001246
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 33.945631 28.771763 27.384094 25.526551 130.505891 12.236465 1108.468222 565.814942 0.016234 0.016200 0.000694
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 13.405604 22.416768 18.954661 21.484332 6.484724 7.472719 245.964909 319.163926 0.016720 0.016337 0.000783
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.138926 13.816208 2.743931 12.810926 1.445759 1.377604 0.244802 4.036114 0.464424 0.038360 0.337985
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.746189 -0.150083 -0.988024 -0.241382 -0.879941 -0.062615 -0.800682 0.000631 0.479583 0.481938 0.284329
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.337285 0.128993 0.793524 0.149949 0.737525 0.758156 -0.082073 8.148700 0.490180 0.493659 0.286997
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.503841 1.217522 3.245965 -0.768859 6.619732 -0.447864 27.175795 0.393291 0.406373 0.505355 0.286001
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.189763 0.767302 0.778653 1.349352 0.761448 0.575131 -0.073919 0.257929 0.498786 0.501608 0.293135
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.379019 0.276892 0.755926 1.120255 0.833287 1.017931 0.298650 0.759149 0.499791 0.503361 0.301433
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.583143 -0.988234 -0.010984 -0.866937 0.085318 -0.904943 0.078162 -0.025999 0.492073 0.501909 0.300945
91 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.325530 0.267911 10.115319 0.462088 1.745831 0.841648 0.537521 0.782594 0.034617 0.486186 0.333475
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 6.520314 7.627450 10.168431 10.602686 1.724455 1.390606 1.938317 2.015871 0.030644 0.025007 0.002773
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 6.856315 1.532834 10.296839 7.858254 1.727956 -0.486136 0.914989 1.271465 0.027980 0.378626 0.247817
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.181781 -0.464725 -0.088521 -0.426317 -0.234180 -1.081512 0.022094 -0.892984 0.431634 0.448188 0.271697
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.190119 8.988889 0.125769 -0.580715 -0.824275 -0.492748 -1.517400 0.198246 0.438440 0.363533 0.256489
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.083120 0.561715 -0.875227 0.506012 -0.696970 -0.083873 0.114563 6.541250 0.433774 0.418330 0.267305
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.901045 3.282900 0.189151 1.053640 0.753190 1.125510 -0.061304 0.603561 0.462938 0.462801 0.282649
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.890941 0.287764 -0.840791 -0.163968 -0.503721 0.067757 -0.687799 6.299170 0.482907 0.482239 0.283659
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.405246 1.329195 -0.688977 -0.581355 -0.822271 -0.054284 1.692272 9.546810 0.485352 0.493088 0.284472
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.300346 27.429160 1.250048 6.045899 -0.014602 0.723020 1.874881 2.027210 0.488358 0.483006 0.284461
105 N09 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.121079 0.946038 0.797295
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.025646 0.357927 0.248570 0.327556 0.200866 0.357112 0.512889 0.085607 0.499433 0.507117 0.296102
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.374699 0.058020 -0.073289 -0.564042 0.088715 -0.181818 0.559293 1.379674 0.496125 0.501069 0.296299
108 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 6.199241 7.557852 10.177696 10.384498 1.709615 1.410254 0.626970 1.746182 0.060606 0.036121 0.016914
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 15.068083 -0.233774 0.543064 0.021858 -0.680363 0.084871 0.198819 -0.107101 0.375478 0.481775 0.286935
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 10.722982 7.532945 1.672157 10.455093 0.816856 1.455978 3.353364 3.298112 0.380258 0.059227 0.261605
112 N10 digital_ok 100.00% 0.00% 0.00% 100.00% 0.452427 2.566924 1.436033 8.821416 0.193819 -0.805120 1.345145 1.048627 0.187831 0.136608 -0.207850
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.399084 2.352816 1.635376 1.619655 1.042208 0.881311 -2.289741 -1.988590 0.419048 0.413887 0.258927
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.963310 1.697346 1.361682 3.460007 0.694347 0.857083 -1.785482 1.683185 0.412209 0.365217 0.251589
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.138893 -0.880935 -0.698959 -0.609717 -0.230049 -1.051621 -0.359442 -0.805268 0.416621 0.416685 0.260189
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.595220 21.441387 26.038603 23.742769 12.410192 11.671874 420.728896 471.909746 0.016704 0.016305 0.000861
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 17.241768 20.732538 22.376077 21.852281 10.044784 6.718189 424.504063 298.638302 0.016262 0.016334 0.000710
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.334695 0.195920 2.531745 -0.465170 1.520075 0.176253 1.951899 -0.246046 0.466167 0.477138 0.282038
121 N08 digital_ok 100.00% 3.31% 0.00% 0.00% -0.085195 1.474095 -0.780147 5.214417 -0.227439 0.954192 5.372910 8.136642 0.444749 0.473936 0.284513
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.382691 1.615986 -0.152445 -0.772447 -0.128146 -0.237637 -0.101197 -0.223058 0.496459 0.500809 0.289738
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.616665 3.533397 0.960452 1.156531 1.020571 0.777388 -0.127317 0.526000 0.504627 0.509484 0.297103
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 6.389645 -0.073223 10.290286 0.798188 1.718612 0.807648 0.665558 0.738179 0.041520 0.511225 0.342316
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.351794 0.802111 3.603398 1.256291 0.262264 0.601956 0.393741 0.457982 0.481459 0.506368 0.301934
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.197820 0.242119 0.441064 1.042640 0.588914 0.838187 1.094894 0.247092 0.491760 0.501376 0.303652
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 6.151671 -1.094118 10.112116 -0.898406 1.739926 -0.317057 0.509982 -0.477295 0.035722 0.484926 0.332072
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.267967 -0.565130 -0.378584 -0.637293 0.202388 -0.986512 1.523514 0.991312 0.469296 0.477349 0.299703
131 N11 not_connected 100.00% 0.00% 83.15% 0.00% -0.965066 6.966697 -0.794670 5.938262 -1.295198 0.831853 -0.998313 0.870506 0.448354 0.184270 0.314725
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.928037 -0.519402 -0.831795 -0.557081 -1.011179 -0.490784 -0.266448 -0.026767 0.441255 0.430628 0.267699
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.481003 -0.978536 -0.559893 -0.979624 -0.723064 -0.985089 -0.337793 -0.326175 0.425863 0.426336 0.265796
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.677459 1.649017 2.610665 1.118554 0.089561 0.394157 7.154607 -1.652224 0.351622 0.388058 0.252545
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.392201 -0.933156 -0.489104 -0.895560 0.593858 -0.114807 0.022018 -0.105279 0.389810 0.392840 0.261313
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 5.865583 -0.495486 9.881778 -0.142038 1.745338 -0.042950 1.140005 0.396705 0.039006 0.409659 0.283388
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 18.985280 29.669352 23.318956 22.843649 12.670554 10.685521 513.177382 369.618792 0.016279 0.016319 0.000755
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.220133 -0.377202 0.050032 -0.868971 -0.894501 -0.791234 -1.404182 0.465238 0.443444 0.447553 0.269621
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 2.009959 -1.178903 -0.135937 -0.937543 4.112629 -0.701429 46.354354 4.078253 0.457933 0.479416 0.277779
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.250367 -0.641695 0.222344 -0.392692 0.614369 -0.983261 0.015382 -0.825516 0.487773 0.486665 0.283606
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.363272 7.563923 -0.257042 10.573387 0.498285 1.398525 15.945780 1.934822 0.496987 0.045346 0.393815
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.518896 7.417484 9.934288 10.545353 1.643487 1.483401 1.557128 2.770991 0.109416 0.032852 0.064508
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.313603 -0.795363 -0.325311 -0.247061 -0.170706 -0.758775 0.285426 -0.175773 0.504239 0.503412 0.298747
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.025445 0.458421 0.147403 0.814711 0.229227 0.057505 0.013777 0.546172 0.500392 0.502807 0.299955
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.614554 -0.957901 -0.626678 -1.051737 -0.648032 -0.785838 -0.622120 -0.429427 0.464346 0.479028 0.294205
147 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
149 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
150 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 101.214074 101.403115 inf inf 954.193816 965.697458 4387.930216 4509.391982 nan nan nan
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.867757 -0.507411 -0.638540 1.110267 -0.428788 0.208440 0.502703 7.101823 0.356816 0.420130 0.253050
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.125019 -0.730157 10.012229 -0.252619 1.747283 0.228553 1.698748 0.445201 0.040057 0.399690 0.285275
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.136048 7.481266 6.857890 10.432176 -0.265100 1.408278 5.435630 1.958140 0.340193 0.039329 0.245943
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.273338 0.260674 0.618012 0.887096 0.532244 0.834838 -0.199551 0.255160 0.418384 0.425886 0.271308
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.713726 -0.917382 -0.930229 -0.988862 -0.499444 -0.272224 2.607021 10.673608 0.440245 0.444718 0.278928
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.044157 8.074811 0.153075 0.009773 -0.285687 -0.247911 0.068365 0.744810 0.427954 0.356742 0.253586
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 6.660790 -0.548791 10.089172 -0.265533 1.750485 0.085959 1.165918 0.224716 0.044903 0.476487 0.366755
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.428971 14.672070 0.472761 0.561182 0.671774 -0.339529 -0.158582 0.119184 0.481573 0.388342 0.268184
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.472716 -0.953654 -0.542479 -1.040955 -0.760658 -0.237171 2.721304 -0.473688 0.487091 0.494985 0.292304
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.052639 0.902110 0.410778 0.660566 0.879609 0.692707 -0.108127 0.713823 0.499735 0.504500 0.296458
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.671248 1.078647 1.663378 1.172153 0.371975 1.364823 6.462947 2.401502 0.493155 0.499885 0.289692
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 8.010832 -0.211501 0.622653 -0.192318 0.224560 0.403475 3.871417 2.052053 0.410867 0.500121 0.285892
166 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 6.451357 -0.377929 10.249824 -0.225775 1.727707 -0.923758 0.760857 -1.023259 0.034812 0.483217 0.332154
167 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 111.627095 111.660580 inf inf 1164.257111 1157.937169 6087.735946 5991.256105 nan nan nan
168 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 111.521463 111.730526 inf inf 1121.694196 1146.432502 5658.608123 5820.055819 nan nan nan
169 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 94.065945 93.897228 inf inf 1033.718457 1017.005486 5057.907898 4930.096886 nan nan nan
170 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 113.734090 113.805318 inf inf 1278.772271 1279.048795 6852.184971 6853.837628 nan nan nan
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.384598 -1.337585 1.091222 -0.762054 -0.018623 -0.861265 -0.019183 -0.194441 0.419498 0.432290 0.275195
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.650274 0.442740 1.150731 0.130796 0.551837 -0.468281 -1.480847 -0.343568 0.420502 0.417622 0.269789
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.402984 2.452709 1.668427 1.676385 1.094429 0.931075 -2.305429 -1.837494 0.387702 0.375601 0.248403
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.509780 -0.423760 0.416932 0.034206 0.380555 -0.202312 -0.227842 8.220289 0.441941 0.448738 0.284190
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.524957 7.862805 -0.690445 10.654240 0.366279 1.432856 10.082627 2.888400 0.453635 0.052249 0.359798
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.045495 0.614618 1.410122 1.073591 0.811973 0.844821 0.130424 4.158700 0.470302 0.475175 0.292506
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.732313 7.442095 -0.663499 10.369980 -0.916465 1.467414 2.176583 3.347129 0.482842 0.048259 0.352235
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.437525 0.471481 0.614542 0.973060 0.917643 1.205163 0.194051 0.478921 0.489035 0.488112 0.286666
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 6.540082 -0.212845 8.602764 0.053900 0.795993 0.030677 3.102291 0.012403 0.283757 0.497958 0.321233
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.720623 -0.049763 -0.897314 0.113542 -0.696204 0.248961 -0.230671 0.390086 0.493721 0.496643 0.291884
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.002214 -1.134125 -0.509140 -0.964359 -1.168092 -0.783342 -1.104627 -0.574896 0.484039 0.487340 0.286197
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.161862 -0.658986 -0.064845 -0.486451 0.268393 -0.952345 1.255653 -0.729120 0.474340 0.475732 0.287743
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
190 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 100.795522 101.036662 inf inf 978.461355 994.920103 4555.024038 4714.254474 nan nan nan
191 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 106.525393 106.771062 inf inf 1031.254875 1045.837128 5026.151615 5126.019599 nan nan nan
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.085760 2.680194 1.442105 1.811618 0.812996 1.076627 -2.112659 -2.101762 0.404856 0.381399 0.258103
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.690290 2.331144 1.838570 1.613124 1.285777 0.891793 -2.375253 -2.050701 0.383416 0.377153 0.246992
200 N18 RF_maintenance 100.00% 100.00% 6.91% 0.00% 7.176023 16.935575 5.782269 0.343112 1.748705 0.848969 1.554824 2.307122 0.040560 0.222558 0.143326
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.049051 1.988410 0.808821 1.464070 -0.422568 0.794437 -0.968881 -1.321289 0.442006 0.426424 0.274357
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.085824 -0.364106 0.072992 -0.357856 -0.986685 0.175955 -1.438978 38.659452 0.462517 0.461764 0.276624
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.103032 5.066088 1.711821 -0.537893 1.277328 -0.023601 8.923931 0.316494 0.476107 0.478812 0.282624
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.378164 -0.810191 4.256076 -0.817068 -0.231841 -0.637207 1.307323 9.807444 0.295652 0.473161 0.323383
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.637773 1.686194 1.752709 3.171747 -0.091523 -0.659375 0.066301 0.774494 0.424686 0.396602 0.251194
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.685878 -0.901262 -0.904890 -1.052372 -0.949586 -0.667053 2.453292 -0.569991 0.440949 0.459450 0.282535
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% -0.392061 7.761339 -0.547669 6.122503 -0.717572 1.386048 -0.212366 1.269398 0.425025 0.038612 0.335923
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.721229 -1.047378 -0.510373 -1.029724 -1.277882 -0.658091 -0.331840 -0.517566 0.446318 0.442744 0.272747
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.955298 -0.646662 -0.949217 -1.036283 -0.523678 -0.616415 3.159702 -0.139363 0.452652 0.456205 0.278271
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.630929 -0.669618 -0.838028 -0.638142 -1.141209 -1.101385 1.229813 -0.814201 0.456752 0.461904 0.278478
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.904709 -0.032266 -0.222481 1.772399 -0.301299 0.003775 -0.295585 10.927031 0.454164 0.429204 0.274544
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.828427 2.489773 1.968933 1.733210 1.414875 0.971827 -2.418147 -2.051586 0.416617 0.419652 0.256327
225 N19 RF_ok 100.00% 0.00% 100.00% 0.00% -0.209254 7.269918 -0.224464 5.912049 -1.239502 1.215615 -1.273730 1.623515 0.455010 0.125284 0.351753
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.013587 6.394219 -1.062326 -0.561522 -0.863424 -0.478028 -0.806220 -0.504377 0.447758 0.373277 0.267848
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 0.750728 -0.470394 2.453386 -0.530162 -0.344663 -0.430654 13.104851 4.391793 0.386334 0.430466 0.282128
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.159452 -0.579269 -0.263771 -0.600792 -1.244324 -0.127534 -0.593671 0.031989 0.431073 0.422513 0.266405
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.022957 0.045860 -0.325383 0.086185 -1.038582 -0.511356 -0.935003 -1.254038 0.427433 0.415561 0.274079
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.284982 -0.884093 0.720570 -0.725036 0.210624 -0.320305 1.572994 -0.424265 0.401203 0.421868 0.274661
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.273630 -0.502731 -0.185189 -0.261170 -1.107789 -0.974880 -1.209875 -0.989650 0.440579 0.437657 0.283233
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.849655 -0.458268 -0.730524 -0.447486 -1.285226 -0.934056 -0.792431 0.137862 0.443340 0.439855 0.279775
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.468554 -0.462252 1.281246 -0.976687 -0.123766 -0.725947 1.426085 -0.042991 0.419300 0.447550 0.285506
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.257742 -0.942557 -0.954728 -0.683857 -0.923165 -1.013156 -0.213937 -0.827420 0.448558 0.444770 0.282767
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.388692 -0.081453 -0.690082 -0.069631 -0.647636 -0.785404 -0.595087 -1.043427 0.346700 0.436744 0.273950
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 5.956388 -0.972248 -0.217075 -0.650484 -0.513814 -0.484702 -0.035233 -0.152759 0.368625 0.433516 0.273815
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.314874 -0.460155 0.169122 0.211466 -0.327963 -0.422339 1.009934 2.193814 0.425785 0.425264 0.263697
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.507127 -0.558938 -0.405807 -0.823907 -1.289183 -0.681929 -1.288039 0.222397 0.434313 0.425119 0.269999
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.784557 8.046893 -1.046255 5.759993 -0.716527 1.400120 -0.642708 0.727016 0.422796 0.038313 0.330402
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.573612 -0.613044 -0.586432 -0.893682 -1.209028 -1.024262 2.873650 -0.574764 0.427049 0.416611 0.269006
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.429275 6.054592 0.319686 0.533153 0.706736 0.660320 -0.146046 1.074069 0.426183 0.416654 0.277035
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.162304 0.157802 0.707627 0.028499 0.129378 -0.398794 -0.853735 0.576624 0.329258 0.306339 0.221797
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.747611 0.893413 -0.024109 0.135872 -0.734628 -0.418554 -0.537746 -0.405647 0.319829 0.300317 0.212918
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.038806 -0.946961 -0.136607 -0.508318 -1.065324 -0.251060 -1.377178 -0.035390 0.351748 0.331863 0.240939
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 7.040785 7.735271 5.688986 6.245041 1.715397 1.380662 0.584019 0.739646 0.040850 0.039077 0.002300
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 0.679364 -0.059682 0.000876 -0.535122 0.655863 0.534880 2.082967 0.033159 0.319230 0.310800 0.213375
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 7, 15, 17, 18, 19, 27, 28, 31, 32, 34, 37, 38, 40, 42, 47, 51, 53, 55, 58, 59, 60, 61, 63, 65, 66, 67, 68, 70, 72, 77, 78, 81, 82, 83, 84, 86, 87, 91, 92, 93, 94, 96, 97, 102, 103, 104, 105, 108, 109, 110, 111, 112, 117, 118, 121, 124, 127, 131, 134, 136, 137, 140, 142, 143, 147, 148, 149, 150, 151, 155, 156, 158, 159, 160, 161, 164, 165, 166, 167, 168, 169, 170, 179, 180, 181, 182, 184, 189, 190, 191, 200, 202, 204, 205, 208, 209, 210, 211, 223, 225, 226, 227, 242, 243, 246, 262, 329]

unflagged_ants: [5, 8, 9, 10, 16, 20, 21, 22, 29, 30, 35, 36, 41, 43, 44, 45, 46, 48, 49, 50, 52, 54, 56, 57, 62, 64, 69, 71, 73, 74, 79, 80, 85, 88, 89, 90, 95, 101, 106, 107, 113, 114, 115, 120, 122, 123, 125, 126, 128, 132, 133, 135, 139, 141, 144, 145, 146, 157, 162, 163, 171, 172, 173, 183, 185, 186, 187, 192, 193, 201, 206, 207, 220, 221, 222, 224, 228, 229, 237, 238, 239, 240, 241, 244, 245, 261, 320, 324, 325, 333]

golden_ants: [5, 9, 10, 16, 20, 21, 29, 30, 41, 44, 45, 54, 56, 62, 69, 71, 85, 88, 101, 106, 107, 122, 123, 128, 141, 144, 145, 146, 157, 162, 163, 171, 172, 173, 183, 186, 187, 192, 193]
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_2460075.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 [ ]: