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 = "2459918"
data_path = "/mnt/sn1/2459918"
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-4-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/2459918/zen.2459918.25269.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/2459918/zen.2459918.?????.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/2459918/zen.2459918.?????.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 2459918
Date 12-4-2022
LST Range 0.394 -- 10.351 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 N18
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 67 / 200 (33.5%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 129 / 200 (64.5%)
Redcal Done? ❌
Never Flagged Antennas 71 / 200 (35.5%)
A Priori Good Antennas Flagged 60 / 104 total a priori good antennas:
3, 7, 9, 15, 16, 17, 29, 30, 37, 38, 42, 51,
53, 54, 55, 56, 68, 71, 72, 81, 86, 88, 93,
94, 101, 103, 109, 111, 118, 121, 122, 123,
127, 128, 129, 130, 136, 140, 143, 146, 148,
151, 152, 153, 158, 161, 164, 165, 167, 170,
173, 182, 183, 185, 187, 189, 191, 192, 193,
202
A Priori Bad Antennas Not Flagged 27 / 96 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 61, 62, 64, 73, 74,
77, 79, 89, 95, 114, 115, 119, 120, 125, 137,
138, 139, 179, 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_2459918.csv

Build DataFrame¶

In [20]:
# build dataframe
to_show = {'Ant': [f'<a href="{ant_to_report_url(ant)}" target="_blank">{ant}</a>' for ant in ants],
           'Node': [f'N{nodes[ant]:02}' for ant in ants], 
           'A Priori Status': [a_priori_statuses[ant] for ant in ants]}
           #'Worst Metric': worst_metrics, 'Worst Modified Z-Score': worst_zs}
df = pd.DataFrame(to_show)

# create bar chart columns for flagging percentages:
bar_cols = {}
if use_auto_metrics:
    bar_cols['Auto Metrics Flags'] = [float(ant in auto_ex_ants) for ant in ants]
if use_ant_metrics:
    if np.sum(list(a_priori_flag_frac.values())) > 0:  # only include this col if there are any a priori flags
        bar_cols['A Priori Flag Fraction in Ant Metrics'] = [a_priori_flag_frac[ant] for ant in ants]
    for ap in antpols:
        bar_cols[f'Dead Fraction in Ant Metrics ({ap})'] = [dead_ant_frac[ap][ant] for ant in ants]
    bar_cols['Crossed Fraction in Ant Metrics'] = [crossed_ant_frac[ant] for ant in ants]
if use_redcal:
    bar_cols['Flag Fraction Before Redcal'] = [redcal_prior_flag_frac[ant] for ant in ants]
    bar_cols['Flagged By Redcal chi^2 Fraction'] = [redcal_flagged_frac[ant] for ant in ants]  
for col in bar_cols:
    df[col] = bar_cols[col]

# add auto_metrics
if use_auto_metrics:
    for label, modz in all_modzs.items():
        df[label] = modz
z_score_cols = [col for col in df.columns if 'Modified Z-Score' in col]        
        
# add ant_metrics
ant_metrics_cols = {}
if use_ant_metrics:
    for ap in antpols:
        ant_metrics_cols[f'Average Dead Ant Metric ({ap})'] = [average_dead_metrics[ap][ant] for ant in ants]
    ant_metrics_cols['Average Crossed Ant Metric'] = [average_crossed_metrics[ant] for ant in ants]
    for col in ant_metrics_cols:
        df[col] = ant_metrics_cols[col]   

# add redcal chisq
redcal_cols = []
if use_redcal:
    for ap in antpols:
        col_title = f'Median chi^2 Per Antenna ({ap})'
        df[col_title] = [cspa[ant, ap] for ant in ants]
        redcal_cols.append(col_title)

# sort by node number and then by antenna number within nodes
df.sort_values(['Node', 'Ant'], ascending=True)

# style dataframe
table = df.style.hide_index()\
          .applymap(lambda val: f'background-color: {status_colors[val]}' if val in status_colors else '', subset=['A Priori Status']) \
          .background_gradient(cmap='viridis', vmax=mean_round_modz_cut * 3, vmin=0, axis=None, subset=z_score_cols) \
          .background_gradient(cmap='bwr_r', vmin=dead_cut-.25, vmax=dead_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .background_gradient(cmap='bwr_r', vmin=crossed_cut-.25, vmax=crossed_cut+.25, axis=0, subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .background_gradient(cmap='plasma', vmax=4, vmin=1, axis=None, subset=redcal_cols) \
          .applymap(lambda val: 'font-weight: bold' if val < dead_cut else '', subset=list([col for col in ant_metrics_cols if 'dead' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val < crossed_cut else '', subset=list([col for col in ant_metrics_cols if 'crossed' in col.lower()])) \
          .applymap(lambda val: 'font-weight: bold' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .applymap(lambda val: 'color: red' if val > mean_round_modz_cut else '', subset=z_score_cols) \
          .bar(subset=list(bar_cols.keys()), vmin=0, vmax=1) \
          .format({col: '{:,.4f}'.format for col in z_score_cols}) \
          .format({col: '{:,.4f}'.format for col in ant_metrics_cols}) \
          .format({col: '{:,.2%}'.format for col in bar_cols}) \
          .applymap(lambda val: 'font-weight: bold', subset=['Ant']) \
          .set_table_styles([dict(selector="th",props=[('max-width', f'70pt')])])

Table 2: RTP Per-Antenna Metrics Summary Table¶

This admittedly very busy table incorporates summary information about all antennas in the array. Its columns depend on what information is available when the notebook is run (i.e. whether auto_metrics, ant_metrics, and/or redcal is done). These can be divided into 5 sections:

Basic Antenna Info: antenna number, node, and its a priori status.

Flag Fractions: Fraction of the night that an antenna was flagged for various reasons. Note that auto_metrics flags antennas for the whole night, so it'll be 0% or 100%.

auto_metrics Details: If auto_metrics is included, this section shows the modified Z-score signifying how much of an outlier each antenna and polarization is in each of four categories: bandpass shape, overall power, temporal variability, and temporal discontinuities. Bold red text indicates that this is a reason for flagging the antenna. It is reproduced from the auto_metrics_inspect.ipynb nightly notebook, so check that out for more details on the precise metrics.

ant_metrics Details: If ant_metrics is included, this section shows the average correlation-based metrics for antennas over the whole night. Low "dead ant" metrics (nominally below 0.4) indicate antennas not correlating with the rest of the array. Negative "crossed ant" metrics indicate antennas that show stronger correlations in their cross-pols than their same-pols, indicating that the two polarizations are probably swapped. Bold text indicates that the average is below the threshold for flagging.

redcal chi^2 Details: If redcal is included, this shows the median chi^2 per antenna. This would be 1 in an ideal array. Antennas are thrown out when they they are outliers in their median chi^2, usually greater than 4-sigma outliers in modified Z-score.

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.581140 0.049060 8.681566 0.317558 6.931746 0.435591 2.271049 2.986139 0.033187 0.675092 0.563648
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.287966 4.205975 3.706747 0.345328 6.885897 0.464027 124.814379 49.774431 0.636805 0.667956 0.408796
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.096012 0.194083 -0.252329 -0.368402 -0.210538 1.524179 -0.056449 -0.296689 0.671616 0.679555 0.405873
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.544915 -1.071686 0.631844 2.769797 0.131716 -0.821284 15.405665 13.588661 0.667697 0.667996 0.400732
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.144075 -1.454260 -0.868559 -0.292290 -0.159902 0.821911 3.705906 3.667493 0.669281 0.677550 0.396003
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.817403 -0.064176 7.141659 0.069571 3.683206 0.300109 0.370590 -0.388711 0.504894 0.673411 0.465260
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.029840 -0.707282 -1.246541 -0.913014 -0.535030 1.154639 -0.183656 1.144722 0.659293 0.667553 0.404254
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.827072 0.731789 8.155144 0.228818 6.945468 1.686532 1.633204 4.504697 0.033837 0.679159 0.557876
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 11.919196 -1.086235 8.652530 0.177544 6.939485 1.471789 2.120949 1.631470 0.032884 0.681307 0.551447
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.252631 1.091582 -0.110111 -0.086896 0.927553 0.720187 7.899109 2.801732 0.676230 0.686748 0.403221
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.639013 10.886326 8.654455 0.072581 7.096792 0.641137 2.154767 36.251961 0.029302 0.468027 0.380217
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.413485 -1.422553 -0.703596 3.369249 -0.117943 0.973786 0.754442 3.014130 0.671220 0.666924 0.395660
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.357966 -1.055425 3.092225 -0.834423 0.274109 -0.474899 1.561069 -0.754656 0.657021 0.691208 0.404661
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.224044 0.338293 -0.342485 3.650427 0.686901 0.860845 0.048122 -0.395226 0.658958 0.641883 0.398868
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.573243 -0.430061 0.367794 -0.014296 1.324472 1.023198 -0.692401 -1.450935 0.633929 0.650693 0.398576
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.076747 12.116753 8.702425 9.124464 7.060670 6.874128 4.110730 2.283107 0.035816 0.039742 0.004894
28 N01 RF_maintenance 100.00% 0.00% 83.41% 0.00% 12.791493 28.479135 -1.091350 0.708154 3.406901 4.126636 5.645836 21.932528 0.376674 0.167154 0.274256
29 N01 digital_ok 100.00% 0.00% 100.00% 0.00% -1.557074 12.643391 0.051070 8.764409 -0.356251 6.861974 -0.215031 0.540219 0.678980 0.036001 0.591785
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.631998 -0.141361 0.159936 0.194687 6.129598 0.180562 11.500490 0.038311 0.675061 0.691405 0.394042
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.008563 -1.211772 0.613180 0.969824 1.703009 -0.063520 0.900126 1.978352 0.687629 0.691427 0.397044
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.707980 25.740362 0.145829 1.895099 8.936354 3.396499 5.587747 37.401978 0.609309 0.583367 0.306484
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 13.522164 -0.565841 3.778419 0.291682 7.002802 0.326296 2.389370 -1.107510 0.044769 0.668885 0.529286
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.504752 -0.476264 0.969088 -1.414600 -0.443933 -0.662344 -1.541895 -0.269885 0.643882 0.645168 0.398800
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.689093 8.478016 -0.129874 0.038963 0.865611 1.488645 1.156669 5.051496 0.663952 0.672916 0.398006
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.675574 0.583751 -1.432537 0.949812 1.284012 0.907111 -0.796816 8.796440 0.677032 0.683351 0.403873
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.210984 0.219422 -0.089864 0.091571 -0.128490 0.595505 6.574348 2.080896 0.679979 0.690869 0.404659
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.298151 0.730319 -0.125404 0.203513 -0.815901 0.715788 -0.673118 -0.369789 0.676373 0.682638 0.393825
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.298437 0.262833 -0.791238 -0.301768 1.623969 0.147876 -0.570116 1.093772 0.683540 0.687562 0.388452
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.546586 13.235912 8.901628 9.535375 6.843403 6.682043 2.766237 2.370948 0.030946 0.029076 0.002226
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.511866 0.524421 0.111121 0.191916 -1.045993 0.568884 -1.194393 0.290642 0.692908 0.694509 0.395912
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.538028 0.401326 -1.019737 -0.221248 -0.590122 0.777598 -1.011982 -0.633356 0.690067 0.703325 0.393043
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.630911 3.153850 -0.020971 0.014296 -0.470415 1.802421 0.471352 3.549588 0.679979 0.680203 0.385976
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.186466 2.366559 1.110034 1.791245 -0.738298 0.319839 0.215454 -1.789254 0.671680 0.699740 0.405958
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 12.594160 1.256041 3.616192 -1.047927 6.971467 -1.068794 2.439093 3.289777 0.039166 0.655739 0.509137
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.088859 1.030449 0.732306 1.509246 -0.559633 0.831916 -1.162227 -2.430145 0.646730 0.670714 0.398841
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.130450 -0.704828 -0.631221 -1.062075 -0.361628 -0.404283 -0.094993 12.158304 0.602068 0.642469 0.396645
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.855969 28.221254 0.026717 1.120575 0.393312 0.456200 22.015162 41.096869 0.656525 0.593631 0.369381
51 N03 digital_ok 100.00% 100.00% 0.00% 0.00% 27.347440 0.934006 11.137065 -0.165630 7.232209 2.980406 10.449416 3.071861 0.042159 0.688246 0.568348
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.589757 7.531105 -0.737486 0.156030 0.317764 1.227486 2.536282 1.882549 0.683097 0.693923 0.394635
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.617333 2.570035 -0.390914 -0.204748 1.543763 1.557347 2.893395 7.324744 0.690134 0.696218 0.396332
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.630476 12.904189 8.709524 9.325961 7.015324 6.830608 3.564522 1.371273 0.030710 0.029321 0.001367
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.741318 13.664162 0.540002 9.240953 1.524743 6.868501 2.984203 3.480121 0.682518 0.035034 0.539516
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 1.629368 13.762539 0.082161 9.424609 0.099371 6.774876 3.261502 2.313266 0.684689 0.038613 0.564112
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 32.105587 0.349603 5.262011 0.250136 4.278805 1.204094 5.368062 3.064078 0.480260 0.696290 0.407601
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.111015 12.507192 8.595666 9.219516 6.964916 6.797397 4.365770 2.752079 0.036184 0.035705 0.001317
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.411851 0.504422 8.639481 0.935934 6.813839 3.016231 2.195424 6.939425 0.049763 0.693019 0.554577
60 N05 RF_maintenance 100.00% 0.00% 97.08% 0.00% 0.858699 12.366961 -0.592969 9.251972 -0.057742 6.815468 1.056338 3.281232 0.679879 0.081516 0.540109
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 3.230674 0.188006 -0.688112 -0.820268 1.555181 -1.536984 -0.702927 0.781368 0.624763 0.654283 0.384746
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.159779 1.561194 -0.968039 1.168783 0.157102 -0.529211 0.370616 -1.534650 0.619782 0.671509 0.399414
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.180017 12.824417 -0.208562 4.133949 -0.137127 6.895297 -0.751029 2.780452 0.627066 0.044405 0.490482
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.107258 0.007827 -0.482678 -0.706846 -0.788114 -1.121589 0.836096 -0.098123 0.614678 0.609730 0.384259
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.525650 0.839921 0.183648 0.593699 0.052759 0.591209 1.944828 0.427866 0.660004 0.680677 0.405493
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.432300 1.879379 1.651404 1.509034 2.359178 -0.134966 -0.113675 1.942185 0.669375 0.686454 0.399901
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.682545 -0.941950 1.649583 1.511969 -0.667548 0.430606 0.583863 1.251015 0.674890 0.691361 0.391503
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 0.973182 29.800644 0.271098 12.202643 0.048044 6.865011 3.852850 9.784419 0.686338 0.032604 0.548453
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.330467 -0.443094 0.090610 0.299582 -0.498694 1.105505 0.437776 0.241189 0.684732 0.698495 0.385083
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.586043 -0.107716 -0.692314 -0.382341 1.278453 1.384534 0.046963 -0.128862 0.692848 0.703179 0.385098
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.207496 0.153195 0.178817 0.769094 0.362793 -0.030478 1.805077 1.691010 0.697706 0.702072 0.382302
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.644330 13.781392 0.295036 9.557322 0.457668 6.698234 13.324643 1.904718 0.687368 0.035068 0.557372
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.339547 1.301112 -0.646309 1.281428 0.695221 1.928292 0.208429 0.675935 0.699643 0.698852 0.388392
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.593106 1.268376 0.195217 -0.962881 -0.919183 2.286839 -1.468083 1.307918 0.693119 0.701791 0.387467
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.072055 0.173205 0.585902 -1.423494 -0.959030 -1.127362 3.397634 -1.063868 0.661674 0.647408 0.394055
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 35.678311 0.666885 -0.560521 1.105986 1.784326 -0.593196 2.735327 0.771201 0.448036 0.662258 0.387068
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.260995 -0.407284 -0.531851 -0.767440 -0.707914 -0.797629 1.916952 -0.632785 0.634747 0.655889 0.396912
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 9.293010 14.185706 2.283522 4.025893 4.390498 6.758846 14.103501 1.239757 0.319213 0.039345 0.218847
81 N07 digital_ok 100.00% 0.00% 67.73% 0.00% -0.691692 0.724580 -0.485668 3.985516 -0.416200 73.553171 0.112377 4.387972 0.637858 0.244612 0.458634
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.972496 -1.037331 -0.137647 3.738240 -0.512325 37.013004 -0.684896 0.961768 0.652389 0.605224 0.397840
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.702385 0.037261 -0.289029 0.045636 0.106707 -0.681433 -0.192716 0.868372 0.669988 0.685315 0.389204
84 N08 RF_maintenance 100.00% 20.54% 100.00% 0.00% 22.604021 26.361766 11.189612 11.798867 5.650209 6.836717 4.783610 5.630644 0.255910 0.035546 0.170451
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.085470 0.773484 0.030395 0.305345 0.344205 0.213294 -0.376718 -0.401731 0.684983 0.693147 0.383625
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.363787 -0.167305 1.009363 0.526995 3.310891 -0.264918 0.362729 18.094654 0.670972 0.691588 0.377233
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.899284 7.984784 0.808211 -0.397865 13.066029 -0.237146 2.378160 2.553661 0.633871 0.710941 0.368380
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.732491 0.519012 -0.007665 0.649744 -0.949754 -0.197803 9.073110 2.391570 0.682435 0.697287 0.375313
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.108723 0.475449 -0.143925 0.525568 -0.738145 -0.805872 -0.823030 -0.646200 0.692131 0.699594 0.380417
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.476228 -0.541645 0.650356 0.893545 -0.396061 -0.837405 0.237701 4.911910 0.681083 0.692203 0.382797
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.509651 0.002804 0.038497 0.025681 -0.909941 -0.719592 0.197180 -0.393353 0.678286 0.697134 0.393073
92 N10 RF_maintenance 100.00% 0.00% 16.32% 0.00% 42.725395 48.198462 0.292858 0.700390 4.097980 4.046978 3.128668 8.808045 0.302181 0.254121 0.098698
93 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 2.459378 0.070897 1.823913 0.006454 -0.257167 1.043905 4.666902 0.000501 0.665886 0.690503 0.398119
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.880120 12.987140 8.838723 9.129199 6.983094 6.793765 2.310042 0.888477 0.030861 0.026301 0.002478
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.372922 0.077472 -0.425690 0.908643 -0.319754 -0.686451 0.842059 1.169292 0.637883 0.673871 0.405894
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.978288 13.722958 3.612761 4.184091 6.840726 6.669697 2.427156 0.957535 0.033135 0.038365 0.002797
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.110369 2.745097 -0.038102 -0.352693 0.594780 0.580352 4.187023 9.728101 0.586526 0.620822 0.390894
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.858929 -0.001070 -0.153647 -0.174052 -0.103963 1.070381 0.579721 2.198262 0.638561 0.657500 0.396009
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.572756 -0.921300 0.490568 0.476159 -0.789418 1.322625 0.812735 -0.584558 0.643458 0.670840 0.396576
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.468325 -0.773003 -0.243095 0.668551 0.818970 -0.407329 0.926343 2.486487 0.664188 0.677834 0.388471
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.443035 8.784166 -0.676714 0.644975 -0.016337 1.417524 0.435533 0.198323 0.687254 0.695755 0.384139
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.565382 1.107465 -0.413165 1.720258 0.250603 -0.153759 -0.054028 7.883039 0.692045 0.688532 0.379842
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.951952 6.316593 3.667149 -0.600426 14.922531 1.468963 11.432265 9.555775 0.664508 0.703990 0.384004
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.683334 66.195530 5.942281 6.384668 1.989010 3.350518 -0.516552 0.324302 0.635324 0.672907 0.379877
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.103384 -0.179471 -0.252495 0.533156 0.850998 -0.397772 -0.397760 -0.243646 0.692793 0.699320 0.371018
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.180507 -0.778062 1.203484 0.813663 3.039644 -0.762720 -0.401700 -0.091553 0.678647 0.693029 0.372516
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.618797 -0.263491 -0.558543 -0.384724 -0.083924 -0.537871 3.910823 3.634896 0.690343 0.703357 0.382411
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.806254 11.811621 8.643109 -0.693950 7.018724 4.144121 3.135329 2.602997 0.038602 0.394645 0.248322
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.528202 12.482866 8.688896 9.018531 7.086717 6.874216 1.915823 1.961322 0.028998 0.033976 0.002102
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.435110 28.163815 -0.204288 11.953758 4.614743 6.704128 17.218304 4.536066 0.677420 0.032978 0.472056
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.090293 12.409063 0.128119 9.110078 -0.045394 6.877719 4.548175 2.459790 0.672574 0.036564 0.479889
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.467475 1.612249 -0.221099 -0.300507 0.591472 1.410581 0.121280 -0.503532 0.664241 0.675737 0.402337
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.829432 13.780436 3.420513 4.090548 6.871557 6.704104 2.861430 0.837371 0.035007 0.030950 0.002263
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 3.820869 1.151660 -0.126785 -0.261629 1.420338 -0.641166 0.570141 -0.137088 0.582307 0.654500 0.409885
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.352686 2.383190 1.129388 2.031689 0.400396 0.532950 -1.689579 -1.998393 0.627664 0.652662 0.414198
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.391567 0.012377 -0.331027 0.289083 0.386760 0.148015 0.527357 0.002504 0.633113 0.652088 0.393939
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.668532 14.101524 8.738774 9.539949 6.889574 6.808232 2.642578 3.883122 0.027314 0.031438 0.002442
118 N07 digital_ok 100.00% 0.00% 0.00% 0.00% 0.368535 1.425963 -0.335092 0.302148 -0.731734 -0.659049 4.394922 5.546136 0.661566 0.682557 0.391572
119 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.846419 0.953224 -0.974085 -0.700975 0.633419 2.976954 0.044932 2.500299 0.675560 0.689737 0.389259
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.235874 3.290525 2.062150 2.033759 -0.325312 0.606655 0.493412 -2.553893 0.673472 0.696916 0.377496
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.603096 5.003376 -1.343914 0.180932 -0.102104 7.059555 6.040262 16.547417 0.690944 0.704333 0.379627
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 9.525032 6.836576 -0.342618 0.369788 2.559456 0.984768 0.685566 -0.684993 0.700649 0.706669 0.380652
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.377218 9.947514 0.171264 0.642158 0.735624 0.468307 -0.216390 0.269211 0.702138 0.711181 0.380430
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -1.109309 -0.301397 -0.357284 0.269857 -0.458282 0.371423 0.611408 0.675929 0.697405 0.708255 0.379443
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.027789 -1.273094 -0.729884 0.537434 -0.834749 -0.111290 -0.278266 -0.280715 0.692232 0.698496 0.380737
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.603643 -0.533957 -0.777351 0.549933 2.534680 1.561823 5.977320 -0.149404 0.688841 0.697846 0.389018
127 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 0.269726 0.500517 -0.221613 0.025407 1.852997 1.247179 1.654371 6.754220 0.685603 0.705101 0.399024
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.207540 11.997519 8.743023 9.210669 6.963360 6.736103 1.784220 0.937124 0.030244 0.026357 0.002121
129 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
130 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.767813 13.904856 3.648674 4.299657 6.985581 6.801214 4.082291 0.245161 0.033529 0.038445 0.002299
132 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.798623 1.101615 -0.738657 -1.297001 14.794777 -0.614159 -0.622424 -0.866391 0.620897 0.644641 0.393840
133 N11 not_connected 100.00% 100.00% 72.00% 0.00% 13.309296 18.265312 3.426682 2.948175 6.964780 5.588435 2.832661 0.661075 0.042091 0.199136 0.111271
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.627955 -0.737600 0.239538 -1.190165 3.622157 0.361584 11.182294 0.310566 0.633570 0.660825 0.413708
136 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 4.431893 -0.183587 5.894359 3.479862 11.590207 19.342587 0.237245 -0.159023 0.532702 0.633044 0.400748
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.075634 -0.707642 -0.553598 -0.981417 1.248453 -0.642323 0.338006 1.332967 0.646119 0.671316 0.400808
138 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.453011 -0.090492 0.321947 1.219617 -0.350865 -0.052759 3.269191 0.375367 0.666476 0.681030 0.396190
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.474193 -0.295296 1.463699 -0.753760 0.398535 -1.512222 -0.356285 1.158511 0.669272 0.674875 0.385311
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.254784 -0.448533 -1.253647 -0.256450 -0.749462 -0.856685 4.949063 2.283197 0.682262 0.703976 0.385108
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.607280 -0.452683 -0.841587 0.670386 0.796836 -1.249968 0.470662 -1.715785 0.686053 0.704456 0.382645
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.686957 12.350706 -1.218325 9.256877 1.379890 6.831785 20.294043 1.983819 0.690056 0.049128 0.575945
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.671460 -0.425477 5.173420 -0.312786 -0.785068 1.365335 -0.310391 -0.137122 0.638326 0.709911 0.409800
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.992418 -0.380874 -0.596184 2.491617 0.348827 0.159179 -0.363022 -0.074918 0.693989 0.693817 0.386102
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.374735 1.959131 -0.447312 5.235606 -0.518235 7.203206 0.457468 0.692849 0.690338 0.648820 0.405263
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 13.013023 -1.154284 3.437880 0.068972 6.946214 -0.974320 1.645170 -1.408021 0.036643 0.693765 0.561567
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.339542 -1.389578 0.953224 1.798847 0.294866 -0.145530 -0.206639 -0.394086 0.674026 0.690581 0.395209
148 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.485228 -0.017156 8.579357 1.228440 7.091391 1.959446 1.931893 -0.256116 0.031816 0.692673 0.530407
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.886898 1.585419 -0.997643 1.716311 -0.910691 -0.298030 -0.127682 -1.748128 0.671500 0.691533 0.410299
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.147496 0.258446 1.379324 0.817102 0.771739 -1.105348 -1.137519 -1.355700 0.666867 0.688485 0.416741
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 24.975150 0.831525 0.027894 0.001242 4.805612 -1.037510 8.076928 -0.052236 0.533924 0.628358 0.387761
152 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 1.014853 1.284741 -1.216581 -1.036552 0.536144 -1.396662 5.829130 0.429968 0.613560 0.646970 0.412736
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 12.142518 -0.232528 3.570483 -0.463800 6.947695 2.536927 2.336921 0.435422 0.041990 0.643204 0.574090
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.581369 -0.957364 0.591914 0.073247 -1.012472 -1.489915 -1.235423 -0.684208 0.603745 0.637579 0.422582
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.364133 -0.527309 8.411314 -0.981112 7.089614 0.510375 2.068209 0.704233 0.035732 0.661247 0.504087
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.320570 12.112157 3.084053 9.004995 -0.600203 6.870485 1.235943 0.761343 0.614721 0.039647 0.497712
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.129265 -0.218499 -0.391642 0.327322 -0.496051 0.742673 -0.111633 -0.157502 0.651558 0.667305 0.398632
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.225212 -0.050010 -0.832311 -0.944336 1.817378 2.019809 6.942908 17.808435 0.667444 0.680478 0.401494
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.430921 29.025111 -1.213002 -0.748340 -1.086769 4.207712 -0.457189 57.665904 0.641335 0.545403 0.362581
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.965956 -1.110409 -0.591185 -1.053781 -0.503642 1.698653 0.455734 0.344050 0.676441 0.689889 0.389195
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.966282 32.333053 -0.459274 -0.636825 0.029874 0.256411 -0.491475 0.966776 0.679001 0.567534 0.348106
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 2.392970 0.331831 2.214179 1.289552 0.385405 -0.916493 -0.024289 -1.789251 0.683430 0.701138 0.383895
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.139380 -0.048906 -0.544800 0.099705 -0.157290 0.446983 -0.072430 1.257322 0.692202 0.695621 0.390686
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.617867 0.380831 1.451347 -0.487835 6.934092 1.690711 1.046679 1.266046 0.679336 0.698363 0.384245
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 33.642145 0.353018 1.992427 0.225403 2.474643 0.161737 2.365293 -0.252626 0.527704 0.697623 0.385328
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.553118 2.362115 -0.108995 0.291579 -0.016014 36.449783 5.977198 0.451161 0.684488 0.694703 0.395965
167 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.535230 -1.313840 -0.626081 3.255101 1.241264 -0.660865 -0.765611 4.829952 0.688876 0.680133 0.406502
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.808823 -0.916781 -0.305752 -0.678596 1.324229 0.744518 0.260149 1.473883 0.676750 0.698482 0.409588
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.889996 2.653847 -1.191263 -1.152909 0.390524 -0.423884 -0.893521 -1.222740 0.674730 0.680567 0.408508
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 12.460378 -0.426271 8.851099 -1.090126 6.849314 2.705118 2.265498 0.641321 0.038568 0.690366 0.567789
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.813672 2.431801 -1.028815 -0.039007 -1.287431 0.198675 -0.476842 1.577320 0.618895 0.604809 0.393105
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 13.974101 13.600080 3.229632 3.805444 7.175311 6.914348 4.748903 7.381923 0.038540 0.043295 0.001136
174 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 295.035114 294.991183 inf inf 4139.224816 4139.321893 11300.843568 11303.265273 nan nan nan
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.092637 -0.392112 1.358672 1.789547 0.373914 0.748743 -0.002504 0.078935 0.651479 0.664415 0.398414
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.202925 13.332640 0.158975 9.372043 0.221004 6.752877 27.386937 2.491619 0.666981 0.054348 0.577117
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.690020 0.001070 -0.474707 0.135232 0.605566 -0.162342 -0.549328 3.972579 0.678006 0.683659 0.395386
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.083669 5.021497 -0.298953 2.958236 -0.623747 2.743969 17.363913 -1.128387 0.685494 0.680548 0.400971
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.535176 2.236196 1.210317 4.723675 0.631892 -1.392037 0.427632 -0.408719 0.663780 0.633702 0.383042
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.456450 -0.666437 -0.374284 2.988151 -0.128089 -0.406862 0.675864 0.217990 0.683255 0.682251 0.387692
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 21.292040 -1.510077 6.907611 3.592006 6.598476 -0.898536 0.974008 0.079154 0.392084 0.664840 0.419675
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.586350 -1.182031 -1.015109 -0.264699 0.658944 -0.456830 0.507666 -1.666054 0.686813 0.701861 0.401478
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.055658 -0.822433 -0.999430 -0.818327 -0.359733 34.746305 1.597973 10.560489 0.684683 0.696631 0.396890
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 9.770813 9.772813 1.590275 0.184130 2.230856 5.015326 3.002503 1.729443 0.360465 0.387077 0.178179
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.197083 -1.340488 -0.894888 0.289435 -0.314264 -0.759266 -0.106219 -1.516375 0.666540 0.688514 0.420324
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.781405 0.341762 0.723009 -0.685475 0.759452 0.919243 14.757241 2.610543 0.653085 0.678804 0.418312
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.806472 8.273748 4.160456 4.192042 5.121106 5.183870 -1.897337 -3.398844 0.610815 0.632094 0.407516
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 7.949566 0.320068 4.373400 1.019082 5.471017 0.006854 -1.838860 -0.478150 0.598668 0.648852 0.434653
194 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 288.661947 288.713583 inf inf 2993.311150 3076.093865 6655.340478 7189.250171 nan nan nan
200 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
201 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 221.379944 221.018895 inf inf 3423.149179 3689.605950 6244.692768 8016.745052 nan nan nan
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 274.562517 274.381702 inf inf 2663.295847 2605.565141 6339.621478 6857.001172 nan nan nan
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.803635 2.960911 0.691787 -1.255403 -0.763283 -0.239780 -0.889027 9.528581 0.656614 0.648432 0.390695
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.110275 1.396487 0.322829 -0.731662 9.912750 -1.129380 0.729564 4.327425 0.652410 0.652578 0.390578
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 3.411153 2.740152 1.347874 -0.847050 0.608314 12.552381 -0.920499 -0.382089 0.639964 0.643269 0.379362
213 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 274.806337 274.619025 inf inf 2997.024109 3006.999730 6563.115682 6717.428419 nan nan nan
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 290.616708 290.564414 inf inf 4153.037490 4152.523061 11441.394871 11438.534862 nan nan nan
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 270.038710 270.141169 inf inf 3307.938042 3297.559761 5668.431445 5328.628227 nan nan nan
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 279.017380 279.361894 inf inf 2262.905757 2251.352597 5841.992597 5678.697821 nan nan nan
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.167353 1.366830 -1.204360 -1.095468 -0.740718 39.162481 0.829334 23.595905 0.636482 0.623330 0.395182
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 8.382477 7.943793 4.598797 4.244435 5.340687 5.307974 -1.892539 -3.308799 0.626815 0.637629 0.393840
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 264.260898 264.175270 inf inf 3533.923423 3506.653106 6084.228809 5841.092744 nan nan nan
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
238 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 227.465303 228.144491 inf inf 3222.392525 3156.425097 6707.803792 6672.467920 nan nan nan
239 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 225.432476 224.262795 inf inf 3693.966576 3556.474488 7098.774454 6210.152436 nan nan nan
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% 260.783806 260.114766 inf inf 3077.852001 3194.249219 4482.270249 3843.868480 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% 202.984113 203.205244 inf inf 3018.503154 2997.423270 5113.739879 4914.034945 nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.274420 13.729853 -0.597666 6.020050 -0.623120 6.882399 7.102614 3.174575 0.652189 0.050088 0.558303
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.622594 3.142347 1.189336 1.451772 1.125952 0.257192 0.798487 -1.244970 0.542386 0.562531 0.393180
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.490191 -1.382457 1.266527 -1.058917 0.654740 -0.945772 -1.433007 0.391709 0.578023 0.581904 0.397468
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.265374 -0.308033 0.082542 -0.212506 4.529759 -0.943040 7.988073 0.899100 0.524042 0.559376 0.395153
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.442309 1.004407 -0.981378 -1.205828 -0.886671 -1.289171 1.529811 0.885313 0.502741 0.550619 0.396929
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 9, 15, 16, 17, 18, 27, 28, 29, 30, 32, 34, 36, 37, 38, 42, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 78, 80, 81, 82, 84, 86, 87, 88, 90, 92, 93, 94, 96, 97, 101, 102, 103, 104, 108, 109, 110, 111, 113, 117, 118, 121, 122, 123, 126, 127, 128, 129, 130, 131, 132, 133, 135, 136, 140, 142, 143, 145, 146, 148, 151, 152, 153, 155, 156, 158, 159, 161, 164, 165, 166, 167, 170, 173, 174, 180, 182, 183, 185, 187, 189, 191, 192, 193, 194, 200, 201, 202, 203, 205, 206, 207, 213, 219, 220, 221, 222, 223, 224, 225, 226, 237, 238, 239, 240, 241, 242, 243, 320, 329]

unflagged_ants: [5, 8, 10, 19, 20, 21, 22, 31, 35, 40, 41, 43, 44, 45, 46, 48, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 77, 79, 83, 85, 89, 91, 95, 98, 99, 100, 105, 106, 107, 112, 114, 115, 116, 119, 120, 124, 125, 137, 138, 139, 141, 144, 147, 149, 150, 154, 157, 160, 162, 163, 168, 169, 171, 179, 181, 184, 186, 190, 324, 325, 333]

golden_ants: [5, 10, 19, 20, 21, 31, 40, 41, 44, 45, 65, 66, 67, 69, 70, 83, 85, 91, 98, 99, 100, 105, 106, 107, 112, 116, 124, 141, 144, 147, 149, 150, 154, 157, 160, 162, 163, 168, 169, 171, 181, 184, 186, 190]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2459918.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 [ ]: