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 = "2459914"
data_path = "/mnt/sn1/2459914"
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-30-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/2459914/zen.2459914.25246.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/2459914/zen.2459914.?????.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/2459914/zen.2459914.?????.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 2459914
Date 11-30-2022
LST Range 0.125 -- 10.087 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 56 / 200 (28.0%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 118 / 200 (59.0%)
Redcal Done? ❌
Never Flagged Antennas 82 / 200 (41.0%)
A Priori Good Antennas Flagged 52 / 105 total a priori good antennas:
3, 7, 9, 10, 15, 16, 19, 20, 21, 29, 30, 31,
42, 51, 54, 55, 56, 68, 71, 81, 86, 94, 98,
101, 103, 109, 111, 121, 122, 123, 128, 136,
142, 143, 144, 146, 151, 153, 158, 161, 165,
167, 170, 173, 182, 183, 185, 187, 189, 191,
192, 193
A Priori Bad Antennas Not Flagged 29 / 95 total a priori bad antennas:
8, 22, 43, 46, 48, 49, 61, 64, 73, 74, 77,
82, 89, 90, 95, 115, 120, 125, 126, 132, 137,
179, 205, 220, 221, 222, 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_2459914.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.537632 -0.384602 11.173482 0.311868 8.626011 0.641257 6.736960 2.378693 0.035871 0.731901 0.622464
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.258415 3.114396 1.267690 -0.850204 1.957542 0.305249 14.694969 3.718558 0.720088 0.727460 0.327964
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.096290 -0.112788 -0.185870 -0.398122 -0.221723 1.586981 0.455893 1.136899 0.724226 0.733222 0.321218
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.607589 -1.380575 1.021224 3.550232 0.736207 0.303743 4.551805 8.586568 0.719012 0.721811 0.315832
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.131451 -1.579693 -1.079798 -0.478068 0.132536 0.714314 1.110382 2.211127 0.719577 0.729194 0.320140
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.646528 -0.529262 9.188516 -0.075963 4.820208 0.838240 1.512320 2.874907 0.579505 0.725885 0.391628
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.783426 -0.540331 -1.331977 -1.231978 0.098415 2.071481 0.933852 5.098726 0.707401 0.723150 0.329010
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.967111 0.226579 11.104217 1.011916 8.666308 1.923704 6.632778 1.641043 0.034828 0.734501 0.610974
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.813867 -1.203498 11.133583 0.307292 8.633773 1.562101 6.731206 1.327610 0.034880 0.735855 0.608256
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.647908 0.630907 0.054324 -0.207564 0.382540 0.799218 -0.010464 -0.090516 0.729953 0.739014 0.320892
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.580673 11.561552 11.128842 -0.118147 8.787046 4.306213 6.690675 10.326510 0.029710 0.551983 0.460540
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.590978 -1.853142 -0.752600 3.649009 4.053563 46.539938 2.076011 6.773997 0.728122 0.720267 0.317069
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.122833 -1.023242 3.641877 -1.019358 18.708674 -0.809109 15.721110 -1.971099 0.713587 0.737679 0.332290
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.010813 0.069836 -0.258785 4.830162 0.569395 1.253905 1.860891 6.815186 0.714837 0.702988 0.319325
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.115466 -0.674156 0.426315 0.301083 -0.010103 0.509185 -0.017869 -0.805343 0.684581 0.703144 0.324006
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.021660 12.476641 11.185783 11.554669 8.762721 9.298252 7.208042 6.780571 0.036839 0.041171 0.004951
28 N01 RF_maintenance 100.00% 0.00% 55.65% 0.00% 12.542378 28.407394 -1.538206 0.697370 4.099615 8.342450 5.160963 11.156898 0.456940 0.215820 0.318220
29 N01 digital_ok 100.00% 0.00% 100.00% 0.00% -1.499415 12.960912 -0.165078 11.089271 -0.099362 9.285970 -0.428151 6.393764 0.734799 0.038351 0.643905
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.039976 -0.572199 -0.088141 0.129995 9.409009 -0.066571 2.900648 0.118434 0.728532 0.743800 0.311569
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.552987 -1.671779 1.018330 0.935796 10.938964 -0.130914 7.700344 1.792626 0.739407 0.743858 0.312320
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.351793 26.965591 -0.597571 2.543254 -0.020939 4.295773 -0.160777 3.807299 0.720664 0.659290 0.292737
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 13.525948 -0.774757 4.706302 0.632366 8.679639 0.545136 6.752863 -1.616117 0.049732 0.717741 0.545056
35 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.798862 -0.242477 0.625555 -1.163153 6.617876 -0.917492 0.684728 1.013722 0.689304 0.703098 0.317081
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.957041 8.521292 -0.035277 0.079837 0.908680 1.850353 -0.007785 0.256675 0.723697 0.731998 0.304321
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.791593 0.197192 -1.859316 1.172850 1.640317 1.437340 -1.096293 3.116445 0.733703 0.741450 0.306340
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.227794 0.196534 -0.193136 0.101816 -0.017235 1.876150 1.359706 0.533599 0.737481 0.747264 0.307722
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.284928 0.437383 -0.281501 0.148621 -0.492692 -0.201659 -0.427803 -0.442150 0.733332 0.740619 0.304448
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.579043 -0.171450 -0.702074 -0.454281 1.576382 0.059227 -0.520993 -0.568860 0.739660 0.744377 0.303082
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.469151 13.500422 11.476529 12.120654 8.552134 9.115831 7.212260 7.164423 0.037093 0.033796 0.000968
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.244567 0.102385 0.025404 0.222002 -0.207043 0.699917 -0.903730 -0.004095 0.741956 0.745596 0.309546
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -2.270833 -0.190308 -0.554973 -1.169686 -0.770131 0.970326 -1.401870 -0.992642 0.738542 0.752338 0.311833
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.575787 3.167258 -0.142044 0.058027 0.046500 1.218457 0.549048 1.893162 0.731649 0.730126 0.302576
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.310996 2.038046 1.350161 2.583275 0.274595 0.740875 1.947959 1.138266 0.725419 0.740735 0.335695
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 12.577431 2.517301 4.496252 -1.173274 8.650569 -0.612482 6.833921 -0.682578 0.041449 0.703471 0.521809
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.079591 0.674825 0.811874 2.278486 -0.702929 0.944596 -0.778320 -0.323375 0.696880 0.718027 0.327405
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.280338 -0.397752 -0.800313 -1.272612 -0.638758 1.439387 0.829942 3.966340 0.663874 0.702711 0.314915
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.342785 27.407945 -0.107566 1.419826 0.396784 0.948515 2.185890 5.058579 0.717289 0.668002 0.279418
51 N03 digital_ok 100.00% 97.46% 0.00% 0.00% 23.741909 0.621717 13.537788 -0.741099 8.885886 3.382839 8.473623 1.233641 0.050500 0.744294 0.611441
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.954491 7.371889 -0.835220 0.123007 1.127994 1.184733 -0.075731 -0.033747 0.738534 0.748611 0.303046
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.536753 2.976368 -0.300125 -0.195285 1.481377 1.906084 0.757073 1.609550 0.745800 0.754505 0.304704
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.572895 13.196270 11.201629 11.826986 8.758605 9.295645 7.823031 7.306923 0.034016 0.033513 0.001100
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.560830 13.364619 -0.589779 11.059300 2.636050 9.285500 0.865339 7.392958 0.741189 0.040044 0.577747
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.149164 14.078961 0.131975 11.965407 -0.035807 9.222979 1.920586 7.242880 0.741604 0.040908 0.591392
57 N04 RF_maintenance 100.00% 0.32% 0.00% 0.00% 30.218525 -0.050488 7.052565 0.162211 10.813074 1.104006 3.843033 0.694549 0.551196 0.752919 0.327419
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.092633 12.888330 11.060755 11.691520 8.649754 9.223438 7.275570 6.895862 0.037312 0.036868 0.000787
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.087021 0.293378 10.523822 0.655576 8.494371 2.720949 7.064755 2.212685 0.056355 0.747289 0.583382
60 N05 RF_maintenance 100.00% 0.00% 90.38% 0.00% 0.657963 12.787859 -0.708067 11.730369 -0.216673 9.236193 0.091505 7.020241 0.731819 0.120700 0.546289
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 3.135803 0.701903 -0.904316 -1.282014 1.813140 -1.449494 -1.277855 -1.074235 0.679560 0.708335 0.307874
62 N06 not_connected 100.00% 0.00% 0.00% 0.00% 1.064777 0.699120 -1.039512 1.613124 5.570773 -0.234340 -0.160533 -0.425945 0.672374 0.720117 0.327078
63 N06 not_connected 100.00% 0.00% 98.92% 0.00% 0.294613 13.248644 -0.262754 4.977478 -0.563333 9.309127 -0.987678 6.976941 0.682261 0.049083 0.492685
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.224035 0.588211 -0.768547 -1.047026 -1.190817 -0.864215 -0.110296 2.262599 0.673783 0.678721 0.303121
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.298682 0.799012 0.135299 0.708272 0.271732 1.147283 0.866229 0.622349 0.717962 0.737162 0.311099
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.094040 1.603191 2.624857 1.906426 2.424274 0.192149 1.779949 1.301836 0.726418 0.744487 0.306015
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.488988 2.324228 2.159820 1.885397 -0.153411 2.897513 2.188843 2.212643 0.733214 0.745930 0.297068
68 N03 digital_ok 100.00% 0.00% 99.35% 0.00% 0.901937 29.184942 0.427091 15.593244 0.335925 9.321863 0.908448 8.990639 0.743252 0.038389 0.591743
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.275881 -0.783273 -0.017729 0.396019 -0.154481 1.310517 0.257757 0.231742 0.741994 0.753457 0.295292
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.567231 -0.376386 -0.668276 -0.490281 1.371405 1.903945 -0.341583 -0.440986 0.747634 0.756641 0.296300
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.088069 -0.122876 0.356220 0.701217 0.609020 0.372589 0.738758 0.464926 0.752496 0.757913 0.294076
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.285140 -0.256806 0.500068 0.633585 -0.059273 -0.040724 1.165547 1.023229 0.743861 0.756250 0.291741
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.184687 1.159562 -1.095946 1.311321 0.571046 0.652209 -1.688488 0.833960 0.750272 0.754346 0.299819
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.524114 0.942264 0.101952 -1.237017 0.031775 3.798015 -1.030005 0.269493 0.743273 0.754366 0.303223
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.918655 0.435152 0.620748 -1.906977 -0.799371 -0.475939 0.366218 -2.119935 0.710689 0.702612 0.312699
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 35.678879 0.020764 -0.722595 1.604698 2.823668 -0.387713 2.644590 -0.295130 0.529934 0.714021 0.323416
79 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.404966 -0.490735 -0.916668 -0.943995 10.068687 -0.697842 12.985747 -1.592114 0.691756 0.717270 0.317653
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 9.363887 14.551817 3.082011 4.851649 5.492352 9.190729 9.599217 6.514472 0.400403 0.042771 0.265023
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -0.866794 -1.103828 -0.425612 0.478809 -0.327377 10.276730 -0.759358 -0.606425 0.699522 0.722647 0.307358
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.049140 -0.348264 0.039754 1.953399 -1.150962 -0.066274 -0.686377 0.091241 0.712439 0.728126 0.300697
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.757892 -0.391344 -0.242211 -0.097536 -0.194502 -0.441879 -0.701850 -0.591707 0.728515 0.742423 0.298319
84 N08 RF_maintenance 100.00% 23.28% 100.00% 0.00% 22.221363 25.644494 14.541312 15.090243 7.205335 9.181300 5.114005 7.173826 0.349801 0.036950 0.212789
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.452445 -0.011481 0.301857 1.116320 -0.223295 -0.424159 -0.168450 0.004095 0.743453 0.748425 0.292098
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.186053 -0.448936 1.492482 1.402706 3.281090 -1.044645 0.316749 5.129093 0.735711 0.747062 0.287712
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.491093 7.108594 -0.012386 -0.683188 0.159474 -0.192157 -0.265138 -0.826913 0.751319 0.762263 0.292440
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.630506 0.236391 0.101557 0.409941 -1.025940 0.010103 0.808749 -0.231258 0.742360 0.755072 0.287646
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.896368 0.216052 -0.285248 0.498624 -0.548711 -0.720312 -0.570277 -0.452402 0.748739 0.754737 0.289009
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.489289 -0.537999 1.179951 0.916648 3.586859 -0.783373 0.818575 1.084654 0.740195 0.750499 0.290840
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.672343 -0.120503 0.051421 -0.136156 -1.233196 -0.541902 0.118030 -0.383354 0.735717 0.751492 0.299496
92 N10 RF_maintenance 100.00% 0.05% 4.38% 0.00% 42.132205 47.562542 0.539990 1.087838 6.239601 6.839759 4.224299 6.292871 0.384315 0.329174 0.092600
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.321449 0.545142 2.092296 0.021701 0.363725 0.699767 3.062867 0.053931 0.727893 0.747141 0.306510
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 12.687808 -1.075985 11.366715 -0.449672 8.712677 2.484216 6.749620 1.362352 0.034925 0.742301 0.469473
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.034114 -0.542312 -0.803577 1.415478 -0.480764 -0.190656 -1.366588 -0.455199 0.694008 0.730046 0.328742
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.920950 14.102636 4.507727 5.072935 8.531695 9.090694 6.820101 6.501171 0.033523 0.039205 0.003158
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.076869 2.866654 -0.478289 -0.778223 19.251775 3.052812 3.298107 6.500346 0.663239 0.697966 0.307300
98 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 0.990248 -0.299662 -0.354743 -0.418760 4.913574 1.872268 -0.031904 -0.368338 0.698049 0.715328 0.308919
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.064380 -0.743756 0.831888 -0.023095 -0.982203 2.250141 0.614337 -1.082814 0.702969 0.730408 0.312110
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.342458 -0.962628 -0.793734 -0.015508 0.813363 -0.636182 -0.767243 -0.585394 0.719481 0.734742 0.302030
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.711536 6.886808 -0.852237 0.800542 -0.006002 1.060996 -0.543779 -0.055921 0.740015 0.746286 0.296873
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.266537 0.473315 -1.691037 2.932603 9.845870 -0.217658 -0.719938 2.616606 0.746844 0.745754 0.291048
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.823401 5.395756 2.254407 0.001757 158.553299 1.379766 11.119289 -0.228091 0.721921 0.755708 0.297572
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.791497 65.337602 7.511878 7.918762 2.186474 0.748906 2.727469 2.490429 0.705808 0.738537 0.292094
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.599106 -0.574593 -0.132491 0.498733 0.363624 -0.289998 -0.273017 -0.310668 0.750197 0.754950 0.284201
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.077084 -1.240270 0.967287 0.680706 2.508866 -0.355554 0.327359 -0.532062 0.742911 0.749467 0.284544
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.610464 0.790436 -0.586065 -0.601893 0.490776 -0.032027 0.425033 0.358069 0.747276 0.756780 0.287183
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.723821 9.851080 11.125961 -0.923486 8.711136 5.157376 6.944610 4.140016 0.040583 0.472899 0.281321
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.441800 12.846672 11.167477 11.418493 8.793382 9.286697 6.678573 6.733900 0.029648 0.036128 0.002983
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.394703 27.541948 -0.292553 15.284886 1.273285 9.133188 0.098841 6.973607 0.743140 0.036269 0.467026
111 N10 digital_ok 100.00% 0.00% 99.95% 0.00% 0.006433 12.720971 0.169351 11.536385 -0.495593 9.318565 0.761294 6.802622 0.732414 0.042222 0.470741
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.156391 1.548213 -0.126879 -0.317559 0.484720 1.440761 0.394564 -0.043199 0.723774 0.736985 0.309017
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.791822 14.137747 4.252162 4.944137 8.562473 9.130646 6.927614 6.455177 0.036666 0.030880 0.003103
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.494071 1.052546 0.997614 -0.354259 1.371802 -1.107061 0.143969 -1.809060 0.629915 0.718383 0.334025
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.272459 1.053390 3.107305 2.416320 1.857978 0.884247 1.001708 -0.586534 0.683873 0.710867 0.331283
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.641804 0.066260 -1.556677 -0.430929 0.206007 0.089813 -0.729406 -0.205609 0.690407 0.710793 0.316450
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.625229 14.467576 11.265439 12.125558 8.572300 9.246476 6.780742 7.194441 0.027502 0.033218 0.003641
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.290517 0.878476 -0.480545 0.255319 -0.797868 -0.508488 0.329854 0.342865 0.717785 0.736746 0.307802
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.585970 2.039279 -1.831660 -1.648791 0.214472 5.601669 -1.535884 -1.324093 0.729153 0.739387 0.305249
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.824696 2.736722 2.834623 2.836640 -0.707359 1.168294 2.715095 1.517344 0.729258 0.741400 0.305751
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.363455 5.046089 -0.723761 0.751689 5.150660 1.362684 9.134266 4.460344 0.745149 0.757312 0.293669
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.543206 5.912744 -0.837374 0.513523 2.555439 1.016962 -0.358404 -0.113355 0.755826 0.757333 0.290371
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.364219 9.725514 0.406038 0.665391 0.586781 0.662969 0.764530 0.315088 0.758135 0.763743 0.289415
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -1.333080 -0.353805 -0.403831 0.263708 -0.873100 -0.105444 0.055927 0.020558 0.754694 0.761328 0.288878
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.106017 -0.938956 -0.971020 0.476547 0.350388 -0.644343 -0.869520 -0.367155 0.749408 0.756221 0.289804
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.814133 -0.489890 -1.617770 0.683165 1.982858 0.473310 0.052857 1.593072 0.746800 0.751089 0.293790
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.068209 0.011481 0.015508 0.045185 1.693648 1.067708 0.081955 0.060078 0.743425 0.759014 0.303711
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.190361 12.328436 11.256710 11.686120 8.562994 9.158440 6.613937 6.449431 0.031536 0.026642 0.002569
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.620262 -2.034060 -0.229415 -0.109897 -0.631630 0.311700 -0.149819 0.091360 0.734882 0.751921 0.309360
130 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.092520 0.380781 -0.272645 -0.019923 -0.662299 -0.016021 0.239953 1.264465 0.722199 0.744039 0.302607
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.713278 14.292569 4.535959 5.205698 8.705454 9.249174 7.586482 6.312523 0.035264 0.041285 0.002719
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.140646 2.043828 0.405852 -1.694221 -0.424655 -0.361049 -1.334511 -1.334697 0.695645 0.708013 0.309942
133 N11 not_connected 100.00% 100.00% 48.84% 0.00% 13.323276 17.972846 4.248748 3.546438 8.668822 7.671582 6.879692 5.146223 0.044436 0.274787 0.161649
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.440522 0.399054 7.116723 2.194926 1.282374 0.000182 4.359411 0.763822 0.621988 0.703908 0.358267
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 2.769898 0.211075 6.275919 2.628865 13.959956 13.547023 4.258733 2.263490 0.637565 0.704729 0.320871
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.311681 -0.651173 -0.326195 -1.385473 1.618469 -0.121152 0.135116 -1.290667 0.701955 0.725705 0.318698
138 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.682462 -0.626978 -0.543542 0.682304 22.909864 0.202602 1.295714 0.214484 0.720722 0.736881 0.311244
139 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.696075 -0.466682 1.919672 -1.101722 0.045254 14.393061 0.955744 4.202137 0.719236 0.724500 0.312441
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.887210 -0.476875 -1.546238 -0.046522 3.479742 -0.836020 0.634581 -0.230249 0.737190 0.752081 0.305055
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.610236 -0.631322 -0.784304 1.043123 0.987643 -1.232520 -0.048670 -0.662604 0.743713 0.751389 0.303210
142 N13 digital_ok 100.00% 0.00% 98.76% 0.00% 2.084583 12.729184 -1.223506 11.732501 2.251117 9.286758 6.207958 6.750609 0.745726 0.053842 0.571344
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.727331 -1.010592 6.973900 -0.344794 -0.573955 1.116069 2.163728 -0.314097 0.703520 0.761849 0.317769
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.942323 -1.224724 -0.748110 4.222026 0.194825 0.462991 -0.122427 2.645777 0.751008 0.743969 0.291653
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.478898 0.859359 -0.514957 5.300403 -0.410305 13.991791 0.300790 3.871581 0.748703 0.732004 0.298205
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 12.982367 -1.431309 4.256545 0.067181 8.585899 -0.881841 6.577823 -1.964108 0.039567 0.746996 0.586520
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.911401 -1.675566 1.012349 2.187148 -0.411308 -0.266404 1.195076 1.648942 0.737153 0.748317 0.296414
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -2.296083 -0.249969 3.346133 1.595240 0.020198 1.027015 2.164535 1.089340 0.723754 0.751050 0.305450
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.985840 1.065259 -1.426978 2.379972 0.569407 -0.046710 -1.647180 0.466005 0.731277 0.741872 0.323191
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.947205 -0.068182 1.857261 1.176923 -0.609048 -1.010292 0.178339 -1.016738 0.720227 0.741544 0.327197
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 29.972631 0.987905 -0.206783 0.008300 3.250296 -0.922417 1.419704 -1.054025 0.577515 0.696661 0.305136
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.727907 1.075145 -1.536430 -1.276916 0.328341 -1.057060 -0.797689 -2.080675 0.679660 0.712377 0.326473
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 12.154908 0.011251 4.437444 -0.164030 8.632898 0.693477 6.716129 -1.821929 0.046938 0.711453 0.636732
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.292986 -1.094343 0.642902 0.283973 -0.912402 -1.130287 -1.342554 -1.449378 0.673380 0.707970 0.329954
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.263929 -0.604513 10.796102 -1.501167 8.753399 1.425027 6.724208 -0.404231 0.039175 0.710848 0.507909
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.318868 12.383858 3.712007 11.395343 -0.121042 9.262726 3.782659 6.502192 0.672634 0.041654 0.491662
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.053439 -0.250340 -0.472697 0.245188 -0.470671 1.011944 0.197608 0.159510 0.704337 0.722595 0.322169
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.912554 -0.316039 -0.664464 -1.191838 2.305164 2.555642 1.023334 5.041459 0.718673 0.733547 0.322176
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.180609 32.255797 -1.654988 -0.897763 -0.872302 4.515981 -1.245886 5.362113 0.696867 0.598937 0.291471
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.537331 -1.311056 -0.744230 -1.304644 -0.879560 1.324020 -0.055347 -0.752052 0.732944 0.744956 0.306500
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.157884 30.451465 -0.494096 -0.934094 -0.206719 1.140882 -0.214319 0.561829 0.737792 0.647652 0.273544
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.552558 -0.095075 2.830055 1.719878 1.563254 -0.720995 1.879079 0.025764 0.734952 0.749254 0.311619
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.066627 -0.528976 -0.642604 0.069144 -0.311686 0.551720 -0.332733 0.304025 0.750526 0.751008 0.298927
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.211699 -0.047639 1.500705 -0.588142 2.843288 2.138308 1.637603 -0.157390 0.742449 0.753306 0.293375
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 32.031795 0.247405 2.498673 0.174682 3.796867 0.117011 1.909306 0.668891 0.608587 0.753753 0.296299
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.530861 2.307582 0.012490 1.444420 2.178670 30.434603 1.398342 2.360662 0.743258 0.748515 0.310537
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.386717 -1.590202 -1.068230 3.980717 1.031921 -0.194931 -1.739672 3.739481 0.745632 0.740690 0.304800
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.831104 -1.199914 -0.143051 -0.981634 1.421988 0.780816 0.543799 -0.376692 0.738553 0.753337 0.307175
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.896254 2.796640 -1.466276 -1.472653 0.922788 -0.151776 -0.839541 -1.979275 0.735505 0.737205 0.309855
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 12.388003 -0.741477 11.406192 -1.599374 8.537773 6.583033 6.711920 0.243637 0.042059 0.748814 0.603379
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.595572 2.582037 -1.509492 -0.376470 -1.109810 0.659632 -1.522396 -1.483956 0.684712 0.681942 0.301253
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 13.977896 13.996280 3.966053 4.544848 8.809412 9.292980 7.462350 7.781988 0.040398 0.044624 0.001090
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 0.00% 0.00% 0.00% 0.00% -0.226188 -0.487038 0.913220 2.590722 2.233444 -0.035608 1.635498 1.510711 0.711287 0.720895 0.317036
180 N13 RF_maintenance 100.00% 0.00% 99.84% 0.00% -0.758822 13.644116 0.328132 11.895277 3.004280 9.193125 6.069806 6.838447 0.721948 0.057028 0.571176
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.436336 -0.309505 -0.599419 -0.106448 0.279560 -0.212047 -0.178444 1.434995 0.735598 0.742118 0.310500
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.064358 4.436218 -0.500553 4.173542 9.863269 3.867216 3.667951 3.596028 0.741683 0.727791 0.327441
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.471056 2.544118 0.962515 5.308406 0.878529 0.140947 1.191984 1.492470 0.728075 0.703469 0.292740
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.424007 -0.892873 -0.438589 3.722293 0.686683 -0.149180 1.121453 3.439635 0.744047 0.743156 0.289557
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 21.906645 -1.487819 8.672557 4.673447 8.082222 -0.907402 2.194912 2.473385 0.516123 0.727429 0.328722
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.585926 -1.422477 -1.651224 -0.308157 1.076450 0.020695 -0.853543 -1.959072 0.743437 0.753590 0.312313
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.083577 -0.522088 -1.246215 -0.711740 -0.146559 1.346441 -1.456654 4.600806 0.741840 0.753683 0.306556
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 9.048666 9.693249 2.738045 0.970111 2.724232 3.453955 4.317675 4.603107 0.442026 0.461842 0.158830
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.409420 -1.440610 -1.177010 0.654292 -0.306759 -0.660825 -0.333709 -1.338261 0.727770 0.740032 0.325984
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.838821 0.021071 1.070935 -1.017417 -0.732682 0.834006 4.798986 -0.179219 0.719092 0.738528 0.315654
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.447782 7.868911 5.778490 5.970483 11.323129 7.284898 5.315941 4.945170 0.663727 0.683842 0.339928
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.526320 0.613388 6.054621 2.133550 6.896548 1.409346 5.141694 0.269426 0.653120 0.710157 0.369207
194 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
200 N18 RF_maintenance 100.00% 100.00% 27.71% 0.00% 13.517100 39.499101 4.446653 0.940447 8.807283 7.060347 6.942171 4.847805 0.047699 0.287029 0.213671
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.665028 6.814055 6.034748 5.360708 6.783877 6.243788 5.293457 4.555824 0.677307 0.694190 0.338948
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 0.995081 2.525909 0.932453 -0.439499 -0.449228 -0.322898 0.337126 -0.500160 0.718546 0.696616 0.316155
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 0.00% 0.00% 0.00% 0.00% 2.219641 2.676328 0.207023 -0.935734 -0.936796 -0.532109 -0.371941 0.233005 0.717483 0.709032 0.306150
206 N19 RF_ok 100.00% 0.00% 3.73% 0.00% 1.281693 1.173509 1.351309 -0.474860 2.065517 28.809350 0.528238 38.781172 0.716906 0.689569 0.321189
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.929370 2.978759 1.723834 -1.056505 0.946064 8.079808 0.814157 -0.602449 0.702214 0.707717 0.299178
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.906554 -0.746435 0.109729 -0.049204 -1.230875 -1.040672 -0.307062 -1.640841 0.712694 0.714573 0.322348
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.168991 0.252751 -0.836785 -0.221956 -0.419036 -1.029088 -0.582461 -1.127713 0.685970 0.717915 0.329069
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.226646 0.809568 0.820110 0.239749 -0.573690 -1.371821 1.172625 -1.021690 0.713079 0.721421 0.321379
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.879469 1.148039 -1.634161 -1.341107 -1.233301 52.194022 -1.034262 5.203060 0.702686 0.691952 0.316771
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.713348 7.368979 6.227207 5.953098 6.780922 7.229272 5.488724 4.970887 0.681013 0.689345 0.335313
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.901344 2.026083 1.761266 -1.214028 4.836227 -0.868324 4.039675 -1.328186 0.593494 0.693900 0.372146
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.712608 -0.551297 1.995767 1.520022 -0.220736 -0.096853 0.361703 -0.462785 0.706243 0.710501 0.337847
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.212104 -0.427271 0.354137 -1.177635 3.018489 29.367762 -0.013200 0.547955 0.704307 0.697331 0.327374
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% nan nan inf inf nan nan nan nan nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.280530 13.746821 -0.621803 7.461926 -0.794800 9.318302 2.171226 7.396432 0.711843 0.053506 0.600850
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.997933 2.324621 1.492064 2.054534 1.073131 0.739366 0.067449 -0.649763 0.629159 0.640737 0.313345
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.094354 -1.166788 1.608036 -1.223753 0.887404 0.237119 -0.926414 3.627939 0.653074 0.653632 0.317574
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.347132 -0.541665 0.964874 -0.842557 18.804544 -0.897833 5.524880 2.657239 0.539040 0.643591 0.334710
333 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.490031 1.173123 -1.302931 -1.494050 0.373409 -0.284389 4.250064 3.032084 0.553518 0.613880 0.362461
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, 9, 10, 15, 16, 18, 19, 20, 21, 27, 28, 29, 30, 31, 32, 34, 35, 36, 42, 47, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 62, 63, 68, 71, 78, 79, 80, 81, 84, 86, 87, 92, 94, 96, 97, 98, 101, 102, 103, 104, 108, 109, 110, 111, 113, 114, 117, 119, 121, 122, 123, 128, 131, 133, 135, 136, 138, 139, 142, 143, 144, 145, 146, 151, 153, 155, 156, 158, 159, 161, 165, 166, 167, 170, 173, 174, 180, 182, 183, 185, 187, 189, 191, 192, 193, 194, 200, 201, 203, 206, 207, 213, 219, 223, 224, 225, 226, 237, 239, 240, 241, 242, 243, 320, 329, 333]

unflagged_ants: [5, 8, 17, 22, 37, 38, 40, 41, 43, 44, 45, 46, 48, 49, 53, 61, 64, 65, 66, 67, 69, 70, 72, 73, 74, 77, 82, 83, 85, 88, 89, 90, 91, 93, 95, 99, 100, 105, 106, 107, 112, 115, 116, 118, 120, 124, 125, 126, 127, 129, 130, 132, 137, 140, 141, 147, 148, 149, 150, 152, 154, 157, 160, 162, 163, 164, 168, 169, 171, 179, 181, 184, 186, 190, 202, 205, 220, 221, 222, 238, 324, 325]

golden_ants: [5, 17, 37, 38, 40, 41, 44, 45, 53, 65, 66, 67, 69, 70, 72, 83, 85, 88, 91, 93, 99, 100, 105, 106, 107, 112, 116, 118, 124, 127, 129, 130, 140, 141, 147, 148, 149, 150, 152, 154, 157, 160, 162, 163, 164, 168, 169, 171, 181, 184, 186, 190, 202]
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_2459914.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 [ ]: