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 = "2460064"
data_path = "/mnt/sn1/2460064"
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-29-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/2460064/zen.2460064.42112.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 361 ant_metrics files matching glob /mnt/sn1/2460064/zen.2460064.?????.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/2460064/zen.2460064.?????.sum.known_good.omni.calfits. Skipping redcal chisq.

Figure out some general properties¶

In [9]:
# Parse some general array properties, taking into account the fact that we might be missing some of the metrics
ants = []
pols = []
antpol_pairs = []

if use_auto_metrics:
    ants = sorted(set(bl[0] for bl in auto_metrics['modzs']['r2_shape_modzs']))
    pols = sorted(set(bl[2] for bl in auto_metrics['modzs']['r2_shape_modzs']))
if use_ant_metrics:
    antpol_pairs = sorted(set([antpol for dms in ant_metrics_dead_metrics.values() for antpol in dms.keys()]))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))
if use_redcal:
    antpol_pairs = sorted(set([ant for cspa in cspa_med_dict.values() for ant in cspa.keys()]) | set(antpol_pairs))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))

# Figure out remaining antennas not in data and also LST range
data_files = sorted(glob.glob(os.path.join(data_path, 'zen.*.sum.uvh5')))
hd = io.HERAData(data_files[0])
unused_ants = [ant for ant in hd.antpos if ant not in ants]    
hd_last = io.HERAData(data_files[-1])

Load a priori antenna statuses and node numbers¶

In [10]:
# try to load a priori antenna statusesm but fail gracefully if this doesn't work.
a_priori_statuses = {ant: 'Not Found' for ant in ants}
nodes = {ant: np.nan for ant in ants + unused_ants}
try:
    from hera_mc import cm_hookup

    # get node numbers
    hookup = cm_hookup.get_hookup('default')
    for ant_name in hookup:
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in nodes:
            if hookup[ant_name].get_part_from_type('node')['E<ground'] is not None:
                nodes[ant] = int(hookup[ant_name].get_part_from_type('node')['E<ground'][1:])
    
    # get apriori antenna status
    for ant_name, data in hookup.items():
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in a_priori_statuses:
            a_priori_statuses[ant] = data.apriori

except Exception as err:
    print(f'Could not load node numbers and a priori antenna statuses.\nEncountered {type(err)} with message: {err}')

Summarize auto metrics¶

In [11]:
if use_auto_metrics:
    # Parse modzs
    modzs_to_check = {'Shape': 'r2_shape_modzs', 'Power': 'r2_power_modzs', 
                      'Temporal Variability': 'r2_temp_var_modzs', 'Temporal Discontinuties': 'r2_temp_diff_modzs'}
    worst_metrics = []
    worst_zs = []
    all_modzs = {}
    binary_flags = {rationale: [] for rationale in modzs_to_check}

    for ant in ants:
        # parse modzs and figure out flag counts
        modzs = {f'{pol} {rationale}': auto_metrics['modzs'][dict_name][(ant, ant, pol)] 
                 for rationale, dict_name in modzs_to_check.items() for pol in pols}
        for pol in pols:
            for rationale, dict_name in modzs_to_check.items():
                binary_flags[rationale].append(auto_metrics['modzs'][dict_name][(ant, ant, pol)] > mean_round_modz_cut)

        # parse out all metrics for dataframe
        for k in modzs:
            col_label = k + ' Modified Z-Score'
            if col_label in all_modzs:
                all_modzs[col_label].append(modzs[k])
            else:
                all_modzs[col_label] = [modzs[k]]
                
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
else:
    mean_round_modz_cut = 0

Summarize ant metrics¶

In [12]:
if use_ant_metrics:
    a_priori_flag_frac = {ant: np.mean([ant in apxa for apxa in ant_metrics_apriori_exants.values()]) for ant in ants}
    dead_ant_frac = {ap: {ant: np.mean([(ant, ap) in das for das in ant_metrics_dead_ants_dict.values()])
                                 for ant in ants} for ap in antpols}
    crossed_ant_frac = {ant: np.mean([np.any([(ant, ap) in cas for ap in antpols])
                                      for cas in ant_metrics_crossed_ants_dict.values()]) for ant in ants}
    ant_metrics_xants_frac_by_antpol = {antpol: np.mean([antpol in amx for amx in ant_metrics_xants_dict.values()]) for antpol in antpol_pairs}
    ant_metrics_xants_frac_by_ant = {ant: np.mean([np.any([(ant, ap) in amx for ap in antpols])
                                     for amx in ant_metrics_xants_dict.values()]) for ant in ants}
    average_dead_metrics = {ap: {ant: np.nanmean([dm.get((ant, ap), np.nan) for dm in ant_metrics_dead_metrics.values()]) 
                                 for ant in ants} for ap in antpols}
    average_crossed_metrics = {ant: np.nanmean([cm.get((ant, ap), np.nan) for ap in antpols 
                                                for cm in ant_metrics_crossed_metrics.values()]) for ant in ants}
else:
    dead_cut = 0.4
    crossed_cut = 0.0

Summarize redcal chi^2 metrics¶

In [13]:
if use_redcal:
    cspa = {ant: np.nanmedian(np.hstack([cspa_med_dict[cal][ant] for cal in redcal_files])) for ant in antpol_pairs}
    redcal_prior_flag_frac = {ant: np.mean([np.any([afd[ant, ap] and not ant in flagged_by_redcal_dict[cal] for ap in antpols])
                                            for cal, afd in post_redcal_ant_flags_dict.items()]) for ant in ants}
    redcal_flagged_frac = {ant: np.mean([ant in fbr for fbr in flagged_by_redcal_dict.values()]) for ant in ants}

Get FEM switch states¶

In [14]:
HHautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.sum.autos.uvh5"))
diffautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.diff.autos.uvh5"))

try:
    db = mc.connect_to_mc_db(None)
    session = db.sessionmaker()
    startJD = float(HHautos[0].split('zen.')[1].split('.sum')[0])
    stopJD = float(HHautos[-1].split('zen.')[1].split('.sum')[0])
    start_time = Time(startJD,format='jd')
    stop_time = Time(stopJD,format='jd')

    # get initial state by looking for commands up to 3 hours before the starttime
    # this logic can be improved after an upcoming hera_mc PR
    # which will return the most recent command before a particular time.
    search_start_time = start_time - TimeDelta(3*3600, format="sec")
    initial_command_res = session.get_array_signal_source(starttime=search_start_time, stoptime=start_time)
    if len(initial_command_res) == 0:
        initial_source = "Unknown"
    elif len(command_res) == 1:
        initial_source = initial_command_res[0].source
    else:
        # multiple commands
        times = []
        sources = []
        for obj in command_res:
            times.append(obj.time)
            sources.append(obj.source)
        initial_source = sources[np.argmax(times)]
    
    # check for any changes during observing
    command_res = session.get_array_signal_source(starttime=start_time, stoptime=stop_time)
    if len(command_res) == 0:
        # still nothing, set it to None
        obs_source = None
    else:
        obs_source_times = []
        obs_source = []
        for obj in command_res:
            obs_source_times.append(obj.time)
            obs_source.append(obj.source)

    if obs_source is not None:
        command_source = [initial_source] + obs_source
    else:
        command_source = initial_source
    
    res = session.get_antenna_status(starttime=startTime, stoptime=stopTime)
    fem_switches = {}
    right_rep_ant = []
    if len(res) > 0:
        for obj in res:
            if obj.antenna_number not in fem_switches.keys():
                fem_switches[obj.antenna_number] = {}
            fem_switches[obj.antenna_number][obj.antenna_feed_pol] = obj.fem_switch
        for ant, pol_dict in fem_switches.items():
            if pol_dict['e'] == initial_source and pol_dict['n'] == initial_source:
                right_rep_ant.append(ant)
except Exception as e:
    print(e)
    initial_source = None
    command_source = None
    right_rep_ant = []
name 'startTime' is not defined

Find X-engine Failures¶

In [15]:
read_inds = [1, len(HHautos)//2, -2]
x_status = [1,1,1,1,1,1,1,1]
s = UVData()
s.read(HHautos[1])

nants = len(s.get_ants())
freqs = s.freq_array[0]*1e-6
nfreqs = len(freqs)

antCon = {a: None for a in ants}
rightAnts = []
for i in read_inds:
    s = UVData()
    d = UVData()
    s.read(HHautos[i])
    d.read(diffautos[i])
    for pol in [0,1]:
        sm = np.abs(s.data_array[:,0,:,pol])
        df = np.abs(d.data_array[:,0,:,pol])
        sm = np.r_[sm, np.nan + np.zeros((-len(sm) % nants,len(freqs)))]
        sm = np.nanmean(sm.reshape(-1,nants,nfreqs),axis=1)
        df = np.r_[df, np.nan + np.zeros((-len(df) % nants,len(freqs)))]
        df = np.nanmean(df.reshape(-1,nants,nfreqs),axis=1)

        evens = (sm + df)/2
        odds = (sm - df)/2
        rat = np.divide(evens,odds)
        rat = np.nan_to_num(rat)
        for xbox in range(0,8):
            xavg = np.nanmean(rat[:,xbox*192:(xbox+1)*192],axis=1)
            if np.nanmax(xavg)>1.5 or np.nanmin(xavg)<0.5:
                x_status[xbox] = 0
    for ant in ants:
        for pol in ["xx", "yy"]:
            if antCon[ant] is False:
                continue
            spectrum = s.get_data(ant, ant, pol)
            stdev = np.std(spectrum)
            med = np.median(np.abs(spectrum))
            if (initial_source == 'digital_noise_same' or initial_source == 'digital_noise_different') and med < 10:
                antCon[ant] = True
            elif (initial_source == "load" or initial_source == 'noise') and 80000 < stdev <= 4000000 and antCon[ant] is not False:
                antCon[ant] = True
            elif initial_source == "antenna" and stdev > 500000 and med > 950000 and antCon[ant] is not False:
                antCon[ant] = True
            else:
                antCon[ant] = False
            if np.min(np.abs(spectrum)) < 100000:
                antCon[ant] = False
for ant in ants:
    if antCon[ant] is True:
        rightAnts.append(ant)
            
x_status_str = ''
for i,x in enumerate(x_status):
    if x==0:
        x_status_str += '\u274C '
    else:
        x_status_str += '\u2705 '

Build Overall Health DataFrame¶

In [16]:
def comma_sep_paragraph(vals, chars_per_line=40):
    outstrs = []
    for val in vals:
        if (len(outstrs) == 0) or (len(outstrs[-1]) > chars_per_line):
            outstrs.append(str(val))
        else:
            outstrs[-1] += ', ' + str(val)
    return ',<br>'.join(outstrs)
In [17]:
# Time data
to_show = {'JD': [JD]}
to_show['Date'] = f'{utc.month}-{utc.day}-{utc.year}'
to_show['LST Range'] = f'{hd.lsts[0] * 12 / np.pi:.3f} -- {hd_last.lsts[-1] * 12 / np.pi:.3f} hours'

# X-engine status
to_show['X-Engine Status'] = x_status_str

# Files
to_show['Number of Files'] = len(data_files)

# Antenna Calculations
to_show['Total Number of Antennas'] = len(ants)

to_show[' '] = ''
to_show['OPERATIONAL STATUS SUMMARY'] = ''

status_count = {status: 0 for status in status_colors}
for ant, status in a_priori_statuses.items():
    if status in status_count:
        status_count[status] = status_count[status] + 1
    else:
        status_count[status] = 1
to_show['Antenna A Priori Status Count'] = '<br>'.join([f'{status}: {status_count[status]}' for status in status_colors if status in status_count and status_count[status] > 0])

to_show['Commanded Signal Source'] = ', '.join(command_source if hasattr(command_source, '__iter__') else [str(command_source)])
to_show['Antennas in Commanded State (reported)'] = f'{len(right_rep_ant)} / {len(ants)} ({len(right_rep_ant) / len(ants):.1%})'
to_show['Antennas in Commanded State (observed)'] = f'{len(rightAnts)} / {len(ants)} ({len(rightAnts) / len(ants):.1%})'

if use_ant_metrics:
    to_show['Cross-Polarized Antennas'] = ', '.join([str(ant) for ant in ants if (np.max([dead_ant_frac[ap][ant] for ap in antpols]) + crossed_ant_frac[ant] == 1) 
                                                                                 and (crossed_ant_frac[ant] > .5)])

# Node calculations
nodes_used = set([nodes[ant] for ant in ants if np.isfinite(nodes[ant])])
to_show['Total Number of Nodes'] = len(nodes_used)
if use_ant_metrics:
    node_off = {node: True for node in nodes_used}
    not_correlating = {node: True for node in nodes_used}
    for ant in ants:
        for ap in antpols:
            if np.isfinite(nodes[ant]):
                if np.isfinite(average_dead_metrics[ap][ant]):
                    node_off[nodes[ant]] = False
                if dead_ant_frac[ap][ant] < 1:
                    not_correlating[nodes[ant]] = False
    to_show['Nodes Registering 0s'] = ', '.join([f'N{n:02}' for n in sorted([node for node in node_off if node_off[node]])])
    to_show['Nodes Not Correlating'] = ', '.join([f'N{n:02}' for n in sorted([node for node in not_correlating if not_correlating[node] and not node_off[node]])])

# Pipeline calculations    
to_show['  '] = ''
to_show['NIGHTLY ANALYSIS SUMMARY'] = ''
    
all_flagged_ants = []
if use_ant_metrics:
    to_show['Ant Metrics Done?'] = '\u2705'
    ant_metrics_flagged_ants = [ant for ant in ants if ant_metrics_xants_frac_by_ant[ant] > 0]
    all_flagged_ants.extend(ant_metrics_flagged_ants)
    to_show['Ant Metrics Flagged Antennas'] = f'{len(ant_metrics_flagged_ants)} / {len(ants)} ({len(ant_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Ant Metrics Done?'] = '\u274C'
if use_auto_metrics:
    to_show['Auto Metrics Done?'] = '\u2705'
    auto_metrics_flagged_ants = [ant for ant in ants if ant in auto_ex_ants]
    all_flagged_ants.extend(auto_metrics_flagged_ants)    
    to_show['Auto Metrics Flagged Antennas'] = f'{len(auto_metrics_flagged_ants)} / {len(ants)} ({len(auto_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Auto Metrics Done?'] = '\u274C'
if use_redcal:
    to_show['Redcal Done?'] = '\u2705'    
    redcal_flagged_ants = [ant for ant in ants if redcal_flagged_frac[ant] > 0]
    all_flagged_ants.extend(redcal_flagged_ants)    
    to_show['Redcal Flagged Antennas'] = f'{len(redcal_flagged_ants)} / {len(ants)} ({len(redcal_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Redcal Done?'] = '\u274C' 
to_show['Never Flagged Antennas'] = f'{len(ants) - len(set(all_flagged_ants))} / {len(ants)} ({(len(ants) - len(set(all_flagged_ants))) / len(ants):.1%})'

# Count bad antennas with good statuses and vice versa
n_apriori_good = len([ant for ant in ants if a_priori_statuses[ant] in good_statuses.split(',')])
apriori_good_flagged = []
aprior_bad_unflagged = []
for ant in ants:
    if ant in set(all_flagged_ants) and a_priori_statuses[ant] in good_statuses.split(','):
        apriori_good_flagged.append(ant)
    elif ant not in set(all_flagged_ants) and a_priori_statuses[ant] not in good_statuses.split(','):
        aprior_bad_unflagged.append(ant)
to_show['A Priori Good Antennas Flagged'] = f'{len(apriori_good_flagged)} / {n_apriori_good} total a priori good antennas:<br>' + \
                                            comma_sep_paragraph(apriori_good_flagged)
to_show['A Priori Bad Antennas Not Flagged'] = f'{len(aprior_bad_unflagged)} / {len(ants) - n_apriori_good} total a priori bad antennas:<br>' + \
                                            comma_sep_paragraph(aprior_bad_unflagged)

# Apply Styling
df = pd.DataFrame(to_show)
divider_cols = [df.columns.get_loc(col) for col in ['NIGHTLY ANALYSIS SUMMARY', 'OPERATIONAL STATUS SUMMARY']]
try:
    to_red_columns = [df.columns.get_loc(col) for col in ['Cross-Polarized Antennas', 'Nodes Registering 0s', 
                                                          'Nodes Not Correlating', 'A Priori Good Antennas Flagged']]
except:
    to_red_columns = []
def red_specific_cells(x):
    df1 = pd.DataFrame('', index=x.index, columns=x.columns)
    for col in to_red_columns:
        df1.iloc[col] = 'color: red'
    return df1

df = df.T
table = df.style.hide_columns().apply(red_specific_cells, axis=None)
for col in divider_cols:
    table = table.set_table_styles([{"selector":f"tr:nth-child({col+1})", "props": [("background-color", "black"), ("color", "white")]}], overwrite=False)

Table 1: Overall Array Health¶

In [18]:
HTML(table.render())
Out[18]:
JD 2460064
Date 4-29-2023
LST Range 14.041 -- 15.982 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 361
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, 42, 70, 112
Total Number of Nodes 19
Nodes Registering 0s N15
Nodes Not Correlating N07
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 64 / 198 (32.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 50 / 93 total a priori good antennas:
7, 15, 17, 19, 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 / 105 total a priori bad antennas:
8, 22, 35, 36, 43, 46, 48, 49, 50, 52, 57,
62, 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
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_2460064.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.120280 8.824801 -1.044169 -0.692490 -0.220047 0.936640 -0.733357 12.580047 0.492338 0.397116 0.322378
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.337838 0.502395 0.320324 2.854332 0.982111 0.962243 -0.101919 0.773202 0.502951 0.484218 0.328042
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.682510 -0.129429 -0.430661 0.077694 0.054285 -0.254536 1.231778 9.341326 0.511057 0.499853 0.323502
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.501250 1.657285 1.021408 1.039326 0.269583 0.225220 -1.781971 -1.564618 0.477881 0.470995 0.300958
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.713370 -0.474586 2.875183 -0.385645 1.353201 0.130848 2.082694 -0.264809 0.482187 0.495372 0.312994
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.660127 -0.672263 -0.443370 -0.565566 -1.192055 0.611074 -1.067633 0.167816 0.487022 0.481687 0.314289
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 10.328476 -0.460484 -0.525569 -0.554706 -0.390329 0.081762 0.001168 0.990438 0.394361 0.500477 0.320173
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.090660 1.278874 0.187952 0.813982 -0.946703 -0.175564 -1.277358 -1.826801 0.500784 0.488487 0.322647
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.218952 2.422547 0.846072 7.575449 1.237883 -0.866857 0.337782 4.202619 0.511233 0.384478 0.355361
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.833818 5.367889 0.827130 1.365684 1.042338 0.696136 5.977789 17.936458 0.486568 0.309212 0.357267
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.424482 -0.050941 -0.240306 3.372797 0.359670 1.024420 0.021914 13.902017 0.519225 0.506009 0.324556
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 2.117313 -0.978203 1.714461 -0.380062 2.048656 -0.041411 2.103112 -0.048464 0.503211 0.513733 0.314063
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.232278 0.037698 0.036866 0.205611 0.963923 2.053603 0.682349 0.304639 0.502010 0.505424 0.314244
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.851803 -0.951240 -0.402975 -0.715237 -0.945767 0.046691 -0.241694 -0.294120 0.469136 0.469782 0.304347
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.772448 18.273697 8.647073 5.517519 1.294159 0.819911 3.649073 45.896694 0.067444 0.065762 -0.021973
28 N01 RF_maintenance 100.00% 100.00% 18.84% 0.00% 6.690721 10.541616 8.838396 3.563970 1.701698 0.848276 1.490257 17.628100 0.031670 0.230289 0.174790
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.792304 -0.041038 -0.123781 0.041839 1.068927 0.469769 0.691416 2.977920 0.524120 0.526716 0.321851
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.121132 -0.792150 0.085345 -0.651277 0.810746 -0.481107 0.269653 -0.147626 0.529992 0.532590 0.321766
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.375513 -0.070809 1.009523 2.756530 1.567920 -0.239504 0.677982 21.141870 0.532928 0.521321 0.324024
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.868244 12.497246 -0.030053 -0.113426 -0.475727 0.649209 1.792401 3.881898 0.421240 0.446928 0.170824
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.600415 -0.553424 5.072532 -0.703380 1.656269 -0.814533 1.042311 -0.156714 0.045058 0.492387 0.345265
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.612849 -0.744965 -0.344000 -0.496986 -1.262517 0.273606 -1.227258 -0.139782 0.487336 0.480389 0.312747
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.316858 3.418614 1.002552 0.670786 1.001807 0.754910 0.511808 1.324546 0.491944 0.479444 0.320281
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.878055 14.205277 -0.761560 10.787993 -0.841477 1.321281 -0.947413 2.770322 0.494166 0.035245 0.397227
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.021481 -0.200037 -0.029072 0.452750 0.252334 -0.169186 2.755967 9.620064 0.500983 0.497191 0.316253
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.120212 0.786103 0.208096 -0.302791 -0.302201 0.971397 29.564918 1.004440 0.204458 0.199735 -0.268297
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.390623 0.843483 1.089060 2.043216 1.761162 -0.449849 0.519914 0.757784 0.525026 0.523969 0.325082
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.301584 0.936659 -0.224523 -0.627544 -0.319594 1.489445 0.044396 1.693489 0.225004 0.213308 -0.269602
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.252448 0.053860 -1.024379 0.710233 -0.395108 0.659280 -0.684635 0.857163 0.538995 0.539712 0.330658
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.136406 0.156034 -0.983049 0.032729 -1.065213 -0.193906 -0.590637 0.025240 0.540260 0.545721 0.330706
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.629121 1.287721 0.806063 0.570622 0.391729 1.344499 0.207234 1.669149 0.530212 0.529869 0.322494
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.226020 -0.796237 0.165917 -0.977864 0.320817 -0.163726 0.111104 -0.296757 0.523273 0.533417 0.324351
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 7.042374 8.646160 5.001260 4.979084 1.676545 1.282049 1.984034 0.722712 0.031210 0.054701 0.016103
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.587601 0.020310 -0.960681 0.010626 -0.723594 -0.457553 -0.841438 -1.309684 0.493330 0.496064 0.305684
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.549452 -0.456197 0.126135 -0.638333 0.262373 -0.896141 0.007303 0.325339 0.469536 0.481274 0.303082
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.116541 0.593030 0.490270 1.326161 0.518578 1.464915 0.137385 0.283039 0.484160 0.475466 0.315640
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.233465 0.502139 0.001938 -0.173357 1.790609 0.174644 79.692615 0.958817 0.494201 0.492939 0.315445
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.824230 2.131211 0.100048 -0.158817 0.490832 0.369426 1.588483 0.244907 0.517238 0.508865 0.321638
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.053667 -0.077005 -0.045912 -0.816660 2.872958 -0.391078 5.534350 3.953104 0.524933 0.518641 0.326060
54 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 3.097473 1.261131 0.837397 -0.520646 0.508779 0.478359 -1.403107 -0.810059 0.311843 0.351197 0.151977
55 N04 digital_ok 100.00% 47.65% 100.00% 0.00% 0.020180 29.403582 -0.119633 6.515470 -0.538985 1.743145 1.123461 0.630522 0.211674 0.042992 0.066822
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.562987 3.065258 -0.980185 2.052179 0.013808 2.095400 0.020857 2.913535 0.537685 0.519599 0.317038
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.781170 0.425602 -0.924709 -0.411133 -0.140663 0.138855 -0.152864 0.631382 0.540818 0.540159 0.324399
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.304351 8.144843 8.850967 9.273218 1.657087 1.295532 1.284038 1.250679 0.039737 0.038939 0.002241
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.859777 0.552012 8.497925 0.482660 1.604401 0.958162 0.528153 10.899209 0.047446 0.539933 0.390184
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.964838 8.075602 0.179247 9.298754 0.511687 1.289931 0.283570 2.552688 0.517575 0.071595 0.401179
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.484294 -0.860319 4.795674 -0.467570 1.646224 -0.301526 0.186220 0.302097 0.036399 0.506855 0.348388
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.342188 0.163653 0.514831 -0.061943 -0.983333 -0.931666 1.039885 -1.200883 0.476996 0.501284 0.303584
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.691724 8.379157 -1.042931 5.294395 -0.732854 1.332405 -0.539000 2.129946 0.499533 0.046408 0.377420
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.644542 -0.573157 -0.800884 -0.038026 -0.300981 -0.013808 -0.414654 0.575348 0.487620 0.476563 0.307893
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 15.000152 14.209883 11.134770 11.117806 1.682350 1.360565 3.751529 4.865371 0.023846 0.033733 0.010175
66 N03 digital_ok 100.00% 73.41% 100.00% 0.00% 1.236104 14.584140 0.738014 11.235736 0.451409 1.301967 -1.661432 5.019357 0.184558 0.046508 0.085175
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.754745 -0.096932 -0.515291 0.781849 -0.715268 -0.129372 2.026568 1.367447 0.514226 0.508301 0.320448
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 15.860892 -0.389634 11.174108 -0.413774 1.628023 -0.948322 4.201562 -0.696420 0.035456 0.519403 0.408344
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.818170 3.162248 1.267674 -0.609542 0.165031 -0.086015 2.674002 0.767334 0.535431 0.531751 0.317308
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.094782 1.593243 1.039255 2.304455 0.144484 1.668472 2.225850 0.634049 0.228581 0.212216 -0.267174
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.753666 -0.039002 -0.218536 0.329705 0.035454 0.189334 -0.386588 0.598049 0.549381 0.550720 0.328795
72 N04 digital_ok 100.00% 0.28% 100.00% 0.00% 0.170672 8.366165 1.932441 9.403733 -0.315943 0.987118 10.963147 1.305555 0.232676 0.080353 0.012153
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.651856 1.213782 -0.574099 1.152092 0.628958 7.198316 0.301543 3.042132 0.555954 0.552697 0.336301
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.923723 -0.144631 -0.814905 -0.157416 -0.568557 1.160179 -0.634428 0.932576 0.546369 0.552100 0.333396
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 24.481487 6.837266 0.116285 -0.759717 -0.069012 -0.335350 1.133306 -0.233015 0.319072 0.426881 0.217937
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 13.124851 -0.024054 0.064107 0.021153 -0.329955 -0.793323 0.237758 -0.929099 0.371627 0.507641 0.302281
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.993335 -0.736778 0.744805 -0.772278 0.901013 -0.310635 2.025871 0.277528 0.479602 0.495766 0.309025
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.712347 1.239833 -0.717324 0.842614 -1.153584 0.378035 -0.974739 -1.691815 0.495071 0.478451 0.319348
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 97.854395 31.553191 26.743695 23.582306 15.394013 19.061769 420.319104 524.074440 0.017801 0.016225 0.001478
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.746729 33.322511 22.974221 24.213350 18.696142 29.402612 607.922939 664.762747 0.016327 0.016197 0.000716
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 24.819804 30.578341 21.811491 23.610664 24.589743 29.577000 619.932017 665.912977 0.016245 0.016211 0.000759
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.895871 15.805827 0.450878 11.295917 -0.433601 1.200196 -1.683489 4.086445 0.510248 0.050912 0.386388
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.673065 -0.494561 -0.940324 -0.351560 -1.203586 0.061541 -0.888083 0.493895 0.533769 0.531878 0.319607
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.329932 0.344552 0.791780 0.101949 -0.587575 0.749127 0.110373 10.866081 0.540344 0.538837 0.315174
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.571822 1.822738 2.773079 -0.860280 12.149140 -0.285051 61.560375 1.705341 0.442310 0.554099 0.311565
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.214707 0.970655 0.705912 1.219063 0.497909 -0.497543 0.072826 0.263467 0.552256 0.550032 0.318914
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.443906 0.289237 0.691036 0.965224 0.146777 0.523585 -0.098302 0.207749 0.551083 0.551658 0.325966
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.504994 -0.835894 -0.054854 -0.913822 0.410378 -0.373831 0.122178 0.278232 0.547705 0.553250 0.329091
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.002294 0.243556 0.814846 0.560277 1.222506 0.239038 0.123528 0.132518 0.535018 0.546652 0.329932
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.647549 0.059243 8.879707 0.341922 1.692476 0.411803 0.565770 0.801025 0.037229 0.539109 0.376553
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 6.865147 8.281861 8.930306 9.335241 1.662206 1.301615 2.177059 2.151732 0.032321 0.025367 0.003469
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 7.218770 2.255508 9.032595 7.302670 1.684638 0.984524 1.035138 2.011910 0.029388 0.405688 0.271892
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.053535 -0.539266 -0.127359 -0.465293 0.285353 -1.032626 0.713592 -0.796162 0.486768 0.505896 0.312502
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.088915 10.927723 0.023924 -0.608550 -1.199935 -0.228764 -1.448302 0.232812 0.495782 0.419630 0.297969
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.020770 1.177961 -0.821246 0.404949 -0.959266 -0.527481 -0.061956 7.236987 0.488410 0.472007 0.309821
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 3.488673 3.690405 0.185477 0.914900 0.462600 1.176779 -0.099949 0.432273 0.517771 0.516321 0.320887
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.853022 0.324916 -0.852135 -0.272193 -0.242853 -0.428490 -0.616268 5.509799 0.536362 0.533528 0.318174
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.296858 2.015001 -0.727185 -0.574148 -0.286309 0.146213 1.524512 10.001585 0.535233 0.541771 0.314047
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.965420 30.789894 1.555235 5.628948 0.425931 -0.655752 2.254250 0.779204 0.533874 0.526378 0.311945
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.040154 0.332438 0.406814 1.012022 0.976124 0.650175 0.154370 0.405827 0.553488 0.549271 0.321286
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.195744 0.601610 0.255612 0.252102 -0.573989 -0.273063 0.705375 0.231618 0.551200 0.555617 0.321911
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.340390 0.002294 0.321735 -0.215530 0.322418 0.192964 0.529802 1.246743 0.546552 0.550436 0.322777
108 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.221981 1.598434 1.144728 2.023990 0.413328 1.249479 5.100176 0.528148 0.540341 0.547738 0.327014
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 6.503945 8.206832 8.936489 9.138660 1.678693 1.335565 0.726146 1.775381 0.065670 0.038640 0.020002
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.946247 -0.231121 0.284196 -0.007497 0.505173 0.341493 0.528091 -0.104609 0.425180 0.534189 0.314133
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 9.959473 8.160879 1.149146 9.200486 4.659914 1.319501 20.961538 2.119542 0.445142 0.061573 0.319868
112 N10 digital_ok 100.00% 0.00% 0.00% 100.00% 0.150408 3.286469 1.243139 7.863908 0.504835 -0.789868 1.088697 0.813467 0.205324 0.145130 -0.221120
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.551109 2.368732 1.496809 1.479702 0.856239 0.742833 -2.468521 -2.277169 0.478143 0.469892 0.300486
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.023965 2.688004 1.230662 3.222277 0.320547 -0.121596 -2.082913 1.793060 0.471727 0.407389 0.301762
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.067473 -0.861292 -0.664890 -0.646037 -0.656980 -0.895382 -0.278176 -0.811570 0.474107 0.474259 0.302422
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 19.964271 28.097479 19.045899 22.928506 12.155342 25.686395 283.301137 509.274117 0.017329 0.016201 0.001101
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 21.793060 22.342447 21.953256 19.721058 22.588272 10.980914 537.942568 292.094255 0.016214 0.016273 0.000694
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.505864 0.516631 2.359098 -0.507795 2.243264 0.234755 1.773173 -0.267334 0.518818 0.528259 0.317752
121 N08 digital_ok 100.00% 1.94% 0.00% 0.00% 1.400542 1.761703 0.818751 4.722042 -0.014207 0.728687 -0.636911 8.257313 0.495804 0.521389 0.313453
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.985274 2.141646 -0.320369 -0.800751 -0.978868 0.020716 -0.278470 -0.492374 0.548377 0.548278 0.320529
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.111380 1.111458 1.324059 0.260995 0.688225 -0.579021 -1.905604 -1.442220 0.520046 0.544352 0.320462
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 6.715102 -0.016079 9.040588 0.663522 1.632473 0.718892 0.733094 0.783298 0.043667 0.557832 0.376794
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.217731 0.497780 2.729048 1.169218 1.063712 -0.345223 0.969158 0.270477 0.540677 0.550818 0.325855
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.313959 0.338836 0.496103 0.873318 -0.778914 1.216364 1.383185 0.393921 0.545250 0.550518 0.329487
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 6.500234 -1.070355 8.877598 -0.875903 1.686220 -0.274723 0.549805 -0.321375 0.038027 0.540033 0.377642
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.040944 -0.542561 -0.395673 -0.648666 -0.142434 -0.673971 0.519989 1.882908 0.525565 0.529290 0.330274
131 N11 not_connected 100.00% 0.00% 62.33% 0.00% -1.077303 7.817970 -0.841051 5.158901 -1.093734 0.727109 -0.893555 0.738051 0.509561 0.205428 0.364455
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.042906 -0.430214 -0.876716 -0.622651 0.675010 -0.429524 -0.152597 -0.076717 0.498967 0.486590 0.312513
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.250908 -1.043803 -0.535169 -1.033255 -0.772983 -1.062019 -0.037589 -0.291807 0.484387 0.484279 0.309381
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.149580 1.614773 2.299523 0.995308 0.152117 0.115853 5.180802 -1.846721 0.408808 0.451457 0.301262
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.659159 -0.966155 -0.542883 -0.898638 0.709525 0.330461 0.131847 -0.007303 0.461649 0.463476 0.310984
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 6.122722 -0.530536 8.666202 -0.180781 1.689989 -0.029239 1.186447 0.701479 0.041325 0.471994 0.333435
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 17.558533 42.656802 19.004143 22.925105 18.200588 22.805615 430.582868 593.211099 0.016409 0.016247 0.000764
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.225304 -0.272025 -0.051315 -0.845158 -1.077033 -0.447107 -1.252672 0.513646 0.499186 0.501266 0.308553
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 7.490258 -0.883564 -0.612166 -0.923566 7.557065 0.792890 98.863007 10.469757 0.472675 0.524138 0.302306
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.265058 -0.671530 0.129748 -0.484089 0.906184 -1.017050 -0.009269 -1.022053 0.536341 0.533912 0.313331
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.311034 8.205438 -0.334693 9.308522 1.136555 1.310893 12.585821 1.748008 0.547238 0.047573 0.439823
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.943169 8.026735 8.717066 9.283227 1.300233 1.292113 0.541658 1.672774 0.120596 0.034817 0.073140
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.380263 -0.929414 -0.302895 -0.487143 0.822021 -0.423721 -0.291232 -0.714619 0.554047 0.551389 0.326802
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.121813 0.449258 0.193547 0.900565 0.801397 1.564323 -0.046175 1.091921 0.550296 0.547907 0.325686
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.497112 -0.943949 -0.710262 -1.038394 -1.073729 -0.874259 -0.465602 -0.426251 0.523265 0.531594 0.325228
147 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
149 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
150 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 8.683834 -0.621152 -0.660626 0.929032 -0.370145 0.606040 -0.414420 5.334420 0.401714 0.473054 0.286291
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.447379 -0.828101 8.784726 -0.258222 1.701187 0.867787 1.771072 0.370057 0.042116 0.463494 0.336667
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.220585 8.099986 6.107362 9.177669 0.389387 1.332356 4.389578 1.914886 0.395738 0.041091 0.296088
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.426881 0.085589 0.542192 0.770413 0.880555 1.424552 0.022018 0.229918 0.478530 0.484118 0.317455
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.912581 -1.021955 -0.949562 -1.008017 0.467100 0.154383 1.478168 8.694114 0.496625 0.499596 0.323461
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.125267 10.417288 0.111984 -0.032325 -0.435064 -0.175135 0.041288 1.287491 0.476616 0.387999 0.290388
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 7.023284 -0.639750 8.854543 -0.330801 1.661648 0.806425 0.728877 -0.105717 0.047758 0.525120 0.405421
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.406656 16.702656 0.429623 0.393559 0.986306 -0.401249 -0.071421 0.072705 0.529994 0.428514 0.300266
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.736616 -1.169153 -0.616495 -1.069765 -0.139784 0.376625 1.911256 -0.586700 0.540111 0.543978 0.321754
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.071519 0.780284 0.366906 0.529108 0.849498 0.722902 0.086318 0.608280 0.545051 0.550459 0.325799
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.653639 0.852673 1.804144 1.016830 3.658600 1.471236 7.328275 1.450477 0.541911 0.544858 0.318298
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 11.297524 -0.291863 0.577387 -0.229797 -0.061196 0.325103 1.326434 0.009501 0.454317 0.545507 0.310574
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.158398 -0.452354 0.968628 -0.292324 1.283906 -0.920275 0.189923 -1.094003 0.538819 0.534816 0.319136
167 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
168 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
169 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
170 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.267264 -1.365350 1.007891 -0.771741 0.150877 -1.003458 0.145553 -0.131221 0.469317 0.485566 0.313489
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.722041 0.370610 1.028400 0.044922 0.444061 -1.003794 -2.065244 -0.893582 0.481508 0.477690 0.315290
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.512683 2.439937 1.501371 1.511042 1.070661 0.913400 -2.460491 -2.102995 0.449267 0.435071 0.297781
179 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.411411 8.567105 -0.637846 9.382273 0.300646 1.287919 7.170278 1.960713 0.509985 0.053861 0.409910
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.048894 0.373062 1.398774 0.992683 -0.253118 0.552791 0.126951 3.936099 0.523960 0.523727 0.326041
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.682696 8.060508 -0.701027 9.120323 -0.797251 1.322496 0.336526 2.227133 0.536314 0.049742 0.398613
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.331149 0.771183 0.504019 0.911027 1.089870 0.942106 0.115060 0.488445 0.539302 0.534891 0.318286
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 8.315782 -0.215529 7.669276 -0.061120 1.419559 0.156143 1.701985 -0.005143 0.287930 0.544162 0.360833
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.459576 -0.019919 -0.852104 0.060229 0.087782 -0.090517 -0.497640 0.117370 0.545982 0.542121 0.325280
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.065840 -1.050074 -0.558276 -1.018039 -1.102354 -0.980777 -1.031251 -0.561113 0.538285 0.537743 0.320531
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.003315 -0.664701 -0.159145 -0.512680 0.406723 -0.665859 0.995449 -0.755638 0.529871 0.523086 0.320458
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
190 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
191 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.154748 2.711376 1.312581 1.663659 0.676799 0.955504 -2.241763 -2.438403 0.459625 0.436041 0.301285
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.850181 2.312276 1.690797 1.466607 1.133398 0.855399 -2.586311 -2.333523 0.440849 0.433602 0.293456
200 N18 RF_maintenance 100.00% 100.00% 0.00% 0.00% 7.599371 18.663366 4.952794 0.147486 1.687078 0.289435 1.345325 4.155799 0.043044 0.239334 0.154587
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.108110 1.993791 0.707276 1.335216 -0.477318 0.684251 -1.801549 -2.246107 0.498684 0.477582 0.317005
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% -0.049493 -0.373247 -0.039245 -0.445765 -0.915123 0.667375 -1.341263 34.443081 0.514411 0.507548 0.311995
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.892912 6.105734 1.534892 -0.604344 0.853419 0.356235 9.919615 0.667929 0.529631 0.527707 0.317425
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.855358 -0.837437 3.626660 -0.921799 -0.221844 -0.085865 1.756337 8.812722 0.333373 0.517991 0.359964
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 1.007937 2.160773 1.603332 2.789564 -0.723048 -0.901065 0.421364 0.810752 0.464851 0.431190 0.283864
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 1.082408 -1.002917 -0.936986 -1.069786 -0.527149 -0.415942 3.390137 -0.574782 0.491704 0.506564 0.311001
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% -0.260907 8.405611 -0.572171 5.279946 -0.565998 1.276121 0.012531 1.190151 0.476149 0.040983 0.389526
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.857889 -1.029983 -0.609320 -0.972043 -1.315315 -0.580545 0.082951 -0.438713 0.500087 0.490301 0.313459
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.907099 -0.743536 -0.905338 -1.055663 0.154414 -0.812173 1.449280 -0.573585 0.502047 0.503540 0.313745
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.651197 -0.675916 -0.838277 -0.678195 -0.857321 -1.084952 1.658997 -0.755542 0.509564 0.509088 0.314061
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.926318 -0.040108 -0.257957 1.457897 -0.396295 -0.067631 -0.221816 10.284396 0.503233 0.474459 0.310984
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.008564 2.493169 1.816636 1.588547 1.290048 0.853003 -2.605527 -2.338081 0.467536 0.466332 0.290822
225 N19 RF_ok 100.00% 0.00% 100.00% 0.00% -0.284242 7.968718 -0.281899 5.100370 -1.254119 1.175888 -1.203359 1.661033 0.505118 0.134959 0.398908
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.084969 8.237574 -1.040351 -0.602436 -0.749708 -0.341787 -0.633757 -0.442844 0.500301 0.417565 0.304703
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.198559 -0.485055 2.123965 -0.571400 -0.217814 -0.254955 10.220471 5.273369 0.433885 0.479446 0.315961
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.190225 -0.538414 -0.328888 -0.641749 -1.088984 -0.015476 -0.269728 0.520087 0.483739 0.472139 0.303324
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.021928 0.037934 -0.370095 0.021877 -1.059186 -0.660853 -0.875820 -1.347105 0.478803 0.467190 0.310939
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.769577 -0.860034 0.579190 -0.759004 0.250682 -0.046925 1.679920 -0.418681 0.453103 0.473730 0.313885
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.318736 -0.574528 -0.261250 -0.286432 -1.322296 -1.041943 -1.214999 -1.156072 0.493882 0.483552 0.322530
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.882901 -0.449196 -0.790652 -0.490235 -1.261228 -0.824564 -0.840966 -0.180440 0.494273 0.487868 0.316393
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.834962 -0.402842 1.121242 -0.968504 -0.218190 -0.557059 2.622978 0.737217 0.464880 0.493261 0.320222
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.354772 -1.039925 -0.985190 -0.711025 -0.924716 -1.054046 -0.051201 -0.879396 0.497414 0.490996 0.318204
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 8.077541 -0.150348 -0.702130 -0.141446 -0.396179 -0.555187 0.974200 -1.024266 0.387096 0.485682 0.305804
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.476971 -0.924642 0.092992 -0.679427 0.927874 -0.307764 14.628555 -0.169416 0.469571 0.479989 0.309351
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.451426 -0.475384 0.159186 0.224133 -0.537065 -0.482342 1.022472 1.718662 0.474300 0.470684 0.296921
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.565712 -0.490524 -0.461736 -0.813803 -1.347092 -0.552497 -1.199853 0.467459 0.484866 0.472032 0.307366
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.731900 8.732951 -1.043993 4.950838 -0.051555 1.301738 -0.111668 0.660547 0.474917 0.040832 0.384561
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.649295 -0.565237 -0.641104 -0.869298 -1.022843 -1.018166 0.666633 -0.728195 0.475599 0.462605 0.307717
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.353324 7.141040 0.267198 0.421182 1.161181 0.402973 0.067011 0.788731 0.479954 0.466862 0.316061
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.316344 0.153048 0.623562 -0.010626 -0.252477 -0.647559 -1.736243 -0.412640 0.378173 0.358366 0.274546
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.856747 0.964738 -0.103391 0.056717 -1.039550 -0.536107 -1.044907 -1.279598 0.371652 0.353736 0.265023
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.131460 -0.896400 -0.199730 -0.541126 -1.255701 -0.428351 -1.248729 -0.079049 0.399557 0.379667 0.288153
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
333 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 7, 15, 17, 18, 19, 27, 28, 31, 32, 34, 37, 38, 40, 42, 47, 51, 53, 55, 58, 59, 60, 61, 63, 65, 66, 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, 333]

unflagged_ants: [5, 8, 9, 10, 16, 20, 21, 22, 29, 30, 35, 36, 41, 43, 44, 45, 46, 48, 49, 50, 52, 54, 56, 57, 62, 64, 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]

golden_ants: [5, 9, 10, 16, 20, 21, 29, 30, 41, 44, 45, 54, 56, 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_2460064.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 [ ]: