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 = "2459858"
data_path = "/mnt/sn1/2459858"
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: 10-5-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/2459858/zen.2459858.25291.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 1862 ant_metrics files matching glob /mnt/sn1/2459858/zen.2459858.?????.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.')
Found 187 ant_metrics files matching glob /mnt/sn1/2459858/zen.2459858.?????.sum.known_good.omni.calfits

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 2459858
Date 10-5-2022
LST Range 20.457 -- 6.478 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1862
Total Number of Antennas 180
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 3
dish_ok: 1
RF_maintenance: 35
RF_ok: 9
digital_maintenance: 11
digital_ok: 98
not_connected: 23
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 180 (0.0%)
Antennas in Commanded State (observed) 0 / 180 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 16
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 55 / 180 (30.6%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 116 / 180 (64.4%)
Redcal Done? ✅
Redcal Flagged Antennas 6 / 180 (3.3%)
Never Flagged Antennas 57 / 180 (31.7%)
A Priori Good Antennas Flagged 64 / 98 total a priori good antennas:
7, 19, 21, 30, 31, 37, 38, 45, 46, 51, 53,
54, 55, 56, 65, 66, 67, 68, 71, 72, 73, 81,
84, 86, 93, 94, 98, 99, 101, 103, 105, 107,
108, 109, 111, 116, 117, 118, 121, 122, 123,
140, 142, 144, 147, 156, 158, 161, 162, 163,
164, 167, 169, 170, 176, 178, 179, 183, 184,
186, 187, 189, 190, 191
A Priori Bad Antennas Not Flagged 23 / 82 total a priori bad antennas:
4, 8, 48, 49, 64, 82, 89, 90, 125, 136, 148,
154, 168, 171, 202, 220, 221, 237, 238, 321,
322, 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_2459858.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 Flag Fraction Before Redcal Flagged By Redcal chi^2 Fraction 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 Median chi^2 Per Antenna (Jee) Median chi^2 Per Antenna (Jnn)
3 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 3.719635 -0.254575 -0.439565 0.227771 -0.963429 1.721723 -0.068326 3.413082 0.713917 0.683006 0.423624 1.941594 1.490051
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.487318 3.325154 1.037657 0.841247 -0.058858 1.220900 2.829282 0.073583 0.729387 0.674928 0.426301 3.668098 2.896336
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.389063 -0.261407 0.341375 -0.545381 0.381150 0.802511 0.682540 0.402376 0.733120 0.685613 0.420763 1.843618 1.526390
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.854889 -0.576090 0.609411 0.480509 -0.465538 1.129557 0.809290 14.535296 0.727004 0.681999 0.423264 2.736710 2.592722
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.086612 2.585984 2.290070 2.082399 -0.068942 0.078448 -1.325751 -3.890637 0.723976 0.664849 0.421667 2.805129 2.406199
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.165465 -1.009833 0.622063 0.298861 1.413835 1.593400 -0.471108 1.103215 0.720656 0.677730 0.425783 1.673922 1.429337
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 2.945252 0.254012 1.202960 0.448469 0.494772 -1.014940 -2.238617 -2.694415 0.714236 0.675890 0.432669 1.631334 1.385217
15 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.935944 0.052219 -0.812904 -0.047595 1.043834 0.970910 0.015976 3.643077 0.739036 0.690412 0.420474 2.053500 1.593515
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.965019 -0.472015 0.903029 0.906812 -0.564630 -0.514551 0.727568 2.805525 0.737792 0.684411 0.420192 1.881635 1.539139
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -1.358319 0.241680 0.460526 0.453281 -0.251162 0.687141 2.789780 0.862824 0.728752 0.692144 0.412051 1.784031 1.551025
18 N01 RF_maintenance 100.00% 0.00% 22.02% 0.00% 100.00% 0.00% 4.321906 10.948475 -0.070751 0.094799 0.805586 2.623595 15.259946 31.051255 0.711721 0.458542 0.470851 2.314353 1.576559
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.188428 -1.732696 0.555227 -0.148892 -0.582671 0.402604 13.136635 13.534581 0.726781 0.692722 0.419251 2.428685 2.385784
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.566152 1.893639 -2.809494 1.696538 0.458402 -0.368847 1.364018 -3.793023 0.741022 0.673202 0.428872 1.569792 1.491519
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.061099 -0.565457 -0.608244 -0.837068 -0.015528 0.312250 1.325271 6.055502 0.723605 0.681937 0.423696 3.460428 2.972450
22 N06 not_connected 100.00% 27.87% 0.00% 0.00% 100.00% 0.00% 29.943399 9.259628 -1.162892 -2.175144 10.770103 6.794263 17.936014 7.309993 0.470091 0.625686 0.357843 1.925440 2.631848
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.050477 11.343802 9.197338 9.833530 2.312605 2.962749 3.052500 1.855558 0.032632 0.036932 0.002524 1.169155 1.168722
28 N01 RF_maintenance 100.00% 50.97% 100.00% 0.00% 100.00% 0.00% 14.494409 27.982124 -0.058225 -0.124579 5.303204 5.146940 8.330612 21.245742 0.370280 0.159611 0.237112 4.091739 1.657341
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -1.321510 -0.155497 0.241281 0.329635 0.099417 0.904525 -0.242836 2.540866 0.735170 0.691295 0.407322 1.708673 1.504901
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.686766 -1.051241 0.764606 0.825849 -0.485394 1.037251 15.955391 0.306754 0.728503 0.694557 0.406386 2.622814 2.493992
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.229358 -1.091442 -0.148384 -0.088406 1.618387 6.835389 1.195618 2.837060 0.748678 0.700041 0.418881 2.700749 2.400283
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 7.004310 24.927127 -0.365296 -1.056592 10.033026 -0.455477 3.812394 1.792792 0.673077 0.611460 0.303078 2.851054 2.898047
33 N02 RF_maintenance 100.00% 0.00% 10.74% 0.00% 100.00% 0.00% 0.046490 13.332841 0.307087 0.984645 0.787502 1.325477 1.903917 31.965259 0.725481 0.496180 0.499632 3.120057 1.640442
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 11.729288 0.814840 3.372854 -2.894663 2.287258 8.237116 1.007570 1.526418 0.041554 0.659713 0.547327 1.241931 2.881606
35 N06 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.852818 -0.157712 -0.411706 -2.449081 -1.694317 -2.013424 5.574541 -0.092626 0.640838 0.650518 0.443606 2.447880 2.601719
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 8.930102 6.467447 0.565062 0.258802 1.083081 1.116100 0.046378 0.401780 0.734552 0.687790 0.423915 3.141789 2.594408
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.099815 0.214855 0.466834 0.989220 0.543723 1.258885 -0.129116 11.241277 0.736653 0.698919 0.423825 2.799463 2.492043
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.067259 0.137078 0.494715 0.959646 2.413804 4.451760 7.613386 2.105309 0.741956 0.703185 0.422425 2.652462 2.451623
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.153088 -0.022374 0.418368 0.888544 1.853861 0.881101 -0.341634 -0.324394 0.732878 0.692718 0.412934 1.854700 1.545778
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.002042 -0.879352 -1.054403 -0.414307 0.066166 1.021954 -0.492923 -0.405507 0.742473 0.698360 0.407511 2.011771 1.612442
42 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.058323 2.288173 -0.339996 0.517711 -0.136542 0.311442 0.218912 -0.468333 0.747654 0.692325 0.418260 1.804963 1.582007
43 N05 digital_maintenance 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 9.329167 2.289849 9.087143 0.005777 2.268161 0.167157 1.727083 0.973416 0.040480 0.699073 0.506725 1.144375 2.594569
44 N05 digital_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 4.179344 2.577609 0.629934 0.607094 2.762822 0.655986 21.527566 6.104642 0.718349 0.694006 0.396731 2.729817 2.539803
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.548724 -0.029735 0.521300 0.859047 1.894087 -1.038233 -0.148954 22.414157 0.736223 0.687931 0.409777 2.745878 2.301430
46 N05 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -0.845228 11.904860 -0.371043 9.885481 1.147652 2.842872 0.358188 2.986148 0.732379 0.036804 0.562669 2.857332 1.144282
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 10.940333 0.603875 3.179017 -2.931404 2.322565 5.104108 0.900495 2.798109 0.038242 0.665248 0.551873 1.184592 2.652424
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.042627 3.468368 2.634102 2.294387 0.585636 -0.285007 -4.229243 -4.508992 0.705039 0.668723 0.434660 2.834957 2.638903
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.466857 3.680357 2.462052 2.458225 0.589682 0.715516 -3.769445 -4.283849 0.697962 0.653441 0.430545 2.862291 2.548459
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.921084 21.691361 0.624190 -0.073297 2.880325 3.039599 6.520178 63.025744 0.727065 0.605653 0.399043 3.100807 2.387607
51 N03 digital_ok 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 24.986796 1.610375 12.098306 1.331501 2.082366 -0.742498 11.117124 6.394250 0.038538 0.697580 0.502620 1.117430 2.295334
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 7.564190 6.795009 -0.266172 0.050735 5.926776 1.620438 1.175784 -0.093370 0.745278 0.709290 0.411507 2.791972 2.536747
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.165729 2.340693 -0.603036 -0.336907 0.827632 0.617502 3.292689 6.614116 0.748958 0.714253 0.415188 2.970917 2.550293
54 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 10.039540 3.680508 9.194221 0.356749 2.311183 1.935683 2.350213 11.727015 0.045894 0.686008 0.527686 1.333557 2.395997
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 0.726672 12.596434 0.503416 9.987695 6.613247 2.922503 3.157582 0.908921 0.730570 0.033654 0.533395 3.030002 1.138351
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.292531 0.284510 -0.180658 -0.537103 1.455341 3.506734 0.444447 4.706697 0.741582 0.709324 0.393915 4.030437 2.680456
57 N04 RF_maintenance 100.00% 0.54% 0.00% 0.00% 100.00% 0.00% 31.781350 1.009930 3.352906 0.145418 0.348913 1.405336 3.990292 0.569668 0.583520 0.705890 0.383928 3.792097 2.454487
58 N05 digital_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 9.556783 11.884321 9.144094 10.026078 2.366092 3.050427 3.067003 2.530397 0.035545 0.033150 0.001590 1.127509 1.123357
59 N05 digital_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 27.201683 1.551202 -0.791642 0.865188 0.291481 2.403911 3.708576 5.056602 0.654747 0.694519 0.395118 2.483735 2.420656
60 N05 digital_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.550244 11.608508 9.178806 10.007035 2.286661 2.958161 1.934819 2.878506 0.026612 0.026723 0.000699 1.129492 1.124510
61 N06 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 2.373879 2.284263 -1.884060 -1.070354 6.897919 -2.117400 0.449537 3.540206 0.686342 0.643752 0.408803 2.807099 2.468817
62 N06 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.494685 4.107617 2.536677 2.433311 0.426840 1.001561 -3.745448 -4.409988 0.716833 0.672708 0.425696 2.911843 2.589395
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 2.048162 11.937881 -1.135942 3.948177 -0.955461 2.918100 -0.123324 2.998123 0.679746 0.044176 0.607104 2.736541 1.183890
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.350673 -0.432130 -2.507136 -1.071764 -1.521199 -2.411546 0.604692 -1.755261 0.668146 0.647311 0.439767 2.807593 2.560900
65 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 6.950634 5.785288 -0.688175 -0.106757 2.345662 1.669624 4.156878 0.165506 0.676534 0.645431 0.405615 3.090538 2.674973
66 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 6.335546 5.576407 1.102822 0.856391 0.191036 1.960810 -0.161652 1.312138 0.679609 0.650689 0.398253 2.781927 2.413641
67 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 5.531508 5.926758 1.039636 0.980895 1.935730 1.269581 0.871852 2.999110 0.681053 0.655755 0.393615 2.586962 2.395086
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 1.408014 27.929527 0.959302 13.506475 1.274608 2.636721 0.621964 11.156998 0.734902 0.030071 0.508947 2.869991 1.115196
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.136279 -0.587709 -0.230232 1.003974 2.443396 0.739528 -0.152178 0.797602 0.739403 0.708799 0.404188 1.537437 1.343313
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.002042 -0.551861 -2.607157 0.347352 -0.457429 0.044063 -0.461110 -0.002162 0.751155 0.714890 0.403900 2.893127 2.435051
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 5.347753 -0.809368 3.274839 0.654002 4.660237 1.929175 0.246911 0.392637 0.741327 0.712702 0.400034 3.354470 2.666237
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 2.659017 0.137409 0.077333 -0.216021 1.823888 2.977129 7.342142 -0.335564 0.736587 0.708185 0.390652 3.323830 2.610527
73 N05 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 9.267143 11.129677 9.036396 9.722874 2.199134 2.821653 3.176917 0.760941 0.026588 0.026688 0.000515 1.129246 1.127130
74 N05 digital_maintenance 100.00% 100.00% 72.77% 0.00% 100.00% 0.00% 10.329840 9.580436 9.442476 9.627222 2.578685 2.623550 2.648771 24.995522 0.030772 0.324974 0.208358 1.140006 1.297632
75 N05 digital_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 5.351118 12.142110 4.203990 10.100037 2.296421 3.149960 18.185435 3.222800 0.688189 0.043746 0.524270 2.471111 1.190067
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 18.127431 20.234170 -0.602161 -1.804118 0.697327 0.031500 13.060809 7.469874 0.615646 0.542600 0.266655 2.870308 2.249178
78 N06 not_connected 100.00% 13.43% 0.00% 0.00% 100.00% 0.00% 31.701631 -1.254080 -1.528550 -1.549288 0.705898 -1.394642 -0.592421 -0.520262 0.520899 0.661790 0.387184 2.597246 2.345898
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.085037 -0.533852 0.795013 1.872873 -1.026380 14.577222 -0.360757 0.009736 0.696349 0.651451 0.420055 3.036206 2.640456
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.335467 0.279527 -1.244127 0.775532 0.441214 -0.345718 -0.121224 -0.646030 0.722534 0.685696 0.419016 2.891615 2.511030
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.010304 -0.038862 -1.523774 -0.238943 -0.560938 1.504731 -0.736468 0.002324 0.732208 0.697964 0.413100 1.354478 1.348888
84 N08 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 7.095084 24.511368 0.256342 13.027577 0.262563 2.657321 -0.484317 5.994692 0.737983 0.039448 0.622490 2.695855 1.124979
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.147057 -0.015975 -0.430930 -0.029585 0.419083 0.168323 -0.641992 -0.666441 0.736035 0.703385 0.412889 1.471975 1.378560
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.648404 6.267655 -0.100187 0.895415 7.107370 -0.954118 1.123724 20.294817 0.734156 0.663911 0.408565 2.800812 2.239103
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 9.391461 7.332932 -1.979307 0.794691 16.004693 2.499699 29.864689 1.706819 0.682815 0.722182 0.392158 3.297321 2.661335
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.153950 1.349105 -0.783965 -0.366375 -0.225554 3.721898 3.487639 0.905220 0.737114 0.709527 0.394159 1.778246 1.484252
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.109069 0.995583 -1.308015 -0.543264 1.634352 1.386924 -0.712095 -0.647031 0.746256 0.710150 0.398254 3.371354 2.741658
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.302006 -0.629557 0.340009 1.116175 -0.774270 0.162428 0.165707 2.564068 0.734849 0.692598 0.399749 2.933265 2.604404
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.116718 0.291571 -1.145707 -1.097550 0.854225 1.357409 2.130295 1.393325 0.739612 0.709903 0.412217 1.459068 1.366438
92 N10 RF_maintenance 100.00% 77.60% 89.42% 0.00% 100.00% 0.00% 38.759844 48.149231 -1.041529 -0.513744 2.842839 5.586568 0.507899 10.204979 0.310137 0.252673 0.116795 2.119227 1.658955
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.913631 0.190644 1.216201 0.636181 3.441761 -0.290103 6.302143 -0.631934 0.726501 0.693495 0.417522 3.318778 2.668871
94 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.812607 -1.348273 0.085758 0.614650 1.363026 1.857272 4.691926 5.651535 0.727987 0.684091 0.424460 3.168297 2.562517
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 1.60% -1.054735 0.943391 0.091006 0.730048 0.397493 -0.156854 0.316843 1.746047 0.689452 0.660320 0.422115 1.487825 1.472001
99 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.344982 -0.146734 -0.174593 -0.268796 -0.779747 5.174788 1.614080 -0.670311 0.706058 0.684124 0.422528 2.708188 2.800824
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.952809 -0.958649 0.278737 1.318955 -0.069633 -0.337753 0.256482 -0.338899 0.715452 0.680635 0.413534 1.446605 1.415493
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 7.793964 7.699969 -1.957955 -0.294538 1.063606 0.168103 0.049579 -0.400663 0.744477 0.704279 0.408229 2.773409 2.637838
102 N08 RF_maintenance 100.00% 49.14% 100.00% 0.00% 100.00% 0.00% 8.538512 12.072308 8.227581 9.445779 2.861879 3.097299 0.529803 4.687222 0.389992 0.040558 0.322154 1.436293 1.215315
103 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 23.599852 24.865620 10.633582 11.415086 2.668837 3.451805 10.896031 9.868984 0.026618 0.027080 0.001205 1.127047 1.125543
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 7.474226 57.440862 -0.364094 8.635764 2.236486 2.958016 -0.284639 0.087987 0.748257 0.657151 0.438599 2.902733 2.208696
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 16.04% 0.281436 0.425197 -0.409356 -0.507388 -0.477313 1.221946 -0.004903 -0.531388 0.742506 0.710993 0.396115 1.995263 1.832073
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.062956 0.694042 -0.208994 -0.113092 3.890060 2.959829 0.456107 0.500852 0.736894 0.704335 0.397453 1.707951 1.577145
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 4.28% 2.004747 0.383807 0.613715 0.679049 -0.543284 -0.036901 1.384107 2.914986 0.722778 0.699008 0.397011 1.706435 1.662920
108 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 2.720492 3.891881 6.638001 -0.262327 4.359394 0.288182 0.988643 2.197022 0.623958 0.707315 0.453528 2.018798 3.035528
109 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -0.939234 11.735119 0.096041 9.714299 0.892694 2.870088 3.096850 1.947421 0.738618 0.034807 0.519841 3.420837 1.208875
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 10.544367 26.493348 -0.853103 13.188700 11.819864 2.673238 20.830722 5.179574 0.688724 0.031094 0.447375 4.863246 1.185905
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -0.175224 11.666289 0.711541 9.826431 0.975562 2.843298 0.412775 2.638198 0.731644 0.034372 0.519437 3.474801 1.191291
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -1.069773 -0.708156 0.394344 0.319586 0.364340 -0.661841 1.248753 -0.530637 0.721000 0.685721 0.428669 1.510529 1.354146
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 4.81% -1.136813 0.033578 -0.402311 -0.745426 1.704737 -0.733699 1.377427 -0.412186 0.696178 0.671286 0.426912 1.502209 1.457704
117 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 11.094904 13.405770 9.208651 10.313617 2.424045 3.065838 1.608488 4.098259 0.027604 0.031322 0.003085 1.203227 1.197380
118 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.141244 0.580683 -0.396746 0.400681 1.588619 5.710280 0.298770 0.907805 0.722108 0.692386 0.416567 3.198913 2.738020
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.276013 0.852500 -2.232032 2.259218 -0.296096 20.516570 -0.355353 2.898225 0.734321 0.665623 0.419839 2.727349 2.308539
120 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 2.453233 24.235288 -0.338567 12.954526 1.694763 2.924284 1.367030 10.540535 0.738383 0.035129 0.631586 2.796023 1.131404
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.600524 5.401663 -0.730936 -0.285397 0.520364 1.797315 43.451145 16.912249 0.747023 0.711596 0.412369 3.379522 2.680578
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 8.071563 7.054230 0.536411 1.160621 3.111423 0.274667 -0.177360 -0.673496 0.748371 0.711102 0.408478 3.180090 2.679433
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 7.017819 9.328882 -0.922921 0.604284 0.260216 2.102357 -0.559980 -0.263395 0.753619 0.719206 0.405398 3.040446 2.773064
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.589978 0.453590 -0.737321 0.218667 1.083167 0.460961 0.623461 0.883217 0.749839 0.716275 0.404363 1.712033 1.486092
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.090528 -0.712985 0.225730 -0.576238 -0.315043 1.895045 -0.477515 -0.622984 0.728962 0.708782 0.404107 3.374343 3.105136
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 15.796069 0.742564 -1.369776 0.393582 9.374498 -0.560503 15.131356 -0.524811 0.673121 0.701604 0.406385 3.166336 2.948059
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.701161 -0.155088 1.095020 0.540267 -0.238917 0.587644 -0.034662 2.815255 0.735810 0.708128 0.411772 1.581890 1.526349
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.647063 3.719527 -0.000856 -0.205097 1.312169 -0.929230 -0.328060 -0.485992 0.741453 0.695418 0.411267 1.639508 1.570908
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.451966 -1.291348 -0.423979 -0.202286 1.014836 1.509522 0.171591 -0.330336 0.731286 0.700097 0.422290 1.971000 1.498663
130 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 1.062578 0.169952 0.221224 0.703480 0.900159 0.265882 0.093768 2.753392 0.715867 0.687354 0.420869 1.667677 1.436740
135 N12 digital_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -1.035046 11.782717 -0.286811 10.051433 -0.226580 3.114872 -0.096645 1.197003 0.700151 0.039294 0.508052 3.542560 1.311305
136 N12 digital_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.806987 0.346233 -0.308136 -0.456470 -0.187891 3.555760 0.002162 0.421551 0.693076 0.669149 0.422265 3.163181 2.830916
137 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.219858 -0.856187 -0.287056 0.185726 0.211973 6.754175 0.648974 0.273143 0.703861 0.671575 0.419981 3.028944 2.665353
138 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.361633 0.099512 1.189668 1.313844 -0.032876 1.454798 5.483074 -0.419751 0.720021 0.685983 0.423299 2.937621 2.626855
140 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 2.831650 12.573506 2.315003 9.919316 -0.065695 2.814059 -2.416120 2.984079 0.731556 0.052500 0.529640 2.794995 2.025535
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -1.017400 3.376123 -2.068783 2.564131 0.190097 0.700836 -0.234917 -4.611331 0.743066 0.683105 0.408151 1.557665 1.418682
142 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 0.669377 11.680173 -1.000672 9.985336 0.995559 2.980408 1.468098 1.838778 0.738191 0.048584 0.539867 3.036328 1.870758
143 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.744019 -0.633128 0.500722 0.424683 -0.253101 -0.549191 -0.288926 -0.633606 0.725083 0.702896 0.397724 1.807221 1.471670
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.573479 -0.499763 -0.631843 -2.274005 10.401640 -0.772883 0.449939 18.898239 0.735582 0.707622 0.403157 3.358406 3.114804
145 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.539761 12.063600 9.264320 10.032058 2.350958 2.993512 2.092090 3.714580 0.034377 0.027749 0.004199 1.219724 1.216986
147 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.630493 -1.171508 -0.870243 0.066697 4.037309 0.942951 19.338133 -0.408191 0.725459 0.702130 0.407232 3.420341 2.926276
148 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.549559 0.120145 0.289377 0.811085 -0.064193 -0.139702 1.469348 0.592666 0.735139 0.701115 0.414454 3.758491 2.999466
149 N15 RF_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% 1.511553 12.445101 0.884864 10.000358 -0.188241 3.001465 0.873788 2.532462 0.724905 0.033281 0.558257 4.439486 1.220769
150 N15 RF_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.769303 11.790279 9.190506 9.973835 2.275862 2.987025 2.716679 2.667099 0.026167 0.028252 0.000611 1.163654 1.161475
151 N16 not_connected 100.00% 5.91% 0.00% 0.00% 100.00% 0.00% 25.707814 -0.163112 -1.661940 -0.932941 2.045383 -2.056359 4.516063 -0.353517 0.586825 0.637390 0.414860 2.286584 2.241503
152 N16 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.177396 -0.280068 -2.944492 -2.703213 -1.011706 -1.431999 16.086280 -0.431565 0.680934 0.659819 0.448044 2.431255 2.364868
153 N16 not_connected 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 10.475126 -0.402157 3.117516 -2.937149 2.368111 9.310174 1.041268 -0.473250 0.040153 0.649767 0.553130 1.205379 2.354466
154 N16 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.153940 -1.228457 -0.774832 -1.420858 -0.699684 -1.672101 -1.557198 -1.510296 0.681148 0.652783 0.455572 2.614290 2.558429
155 N12 digital_maintenance 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 9.975350 -0.234805 8.857342 -0.124762 2.169611 4.014038 0.663554 2.721115 0.058127 0.669506 0.497548 1.238807 3.061751
156 N12 digital_ok 100.00% 65.79% 0.00% 0.00% 100.00% 0.00% 7.802259 0.143244 8.787571 -0.582996 1.539962 0.175862 1.238966 0.019039 0.313697 0.677310 0.472558 1.573493 3.440576
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 0.602600 -0.241300 -1.033755 -0.567130 0.165175 0.728280 -0.278690 -0.074282 0.718620 0.682849 0.424000 1.622290 1.413260
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.193926 -0.714985 -2.657474 -0.715508 -0.059299 -0.442814 5.706956 28.456871 0.733981 0.691070 0.426810 3.529674 3.271233
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 3.283737 1.796175 2.333077 1.718913 -0.319141 0.160746 -3.713421 -3.587447 0.731144 0.688946 0.410540 1.526367 1.415747
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.017653 28.818069 -0.735696 -0.531159 -0.050166 27.365867 -0.183587 1.519927 0.737732 0.557619 0.380413 3.363855 3.743417
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 2.211198 0.035086 6.260268 3.316419 0.611216 4.546180 0.714775 0.592347 0.648350 0.679898 0.420838 2.349522 2.807265
163 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 9.453302 11.016237 9.057826 9.853593 2.178396 2.886142 0.669310 1.252467 0.027412 0.026107 0.001128 1.247058 1.237521
164 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.491291 12.093954 9.075655 10.031703 2.391722 3.140130 0.859664 0.847753 0.032113 0.037236 0.002719 1.236144 1.231712
165 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.249027 -0.021924 -2.075688 0.339645 2.698153 0.242287 0.191738 -0.025640 0.738380 0.691863 0.414965 1.460742 1.373532
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 19.232505 25.466315 -0.182007 0.149044 4.468529 3.008963 37.971752 62.046498 0.656940 0.576006 0.296647 2.602689 2.668181
167 N15 digital_ok 100.00% 6.98% 0.54% 0.00% 100.00% 0.00% 48.971446 40.341425 -1.086572 -0.643655 2.680346 2.240380 31.196379 84.476361 0.546119 0.551563 0.254688 2.361376 2.127497
168 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.485383 0.737888 0.855001 0.249788 -0.196137 -0.531826 0.502069 0.235795 0.730397 0.693366 0.419711 3.584013 2.972961
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 7.49% -0.763376 2.995621 0.617152 0.797431 0.036901 -1.227173 -0.075157 1.375889 0.731786 0.675694 0.425981 1.964019 1.669047
170 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.315191 1.273564 -0.566082 -0.043641 -0.598497 0.495423 12.425536 2.778231 0.724047 0.690503 0.431421 3.130479 2.798645
171 N16 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.322313 2.570858 -2.728890 0.213363 -0.914839 -1.171654 -0.399993 -0.236156 0.687298 0.597292 0.436344 2.554990 2.081126
173 N16 not_connected 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 12.262893 12.642557 2.743509 3.566731 2.185882 2.860662 3.824983 8.684479 0.035563 0.039865 0.004849 1.215755 1.216269
176 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.127152 0.175805 -0.582420 -0.139417 -0.441158 0.737299 -0.464343 9.572915 0.701797 0.664724 0.438387 3.668550 3.308617
177 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.741418 -1.057030 0.697691 -0.581605 0.791595 0.382396 -0.537893 1.940900 0.708765 0.669688 0.434953 1.610906 1.401973
178 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.479526 -0.522164 1.368727 0.166766 0.680448 3.479725 4.539970 1.435950 0.700864 0.678131 0.433890 3.141469 3.013384
179 N12 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.985450 12.745026 9.339126 10.456544 2.515422 3.392573 0.676120 1.178051 0.042174 0.088695 0.037941 1.228654 1.237449
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -0.354704 12.583797 -1.093573 10.111837 -0.298745 3.082054 -0.271485 2.454678 0.736482 0.060495 0.545305 3.801005 4.887046
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% 1.507260 -1.401916 1.887293 -0.669933 -0.600791 -1.066337 -3.606210 2.344892 0.738878 0.700747 0.418753 1.458903 1.333664
182 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.068881 2.869608 5.191632 1.945917 -1.499869 -0.148649 8.544250 8.252164 0.683062 0.690819 0.423460 2.274640 2.661399
183 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 100.00% 0.00% 10.550390 -0.609873 9.043277 1.798838 2.178138 1.135710 0.024910 0.636988 0.035919 0.679700 0.479914 1.238005 2.704052
184 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 10.323640 12.151803 9.274948 10.001226 2.264509 2.912455 0.720814 0.901572 0.029967 0.026393 0.002136 1.222889 1.208862
185 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 0.00% -0.626677 -0.554735 0.764608 0.892996 -0.624787 0.191861 2.276186 2.593946 0.725359 0.680249 0.414325 1.571458 1.382779
186 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.657424 -0.428690 0.639127 0.413660 0.025154 0.218657 5.270954 3.027321 0.727646 0.687452 0.417798 3.935634 3.472440
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.087723 -0.833482 0.891917 0.479627 0.116475 -0.064386 5.619399 2.719630 0.716947 0.685562 0.414731 2.737167 2.616096
189 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.00% 8.56% 0.712094 1.433126 -0.627452 -0.752241 0.919586 -0.570181 0.473888 3.925453 0.727800 0.691163 0.424668 2.224400 1.602200
190 N15 digital_ok 100.00% 20.41% 100.00% 0.00% 100.00% 0.00% 50.881683 11.858369 -1.134300 10.074251 2.352512 3.172687 21.517501 3.074879 0.488959 0.034136 0.358003 2.640963 1.199074
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.579489 -0.561972 -1.074380 0.052978 1.433944 0.492870 8.180793 7.246331 0.724780 0.686709 0.440229 3.050869 2.772071
192 N16 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.837954 5.377201 2.171712 3.481678 1.373990 2.473270 -2.608279 -5.271462 0.702331 0.641889 0.447378 2.774692 2.350795
193 N16 not_connected 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 5.369310 -0.409105 3.840205 0.170526 1.683076 -2.180717 -4.919768 -1.079310 0.674555 0.663924 0.459023 2.554235 2.535233
200 N18 RF_maintenance 100.00% 100.00% 95.11% 0.00% 100.00% 0.00% 11.677385 34.724317 3.163283 -0.482674 2.185114 3.410037 1.970158 7.542657 0.047867 0.203760 0.133152 1.265237 1.987776
201 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 5.514894 4.291659 3.817539 2.965539 1.539278 1.364325 -4.795942 -4.463510 0.699749 0.653820 0.416208 3.794894 3.005652
202 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.289751 2.628952 -0.476425 -0.162071 -1.386151 -1.706619 -0.594020 2.774215 0.724930 0.617336 0.439806 3.188876 2.315565
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 100.00% 0.00% 12.344194 13.715531 2.916053 3.675532 2.252240 2.913555 3.016591 3.319908 0.034510 0.043085 0.002309 1.223598 1.221896
219 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 5.251480 2.956745 3.956399 2.084045 1.814672 -0.399586 -5.000813 -3.328609 0.673967 0.666237 0.436187 2.735822 2.626734
220 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.840650 -1.211893 -1.942894 -1.641079 -1.186984 -1.514759 3.708152 -0.125735 0.714922 0.669934 0.422575 2.821317 2.531851
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 3.093749 -0.654940 -1.988026 -1.771988 0.166821 -0.622960 2.187936 0.108954 0.684814 0.667962 0.430428 2.783237 2.647392
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.082346 -0.249793 -1.227557 -1.620480 -0.873165 -1.026048 7.453744 -0.829611 0.715871 0.670620 0.426949 3.508816 2.942185
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 1.668388 0.789859 -1.750999 -2.615773 -0.621221 -1.738691 1.723462 -0.217009 0.671884 0.646048 0.434259 2.729064 2.593831
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.569838 -1.550056 0.000856 -0.554361 -1.478313 -1.301295 -2.294443 -2.494133 0.721421 0.668577 0.435429 3.199567 2.750423
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 100.00% 0.00% -1.258947 1.733646 -1.323428 -0.855169 -0.264117 -2.074636 4.049462 19.760652 0.714526 0.610338 0.452013 3.208261 2.391485
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 100.00% 0.00% -0.483381 12.813503 -1.294463 6.177185 -0.685319 2.935350 5.781322 3.272262 0.718589 0.047736 0.550309 0.000000 0.000000
321 N02 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.233019 -0.301821 -1.688348 -1.713129 -0.627702 -1.062314 2.344558 1.222324 0.649938 0.595201 0.447706 0.000000 0.000000
322 N05 digital_maintenance 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.107494 0.861621 -1.072057 0.717192 -1.313868 -1.410983 0.185860 -2.609380 0.637515 0.587834 0.439349 0.000000 0.000000
323 N02 not_connected 100.00% 42.70% 0.00% 0.00% 100.00% 0.00% 23.925133 0.161308 -1.164152 0.177903 -0.127618 -1.957271 4.540753 -1.423122 0.418287 0.578363 0.383734 0.000000 0.000000
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% 0.069933 0.985839 -0.101439 0.195299 -0.231423 -1.937860 1.107644 -0.952978 0.637462 0.582335 0.427342 0.000000 0.000000
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 100.00% 0.00% -0.339604 -1.418263 0.006851 -2.750833 -1.393749 -0.367615 -2.167898 -0.399680 0.673895 0.602390 0.451528 0.000000 0.000000
329 N12 dish_maintenance 100.00% 8.59% 0.00% 0.00% 100.00% 0.00% 3.401886 -1.597836 -0.473986 -2.309416 -1.024419 -0.114174 4.216997 0.431173 0.570282 0.591733 0.436013 0.000000 0.000000
333 N12 dish_maintenance 0.00% 11.28% 0.00% 0.00% 100.00% 0.00% 3.393991 0.188411 -0.627256 -2.874156 -1.391042 -0.773568 1.554590 1.232434 0.565994 0.576035 0.428644 0.000000 0.000000
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 7, 8, 18, 19, 21, 22, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 77, 78, 81, 82, 84, 86, 87, 89, 90, 92, 93, 94, 98, 99, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 116, 117, 118, 119, 120, 121, 122, 123, 125, 126, 135, 136, 137, 138, 140, 142, 144, 145, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 158, 161, 162, 163, 164, 166, 167, 168, 169, 170, 171, 173, 176, 178, 179, 180, 182, 183, 184, 186, 187, 189, 190, 191, 192, 193, 200, 201, 202, 203, 219, 220, 221, 222, 237, 238, 239, 320, 321, 322, 323, 324, 325, 329, 333]

unflagged_ants: [3, 5, 9, 10, 15, 16, 17, 20, 29, 40, 41, 42, 69, 83, 85, 88, 91, 100, 106, 112, 124, 127, 128, 129, 130, 141, 143, 157, 160, 165, 177, 181, 185]

golden_ants: [3, 5, 9, 10, 15, 16, 17, 20, 29, 40, 41, 42, 69, 83, 85, 88, 91, 100, 106, 112, 124, 127, 128, 129, 130, 141, 143, 157, 160, 165, 177, 181, 185]
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_2459858.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.4.dev14+g32bfdb8
3.1.5.dev87+gc99f378
In [ ]: