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 = "2460073"
data_path = "/mnt/sn1/2460073"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 5-8-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/2460073/zen.2460073.42108.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/2460073/zen.2460073.?????.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/2460073/zen.2460073.?????.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 2460073
Date 5-8-2023
LST Range 14.631 -- 16.572 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: 94
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas 40, 42, 70, 112
Total Number of Nodes 19
Nodes Registering 0s N15
Nodes Not Correlating N07
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 61 / 198 (30.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 101 / 198 (51.0%)
Redcal Done? ❌
Never Flagged Antennas 95 / 198 (48.0%)
A Priori Good Antennas Flagged 50 / 94 total a priori good antennas:
7, 15, 17, 19, 20, 31, 37, 38, 40, 42, 53,
55, 65, 66, 70, 72, 81, 83, 86, 93, 94, 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 51 / 104 total a priori bad antennas:
8, 22, 35, 36, 43, 46, 48, 49, 50, 57, 64,
73, 74, 79, 80, 89, 90, 95, 108, 113, 114,
115, 120, 125, 126, 132, 133, 135, 139, 185,
201, 206, 207, 220, 221, 222, 224, 228, 229,
237, 238, 239, 240, 241, 244, 245, 261, 320,
324, 325, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2460073.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.231987 8.602726 -0.936026 -0.638802 -0.371489 0.075045 -0.906224 3.626562 0.449323 0.357619 0.283369
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.088580 0.567585 0.371522 2.846598 0.958718 1.337724 -0.168707 1.150466 0.462308 0.447705 0.291198
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.917298 -0.103389 -0.519464 0.064373 -0.173606 0.281803 0.506194 9.804143 0.467645 0.462070 0.286620
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.685658 1.949696 1.152513 1.184767 0.441100 0.378887 -1.936942 -1.612503 0.433200 0.429472 0.262186
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.850313 -0.434376 2.836327 -0.446305 2.493339 0.208275 2.537555 -0.211882 0.440353 0.452106 0.274784
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.751663 -0.793198 -0.297326 -0.672076 -1.351013 0.091482 -1.293237 0.381714 0.439343 0.438608 0.271654
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 9.176896 -0.544595 -0.527191 -0.573766 -0.450168 -0.274648 0.106854 1.590472 0.361243 0.460081 0.285850
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.175658 1.624942 0.357831 0.970195 -0.498080 0.164940 -1.565790 -1.884953 0.458098 0.447390 0.285132
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.203688 2.237440 0.793789 8.089669 0.972520 -0.890790 0.282972 5.029145 0.475441 0.364922 0.319637
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.463992 4.338594 0.784374 1.783363 0.430691 0.120731 4.916324 17.310202 0.448215 0.277592 0.318768
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.513159 0.440070 -0.294869 3.502211 0.088121 1.145728 -0.237374 11.396272 0.477939 0.471360 0.287449
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.521684 -1.075740 1.649212 -0.473920 2.259092 -0.186676 3.303654 -0.071659 0.462319 0.474590 0.277378
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.253295 0.043785 -0.093420 0.141135 0.688500 0.105909 0.393053 0.369022 0.458439 0.464503 0.277423
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.949654 -1.003397 -0.400800 -0.665162 -0.864579 -0.770203 -0.202812 -0.324429 0.422857 0.425939 0.265875
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.072833 17.227521 9.455183 5.990249 1.771066 0.795983 2.841996 44.643604 0.070887 0.063266 -0.005942
28 N01 RF_maintenance 100.00% 100.00% 22.16% 0.00% 6.950295 10.099985 9.654406 4.059720 1.967218 -0.085907 1.523416 12.086389 0.029048 0.209730 0.158723
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.846293 -0.240879 -0.228701 -0.087943 0.691842 0.619682 1.397454 0.493215 0.483982 0.488880 0.290582
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.258597 -0.906545 0.048139 -0.685704 0.524752 -0.566261 0.652655 -0.090964 0.490362 0.495549 0.290667
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.679309 0.440474 0.980287 3.010082 1.254625 0.433389 0.370239 21.439143 0.493318 0.484727 0.290545
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.403778 12.417973 -0.046880 -0.153976 -0.771129 -0.064190 0.706244 2.587199 0.387947 0.415599 0.157769
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.918714 -0.441253 5.637088 -0.574833 1.937870 -1.075849 1.067011 -0.133787 0.042238 0.449650 0.311492
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.509771 -0.853789 -0.250134 -0.549940 -1.336326 -0.151317 -1.298757 -0.016551 0.441916 0.439468 0.272753
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.110160 3.266316 0.920725 0.574069 0.607240 0.590279 0.269081 1.070761 0.441886 0.431902 0.276060
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.948535 15.875303 -0.869566 12.272284 -0.751974 1.627950 -0.880259 3.871560 0.449384 0.031167 0.354101
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.049464 -0.392395 -0.087101 0.406461 0.069183 0.215731 4.274304 10.915566 0.456738 0.455985 0.279573
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.283370 0.385974 0.203881 -0.366450 -0.378543 0.912138 36.654742 1.331277 0.204623 0.197269 -0.253071
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.597268 1.231024 0.996020 2.147121 1.453959 0.060328 0.093674 0.641120 0.486315 0.488029 0.294802
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.320826 0.376217 -0.316502 -0.727516 -0.566750 0.358173 0.003644 2.221697 0.223623 0.212276 -0.253887
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.361122 -0.029670 -0.892690 0.659146 -1.243062 0.426102 -1.081994 0.990480 0.501310 0.503602 0.299362
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.933598 0.481606 -0.686076 0.414904 -0.569591 0.586488 -0.616187 0.326411 0.498023 0.507462 0.298150
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.664858 0.858557 0.792035 0.485120 0.925896 0.616241 0.141545 2.216592 0.492282 0.498337 0.293673
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.277209 -1.027590 0.099595 -1.009501 0.131808 -0.562207 0.388567 -0.083712 0.483908 0.494898 0.293468
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 7.405599 8.916370 5.560796 5.507359 1.943173 1.591665 2.181506 0.924954 0.030970 0.054877 0.016321
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.623864 0.236156 -0.801445 0.143466 -1.030442 -0.629085 -0.807246 -1.319804 0.446899 0.451549 0.267596
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.704722 -0.270144 0.125938 -0.506785 -0.117876 -1.068612 -0.129340 0.849433 0.426268 0.438164 0.266291
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.115404 0.487314 0.493851 1.263714 1.032732 1.132867 0.073692 0.420463 0.434533 0.429384 0.271663
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 0.858873 0.194476 -0.124629 -0.233323 0.961374 -0.061614 70.136501 0.345957 0.447621 0.448574 0.277158
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.864405 2.172812 0.410042 0.164702 0.800557 0.517175 4.342606 0.486005 0.470946 0.465851 0.284047
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.311893 -0.317144 -0.231932 -0.528334 1.088785 -0.896150 6.702857 5.963505 0.480445 0.476035 0.290955
54 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 3.166329 1.340432 0.948565 -0.400228 1.193912 0.816311 -1.017474 -0.511727 0.289961 0.333846 0.145655
55 N04 digital_ok 100.00% 54.85% 100.00% 0.00% -0.037316 29.547939 -0.020163 7.184958 -0.588724 1.748445 0.834397 0.851502 0.203004 0.040427 0.068309
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.687292 2.242059 -1.000197 1.461541 -0.628489 3.606849 -0.709355 1.868542 0.502265 0.492723 0.291001
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.969145 -0.212248 -0.735604 -0.480638 -0.822883 0.126082 -0.146894 0.484251 0.501991 0.505155 0.293168
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.626293 8.424775 9.659990 10.084933 1.936838 1.599354 1.244558 1.533704 0.037196 0.036715 0.002480
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.847492 0.841993 9.501381 0.844814 2.289328 0.962458 7.282850 11.604626 0.047398 0.504907 0.363058
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.564156 8.308221 0.138427 10.112664 0.395978 1.578375 0.177226 2.739932 0.476890 0.072723 0.361676
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 7.795273 -1.037413 5.339803 -0.539452 1.931355 -0.222147 0.195723 0.410865 0.034279 0.470243 0.316615
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% -0.498560 0.332834 0.523103 0.084012 -0.146767 -0.805616 1.363102 -1.273237 0.434659 0.458952 0.268512
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.677558 8.577287 -1.020102 5.852975 -0.998571 1.626529 -0.569791 2.519382 0.453621 0.043889 0.333348
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.733177 -0.661084 -0.877535 -0.081460 -0.531198 -0.002652 -0.247305 0.338940 0.442987 0.434552 0.267552
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 15.553879 14.658873 12.119295 12.076310 1.956277 1.659908 4.033177 5.616572 0.023612 0.030736 0.007887
66 N03 digital_ok 100.00% 95.57% 100.00% 0.00% 1.294116 15.042813 0.856165 12.197496 0.481425 1.591632 -1.837812 5.685745 0.175359 0.048493 0.078416
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.663472 0.066698 -0.146209 1.249021 -0.092484 0.789287 3.360007 2.031483 0.471545 0.467587 0.284298
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 16.345292 -0.218107 12.147814 -0.283908 1.923060 -1.100356 4.510938 -0.804731 0.032511 0.477750 0.373470
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.859855 3.030820 1.297646 -0.648761 1.284828 0.467321 2.085424 0.494805 0.495699 0.492931 0.284208
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% 0.188419 1.365739 0.999985 2.279619 0.002652 1.977814 3.483799 1.082557 0.229315 0.212306 -0.252911
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.728658 0.078687 -0.283778 0.418521 0.101776 0.241079 -0.513836 1.091890 0.509829 0.515019 0.298686
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.276735 8.606930 2.040156 10.222216 -0.263768 1.219957 13.315880 1.564624 0.223326 0.083815 0.014405
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.859730 1.311278 -0.687820 1.159120 0.037842 3.776712 -0.003644 2.867887 0.515683 0.517890 0.303348
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.742370 -0.575448 -0.359577 -0.587320 -0.820146 0.408350 -0.662070 1.083777 0.501513 0.515245 0.301935
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 20.717823 5.865721 0.003782 -0.736177 0.507480 -0.454106 3.131976 -0.177589 0.305111 0.392037 0.180187
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 12.153290 0.164289 0.081592 0.148457 -0.303672 -0.641981 -0.227078 -0.254275 0.340193 0.465489 0.269397
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.779575 -0.809006 0.701661 -0.822921 0.009341 -0.655076 3.378310 0.128940 0.438941 0.454697 0.272276
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.627511 1.497657 -0.568585 0.966111 -1.223481 0.199757 -1.244564 -1.693289 0.447550 0.432080 0.276787
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.489609 15.614617 2.458253 12.282696 2.111003 1.592229 0.316574 4.646391 0.477095 0.038855 0.345735
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.715251 -0.466010 -0.901409 -0.353534 -1.076340 -0.099267 -0.628779 -0.046677 0.491415 0.495390 0.287256
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.396263 0.122232 0.971945 0.027622 0.420953 0.398269 0.090819 9.922428 0.501131 0.505021 0.286992
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.301182 1.227866 2.585582 -0.708061 9.032961 -0.686718 158.314937 5.901781 0.398140 0.516052 0.286758
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.042598 0.858428 0.676906 1.314577 0.621710 0.353654 0.154553 0.422577 0.514025 0.515855 0.291613
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.467977 0.280177 0.699781 0.978401 0.770658 0.354306 -0.168916 0.376442 0.515000 0.517932 0.298894
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.647733 -0.855934 -0.137384 -0.761937 0.054178 -1.110186 0.120522 -0.137011 0.509855 0.517383 0.299722
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.026129 0.141847 0.803867 0.545557 0.672527 0.806736 0.051378 0.257882 0.497245 0.511120 0.302439
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.966528 0.138345 9.696716 0.292339 1.965042 0.551772 0.641752 0.979787 0.034152 0.501624 0.345653
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 7.182755 8.553807 9.741277 10.149341 1.930131 1.596563 2.222697 2.287537 0.030225 0.025095 0.002703
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 7.561895 2.966790 9.871127 8.256484 1.930616 0.458860 0.999400 1.064978 0.027356 0.350189 0.225777
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.173266 -0.392252 -0.240722 -0.327437 -0.155404 -1.119487 0.500831 -0.749872 0.446504 0.460387 0.273064
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.303623 9.856622 0.193405 -0.593343 -0.958347 -0.325164 -1.645383 0.716110 0.450181 0.377079 0.259647
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.121382 0.864261 -0.892771 0.387603 -0.701586 -0.173265 0.355281 7.131839 0.445471 0.432317 0.269030
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 3.314260 3.494150 0.117469 0.882919 0.754489 0.963312 -0.045670 0.745052 0.473753 0.473564 0.283659
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.959946 0.237935 -0.951922 -0.287189 0.090872 0.147112 -0.803808 7.966428 0.493472 0.494087 0.285480
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.327457 1.654434 -0.538593 -0.689344 -1.043175 -0.257283 3.326500 2.532719 0.496044 0.504544 0.285517
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.438575 30.597959 1.582799 5.927601 1.301610 0.512757 1.338919 0.978838 0.498413 0.493083 0.282165
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.226963 0.332833 0.333328 1.019505 0.342925 0.395791 0.240482 0.381622 0.516001 0.516553 0.293714
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.077803 0.411338 0.327460 0.262021 0.023216 0.207787 0.935882 0.297796 0.514732 0.522238 0.296365
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.036258 -0.232907 -0.130191 -0.659665 0.190184 -0.288629 2.294805 1.204066 0.508814 0.515737 0.295215
108 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.035492 1.881970 1.147817 2.061856 1.025331 1.239156 3.339397 0.735641 0.503808 0.515062 0.300211
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 6.828898 8.469752 9.757655 9.946630 1.935366 1.629575 0.714031 1.964864 0.067998 0.035591 0.021949
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.796705 -0.355436 0.387407 -0.073039 -0.751839 0.663964 0.078962 -0.036351 0.390906 0.494150 0.285909
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 11.385914 8.434502 1.432749 10.011665 1.541466 1.594982 10.281726 2.528255 0.393268 0.063256 0.269588
112 N10 digital_ok 100.00% 0.00% 0.00% 100.00% 0.420892 3.049162 1.226649 8.407345 0.277589 -0.871701 1.101369 1.126559 0.199799 0.149012 -0.208516
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.685211 2.681306 1.619533 1.614386 1.093332 1.010210 -2.619575 -2.204203 0.430956 0.426915 0.260721
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.212638 2.148059 1.368282 3.323983 0.780448 -0.362007 -2.106345 1.768131 0.423935 0.376607 0.253677
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.201697 -0.826116 -0.723367 -0.538647 -0.090691 -1.052895 -0.470796 -0.865033 0.428937 0.429326 0.261918
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 23.340752 21.257409 22.556786 22.111565 12.747094 20.691286 424.118359 510.209127 0.016700 0.016248 0.000798
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 29.331183 27.710502 25.627024 23.583846 20.833176 15.586337 731.290794 438.317072 0.016152 0.016214 0.000733
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.574689 -0.010116 2.323305 -0.594942 2.680507 -0.059163 2.028747 0.176039 0.475185 0.486287 0.281656
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.155614 1.725955 -0.820505 4.934772 -0.085144 1.251719 0.405114 8.352564 0.494981 0.486089 0.283954
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.830890 1.871368 -0.117071 -0.849898 0.057004 -0.333598 -0.205291 -0.452480 0.507661 0.512428 0.289406
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.982845 3.954712 0.809525 1.026815 0.999271 0.936699 -0.092452 0.654284 0.516912 0.522132 0.296150
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 7.028941 -0.078563 9.856299 0.621054 1.917757 0.746921 0.740454 1.105259 0.041539 0.525299 0.353565
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.097955 0.626686 3.770158 1.195327 -0.032498 0.977131 0.703597 0.506146 0.493461 0.518427 0.300095
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.366367 0.141120 0.585981 0.851135 0.353034 1.288011 0.264612 0.326401 0.509094 0.516753 0.300517
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 6.809786 -1.040062 9.694627 -0.711920 1.960496 -0.434728 0.583181 -0.386915 0.035381 0.499717 0.343385
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.189006 -0.447174 -0.429751 -0.483229 0.295046 -1.123141 2.679846 1.223917 0.485226 0.490364 0.298322
131 N11 not_connected 100.00% 0.00% 70.91% 0.00% -1.001091 7.825107 -0.706290 5.657331 -1.368883 0.903743 -1.161155 0.893637 0.461393 0.193494 0.318121
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.980905 -0.560829 -0.757092 -0.671033 -0.978765 0.070297 0.166810 0.016906 0.453782 0.445700 0.271095
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.432869 -0.967974 -0.601562 -0.898934 -0.546106 -0.978531 -0.347222 -0.323118 0.438492 0.439759 0.268209
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.764639 1.919894 2.412818 1.124529 -0.283801 0.483950 6.259647 -1.853035 0.367420 0.402201 0.255173
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.459006 -1.051916 -0.572030 -1.022917 0.685531 -0.277267 -0.221114 0.014356 0.405798 0.409063 0.263979
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 6.452890 -0.690461 9.473672 -0.227048 1.971476 -0.396624 1.183384 1.214782 0.038727 0.425217 0.296159
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 22.023510 48.003293 22.811992 24.863330 19.502726 15.730683 664.014909 469.088012 0.016257 0.016137 0.000749
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.360851 -0.300176 0.093611 -0.893690 -0.970846 -0.900373 -1.658614 0.611478 0.455905 0.460787 0.272413
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 3.759403 -1.227732 -0.186547 -0.873251 4.223700 -1.002178 16.885073 2.427009 0.461413 0.490946 0.279334
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.330416 -0.521479 0.042380 -0.363789 0.672643 -0.959241 -0.114575 -1.028270 0.498363 0.497991 0.283962
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.394337 8.483718 -0.430725 10.125777 0.401857 1.614046 10.624865 1.986019 0.508524 0.045681 0.402282
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 7.246414 8.442082 9.498419 10.099531 1.604740 1.600567 0.523509 1.912760 0.122818 0.031966 0.075808
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.331446 -0.837806 -0.366509 -0.268075 -0.076405 -0.665643 -0.396880 -0.719594 0.518292 0.517788 0.298172
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.167750 0.722494 0.224559 1.237655 0.293577 0.171815 -0.097124 0.888523 0.515672 0.514679 0.297748
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.617011 -0.980848 -0.692088 -1.047918 -0.621809 -0.974506 -0.684759 -0.274283 0.483647 0.492797 0.293530
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% 7.770590 -0.614099 -0.637626 0.904290 -0.538274 0.346622 -0.373772 5.328688 0.366454 0.434258 0.256460
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.737966 -0.835468 9.600699 -0.306164 1.975058 0.162905 1.940753 0.438528 0.039988 0.414226 0.298598
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.182419 8.401580 6.513307 9.994171 -0.015401 1.631472 5.463805 2.435762 0.354907 0.038682 0.258561
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.336922 0.143383 0.491178 0.706281 0.634293 0.662688 -0.112073 0.359254 0.431615 0.439076 0.274258
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.799464 -1.092948 -1.008773 -0.997010 -0.628095 -0.575590 1.763307 7.730927 0.452688 0.457699 0.281965
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.043685 9.146458 0.162628 -0.121950 -0.358814 -0.082858 -0.074363 4.518623 0.438812 0.362336 0.254544
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 7.346508 -0.735776 9.668322 -0.409869 1.948671 0.237966 0.812537 -0.009480 0.045336 0.487810 0.376742
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.533284 16.574078 0.357104 0.422574 0.993245 -0.383302 -0.088348 0.038273 0.492094 0.399804 0.270370
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.564642 -1.091623 -0.423163 -0.938006 -0.948537 -0.274484 2.572819 -0.588145 0.498249 0.505982 0.294133
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.276568 0.802421 0.314409 0.424898 0.711791 0.356749 -0.098278 0.601580 0.512023 0.516218 0.298615
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.813809 1.066493 2.292516 0.918049 2.013569 1.538759 6.280016 1.774158 0.503213 0.511572 0.291000
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 10.117216 -0.225950 0.643023 -0.282597 -0.243989 0.182704 3.756886 0.246948 0.422755 0.511912 0.285596
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.072838 -0.284404 0.938723 -0.147534 0.633895 -0.954798 0.203592 -1.106579 0.497478 0.496513 0.288053
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.405118 -1.425521 0.950672 -0.781267 -0.023570 -0.849820 0.012247 -0.079460 0.432181 0.444396 0.276120
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.873561 0.697672 1.148306 0.238540 0.435314 -0.595526 -2.236242 -0.968007 0.433873 0.431101 0.272979
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.642680 2.773278 1.625529 1.655860 1.262415 1.100506 -2.610584 -2.062438 0.401061 0.388404 0.251374
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.295225 -0.470914 0.599733 0.045160 -0.210480 -0.097538 0.026716 4.785620 0.453897 0.461161 0.286280
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.611428 8.812015 -0.795731 10.198946 -0.354992 1.594401 9.676422 2.387793 0.465464 0.052744 0.369523
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.239297 0.587387 1.424068 0.935363 0.639397 0.747470 0.127153 3.048421 0.481505 0.486346 0.293596
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.700281 8.356721 -0.582772 9.930605 -1.265292 1.631525 1.841195 2.606500 0.495183 0.048421 0.358849
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.434000 0.684124 0.468815 0.838215 1.015552 0.562188 0.171093 0.729572 0.499399 0.498186 0.287617
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 7.540886 -0.156567 8.525393 0.123350 1.374149 -0.212465 2.279342 0.198547 0.267026 0.508273 0.329792
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.612796 -0.047248 -0.950432 0.039310 -0.218160 -0.013286 -0.699472 0.131655 0.507856 0.507686 0.294309
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.985407 -1.144746 -0.418439 -0.922138 -1.310715 -0.994183 -1.301991 -0.539818 0.498145 0.498353 0.288035
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.168707 -0.475083 -0.183068 -0.364514 0.104127 -1.032274 0.796268 -0.791910 0.490009 0.485980 0.288255
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.200166 2.991973 1.353280 1.770240 0.834476 1.172793 -2.395429 -2.375167 0.419466 0.395523 0.262053
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.917399 2.526196 1.769145 1.538972 1.382356 0.977255 -2.684356 -2.249092 0.397825 0.392726 0.250559
200 N18 RF_maintenance 100.00% 100.00% 0.00% 0.00% 7.919764 18.915478 5.518038 0.254933 1.964657 0.603205 1.616350 2.034303 0.040070 0.233900 0.153889
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.173472 2.337706 0.807715 1.477303 0.919987 0.856983 -2.019733 -2.223769 0.454413 0.437839 0.277874
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.148152 -0.440546 0.119203 -0.538276 -0.811605 0.427857 -1.578846 40.639410 0.472018 0.472084 0.277790
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.852311 5.631833 1.654524 -0.641301 0.754483 -0.100885 15.457729 0.696600 0.488991 0.489185 0.284805
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.836657 -0.875261 4.019211 -0.894193 -0.331790 -0.414239 1.201298 8.030232 0.309693 0.482354 0.323701
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.968623 1.974789 1.853388 2.999440 -0.855985 -0.749763 0.110271 0.913299 0.433777 0.406598 0.251394
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.813547 -0.914568 -0.959059 -0.994695 -0.654494 -0.840619 3.655192 -0.420627 0.454141 0.468925 0.281425
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.420090 8.679314 -0.619897 5.827431 -0.725781 1.589752 0.015803 1.454885 0.436355 0.038386 0.350144
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.760711 -1.061850 -0.453336 -1.010776 -1.205334 -0.939733 0.204416 -0.412931 0.456597 0.453352 0.274129
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.956921 -0.731797 -1.045835 -1.033049 -0.744773 -1.069332 2.800240 -0.586202 0.464642 0.466651 0.280113
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.575289 -0.599487 -0.663496 -0.566775 -1.127457 -1.177047 1.359521 -0.773832 0.469167 0.473201 0.280852
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.960575 -0.030070 -0.276366 1.569802 -0.292816 0.096756 -0.262523 11.084927 0.466225 0.441308 0.277522
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 3.135655 2.831865 1.940692 1.728195 1.550465 1.130214 -2.743745 -2.297579 0.428266 0.429614 0.257104
225 N19 RF_ok 100.00% 0.00% 100.00% 0.00% -0.088703 8.135682 -0.129755 5.630871 -1.346508 1.378625 -1.475671 1.888644 0.466290 0.132865 0.355947
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.237724 7.402330 -1.041616 -0.550255 -1.093401 -0.274690 -0.834561 -0.578177 0.459416 0.380193 0.269426
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.097897 -0.412297 2.206033 -0.550767 -0.290394 -0.259691 10.581195 5.353813 0.401615 0.441128 0.280972
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.110430 -0.594722 -0.210395 -0.650032 -1.211602 -0.432799 -0.145119 0.388847 0.442005 0.433755 0.267242
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.180726 0.223744 -0.257878 0.151710 -1.168051 -0.833239 -0.907188 -1.366940 0.438192 0.427206 0.273817
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.257123 -0.962700 0.500843 -0.827574 0.551425 -0.675371 2.222900 -0.426115 0.414714 0.433325 0.275154
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.167051 -0.339607 -0.104171 -0.121495 -1.141020 -1.050782 -1.408467 -1.181085 0.452185 0.447379 0.285197
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.195594 -0.741089 -1.016242 -0.605612 -1.345795 -0.848818 -0.636986 -0.032033 0.456338 0.452538 0.282101
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.578503 -0.420333 1.135820 -1.011719 0.228729 -0.673610 1.887335 0.682299 0.431249 0.457732 0.286220
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.281328 -0.944477 -0.851085 -0.608485 -0.993705 -1.158818 -0.190222 -0.879441 0.459332 0.454685 0.283759
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.121097 0.033773 -0.678395 -0.026616 -0.640671 -0.683362 -0.608119 -1.081983 0.355942 0.446833 0.273788
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.527758 -0.965542 -0.160875 -0.740332 0.091867 -0.300752 -0.291062 -0.145960 0.374235 0.443598 0.272824
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.217096 -0.485961 0.140137 0.197904 -0.457828 -0.426316 0.666682 1.579623 0.437233 0.435781 0.264330
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.452923 -0.581961 -0.343345 -0.878347 -1.391287 -0.662296 -1.399722 0.643041 0.445458 0.436780 0.271258
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.781660 9.009916 -1.046436 5.482266 -0.438123 1.614380 -0.259042 0.864457 0.434406 0.038196 0.345113
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.536255 -0.520655 -0.500898 -0.766610 -1.360322 -1.154790 1.401833 -0.613791 0.438584 0.428477 0.271010
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.181268 6.872021 0.236134 0.436860 0.679868 0.525772 0.001997 1.152747 0.439223 0.428495 0.279196
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.457290 0.407391 0.777954 0.141297 0.083236 -0.433121 -1.908755 -0.205213 0.341724 0.321660 0.225753
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.027432 1.164518 0.070866 0.226250 -0.870051 -0.565359 -1.510469 -1.346009 0.333193 0.315278 0.217396
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.224305 -0.978779 -0.039310 -0.632686 -1.133231 -0.530070 -1.499313 -0.041108 0.362368 0.346418 0.243045
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 7.762685 8.661997 5.418263 5.943478 1.910957 1.574937 0.709279 0.919669 0.039866 0.038387 0.001924
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 0.723723 0.010116 -0.154560 -0.661966 -0.108692 -0.492692 1.143858 0.321404 0.334825 0.327912 0.218830
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 7, 15, 17, 18, 19, 20, 27, 28, 31, 32, 34, 37, 38, 40, 42, 47, 51, 52, 53, 55, 58, 59, 60, 61, 63, 65, 66, 68, 70, 72, 77, 78, 81, 82, 83, 84, 86, 87, 92, 93, 94, 96, 97, 102, 104, 109, 110, 111, 112, 117, 118, 121, 124, 127, 131, 134, 136, 137, 140, 142, 143, 147, 148, 149, 150, 151, 155, 156, 158, 159, 160, 161, 164, 165, 167, 168, 169, 170, 179, 180, 182, 184, 189, 190, 191, 200, 202, 204, 205, 208, 209, 210, 211, 223, 225, 226, 227, 242, 243, 246, 262, 329]

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

golden_ants: [5, 9, 10, 16, 21, 29, 30, 41, 44, 45, 54, 56, 62, 67, 69, 71, 85, 88, 91, 101, 103, 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_2460073.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 [ ]: