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 = "2459916"
data_path = "/mnt/sn1/2459916"
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-2-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/2459916/zen.2459916.25259.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 1850 ant_metrics files matching glob /mnt/sn1/2459916/zen.2459916.?????.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/2459916/zen.2459916.?????.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 2459916
Date 12-2-2022
LST Range 0.260 -- 10.217 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
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 131 / 200 (65.5%)
Redcal Done? ❌
Never Flagged Antennas 69 / 200 (34.5%)
A Priori Good Antennas Flagged 61 / 104 total a priori good antennas:
3, 7, 9, 15, 16, 17, 19, 21, 29, 30, 37, 38,
42, 45, 51, 53, 54, 55, 56, 68, 71, 72, 81,
86, 88, 93, 94, 101, 103, 106, 107, 109, 111,
118, 121, 122, 123, 128, 130, 136, 140, 143,
146, 148, 151, 153, 158, 161, 164, 165, 170,
173, 181, 182, 183, 185, 187, 189, 191, 192,
193
A Priori Bad Antennas Not Flagged 26 / 96 total a priori bad antennas:
22, 35, 43, 46, 48, 61, 62, 64, 74, 79, 82,
89, 95, 115, 120, 125, 137, 138, 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_2459916.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% 10.115961 0.059074 8.866819 0.348324 7.342087 1.005361 1.406314 2.732995 0.033796 0.673874 0.568015
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.555844 3.465655 1.054072 0.244469 4.581612 4.918514 76.587250 88.572909 0.656251 0.667104 0.411418
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.260343 0.124637 -0.165201 -0.412947 -0.321584 1.649127 0.144125 -0.020342 0.666047 0.678298 0.413812
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.159602 -0.736781 0.731281 2.798032 -0.071464 0.310578 23.230720 20.908508 0.663176 0.666581 0.405347
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.160988 -1.085581 -0.758918 -0.282134 0.279599 1.281860 4.946686 5.873769 0.665209 0.676443 0.402503
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 3.918896 0.039511 7.286521 0.124197 2.958241 0.869880 0.430610 0.297371 0.503363 0.672830 0.471709
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.447520 -0.379153 -1.141782 -0.863098 0.071309 1.409552 0.343704 3.488495 0.654387 0.669020 0.410626
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.534828 0.596001 8.818935 0.818598 7.379795 1.177129 0.945840 3.879310 0.033346 0.677644 0.560646
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.396278 -1.273849 8.839307 0.140516 7.364832 1.851202 1.553976 4.523736 0.033780 0.681581 0.560703
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.057498 1.101438 -0.054088 -0.100442 1.452940 1.488903 5.915013 2.103641 0.672219 0.685752 0.410222
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.073017 10.109692 8.849791 0.149646 7.489944 1.184719 1.340417 28.186120 0.029472 0.464671 0.383327
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.317692 -1.397788 -0.570850 3.263381 0.298862 0.863875 1.011745 4.507807 0.670873 0.667290 0.403610
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.355596 -0.950932 3.199165 -1.246488 1.012265 -0.449497 3.251945 -0.385011 0.648657 0.690038 0.413873
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.327670 0.035862 -0.292050 3.637666 1.441284 0.445313 0.414396 0.029690 0.655827 0.644243 0.401710
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.950748 -0.848731 -0.166206 -0.558477 2.775884 2.781624 0.534733 -0.366973 0.629016 0.647542 0.399754
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.138846 10.562125 8.899443 9.229534 7.491352 7.867325 3.435481 2.530743 0.036046 0.040686 0.005346
28 N01 RF_maintenance 100.00% 0.00% 83.03% 0.00% 11.215522 25.471429 -1.232965 0.642481 4.089339 6.753692 5.734074 21.563280 0.378757 0.175821 0.268109
29 N01 digital_ok 100.00% 0.00% 100.00% 0.00% -1.304707 11.033683 0.036807 8.873225 -0.190809 7.848419 -0.137815 0.796544 0.674371 0.036830 0.589083
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.500200 -0.058815 0.328681 0.246953 0.070396 0.549328 13.216767 -0.067741 0.671232 0.690019 0.400977
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.037562 -0.905229 0.689902 1.126182 1.508462 0.402570 1.432343 2.229610 0.683196 0.689289 0.402204
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.688357 23.292844 0.533165 1.920802 9.347279 4.369255 5.929113 6.452785 0.573222 0.574707 0.254627
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.857935 -0.773763 3.992937 -0.143471 7.412791 1.436883 2.249473 -0.415490 0.047514 0.666496 0.529256
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.442249 -0.634475 0.673559 -1.545290 -0.531940 -0.745305 -1.820544 0.518860 0.640582 0.645681 0.399952
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.541513 7.515305 -0.045943 0.058433 1.020862 2.189012 1.588485 5.523921 0.661241 0.673325 0.403165
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.689507 0.382172 -1.262537 0.393653 0.279968 1.618875 0.333148 13.196000 0.673141 0.684003 0.411134
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.391496 0.307182 0.078954 0.154516 0.281352 0.377291 8.632199 2.731387 0.675354 0.690624 0.413175
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.135353 0.702280 0.029836 0.214629 -0.567971 0.307320 0.100797 0.444005 0.670976 0.677266 0.399003
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.104384 0.280357 -0.797342 -0.273938 1.110387 0.259787 -0.417752 1.148398 0.678685 0.686881 0.395017
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.970685 11.543179 9.079568 9.625364 7.278476 7.726672 2.230483 3.187994 0.035983 0.033224 0.000872
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.435534 0.513972 -0.234174 0.202462 -1.260407 0.564173 -1.491612 0.895672 0.687866 0.692215 0.400948
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.868424 0.229033 -0.882140 -0.721667 -0.679369 0.531726 0.016898 0.339232 0.684008 0.700851 0.399054
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.552990 1.735552 0.133916 -0.060806 -0.030444 1.735730 0.974933 4.382129 0.674308 0.680707 0.393545
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.910564 2.013002 1.229716 1.530624 -0.366819 0.325716 0.954357 -1.807591 0.666351 0.697509 0.412253
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.013958 1.258201 3.829990 -1.310572 7.381528 -1.153845 2.041138 7.106163 0.040037 0.649323 0.505967
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.200737 0.805091 0.436976 1.186357 -1.058003 0.665821 -1.804253 -2.880152 0.643459 0.669116 0.401887
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.249341 -0.785413 -0.504655 -1.305574 -0.713646 -0.472212 2.449120 17.329701 0.599168 0.643146 0.399477
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 31.293862 0.583772 0.822416 0.477919 4.372669 1.985158 37.850454 7.551401 0.559130 0.670620 0.376155
51 N03 digital_ok 100.00% 97.41% 0.00% 0.00% 24.418247 0.815935 11.325562 -0.253582 7.721464 2.683411 13.912429 3.673676 0.046712 0.688640 0.567006
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.622404 6.448585 -0.543463 0.176618 0.382993 1.539122 2.484623 1.715674 0.678724 0.693277 0.402283
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.452862 2.906035 -0.370886 -0.231754 1.777159 1.780791 3.794101 8.977383 0.685288 0.698802 0.407368
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.166848 11.257289 8.895414 9.424112 7.449461 7.845363 3.407453 1.997811 0.033176 0.033114 0.001055
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.997278 11.952802 0.803873 9.343640 1.719457 7.895982 3.962931 5.217642 0.676738 0.036407 0.534651
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.659571 12.044120 0.230303 9.519866 -0.072337 7.776343 2.737353 1.849900 0.680810 0.039630 0.559951
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 28.125098 1.282596 5.438641 0.288730 6.682859 0.493663 5.542712 2.287876 0.476023 0.696625 0.409759
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.659281 10.907512 8.781264 9.318827 7.391160 7.820387 3.443659 2.766318 0.036814 0.036390 0.000958
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.601959 0.548710 8.355277 0.257394 7.202580 3.227049 0.857299 8.942594 0.052584 0.692859 0.560059
60 N05 RF_maintenance 100.00% 0.00% 96.70% 0.00% 0.691636 10.741983 -0.468394 9.353195 -0.089560 7.804103 0.601843 3.747317 0.674698 0.092025 0.533572
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.618506 0.110436 -0.337408 -0.759022 1.251350 -1.512387 0.302642 1.874397 0.613099 0.650421 0.389343
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.065719 1.509695 -0.911960 0.945539 -1.301987 -0.356070 0.694929 -2.209034 0.617755 0.669747 0.403604
63 N06 not_connected 100.00% 0.00% 98.59% 0.00% 0.227688 11.179545 -0.592616 4.264917 -0.884672 7.881221 -0.397427 3.759540 0.622881 0.047068 0.485334
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.040835 0.019125 -0.798039 -0.667308 -0.959651 -1.066097 0.838794 0.548828 0.611311 0.611670 0.383023
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.484848 0.848961 0.358138 0.640969 0.462770 1.315482 0.904829 1.352112 0.657835 0.682437 0.411287
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.409725 1.715688 1.607033 1.513364 1.938781 0.979762 0.502691 3.715556 0.666630 0.687418 0.407268
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.732692 -0.798939 1.791919 1.518664 -0.582221 0.044738 0.621413 1.576075 0.669948 0.691263 0.401266
68 N03 digital_ok 100.00% 0.00% 99.30% 0.00% 0.340077 26.569042 0.385054 12.295024 0.333786 7.922573 1.106446 13.441504 0.682834 0.035695 0.542816
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.294934 -0.213870 0.268195 0.238146 -0.557401 1.752833 0.943218 1.352645 0.679564 0.698108 0.394535
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.576901 -0.134244 -0.635383 -0.403361 1.355195 1.156424 1.066931 0.878330 0.688582 0.703197 0.395520
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 6.431979 0.223883 0.285893 0.838958 0.850790 0.564968 1.228245 1.106236 0.693947 0.703089 0.391580
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 2.462762 0.382575 0.511267 0.803813 0.164275 -0.033519 5.584250 0.582035 0.682376 0.699963 0.387835
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.118810 1.003618 -0.930730 1.646872 -0.199031 4.545285 -0.375422 0.041843 0.695107 0.695691 0.394246
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.334517 1.003447 -0.074566 -0.901844 -0.379503 0.926127 -1.311389 1.168603 0.688305 0.700636 0.392255
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.191483 -0.044258 0.237694 -1.387312 -0.959363 -1.121742 5.271838 -0.349146 0.654364 0.646215 0.392596
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 31.432729 0.636292 -0.611355 0.848313 2.040997 -0.575939 1.249834 0.511872 0.445878 0.662693 0.389618
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.940292 -0.579366 -0.801260 -0.969988 -0.938856 -0.990918 1.590386 -1.205155 0.634333 0.660270 0.401114
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 8.141520 12.415810 1.920971 4.152637 4.737619 7.742385 15.537881 1.505091 0.321124 0.041574 0.216167
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -0.791926 -0.832895 -0.408464 3.134885 -0.851634 26.043897 0.492277 2.256792 0.636035 0.637188 0.390186
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.779224 -0.831392 -0.016181 3.422340 0.513250 0.935959 -0.155517 0.060532 0.657107 0.646788 0.392963
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.484125 0.216056 -0.204898 0.135111 0.514431 -0.157878 -0.737985 -0.082580 0.667802 0.685772 0.396689
84 N08 RF_maintenance 100.00% 19.51% 100.00% 0.00% 19.933990 23.431439 11.353013 11.899372 5.824548 7.799778 5.484005 7.577888 0.257111 0.036575 0.167608
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.000114 0.735101 0.201109 0.319717 -0.606037 -0.101903 -0.146632 -0.025119 0.679915 0.690520 0.391789
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.787525 -0.048103 1.966532 1.159179 2.049496 0.235177 0.521993 28.877177 0.665318 0.691304 0.387397
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 20.206397 6.761942 1.402437 -0.366622 11.438994 1.659084 6.862459 2.292259 0.592772 0.710632 0.360720
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.382719 0.301332 0.097240 0.777310 -0.833104 -0.212544 5.824149 1.391374 0.678683 0.696979 0.380366
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.916869 0.586599 0.024476 0.548017 -0.813812 0.039350 -0.783911 -0.709332 0.688283 0.700162 0.385751
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.392075 -0.348754 0.677897 0.947800 -0.286221 -0.478010 -0.056911 5.590437 0.678208 0.691625 0.387499
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.661723 -0.248389 0.161809 0.085985 -0.085209 -0.295145 0.358990 -0.439761 0.672633 0.696131 0.397547
92 N10 RF_maintenance 100.00% 0.00% 15.84% 0.00% 38.042480 43.416677 0.429202 0.759431 5.089692 6.759000 2.138044 12.349560 0.304415 0.256202 0.097550
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.177888 0.192635 1.981357 -0.027188 0.763698 1.478370 4.250556 -0.049652 0.663183 0.692634 0.403837
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 11.229705 -0.634225 9.018479 -0.131860 7.389952 1.189619 1.514466 5.128311 0.034110 0.690332 0.475869
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.592397 -0.221311 -0.664146 0.661802 -0.644955 -0.938626 0.149645 -0.209398 0.639076 0.677335 0.410153
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.340967 12.001820 3.820213 4.304171 7.244932 7.667514 1.848674 1.434652 0.033084 0.039016 0.003309
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.797607 2.176688 0.137368 -0.271942 -0.529566 -0.696061 6.521322 13.267769 0.585618 0.623508 0.394963
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.823933 2.224518 0.018900 -0.095305 -0.407006 0.506492 0.538461 2.586429 0.635901 0.659439 0.399645
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 1.726090 -0.666982 0.577729 0.653029 -0.709955 1.903538 1.544254 -0.622816 0.642280 0.672509 0.402780
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.284192 -0.602726 -0.187632 0.733321 1.194856 0.196709 0.478344 1.161709 0.661480 0.680581 0.395744
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.665173 6.317565 -0.555470 0.617026 0.556672 1.530441 0.255459 0.029040 0.683652 0.692741 0.389023
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.054283 0.854398 -0.683563 1.742487 0.576744 0.920610 -1.148700 11.160407 0.690073 0.691562 0.387920
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.631095 5.680255 3.960784 -0.600280 1.403112 1.235652 12.669444 15.318142 0.661650 0.703942 0.394388
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.264262 58.308258 6.153940 6.907864 2.758127 7.398661 -0.149615 0.105860 0.629863 0.666840 0.386505
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.200347 0.140447 -0.199551 0.599925 1.089144 -0.340686 -0.031686 -0.390621 0.689982 0.698819 0.377497
106 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.448003 -0.762228 2.305733 0.927912 9.820988 -0.805448 -0.011810 -0.157721 0.662218 0.692611 0.382100
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.998866 0.898505 -1.049511 -0.898721 -0.392803 -0.279597 7.932688 7.682194 0.687654 0.702746 0.384530
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.277193 8.837941 8.833570 -0.705994 7.404985 5.694687 2.762114 4.766540 0.040048 0.395807 0.253677
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.062670 10.905276 8.883052 9.126566 7.518266 7.897453 1.030745 2.656421 0.028427 0.032963 0.002428
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 14.201112 25.068748 0.473009 12.042038 11.245940 7.707771 3.582539 6.185872 0.617640 0.033694 0.387513
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.078558 10.871031 0.307228 9.219515 0.006462 7.893835 5.953035 3.149262 0.670982 0.039705 0.469223
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.385697 1.515972 -0.165846 -0.370353 1.145010 1.819973 -0.025175 -0.511100 0.662390 0.678715 0.403317
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.124597 12.058264 3.629916 4.213528 7.262774 7.692398 2.377687 1.037381 0.035600 0.030949 0.002443
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 3.612369 0.916348 0.215506 -0.448125 4.701744 -0.919087 1.093159 -0.144174 0.575473 0.657537 0.418014
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.185988 2.090987 0.761068 1.766345 -0.247391 0.732006 -2.131268 -2.851640 0.626570 0.655315 0.418616
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.502253 -0.120640 -0.729585 -0.305317 0.857866 0.354623 0.424218 -0.249177 0.629142 0.655173 0.399148
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.116361 12.411018 8.921877 9.640912 7.291344 7.807406 2.241978 5.194536 0.027316 0.032090 0.003095
118 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 0.150369 0.895494 -0.161137 0.459994 -0.288252 0.313886 3.190038 4.232159 0.658483 0.683859 0.397620
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.931246 1.199545 -0.889233 -0.048784 0.731939 4.627681 0.277947 3.116556 0.672928 0.689089 0.394953
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.865243 2.916868 2.175606 1.775010 0.168057 0.794785 0.474734 -3.154132 0.669639 0.697224 0.383787
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.922312 4.704638 -1.475448 0.063967 -0.292391 2.983710 6.717051 20.951200 0.689610 0.706028 0.386888
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.264320 6.468649 -0.049874 0.356427 1.330364 1.598659 0.356797 -0.702267 0.697423 0.707767 0.388531
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.525544 8.740210 0.268945 0.697926 1.163618 0.325897 -0.528677 0.461852 0.700169 0.711409 0.387605
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.951837 -0.284176 -0.183093 0.293424 -0.594766 1.074563 0.579383 0.654053 0.694729 0.708145 0.384884
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.091068 -0.858745 -0.553492 0.661249 -0.617827 -0.509613 -0.557158 -0.469728 0.689401 0.699398 0.386714
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 29.552151 1.060390 0.145633 0.671666 4.953621 -0.293054 9.236815 1.908245 0.568182 0.696480 0.374254
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.107470 0.408051 -0.210569 0.010429 1.439798 1.673903 0.188648 1.988068 0.682417 0.705916 0.404326
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.750258 10.456367 8.926608 9.308313 7.312104 7.749554 0.693425 1.080336 0.030844 0.026484 0.002189
129 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.821496 -1.473667 -0.023036 0.116668 -0.164686 0.553961 -0.420774 -0.231979 0.671569 0.695148 0.411420
130 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 0.729010 1.139682 -0.106356 0.057191 -0.558564 1.005476 0.648600 4.859600 0.655650 0.685444 0.400072
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.191910 12.156471 3.862355 4.426751 7.375128 7.783124 3.587127 -0.066511 0.032728 0.039352 0.003114
132 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.609610 0.843209 -1.228688 -1.470747 14.959827 -0.969697 0.614836 -0.889679 0.619493 0.648365 0.400958
133 N11 not_connected 100.00% 100.00% 73.41% 0.00% 11.620458 16.485246 3.640675 3.040230 7.358813 7.060418 2.196654 0.888792 0.042824 0.206437 0.113544
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.521918 -0.849509 0.315008 -1.375285 4.162952 0.634478 9.440550 0.483348 0.632376 0.665281 0.418906
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 3.732761 -0.129442 6.186146 4.253111 11.591772 24.217054 1.090142 0.703387 0.524681 0.625060 0.400431
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.062940 -0.446735 -0.551615 -0.808408 1.457052 0.616613 0.448643 2.110259 0.645193 0.674541 0.407033
138 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.382453 -0.044742 0.406087 1.261515 0.508621 0.608788 3.163830 -0.078930 0.665022 0.684647 0.403103
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.142399 -0.415912 1.094318 -1.049521 0.337163 -1.608099 -1.564191 0.338901 0.668749 0.678294 0.388966
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.046682 -0.494471 -1.078645 -0.551636 -0.312156 -0.723598 5.181903 3.231027 0.680041 0.705867 0.390653
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.234345 -0.234361 -0.752153 0.407670 -0.014210 -1.387571 -0.059043 -2.240428 0.685033 0.706273 0.388128
142 N13 RF_maintenance 100.00% 0.00% 98.43% 0.00% 0.023154 10.780106 -1.181214 9.360376 1.263651 7.823048 25.808563 2.609428 0.689838 0.051630 0.561623
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.314325 -0.321539 5.229635 -0.337486 -0.505236 0.879816 -0.336866 -0.220686 0.639885 0.711595 0.415404
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.024699 -0.178572 -0.458899 2.494500 0.811672 -0.905390 -0.281375 0.440266 0.692370 0.695843 0.388440
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.065325 1.597898 -0.161307 5.697089 0.143956 8.348726 0.219577 0.624670 0.688757 0.645081 0.409858
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 11.386737 -1.022153 3.651360 -0.127948 7.331634 -1.572614 0.549017 -1.743447 0.037355 0.695312 0.558096
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.315528 -1.293088 1.334148 1.841303 1.778029 -0.069103 -0.000796 -0.274081 0.668221 0.690463 0.398007
148 N15 digital_ok 100.00% 63.30% 0.00% 0.00% 0.899094 0.076401 5.281637 1.217679 77.988672 1.845554 3.661475 -0.198094 0.272066 0.694955 0.491836
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.912722 1.469594 -1.327116 1.479469 -1.114452 0.080056 -0.354528 -2.438784 0.669834 0.692854 0.411049
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.685799 -0.071696 1.026360 0.580857 0.180750 -1.220725 -0.697803 -0.517404 0.663313 0.688709 0.418152
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 23.629504 0.367056 -0.352377 -0.007914 3.826008 -0.838534 3.483431 0.215854 0.523938 0.634486 0.395877
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.450812 0.776877 -1.469818 -1.265061 -1.611318 -1.414523 2.741546 -0.092988 0.613639 0.651542 0.419822
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 10.608829 -0.242604 3.782041 -0.969444 7.352766 2.347918 1.514427 0.814894 0.044322 0.644269 0.570937
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.606435 -0.924952 0.300407 -0.165378 -1.012334 -1.532871 -1.708249 -0.869781 0.604093 0.641344 0.427444
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.890788 -0.349300 8.605193 -0.918857 7.490192 0.851997 1.311334 0.687982 0.037141 0.664037 0.506699
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.282202 10.559302 3.179375 9.111527 -0.715663 7.867580 1.072842 1.029733 0.612092 0.040066 0.484935
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.132510 -0.000114 -0.287966 0.316455 -0.499751 0.707063 -0.221526 -0.336708 0.649402 0.671086 0.404340
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.186710 -0.311410 -0.824711 -0.986236 1.591120 1.822146 7.339369 20.120343 0.665737 0.684401 0.407979
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.145789 28.582093 -1.528341 -0.772663 -1.281230 2.298913 0.668868 13.681317 0.641994 0.537951 0.362721
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.872052 -0.920958 -0.474193 -1.081199 -0.177004 1.096486 0.598982 -0.248831 0.675792 0.694509 0.393690
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.716323 28.941989 -0.363596 -0.677732 -0.044670 0.499253 -0.553582 -0.005451 0.680078 0.575351 0.349587
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 2.211107 0.353033 1.914916 1.067644 0.593342 -0.838302 -1.488302 -2.441010 0.686193 0.705089 0.384996
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.225317 -0.135294 -0.423154 0.117404 -0.034600 0.922001 0.000796 0.824178 0.693708 0.698833 0.392378
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.285234 0.250535 2.913574 -0.537651 23.802501 2.038730 1.313026 1.703436 0.666644 0.701648 0.394265
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 28.829619 0.266250 2.226631 0.252374 2.572393 0.633977 1.217471 -0.304127 0.527059 0.699495 0.389043
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.462791 2.366235 -0.014390 0.960746 0.147192 18.565743 7.549295 -0.457265 0.684666 0.701606 0.398494
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.443584 -1.265169 -0.875011 3.327501 0.807352 -0.572747 -1.524564 3.598725 0.685921 0.680961 0.406889
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.722168 -0.766182 -0.249194 -0.656405 1.382190 1.022792 0.245399 1.744465 0.673964 0.698881 0.412694
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.841444 2.202147 -1.103080 -1.354569 0.255947 -0.669612 -0.532191 -0.932249 0.671625 0.681234 0.408222
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.888061 -0.308055 9.031426 -1.077394 7.270824 1.315392 1.432433 1.946550 0.040555 0.691225 0.564119
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.450329 1.883084 -1.335179 0.675422 -1.442683 0.154330 -0.255386 0.986876 0.618956 0.606328 0.393368
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 12.343804 11.907715 3.455059 3.940859 7.572983 7.903977 4.043023 9.603540 0.039394 0.044288 0.001513
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.135325 -0.349320 1.636245 1.989163 -0.968484 -0.384168 -0.039310 -0.468248 0.649983 0.669477 0.405377
180 N13 RF_maintenance 100.00% 0.00% 99.30% 0.00% -0.139952 11.664257 0.309552 9.470842 0.238633 7.761827 31.456267 3.865220 0.668278 0.056865 0.560770
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.706259 0.172700 -0.368178 0.253197 0.930544 0.737517 0.186633 5.633843 0.681118 0.691997 0.396663
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.107088 4.447903 -0.607025 2.640575 -1.248069 3.206627 18.626257 -1.680827 0.690037 0.688640 0.396753
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.384035 2.035366 0.664846 4.261869 1.354276 -1.221555 0.329768 0.117507 0.673745 0.645423 0.380944
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.231276 -0.524340 -0.287488 3.032789 0.918834 -0.728614 0.243890 0.724846 0.679926 0.683322 0.388502
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 18.062180 -1.176942 7.225991 3.599613 8.002512 -0.915803 -0.070528 -0.198912 0.385563 0.671610 0.421417
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.554868 -0.974666 -1.262116 -0.510974 -0.255791 -1.346799 0.748309 -1.910862 0.685830 0.704349 0.406428
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.055743 -0.227769 -1.287777 -0.568630 0.051646 -0.237712 1.956056 5.416233 0.682216 0.702641 0.404164
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 8.400190 8.767578 2.375546 0.549015 2.485015 3.872718 0.813336 1.314473 0.360442 0.389016 0.178769
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.959221 -1.403079 -0.772110 -0.010429 0.014210 -1.496454 0.069620 -1.715638 0.662523 0.688138 0.424638
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.449488 0.158759 0.864889 -0.670703 0.172700 0.570160 21.795095 0.872379 0.649694 0.679338 0.424885
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 5.847488 7.239084 3.737849 3.858778 5.345008 6.085708 -4.457601 -4.785913 0.611083 0.634994 0.410344
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.830381 0.110221 3.951701 0.699971 5.661671 -0.145139 -4.606181 -0.149306 0.599102 0.652798 0.440619
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% 42.22% 0.00% 11.849957 34.848744 3.815592 0.411782 7.526443 6.550077 2.748296 -0.833090 0.047570 0.236486 0.170847
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.160932 6.413083 4.023838 3.470184 5.886542 5.333008 -4.521561 -4.228525 0.633076 0.654168 0.389833
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 0.961895 1.502803 0.507738 -0.368570 -0.437053 -0.572052 0.442218 2.353093 0.664074 0.643873 0.391079
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 194.018007 193.942369 inf inf 4147.738301 4157.719021 8371.589406 8973.109730 nan nan nan
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.249666 2.332371 0.350370 -1.253957 -1.067873 -0.366935 -1.452746 9.736894 0.658460 0.655327 0.391355
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.608047 0.819362 -0.334851 -1.037463 14.205823 -1.278241 1.029757 4.655846 0.650564 0.661663 0.395019
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.672486 2.495004 1.001615 -1.445979 0.481628 -0.385657 -1.844057 -0.221300 0.639154 0.645605 0.380793
213 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 229.097431 229.137107 inf inf 4097.193610 4454.096832 8174.394821 10037.320646 nan nan nan
220 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.246438 -0.627700 -0.206533 -0.364952 -1.395799 -1.186078 4.185910 -0.621777 0.659050 0.664488 0.398807
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.444172 0.115466 -0.727176 -0.571409 -0.381189 -1.662155 2.517107 -1.025781 0.629642 0.668966 0.408497
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.993556 0.911284 0.429291 -1.504446 -0.813918 5.965952 6.573692 4.115662 0.657293 0.659073 0.399218
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.790841 1.015962 -1.524381 -0.251265 -1.222585 3.721258 1.532582 45.218149 0.641132 0.637052 0.391395
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.153597 6.945374 4.154572 3.907352 5.934330 6.206000 -4.781856 -4.780035 0.628327 0.642675 0.397127
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 206.126298 206.680104 inf inf 3802.449483 3843.040047 8129.486557 7813.723242 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% 5.439563 1.465942 1.413746 -1.151471 0.292618 -0.861292 4.039655 -1.043125 0.538862 0.646903 0.440423
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.277016 -0.119182 1.232772 0.975881 -0.085607 -0.495615 -2.413664 -2.530850 0.654490 0.663395 0.410743
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.078661 0.494641 0.042682 0.601174 -0.268644 -0.565571 -0.839344 6.418942 0.649518 0.663720 0.407107
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% 240.231578 240.127728 inf inf 3929.517423 3945.253243 8347.218107 8296.211935 nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 207.150534 206.922816 inf inf 3608.966622 3769.025435 8624.701981 8615.198097 nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 99.95% 0.00% -0.416639 12.155250 -0.511323 6.142624 0.064348 7.905197 11.757156 5.066174 0.649034 0.053023 0.556322
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.207574 2.566868 0.833938 1.143368 0.714816 0.475185 -0.027578 -1.773014 0.544325 0.567005 0.396190
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.682000 -1.239907 0.919840 -1.307759 0.344440 -0.570351 -2.037286 0.308590 0.572424 0.581538 0.406784
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.142730 -0.488482 -0.879214 -0.941308 -0.291404 -1.032613 8.622317 1.316494 0.529720 0.567601 0.397866
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.829745 0.509773 -0.862555 -1.375559 -1.299499 -0.753502 1.269252 2.112217 0.510243 0.559037 0.399384
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, 32, 34, 36, 37, 38, 42, 45, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 73, 77, 78, 80, 81, 84, 86, 87, 88, 90, 92, 93, 94, 96, 97, 101, 102, 103, 104, 106, 107, 108, 109, 110, 111, 113, 114, 117, 118, 119, 121, 122, 123, 126, 128, 130, 131, 132, 133, 135, 136, 140, 142, 143, 145, 146, 148, 151, 153, 155, 156, 158, 159, 161, 164, 165, 166, 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, 31, 35, 40, 41, 43, 44, 46, 48, 61, 62, 64, 65, 66, 67, 69, 70, 74, 79, 82, 83, 85, 89, 91, 95, 98, 99, 100, 105, 112, 115, 116, 120, 124, 125, 127, 129, 137, 138, 139, 141, 144, 147, 149, 150, 152, 154, 157, 160, 162, 163, 167, 168, 169, 171, 179, 184, 186, 190, 202, 207, 221, 238, 324, 325, 333]

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