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 = "2459913"
data_path = "/mnt/sn1/2459913"
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: 11-29-2022
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/2459913/zen.2459913.25250.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 1851 ant_metrics files matching glob /mnt/sn1/2459913/zen.2459913.?????.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/2459913/zen.2459913.?????.sum.known_good.omni.calfits. Skipping redcal chisq.

Figure out some general properties¶

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

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

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

Load a priori antenna statuses and node numbers¶

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

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

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

Summarize auto metrics¶

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

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

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

Summarize ant metrics¶

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

Summarize redcal chi^2 metrics¶

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

Get FEM switch states¶

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

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

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

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

Find X-engine Failures¶

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

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

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

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

Build Overall Health DataFrame¶

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

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

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

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

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

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

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

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

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

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

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

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

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

Table 1: Overall Array Health¶

In [18]:
HTML(table.render())
Out[18]:
JD 2459913
Date 11-29-2022
LST Range 0.061 -- 10.023 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
Total Number of Antennas 200
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 3
dish_ok: 1
RF_maintenance: 49
RF_ok: 15
digital_maintenance: 3
digital_ok: 105
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 200 (0.0%)
Antennas in Commanded State (observed) 0 / 200 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 18
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 57 / 200 (28.5%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 131 / 200 (65.5%)
Redcal Done? ❌
Never Flagged Antennas 69 / 200 (34.5%)
A Priori Good Antennas Flagged 60 / 105 total a priori good antennas:
3, 7, 9, 15, 19, 21, 29, 30, 37, 38, 42, 45,
51, 53, 54, 55, 56, 66, 68, 71, 81, 86, 93,
94, 101, 103, 109, 111, 116, 121, 122, 123,
128, 136, 140, 142, 143, 146, 147, 151, 152,
153, 158, 161, 164, 165, 167, 169, 170, 173,
181, 182, 183, 185, 187, 189, 191, 192, 193,
202
A Priori Bad Antennas Not Flagged 24 / 95 total a priori bad antennas:
22, 35, 43, 46, 62, 73, 77, 79, 82, 89, 90,
95, 115, 120, 125, 132, 137, 138, 139, 220,
221, 238, 324, 325
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459913.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
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.562537 -0.159004 9.379526 0.357905 8.994371 0.681365 5.639267 5.721468 0.034431 0.677107 0.581050
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.096870 0.245786 1.954938 0.322213 1.500678 12.883125 -0.744431 -0.550125 0.689328 0.679216 0.417025
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.503482 0.090640 -0.201847 -0.197518 0.372618 2.595186 -0.451567 -0.209041 0.693065 0.679321 0.413371
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.363421 -0.887287 0.873581 2.751160 0.481593 -0.046004 13.282173 15.272313 0.684757 0.668819 0.411933
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.965355 -1.397208 -0.958697 -0.295585 -0.100345 0.960347 5.838202 2.546168 0.685670 0.678469 0.409117
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.978761 -0.660976 7.741398 0.049359 4.901317 0.746919 1.299496 -0.316789 0.519212 0.673569 0.467431
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.117365 -0.691029 -1.323136 -0.693969 0.276359 2.083453 -0.648648 1.170429 0.669121 0.668218 0.417523
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.768342 0.259157 8.783537 0.984157 9.002969 2.016788 5.073513 0.988775 0.032923 0.677690 0.562548
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.176943 -0.857089 -0.363706 0.402225 1.803518 2.457301 0.487545 2.290441 0.699087 0.682121 0.410242
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.318682 1.138333 -0.070778 -0.085928 1.148648 0.670061 0.145421 1.478377 0.695027 0.687118 0.412897
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.553566 9.525148 9.332248 -0.068894 9.135092 2.454883 5.546864 24.442717 0.029771 0.478788 0.394670
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.392781 -1.432641 0.770084 1.171631 -0.339273 2.009202 1.719673 8.816309 0.687505 0.682928 0.404971
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.705706 -1.026658 3.495258 -1.005264 0.143483 -0.990311 2.242264 -0.898498 0.673568 0.689426 0.413982
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.524915 0.048815 -0.298903 4.327197 0.663724 0.429102 2.007341 1.405037 0.672834 0.640843 0.415157
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.621151 -0.180549 0.467648 0.147105 0.859458 0.778938 0.107674 -0.423337 0.640522 0.646087 0.409467
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.180321 12.431157 9.388751 9.870104 9.130970 9.287308 7.319971 3.198088 0.035664 0.039553 0.004847
28 N01 RF_maintenance 100.00% 0.00% 84.12% 0.00% 13.585536 28.853941 -1.354454 0.744062 3.507931 7.093181 10.759453 19.859380 0.382741 0.161479 0.285228
29 N01 digital_ok 100.00% 0.00% 100.00% 0.00% -1.059915 12.912440 -0.194424 9.466783 0.197071 9.285923 -0.463588 1.649352 0.699731 0.036584 0.613583
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.581769 -0.095337 -0.472674 0.248965 2.192145 1.667280 13.529604 0.795543 0.698355 0.691766 0.402530
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.387257 -1.244152 1.008756 0.834179 1.416800 -0.037625 3.757878 3.090992 0.704756 0.690454 0.407132
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.226450 27.169907 -0.569759 2.339074 0.152352 3.379700 0.615638 7.635334 0.684691 0.587791 0.384860
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 13.495742 -0.507834 3.842061 0.025812 9.067276 5.408566 5.973685 5.352644 0.043778 0.661008 0.525352
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.556271 0.661430 -1.283868 -1.694822 2.228428 -0.346089 3.588446 0.024855 0.631815 0.636238 0.403547
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.137425 8.630533 -0.113570 0.164763 0.993513 2.187130 0.757344 1.825798 0.678545 0.673643 0.401714
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.799609 0.440066 -1.375703 0.506937 1.269765 2.126459 -1.043429 8.285033 0.691607 0.685244 0.407090
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.060271 -0.025451 -0.242652 0.150410 0.137321 2.160674 7.095397 2.204501 0.697504 0.691916 0.408732
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.312163 0.652547 -0.323738 0.250765 -0.442844 0.058506 -0.367688 -0.024855 0.696860 0.685342 0.401677
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.520383 0.221096 -0.625132 -0.229264 2.735763 -0.043007 -0.891481 -0.670814 0.703391 0.690421 0.395853
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.487577 13.469461 9.642982 10.362398 8.900423 9.121382 5.682729 3.021185 0.035289 0.032609 0.001001
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.282643 0.890730 0.034400 0.304615 -0.693249 0.804257 -1.567196 0.391787 0.709528 0.693796 0.402594
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.303920 0.249498 -1.106915 -0.213080 -0.417973 0.699094 -1.492281 -0.218527 0.706170 0.703027 0.399998
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.498207 1.794002 -0.183234 0.332866 -0.536500 4.140226 0.320381 4.845397 0.694820 0.680586 0.396247
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.013294 2.208199 1.091498 2.009016 -0.299617 0.535811 0.574160 -1.723289 0.686611 0.697617 0.415770
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 12.552715 1.383724 3.663949 -1.176864 9.027921 0.053930 5.745796 2.329155 0.038955 0.652632 0.510166
48 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.680359 1.107514 -0.000652 1.765069 5.785830 1.418497 4.988378 -1.233056 0.646880 0.665936 0.408865
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.516780 0.304388 -1.463330 -0.762802 0.631919 -0.322192 0.061074 12.026532 0.602907 0.633761 0.403107
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.425473 32.038184 -0.223449 1.339088 0.649976 0.580720 4.050723 2.207059 0.669867 0.577473 0.376095
51 N03 digital_ok 100.00% 99.89% 0.00% 0.00% 26.137637 1.111900 12.102216 0.175610 9.255268 4.559976 13.918901 7.370225 0.040099 0.688560 0.568030
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.078871 7.219551 -0.751876 0.222435 1.124250 1.020618 1.902949 2.039292 0.698866 0.694479 0.399315
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.891837 2.991546 -0.306527 -0.032347 1.577243 2.594328 3.546094 6.412827 0.707122 0.701331 0.401949
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.563616 13.119193 9.401656 10.101859 9.058796 9.246822 7.258667 2.888165 0.033090 0.032618 0.001227
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 1.574140 13.857299 -0.066166 10.000044 3.611712 9.268197 2.816013 4.490223 0.704592 0.035630 0.556752
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 1.441641 13.996469 0.043208 10.222868 -0.136631 9.187338 0.807613 2.852631 0.705645 0.038698 0.579231
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 29.883956 0.423025 5.866730 0.273482 5.512674 1.005687 8.350893 1.691672 0.513673 0.700334 0.408443
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.121681 12.798659 9.284254 9.989577 9.011563 9.231391 6.981718 3.157162 0.035199 0.035360 0.001286
59 N05 RF_maintenance 100.00% 99.95% 0.00% 0.00% 12.344243 0.900961 9.347869 1.965923 8.893598 3.074997 5.955269 11.787978 0.048644 0.688805 0.552428
60 N05 RF_maintenance 100.00% 0.00% 97.03% 0.00% 1.083335 12.702040 -0.679184 10.023088 -0.353149 9.244789 1.700459 4.743782 0.693689 0.072406 0.557875
61 N06 not_connected 100.00% 0.00% 0.00% 0.00% 8.638516 0.857123 1.956215 -1.274342 4.889467 -1.316663 1.120211 0.462282 0.513529 0.651688 0.424160
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.389692 0.952634 -1.677438 1.170875 -0.728177 -0.510972 2.521098 -0.228784 0.631557 0.666357 0.403171
63 N06 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
64 N06 not_connected 100.00% 100.00% 100.00% 0.00% 261.585006 261.404461 inf inf 4110.973668 4228.318656 8787.911074 9113.925725 nan nan nan
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.576801 1.372932 0.001874 0.709025 0.334193 1.746003 0.344003 -0.246139 0.673487 0.683606 0.408851
66 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.381199 1.729957 2.223817 1.673839 3.828574 0.424522 0.844437 0.576532 0.681971 0.687140 0.402489
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.373555 -0.443885 1.074109 1.069136 -0.697321 1.044853 1.462334 2.652936 0.691085 0.689894 0.392099
68 N03 digital_ok 100.00% 0.00% 99.95% 0.00% 1.002766 28.995825 0.265575 13.316724 -0.021799 9.261172 0.565471 11.506889 0.702480 0.032856 0.561542
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.411340 -0.323197 -0.085193 0.434803 -0.220537 2.306580 -0.209511 0.488677 0.703027 0.700154 0.391782
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.894029 0.036770 -0.611685 -0.277320 1.741422 2.395526 0.277741 0.350102 0.711539 0.705473 0.390162
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 8.439819 -0.125014 0.261182 0.676329 0.809312 0.240198 0.928310 1.008323 0.719664 0.706897 0.390282
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.646111 0.076105 0.398453 0.662300 -0.037561 -0.365173 0.937217 0.335398 0.708784 0.704496 0.385862
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.940651 1.188192 -1.014528 1.010382 1.197034 0.188824 -1.018712 0.027797 0.715998 0.702941 0.394164
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.938300 2.075772 0.017887 -0.872832 0.044068 1.881047 -0.730514 4.893689 0.708736 0.699913 0.390984
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.375534 1.023502 0.447272 -1.522272 -0.877431 -0.514424 -1.513221 -0.850865 0.667710 0.637280 0.403615
78 N06 not_connected 100.00% 100.00% 100.00% 0.00% 238.144047 237.929953 inf inf 3455.861573 3506.661841 9288.092007 8918.707692 nan nan nan
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.660785 -0.022199 -0.743067 -1.058828 -0.974741 -0.815791 -0.547848 -0.090510 0.637535 0.651244 0.405614
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 9.636757 14.456341 2.644445 4.137922 6.668054 9.187804 29.137888 2.460937 0.309245 0.039733 0.209407
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -0.475307 -0.371779 -0.431407 -0.496772 -0.038868 18.685972 0.316675 1.071871 0.653588 0.667744 0.400711
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.806413 -0.274450 -0.048835 1.757684 -0.253243 0.178702 -0.406328 -0.198034 0.672371 0.667157 0.395203
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.730519 -0.158248 -0.265993 -0.042845 -0.083418 0.287214 0.083648 1.245229 0.683540 0.687058 0.393682
84 N08 RF_maintenance 100.00% 27.66% 100.00% 0.00% 22.530311 25.598327 12.264621 12.878512 7.552888 9.170499 7.282138 6.115731 0.255742 0.035166 0.170958
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.599374 0.462808 2.645775 1.085433 -0.525502 0.228320 -0.027535 3.549665 0.683848 0.694490 0.392560
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.741218 -0.295753 1.112193 1.304447 5.209561 -0.885193 0.557742 19.002424 0.694870 0.691073 0.380996
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.425200 7.465466 0.036909 -0.443798 7.352849 1.512845 0.399150 0.671865 0.706417 0.714778 0.386840
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.687552 0.452683 0.073794 0.467332 -0.118620 0.195445 0.454813 -0.198745 0.708232 0.702442 0.379263
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.758323 0.352542 -0.342225 0.513066 -0.213035 -0.781132 -0.705959 -0.390279 0.709106 0.702303 0.384200
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.325219 -0.248050 1.266437 0.890098 -1.250874 -0.853177 0.447568 3.891012 0.697040 0.696417 0.387321
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.612841 -0.294027 -0.678281 -0.684919 -1.049472 -0.908594 -0.281124 -0.200992 0.695346 0.701769 0.397616
92 N10 RF_maintenance 100.00% 0.00% 10.43% 0.00% 42.280603 48.198585 0.262528 0.816952 5.311993 5.779801 3.955892 13.435594 0.298994 0.253748 0.099254
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.325804 0.812271 1.661613 0.104587 0.878023 0.639531 4.797934 -0.538614 0.681680 0.691196 0.403677
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 12.778835 -0.743673 9.550489 -0.398286 8.958735 0.631213 5.917544 2.196692 0.032476 0.686127 0.473369
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.182787 0.052370 -0.756331 1.018901 -0.466143 0.076753 -1.126732 -0.026424 0.644307 0.669946 0.411601
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.936810 14.003884 3.678756 4.328886 8.908337 9.120118 5.822111 2.160685 0.033069 0.037111 0.002655
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.501034 5.165717 -1.619467 0.940079 -0.819789 4.808643 9.333844 23.967741 0.619693 0.579035 0.405128
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.029329 0.605572 -0.303052 -0.070988 -0.335614 0.935456 1.372529 2.801206 0.651605 0.654795 0.399394
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.026977 -0.735872 0.630708 -0.040701 -0.678920 1.323236 3.351293 -0.090567 0.657080 0.674940 0.402034
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.119072 -0.433731 -0.689126 0.094041 1.449499 -0.568374 0.436020 1.664952 0.675639 0.678571 0.392327
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.804417 8.850719 -0.834603 0.839980 -0.067212 1.829422 0.098012 -0.216679 0.701707 0.697746 0.391380
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.070957 1.124927 -1.388773 2.627568 1.429616 0.498277 -1.251369 9.389626 0.708651 0.689965 0.387634
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.465109 5.384619 4.664306 0.553762 5.891354 4.516873 9.033714 3.811262 0.678229 0.703191 0.385069
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.484773 66.303283 6.266895 6.811623 1.997128 0.566692 0.752826 3.700690 0.662199 0.677657 0.383262
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.354522 -0.559746 -0.701618 -0.152007 0.535423 -0.817303 -0.685208 -0.500299 0.712271 0.702912 0.377349
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.216959 0.787590 0.592754 0.671820 0.391318 0.072007 0.336263 -0.387255 0.705667 0.702328 0.380037
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.732720 -0.354415 -1.200419 -1.039055 -0.345551 -0.266017 0.053212 2.016803 0.709127 0.707274 0.385165
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.705776 12.862463 9.333016 -0.727455 9.057507 5.797229 6.426686 4.304059 0.038218 0.395907 0.257451
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.236805 12.407872 8.838136 9.218341 9.100806 9.266154 5.123364 2.924476 0.030195 0.035670 0.002550
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.660872 27.467181 -0.225468 13.064418 1.416902 9.108476 -0.048039 5.791881 0.700670 0.033114 0.477707
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.289253 12.686363 0.118955 9.872739 -0.500622 9.299569 0.902751 3.468604 0.685299 0.036749 0.482593
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.181334 0.773220 -0.170129 -0.090380 0.013210 2.009002 -0.026183 -0.512370 0.674486 0.679895 0.407822
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.775277 14.061212 3.456996 4.217585 8.938670 9.149911 6.433300 1.886960 0.035193 0.030882 0.002357
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 25.250617 15.331775 24.434895 12.350087 75.248321 11.528693 1707.122392 219.772172 0.016487 0.023601 0.004341
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.656619 1.368902 2.644554 1.837534 2.041017 0.818345 -0.464363 -0.351977 0.628202 0.646557 0.418504
116 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -1.102100 0.555846 -0.204177 0.393158 0.024680 0.413368 5.006912 1.349944 0.644936 0.653186 0.401068
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 17.033835 46.399234 44.160378 31.503514 13.453462 68.791773 671.352611 771.744341 0.016225 0.016256 0.005089
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.315641 1.224813 -0.520695 0.333386 0.030240 -0.160625 0.938906 1.781082 0.677319 0.684997 0.398488
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.193993 1.473285 -1.650907 -1.288836 0.256079 5.989311 -0.853124 1.094673 0.689701 0.690631 0.394361
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.243192 2.987330 2.332934 2.219807 -0.696805 0.963575 3.103981 -2.073434 0.690571 0.698344 0.384195
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.244272 4.683803 -0.234110 3.596889 2.283233 26.247416 53.512645 15.438322 0.710334 0.692153 0.385144
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.297528 7.386991 0.673610 0.570496 0.620815 1.572453 0.916462 -0.311837 0.717992 0.710891 0.386201
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.369469 9.763982 0.298178 0.681875 0.456300 -0.038072 0.648578 0.470414 0.722560 0.715593 0.385054
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.999893 -0.503785 -0.460855 0.384903 -0.774608 0.226651 0.543503 0.394440 0.717665 0.711473 0.378644
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.556003 -0.110437 -0.517224 0.449085 -0.228241 -0.013210 -0.148173 0.049510 0.710819 0.702908 0.384604
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.208870 0.434260 -1.509296 0.634016 3.747448 0.023955 3.272618 -0.238125 0.710253 0.705333 0.393004
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.354406 0.332174 -0.022811 0.174531 2.569566 1.456144 -0.209025 0.080409 0.703646 0.707910 0.401767
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.265198 12.282456 9.453488 9.987116 8.972216 9.177400 5.157547 1.977264 0.030233 0.026254 0.002223
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.169259 -1.692182 0.382408 0.678898 -0.548383 -0.217399 -0.236518 0.659664 0.688302 0.694758 0.408537
130 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.483566 0.730853 -0.332556 0.118654 -0.551104 0.856778 1.125707 3.462849 0.671147 0.684492 0.400411
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.730883 14.205791 3.698346 4.438965 9.046651 9.232704 8.483772 1.115527 0.033662 0.039727 0.002565
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.733477 1.603558 0.326913 -1.417970 -0.856798 -0.665246 -1.327894 0.063705 0.638617 0.638025 0.405348
133 N11 not_connected 100.00% 100.00% 81.42% 0.00% 13.285387 17.897716 3.453486 3.028779 9.029398 7.861797 6.274900 1.786418 0.041746 0.186646 0.104243
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.074305 1.015918 6.033832 1.711978 1.997917 -0.466040 4.556470 -1.686536 0.570343 0.662177 0.433999
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 3.197949 0.149210 3.424122 1.406770 21.965657 17.618633 3.709028 0.613463 0.617352 0.653146 0.400755
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.022199 -0.896609 -0.301206 -1.271834 3.094793 -0.589568 1.363456 0.762130 0.658332 0.671973 0.405838
138 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.049397 -0.364931 -0.001874 0.661848 -0.185187 -0.261991 2.094535 -0.247091 0.681288 0.683543 0.402352
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.879478 -0.087937 1.601212 -0.964191 0.695956 -1.323277 -1.172795 -0.997519 0.683872 0.675600 0.392335
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.130061 -0.332216 -1.491498 -0.253085 -0.099435 -0.383757 6.251722 5.322359 0.701623 0.706162 0.387776
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.354768 -0.615774 -0.759099 0.691537 3.225264 -1.242384 -0.111242 -1.195618 0.706630 0.707242 0.385615
142 N13 digital_ok 100.00% 0.00% 99.89% 0.00% 2.178241 12.626370 -1.122832 10.026244 3.623450 9.247557 28.727921 3.089050 0.710854 0.046573 0.576087
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 1.369399 -0.623601 5.862530 -0.173016 0.005585 2.894578 -0.119921 -0.443683 0.657749 0.713659 0.405298
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.584253 -0.802302 -0.669196 3.443962 0.898969 -0.735605 -0.319565 -0.269794 0.716493 0.691163 0.392622
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.176995 1.212055 -0.484696 4.332601 0.000304 12.515963 0.460054 0.876886 0.712513 0.677902 0.400481
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 12.996209 -0.903114 3.459370 -0.174586 8.992910 -0.406744 5.211365 -0.946866 0.037467 0.694706 0.560129
147 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.576445 -1.177351 1.328448 1.908764 -0.398737 -0.302636 4.487421 0.774618 0.691490 0.693750 0.397110
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.593518 -0.140842 2.829560 1.523029 0.593737 1.145480 0.984946 0.050448 0.673929 0.695049 0.406611
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.596247 1.181667 -1.221990 1.815288 -0.329055 -0.075441 -0.761493 -1.412600 0.685874 0.694557 0.412190
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.172616 0.226063 1.574668 0.799324 1.008901 -1.164159 -1.130094 -1.211589 0.675851 0.689722 0.419856
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 31.179626 1.452197 -0.229004 0.079730 3.750952 -0.471417 2.545298 -0.009856 0.507922 0.620564 0.384722
152 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 1.237233 1.475534 -1.412747 -1.296121 1.165317 -1.229846 6.064755 -0.541699 0.617923 0.642855 0.419259
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 12.129248 0.410456 3.616979 -0.297558 9.016192 -0.679984 6.138996 0.218445 0.041972 0.641598 0.575745
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.848807 -0.593175 0.497220 0.023380 -0.434329 -1.024541 -0.905019 -0.511767 0.607517 0.633527 0.427857
155 N12 RF_maintenance 100.00% 80.77% 0.00% 0.00% 0.612905 -0.548343 5.144833 -1.144646 109.372587 0.779756 18.379562 3.563921 0.157116 0.663387 0.497156
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.041011 12.367041 2.906769 9.730925 -0.643449 9.286378 5.029448 1.912172 0.634322 0.039574 0.503555
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.238257 -0.081987 -0.465445 0.409023 -0.296716 1.485491 0.772006 0.678168 0.667341 0.669597 0.407164
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.234325 0.566278 -0.622110 -0.812536 2.444178 2.517591 6.219543 23.564861 0.682189 0.683244 0.411116
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.064463 22.149534 -1.444351 -1.111200 -0.864838 6.499188 -0.860382 15.830314 0.655243 0.586316 0.385340
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.378107 -1.045880 -0.709908 -0.985673 -0.360718 2.163682 1.267164 1.394122 0.699283 0.696116 0.393190
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.577405 30.881017 -0.481241 -0.819501 0.666955 0.782919 0.156826 1.174777 0.703533 0.573292 0.357105
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.521600 -0.068663 2.325832 1.247753 0.125054 -0.983762 -0.413927 -0.900070 0.706622 0.708748 0.384321
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.137141 1.258023 -0.623663 0.172830 0.222733 1.054293 0.181441 2.028863 0.717754 0.707829 0.392117
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.578228 0.651064 1.109781 -0.361912 5.663416 2.525570 2.158528 1.696180 0.706650 0.708240 0.386010
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 33.742052 0.129727 2.006097 0.261507 3.996292 0.599636 1.635470 0.015886 0.553509 0.702697 0.373133
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.309726 1.858024 -0.086246 1.347119 0.376647 -0.249790 7.029130 2.522969 0.708712 0.705003 0.399606
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.140647 -1.180434 -1.013709 3.618659 1.984676 -0.039538 -1.195434 6.535466 0.706981 0.681830 0.410313
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.527410 -0.969754 -0.178421 -0.677162 1.753203 0.811996 -0.110235 2.132527 0.694471 0.701785 0.408322
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.633187 3.385259 -1.290440 -1.503275 0.473548 0.870415 -0.827592 11.402029 0.691233 0.681811 0.412152
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 12.401245 -0.268325 9.581902 -1.077226 8.915241 4.943518 5.628839 5.251963 0.037639 0.692022 0.565539
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.070835 3.238896 -1.279629 -0.281362 -1.010203 0.890750 -0.932192 -0.055660 0.625065 0.600782 0.398054
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 14.014280 13.896992 3.207940 3.870850 9.171770 9.294113 8.159093 7.961874 0.039085 0.043515 0.001012
174 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
179 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.622646 14.133003 9.600541 10.555544 8.845462 9.087191 5.471100 2.551194 0.030300 0.031484 0.001131
180 N13 RF_maintenance 100.00% 0.00% 99.89% 0.00% 0.051958 13.593537 0.302671 10.165711 1.289382 9.194371 27.183179 4.068333 0.688765 0.052237 0.579051
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.858445 0.002934 -0.566556 0.055619 0.833535 0.276193 0.139173 5.567206 0.703875 0.693048 0.396545
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.475251 4.766867 -1.262845 3.393311 0.319456 3.847143 18.058526 0.312485 0.710707 0.689243 0.402117
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.402950 1.927391 0.725002 4.585548 1.104238 0.250982 2.219887 0.054506 0.702776 0.649403 0.393623
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.171728 -0.544463 -0.359589 3.323951 0.118362 -0.922619 2.584143 0.943143 0.704831 0.686394 0.390530
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 23.432155 -1.300530 7.078039 4.074115 7.964240 -0.457725 1.851669 0.385262 0.446983 0.671041 0.400845
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.628251 -1.298171 -1.566179 -0.787446 2.368204 0.801257 1.726452 0.488109 0.709623 0.707529 0.404383
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.188263 -0.313633 -1.256880 -0.811609 0.437320 1.286453 2.494308 17.216816 0.703817 0.705429 0.399311
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 9.434698 9.799645 1.855399 1.526729 3.541901 4.111411 4.670004 1.378904 0.360551 0.380898 0.179331
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.065034 -1.206034 -1.063264 0.357313 -0.320420 -0.083417 -0.286561 -1.494859 0.682354 0.692783 0.425346
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.506009 0.760331 0.817796 -0.679556 0.192006 1.115161 12.071212 0.647342 0.667512 0.679390 0.422991
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.175023 8.293304 5.034662 4.886207 6.989810 7.156421 1.373763 -2.338895 0.614951 0.631929 0.413514
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.902721 0.360878 5.122978 1.235539 7.161248 1.117427 1.463231 -0.187089 0.604330 0.647148 0.437489
194 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 269.131045 268.911434 inf inf 4927.018597 4927.161161 8904.605283 8885.808204 nan nan nan
200 N18 RF_maintenance 100.00% 100.00% 46.62% 0.00% 13.511020 40.356607 3.617811 0.669161 9.154001 7.134539 6.585428 0.978303 0.047060 0.228862 0.165944
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.223353 7.233334 5.198890 4.443960 7.136880 6.413206 1.645346 -1.765056 0.648245 0.653876 0.396040
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 1.231907 2.821749 0.820375 -0.260144 -0.493642 -0.227380 1.642426 5.195668 0.685251 0.634982 0.404196
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.624044 3.138074 0.151197 -0.718604 -0.927291 -0.425346 -0.583527 7.061031 0.679409 0.651155 0.399007
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.610720 1.668913 1.116990 -0.852388 3.696237 -0.932926 -0.645705 5.749525 0.675395 0.656127 0.398082
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.192740 2.974730 1.465913 -0.476005 0.812235 4.939031 -0.575409 -0.524876 0.661243 0.652939 0.386319
213 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.024575 -0.068511 0.058050 -0.187136 -1.111915 -0.159192 2.817955 -0.993385 0.677269 0.663526 0.399534
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 3.005722 0.797962 -0.802304 -0.362576 -0.405896 -0.742661 1.616493 0.221113 0.646883 0.669168 0.407583
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.508090 1.254794 0.666798 -0.391004 -0.534325 4.609679 5.111892 1.365831 0.680060 0.669907 0.404715
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.249259 1.624691 -1.389187 -1.020914 -0.542020 1.177109 -0.748312 4.400273 0.665379 0.663240 0.400992
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 8.328058 7.924708 5.366614 4.947349 7.239172 7.226064 1.870611 -2.277714 0.646949 0.644930 0.404343
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
237 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 6.643871 2.487882 1.191625 -1.243876 3.069236 -0.523317 2.638747 -0.604053 0.560836 0.642957 0.431747
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.039498 -0.114447 1.678607 1.090199 0.500538 -0.320677 -1.055699 -1.801552 0.677269 0.663758 0.414218
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.156317 4.066752 0.073131 0.575651 6.266362 3.333311 4.735382 4.389932 0.671199 0.591005 0.429049
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 235.347199 234.837861 inf inf 4027.577061 3998.954243 8002.040273 7842.181000 nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 0.290516 13.668800 -0.589781 6.363612 -0.164738 9.299520 10.275981 4.579635 0.664780 0.048713 0.571756
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.546897 2.951495 1.235131 1.578766 0.505385 0.349991 0.169570 -0.909690 0.548485 0.553011 0.399285
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.409700 -0.732443 1.350375 -1.287067 0.533161 -0.079162 -1.334586 1.240065 0.604212 0.577294 0.404865
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.772702 -0.338538 -1.600729 -0.934133 -0.408589 -0.351367 5.203653 0.778646 0.512518 0.552629 0.397322
333 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.793723 1.778862 -1.129615 -1.524948 -0.786476 -0.571011 4.336739 0.835956 0.502454 0.547944 0.400871
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: [3, 4, 7, 8, 9, 15, 18, 19, 21, 27, 28, 29, 30, 32, 34, 36, 37, 38, 42, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 63, 64, 66, 68, 71, 74, 78, 80, 81, 84, 86, 87, 92, 93, 94, 96, 97, 101, 102, 103, 104, 108, 109, 110, 111, 113, 114, 116, 117, 119, 121, 122, 123, 126, 128, 131, 133, 135, 136, 140, 142, 143, 145, 146, 147, 151, 152, 153, 155, 156, 158, 159, 161, 164, 165, 166, 167, 169, 170, 173, 174, 179, 180, 181, 182, 183, 185, 187, 189, 191, 192, 193, 194, 200, 201, 202, 203, 205, 206, 207, 213, 219, 222, 223, 224, 225, 226, 237, 239, 240, 241, 242, 243, 320, 329, 333]

unflagged_ants: [5, 10, 16, 17, 20, 22, 31, 35, 40, 41, 43, 44, 46, 62, 65, 67, 69, 70, 72, 73, 77, 79, 82, 83, 85, 88, 89, 90, 91, 95, 98, 99, 100, 105, 106, 107, 112, 115, 118, 120, 124, 125, 127, 129, 130, 132, 137, 138, 139, 141, 144, 148, 149, 150, 154, 157, 160, 162, 163, 168, 171, 184, 186, 190, 220, 221, 238, 324, 325]

golden_ants: [5, 10, 16, 17, 20, 31, 40, 41, 44, 65, 67, 69, 70, 72, 83, 85, 88, 91, 98, 99, 100, 105, 106, 107, 112, 118, 124, 127, 129, 130, 141, 144, 148, 149, 150, 154, 157, 160, 162, 163, 168, 171, 184, 186, 190]
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_2459913.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.0.5.dev11+g87299d5
3.1.5.dev171+gc8e6162
In [ ]: