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 = "2459982"
data_path = "/mnt/sn1/2459982"
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-6-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/2459982/zen.2459982.21291.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

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

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1851 ant_metrics files matching glob /mnt/sn1/2459982/zen.2459982.?????.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/2459982/zen.2459982.?????.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 2459982
Date 2-6-2023
LST Range 3.642 -- 13.604 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 25
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 56 / 198 (28.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 88 / 198 (44.4%)
Redcal Done? ❌
Never Flagged Antennas 110 / 198 (55.6%)
A Priori Good Antennas Flagged 34 / 93 total a priori good antennas:
3, 10, 15, 16, 29, 40, 42, 54, 55, 71, 72,
81, 94, 101, 103, 109, 111, 121, 122, 123,
128, 136, 144, 147, 148, 149, 151, 161, 165,
170, 173, 182, 185, 189
A Priori Bad Antennas Not Flagged 51 / 105 total a priori bad antennas:
4, 8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 82, 89, 90, 97, 102, 115, 120, 125, 126,
132, 133, 135, 137, 139, 166, 201, 207, 211,
220, 221, 222, 223, 224, 227, 228, 229, 237,
238, 239, 240, 241, 244, 245, 261, 324, 325,
329, 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_2459982.csv

Build DataFrame¶

In [20]:
# build dataframe
to_show = {'Ant': [f'<a href="{ant_to_report_url(ant)}" target="_blank">{ant}</a>' for ant in ants],
           'Node': [f'N{nodes[ant]:02}' for ant in ants], 
           'A Priori Status': [a_priori_statuses[ant] for ant in ants]}
           #'Worst Metric': worst_metrics, 'Worst Modified Z-Score': worst_zs}
df = pd.DataFrame(to_show)

# create bar chart columns for flagging percentages:
bar_cols = {}
if use_auto_metrics:
    bar_cols['Auto Metrics Flags'] = [float(ant in auto_ex_ants) for ant in ants]
if use_ant_metrics:
    if np.sum(list(a_priori_flag_frac.values())) > 0:  # only include this col if there are any a priori flags
        bar_cols['A Priori Flag Fraction in Ant Metrics'] = [a_priori_flag_frac[ant] for ant in ants]
    for ap in antpols:
        bar_cols[f'Dead Fraction in Ant Metrics ({ap})'] = [dead_ant_frac[ap][ant] for ant in ants]
    bar_cols['Crossed Fraction in Ant Metrics'] = [crossed_ant_frac[ant] for ant in ants]
if use_redcal:
    bar_cols['Flag Fraction Before Redcal'] = [redcal_prior_flag_frac[ant] for ant in ants]
    bar_cols['Flagged By Redcal chi^2 Fraction'] = [redcal_flagged_frac[ant] for ant in ants]  
for col in bar_cols:
    df[col] = bar_cols[col]

# add auto_metrics
if use_auto_metrics:
    for label, modz in all_modzs.items():
        df[label] = modz
z_score_cols = [col for col in df.columns if 'Modified Z-Score' in col]        
        
# add ant_metrics
ant_metrics_cols = {}
if use_ant_metrics:
    for ap in antpols:
        ant_metrics_cols[f'Average Dead Ant Metric ({ap})'] = [average_dead_metrics[ap][ant] for ant in ants]
    ant_metrics_cols['Average Crossed Ant Metric'] = [average_crossed_metrics[ant] for ant in ants]
    for col in ant_metrics_cols:
        df[col] = ant_metrics_cols[col]   

# add redcal chisq
redcal_cols = []
if use_redcal:
    for ap in antpols:
        col_title = f'Median chi^2 Per Antenna ({ap})'
        df[col_title] = [cspa[ant, ap] for ant in ants]
        redcal_cols.append(col_title)

# sort by node number and then by antenna number within nodes
df.sort_values(['Node', 'Ant'], ascending=True)

# style dataframe
table = df.style.hide_index()\
          .applymap(lambda val: f'background-color: {status_colors[val]}' if val in status_colors else '', subset=['A Priori Status']) \
          .background_gradient(cmap='viridis', vmax=mean_round_modz_cut * 3, vmin=0, axis=None, subset=z_score_cols) \
          .background_gradient(cmap='bwr_r', vmin=dead_cut-.25, vmax=dead_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .background_gradient(cmap='bwr_r', vmin=crossed_cut-.25, vmax=crossed_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .background_gradient(cmap='plasma', vmax=4, vmin=1, axis=None, subset=redcal_cols) \
          .applymap(lambda val: 'font-weight: bold' if val < dead_cut else '', subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val < crossed_cut else '', subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .applymap(lambda val: 'color: red' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .bar(subset=list(bar_cols.keys()), vmin=0, vmax=1) \
          .format({col: '{:,.4f}'.format for col in z_score_cols}) \
          .format({col: '{:,.4f}'.format for col in ant_metrics_cols}) \
          .format({col: '{:,.2%}'.format for col in bar_cols}) \
          .applymap(lambda val: 'font-weight: bold', subset=['Ant']) \
          .set_table_styles([dict(selector="th",props=[('max-width', f'70pt')])])

Table 2: RTP Per-Antenna Metrics Summary Table¶

This admittedly very busy table incorporates summary information about all antennas in the array. Its columns depend on what information is available when the notebook is run (i.e. whether auto_metrics, ant_metrics, and/or redcal is done). These can be divided into 5 sections:

Basic Antenna Info: antenna number, node, and its a priori status.

Flag Fractions: Fraction of the night that an antenna was flagged for various reasons. Note that auto_metrics flags antennas for the whole night, so it'll be 0% or 100%.

auto_metrics Details: If auto_metrics is included, this section shows the modified Z-score signifying how much of an outlier each antenna and polarization is in each of four categories: bandpass shape, overall power, temporal variability, and temporal discontinuities. Bold red text indicates that this is a reason for flagging the antenna. It is reproduced from the auto_metrics_inspect.ipynb nightly notebook, so check that out for more details on the precise metrics.

ant_metrics Details: If ant_metrics is included, this section shows the average correlation-based metrics for antennas over the whole night. Low "dead ant" metrics (nominally below 0.4) indicate antennas not correlating with the rest of the array. Negative "crossed ant" metrics indicate antennas that show stronger correlations in their cross-pols than their same-pols, indicating that the two polarizations are probably swapped. Bold text indicates that the average is below the threshold for flagging.

redcal chi^2 Details: If redcal is included, this shows the median chi^2 per antenna. This would be 1 in an ideal array. Antennas are thrown out when they they are outliers in their median chi^2, usually greater than 4-sigma outliers in modified Z-score.

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 9.194973 11.417059 8.409544 8.983374 4.479884 5.250528 2.389768 3.158011 0.029792 0.031475 0.002577
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.250999 -0.568647 1.872505 -0.403829 1.547411 -1.086741 1.310915 -1.090367 0.681977 0.675103 0.311998
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.570151 0.586967 0.497670 0.424001 0.151955 1.270420 0.845635 0.893879 0.687901 0.683256 0.298426
7 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.209592 -0.690865 -0.587883 0.173020 0.039296 0.562904 0.660269 1.964653 0.682581 0.684449 0.298902
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.151263 -0.732823 -0.164055 0.307204 0.035974 0.305572 0.699590 1.101386 0.679710 0.679516 0.298700
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.638409 -1.131695 2.558729 -0.702327 0.670672 0.115949 2.332661 0.245390 0.662366 0.674250 0.302335
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.201579 0.194420 4.218030 -0.895184 0.607951 0.245982 3.446695 1.008557 0.629943 0.667722 0.307848
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 9.278531 11.684740 8.364934 8.927213 4.488833 5.270904 2.359849 3.110703 0.026885 0.025477 0.001687
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 9.076134 -0.098187 8.382339 0.877948 4.464968 1.238859 2.375547 0.741837 0.031590 0.692346 0.565854
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 1.069804 2.370993 0.567516 0.533115 0.678310 0.777139 0.312209 0.262889 0.692331 0.691901 0.298715
18 N01 RF_maintenance 100.00% 100.00% 12.59% 0.00% 9.910738 19.752902 8.371977 -0.192266 4.543846 3.956493 2.354865 4.707320 0.029944 0.289353 0.228869
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.207844 -0.279347 -0.654053 -0.464110 0.123423 1.289708 -0.201338 -0.013299 0.690786 0.694907 0.295403
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.508343 0.197963 2.202690 -0.620876 0.106327 0.595692 2.009579 -0.129483 0.683197 0.690551 0.298139
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.170722 0.002095 -0.263218 0.311768 0.297999 1.084585 0.954878 1.635947 0.673714 0.674278 0.293638
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.952877 -0.003960 -0.063595 -0.257072 -0.782483 -0.286629 -0.447041 -0.577362 0.637711 0.644664 0.303524
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.654340 10.877104 8.395886 8.803095 4.537824 5.292005 2.477638 3.275014 0.033689 0.036973 0.004263
28 N01 RF_maintenance 100.00% 0.00% 61.53% 0.00% 13.423753 29.788038 0.592585 2.487398 3.417504 5.924934 0.655219 5.460869 0.446093 0.208341 0.309546
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 9.011772 10.741297 8.091572 8.500736 4.521930 5.268095 2.385619 3.106478 0.029698 0.035393 0.006091
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.030714 1.244533 1.258252 -1.106873 1.370512 0.205560 0.379025 -1.221382 0.694347 0.705403 0.292682
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.700897 -0.430477 1.146065 1.056652 1.190645 -0.286568 0.987754 1.181429 0.708208 0.701621 0.289812
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.286398 21.206577 -0.315535 2.310211 0.497402 1.003242 0.416115 1.207833 0.694315 0.620141 0.275038
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.530086 12.191280 3.970944 4.288343 4.518201 5.240514 2.397523 3.125597 0.034495 0.045283 0.007288
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.314018 0.241367 0.578190 -1.246075 -1.076124 -0.702462 -0.563757 0.781147 0.645816 0.644106 0.299919
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 13.067248 12.025065 11.096671 11.078569 4.719831 5.424723 2.556650 3.409739 0.031772 0.029522 0.001109
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.137646 1.687890 -0.616787 1.477286 0.871613 1.066448 -0.104480 1.588737 0.702309 0.700179 0.288367
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.189377 0.315704 0.423529 0.678306 -0.003534 0.823007 0.761790 0.720404 0.712022 0.706812 0.286675
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 8.611296 2.685795 8.097874 0.645887 4.519640 -0.221137 2.456004 0.092691 0.036943 0.686719 0.515078
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.893200 0.236857 0.223101 0.304324 1.211922 0.578496 -0.006371 0.262557 0.710612 0.710194 0.276787
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.045332 2.017689 -0.499471 6.994629 1.079209 2.471015 -0.396327 2.075202 0.718556 0.624484 0.325625
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.192637 0.788380 -0.443178 0.842160 -0.515498 0.483603 -1.177270 0.609097 0.707391 0.706221 0.282987
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.329605 -0.854925 -0.820362 -0.173196 -0.532458 0.552748 -1.064240 -0.164999 0.701219 0.710418 0.287344
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.088745 2.574757 0.413977 0.726294 -0.328763 0.727828 0.380168 1.023747 0.694563 0.693034 0.279996
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.473407 -0.373027 -0.391449 -1.165706 -0.300784 -0.221905 0.165969 -1.043637 0.694514 0.701058 0.294449
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.360046 11.444914 3.883626 3.984248 4.545601 5.226099 2.775300 3.281304 0.030971 0.056933 0.017734
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.131301 0.111655 -0.088910 1.036449 -0.750819 -0.158411 -0.864113 -0.349317 0.657351 0.662626 0.302775
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.049531 -0.621304 0.085376 -0.865348 -0.081640 -0.954800 1.047335 0.651746 0.623331 0.651551 0.300381
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.693360 10.272885 0.576440 1.371671 0.034181 1.960794 1.506630 8.028142 0.684398 0.645281 0.283437
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 10.834419 5.762845 0.413566 1.802529 4.230565 2.893287 5.351783 0.051260 0.599260 0.601937 0.214603
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.001758 4.787477 -0.207982 0.549904 1.369531 0.827573 -0.085238 0.312687 0.712474 0.708512 0.281504
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.905375 1.528408 -0.882130 -0.743376 0.817730 1.152851 -0.340241 -0.610731 0.720733 0.717297 0.283425
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 17.929891 -0.546430 3.953534 -0.362699 0.675618 0.386863 1.955994 -0.300121 0.585886 0.718217 0.278136
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.286985 11.542193 8.425861 8.918401 4.534445 5.263580 2.437286 3.309044 0.027887 0.031003 0.002946
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.653791 -0.562114 -0.322927 1.303409 0.232069 -0.218060 -0.276812 1.116061 0.725496 0.723131 0.272806
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.060504 1.954920 6.431631 -1.147268 2.180747 0.478341 0.954141 -0.963687 0.498843 0.717149 0.316750
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.810034 11.113431 8.331002 8.914930 4.458588 5.234991 2.450276 3.181980 0.035042 0.034807 0.001294
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.460700 -0.471907 7.988192 1.064889 4.361246 0.982965 2.394043 1.257585 0.048148 0.706377 0.532873
60 N05 RF_maintenance 100.00% 0.00% 85.90% 0.00% 1.572216 11.248572 0.018489 8.916258 0.314045 5.291593 0.416139 3.449523 0.700624 0.119889 0.521681
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.551291 -0.850793 -0.110420 -0.823560 -0.287665 -0.816900 -0.666504 -0.909825 0.652634 0.672078 0.288441
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.316602 -1.154008 -0.670675 0.450463 -0.891076 -1.002373 -0.371640 -0.848013 0.650002 0.670298 0.296061
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.673220 11.633115 -0.658626 4.288086 -1.040724 5.304028 -0.669937 3.300795 0.658301 0.043844 0.484680
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.286030 -0.460343 -1.173930 -0.408686 -0.331344 -0.356603 0.327478 1.622164 0.642489 0.639757 0.292001
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.330709 1.457389 0.663184 1.160516 -0.256404 0.806965 0.679295 1.460410 0.686619 0.695057 0.295456
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.316803 0.697573 -0.735851 -0.679512 1.843496 0.175713 -0.406328 -0.746889 0.698901 0.705280 0.292923
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.063027 0.690820 0.110097 1.354794 0.137221 0.591813 0.446772 1.426762 0.714208 0.704491 0.279248
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 22.735976 21.184562 1.662491 11.744922 2.680847 5.444928 0.578454 3.652608 0.465387 0.028918 0.353544
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.355415 -0.248406 0.458925 0.942387 -0.468601 0.615913 0.310972 0.737809 0.714418 0.719869 0.268026
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.177562 -0.645347 0.145744 0.363711 0.806882 1.053593 -0.179686 0.134766 0.722260 0.724280 0.266748
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.771652 0.101441 0.656720 1.034538 0.792682 -0.195758 0.416093 0.747031 0.729528 0.727543 0.267504
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.908482 12.248674 8.735148 9.245944 4.396098 5.147119 2.349381 3.128935 0.034110 0.037425 0.004544
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.412403 2.299877 -0.790754 -0.656843 1.026755 -0.125079 -0.383504 -0.735465 0.719862 0.722036 0.274878
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.181640 -0.703788 -0.483359 -0.139204 0.310467 1.240890 -0.940039 0.221580 0.714396 0.720293 0.280099
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 51.690036 9.262623 0.296274 -1.002069 2.573616 3.350638 0.308495 -0.420796 0.462815 0.614565 0.264501
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 15.949253 -0.100663 -0.826031 0.430399 -0.035171 -0.923640 0.071474 -0.516982 0.525297 0.675303 0.298656
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.465013 11.763010 -0.845381 4.321985 -0.979857 5.192966 0.042444 3.059887 0.657059 0.039308 0.484950
80 N11 not_connected 100.00% 0.00% 96.38% 0.00% -1.012039 12.235610 -0.178562 4.246296 -1.235311 5.223979 -0.623178 3.161902 0.659940 0.062103 0.490183
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.941994 11.261127 0.452540 7.837672 0.093747 5.072028 0.271204 3.253273 0.666016 0.037178 0.485408
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.539034 0.092527 0.625719 2.024291 0.035011 0.004422 0.315954 1.308059 0.686295 0.683711 0.283454
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.136850 0.234141 0.528380 0.595108 0.236540 0.116393 0.109808 0.569863 0.699148 0.704086 0.279452
84 N08 RF_maintenance 100.00% 23.07% 100.00% 0.00% 10.454571 11.755948 10.721251 11.259500 3.693145 5.375048 1.403239 3.298092 0.332603 0.036029 0.209458
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.252788 1.280031 1.416015 1.433126 -0.374006 0.202360 0.551235 1.010050 0.715370 0.717996 0.266056
86 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.142388 -0.036005 1.408279 1.621114 0.495237 -0.268438 0.528679 2.261133 0.708773 0.715393 0.258393
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.807640 4.357559 -0.360114 -0.248244 0.519798 0.700274 2.024209 2.205765 0.717783 0.727828 0.259377
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.249787 0.196157 0.665556 0.895459 -0.112378 -0.637698 0.232995 0.362942 0.725055 0.725003 0.259547
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.157881 0.345646 0.357511 1.008303 -0.541944 -0.207043 0.094962 0.533246 0.725458 0.725984 0.266510
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.013563 -0.440060 -0.792341 -0.192537 0.242395 0.394296 -0.493577 -0.164819 0.723362 0.725908 0.269464
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.644434 -0.484678 0.654463 0.518129 -0.136073 -0.112750 0.369473 0.298231 0.711895 0.720367 0.276744
92 N10 RF_maintenance 100.00% 0.00% 1.08% 0.00% 28.576152 26.418410 1.023870 1.703887 3.398832 3.064986 0.624611 1.440674 0.385751 0.333285 0.067183
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.090915 -0.681351 2.020076 -0.561131 -0.092616 0.345225 1.867307 -0.440163 0.700139 0.707774 0.286888
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.786731 11.465587 8.517910 8.838050 4.509894 5.250924 2.395837 3.114654 0.031821 0.026284 0.002670
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.156210 4.935310 -0.679605 0.663230 0.301131 -0.320874 -0.454894 0.003328 0.630973 0.648630 0.278279
96 N11 not_connected 100.00% 0.00% 0.00% 92.06% 19.362156 0.471413 0.088278 1.856787 0.832692 1.083527 0.341042 1.022942 0.386100 0.363689 -0.214816
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.578388 3.406520 -1.266414 1.398471 -0.882744 1.650149 0.313078 3.472187 0.649848 0.617865 0.292570
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.506983 5.979364 -0.133617 1.082088 0.528702 1.038423 -0.144621 1.073614 0.710804 0.714299 0.276939
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.730882 0.052983 -1.078394 -0.418638 0.805512 0.836634 -0.816861 0.026855 0.719242 0.719755 0.272741
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.849089 3.193355 1.378097 -1.013224 5.234861 0.822164 1.081173 -0.281729 0.721545 0.725563 0.264734
104 N08 RF_maintenance 100.00% 0.22% 0.00% 0.00% 10.075884 39.577930 -1.051096 6.137870 0.889696 3.965903 -0.361376 4.911878 0.720376 0.715717 0.260437
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.520318 -0.024665 0.547473 1.002408 0.422986 -0.116427 0.120476 0.501410 0.727095 0.728165 0.260283
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 2.717498 1.337218 -0.909628 -0.171066 -0.847621 -0.697468 -0.652768 -0.436114 0.726648 0.728350 0.264444
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.659177 1.085455 0.298883 -0.018753 0.059589 0.390763 0.441182 0.054968 0.724581 0.728976 0.265345
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.294123 32.619442 8.356958 1.460984 4.522754 2.706285 2.443456 1.732283 0.034242 0.381132 0.195425
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 8.933842 11.039730 8.390020 8.715479 4.562910 5.282956 2.372034 3.207024 0.028130 0.026128 0.001805
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 20.217908 20.336428 11.187717 11.548370 4.559078 5.293045 2.411807 3.211984 0.023377 0.024755 0.000912
111 N10 digital_ok 100.00% 0.00% 87.30% 0.00% 22.800352 10.567661 1.645058 8.671700 2.092761 5.056369 0.877748 3.135462 0.401954 0.124819 0.216884
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.028857 -0.523102 0.519346 0.502125 0.003534 0.941933 0.509340 0.692295 0.694718 0.700943 0.290860
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.543531 12.021270 3.694240 4.323660 4.420496 5.190179 2.435728 3.104833 0.035665 0.030916 0.002578
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.366057 6.631158 19.414995 11.500123 35.089894 9.188666 147.257823 23.197329 0.016831 0.023422 0.003932
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.597987 -0.855663 -0.801641 -0.379774 -0.978376 -1.312263 -0.337006 -0.767906 0.641798 0.659077 0.301542
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.018962 12.279557 8.479909 9.215156 4.427759 5.270282 2.414890 3.301399 0.028081 0.031970 0.002826
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.134705 0.660337 0.160254 0.754038 -0.421197 0.405141 -0.125011 0.509476 0.683854 0.694834 0.292673
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.448194 1.435441 2.484170 -0.408474 -0.155612 0.889171 1.283600 -0.393517 0.705348 0.718850 0.274298
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.858160 3.274686 -0.640443 4.899808 0.662153 0.519182 0.061853 4.607009 0.717401 0.705890 0.264848
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.632760 4.562054 -0.902563 -0.948582 0.258530 0.931962 -0.510142 -0.955525 0.717619 0.728998 0.266153
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.216602 5.965792 0.845650 0.976898 0.543190 0.315420 0.540962 0.928298 0.735392 0.735820 0.261155
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.015350 0.646756 0.337886 0.827693 0.018308 0.530108 0.187032 0.656958 0.731466 0.733766 0.266418
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.058625 0.731555 -0.000535 0.892161 -0.281707 -0.177854 0.023877 0.589367 0.727911 0.727191 0.265643
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.432170 -0.397427 -0.690363 1.056432 -0.315124 0.157658 -0.338169 0.720576 0.725119 0.722565 0.267926
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.642348 0.615810 0.728398 0.590833 1.010044 0.473676 0.175557 0.349177 0.716160 0.724105 0.277533
128 N10 digital_ok 100.00% 0.00% 100.00% 0.00% -0.140515 10.666906 0.942707 8.902301 0.771510 5.207802 0.339947 3.292894 0.715050 0.040783 0.478666
131 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.668469 10.189504 -0.471293 4.141703 -0.787388 4.787697 -1.148567 0.675589 0.680383 0.412741 0.359946
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.480627 1.789049 -1.145706 -0.911906 0.787062 -1.012047 -0.671433 -0.744129 0.661542 0.664186 0.287926
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.861336 -0.632950 -1.079914 -0.740525 -1.276731 -1.289101 -0.256316 -0.997171 0.651174 0.670426 0.301425
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.336919 12.467856 3.810606 4.280678 4.428679 5.219286 2.310804 3.153247 0.039777 0.034709 0.002558
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.227509 -1.028520 -0.596780 -1.078929 1.231328 0.687195 0.366857 -0.542414 0.641934 0.669499 0.312448
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 8.259825 0.127520 8.046483 -0.341891 4.545913 0.320445 2.479536 -0.041509 0.040955 0.674873 0.455751
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.059822 0.305628 0.555258 -1.133613 1.084008 0.075861 0.281639 -0.954935 0.666963 0.684789 0.299006
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.677168 0.602346 0.839678 -1.137902 -0.878253 -0.930533 -0.281767 -1.426429 0.683245 0.687283 0.288111
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.063364 -1.284147 -0.514884 -0.517636 -0.370438 -1.093809 -0.078904 -1.236296 0.712000 0.711948 0.275111
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.058776 -1.129832 0.107285 0.139775 1.119760 -0.995248 0.223047 -0.921638 0.718259 0.716582 0.273630
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.093931 11.339710 -0.186002 8.926253 1.919032 5.292733 2.248725 3.237823 0.714121 0.047694 0.533185
143 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.759973 -0.956911 -1.098747 -0.621492 0.168921 1.552350 -0.425936 -0.709725 0.730603 0.728796 0.268644
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.109317 1.804351 -1.267774 6.720400 0.521795 1.230398 -0.810859 1.342081 0.729574 0.637045 0.305672
145 N14 RF_maintenance 100.00% 90.76% 100.00% 0.00% 9.229661 11.595316 8.389658 8.951189 4.372712 5.259938 2.292095 3.404643 0.100697 0.030072 0.055008
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.614971 -0.662410 -1.108360 0.032425 -1.031936 -1.245136 -1.019333 -1.170965 0.706374 0.715806 0.275834
147 N15 digital_ok 100.00% 99.24% 99.24% 0.00% nan nan inf inf nan nan nan nan 0.391905 0.409467 0.189896
148 N15 digital_ok 100.00% 99.03% 99.03% 0.00% nan nan inf inf nan nan nan nan 0.425300 0.445105 0.172376
149 N15 digital_ok 100.00% 99.41% 99.24% 0.00% 169.290484 169.394729 inf inf 2403.310248 2482.868272 770.265294 827.031431 0.335084 0.388919 0.210566
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.756918 -0.862494 -1.242037 -1.267891 -0.327648 0.352783 -0.555871 -0.783685 0.695205 0.699515 0.293652
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 13.387915 2.351274 -0.576632 0.701535 0.565213 -0.653389 0.513303 -0.156016 0.623729 0.652533 0.271286
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 8.737307 0.292787 8.158094 -0.882057 4.564281 0.158875 2.526077 -0.371504 0.042374 0.672735 0.465540
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.233733 10.210803 6.762207 8.715913 1.820801 5.249557 0.451258 3.315519 0.532388 0.038481 0.374494
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.227773 -0.028790 0.252294 0.810371 0.154102 0.516124 0.298981 0.933985 0.668237 0.683476 0.300344
158 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.151842 -0.786885 0.217310 -0.146990 1.385965 1.557168 0.346234 1.037962 0.682989 0.694108 0.298269
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.096404 17.651612 -1.032450 -0.650539 -1.113392 2.584517 -0.961396 2.948816 0.660367 0.600622 0.279694
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.095048 -0.914530 0.047163 -0.238939 -0.041406 0.967769 0.185592 0.006296 0.703204 0.707844 0.279723
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.115323 23.778531 0.337552 -0.035319 0.566901 0.841085 0.115839 -0.126966 0.712157 0.611032 0.256404
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 2.190335 -0.921080 -1.150975 -1.291165 0.938008 0.949895 -0.677548 -1.097103 0.710544 0.721890 0.278422
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.978911 1.315164 0.092374 0.629022 0.367790 0.686710 -0.006296 0.552159 0.725278 0.726156 0.273776
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.040729 -0.330181 0.698253 1.392145 -0.090541 1.550591 0.459706 1.152999 0.724155 0.723897 0.267151
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 16.268473 0.829108 -0.532815 -0.525762 3.043434 0.330034 1.174951 -0.195637 0.647699 0.725494 0.277017
166 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.671813 0.881751 0.000535 2.128753 0.214876 1.232106 0.289982 1.322284 0.721574 0.696409 0.295059
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.511414 -0.234245 -0.826239 0.174914 1.238598 -0.094507 -0.449379 0.433094 0.714429 0.714583 0.274975
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.336698 -0.321301 0.547130 0.020624 0.909514 0.478326 0.382831 0.083680 0.711155 0.711981 0.281354
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.189466 -0.325108 -0.432796 -1.132802 0.744941 0.593839 -0.164112 -1.060242 0.707927 0.709821 0.288988
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.252001 -0.123950 8.627930 -0.404637 4.467483 -0.460131 2.603528 0.526542 0.041277 0.707230 0.538399
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.109206 3.562135 -1.139086 0.388677 -1.106080 -0.372302 -0.905125 -0.679798 0.658510 0.640840 0.280985
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 10.937333 11.409072 3.439956 3.984529 4.597960 5.281064 2.699990 3.498668 0.039728 0.043768 0.003810
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.175023 -0.200435 0.385450 -0.569303 -0.057309 1.419107 0.291167 -0.446864 0.664152 0.690136 0.298522
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.258026 11.697742 -0.986014 9.040923 1.122173 5.210447 0.390141 3.304802 0.691974 0.053648 0.530077
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.769177 -0.696255 0.697604 0.664040 -0.006144 0.250154 0.401676 0.717643 0.704021 0.707778 0.285350
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.134890 10.510283 -0.629934 8.697161 0.182323 5.315459 0.339387 3.238989 0.714636 0.046988 0.501100
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.084407 1.010133 -0.304151 0.292679 1.183524 -0.349030 -0.242353 0.088473 0.707047 0.711261 0.269134
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.728677 -0.608381 -1.065408 -0.045504 -0.231110 0.037158 -0.175152 0.367477 0.722910 0.726946 0.265126
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 26.500934 0.775852 -0.220159 -0.860410 3.874084 0.746389 0.601528 -0.906093 0.620487 0.719573 0.269607
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.727056 -0.346065 -0.063703 -0.585667 0.215078 -0.489900 -1.025696 -1.327876 0.717270 0.719516 0.280669
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.002095 -0.989397 -1.271070 -0.335196 0.363704 0.770852 -0.571104 -1.208939 0.715793 0.714867 0.275581
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 8.284306 10.158689 8.025106 8.792814 4.583386 5.333457 2.577627 3.423103 0.028181 0.031237 0.001454
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.256365 -1.330566 -0.233763 -0.071679 0.085536 -1.160923 0.078553 -1.141298 0.702470 0.703452 0.295011
191 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.193409 0.648636 1.302844 0.014916 0.604427 0.440685 1.746377 0.664367 0.694313 0.696379 0.286969
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.404166 3.177612 3.472240 3.442631 2.903669 3.834592 1.676691 2.495083 0.633487 0.638688 0.308773
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.810486 0.436759 3.638282 0.952141 3.189282 -0.235737 1.823090 -0.208460 0.619164 0.662172 0.321424
200 N18 RF_maintenance 100.00% 100.00% 36.95% 0.00% 10.377070 30.654486 3.781452 1.310218 4.563912 2.884504 2.457411 3.849294 0.041141 0.258629 0.171710
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.467209 2.032797 2.095937 2.925248 0.898485 2.845516 0.571532 1.985096 0.677051 0.662644 0.306078
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% -0.402392 1.737633 0.870737 -1.103858 -0.797831 -0.417027 -0.373859 1.252640 0.691281 0.682246 0.288510
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.988475 13.749906 1.011972 -0.950885 0.075113 0.679339 2.075295 -1.088488 0.713906 0.713543 0.280723
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.898224 0.671356 2.787602 -0.105895 3.173006 -1.093497 0.505557 0.243257 0.493149 0.686731 0.367065
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.957998 6.020094 -1.241351 2.144226 3.899779 1.625250 -1.085499 -0.428984 0.689297 0.608920 0.301462
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.634099 0.762133 -0.990808 -0.867291 -0.936910 -0.606181 -0.426159 -1.097913 0.693190 0.692675 0.274309
208 N20 dish_maintenance 100.00% 98.76% 98.87% 0.00% nan nan inf inf nan nan nan nan 0.444002 0.362078 0.225295
209 N20 dish_maintenance 100.00% 98.97% 99.24% 0.00% nan nan inf inf nan nan nan nan 0.380284 0.309596 0.210185
210 N20 dish_maintenance 100.00% 99.19% 99.14% 0.00% nan nan inf inf nan nan nan nan 0.368438 0.420616 0.219409
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.908970 1.965252 -1.240221 -0.487484 -0.824006 -1.234651 -0.811967 -1.403306 0.664930 0.663519 0.280576
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.063694 -1.045972 -0.081081 -0.736869 -1.009430 -1.214156 -0.609840 -1.456279 0.681612 0.678314 0.294505
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.269546 -0.059730 -1.123794 -0.982258 -0.322411 -1.011368 0.256326 -1.476034 0.675248 0.684745 0.289969
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.596627 -0.919615 -0.685554 -0.341307 -0.344799 -1.057247 -0.970134 -1.343898 0.685671 0.690357 0.286082
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.604318 -0.847286 -0.960201 -0.029233 -1.148974 -1.101498 -0.875881 -0.934788 0.684445 0.692705 0.286530
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.694857 2.736419 3.773738 3.334235 3.414315 3.602257 1.937532 2.381277 0.655268 0.659287 0.305255
225 N19 RF_ok 100.00% 0.00% 57.86% 0.00% -1.179010 11.406553 0.116680 4.106878 -0.982090 5.147744 -1.052124 2.741084 0.696544 0.234938 0.518385
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.482918 16.485067 -0.825105 0.144865 -0.913159 0.707173 -1.139890 0.281927 0.692605 0.610049 0.274063
227 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 3.907490 -0.083531 1.887480 -0.700511 0.517475 -1.262104 -0.315545 -1.403241 0.601916 0.685081 0.314331
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.871237 -0.186130 0.490755 -1.125801 -1.227542 -0.885247 -0.746177 -0.978133 0.677503 0.674928 0.286194
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.039794 0.025543 -0.013660 0.748074 -0.369035 -0.445219 -0.857192 -0.601816 0.674729 0.676437 0.296832
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.242897 0.273364 0.323213 -1.006132 -0.948542 -0.814920 -0.686584 -1.134164 0.633055 0.658265 0.303489
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.302771 0.671399 0.678663 0.203489 -1.040829 -0.987119 -0.629666 -0.946733 0.672957 0.672231 0.303635
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.681123 -0.843007 -0.110139 0.014944 -0.964974 -0.720880 -0.703537 -0.845272 0.679227 0.675121 0.296499
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.344737 0.846050 -1.070823 -1.198748 -1.063580 -0.980486 -0.817046 -1.012080 0.680541 0.680735 0.292549
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.131992 -0.826313 -0.734622 -0.240905 -0.550328 -1.211096 -1.029565 -1.261200 0.686418 0.686126 0.296331
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 15.978780 -0.553180 -0.116567 0.934239 0.246048 -0.296970 -0.105268 -0.169942 0.565631 0.679433 0.276099
243 N19 RF_ok 100.00% 0.11% 0.00% 0.00% 57.790797 -0.267569 0.288324 -0.936288 5.683998 -0.842556 4.822499 -0.831822 0.425010 0.675420 0.399597
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.120295 0.181332 -0.430045 -1.060953 -0.798004 -1.079652 -0.265069 -0.983019 0.651822 0.672225 0.272795
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.744355 1.331831 0.471083 -0.901626 -1.180797 -1.201019 -0.939466 -1.371762 0.679503 0.673196 0.291938
246 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 25.157412 23.383106 -0.406651 -0.512077 2.192807 2.116051 0.619122 1.469260 0.376402 0.364641 0.124220
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.480821 1.562067 0.163446 -0.729623 -0.531153 -0.523130 -0.751170 -1.136843 0.669007 0.660146 0.291716
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 4.323363 5.112259 7.519501 8.299689 4.205052 4.846106 2.788200 4.495607 0.032327 0.027344 0.004379
320 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 10.794932 10.462502 5.743599 6.033082 4.594707 5.335845 2.374602 3.179225 0.054330 0.046790 0.005735
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 2.228717 2.562804 0.503299 0.837327 -0.586397 -0.442050 -0.183627 -0.815733 0.569191 0.566441 0.305943
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% -0.098025 -0.988296 0.554955 -1.158675 -0.803865 -0.705279 -0.399340 1.587262 0.640225 0.611815 0.292332
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.418308 0.528640 0.159334 -1.180400 0.943088 -0.800438 2.207087 1.046438 0.532258 0.578546 0.311855
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.428319 3.340278 -0.697509 -1.017310 -0.910945 -0.685680 1.262283 1.266994 0.523298 0.554896 0.314831
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, 10, 15, 16, 18, 27, 28, 29, 32, 34, 36, 40, 42, 47, 50, 51, 52, 54, 55, 57, 58, 59, 60, 63, 68, 71, 72, 77, 78, 79, 80, 81, 84, 87, 92, 94, 95, 96, 101, 103, 104, 108, 109, 110, 111, 113, 114, 117, 121, 122, 123, 128, 131, 134, 136, 142, 144, 145, 147, 148, 149, 151, 155, 156, 159, 161, 165, 170, 173, 179, 180, 182, 185, 189, 200, 204, 205, 206, 208, 209, 210, 225, 226, 242, 243, 246, 262, 320]

unflagged_ants: [4, 5, 7, 8, 9, 17, 19, 20, 21, 22, 30, 31, 35, 37, 38, 41, 43, 44, 45, 46, 48, 49, 53, 56, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 82, 83, 85, 86, 88, 89, 90, 91, 93, 97, 102, 105, 106, 107, 112, 115, 118, 120, 124, 125, 126, 127, 132, 133, 135, 137, 139, 140, 141, 143, 146, 150, 157, 158, 160, 162, 163, 164, 166, 167, 168, 169, 171, 181, 183, 184, 186, 187, 190, 191, 192, 193, 201, 202, 207, 211, 220, 221, 222, 223, 224, 227, 228, 229, 237, 238, 239, 240, 241, 244, 245, 261, 324, 325, 329, 333]

golden_ants: [5, 7, 9, 17, 19, 20, 21, 30, 31, 37, 38, 41, 44, 45, 53, 56, 65, 66, 67, 69, 70, 83, 85, 86, 88, 91, 93, 105, 106, 107, 112, 118, 124, 127, 140, 141, 143, 146, 150, 157, 158, 160, 162, 163, 164, 167, 168, 169, 171, 181, 183, 184, 186, 187, 190, 191, 192, 193, 202]
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_2459982.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 [ ]: