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 = "2460054"
data_path = "/mnt/sn1/2460054"
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: 4-19-2023
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

# find the auto_metrics file
glob_str = os.path.join(data_path, f'zen.{JD}*.auto_metrics.h5')
auto_metrics_file = sorted(glob.glob(glob_str))

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2460054/zen.2460054.42099.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

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

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 362 ant_metrics files matching glob /mnt/sn1/2460054/zen.2460054.?????.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/2460054/zen.2460054.?????.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 2460054
Date 4-19-2023
LST Range 13.381 -- 15.327 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 362
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 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 40
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating N05, N07, N14
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 183 / 198 (92.4%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 131 / 198 (66.2%)
Redcal Done? ❌
Never Flagged Antennas 0 / 198 (0.0%)
A Priori Good Antennas Flagged 93 / 93 total a priori good antennas:
5, 7, 9, 10, 15, 16, 17, 19, 20, 21, 29, 30,
31, 37, 38, 40, 41, 42, 44, 45, 53, 54, 55,
56, 65, 66, 67, 69, 70, 71, 72, 81, 83, 85,
86, 88, 91, 93, 94, 101, 103, 105, 106, 107,
109, 111, 112, 118, 121, 122, 123, 124, 127,
128, 136, 140, 141, 144, 145, 146, 147, 148,
149, 150, 151, 157, 158, 160, 161, 162, 163,
164, 165, 166, 167, 168, 169, 170, 171, 172,
173, 181, 182, 183, 184, 186, 187, 189, 190,
191, 192, 193, 202
A Priori Bad Antennas Not Flagged 0 / 105 total a priori bad antennas:
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_2460054.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 0.00% 100.00% 100.00% 0.00% 1.931326 2.080040 0.189726 -0.123028 0.869301 0.080928 0.287166 -0.043532 0.027591 0.027398 0.001478
5 N01 digital_ok 0.00% 100.00% 100.00% 0.00% -0.378205 0.648580 0.990687 1.622357 -0.394031 -1.070913 -0.004848 -0.002817 0.026575 0.025175 0.001164
7 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 0.725109 -0.361092 0.573045 0.865369 6.287540 5.151949 14.878530 17.045693 0.071190 0.026201 0.013190
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.190042 5.879566 7.978666 8.313396 14.962675 8.320041 -6.205149 -6.683073 0.515394 0.521260 0.383302
9 N02 digital_ok 0.00% 100.00% 100.00% 0.00% -0.409951 1.192296 1.571431 0.420888 0.282018 -1.049826 3.670218 -0.276818 0.061415 0.044239 0.033951
10 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 4.760316 2.193771 -0.876320 -0.889029 5.822367 11.987626 10.006158 5.827672 0.029112 0.028313 0.001906
15 N01 digital_ok 100.00% 0.00% 100.00% 0.00% 1.151297 6.463836 5.144717 4.875688 38.858098 33.222247 -0.520770 4.468360 0.437390 0.031006 0.219911
16 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 5.607297 6.515543 -0.909987 0.358185 9.243700 2.763265 6.639164 -0.452624 0.030091 0.037855 0.004151
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 5.315958 4.294129 2.873217 0.534887 59.254868 17.199266 3.076033 13.899167 0.540571 0.387651 0.422961
18 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.133937 1.464181 0.415702 -1.286564 59.981455 11.257786 187.481640 14.305814 0.027693 0.028164 0.001970
19 N02 digital_ok 100.00% 100.00% 100.00% 0.00% -0.303185 0.735107 0.836980 1.596708 1.060991 4.389505 0.502691 7.469281 0.029886 0.024745 0.004217
20 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 0.686716 0.811509 2.342926 0.218381 3.714014 0.488810 10.003571 -0.214807 0.026672 0.027507 0.002429
21 N02 digital_ok 0.00% 100.00% 100.00% 0.00% 1.343021 0.702458 0.690224 0.782955 0.960922 1.549923 1.394996 -0.355844 0.027108 0.025715 0.001767
22 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.606065 -0.438264 0.068516 0.189826 3.129372 2.569803 2.717944 4.498824 0.030597 0.029014 0.002351
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.859708 1.418156 2.036871 -0.986199 1.557728 15.091682 5.815489 85.026894 0.025162 0.029122 0.002856
28 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.968278 2.014660 1.985439 -1.478022 0.962035 7.890507 4.197372 3.442750 0.025296 0.029347 0.003056
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 0.691136 0.255957 0.356266 0.371817 2.679043 -0.032220 8.415334 2.195858 0.028337 0.026190 0.002203
30 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 2.779155 3.692972 -0.347807 -1.177005 32.514539 43.135687 62.857018 67.269895 0.027721 0.028152 0.001623
31 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 3.605928 -0.121079 2.838445 1.162597 6.395096 1.472138 3.521762 9.819943 0.023358 0.025819 0.001924
32 N02 RF_maintenance 0.00% 100.00% 100.00% 0.00% 2.357303 1.901596 0.154800 0.172666 0.975691 1.457945 -0.698385 1.732685 0.027100 0.027036 0.001391
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 1.573585 -0.645150 -1.493000 -0.660653 0.936734 0.887062 2.247995 4.980005 0.029427 0.029494 0.002167
35 N06 not_connected 0.00% 100.00% 100.00% 0.00% -0.860459 0.408512 -0.418719 -0.971625 -0.634733 -1.496311 1.569895 -1.203941 0.029614 0.029405 0.001901
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 2.318825 1.431252 2.425512 1.951819 7.175330 3.618665 2.204734 2.241492 0.024791 0.024481 0.001288
37 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 4.878616 -0.121539 0.702925 4.502093 4.834582 1.857721 1.934079 10.342615 0.026467 0.020663 0.004516
38 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 3.309185 2.186184 2.018815 1.823541 10.767815 16.659149 14.502270 22.961714 0.024622 0.024465 0.001022
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 5.957412 5.921863 3.875503 4.583597 38.393549 53.413599 21.925644 1.120754 0.144752 0.128028 -0.264696
41 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.604259 -0.210877 1.214660 1.088173 -1.270071 2.508084 -0.488607 0.246822 0.030704 0.025621 0.003997
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 1.403273 1.558042 0.542091 0.439635 2.650197 7.532119 0.312610 29.919852 0.035350 0.041708 0.006260
43 N05 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.410027 -0.766594 0.155385 1.005832 -0.497906 -0.841420 -0.815488 -0.604402 0.027329 0.026373 0.001485
44 N05 digital_ok 0.00% 100.00% 100.00% 0.00% 1.055964 -0.700351 0.582967 1.141537 2.171602 -0.189551 -0.167314 0.217235 0.027023 0.025822 0.001395
45 N05 digital_ok 100.00% 100.00% 100.00% 0.00% -0.435577 -0.640299 0.759285 0.720036 0.507899 2.963421 1.106583 4.610150 0.026576 0.025788 0.001382
46 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.345989 1.869396 -0.223295 -1.086588 20.441684 29.443695 26.639527 35.966611 0.027556 0.028337 0.001681
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 1.804071 1.997235 -1.418574 -1.093358 1.559768 -0.047159 6.234498 0.479454 0.030420 0.029048 0.002635
48 N06 not_connected 0.00% 100.00% 100.00% 0.00% -0.370490 0.251041 -0.554304 -0.075570 -0.413214 -1.038037 1.757333 -0.519431 0.032560 0.028878 0.003412
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 4.826493 5.770885 3.243211 5.611363 37.412590 30.219491 7.153546 34.014362 0.520010 0.561982 0.367440
50 N03 RF_maintenance 0.00% 100.00% 100.00% 0.00% 3.414276 1.745557 1.852281 2.427502 1.109186 0.639100 1.004873 3.157791 0.025355 0.023666 0.001387
51 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 3.988476 3.098789 0.806953 0.673326 84.168558 10.657628 363.630438 2.421024 0.045385 0.026596 0.005466
52 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.823153 1.173986 2.484633 2.110324 9.180366 0.803889 15.438578 2.819336 0.025355 0.023917 0.001881
53 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 2.573267 2.718905 1.931354 0.802830 8.368045 12.904621 21.801439 37.441181 0.051161 0.025558 0.007583
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 5.980987 1.971204 -0.543467 -0.081899 8.219536 5.701291 6.136769 16.082444 0.039206 0.039395 0.010139
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 4.409019 5.059117 -1.043988 -1.063162 3.428530 3.338925 3.120289 -0.071333 0.029937 0.028050 0.002748
56 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 1.551476 -0.344774 0.350911 1.684446 1.469611 0.482013 0.288488 0.896841 0.029418 0.024665 0.003785
57 N04 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.777382 0.137183 0.051774 0.479972 6.206879 6.117339 -0.027288 -0.177580 0.031668 0.040540 0.006981
58 N05 RF_maintenance 0.00% 100.00% 100.00% 0.00% 2.154785 2.199610 2.027245 2.209128 0.845872 0.253253 3.037257 2.297351 0.026050 0.024335 0.001497
59 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.834349 0.085348 2.066990 0.925605 -0.073751 2.476563 1.104274 7.628778 0.027162 0.025429 0.002298
60 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 2.182992 2.230583 0.047716 2.249706 10.760892 5.338431 21.227113 8.596116 0.027480 0.023768 0.002606
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 1.634294 5.736073 -1.186051 4.777366 -0.311640 35.523028 -0.898774 1.724555 0.030740 0.565864 0.190257
62 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.034088 0.613415 -0.417832 0.709979 2.903663 8.851191 2.819363 11.728693 0.031179 0.031956 0.002371
63 N06 not_connected 100.00% 100.00% 100.00% 0.00% 0.279659 2.117980 0.431669 -1.416332 27.950280 3.670611 34.956609 6.888132 0.039251 0.028710 0.007277
64 N06 not_connected 100.00% 0.00% 0.00% 0.00% 4.879971 5.826531 4.855858 4.281792 54.166528 31.040003 2.402572 -0.064753 0.534403 0.564726 0.358732
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% -0.585094 0.259742 4.593496 4.273398 1.635122 2.539743 12.812711 16.284470 0.022094 0.020683 0.001805
66 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 6.878624 0.229658 -0.631901 4.441465 16.040933 7.446688 15.169329 21.246790 0.028533 0.020780 0.005581
67 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 3.879936 1.955283 0.917642 1.690413 5.935720 12.007621 12.832245 7.819612 0.025163 0.024763 0.000802
68 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% -0.318830 5.386459 4.682193 -0.687288 12.188717 24.671709 19.359813 5.484043 0.022764 0.026707 0.004314
69 N04 digital_ok 100.00% 100.00% 100.00% 0.00% -0.456609 1.584131 0.966652 0.245421 2.039838 17.148031 1.879093 2.489293 0.029294 0.028171 0.002666
70 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.428036 -0.639840 0.860336 1.354076 1.352137 2.246020 0.624724 0.409347 0.027244 0.027514 0.001284
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.160576 6.278995 4.061418 3.931320 47.761173 35.354475 -0.123945 1.494529 0.573939 0.556402 0.411609
72 N04 digital_ok 100.00% 57.73% 100.00% 0.00% 5.432167 2.161418 1.677944 2.334653 54.709033 3.808627 42.912608 2.594955 0.192860 0.024436 0.027991
73 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.649814 0.674307 -0.722300 -0.536545 15.064157 23.905383 0.745054 0.747698 0.027898 0.027895 0.001483
74 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 3.088442 1.165452 -1.300737 -0.529375 105.814031 99.887800 218.935946 175.600094 0.028385 0.027679 0.001585
77 N06 not_connected 100.00% 100.00% 100.00% 0.00% 0.053442 -0.794039 0.061517 0.506928 6.938088 4.737599 21.277171 7.350889 0.030561 0.030459 0.001820
78 N06 not_connected 0.00% 100.00% 100.00% 0.00% -0.392648 0.041920 -0.250931 0.395881 -0.860278 0.112371 -0.507303 2.665961 0.041640 0.038943 0.008679
79 N11 not_connected 100.00% 100.00% 100.00% 0.00% 0.540036 -0.267754 -1.080414 -0.819280 -0.502701 -1.471254 4.066796 -0.735737 0.031248 0.028841 0.002819
80 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.344588 3.622338 -0.257314 1.723472 -0.150782 2.001823 -0.755401 1.121497 0.030790 0.029127 0.002624
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 9.733426 11.682363 15.508131 13.511295 371.431913 267.239895 1362.217045 1083.799585 0.018425 0.016295 0.002254
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 7.153888 16.940903 11.238907 18.081743 137.664299 543.618982 558.821556 1714.727276 0.017298 0.016165 0.001264
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 7.611451 9.333706 12.621358 13.283711 208.273037 235.163850 1004.842713 1012.487189 0.016637 0.016318 0.000789
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 5.966103 1.302957 7.124499 4.522940 23.202024 2.327003 -5.466153 12.734959 0.549520 0.020813 0.069672
85 N08 digital_ok 0.00% 100.00% 100.00% 0.00% 1.202284 -0.503017 -1.019948 -0.548724 0.620209 -0.692001 -0.158839 0.494982 0.031569 0.029354 0.002746
86 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 0.046279 -0.248379 -0.295121 -0.412625 8.273009 6.062316 10.309734 19.871658 0.029810 0.029210 0.002255
87 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.778947 2.586791 2.459178 0.197550 9.345270 9.993117 4.633776 1.521979 0.026111 0.026190 0.001926
88 N09 digital_ok 100.00% 100.00% 100.00% 0.00% -0.663036 -0.267989 0.181288 0.202049 9.072936 7.217734 14.902636 15.023946 0.029358 0.027676 0.002260
89 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.900522 -0.531945 0.056721 0.103163 0.583851 -0.616831 -0.443846 -0.431478 0.032406 0.028011 0.002346
90 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.010305 1.145748 -0.274872 -0.960901 -0.438699 1.427287 0.592750 2.449250 0.031650 0.028578 0.002671
91 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.907406 -0.851543 0.061989 0.096063 0.616777 -0.794081 0.033142 0.143834 0.027288 0.027351 0.001223
92 N10 RF_maintenance 0.00% 100.00% 100.00% 0.00% 2.006843 -0.443481 2.032154 0.895826 -0.103737 0.928345 0.618180 1.198990 0.027093 0.025535 0.002131
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 1.899756 2.145592 2.127429 2.289221 1.400278 0.705969 6.044278 4.459773 0.024710 0.024041 0.001096
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 1.720041 5.724948 2.222981 -0.936297 1.017611 67.721676 2.703293 5.158540 0.024778 0.569364 0.056270
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 3.705966 5.873555 3.819556 6.404080 48.540684 23.210480 6.043485 -1.950484 0.522774 0.586634 0.367344
96 N11 not_connected 0.00% 100.00% 100.00% 0.00% 0.010305 -0.856826 -0.289063 -0.664820 -0.277948 0.097077 -0.417048 -0.863167 0.029940 0.030345 0.002087
97 N11 not_connected 100.00% 100.00% 100.00% 0.00% -0.022465 0.664631 -0.995165 -1.090983 -0.801959 3.148711 0.608863 16.098372 0.029689 0.029512 0.002045
101 N08 digital_ok 0.00% 100.00% 100.00% 0.00% 0.870115 -0.092795 1.703625 1.990322 1.185632 0.930987 2.566737 3.163096 0.026380 0.024417 0.001619
102 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.038159 0.330838 0.095234 0.268451 1.587638 4.358009 -0.518730 8.809512 0.031057 0.026543 0.003477
103 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 7.027533 1.998526 -0.387897 0.672374 12.739095 5.792525 24.738816 21.095979 0.029056 0.026092 0.002125
104 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.277220 19.551175 1.554476 10.137200 15.728569 8.455766 4.880447 41.399795 0.025811 0.017635 0.004846
105 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.461897 -0.188104 0.273982 0.478065 -0.552147 -0.934343 -0.324145 -0.650597 0.028691 0.026169 0.002336
106 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.799466 -0.641494 -0.133759 0.019807 2.396304 -0.656981 2.880646 0.209873 0.028703 0.026717 0.002094
107 N09 digital_ok 100.00% 100.00% 100.00% 0.00% -0.807279 -0.760166 -0.260027 -0.480536 2.875884 2.893847 5.229772 9.263110 0.031817 0.027368 0.003979
108 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.509590 0.010328 0.999641 1.339946 2.679975 -0.812415 23.326318 0.895539 0.026351 0.026378 0.001248
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 2.037360 2.180146 2.113091 2.029026 0.197238 1.131381 1.046578 4.884138 0.026588 0.024100 0.002346
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.658226 3.541795 0.952887 1.295070 10.478342 0.753612 2.653705 1.233006 0.026151 0.025055 0.001302
111 N10 digital_ok 100.00% 100.00% 100.00% 0.00% -0.863177 2.221729 1.157226 2.111093 -0.693624 0.771529 -0.040928 5.737620 0.026152 0.024378 0.001470
112 N10 digital_ok 100.00% 100.00% 100.00% 0.00% -0.742643 1.892446 1.203218 2.215960 -0.451982 0.640177 0.282743 4.152682 0.027795 0.023851 0.003043
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 5.276836 4.772233 3.667503 4.288926 7.289710 1.424961 1.808326 3.274755 0.030690 0.030259 0.002046
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 5.039061 1.353103 2.076928 -1.500989 7.364195 1.079858 16.324147 -0.602115 0.030193 0.030036 0.002100
115 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.024729 5.949361 4.715229 6.123423 48.021298 26.193489 -0.191802 -3.208182 0.534243 0.543178 0.376367
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.934872 11.617861 16.217208 14.810563 287.785435 277.101510 1070.514705 1245.062497 0.017171 0.016227 0.001300
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 8.241654 8.917804 14.395476 13.270408 270.025971 283.097445 1112.484869 1012.344391 0.016484 0.016352 0.000810
120 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.759203 2.390414 3.231165 1.622032 7.929644 9.856267 14.748306 9.061931 0.024761 0.024417 0.001738
121 N08 digital_ok 100.00% 5.80% 0.00% 0.00% 5.104478 7.217522 7.683658 -0.847598 20.321179 48.525683 15.204534 34.035605 0.480119 0.528580 0.379132
122 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 1.568346 1.226278 1.489417 0.998786 11.104515 2.834434 2.303868 3.525584 0.026626 0.026097 0.001409
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 5.679612 7.058781 8.358731 7.378313 9.926007 16.470069 -8.476158 -5.798118 0.555944 0.554109 0.385100
124 N09 digital_ok 0.00% 100.00% 100.00% 0.00% 1.937107 -0.686982 2.268060 1.213354 0.148703 0.019726 1.132583 2.363379 0.032043 0.027219 0.003722
125 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.490088 -0.651862 0.392415 0.311228 0.259419 -0.490408 -0.609032 -0.062845 0.027009 0.027002 0.001172
126 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.729228 -0.105111 0.054651 0.516224 3.244152 -0.495927 0.503496 0.699854 0.027796 0.026999 0.001583
127 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 2.087487 0.944758 2.029418 0.156278 -0.018326 7.126515 0.476886 -0.332469 0.025250 0.026917 0.001457
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 0.551554 1.983652 0.599305 -0.141384 3.613849 4.008783 2.042951 7.922574 0.026869 0.027243 0.001236
131 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.630292 1.788494 -0.753260 -1.534828 -0.088685 -0.338225 0.881620 -0.894801 0.030809 0.028563 0.002770
132 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.671348 0.051844 -0.535223 -1.009302 -0.187088 0.225557 -0.764700 -0.007963 0.029600 0.029526 0.001896
133 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.298550 -0.870368 -0.684429 -0.626740 -0.179242 -0.796338 1.299924 0.424043 0.031405 0.030432 0.002451
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 0.601166 4.635607 -0.593791 3.469125 1.849837 50.809803 6.683093 128.354187 0.031083 0.029303 0.002714
135 N12 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.641787 0.962066 0.701853 0.499964 3.431757 2.401894 2.904859 0.327343 0.026992 0.026062 0.001571
136 N12 digital_ok 0.00% 100.00% 100.00% 0.00% 2.247484 0.561126 1.784803 0.250980 0.322417 0.898888 3.266469 -0.067249 0.025776 0.026898 0.001258
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.429593 14.675094 15.625246 14.095774 437.969207 263.175389 1696.504612 976.395962 0.016282 0.016236 0.000664
139 N13 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.733941 -0.331249 0.126941 -0.621273 -0.538684 0.062447 -0.245225 -0.645238 0.032330 0.031856 0.003179
140 N13 digital_ok 100.00% 100.00% 100.00% 0.00% -0.062386 1.601532 0.669198 -0.093149 3.018010 1.740818 4.115359 4.547508 0.029156 0.026727 0.002535
141 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.796261 1.926386 1.202214 -0.019807 2.724834 -1.144256 -0.122649 -0.265706 0.028491 0.027422 0.001830
142 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% 2.138903 2.190675 -0.026426 2.244048 14.439523 1.048336 38.246327 3.826022 0.028382 0.024882 0.002644
143 N14 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.846664 2.192342 1.934476 2.215024 1.666865 0.327342 0.638211 3.443092 0.095533 0.024370 0.012559
144 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 0.221580 1.724143 0.646512 -0.387804 2.020696 6.421779 0.631716 2.186897 0.027109 0.026833 0.001600
145 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 0.066579 0.641754 0.890198 0.516422 5.122986 17.408817 -0.230156 0.536198 0.026968 0.027311 0.001622
146 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.672960 -0.709766 -0.574548 -0.459524 -0.832885 -1.511629 -0.223130 -1.033131 0.029626 0.029551 0.001944
147 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.134205 0.186124 0.105048
148 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.149925 0.088155 0.056550
149 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.145067 0.191649 0.102321
150 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
151 N16 digital_ok 0.00% 100.00% 100.00% 0.00% -0.544241 0.812949 -0.499941 -1.171757 0.321103 -0.518313 -0.543135 0.238496 0.032193 0.028638 0.003410
155 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% 2.103348 0.969051 1.916010 0.153409 1.827332 9.703506 5.067994 1.433239 0.025584 0.027011 0.001424
156 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.490189 2.273507 1.956713 2.072575 3.241177 4.735823 4.667461 7.294271 0.028287 0.024131 0.003340
157 N12 digital_ok 0.00% 100.00% 100.00% 0.00% -0.626935 -0.796302 0.924739 0.937215 -0.938198 1.580511 -0.464138 -0.389451 0.028095 0.026136 0.001629
158 N12 digital_ok 100.00% 100.00% 100.00% 0.00% 0.466354 0.371027 0.746013 0.874275 2.596238 3.312745 7.179755 16.938543 0.026840 0.026183 0.001274
159 N13 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.305636 -0.518150 -0.543686 -0.550936 -0.575974 0.268874 -0.819876 0.581416 0.032175 0.031753 0.003218
160 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 1.840728 0.896728 2.019463 0.452186 0.097014 1.455517 1.050140 0.994579 0.057765 0.026448 0.009213
161 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 0.413044 1.923455 0.885478 0.041756 -0.413451 0.200291 -0.152413 1.213171 0.034503 0.026640 0.004328
162 N13 digital_ok 100.00% 100.00% 100.00% 0.00% 3.256592 2.370829 -0.476421 -0.018869 6.141402 2.197663 20.394126 0.434030 0.055302 0.036480 0.010499
163 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.185940 -0.642028 0.853811 0.897225 1.367409 4.668092 5.562828 6.612609 0.028842 0.025684 0.002781
164 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 0.073491 -0.775064 0.844180 1.171275 0.470301 3.508778 0.579531 1.749670 0.027191 0.026932 0.001618
165 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 1.007369 0.302138 0.199778 0.268656 -0.248008 -0.313813 0.390502 -0.068439 0.027062 0.026347 0.001550
166 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.951291 2.746056 1.330680 -0.440736 1.938180 5.505571 0.668672 0.518925 0.026150 0.027758 0.001422
167 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.028069 0.048275 -0.022708
168 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.083952 0.086158 0.071520
169 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.087713 0.078841 0.031284
170 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.066963 0.167177 0.008249
171 N16 digital_ok 0.00% 100.00% 100.00% 0.00% 0.658525 -0.551642 -0.419979 -0.035013 -1.187635 -1.270061 -0.997338 -0.613550 0.030073 0.030166 0.002115
172 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 4.449239 1.322121 2.254802 0.457301 5.281997 8.842234 2.535322 2.814349 0.030550 0.030494 0.002262
173 N16 digital_ok 100.00% 0.00% 100.00% 0.00% 5.281989 5.889365 8.669104 8.970476 6.317969 3.333794 -9.261418 -6.889168 0.521983 0.038496 0.320008
179 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.948154 6.188680 3.918146 3.108894 54.253556 42.822011 2.107924 58.116401 0.554348 0.031504 0.266533
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 5.267545 2.042479 4.558476 2.342929 51.594697 1.478480 51.300670 5.919827 0.582549 0.031364 0.276065
181 N13 digital_ok 100.00% 100.00% 100.00% 0.00% -0.891336 -0.865025 1.333776 1.252988 0.894094 0.977017 0.171617 4.506342 0.067730 0.032317 0.013199
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 5.120057 2.251785 5.582393 2.012123 42.145004 0.337756 7.018752 4.747059 0.579348 0.036435 0.358969
183 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 0.099232 -0.133015 0.382977 0.422068 0.359360 0.966693 -0.421680 1.767621 0.030750 0.026438 0.003234
184 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 1.585990 0.848021 1.762322 0.131032 -0.166952 2.624271 2.773817 0.002817 0.029516 0.027061 0.002671
185 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 2.520374 0.908661 -0.527165 -0.108387 9.906199 0.525908 -0.207720 0.415141 0.027066 0.027676 0.000844
186 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 4.431789 3.435363 -1.107140 -1.085404 4.870339 1.926404 4.487239 2.673878 0.031441 0.027400 0.004119
187 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 1.920350 3.600002 0.019290 -1.066809 2.676805 7.929598 16.878222 5.602361 0.027462 0.028018 0.001522
189 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.059778 0.076301 0.056766
190 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.072045 0.080893 0.017761
191 N15 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.292338 0.223631 0.096354
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 5.149268 5.855529 8.373307 9.058028 7.477620 0.794928 -8.112052 -9.830330 0.518858 0.501887 0.367316
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 5.243125 5.824863 8.784888 8.835590 4.160432 3.471017 -9.518884 -9.250179 0.525069 0.504855 0.369177
200 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.573460 -0.045499 -1.339884 -0.850849 1.086255 -0.251204 3.890556 5.796083 0.037783 0.028787 0.006621
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.010928 5.860198 7.589059 8.694285 24.159100 3.522913 -3.466837 -8.559986 0.551457 0.481423 0.393711
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% -0.083946 0.676835 -0.322611 -1.051210 -1.093809 1.097296 -0.597040 11.617773 0.037377 0.078838 0.030859
204 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.202539 0.861082 0.978886 0.218760 2.888113 1.838340 20.791141 2.302898 0.026254 0.025978 0.001594
205 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 1.422089 0.067788 -1.334415 -1.126276 0.124843 -0.019726 0.308497 1.445318 0.029701 0.029611 0.002129
206 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.676021 1.652341 -0.832842 -1.153281 0.230879 -0.585908 -0.190228 -0.933570 0.029919 0.029815 0.002207
207 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.430010 -0.432161 -0.563146 -0.655822 0.189905 -0.457892 1.646154 0.557151 0.044816 0.029056 0.010586
208 N20 dish_maintenance 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.278180 0.122507 0.248470
209 N20 dish_maintenance 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.030635 0.081339 -0.045256
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_ok 0.00% 100.00% 100.00% 0.00% 0.082502 2.082884 -0.800650 -1.434450 -1.115368 0.279341 -1.350772 1.997837 0.031813 0.028676 0.003426
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.415988 0.310658 0.142410 -0.087447 20.645352 20.280674 61.749304 53.376341 0.033306 0.029224 0.004546
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% -0.824559 -0.812387 -0.408052 -0.439640 2.338877 3.543191 5.488382 7.163347 0.031519 0.029605 0.002578
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% -0.699106 -0.732156 -0.548522 -0.599276 3.091496 3.697215 6.071604 7.902323 0.029080 0.029527 0.001687
223 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.660382 1.666882 -0.757081 -1.096778 -1.301237 -0.417917 -0.767426 0.157899 0.070631 0.054187 0.044866
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 5.277898 5.817195 8.993761 9.015191 1.529208 1.269235 -10.098985 -9.075178 0.490221 0.477951 0.369355
225 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.396693 2.089151 -0.370481 -1.322770 -1.322168 1.241825 -0.872074 3.448507 0.030866 0.028819 0.002693
226 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.606491 -0.046889 -0.703334 -0.119919 -1.385658 1.073426 -0.729421 -0.902029 0.029512 0.029814 0.002001
227 N20 RF_ok 0.00% 100.00% 100.00% 0.00% 1.308339 -0.035502 -1.157166 -0.850442 -0.439497 1.482451 -0.447630 -0.961670 0.030940 0.028756 0.002810
228 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.822746 0.902453 -0.126111 -0.754146 -0.850596 -0.701672 -0.562455 -1.060089 0.029971 0.029662 0.002035
229 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.432420 0.969412 0.341437 0.696463 3.777200 3.522038 1.806416 -0.965902 0.029681 0.029890 0.001977
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 0.106467 -0.868247 -0.805548 -0.693074 1.441489 7.990264 2.630823 9.785683 0.029534 0.029639 0.001901
238 N18 RF_ok 0.00% 100.00% 100.00% 0.00% -0.633640 -0.734986 -0.363833 -0.691220 -0.919038 -0.185463 -0.915998 -0.783862 0.029875 0.029479 0.001983
239 N18 RF_ok 0.00% 100.00% 100.00% 0.00% -0.634110 -0.724307 -0.305074 -0.315905 -0.467874 0.888717 -0.247304 1.992226 0.030773 0.028945 0.002598
240 N19 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.812141 -0.479977 -0.912943 -0.848837 0.041909 0.205122 0.550246 0.078833 0.029391 0.029503 0.001796
241 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.804349 -0.706605 -0.592470 -0.522798 -0.632523 -1.232816 -0.750106 -0.808427 0.030669 0.028857 0.002631
242 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.689663 0.242057 -0.304281 -0.030497 -1.122310 -0.421875 -1.121657 -0.432932 0.029756 0.029704 0.002023
243 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.647024 0.089977 0.231615 -0.759871 2.914176 -1.245891 -0.745013 -0.713661 0.029853 0.029566 0.002056
244 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.279015 -0.071037 -0.840260 -0.977508 -0.466804 -1.107914 0.747100 -0.520765 0.030810 0.029691 0.002449
245 N20 RF_ok 0.00% 100.00% 100.00% 0.00% -0.757349 -0.075398 -0.506473 -0.889126 -1.175607 0.470577 -0.594155 0.250867 0.029911 0.029754 0.002237
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 4.751715 1.956793 4.994884 -1.041153 52.138939 -0.307276 -0.802069 0.070629 0.512831 0.028840 0.180071
261 N20 RF_ok 0.00% 100.00% 100.00% 0.00% -0.779468 -0.252989 -0.559022 -0.684162 -0.548011 -1.087528 1.198568 -0.197409 0.030245 0.029647 0.002253
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% -0.225143 0.384055 0.906170 0.882689 0.627071 3.512211 3.103496 12.087588 0.025500 0.025443 0.000913
320 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.393107 5.875553 7.364689 6.995979 23.282345 20.807155 -5.306291 0.556291 0.447438 0.435673 0.358241
324 N04 not_connected 100.00% 0.00% 0.00% 0.00% 5.167457 6.064890 6.474666 7.137322 35.838693 19.540568 -2.700053 -5.017938 0.432420 0.421373 0.336173
325 N09 dish_ok 100.00% 0.00% 100.00% 0.00% 5.222707 6.037578 6.371653 4.942365 34.998520 30.946037 -2.984933 0.951012 0.467749 0.032592 0.329904
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.438463 6.007626 5.503373 5.671897 44.636052 29.753941 1.838806 -1.344869 0.431827 0.422875 0.336247
333 N12 dish_maintenance 0.00% 100.00% 100.00% 0.00% 0.078668 0.046626 -0.964846 -1.049862 0.140580 -1.488083 3.268498 -1.024695 0.033079 0.029752 0.003340
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, 5, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 131, 132, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 192, 193, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 324, 325, 329, 333]

unflagged_ants: []

golden_ants: []
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_2460054.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 [ ]: