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 = "2460045"
data_path = "/mnt/sn1/2460045"
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-10-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/2460045/zen.2460045.42146.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 360 ant_metrics files matching glob /mnt/sn1/2460045/zen.2460045.?????.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/2460045/zen.2460045.?????.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 2460045
Date 4-10-2023
LST Range 12.801 -- 14.736 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 360
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 65 / 198 (32.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 118 / 198 (59.6%)
Redcal Done? ❌
Never Flagged Antennas 78 / 198 (39.4%)
A Priori Good Antennas Flagged 58 / 93 total a priori good antennas:
7, 15, 17, 31, 37, 38, 40, 42, 45, 53, 54,
55, 56, 65, 66, 69, 70, 71, 72, 81, 83, 86,
93, 94, 101, 103, 109, 111, 112, 118, 121,
122, 123, 124, 127, 136, 147, 148, 149, 150,
151, 158, 160, 161, 165, 167, 168, 169, 170,
173, 182, 184, 189, 190, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 43 / 105 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 50, 57, 61, 62,
64, 73, 74, 90, 95, 115, 120, 125, 132, 133,
135, 139, 179, 185, 201, 206, 220, 221, 222,
228, 229, 237, 238, 239, 240, 241, 244, 245,
261, 320, 324, 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_2460045.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.355003 19.356286 -0.624510 -0.413564 -1.003807 2.813770 -1.178500 5.986802 0.650658 0.523247 0.448467
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.350573 0.387102 0.113233 3.362329 0.965962 0.803283 -0.489122 0.770256 0.653478 0.640978 0.450806
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.911404 -0.106779 -0.799775 0.113217 0.668596 1.244683 6.489343 8.333181 0.659655 0.650805 0.441694
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.555232 2.878150 2.095849 1.906780 2.400967 2.199899 -2.522206 -2.004616 0.640521 0.632381 0.431176
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.846306 -0.487822 3.305224 -0.528299 -0.571232 -0.094196 1.564861 -0.315038 0.643911 0.654096 0.436227
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.109403 -0.293612 0.346958 -0.734789 -0.484823 1.377149 1.759235 1.300640 0.651607 0.637789 0.441687
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 16.167372 -0.668097 -0.499125 -0.715418 0.436972 0.555712 -0.382792 0.533669 0.540257 0.664510 0.430689
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.855026 2.331556 1.030691 1.605370 0.596387 1.731760 -1.948886 -2.127055 0.660090 0.653634 0.443985
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.328816 3.708731 0.805187 9.040399 1.169072 0.261279 -0.201812 3.464723 0.656771 0.523912 0.479966
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.381541 7.515179 0.732263 1.464057 0.800106 1.802355 5.994472 18.228406 0.646504 0.449479 0.499133
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.283606 -1.102325 -0.510824 -0.842648 1.175958 0.859272 -0.455958 1.862228 0.673319 0.669848 0.435294
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.312261 -1.077841 1.758688 -0.423379 3.873716 0.401977 0.843801 0.030817 0.664582 0.669415 0.429811
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.600416 0.609989 -0.228270 0.131239 -0.041216 1.511998 -0.482242 -0.070788 0.658983 0.653085 0.427558
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.202067 -0.721067 -0.862708 -1.090220 -0.103576 0.931284 1.020353 0.780691 0.632869 0.639315 0.434464
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 7.639047 26.389215 10.036598 6.432730 4.062477 4.222106 3.833815 72.349842 0.074281 0.071991 -0.050940
28 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 8.923830 15.431637 10.239651 4.124113 4.722066 2.901361 1.379853 19.682920 0.031354 0.352414 0.277676
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.062507 -0.419826 -0.387096 -0.058522 -0.526201 -0.111089 0.852668 2.920594 0.688244 0.674496 0.439619
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.349609 -1.026344 0.444017 -0.873433 3.348980 -0.275411 3.336809 -0.200478 0.679705 0.679009 0.430194
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.725533 -0.382008 1.044584 3.373072 1.976438 0.287691 0.041742 11.129565 0.688540 0.665822 0.439042
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.647535 18.330219 -0.311556 -0.177679 -0.183209 1.235883 -0.134934 1.847420 0.585613 0.596809 0.237193
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 10.218747 -0.064161 5.658683 -0.279177 4.657779 -0.721295 0.708934 0.196404 0.046457 0.647170 0.483532
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.295931 -0.991268 0.368241 -0.743810 -0.617037 -0.723910 -1.541390 -0.312629 0.642408 0.634061 0.435377
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.442946 5.787118 1.024143 0.768618 0.917033 1.902941 0.094520 1.025174 0.652497 0.650949 0.457818
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.204339 20.544599 -0.165228 12.854509 -1.132911 4.309987 -1.311831 2.835540 0.660806 0.035068 0.544965
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.303862 0.062794 -0.281638 0.445559 0.000711 1.277352 3.367153 8.654418 0.673869 0.663481 0.451464
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 1.251608 2.468332 -0.164097 -0.331910 1.194385 1.167493 16.017686 1.806880 0.231814 0.228329 -0.325983
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.552305 1.021307 1.060260 2.381833 1.693223 0.490225 -0.340883 0.254206 0.678607 0.677272 0.434192
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% 0.599300 3.145569 -0.634121 -0.790398 0.861450 1.683565 -0.519161 -0.154777 0.253862 0.232081 -0.321333
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.673604 0.005176 -0.562766 0.799142 -1.261815 0.690244 -1.142303 0.682461 0.677434 0.680687 0.430201
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.572803 0.694348 -0.989836 0.523515 -0.001667 1.825971 -0.353744 0.426201 0.692370 0.690635 0.433530
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 0.886356 4.202640 0.750207 0.648292 0.444081 0.998581 0.000958 3.893052 0.679486 0.667403 0.424376
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.278594 -0.698998 -0.059877 -0.972580 -0.355925 -0.628316 -0.405178 -0.485343 0.671428 0.680613 0.432436
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 9.528701 12.568635 5.571887 5.795110 4.813838 4.395459 2.575771 1.154214 0.030866 0.058472 0.018351
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.357188 0.721681 -0.441010 0.663660 -1.135035 0.664934 -1.039093 -1.509534 0.650307 0.649489 0.428192
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.528552 -0.590206 0.449864 -0.568185 -0.376324 -0.451372 0.373226 0.007492 0.617195 0.628728 0.424800
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.722117 1.177544 0.443868 1.632466 0.659915 1.821326 -0.203103 0.255410 0.644831 0.637860 0.447191
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.391705 1.136346 -0.156851 -0.436038 2.266422 -0.246594 63.868119 1.520362 0.652743 0.657223 0.439490
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.861782 3.750864 -0.141829 -0.278328 1.265814 0.639848 3.336970 0.354844 0.673802 0.668217 0.442839
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.358115 0.985240 -0.260344 -0.360490 0.379311 -0.297652 8.059366 5.331536 0.680460 0.678112 0.439784
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 6.008466 2.295458 1.637282 -0.310205 1.833593 4.649782 -1.617382 -0.878082 0.384138 0.440468 0.197428
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 1.994302 43.093314 0.690771 7.679978 -0.108406 4.852373 0.244190 0.483500 0.259352 0.043936 0.081232
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.046703 5.261693 -0.807490 2.186676 -0.605257 5.145248 -0.682231 5.018191 0.679511 0.658933 0.412058
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.686433 1.966430 -0.369851 -0.535259 -0.254644 -0.029201 -0.648903 0.476003 0.689167 0.677391 0.426577
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.408987 11.833163 10.256843 11.018776 4.657916 4.265504 1.044422 1.180228 0.039580 0.038583 0.002135
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.353345 0.777929 10.279561 0.958493 4.869394 2.865414 1.298642 8.649336 0.049663 0.679949 0.518363
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.038959 11.773914 0.012041 11.053126 0.637792 4.270370 0.165188 2.480467 0.669722 0.093756 0.542194
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.563582 -0.710986 1.135838 -0.639093 -1.000806 -0.626829 -0.294976 1.048258 0.629333 0.652998 0.424240
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.214199 0.906028 0.601101 0.514183 -0.315512 -0.001631 0.648712 -1.464338 0.632989 0.654874 0.425970
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.320061 12.181076 -0.776520 6.175678 -0.709851 4.344867 -0.728101 2.462970 0.652564 0.046642 0.513339
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.473860 -0.428857 -1.000463 -0.153469 -0.921879 0.053142 -0.157326 0.050974 0.631940 0.628408 0.435469
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 20.763493 20.537596 13.021439 13.252308 4.614791 4.424432 3.753415 5.266033 0.023374 0.034067 0.010577
66 N03 digital_ok 100.00% 7.22% 100.00% 0.00% 3.655792 21.065997 1.770250 13.395883 2.007858 4.381761 -2.194115 5.666337 0.226965 0.051872 0.096033
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.270900 0.121202 -0.391151 1.374849 0.619110 1.486883 3.846734 1.989684 0.660630 0.656039 0.431396
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 22.046398 0.390559 13.076458 0.239276 4.543824 -0.461881 4.195227 -0.840229 0.035762 0.672930 0.536191
69 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 1.055098 4.611192 1.374250 -0.812347 1.797322 1.210023 4.717769 2.001434 0.677749 0.680959 0.431046
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% 0.388748 3.519535 0.906888 2.842339 1.710390 1.801100 2.140588 0.587848 0.257531 0.227784 -0.311955
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.917525 -0.329986 -0.569502 0.429863 0.598681 -0.082573 -0.690244 0.885685 0.694762 0.685701 0.424399
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.431783 11.491300 2.067203 11.067726 1.138309 3.037016 5.368013 1.136044 0.285534 0.100055 -0.055978
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.634750 1.556592 -0.874167 1.632197 0.564900 1.362605 -0.086362 1.064214 0.699589 0.686196 0.436471
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.581733 -0.092236 -0.223272 -0.152761 0.548265 3.786843 0.064086 1.709133 0.695917 0.685338 0.434750
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 37.224519 11.613023 0.349856 -0.617296 6.115439 0.608168 6.041901 0.002226 0.423532 0.576542 0.317310
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 19.501871 0.724087 -0.199923 0.621076 1.325844 0.826410 3.373512 0.150334 0.508380 0.654318 0.382389
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 0.075038 12.381484 -0.690559 6.136511 -0.081733 4.238384 -0.217060 0.243607 0.637026 0.041603 0.518824
80 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.242152 10.587209 0.010609 5.470896 -0.981812 3.364272 -1.175176 1.289682 0.647052 0.374621 0.501622
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 186.505886 47.322945 40.064787 25.678811 81.091448 41.127359 487.595870 420.453901 0.018406 0.016306 0.002636
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.518832 60.701114 20.895255 26.483187 15.092236 41.677548 223.121370 458.348854 0.017270 0.016292 0.000989
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 27.867469 38.489812 21.621500 23.378654 22.948313 36.272464 319.358727 469.896810 0.017003 0.016357 0.000926
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.202103 22.951967 1.379333 13.485689 0.486906 4.147953 -2.245287 4.359076 0.662932 0.054464 0.523642
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.658695 -0.005176 -0.711364 -0.438630 -0.097695 -0.057166 -0.400742 -0.091060 0.681272 0.678686 0.428722
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.050314 0.956663 0.889781 0.077311 0.155498 0.052439 0.051400 16.925401 0.684533 0.673722 0.415638
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 25.387564 3.803940 3.401506 -0.598598 7.813678 -0.500300 29.820422 0.959657 0.569940 0.691795 0.370951
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.760880 1.272669 0.684743 1.495462 1.335408 0.613280 1.649829 0.825215 0.689974 0.679836 0.412634
89 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.343550 -0.489714 -0.325774 -0.596710 -0.351993 -0.937600 -0.325629 0.248049 0.679169 0.686596 0.421772
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.151334 0.675377 0.863656 0.743788 0.739458 0.823933 0.184372 0.472943 0.673807 0.680157 0.424476
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 8.892542 0.048826 10.289612 0.403888 4.700635 1.408400 0.244171 1.384366 0.037097 0.679563 0.484664
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.137785 12.023074 10.354687 11.096216 4.652969 4.270365 1.901261 2.030165 0.031658 0.024947 0.003244
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.684262 12.256936 10.464981 10.939257 4.661995 4.271606 0.634500 0.985773 0.025313 0.025425 0.001102
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.694867 1.199075 -0.816906 0.154876 3.536880 2.537313 -0.889550 -0.637279 0.652947 0.620288 0.279666
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.967225 15.092229 0.855857 -0.539770 -0.262854 1.294240 -1.761363 3.103446 0.651500 0.576163 0.432187
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.209963 1.970380 -0.859695 0.517154 -1.097674 -0.038345 -0.197338 5.021887 0.629049 0.615560 0.436752
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.080368 6.254494 0.074010 1.113845 0.265814 1.172089 -0.092189 1.135923 0.672483 0.670080 0.429970
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.845476 0.699421 -1.032933 -0.379852 0.575069 1.650332 -0.065388 6.059264 0.684464 0.678320 0.425165
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.039354 3.774526 1.242940 -0.949680 -0.218635 0.789109 1.588363 4.436414 0.681522 0.681516 0.412394
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.892367 46.688229 1.496993 6.756085 0.298693 0.747787 0.410035 1.948208 0.684212 0.667608 0.420065
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.144131 0.788260 0.326451 1.261847 1.633374 1.729035 -0.143010 0.410109 0.695258 0.688104 0.419232
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.628963 1.175911 0.244996 0.324837 -0.112393 0.001631 -0.061112 0.167512 0.682135 0.683019 0.413047
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 2.161301 3.216755 0.150356 -0.279237 0.353206 0.618428 3.305538 3.198216 0.679839 0.678552 0.407487
108 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.439734 2.270991 1.329810 2.450685 1.316642 1.861946 17.625110 0.792781 0.673404 0.681763 0.422083
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 8.722484 11.950517 10.358766 10.851377 5.223855 4.948917 2.711329 4.131153 0.076633 0.037708 0.029183
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 25.735722 -0.179996 0.576133 -0.103665 0.416120 0.378347 1.004053 -0.202765 0.579447 0.685772 0.365229
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 15.369220 11.855622 1.013189 10.926916 7.697033 4.283035 32.573547 2.224365 0.605769 0.074237 0.448850
112 N10 digital_ok 100.00% 0.00% 0.00% 100.00% -0.380370 6.013787 1.229343 9.516073 1.122119 0.479848 0.458733 0.715589 0.229023 0.139761 -0.277870
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.408948 12.913011 5.310706 6.126901 4.784307 4.438187 2.193879 1.970687 0.034510 0.031075 0.002073
114 N11 not_connected 100.00% 100.00% 0.00% 0.00% 11.085855 0.653482 5.450207 -0.285732 4.592978 -0.525035 0.152240 0.071696 0.048242 0.636806 0.495919
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.283814 -0.725660 -1.071051 -0.198603 -0.436972 -0.514416 -0.883695 -1.068053 0.629547 0.629978 0.437319
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 30.627468 47.640410 22.075973 29.025466 21.517152 67.950129 336.621458 580.062407 0.018192 0.016230 0.001733
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 24.992388 68.818058 21.078088 31.884036 28.769811 63.807662 344.944138 580.302763 0.017091 0.016242 0.000928
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.776994 1.136431 2.675479 -0.720257 2.147548 0.222116 0.084337 -0.435809 0.673586 0.676489 0.420984
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.793719 3.084748 1.862302 5.795422 1.411154 0.822912 -0.690754 11.601788 0.675164 0.664478 0.416484
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.949668 4.132699 -0.319047 -0.895895 -0.946127 0.187441 -0.474625 -0.575935 0.700240 0.690909 0.423359
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 4.641495 2.802191 2.491581 0.901684 2.941807 0.788612 -2.841534 -1.510263 0.669502 0.682915 0.414873
124 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.808032 2.657720 2.640839 1.384016 0.021772 0.735309 0.533818 0.531925 0.681071 0.685121 0.416100
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.814026 0.775536 0.487773 1.077342 -0.084347 1.224184 7.879215 0.163255 0.686342 0.686634 0.425486
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 8.768944 -1.061381 10.282499 -0.711444 4.680889 1.370492 0.184968 0.541751 0.038055 0.684990 0.486104
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.380487 -0.666389 -0.693345 -0.199020 0.171110 -0.503578 0.960065 1.714479 0.675051 0.674308 0.440006
131 N11 not_connected 100.00% 0.00% 0.28% 0.00% -0.686949 11.445061 -0.241442 6.023914 -0.855606 3.642077 -1.254252 0.556443 0.662778 0.316518 0.504996
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.973041 -0.522903 -0.421162 -0.833125 -0.244130 -0.769444 0.964583 0.119125 0.636445 0.630747 0.433958
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.423220 -1.346524 -0.925101 -0.728381 -1.103398 -0.750879 -0.770207 -0.256119 0.630873 0.635956 0.436114
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.049046 13.031999 5.437240 6.114607 4.589059 4.289963 0.303529 1.013260 0.042173 0.035594 0.003488
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.357363 -1.321809 -0.960908 -1.097530 1.449993 -0.118319 1.739676 0.004070 0.624217 0.630048 0.434604
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 8.142315 -0.536035 10.025766 -0.337019 4.711435 0.809772 0.973868 1.129004 0.043149 0.632522 0.477507
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 25.735201 55.710231 21.269751 29.383146 26.134700 57.150620 341.304934 647.204873 0.016927 0.016191 0.000902
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.444151 -0.108103 0.719300 -1.080435 -0.295023 -0.783236 -1.358010 0.999781 0.663830 0.655626 0.421448
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.712127 -0.887858 -0.009621 -0.700679 -0.590289 -0.598407 2.285296 0.889955 0.678007 0.673761 0.413507
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.474444 -0.316272 -0.154168 0.001832 1.429075 -0.921080 0.012161 -1.162486 0.686503 0.676490 0.415523
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.410219 11.863812 -0.592457 11.061093 1.926226 4.277060 11.323848 1.881244 0.689840 0.050039 0.575832
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.538411 12.015512 10.127364 11.039334 4.282998 4.309959 0.199298 1.638834 0.136312 0.032793 0.087894
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.370735 -0.483957 -0.617647 -1.072406 0.254627 -0.327027 -0.457067 0.165810 0.689937 0.687649 0.420135
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.448630 0.380399 0.232916 1.348751 2.441465 0.787803 -0.144653 0.311178 0.676005 0.674154 0.414799
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.565129 -0.870363 -1.059516 -0.902031 -1.081403 -0.916953 -0.617997 -0.538397 0.668662 0.676700 0.428692
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% 178.642504 179.166456 inf inf 3615.465315 3639.631811 5990.805378 6093.308112 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% 14.114020 -0.820942 -0.562166 1.065502 0.417740 0.213178 -0.462734 4.901699 0.541687 0.624411 0.366748
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 8.565330 -0.941584 10.168994 -0.431926 4.952198 1.006094 2.627621 1.038875 0.044498 0.634411 0.486748
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.553671 11.743876 7.351047 10.898827 -0.232612 4.327519 0.698798 2.257035 0.562007 0.041873 0.448710
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.700629 0.108501 0.433682 0.906780 0.770849 0.533858 -0.253106 -0.003592 0.637718 0.650123 0.436958
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -1.163358 -1.345301 -0.881018 -1.015631 -0.305663 0.437583 0.590888 7.690562 0.644836 0.658885 0.436405
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.332685 16.928851 -0.259268 -0.198626 -0.033033 2.297083 1.451069 3.419856 0.631902 0.544663 0.401455
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 9.393270 -0.927433 10.262008 -0.496782 5.336041 1.873131 3.180989 2.747740 0.046960 0.670733 0.532824
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.256688 25.682628 0.296178 0.376352 1.337002 0.067815 -0.500844 0.022069 0.671412 0.566392 0.391818
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.030251 -1.129503 -0.001832 -0.871103 -0.654939 0.337820 1.217110 -0.666521 0.691682 0.689346 0.419320
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.330957 1.098176 0.264567 0.619701 0.619917 0.436825 -0.202410 0.317027 0.684852 0.691923 0.428216
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.509551 0.722648 1.858921 1.115056 1.758040 2.648061 -0.026900 0.777807 0.685145 0.694244 0.422541
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 19.404001 0.044668 0.507403 -0.331223 1.402962 0.508428 0.980583 -0.101751 0.570289 0.687269 0.388959
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.345816 -0.110057 0.981889 0.183681 0.853393 -0.530366 0.081052 -1.308462 0.683545 0.679693 0.418457
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.492690 -1.067395 0.366595 -0.807803 -0.324138 -0.725316 0.035086 -0.045164 0.620962 0.635464 0.432522
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.781276 1.191470 2.114742 0.699512 1.830790 0.060629 -2.605729 -1.089160 0.634776 0.632340 0.442068
173 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 5.090852 4.087613 2.718441 2.510210 3.424702 3.260534 -3.071074 -2.518441 0.604267 0.595303 0.430258
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.144177 -1.044504 0.144248 -0.791754 -0.395248 1.145857 -0.510132 0.003592 0.649425 0.655124 0.431784
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.278739 12.430850 -1.041069 11.154584 0.803508 4.264852 9.983674 2.214240 0.674171 0.056767 0.562694
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.456756 0.284038 1.438923 1.186692 1.416307 1.321067 -0.054874 3.500240 0.677952 0.676924 0.430950
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.311785 11.697779 -0.360838 10.836306 -0.513073 4.483852 0.606552 3.068515 0.675251 0.051868 0.526071
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.720433 0.064497 0.423945 1.149385 0.674013 1.008464 2.717404 2.438232 0.678330 0.681077 0.409754
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 11.869374 -0.249370 8.429236 -0.333227 3.049481 1.864925 1.530309 -0.188447 0.456820 0.685881 0.445315
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.069606 -0.210716 -0.976445 0.010028 -0.643992 1.195878 -1.023578 0.217878 0.685485 0.683704 0.426320
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.464749 -0.998355 0.122608 -0.673755 -0.918755 -0.491193 -1.382379 -0.635217 0.687912 0.693576 0.427652
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.167673 -0.080500 -0.339129 -0.046191 3.885356 -0.717305 1.390085 -0.888346 0.676659 0.673615 0.432090
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 100.00% 0.00% 0.00% 0.00% 4.244821 4.379795 2.437860 2.656038 2.977311 3.398683 -2.690822 -2.853887 0.607794 0.595196 0.426904
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 5.490136 3.677874 2.913891 2.372568 3.688910 3.113926 -3.198860 -2.645890 0.599389 0.592953 0.429898
200 N18 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.227597 27.634953 5.508353 0.206172 4.704627 1.835540 1.361407 0.312328 0.040986 0.294883 0.204818
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.908896 3.391829 1.785395 2.276694 2.261783 2.926036 -2.316776 -2.646751 0.654372 0.634925 0.434280
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.677795 -0.333419 0.735836 -0.661692 0.311309 1.031121 -1.715912 35.119681 0.661820 0.658942 0.418674
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.158679 10.216235 1.716184 -0.701127 1.176615 0.264957 15.323065 1.295501 0.677001 0.682382 0.419108
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 5.855761 -0.914454 4.264707 -0.829582 1.589916 0.428814 1.361330 2.895588 0.497868 0.672755 0.482007
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.840950 3.278432 1.493037 3.247249 -0.677809 -0.676772 0.012736 0.959579 0.596871 0.575675 0.395366
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.853767 -1.193992 -0.868555 -0.930429 -0.914531 1.308170 5.116674 -0.573741 0.639046 0.657239 0.422521
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.519122 12.196909 -0.894173 6.161833 -0.776992 4.257774 0.043387 1.217711 0.624240 0.040629 0.532546
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.637017 -1.130748 0.024131 -1.056239 -0.708602 -0.298880 1.004203 -0.546847 0.662893 0.644674 0.435599
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.920036 -0.870379 -0.878424 -0.940592 0.808850 -0.765161 0.907741 -0.754635 0.657545 0.659123 0.426767
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.592902 -0.256174 -0.218048 -0.280785 -1.129926 -0.758414 2.024385 -0.761007 0.656117 0.659669 0.422613
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.081166 1.064952 -0.585473 2.635665 -0.661039 0.973231 -0.306332 7.920834 0.660412 0.606712 0.444853
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 5.916940 4.098445 3.134313 2.605100 4.094342 3.366058 -3.365487 -2.732246 0.630693 0.633805 0.421777
225 N19 RF_ok 100.00% 0.00% 40.56% 0.00% 0.255535 11.633539 0.439051 5.939016 -0.858640 4.011681 -1.647969 1.622137 0.661497 0.206923 0.549641
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.866190 13.170470 -0.696568 -0.246195 -0.840326 1.262866 -0.991139 0.200633 0.657039 0.579032 0.427900
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.440547 -0.602172 2.254266 -0.973900 -0.488278 -0.682724 8.283766 0.582646 0.587206 0.642184 0.446997
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.570046 -0.354956 0.352500 -0.869874 0.161225 -0.355804 -0.734434 0.044271 0.633713 0.638793 0.434908
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.646434 0.710129 0.324142 0.599007 -0.637442 0.055695 -0.295691 -1.628326 0.626249 0.626095 0.437774
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.796010 -1.014320 0.407546 -1.039622 -0.670543 -0.037443 2.251531 -0.614725 0.618333 0.640183 0.440611
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.530505 -0.353366 0.448258 0.229007 -0.637313 -0.754914 -1.450612 -1.368875 0.651695 0.645221 0.441381
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.915242 -0.545692 -0.574223 -0.375308 -1.116966 -0.210235 -0.897843 0.485377 0.655676 0.650115 0.436541
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.841028 -0.587118 0.501166 -1.027190 -0.065603 -0.484549 1.693333 0.155584 0.625273 0.645040 0.429064
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.910338 -0.922563 -0.457375 -0.286011 -1.028797 -0.624828 0.441550 -1.030638 0.650974 0.649752 0.438940
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 12.951945 0.375162 -0.496621 0.383409 0.400614 -0.160470 -0.937589 -1.283697 0.537020 0.651179 0.419852
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 12.200175 -1.126728 0.363519 -0.942263 1.581671 0.128232 -0.675911 -0.402148 0.543532 0.643332 0.422144
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.566026 -0.708477 -0.157805 -0.043355 -0.358710 -0.272255 0.085111 1.549896 0.618717 0.637533 0.430968
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.040188 -0.484967 0.209735 -1.088024 -0.677009 -0.644482 -1.625711 0.163165 0.640406 0.636073 0.441441
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.297336 12.655690 -0.765984 5.757003 -0.064090 4.297296 -0.842846 0.534918 0.622429 0.040423 0.529131
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.117845 -0.342797 0.036172 -0.499712 -0.829601 -0.929971 1.599307 -0.816929 0.619733 0.617574 0.433518
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 8.939855 11.651982 0.108579 0.498329 1.069400 2.522709 -0.367231 1.069199 0.637802 0.634509 0.448766
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.248601 0.838671 1.604641 0.604092 0.914537 0.153262 -2.356355 -0.791578 0.513347 0.520693 0.415897
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 2.097236 2.198383 0.675227 0.722210 -0.260893 0.674968 -0.587263 -1.321923 0.497828 0.506821 0.398061
325 N09 dish_ok 100.00% 100.00% 100.00% 0.00% 188.610051 187.690971 inf inf 4062.083390 3652.278163 7071.153733 5694.348233 nan nan nan
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 0.967835 0.073502 -0.963293 -1.048910 0.252101 -0.581598 4.866551 1.391217 0.494164 0.517472 0.399551
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.714050 0.456253 -0.403786 -0.785246 0.169396 0.007533 -0.164937 1.324515 0.497119 0.520251 0.399532
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, 27, 28, 31, 32, 34, 36, 37, 38, 40, 42, 45, 47, 51, 52, 53, 54, 55, 56, 58, 59, 60, 63, 65, 66, 68, 69, 70, 71, 72, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 89, 92, 93, 94, 96, 97, 101, 102, 103, 104, 108, 109, 110, 111, 112, 113, 114, 117, 118, 121, 122, 123, 124, 126, 127, 131, 134, 136, 137, 142, 143, 147, 148, 149, 150, 151, 155, 156, 158, 159, 160, 161, 165, 167, 168, 169, 170, 173, 180, 182, 184, 189, 190, 191, 192, 193, 200, 202, 204, 205, 207, 208, 209, 210, 211, 223, 224, 225, 226, 227, 242, 243, 246, 262, 325, 329]

unflagged_ants: [5, 8, 9, 10, 16, 19, 20, 21, 22, 29, 30, 35, 41, 43, 44, 46, 48, 49, 50, 57, 61, 62, 64, 67, 73, 74, 85, 88, 90, 91, 95, 105, 106, 107, 115, 120, 125, 128, 132, 133, 135, 139, 140, 141, 144, 145, 146, 157, 162, 163, 164, 166, 171, 172, 179, 181, 183, 185, 186, 187, 201, 206, 220, 221, 222, 228, 229, 237, 238, 239, 240, 241, 244, 245, 261, 320, 324, 333]

golden_ants: [5, 9, 10, 16, 19, 20, 21, 29, 30, 41, 44, 67, 85, 88, 91, 105, 106, 107, 128, 140, 141, 144, 145, 146, 157, 162, 163, 164, 166, 171, 172, 181, 183, 186, 187]
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_2460045.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 [ ]: