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 = "2459917"
data_path = "/mnt/sn1/2459917"
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: 12-3-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/2459917/zen.2459917.25252.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 1103 ant_metrics files matching glob /mnt/sn1/2459917/zen.2459917.?????.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/2459917/zen.2459917.?????.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 2459917
Date 12-3-2022
LST Range 0.324 -- 6.259 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1103
Total Number of Antennas 200
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 3
dish_ok: 1
RF_maintenance: 50
RF_ok: 15
digital_maintenance: 3
digital_ok: 104
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 55 / 200 (27.5%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 136 / 200 (68.0%)
Redcal Done? ❌
Never Flagged Antennas 64 / 200 (32.0%)
A Priori Good Antennas Flagged 65 / 104 total a priori good antennas:
3, 7, 9, 15, 16, 17, 19, 21, 29, 30, 31, 37,
38, 42, 45, 51, 53, 54, 55, 56, 65, 68, 71,
72, 81, 86, 88, 93, 94, 99, 100, 101, 103,
106, 107, 109, 111, 118, 121, 122, 123, 128,
136, 140, 143, 146, 148, 151, 153, 158, 161,
164, 165, 169, 170, 173, 181, 182, 183, 185,
187, 189, 191, 192, 193
A Priori Bad Antennas Not Flagged 25 / 96 total a priori bad antennas:
22, 35, 43, 46, 48, 61, 62, 64, 73, 79, 89,
95, 114, 120, 125, 132, 137, 139, 179, 207,
221, 238, 324, 325, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459917.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% 9.761867 -0.338768 8.888749 0.540308 4.908259 1.461489 0.980059 4.749294 0.032116 0.710941 0.604526
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.570342 2.921222 3.026858 0.978762 24.198588 7.042698 92.430848 35.798021 0.686184 0.700600 0.471326
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.727493 0.342211 -0.004122 -0.054709 -0.206027 -0.032103 0.727297 -0.239018 0.706154 0.709693 0.469861
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.855110 -1.158227 0.950483 3.078705 -0.445641 2.898762 17.227454 17.387115 0.700408 0.695116 0.466606
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.304646 -1.365606 -0.715899 -0.068590 0.791405 0.937984 6.066587 3.969216 0.703665 0.706250 0.462119
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 3.650115 -0.906211 7.360933 0.249522 1.973953 1.042604 0.181789 -0.618547 0.532802 0.705329 0.534821
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.748700 -0.715660 -1.104489 -0.700012 0.547940 1.862709 -0.238855 2.437890 0.692257 0.697868 0.471490
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.162414 0.112092 8.832065 1.101794 4.851691 -0.403594 0.477696 3.223282 0.031765 0.715500 0.596648
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.020910 -1.005675 8.858340 0.537410 4.898832 -0.793670 0.837041 4.227956 0.031621 0.712780 0.589499
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.038670 0.666468 0.200663 0.133270 -0.114837 0.408070 14.104970 7.800489 0.710169 0.716211 0.463358
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.714837 9.987354 8.848158 0.175020 4.796351 2.454268 0.820063 18.921418 0.028714 0.493839 0.408522
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.378577 -1.457129 -0.498202 3.625256 0.511997 1.160329 3.781642 4.652006 0.705417 0.692441 0.464375
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.042219 -0.595713 3.493801 -1.286090 1.034927 2.759721 1.662985 -0.625301 0.688405 0.721886 0.472565
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.230633 -0.564128 -0.076653 4.160093 1.050068 0.571270 0.431214 -0.180863 0.690622 0.669755 0.466786
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.817672 -0.886306 0.271918 -0.118385 -0.401682 1.173832 -0.578847 -1.222489 0.668202 0.680961 0.463654
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.329667 9.977815 8.902414 9.320317 4.855513 7.493803 2.964524 1.979938 0.034199 0.037869 0.005014
28 N01 RF_maintenance 100.00% 0.00% 79.51% 0.00% 14.341068 28.339923 -1.248605 0.770587 10.877089 11.179876 6.218761 15.716233 0.384219 0.161889 0.295314
29 N01 digital_ok 100.00% 0.00% 100.00% 0.00% -1.149443 10.435071 0.173719 8.936934 1.798114 7.464142 -0.105895 0.199376 0.709076 0.034184 0.623900
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -1.248498 -0.526600 0.610809 0.417094 1.260618 -0.126901 11.955878 0.098370 0.706512 0.720304 0.454139
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.564616 -1.570803 1.000635 1.089568 0.822903 3.362874 1.595313 4.472304 0.718189 0.718132 0.459911
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.238292 26.046901 -0.315960 2.225216 -0.528146 3.170670 1.730141 6.118196 0.690210 0.603166 0.427934
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.530845 -0.746069 3.680345 0.208394 4.863247 0.927710 1.182241 -1.023631 0.041377 0.696737 0.569665
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.301477 -0.180043 0.677713 -1.511824 -0.907358 -0.553545 -0.937709 0.824659 0.675555 0.668981 0.463418
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 10.020045 8.627094 0.104709 0.305447 2.167439 3.411543 0.022164 3.874820 0.708453 0.716417 0.457597
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.303422 0.586527 -1.516561 0.654047 -0.285450 1.496872 -0.273860 8.855910 0.719585 0.725659 0.466317
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.365089 0.515752 0.075480 0.335209 2.001520 0.852350 8.754831 1.538226 0.719906 0.729292 0.467567
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.017944 -0.071652 0.000269 0.438320 0.513600 -0.320314 -0.481473 -0.128739 0.712326 0.716164 0.455755
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.322321 0.058538 -0.453960 -0.114539 0.992649 -0.630923 -0.228048 3.351068 0.715381 0.719469 0.445027
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.633646 11.038002 9.130884 9.771477 5.336255 8.010505 2.401823 3.195713 0.033008 0.030942 0.000813
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.075942 0.269848 -0.224067 0.456162 -1.097906 -0.707270 -1.330309 0.166727 0.723966 0.721722 0.458197
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.192126 -0.191593 -1.393456 -0.000269 1.900702 1.149287 -0.635527 -0.479771 0.721078 0.732086 0.453539
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.557536 3.298709 0.133044 0.410667 1.189933 3.001035 0.190353 5.283295 0.707902 0.704407 0.446878
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.444987 2.378885 1.309755 1.713074 0.367217 -0.072688 -0.379381 -2.447214 0.699393 0.731073 0.470144
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 10.838191 1.822454 3.510679 -1.352396 4.988435 -0.447728 1.358261 6.320751 0.037384 0.677843 0.545065
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.398394 0.344894 0.436950 1.471940 0.259172 -0.980913 -0.342600 -2.492916 0.673804 0.700647 0.463292
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.422785 -0.352311 -1.237741 -0.925750 -0.411798 -0.726975 0.526230 15.934837 0.623075 0.665230 0.455298
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.020800 25.265640 0.098758 1.264595 4.154665 2.207486 12.983840 24.576430 0.700172 0.641035 0.424085
51 N03 digital_ok 100.00% 100.00% 0.00% 0.00% 23.837220 1.043291 11.470378 0.267991 5.108553 0.311850 11.330586 6.075641 0.037467 0.727275 0.614724
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.845791 7.364787 -0.559962 0.423536 0.596874 0.628299 2.044266 1.892552 0.720959 0.731866 0.453563
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.955179 3.147527 -0.075587 0.111497 1.125884 -0.243179 3.901962 8.876714 0.724160 0.733983 0.456776
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.750822 10.686228 8.914263 9.537013 4.940414 7.567885 2.525167 1.188259 0.031720 0.031167 0.001242
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.497699 11.436601 0.360863 9.445150 8.794602 7.517773 3.061177 3.325837 0.714710 0.034129 0.581379
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% -0.185958 11.505966 0.251188 9.644446 1.006540 7.644308 2.031214 0.996335 0.717535 0.036049 0.599139
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 30.199136 -0.463845 5.538523 0.451979 8.580787 2.132453 4.932939 2.202888 0.498549 0.727910 0.467434
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.285658 10.408669 8.796766 9.425897 4.927291 7.582463 1.608812 0.945816 0.033747 0.033933 0.001473
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.508143 0.296151 8.851292 1.413908 5.079928 0.653607 1.093013 6.410537 0.046178 0.718985 0.594049
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.592963 10.285017 -0.407811 9.458997 -0.440932 7.537548 1.366719 2.751527 0.709247 0.069793 0.586453
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.964865 0.303181 -0.798039 -0.773130 0.004701 -1.022868 -0.406159 1.838883 0.647701 0.674675 0.440928
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.259054 0.718505 -0.942124 0.955716 -0.113815 0.848029 0.829768 -0.942511 0.644493 0.701861 0.465167
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.082289 10.639424 -0.473802 4.020266 -0.552029 7.466431 -0.395035 3.105803 0.655164 0.040024 0.529098
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.155592 0.268860 -0.920299 -0.621763 -0.745978 -0.667266 2.370018 -0.155154 0.639673 0.633440 0.445862
65 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.546306 0.592859 0.285727 0.864900 4.781333 3.163625 4.404884 2.532736 0.693969 0.720515 0.462543
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.402753 1.949280 2.201203 1.761588 0.622975 2.621157 -0.048542 1.528411 0.701497 0.722513 0.457127
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.672987 -0.538009 1.287913 1.221602 1.624423 1.818778 0.917614 1.815419 0.706117 0.725987 0.450470
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 0.912991 26.098643 0.496233 12.582223 1.297560 7.281972 2.341581 11.268680 0.715981 0.030462 0.580542
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.231346 -0.715278 0.197362 0.571971 1.596411 2.175026 -0.130374 -0.048962 0.716857 0.732440 0.445054
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.453042 -0.341514 -0.389186 -0.104816 -0.833701 -0.656330 0.973782 0.615101 0.722684 0.736615 0.444911
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.032105 -0.038504 0.456497 0.922780 -0.032457 1.246563 1.993610 1.385473 0.730055 0.736483 0.441406
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 2.123931 0.211710 0.548271 0.880489 1.808726 1.451851 8.393238 1.251086 0.715431 0.730060 0.438449
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.915281 1.137547 -1.167461 1.291281 0.414387 3.885439 -0.376622 -0.522607 0.729211 0.728557 0.450372
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.197330 1.520214 -0.165947 -0.708546 0.467605 4.982818 -1.196823 3.702655 0.723666 0.730381 0.444453
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.943371 0.047715 0.249431 -1.427535 0.023535 0.068229 6.159593 -0.498968 0.685743 0.667768 0.453718
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 34.736802 0.232902 -0.648477 0.929811 4.336243 -0.601966 1.322012 0.185464 0.453553 0.693438 0.445701
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.246324 -0.692327 -0.909877 -1.195840 -0.299397 -0.751279 1.175191 -0.395815 0.665406 0.687287 0.459163
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 8.844494 11.880352 2.373750 3.915850 6.049371 7.595779 18.256177 1.065159 0.316611 0.037923 0.225923
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -0.616295 -0.785488 -0.260341 1.359132 -0.324762 39.815999 -0.049457 0.843906 0.673321 0.696436 0.451175
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.656240 1.800685 0.128931 5.577603 -0.672051 2.043426 -0.461520 -0.332372 0.692195 0.617087 0.462001
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.336554 0.028124 -0.104408 0.136610 -0.969470 1.286108 -0.605029 0.856863 0.700787 0.718889 0.446829
84 N08 RF_maintenance 100.00% 38.26% 100.00% 0.00% 20.305682 22.594627 11.621055 12.159375 3.801205 7.284734 4.813640 6.183613 0.238379 0.033520 0.163886
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.579836 0.283619 0.862447 1.131320 -1.217774 -0.015652 -0.216177 -0.350853 0.711116 0.721019 0.441441
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.946838 0.053078 1.482435 1.393866 6.635602 -1.120244 0.188726 19.971214 0.700467 0.720944 0.434800
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.260372 7.441545 0.184664 -0.274893 2.336158 1.548793 1.339159 2.456303 0.725603 0.743139 0.434882
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.739814 0.577480 0.190770 0.680813 -0.680411 2.648132 5.387653 1.577009 0.709604 0.726946 0.427337
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.290944 0.745462 -0.045814 0.674054 0.907778 1.003354 -0.421147 -0.476467 0.718589 0.727159 0.434708
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.012629 -0.497677 0.825528 1.050144 -1.417146 -0.854878 -0.081371 5.499920 0.709936 0.721707 0.440227
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.415098 0.017116 0.210153 0.156194 -0.013974 -0.870986 0.853431 0.179688 0.705977 0.726059 0.449362
92 N10 RF_maintenance 100.00% 0.00% 29.01% 0.00% 39.849922 46.031904 0.224970 0.653312 10.367772 12.212895 0.646428 10.444700 0.292912 0.240648 0.116454
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 1.853372 0.120640 1.983552 0.279582 5.451648 -0.409544 4.700856 -0.204752 0.695205 0.721023 0.458056
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.919574 10.818106 9.057448 9.329093 4.808317 7.544885 1.145367 0.679494 0.029617 0.026117 0.001932
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.180963 -1.089231 -0.879855 0.754874 0.616433 -1.484013 0.540994 2.472858 0.668893 0.706325 0.466417
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.984501 11.513742 3.515681 4.091167 4.992225 7.731042 1.223307 0.682554 0.032814 0.037034 0.002230
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.870714 2.648081 0.019575 -0.481819 -0.504711 -0.121328 5.765005 14.714844 0.609942 0.650598 0.456738
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.294008 0.675995 -0.063339 0.086020 3.186242 3.125898 0.740935 1.781399 0.674169 0.694536 0.453247
99 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 0.546942 -0.500946 0.728802 0.325725 -0.719035 5.436364 3.016162 -0.455706 0.675029 0.708196 0.456033
100 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -1.193255 -0.785629 -0.579651 0.229508 2.128175 -0.105946 2.428890 5.749275 0.693567 0.710991 0.445243
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.702121 6.954783 -0.524865 0.938829 0.856785 -0.776799 0.740789 0.436963 0.720125 0.727359 0.440807
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.075246 0.249268 -1.527124 2.664013 0.771417 0.272609 0.343300 8.066430 0.722031 0.718097 0.435741
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.448402 5.935202 4.752893 -0.339491 3.952856 -0.016541 11.670598 12.015960 0.682877 0.733577 0.443622
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.403613 62.142814 6.165885 6.561687 -0.097166 5.486501 0.187131 2.014411 0.662182 0.704341 0.439349
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.305350 -0.046814 0.007902 0.682741 -0.410776 0.570479 -0.201267 -0.272229 0.721447 0.729694 0.424582
106 N09 digital_ok 100.00% 0.00% 0.00% 0.00% -0.200859 -0.654030 1.536823 0.871007 10.297234 1.309328 -0.138272 -0.018500 0.701475 0.720698 0.426834
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.744750 0.261515 -1.004727 -0.870344 1.674214 1.036665 5.948880 5.765622 0.718308 0.732409 0.436255
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.904690 10.643743 8.842608 -0.720409 4.918418 14.718871 2.087478 1.850224 0.036910 0.399485 0.269550
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.648673 10.352228 8.885261 9.206412 4.808686 7.478813 0.600355 1.995436 0.028739 0.033069 0.001876
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.484227 24.387651 0.083265 12.321084 -0.437788 7.198145 7.977140 5.024190 0.720457 0.031141 0.510521
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% -0.196138 10.224903 0.390837 9.302187 -0.397572 7.459237 4.464118 2.274017 0.707380 0.034328 0.519107
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.757887 1.682637 0.019418 -0.021408 0.461761 -0.004701 0.303778 -0.389480 0.697394 0.708156 0.461765
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.870216 11.560159 3.309612 3.989277 4.959450 7.658506 1.822965 0.481450 0.034027 0.030858 0.001778
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 3.359845 0.699559 -0.174731 -0.631273 0.072216 -0.578323 1.087131 0.628586 0.607069 0.685565 0.473805
115 N11 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.019481 0.012893 -0.272170 0.525646 1.269119 0.468052 0.544692 -0.016227 0.671589 0.694078 0.454501
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.757111 11.898119 8.952670 9.767505 4.961578 7.684216 1.416767 4.075190 0.027572 0.030609 0.001996
118 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 0.123587 1.662188 -0.260397 0.440354 3.247061 0.677070 2.690715 5.067239 0.692970 0.717236 0.446629
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.107543 0.997352 -1.405027 -1.576756 -0.536971 11.136546 0.062027 1.665147 0.709518 0.727087 0.448183
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.278600 3.029685 2.398968 1.984460 1.143698 0.220282 1.174800 -2.673552 0.701370 0.731366 0.429387
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.518065 4.735318 -1.466896 1.520032 -0.013118 28.256135 8.943890 19.738132 0.722858 0.733193 0.432176
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.352519 7.046424 -0.120038 0.655515 6.888793 -1.148032 0.099085 -0.680730 0.732442 0.738524 0.435987
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.141902 9.485267 0.459923 0.864348 -0.264372 1.050988 0.984175 2.758471 0.732188 0.742487 0.434996
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.813839 -0.268834 -0.199380 0.499293 0.128590 -0.493319 0.812056 0.718562 0.727651 0.737670 0.430752
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.247259 -0.754815 -0.615419 0.628345 -0.301303 1.531546 0.591256 -0.438221 0.720216 0.727524 0.434623
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 13.400024 0.319393 -1.018535 0.890078 20.753368 0.208749 27.747680 0.868382 0.674513 0.726226 0.439240
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.228176 -0.258472 0.153643 0.291746 0.009795 -0.092002 0.525790 1.225424 0.715945 0.736983 0.457437
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.115893 9.892848 8.950196 9.421393 4.960861 7.669131 0.331412 0.606362 0.029345 0.026293 0.001732
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.572340 -1.568473 -0.005280 0.269112 0.658342 0.718640 0.280902 1.367591 0.706121 0.726403 0.467382
130 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.312679 0.460045 -0.066806 0.297291 -0.336433 0.267096 0.586835 3.006237 0.691379 0.716763 0.454545
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.813186 1.384385 -1.277454 -1.595802 -0.383861 -0.053299 1.248822 -0.460250 0.638452 0.673916 0.457846
133 N11 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.917752 -0.791107 0.589681 -1.647772 10.189017 1.109592 11.031398 0.211029 0.671547 0.704909 0.476649
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 3.018925 -0.063119 5.169208 2.308392 20.745316 26.966768 0.531766 -0.092406 0.595872 0.684877 0.463639
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.058302 -0.241260 -0.213582 -1.008042 1.437315 1.075448 1.285456 1.833740 0.676447 0.706561 0.461326
138 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.429580 0.038522 -0.105287 0.840366 0.208291 0.176765 5.509817 0.545616 0.701425 0.718030 0.456356
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.519669 -0.528212 1.330777 -1.098310 -0.711444 -0.940119 -0.609171 1.244493 0.704788 0.708530 0.440383
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.182393 -0.020706 -1.151384 -0.520111 1.342321 0.248222 7.093248 3.625282 0.711321 0.736140 0.435441
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.542189 -0.547955 -0.589997 0.466546 -0.115330 -2.284248 1.305050 -1.682867 0.716196 0.737695 0.433000
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.031447 10.239410 -0.934467 9.463272 1.508135 7.524727 20.426634 1.776070 0.722023 0.042952 0.596405
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.651186 -0.967506 5.630564 -0.031681 0.886009 0.295335 -0.217307 -0.059788 0.661178 0.739992 0.465638
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.805579 -0.525835 -0.398350 2.797054 3.382276 -0.234258 -0.553422 -0.390431 0.725619 0.724585 0.440093
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.157591 0.786146 -0.290673 4.992481 2.490080 25.382843 0.134419 0.590497 0.719796 0.688448 0.456021
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 11.093492 -1.485145 3.323389 -0.296812 4.834612 -0.820726 0.257491 -1.180955 0.035959 0.725867 0.597473
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.685487 -1.768477 1.059820 2.100435 2.199205 -1.071286 -0.282331 -0.045469 0.704560 0.722156 0.452529
148 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 9.619819 -0.457174 8.771337 1.614244 4.797463 -0.329703 0.281202 -0.528328 0.031194 0.727392 0.569681
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.636266 1.115997 -1.427958 1.572897 0.217554 0.680022 1.867901 -1.004409 0.706241 0.728821 0.467001
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.110031 0.158116 1.290888 0.593946 -1.330039 -0.781220 -1.056525 0.492089 0.703948 0.723414 0.475468
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 29.453603 0.447100 -0.292279 0.159352 6.075082 0.919738 3.408948 -0.320513 0.535999 0.657889 0.450115
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.496275 0.809670 -1.509766 -1.433821 -0.779062 -1.292767 3.465626 0.546919 0.647271 0.681303 0.479632
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 10.294691 -0.397787 3.463952 -0.584393 4.913369 4.441557 1.070691 1.713259 0.039785 0.679911 0.614069
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.203141 -1.336621 0.285300 -0.185545 -0.933207 -1.941173 -0.372870 -0.735140 0.639887 0.674968 0.488793
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.435565 -0.072040 8.590643 -0.872488 4.769562 6.717815 0.745819 1.039783 0.033742 0.702039 0.545786
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.426591 9.918439 3.461605 9.191801 -0.056838 7.467446 0.930097 0.502180 0.644083 0.037394 0.522523
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.050159 -0.291454 -0.218172 0.566398 0.349984 0.459147 -0.346348 -0.088292 0.688094 0.705262 0.458747
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.394698 -0.109255 -0.524747 -0.692767 0.528339 -0.268691 7.761794 21.589919 0.702041 0.717776 0.461753
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.025765 4.154116 -1.593826 -1.360417 -0.384264 8.183578 -0.058285 70.142050 0.674196 0.684386 0.442081
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.399922 -1.132038 -0.429466 -0.771503 0.449018 -0.256806 0.988383 1.859091 0.710130 0.724372 0.439419
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.019453 27.893115 -0.269166 -0.785795 0.524392 0.480351 -0.330040 0.899145 0.712188 0.595582 0.387921
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.965931 0.000759 2.075459 1.067876 1.049014 -0.214005 -0.282536 -1.478615 0.726915 0.740667 0.428929
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.261662 -0.647121 -0.358536 0.294598 -0.191067 1.786867 -0.027858 2.153503 0.729533 0.731128 0.442429
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -1.014847 0.002581 1.185985 -0.203184 7.732893 0.093853 0.916534 1.144211 0.719530 0.735765 0.433869
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 33.767657 -0.030240 1.969225 0.443176 2.152464 0.022336 3.911535 -0.198717 0.552395 0.730744 0.437430
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.132662 -0.253080 0.104559 3.036263 0.591083 25.736325 6.864522 3.290014 0.721590 0.712415 0.449056
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.000759 -1.730511 -1.204047 3.541469 0.409177 0.625922 -0.695246 3.658322 0.725250 0.713148 0.466219
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.105731 -0.765847 0.003967 -0.438026 -0.695287 0.069376 -0.052295 2.711744 0.709952 0.732356 0.467960
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.478548 3.601965 -1.003326 -1.527914 -0.547809 3.115056 -0.635796 13.615970 0.709942 0.714615 0.467638
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.538512 -0.604759 9.074614 -0.933032 4.974955 1.024259 1.040885 1.206179 0.035967 0.725822 0.602654
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.369802 2.174399 -1.451371 -0.079164 -0.430052 -0.668959 -0.185879 0.982315 0.653931 0.636175 0.455549
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 12.058191 11.358609 3.089734 3.672368 4.852841 7.470697 3.538843 7.335475 0.037863 0.041429 0.000604
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.190687 -0.600462 1.708126 2.175004 -1.117738 -1.864927 0.016227 0.684619 0.684094 0.700351 0.458056
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.594338 11.087423 0.421728 9.590310 1.367936 7.611450 29.551399 2.646791 0.705513 0.049687 0.602639
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.563025 -0.525502 -0.295135 0.271484 2.062445 2.068011 -0.383144 6.640846 0.719292 0.725767 0.446347
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.213456 4.478440 -0.704045 3.078473 -0.141485 2.938091 17.860467 -1.590608 0.725581 0.724788 0.447400
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.702404 1.874083 0.935707 4.488952 0.277422 -1.124794 0.856974 -0.359515 0.706340 0.674495 0.432513
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.144137 -0.955154 -0.195094 3.328719 0.710443 0.662884 0.819948 0.114155 0.714940 0.713204 0.442680
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 20.254235 -1.342785 6.968899 3.984585 3.476573 -1.188496 0.295171 0.469144 0.414076 0.699839 0.463706
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.417250 -0.748124 -1.594490 -0.674928 -0.210414 -1.406344 1.664428 -1.343827 0.725313 0.740365 0.458884
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.264657 -0.122672 -1.481530 -0.850515 0.650120 -0.625959 2.031499 12.359754 0.718834 0.736080 0.452237
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 9.831953 10.346441 1.746030 0.412383 5.493502 17.416668 2.533689 1.943899 0.368108 0.401549 0.211623
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.408382 -1.404276 -0.747735 0.091416 0.270018 -0.073134 -0.241130 -1.614074 0.703438 0.726655 0.483986
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.769474 -0.028742 1.000104 -0.478852 1.387028 -0.674146 18.759415 3.763790 0.688928 0.715690 0.485099
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.108725 7.423807 4.548153 4.587965 3.713390 6.588540 -4.157125 -4.625697 0.654849 0.675743 0.474044
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.944097 0.112835 4.769569 1.329199 3.711743 -0.279104 -4.376543 0.141692 0.643353 0.689757 0.500899
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% 39.26% 0.00% 11.544415 36.669322 3.475234 0.644051 4.801041 9.635322 1.887116 -0.436189 0.045814 0.225663 0.163290
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.990566 6.137950 4.771470 4.078309 3.897453 5.017317 -4.219366 -3.397537 0.677721 0.691940 0.441191
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 0.552552 2.015436 0.591211 -0.183289 -0.445602 0.566687 0.621631 1.808808 0.703080 0.667712 0.449168
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.090228 12.387650 3.255574 3.772279 4.911516 7.498583 2.851938 3.287789 0.033111 0.041428 0.001891
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.182182 2.349422 -0.082287 -0.555384 -0.686629 1.031779 -0.740715 9.049861 0.700035 0.684543 0.448071
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.995348 0.846327 0.882153 -1.043486 5.531154 -1.377581 0.357806 6.317605 0.695909 0.687032 0.449412
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.099986 3.194821 1.206327 -1.553673 -0.147677 0.889558 -0.664362 0.025807 0.679417 0.673937 0.433602
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% 0.00% 0.00% 0.00% 7.396334 4.682819 4.905083 3.262606 3.967118 3.137564 -4.547099 -2.784929 0.673197 0.699471 0.465601
220 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.050147 -0.661409 -0.169875 -0.408990 -1.162518 -0.104565 6.253560 1.694711 0.695106 0.695203 0.452232
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 2.086739 -0.201958 -0.649128 -0.557120 0.487611 -0.907228 2.317611 -0.044547 0.661322 0.702168 0.464454
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.809804 1.184124 0.406317 -1.029504 -0.569578 5.754712 7.729886 2.873667 0.697505 0.684256 0.457273
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.746514 2.251161 -1.569695 -0.076843 0.189033 -0.045131 0.729555 40.812017 0.682375 0.663204 0.453255
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.361128 6.898187 4.913944 4.570493 4.068221 6.552002 -4.431790 -4.523409 0.679943 0.686699 0.456317
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.228119 1.816527 1.259028 -1.355410 0.723216 0.102698 6.212858 1.775901 0.567137 0.678083 0.497147
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.007388 -1.025880 0.982114 0.493969 -0.922329 -0.454306 -1.395142 -1.295511 0.697138 0.697515 0.467677
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.449336 -0.187179 -0.127848 0.552599 -0.891782 -0.981674 1.502735 7.578270 0.688577 0.696772 0.459294
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.102394 11.148973 -0.403002 6.024520 0.297851 7.508011 11.755487 3.425075 0.686489 0.046193 0.601389
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.841303 2.007299 1.023511 1.343993 0.190227 -1.081702 1.855973 -0.381907 0.574656 0.591081 0.451024
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% -0.193072 -1.368655 1.109511 -1.425843 -1.158712 1.255497 -1.630090 0.344164 0.615829 0.611398 0.470078
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.297274 -0.463009 -1.050240 -1.093012 0.033940 1.110088 7.969694 1.376393 0.555262 0.593935 0.455054
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.962744 0.680461 -0.917963 -1.593953 0.106936 2.067873 1.184010 0.994774 0.535932 0.583828 0.457066
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, 16, 17, 18, 19, 21, 27, 28, 29, 30, 31, 32, 34, 36, 37, 38, 42, 45, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 65, 68, 71, 72, 74, 77, 78, 80, 81, 82, 84, 86, 87, 88, 90, 92, 93, 94, 96, 97, 99, 100, 101, 102, 103, 104, 106, 107, 108, 109, 110, 111, 113, 115, 117, 118, 119, 121, 122, 123, 126, 128, 131, 133, 135, 136, 138, 140, 142, 143, 145, 146, 148, 151, 153, 155, 156, 158, 159, 161, 164, 165, 166, 169, 170, 173, 174, 180, 181, 182, 183, 185, 187, 189, 191, 192, 193, 194, 200, 201, 203, 205, 206, 213, 219, 220, 222, 223, 224, 225, 226, 237, 239, 240, 241, 242, 243, 320, 329]

unflagged_ants: [5, 10, 20, 22, 35, 40, 41, 43, 44, 46, 48, 61, 62, 64, 66, 67, 69, 70, 73, 79, 83, 85, 89, 91, 95, 98, 105, 112, 114, 116, 120, 124, 125, 127, 129, 130, 132, 137, 139, 141, 144, 147, 149, 150, 152, 154, 157, 160, 162, 163, 167, 168, 171, 179, 184, 186, 190, 202, 207, 221, 238, 324, 325, 333]

golden_ants: [5, 10, 20, 40, 41, 44, 66, 67, 69, 70, 83, 85, 91, 98, 105, 112, 116, 124, 127, 129, 130, 141, 144, 147, 149, 150, 152, 154, 157, 160, 162, 163, 167, 168, 171, 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_2459917.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 [ ]: