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 = "2460056"
data_path = "/mnt/sn1/2460056"
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-21-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/2460056/zen.2460056.42110.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 1470 ant_metrics files matching glob /mnt/sn1/2460056/zen.2460056.?????.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/2460056/zen.2460056.?????.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 2460056
Date 4-21-2023
LST Range 13.515 -- 21.426 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1470
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
Total Number of Nodes 19
Nodes Registering 0s
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 101 / 198 (51.0%)
Redcal Done? ❌
Never Flagged Antennas 95 / 198 (48.0%)
A Priori Good Antennas Flagged 50 / 93 total a priori good antennas:
7, 15, 17, 19, 31, 37, 38, 40, 42, 53, 55,
56, 65, 66, 70, 72, 81, 83, 86, 93, 94, 101,
109, 111, 112, 118, 121, 122, 124, 127, 136,
147, 148, 149, 150, 151, 158, 160, 161, 165,
167, 168, 169, 170, 182, 184, 189, 190, 191,
202
A Priori Bad Antennas Not Flagged 52 / 105 total a priori bad antennas:
8, 22, 35, 36, 43, 46, 48, 49, 50, 52, 57,
62, 64, 73, 74, 79, 80, 89, 90, 95, 113, 114,
115, 120, 125, 126, 132, 133, 139, 185, 201,
206, 207, 220, 221, 222, 224, 228, 229, 237,
238, 239, 240, 241, 244, 245, 261, 320, 324,
325, 329, 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_2460056.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.214264 6.725787 -1.016801 -0.599741 -0.849465 -0.503185 -0.810498 -0.381417 0.678682 0.506176 0.390562
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.140878 1.747772 0.198654 2.991608 0.539074 1.933053 -0.045706 1.219764 0.688470 0.602841 0.396311
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.853830 -0.051386 -0.582208 0.045381 -0.136847 0.279043 1.356444 6.837488 0.691693 0.613350 0.387851
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.577856 1.770692 1.116647 1.170627 0.237184 0.447100 -1.157388 -0.797971 0.669386 0.586510 0.379755
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.584048 -0.526650 3.006494 -0.456550 1.772928 -0.050818 2.087267 -0.298626 0.680972 0.610532 0.385495
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.467444 -0.809737 -0.414143 -0.642795 -1.179101 -0.327368 -1.028886 0.104807 0.678065 0.595704 0.387790
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 6.730530 -0.719958 -0.490072 -0.622017 -0.614612 -0.151243 -0.161660 0.564830 0.594807 0.614507 0.345550
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.236923 1.472511 0.270362 0.934667 -0.613888 0.231298 -1.324368 -1.254307 0.685195 0.603206 0.388280
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.355429 1.880561 0.756260 9.048008 0.967931 -0.164959 0.300796 3.518357 0.698927 0.527311 0.431240
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.391396 3.942066 0.822055 1.636819 0.723100 0.824809 7.477202 23.011438 0.680982 0.444942 0.455282
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.545375 1.523109 -0.331206 3.015199 -0.014248 2.073269 -0.127601 8.599447 0.701376 0.624316 0.386308
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.162204 -0.813569 1.736804 -0.355747 1.502284 0.106039 1.486853 -0.012420 0.695509 0.626617 0.382711
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.101803 0.316790 -0.085458 0.118298 0.207476 0.390866 0.164688 0.208593 0.690644 0.616128 0.384260
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.126840 -1.062557 -0.492297 -0.638921 -0.427286 -0.207871 -0.093507 0.074875 0.669818 0.588447 0.387014
27 N01 RF_maintenance 100.00% 89.52% 91.70% 0.00% 4.060679 12.603440 10.799463 6.790610 0.872416 0.360717 8.027124 53.219394 0.127262 0.103286 -0.028587
28 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.032088 8.050518 11.098828 4.323394 1.248904 0.482166 1.689063 25.114114 0.031277 0.365980 0.298729
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.823801 -0.080861 -0.219240 -0.039596 0.169008 0.273843 0.656716 1.138535 0.709280 0.636425 0.386910
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.172792 -0.939824 0.131959 -0.754097 0.486023 -0.313341 1.310654 -0.427157 0.709068 0.640803 0.383969
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.542073 1.495097 0.867581 3.130590 1.266332 1.893561 0.496533 15.871287 0.713405 0.634435 0.387424
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.560745 8.785603 0.075039 -0.110072 -0.622960 -0.391561 1.480390 2.462808 0.636290 0.585033 0.229516
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 5.761025 -0.368103 6.632530 -0.649765 1.248870 -1.049587 1.477125 -0.317010 0.049791 0.607634 0.422732
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.266507 -0.949200 -0.338096 -0.596798 -1.097247 -0.374910 -0.772399 0.197875 0.678721 0.598006 0.388298
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.235511 1.947626 0.948139 0.639410 1.189124 0.861016 0.499244 0.916347 0.675036 0.584788 0.387384
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.664281 12.013106 -0.980982 13.963712 -0.839717 1.326044 -0.665104 3.702488 0.683235 0.037854 0.559427
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.339191 -0.142984 -0.131021 0.482345 0.187218 0.753790 2.469922 7.337609 0.692519 0.609710 0.390137
40 N04 digital_ok 100.00% 0.00% 0.00% 90.27% 0.417200 -0.027151 0.207413 -0.422458 0.197805 0.219339 28.490833 0.936620 0.323294 0.316813 -0.262120
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.711858 1.634214 1.030679 2.159665 1.049398 1.577404 0.315062 0.847266 0.709217 0.635525 0.387004
42 N04 digital_ok 0.00% 0.00% 0.00% 90.27% -0.168158 0.020938 -0.259865 -0.761154 -0.136183 0.091001 0.299670 3.506585 0.339844 0.327703 -0.261715
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.925840 0.350689 -0.983455 0.663596 -0.861263 0.847502 -0.827486 0.727233 0.716958 0.649776 0.385556
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.864770 0.572574 -0.717697 0.409431 -0.368612 0.681891 -0.286403 0.217886 0.718263 0.652428 0.387278
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.803512 0.838902 0.776629 0.531248 0.856569 0.768369 0.319349 0.940771 0.713800 0.645908 0.385074
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.274121 -0.904852 0.055836 -1.065519 0.358741 -0.570661 0.323994 -0.305701 0.709364 0.643471 0.392580
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 5.432327 6.419459 6.550241 6.453285 1.252415 1.311858 2.416865 1.242616 0.030706 0.064747 0.023601
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.777765 0.340487 -1.050011 0.108777 -1.017724 -0.455670 -0.495887 -1.272563 0.684827 0.606566 0.382858
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.725427 -0.279977 0.115228 -0.543856 -0.122524 -0.966199 0.201242 0.794207 0.669639 0.593238 0.381338
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.018390 0.525819 0.436801 1.371893 0.704415 1.346864 0.248717 0.590757 0.673613 0.580439 0.386385
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 0.679661 -0.226926 -0.051258 -0.245728 0.188893 0.188943 58.826372 0.668916 0.680165 0.597630 0.383515
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.015032 1.277777 0.455560 0.210293 0.666843 0.478666 1.656617 0.494932 0.696986 0.610388 0.387581
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.260654 -0.102741 -0.131661 -0.745838 0.143657 -0.902675 5.105384 3.035500 0.703500 0.621726 0.387102
54 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.484474 1.861739 0.789609 -0.714474 1.280968 1.119126 -0.623457 -0.080199 0.404139 0.419700 0.185698
55 N04 digital_ok 100.00% 14.29% 100.00% 0.00% 0.043460 23.501008 -0.089712 8.277638 -0.769572 1.402704 1.381185 1.586682 0.330323 0.053365 0.153723
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.743777 5.012162 -1.052165 1.920192 -0.767704 1.268051 -0.684114 2.694563 0.716411 0.632138 0.369276
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.895100 -0.055004 -0.858373 -0.461660 -0.946433 -0.106894 -0.290712 0.302651 0.720305 0.650716 0.383206
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.738074 6.000161 11.106453 11.540211 1.249778 1.318847 2.172137 2.325323 0.041452 0.040712 0.002177
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.249952 0.962729 11.120794 0.869203 1.246387 0.929838 1.101687 3.594912 0.063464 0.652045 0.472245
60 N05 RF_maintenance 100.00% 0.00% 77.55% 0.00% 0.226538 5.906408 0.130914 11.563157 0.190546 1.261484 0.403856 3.114471 0.706764 0.162118 0.533285
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 5.656091 -0.931510 6.303579 -0.505283 1.248263 -0.311744 0.654785 0.178709 0.036703 0.622941 0.426505
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.222632 0.487035 0.866774 0.011721 0.196597 -0.546407 1.032167 -1.121749 0.672246 0.614165 0.375500
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.702455 6.153796 -1.078949 6.830970 -0.929730 1.313695 -0.601473 2.631972 0.687786 0.054409 0.521101
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.767169 -0.653251 -0.899147 -0.037595 -0.735590 -0.132740 -0.103450 0.437619 0.677546 0.591530 0.381250
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 11.915920 11.004432 13.831931 13.742430 1.261519 1.325385 3.780221 5.053558 0.023832 0.036940 0.012885
66 N03 digital_ok 100.00% 26.33% 90.82% 0.00% 1.170867 11.333079 0.800019 13.870781 0.024340 1.265557 -1.179509 5.327385 0.300827 0.091418 0.146749
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.915736 -0.014155 -0.616420 0.735554 -0.193370 0.921333 2.416176 1.495363 0.692398 0.611227 0.381487
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 12.576996 0.100764 13.869998 -0.231688 1.262357 -0.805794 4.545132 -0.587602 0.042320 0.616517 0.480878
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.138616 1.165783 1.242700 -0.664505 1.168964 -0.328037 1.933437 0.093957 0.712408 0.634906 0.383397
70 N04 digital_ok 0.00% 0.00% 0.00% 90.14% 0.624364 1.739750 1.060927 2.326850 0.791486 1.892644 2.578674 1.055147 0.345185 0.326387 -0.259539
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.728649 0.060563 -0.311954 0.322489 0.022564 0.555157 -0.296839 0.848503 0.723728 0.653952 0.383217
72 N04 digital_ok 100.00% 0.14% 74.49% 14.22% 1.269620 5.665040 2.157977 11.527175 1.432002 0.771548 7.682815 1.856524 0.350178 0.172751 -0.061796
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.793855 1.234419 -0.676559 1.059290 -0.234405 1.552949 0.014147 1.359358 0.728461 0.660995 0.389597
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.948454 -0.116849 -0.705746 -0.229665 -0.978118 0.207404 -0.754274 0.450189 0.720743 0.658180 0.386382
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 20.188367 4.160761 0.487731 -0.779410 0.064315 -0.591943 3.471278 -0.172307 0.524694 0.573117 0.260446
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 9.228285 0.295668 0.254571 0.123062 -0.565139 -0.503450 0.316994 -1.008498 0.579933 0.618295 0.318618
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.551300 -0.893951 0.763749 -0.852817 0.178636 -0.603681 1.145207 -0.133673 0.676960 0.610683 0.379752
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.574543 1.414297 -0.645308 0.976508 -1.227288 0.294545 -0.963875 -1.441385 0.681658 0.586226 0.389016
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 35.811678 18.677741 25.277831 23.151282 3.097659 2.449316 298.272498 230.281554 0.017439 0.016477 0.001047
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 15.611680 21.726259 22.401370 25.853489 1.990680 4.645070 192.325750 430.059691 0.016646 0.016241 0.000828
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 28.295489 17.793949 29.279460 22.822508 5.166178 3.007591 626.400627 319.954240 0.016210 0.016382 0.000713
84 N08 RF_maintenance 100.00% 0.00% 90.20% 0.00% 0.952232 12.729654 0.533088 13.936182 -0.335646 1.187721 -1.455991 4.193269 0.689269 0.086397 0.477883
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.501648 -0.449196 -0.899812 -0.330917 -0.995332 0.023905 -0.981522 -0.197393 0.710207 0.636065 0.383765
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.252253 -0.147803 0.826001 0.049379 0.789099 0.246656 0.346822 8.364458 0.715977 0.641308 0.375263
87 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.085284 0.081101 0.006329
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.161614 0.726537 0.664366 1.244758 0.701357 1.075523 -0.001309 0.403338 0.723986 0.655024 0.376637
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.325555 0.499294 0.657188 0.972891 0.746666 0.934046 0.025377 0.292716 0.729421 0.657765 0.384823
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.498118 -0.740721 -0.032768 -0.863572 0.115242 -0.946675 0.001309 -0.247756 0.726277 0.659134 0.386236
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.081597 0.272854 0.774609 0.584589 0.793845 0.683066 0.079181 0.094912 0.719219 0.654970 0.391583
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.011949 0.091528 11.143446 0.289279 1.245467 0.654660 0.923465 0.668360 0.040814 0.651003 0.426461
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 5.146453 6.106843 11.198869 11.613203 1.250638 1.316883 2.293844 2.290006 0.032331 0.025027 0.003701
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 5.469747 2.527600 11.310393 9.805542 1.248001 -0.429904 1.274183 1.026354 0.028299 0.488224 0.310978
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.109151 -0.376850 -0.146481 -0.399634 -0.348925 -0.923539 -0.249509 -1.082989 0.679629 0.617566 0.381270
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.350259 7.315771 0.096054 -0.612484 -0.718701 -0.546511 -1.376457 0.067571 0.683632 0.535125 0.364165
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.219247 0.675531 -0.925720 0.435222 -0.716810 0.226853 1.352259 5.006082 0.677193 0.585799 0.381085
101 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.973197 0.063607 -0.916236 -0.286756 -0.534176 0.059770 -0.674946 4.581847 0.711064 0.630613 0.384449
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.847204 0.959881 1.137952 -0.672422 0.249685 -0.244438 -1.547104 3.022282 0.691581 0.640271 0.371452
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.514827 25.278945 1.818387 6.376115 1.638409 2.568236 1.303084 1.389065 0.715277 0.633186 0.382179
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.438343 0.061683 -0.115414 0.546757 0.202017 0.624467 -0.067109 0.117858 0.725383 0.654750 0.379218
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.067278 -0.076406 0.267402 0.220549 0.329951 0.350389 0.447743 0.592971 0.726464 0.658618 0.381140
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.173846 -0.695835 -0.156172 -0.652465 0.093478 -0.297399 0.295178 0.903416 0.726525 0.658541 0.383297
108 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.326382 2.049752 1.094842 2.107080 1.026772 1.583916 10.585761 0.787574 0.722469 0.656765 0.387789
109 N10 digital_ok 100.00% 79.32% 100.00% 0.00% 4.876640 6.039296 11.203941 11.381383 1.208537 1.314888 0.987163 2.127194 0.142317 0.039723 0.077371
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.038582 -0.338605 0.549723 -0.045108 -0.413546 0.232752 0.163978 -0.164052 0.644539 0.648558 0.336341
111 N10 digital_ok 100.00% 0.00% 81.29% 0.00% 8.548809 6.022217 1.689599 11.450508 0.186298 1.280173 5.694547 2.526496 0.629969 0.134367 0.420410
112 N10 digital_ok 100.00% 0.00% 0.00% 89.66% 0.900221 1.913080 1.307222 9.367101 0.895726 -0.378246 1.407435 1.129749 0.320689 0.256859 -0.242663
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.371304 2.397566 1.613277 1.636857 0.675015 0.834284 -1.739268 -1.285784 0.667869 0.585898 0.378777
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.982173 1.404043 1.333015 3.399049 0.428850 0.580957 -1.458542 1.272184 0.661806 0.548710 0.374884
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.169786 -0.668168 -0.720697 -0.568629 -0.610247 -0.957991 -0.378610 -0.709635 0.668637 0.585105 0.375799
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 22.560670 16.423643 27.111933 22.046742 2.415302 2.914002 313.219182 268.689286 0.016786 0.016530 0.000866
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 18.877161 30.401245 26.120772 28.200797 5.408590 3.866515 519.410457 455.723923 0.016242 0.016187 0.000743
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.803004 -0.129532 2.417072 -0.550621 1.666594 -0.115371 1.716593 -0.333823 0.701762 0.625718 0.381283
121 N08 digital_ok 100.00% 1.56% 0.00% 0.00% 1.362524 2.362954 0.883863 5.257987 0.009755 2.006111 1.436831 7.519313 0.650475 0.624855 0.374270
122 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.060356 1.086106 1.426400 0.359646 0.529533 -0.275270 -1.407904 -1.191183 0.699824 0.646048 0.377636
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 5.036870 0.010865 11.332050 0.643604 1.248143 0.828247 1.049549 0.835998 0.048416 0.660671 0.420684
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.077291 0.874975 3.476432 1.196533 1.813415 1.035443 1.087443 0.362831 0.716980 0.658494 0.381831
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.014155 0.530303 0.695718 0.945975 1.160425 1.024473 2.061079 0.307299 0.709929 0.657585 0.369123
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 5.008588 -1.052693 11.142388 -0.837393 1.244706 -0.820560 0.891106 -0.660773 0.044355 0.651609 0.424399
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.343296 -0.566713 -0.496286 -0.573872 -0.183652 -1.006233 1.271734 0.866047 0.714153 0.645279 0.399789
131 N11 not_connected 100.00% 0.00% 17.82% 0.00% -0.826021 5.492581 -0.765250 6.532730 -1.128330 0.555569 -1.002772 1.068537 0.690488 0.360470 0.441851
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.900073 -0.670481 -0.876834 -0.666809 -0.937577 -0.456980 -0.545186 -0.419333 0.683868 0.602100 0.380406
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.653526 -0.978246 -0.629463 -1.001851 -0.575774 -0.991776 -0.346861 -0.500006 0.673781 0.592841 0.381014
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.989301 1.709006 2.555243 1.127908 0.520854 0.396273 4.161553 -1.463508 0.622769 0.560350 0.372668
135 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
136 N12 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 21.424084 28.903491 27.574785 26.445834 6.291641 2.301462 610.581775 365.799077 0.016218 0.016211 0.000745
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.475126 -0.472183 0.035531 -0.915148 -0.823677 -0.594469 -1.311464 0.233543 0.683536 0.601389 0.380569
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.129013 -1.092443 0.104300 -0.945083 0.520080 -0.786986 2.484874 1.013652 0.702164 0.627563 0.376627
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.238761 -0.387662 0.035663 -0.405941 0.370544 -0.942230 -0.120241 -1.084063 0.713209 0.634343 0.382043
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.515355 6.041370 -0.380382 11.584553 0.078493 1.311704 10.432061 2.324332 0.718566 0.060186 0.564826
143 N14 RF_maintenance 100.00% 76.05% 100.00% 0.00% 5.269548 5.975343 10.935261 11.548231 1.166384 1.316117 0.959686 2.151927 0.188650 0.034706 0.129622
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.580153 -0.772841 -0.430530 -0.492678 -0.066944 -0.627268 -0.432187 -0.911285 0.728069 0.655535 0.385728
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.136026 1.077392 0.164388 1.246092 0.645965 1.131983 0.036897 0.584965 0.726559 0.656194 0.383396
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.760301 -1.000370 -0.745527 -1.090588 -0.560851 -0.761680 -0.559370 -0.558895 0.709261 0.644856 0.389532
147 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 100.812422 100.807602 inf inf 456.290615 444.066579 4154.256253 4089.453172 nan nan nan
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 96.657704 96.626693 inf inf 661.382083 656.875740 4868.908068 4826.812767 nan nan nan
149 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 99.641265 99.751403 inf inf 757.359313 741.978469 5994.180589 5846.911066 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% 5.647487 -0.027457 -0.624178 0.981821 -0.639046 0.488660 -0.529134 3.833956 0.601018 0.594524 0.321411
155 N12 RF_maintenance 100.00% 99.93% 99.93% 0.00% nan nan inf inf nan nan nan nan 0.774270 0.926832 0.594973
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.815310 5.985932 7.195337 11.430228 0.617172 1.313244 3.693270 2.352884 0.615092 0.044479 0.474680
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.562842 0.547609 0.447121 0.763215 0.643554 0.857971 0.052422 0.311015 0.671644 0.585090 0.391622
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.869867 -1.124404 -1.052664 -1.064093 -0.531729 -0.624824 1.138949 6.185445 0.683545 0.598973 0.391310
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.067798 6.666416 0.045498 0.174652 -0.100238 -0.538399 -0.078123 0.153437 0.672441 0.502784 0.366450
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 5.283959 -0.649519 11.114031 -0.407041 1.247804 0.012745 1.344456 -0.022406 0.051209 0.626036 0.472485
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.204606 13.452483 0.346455 0.510291 0.574739 -0.410395 -0.026867 -0.051023 0.707161 0.550409 0.351633
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.408062 -1.042809 -0.497297 -1.060261 -1.093468 -0.685063 0.073539 -0.758324 0.713967 0.645375 0.380370
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.110533 0.693693 0.278841 0.510251 0.580062 0.792929 0.122480 0.519621 0.722356 0.655337 0.382723
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 1.417760 0.989345 2.061298 1.002266 2.194595 1.008113 1.540303 1.120185 0.719614 0.653498 0.378647
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 7.459457 -0.261862 0.884651 -0.291339 -0.414257 0.019367 1.266452 0.003955 0.632835 0.657081 0.321180
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.203305 -0.374391 0.927614 -0.229696 1.058639 -0.775557 0.295645 -1.066245 0.719075 0.644329 0.380787
167 N15 digital_ok 100.00% 99.93% 99.93% 0.00% nan nan inf inf nan nan nan nan 0.470182 0.486028 0.232026
168 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 101.893216 101.944733 inf inf 813.370688 813.571466 6637.807975 6637.715876 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% 100.815454 100.792480 inf inf 448.101568 448.140158 4336.280968 4355.441428 nan nan nan
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.022543 -1.272005 1.088381 -0.848334 0.257965 -0.669437 0.208372 -0.376194 0.668353 0.600390 0.381339
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.719537 0.597258 1.126836 0.150421 0.244206 -0.432511 -1.654344 -0.979482 0.666146 0.585674 0.382988
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.361273 2.459390 1.613133 1.661398 0.690513 0.860218 -1.717704 -1.180845 0.643397 0.548839 0.375775
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.131875 -0.418590 0.416414 -0.137441 0.596572 0.190093 0.004566 4.710775 0.686600 0.604174 0.394021
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.587039 6.345628 -0.761198 11.671214 -0.314637 1.313020 7.336403 2.413126 0.692646 0.065491 0.554041
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.444344 0.949202 1.442474 1.011803 1.308770 1.015753 0.550793 2.820110 0.704724 0.630067 0.389245
182 N13 digital_ok 100.00% 0.00% 99.93% 0.00% -0.754452 5.969192 -0.753382 11.365208 -1.083187 1.304192 -0.109488 2.532935 0.710354 0.064446 0.526368
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.305035 0.967665 0.466798 0.932742 0.592151 0.878820 0.168136 0.484443 0.715290 0.642339 0.375366
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 6.160217 -0.273381 9.268436 -0.144502 -0.253549 0.198376 0.868591 -0.161624 0.527507 0.650927 0.347299
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.633553 -0.092678 -0.958988 0.032312 -0.512031 0.280126 -0.681287 0.020920 0.721080 0.650594 0.383377
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.602230 -1.057815 -0.494963 -0.977485 -1.155854 -0.804641 -1.144079 -0.762916 0.715168 0.647946 0.380224
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.228312 -0.295461 -0.269155 -0.437832 0.038394 -0.904136 0.399655 -0.918088 0.712446 0.638625 0.386961
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.119181 0.138352 0.019832
190 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 101.357006 101.407298 inf inf 616.112043 604.997994 4359.722152 4211.398420 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.062718 2.654522 1.423220 1.799150 0.524942 0.973821 -1.718697 -1.292859 0.652920 0.555264 0.379263
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.552557 2.268541 1.768210 1.562135 0.819510 0.788171 -1.764553 -1.365879 0.639114 0.549061 0.372260
200 N18 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.748487 14.011108 6.491149 0.672552 1.249884 1.068258 1.656932 2.638240 0.042541 0.308816 0.210171
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.249082 2.095704 0.806707 1.481993 -0.068002 0.726078 -1.500189 -1.368644 0.683292 0.589774 0.391307
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.250457 -0.489651 0.022420 -0.486872 -0.796486 -0.269241 -1.342117 25.206682 0.696851 0.620977 0.379542
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.118821 3.936375 1.558476 -0.675725 1.373566 -0.322920 13.239966 0.410104 0.709560 0.638025 0.380026
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.879271 -0.791582 4.971195 -0.591619 -0.772565 -0.378442 1.482438 3.191008 0.572456 0.634825 0.388449
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.449801 1.447140 1.556814 3.235253 0.473476 0.358784 0.266508 0.757999 0.675080 0.573902 0.373247
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.097174 -1.018821 -1.000662 -1.066195 -0.968730 -0.834690 2.416807 -0.800516 0.684909 0.625777 0.380026
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.610192 6.223026 -0.557042 6.808967 -0.524994 1.315252 -0.057204 1.828751 0.671958 0.041583 0.575850
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.552280 -0.933696 -0.560244 -1.005740 -1.134579 -0.582613 -0.196256 -0.664131 0.688591 0.606256 0.385706
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.979478 -0.845412 -1.071675 -1.093432 -0.821913 -0.845922 0.733224 -0.683254 0.692529 0.617011 0.384050
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.678500 -0.392893 -0.761536 -0.630379 -1.071281 -1.078288 0.464287 -0.972873 0.695590 0.621890 0.382403
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.797364 0.545551 -0.291149 1.724885 -0.316295 0.653649 -0.324457 8.471775 0.694748 0.598801 0.386074
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.759680 2.534154 1.947313 1.751831 0.975728 0.939595 -1.764134 -1.317671 0.663473 0.588718 0.371953
225 N19 RF_ok 100.00% 0.00% 61.50% 0.00% 0.026931 5.756059 -0.195372 6.552649 -0.994279 1.040628 -1.242010 1.974562 0.693968 0.268290 0.514130
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -1.061668 5.356364 -1.100887 -0.641285 -0.883043 -0.436065 -0.787123 -0.399552 0.690899 0.542381 0.376423
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.083802 -0.867157 2.445710 -0.924339 0.278653 -0.722086 13.183838 -0.159195 0.645208 0.602708 0.383954
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.034802 -0.698072 -0.274749 -0.644804 -1.001287 -0.482308 -0.435386 -0.031383 0.676637 0.594635 0.380599
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.057275 0.289584 -0.333342 0.104957 -1.080270 -0.478314 -0.656402 -1.363900 0.671736 0.582823 0.388493
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.143057 -0.946195 0.588747 -0.810560 -0.000108 -0.570307 1.126471 -0.592286 0.660166 0.588957 0.391407
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.069914 -0.230636 -0.197798 -0.206861 -1.017132 -0.763211 -1.169531 -1.179502 0.683138 0.598982 0.394180
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.959637 -0.491483 -1.058576 -0.692591 -0.945647 -1.054659 -0.887694 -0.152712 0.686435 0.603638 0.391240
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.482332 -0.615671 0.647733 -0.889390 0.034788 -1.005235 1.444031 -0.193522 0.669441 0.606995 0.387114
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.843217 -0.706949 -0.922120 -0.663491 -1.058318 -0.979114 -0.285529 -0.939772 0.688429 0.607095 0.390058
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 5.349379 0.177102 -0.713874 -0.080223 -0.612681 -0.615191 3.051494 -0.981193 0.602386 0.600924 0.336620
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.294424 -1.074069 -0.155731 -0.764334 -0.188827 -0.501520 9.767974 -0.382740 0.622786 0.600877 0.360369
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.094177 -0.266729 0.215838 0.189403 0.000108 0.146787 0.667695 1.387332 0.672563 0.596312 0.379214
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.273267 -0.668521 -0.408333 -0.909258 -1.163949 -0.673966 -1.242814 0.173961 0.678645 0.593733 0.385517
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.642575 6.494381 -1.096316 6.420933 -0.821666 1.311738 -0.492975 1.176091 0.666045 0.041686 0.570610
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.247664 -0.475810 -0.499145 -0.825800 -1.136508 -0.994668 0.295207 -0.849858 0.668639 0.582321 0.384030
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.500037 4.557415 0.198437 0.429427 0.666116 0.770159 0.022196 0.670790 0.672907 0.583666 0.393598
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.342211 0.457451 0.715989 0.097429 -0.164916 -0.445663 -1.488670 -0.483866 0.578778 0.448965 0.352095
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.909845 1.027436 -0.011721 0.172144 -0.799979 -0.380682 -1.060525 -1.006054 0.577115 0.448472 0.343092
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.228551 -1.027551 -0.125831 -0.628470 -0.957264 -0.396572 -1.166656 0.281106 0.606461 0.484863 0.367703
329 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% -0.103419 -0.419992 -0.701189 -0.921400 -0.551405 -0.560551 0.015540 -0.029886 0.580443 0.458855 0.344141
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 0.304897 -0.088454 -0.134780 -0.622903 -0.177961 -0.457036 1.102012 0.425778 0.564171 0.441534 0.334301
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 7, 15, 17, 18, 19, 27, 28, 31, 32, 34, 37, 38, 40, 42, 47, 51, 53, 55, 56, 58, 59, 60, 61, 63, 65, 66, 68, 70, 72, 77, 78, 81, 82, 83, 84, 86, 87, 92, 93, 94, 96, 97, 101, 102, 104, 108, 109, 110, 111, 112, 117, 118, 121, 122, 124, 127, 131, 134, 135, 136, 137, 142, 143, 147, 148, 149, 150, 151, 155, 156, 158, 159, 160, 161, 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]

unflagged_ants: [5, 8, 9, 10, 16, 20, 21, 22, 29, 30, 35, 36, 41, 43, 44, 45, 46, 48, 49, 50, 52, 54, 57, 62, 64, 67, 69, 71, 73, 74, 79, 80, 85, 88, 89, 90, 91, 95, 103, 105, 106, 107, 113, 114, 115, 120, 123, 125, 126, 128, 132, 133, 139, 140, 141, 144, 145, 146, 157, 162, 163, 164, 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, 329, 333]

golden_ants: [5, 9, 10, 16, 20, 21, 29, 30, 41, 44, 45, 54, 67, 69, 71, 85, 88, 91, 103, 105, 106, 107, 123, 128, 140, 141, 144, 145, 146, 157, 162, 163, 164, 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_2460056.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 [ ]: