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 = "2460072"
data_path = "/mnt/sn1/2460072"
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-7-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/2460072/zen.2460072.21278.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/2460072/zen.2460072.?????.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/2460072/zen.2460072.?????.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 2460072
Date 5-7-2023
LST Range 9.553 -- 19.515 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: 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
Nodes Not Correlating N07
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 62 / 198 (31.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 103 / 198 (52.0%)
Redcal Done? ❌
Never Flagged Antennas 93 / 198 (47.0%)
A Priori Good Antennas Flagged 51 / 94 total a priori good antennas:
7, 15, 17, 19, 20, 31, 37, 38, 40, 42, 53,
55, 65, 66, 70, 72, 81, 83, 86, 93, 94, 103,
109, 111, 112, 118, 121, 124, 127, 136, 140,
147, 148, 149, 150, 151, 158, 160, 161, 164,
165, 167, 168, 169, 170, 182, 184, 189, 190,
191, 202
A Priori Bad Antennas Not Flagged 50 / 104 total a priori bad antennas:
8, 22, 35, 36, 43, 46, 48, 49, 50, 52, 57,
64, 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_2460072.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.310519 7.199314 -1.027143 -0.640873 -0.650720 -0.386835 -0.806703 3.941677 0.603234 0.479373 0.391242
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.127639 1.564820 0.414001 2.871676 0.755452 1.821423 -0.144542 1.102461 0.612079 0.576128 0.394413
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.880050 -0.123607 -0.466914 0.085972 -0.034616 0.322973 0.577602 6.878102 0.617834 0.592469 0.385108
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.621633 1.655922 1.125843 1.174012 0.223086 0.332162 -1.265818 -0.911452 0.592242 0.569890 0.371051
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.689012 -0.496020 2.860674 -0.368809 1.632107 -0.045038 2.540519 -0.267111 0.600259 0.591484 0.386498
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.634131 -0.801354 -0.388073 -0.569012 -1.147013 -0.233684 -1.052317 0.370406 0.604866 0.577852 0.382186
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 7.938580 -0.663273 -0.494243 -0.506701 -0.570676 -0.183248 -0.096460 1.008887 0.497249 0.590288 0.368575
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.176233 1.360477 0.256760 0.935215 -0.676591 0.067979 -1.234215 -1.487559 0.612007 0.580504 0.386738
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.296406 2.042940 0.803493 8.393093 1.046010 -0.349614 0.274553 3.391223 0.624022 0.479219 0.431197
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.496990 5.373931 0.773080 1.732652 0.755528 0.274094 6.148637 21.803128 0.604775 0.389578 0.451306
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.540310 1.620887 -0.249277 3.455362 0.150938 1.925839 -0.288307 7.707091 0.629028 0.598433 0.383079
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.949569 -1.007156 1.662704 -0.411069 1.403369 -0.069092 2.188241 0.001413 0.616216 0.610739 0.374248
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.148029 0.001802 -0.019387 0.219709 0.276466 0.338401 0.526835 0.402330 0.619929 0.600095 0.384052
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.987483 -1.148167 -0.352696 -0.633176 -0.739250 -0.651845 -0.074059 -0.198596 0.585103 0.570089 0.383304
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.357189 14.641733 9.872171 6.257798 1.426707 0.618704 9.594094 48.943066 0.076025 0.066608 -0.021844
28 N01 RF_maintenance 100.00% 100.00% 9.67% 0.00% 5.092994 9.677792 10.174003 4.140358 1.355972 0.405711 1.813017 21.336548 0.031032 0.294835 0.232018
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.935790 -0.210103 -0.135259 -0.001392 0.319427 0.480234 0.485103 0.912358 0.638662 0.615878 0.385505
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.188457 -0.936613 0.121157 -0.610595 0.462738 -0.254636 0.682915 -0.109516 0.639291 0.622143 0.383360
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.554583 1.410662 0.962981 3.009207 1.233992 1.216857 0.494781 13.901845 0.645391 0.614361 0.383154
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.732498 10.362641 0.068886 -0.060056 -0.707826 -0.335632 1.395880 2.499819 0.544494 0.544169 0.226617
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 5.900048 -0.343131 5.970240 -0.670796 1.329951 -1.121959 1.190189 -0.101783 0.045439 0.588477 0.425748
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.334266 -0.944945 -0.307779 -0.511284 -1.141755 -0.284776 -1.164790 0.087767 0.601946 0.577430 0.384219
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.241756 2.218472 0.966820 0.660963 1.028106 0.926185 0.546361 1.080078 0.594997 0.558909 0.395547
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.704026 11.857374 -0.734511 12.325026 -0.862785 1.391141 -0.896791 3.084876 0.605646 0.034768 0.489749
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.240302 -0.282420 -0.009880 0.517779 0.069097 0.477356 2.460386 7.861251 0.611387 0.582835 0.389155
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.134673 0.213074 0.258489 -0.318265 0.174360 0.262033 23.033741 0.645037 0.249134 0.242462 -0.294159
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.600842 1.504527 1.042356 2.240807 1.219500 0.791289 0.302061 0.855519 0.636617 0.614028 0.385322
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.530010 0.395265 -0.222411 -0.691424 -0.005306 0.152194 0.167591 1.218736 0.270613 0.258727 -0.293225
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.185255 0.274474 -1.001696 0.718604 -0.732550 0.706691 -0.718811 0.787639 0.648742 0.629876 0.381185
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.950789 0.448488 -0.619382 0.471798 -0.263939 0.484040 -0.488697 0.296858 0.650889 0.636116 0.384752
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.640474 0.642050 0.804712 0.539580 0.827964 0.755154 0.213985 1.508386 0.643468 0.627558 0.384393
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.293868 -0.930603 0.156336 -0.985473 0.356014 -0.412894 0.163577 -0.219628 0.638479 0.629283 0.393293
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 5.546529 6.731183 5.892893 5.822187 1.330217 1.351281 2.370918 1.133472 0.031233 0.056047 0.017233
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.705376 0.140894 -0.927782 0.080516 -0.986875 -0.554482 -0.915950 -1.249083 0.606185 0.589512 0.382197
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.432609 -0.737795 0.567484 -0.876798 0.126478 -0.967385 0.096026 0.438071 0.583168 0.575452 0.384901
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.007758 0.442993 0.523699 1.330658 0.680683 1.299403 0.129829 0.486199 0.594545 0.558015 0.393692
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 0.859131 -0.098043 -0.072727 -0.097911 0.216533 0.047695 60.886227 0.430294 0.600428 0.576081 0.390459
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.093202 1.373077 0.499886 0.238696 0.823521 0.575858 2.083304 0.563216 0.624217 0.591612 0.391397
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.339043 -0.078470 -0.088299 -0.697678 0.516071 -0.747498 3.904677 4.438618 0.633151 0.604996 0.391468
54 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.715709 1.416546 0.866583 -0.786667 0.567431 0.063989 -0.127535 -0.076274 0.347803 0.379173 0.171361
55 N04 digital_ok 100.00% 13.88% 100.00% 0.00% 0.150263 25.340062 -0.114031 7.568699 -0.906605 1.557022 0.770661 0.882557 0.267863 0.044671 0.101238
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.973993 1.860772 -1.029966 1.494927 -0.604489 2.337352 -0.483005 1.540059 0.648793 0.621129 0.375202
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.909877 0.176461 -1.004973 -0.000916 -0.452824 0.256427 0.448929 0.952819 0.656679 0.635077 0.379553
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.834111 6.288075 10.181113 10.612355 1.324542 1.354442 1.580489 1.657477 0.038876 0.038711 0.001881
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.370394 0.933028 10.193600 0.885386 1.302871 1.030712 1.150466 8.176347 0.053550 0.632536 0.471684
60 N05 RF_maintenance 100.00% 0.00% 90.87% 0.00% 0.657325 6.181506 0.185928 10.637783 0.207852 1.321617 0.167318 2.802806 0.632078 0.106940 0.502645
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 5.801883 -0.949119 5.659683 -0.480824 1.323980 -0.396454 0.431099 0.179050 0.036535 0.601394 0.425491
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% -0.346883 0.353321 0.601149 0.000860 -0.428642 -0.772443 0.849515 -1.050354 0.591501 0.594727 0.381527
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.769895 6.415631 -1.045482 6.180555 -0.938599 1.375318 -0.513681 2.433263 0.612287 0.046729 0.479205
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.776089 -0.692199 -0.825581 -0.046255 -0.618815 -0.244727 -0.454508 0.351584 0.597370 0.569160 0.378540
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 12.643832 11.851555 12.760166 12.697668 1.378196 1.413464 4.052207 5.378922 0.024028 0.033347 0.009610
66 N03 digital_ok 100.00% 21.29% 100.00% 0.00% 1.347019 12.303401 0.806612 12.829730 -0.014689 1.354528 -1.392158 5.166260 0.224346 0.057111 0.098705
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.986295 0.116454 -0.511780 0.835618 -0.260704 0.789806 2.379430 1.834120 0.622957 0.593371 0.389200
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 13.389224 -0.178854 12.798518 -0.363640 1.337934 -1.048771 4.364880 -0.722120 0.034616 0.605049 0.473610
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.970639 1.376372 1.262747 -0.584528 1.098661 -0.094952 1.329819 1.424207 0.642708 0.618513 0.382301
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% 0.234704 2.066513 1.081895 2.268428 0.737145 1.818490 2.949185 0.974957 0.277143 0.257863 -0.286410
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.870494 0.002470 -0.223356 0.417588 0.135843 0.373897 -0.261231 0.916031 0.659726 0.640040 0.379234
72 N04 digital_ok 100.00% 1.62% 91.14% 8.86% 0.875231 6.457295 2.114363 10.738300 0.949723 1.070772 10.628665 2.088378 0.294316 0.094158 0.001775
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.841586 1.167777 -0.607628 1.058019 -0.043281 1.166075 0.134990 4.126682 0.663046 0.643534 0.384316
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.286125 -0.229417 -0.760077 -0.155563 -0.860976 0.154935 -0.345437 1.374844 0.654490 0.641918 0.385747
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 20.597469 5.248256 0.258248 -0.736012 0.467291 -0.670506 2.062441 -0.263889 0.420038 0.522658 0.252214
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 10.720422 0.139591 0.153992 0.080086 -0.587941 -0.708465 0.067726 -0.803479 0.480652 0.599002 0.349225
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.646948 -0.936297 0.747498 -0.769864 0.102763 -0.544741 1.750638 -0.014355 0.590915 0.587110 0.382236
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.677487 1.261659 -0.692700 0.962998 -1.146677 0.122101 -0.971096 -1.413914 0.604782 0.568510 0.389600
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 91.800460 23.019132 34.184310 20.972341 3.353055 1.964449 605.394911 242.965319 0.017271 0.016518 0.001085
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 18.032658 23.243464 22.389304 20.244003 1.827047 3.213253 407.136623 293.678636 0.016571 0.016563 0.000821
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 18.586102 23.104720 22.668856 23.835842 3.469120 2.254745 454.199967 374.421864 0.016395 0.016233 0.000736
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.074020 13.493808 0.528790 12.870147 -0.477920 1.261794 -1.542724 4.283268 0.621800 0.057260 0.464288
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.334611 1.288146 -0.637915 -0.729981 -1.169334 -0.124141 -1.000985 1.918779 0.640328 0.616413 0.371226
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.220038 -0.234655 0.923540 0.078035 0.446323 0.282359 0.704904 8.928780 0.649229 0.628393 0.371907
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 13.865645 1.136301 2.667800 -0.809895 1.743602 -0.941174 128.106472 4.984999 0.528382 0.641759 0.341194
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.051256 0.662434 0.690927 1.290453 0.705862 0.786101 0.346598 0.453061 0.658011 0.639406 0.371915
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.270600 0.346085 0.705301 0.966574 0.688736 0.868113 -0.058659 0.332017 0.660118 0.641339 0.378592
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.659990 -0.857602 -0.086216 -0.883518 0.120776 -0.811943 0.081974 -0.119307 0.655396 0.643131 0.383329
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.014907 0.046377 0.810811 0.570863 0.845274 0.664698 0.347642 0.268464 0.645610 0.637400 0.390066
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.114288 0.063711 10.216162 0.353368 1.351671 0.600632 0.783931 0.639013 0.037359 0.632265 0.434077
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 5.227548 6.407766 10.266704 10.680547 1.315045 1.346641 2.338346 2.156691 0.031808 0.025439 0.003156
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 5.581268 2.063195 10.403466 8.569156 1.358847 0.368897 1.200862 2.421412 0.029086 0.484579 0.327936
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.052881 -0.400361 -0.175027 -0.429518 -0.214326 -1.081418 0.272214 -0.822320 0.597618 0.595546 0.387413
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.341120 8.747714 0.095009 -0.571833 -0.829742 -0.618839 -1.390350 -0.018455 0.609804 0.502259 0.362872
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.267619 0.715201 -0.851747 0.388594 -0.783934 -0.200929 -0.056144 5.583880 0.596226 0.559915 0.378582
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.287077 2.514954 0.174594 0.955243 0.452003 0.937750 -0.136346 0.516989 0.630020 0.604047 0.383929
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.061357 -0.198354 -1.004627 -0.638631 -0.579962 -0.153547 -0.831516 4.734692 0.643620 0.618406 0.378834
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.176670 1.197308 -0.746002 -0.595488 -0.872745 -0.109311 1.365403 6.171280 0.646360 0.628177 0.369103
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.718751 27.393245 1.692590 6.090462 0.232164 1.687279 2.164614 1.671459 0.648422 0.618763 0.368751
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.182911 0.338386 0.352493 1.030218 0.700312 0.889008 0.168881 0.410864 0.658850 0.639150 0.371182
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.130569 -0.052664 0.326293 0.289667 0.150756 0.317868 0.823084 0.063979 0.657277 0.643031 0.375988
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.085157 -0.225567 0.279283 -0.222442 0.543673 0.046842 1.370060 1.042700 0.654295 0.641145 0.378627
108 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.328147 2.033982 1.181841 2.051285 0.846350 1.416446 4.755142 0.913368 0.648867 0.637918 0.385021
109 N10 digital_ok 100.00% 91.03% 100.00% 0.00% 4.987664 6.324223 10.279086 10.465122 1.319139 1.377992 0.848300 1.964464 0.097377 0.037898 0.048407
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 15.174640 -0.340780 0.510682 -0.004602 -0.550325 0.254213 0.213477 -0.099017 0.550632 0.629311 0.350886
111 N10 digital_ok 100.00% 0.00% 93.19% 0.00% 7.575812 6.300861 1.338162 10.531921 0.010848 1.348603 19.392214 2.404008 0.564173 0.087496 0.410066
112 N10 digital_ok 100.00% 0.00% 0.00% 100.00% 0.544508 2.281280 1.253082 8.707916 0.913563 -0.457148 1.216415 0.991309 0.248989 0.175616 -0.257395
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.512944 2.314399 1.645625 1.661907 0.703718 0.812111 -2.169449 -1.877889 0.590486 0.563098 0.377588
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.082444 1.796303 1.364266 3.314387 0.406752 0.400415 -1.670790 1.754773 0.580742 0.498930 0.372578
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.187446 -0.896984 -0.669441 -0.633692 -0.582059 -1.115758 -0.316563 -0.746315 0.585568 0.563049 0.381400
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 19.906636 31.342045 22.810576 25.686409 2.374055 4.429684 330.515467 446.939647 0.017175 0.016189 0.001183
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 16.482278 24.003814 21.914399 23.836845 2.859724 3.355740 437.337181 438.864588 0.016499 0.016268 0.000762
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.786898 -0.172957 2.331491 -0.500188 1.705342 0.006045 2.202746 -0.078619 0.631521 0.616987 0.380817
121 N08 digital_ok 100.00% 0.38% 0.00% 0.00% 1.509183 2.145650 0.914280 5.008347 0.014246 1.595706 -0.937720 7.194759 0.616060 0.611551 0.368372
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.848956 1.574641 -0.158525 -0.819663 0.053035 -0.283665 -0.222165 -0.505051 0.656365 0.636668 0.375194
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.256684 1.344539 1.443595 0.341977 0.612740 -0.430665 -1.499638 -1.164127 0.627717 0.635169 0.371137
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 5.129154 -0.114201 10.387147 0.657998 1.310731 0.776343 0.912380 0.655240 0.044154 0.645647 0.432895
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.557209 0.690507 3.683523 1.156262 0.462581 0.799754 1.686093 0.627787 0.638988 0.639885 0.378694
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.088717 0.051819 0.572758 0.896055 0.260607 0.831072 0.673889 0.349775 0.655628 0.639898 0.386265
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 5.062921 -1.147445 10.217573 -0.847711 1.345061 -0.592041 0.749049 -0.219035 0.037752 0.635240 0.432383
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.325657 -0.646282 -0.392684 -0.611905 0.061984 -0.787790 0.800014 1.651524 0.642846 0.626968 0.399014
131 N11 not_connected 100.00% 0.00% 28.36% 0.00% -0.888612 5.904112 -0.809078 5.958118 -0.981857 0.734012 -0.909444 0.963126 0.612628 0.281349 0.440301
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.920601 -0.670298 -0.847338 -0.620193 -0.969330 -0.434326 -0.152941 -0.002606 0.602750 0.574028 0.378964
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.583658 -1.139053 -0.570246 -1.000309 -0.536421 -1.011493 -0.132935 -0.184807 0.591477 0.569423 0.384873
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.120551 1.643696 2.443940 1.132188 -0.093109 0.378706 6.226761 -1.592871 0.516602 0.538325 0.386230
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.991991 -1.202527 -0.591122 -0.908357 -0.038299 -0.301613 0.054393 -0.063665 0.572187 0.548517 0.394265
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 4.715795 -0.594501 9.982683 -0.158430 1.347970 0.089418 1.264477 0.570218 0.041698 0.560494 0.412319
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 13.737193 24.229472 19.601861 21.999562 1.175858 1.779508 245.508767 335.330390 0.016661 0.016329 0.000740
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.450115 -0.495933 -0.000860 -0.854861 -0.891429 -0.827100 -1.306615 0.426859 0.613025 0.589110 0.374045
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.946382 -1.244253 -0.033139 -0.975969 0.251267 -0.891194 32.203017 3.110704 0.616753 0.617526 0.373286
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.308816 -0.472674 0.125605 -0.449308 0.322356 -1.076034 0.091189 -0.951833 0.644437 0.623165 0.374014
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.488327 6.329014 -0.356359 10.654544 0.300322 1.357501 10.437856 2.066609 0.651792 0.047950 0.528844
143 N14 RF_maintenance 100.00% 89.52% 100.00% 0.00% 5.463402 6.228310 10.031518 10.623293 1.147592 1.355399 0.739656 1.840993 0.136310 0.034307 0.087565
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.506932 -0.825040 -0.291494 -0.385154 0.068255 -0.847448 -0.330014 -0.696090 0.660441 0.640029 0.382548
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.110952 0.822684 0.265463 1.109399 0.306785 0.440100 0.160549 1.383492 0.655571 0.634827 0.378915
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.651264 -1.047538 -0.679540 -1.024500 -0.672390 -0.894078 -0.473655 -0.256823 0.634075 0.624289 0.385498
147 N15 digital_ok 100.00% 99.89% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.321527 0.311764 0.201996
148 N15 digital_ok 100.00% 99.95% 99.73% 0.00% nan nan inf inf nan nan nan nan 0.152988 0.353521 0.254816
149 N15 digital_ok 100.00% 99.78% 99.89% 0.00% 110.456467 110.540960 inf inf 548.993868 562.174580 4515.789428 4768.305282 0.184305 0.163058 0.192604
150 N15 digital_ok 100.00% 99.95% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.254591 0.468968 0.345846
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.910526 -0.102406 -0.614147 0.954609 -0.626900 0.362539 -0.390179 3.973393 0.504443 0.562593 0.336947
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 4.918043 -0.891814 10.115705 -0.200309 1.352863 -0.054534 2.052161 0.740611 0.042451 0.553487 0.415252
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.741158 6.260115 6.710071 10.513931 0.282294 1.380195 4.945850 2.289199 0.518976 0.040732 0.406407
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.492650 0.437788 0.536843 0.802014 0.663628 0.874144 -0.066484 0.368358 0.597092 0.578561 0.389395
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -1.115847 -1.264041 -0.998640 -1.028941 -0.202807 -0.375039 1.182405 6.956382 0.612369 0.594508 0.391572
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.115734 7.831426 0.184978 -0.025231 -0.365417 -0.465206 -0.026192 1.709747 0.592059 0.486585 0.354558
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 5.403479 -0.707315 10.189413 -0.331898 1.333523 0.177860 0.946315 -0.106901 0.047968 0.615379 0.483691
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.189354 14.881989 0.423024 0.500060 0.608668 -0.518541 -0.092893 -0.017618 0.638732 0.517881 0.347387
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.565379 -1.121737 -0.578619 -1.059826 -0.839665 -0.411492 2.137952 -0.558677 0.647562 0.631515 0.380314
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.042705 0.609181 0.351689 0.534682 0.625498 0.722183 -0.077778 0.682353 0.654540 0.638511 0.382911
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 1.286684 0.956321 2.252860 0.987546 0.468293 1.054602 5.704185 1.413097 0.648771 0.634687 0.376603
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 8.415940 -0.315029 0.696091 -0.224267 -0.445013 0.127228 3.298739 0.093548 0.559132 0.635839 0.351938
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.102161 -0.506003 0.956090 -0.255768 0.950015 -0.964509 0.267910 -1.050079 0.646517 0.627551 0.377401
167 N15 digital_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.167838 0.198837 0.189554
168 N15 digital_ok 100.00% 99.89% 99.84% 0.00% nan nan inf inf nan nan nan nan 0.172825 0.295950 0.231047
169 N15 digital_ok 100.00% 99.84% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.303139 0.399118 0.270546
170 N15 digital_ok 100.00% 99.73% 99.73% 0.00% nan nan inf inf nan nan nan nan 0.328205 0.284050 0.219958
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.343429 -1.195071 0.554903 -1.078612 -0.186015 -1.032786 -0.027679 -0.238625 0.580372 0.572059 0.386316
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.785623 0.498088 1.135816 0.144598 0.190599 -0.678048 -1.829801 -0.631751 0.587156 0.560101 0.385119
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.532888 2.434107 1.660113 1.705795 0.781628 0.891815 -2.180221 -1.601050 0.558087 0.520958 0.372555
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.073222 0.055011 0.542380 0.500245 0.301266 0.496909 0.042244 4.575828 0.614370 0.593975 0.393690
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.589778 6.632256 -0.669521 10.731598 -0.143765 1.341852 6.895982 2.382471 0.625364 0.055650 0.516144
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.388829 0.793835 1.424604 0.981729 0.942213 0.885661 0.303099 2.662351 0.633501 0.615335 0.388346
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.780102 6.227601 -0.705069 10.445444 -0.964763 1.371224 0.799983 2.567978 0.642529 0.051225 0.487594
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.513548 0.589309 0.514894 0.905006 0.727130 0.724286 0.195898 0.675093 0.645924 0.623182 0.374599
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 6.301394 -0.094555 8.924410 0.177914 0.760491 -0.017286 1.709217 0.304773 0.387876 0.630686 0.401701
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.733826 -0.164377 -0.884292 0.087831 -0.420106 0.163362 -0.330164 0.127874 0.650983 0.630685 0.381944
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.793169 -1.125345 -0.520647 -1.010767 -1.156895 -1.004623 -0.951959 -0.568648 0.645449 0.627108 0.379458
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.260808 -0.421213 -0.200278 -0.464981 0.281488 -0.790940 0.999515 -0.702850 0.638588 0.616793 0.384057
189 N15 digital_ok 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.156771 0.128080 0.141834
190 N15 digital_ok 100.00% 99.57% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.262798 0.266518 0.216053
191 N15 digital_ok 100.00% 99.73% 99.73% 0.00% nan nan inf inf nan nan nan nan 0.349954 0.296199 0.210648
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.161832 2.662068 1.460797 1.864700 0.510238 0.982776 -1.994964 -1.947136 0.569797 0.524406 0.374900
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.801296 2.274726 1.856997 1.648766 0.906562 0.843896 -2.255025 -1.968332 0.552500 0.519027 0.370227
200 N18 RF_maintenance 100.00% 100.00% 12.32% 0.00% 5.870264 16.591814 5.842132 0.519856 1.349856 0.462524 1.568087 4.321597 0.042489 0.251344 0.167803
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.114180 2.004312 0.747116 1.502951 0.005306 0.651390 -1.500063 -1.884844 0.612372 0.573295 0.386762
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.188459 -0.476078 0.014886 -0.461788 -0.810569 -0.109927 -1.277187 33.093733 0.625353 0.598346 0.377645
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.255259 4.519711 1.653091 -0.594995 1.020066 -0.055360 8.577423 0.362576 0.637823 0.618185 0.378050
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.558023 -1.033735 4.201679 -0.889985 -0.369956 -0.557139 1.459946 7.115406 0.442986 0.609117 0.423641
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.910358 1.693680 1.862756 3.022416 -0.239387 -0.029066 0.472141 1.017031 0.571639 0.526339 0.352650
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.531404 -1.059056 -0.936790 -1.062821 -0.782261 -0.626694 2.745706 -0.518593 0.598946 0.597775 0.380072
208 N20 dish_maintenance 100.00% 99.78% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.349896 0.314191 0.260130
209 N20 dish_maintenance 100.00% 99.89% 99.89% 0.05% nan nan inf inf nan nan nan nan 0.272227 0.197321 -0.078801
210 N20 dish_maintenance 100.00% 99.89% 99.89% 0.00% nan nan inf inf nan nan nan nan 0.838404 0.594931 0.711836
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% -0.564388 6.509279 -0.572073 6.156430 -0.406366 1.344378 -0.040684 1.430098 0.585046 0.040870 0.489709
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.671495 -1.027563 -0.576981 -0.958710 -1.116973 -0.891244 0.306435 -0.428591 0.615176 0.585327 0.382434
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.955706 -0.825576 -0.941682 -1.047945 -0.535487 -0.761466 1.687606 -0.380368 0.614260 0.593985 0.379870
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.607080 -0.526206 -0.779832 -0.660429 -0.951087 -1.152665 1.301132 -0.795205 0.617251 0.599367 0.379691
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.905477 0.394025 -0.210422 1.524793 -0.393135 0.153366 -0.126993 9.403348 0.615814 0.568484 0.382378
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.970987 2.450603 1.995357 1.781791 1.032775 0.901111 -2.292456 -1.872463 0.583501 0.563458 0.368067
225 N19 RF_ok 100.00% 0.00% 72.39% 0.00% -0.090418 6.086087 -0.247948 5.940020 -1.023476 1.145996 -1.165040 1.819216 0.616079 0.192988 0.499556
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.211395 6.503046 -1.049937 -0.584821 -0.853842 -0.377864 -0.715906 -0.438101 0.609683 0.504165 0.369943
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.234924 -0.560439 2.234989 -0.504787 0.133815 -0.547096 10.710819 4.615270 0.545681 0.568296 0.389561
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.042819 -0.722234 -0.307475 -0.594176 -1.101925 -0.477214 -0.014780 0.399847 0.593341 0.560952 0.378524
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.019552 0.137075 -0.322641 0.083055 -1.122284 -0.713173 -0.845463 -1.249448 0.586612 0.553181 0.389423
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.385337 -1.001742 0.547517 -0.741104 0.150235 -0.458995 1.285188 -0.425918 0.572139 0.569729 0.391479
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.120856 -0.361266 -0.208180 -0.231478 -1.077996 -0.935525 -1.180189 -1.108855 0.606998 0.579221 0.390631
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.084863 -0.661524 -1.059030 -0.695189 -1.144982 -1.063761 -0.459401 0.322255 0.609767 0.582473 0.387791
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.855839 -0.643784 1.130615 -0.969647 0.182393 -0.642748 1.514094 0.509318 0.577602 0.583479 0.391648
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.123756 -0.908537 -0.961883 -0.706832 -0.973181 -1.147407 -0.265392 -0.836346 0.609717 0.583755 0.390879
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.246479 0.034015 -0.682273 -0.097395 -0.601960 -0.798516 0.191161 -0.921502 0.493927 0.577235 0.359403
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 5.331353 -1.146646 -0.209151 -0.688166 -0.434623 -0.412451 1.225698 -0.265469 0.517397 0.569657 0.365878
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.371590 -0.285397 0.183664 0.252473 -0.165929 -0.241621 1.013201 1.814548 0.583146 0.562480 0.376930
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.001802 -0.748581 -0.167535 -1.030877 -1.009434 -0.865933 -1.329522 0.246630 0.593570 0.560406 0.385403
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.732049 6.805828 -1.056760 5.793961 -0.652230 1.369750 -0.354610 0.875795 0.579103 0.040542 0.483824
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.484326 -0.623675 -0.586268 -0.849832 -1.072879 -1.003678 1.857394 -0.663814 0.582924 0.549486 0.382585
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.680193 5.154805 0.254363 0.474732 0.624780 0.613927 0.002836 0.931641 0.589068 0.554329 0.396219
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.426806 0.334603 0.710201 0.058901 -0.272144 -0.653266 -1.541053 -0.220291 0.484807 0.427176 0.352904
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.881281 1.030838 -0.033381 0.146155 -0.890140 -0.567165 -0.827210 -0.980933 0.475529 0.419369 0.343363
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.254263 -1.077948 -0.145065 -0.565211 -1.038839 -0.448913 -1.273882 -0.117375 0.512572 0.458671 0.369615
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 5.772495 6.502504 5.745683 6.280455 1.304724 1.330132 0.828419 0.876894 0.041770 0.039786 0.002129
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 0.493522 -0.059790 -0.090619 -0.597378 -0.085375 -0.264838 1.894518 0.002606 0.462161 0.416328 0.335586
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, 20, 27, 28, 31, 32, 34, 37, 38, 40, 42, 47, 51, 53, 55, 58, 59, 60, 61, 63, 65, 66, 68, 70, 72, 73, 77, 78, 81, 82, 83, 84, 86, 87, 92, 93, 94, 96, 97, 102, 103, 104, 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, 167, 168, 169, 170, 179, 180, 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, 21, 22, 29, 30, 35, 36, 41, 43, 44, 45, 46, 48, 49, 50, 52, 54, 56, 57, 62, 64, 67, 69, 71, 74, 79, 80, 85, 88, 89, 90, 91, 95, 101, 105, 106, 107, 113, 114, 115, 120, 122, 123, 125, 126, 128, 132, 133, 135, 139, 141, 144, 145, 146, 157, 162, 163, 166, 171, 172, 173, 181, 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, 21, 29, 30, 41, 44, 45, 54, 56, 62, 67, 69, 71, 85, 88, 91, 101, 105, 106, 107, 122, 123, 128, 141, 144, 145, 146, 157, 162, 163, 166, 171, 172, 173, 181, 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_2460072.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 [ ]: