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 = "2459938"
data_path = "/mnt/sn1/2459938"
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-24-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/2459938/zen.2459938.21325.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 1849 ant_metrics files matching glob /mnt/sn1/2459938/zen.2459938.?????.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/2459938/zen.2459938.?????.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 2459938
Date 12-24-2022
LST Range 0.759 -- 10.710 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1849
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 94
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (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 67 / 201 (33.3%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 130 / 201 (64.7%)
Redcal Done? ❌
Never Flagged Antennas 68 / 201 (33.8%)
A Priori Good Antennas Flagged 57 / 94 total a priori good antennas:
3, 7, 9, 15, 16, 17, 21, 29, 30, 37, 38, 40,
42, 45, 53, 54, 55, 56, 71, 72, 81, 86, 91,
94, 98, 99, 100, 101, 103, 105, 107, 109, 111,
116, 121, 122, 123, 128, 129, 130, 136, 140,
143, 146, 158, 161, 164, 165, 170, 181, 182,
183, 185, 187, 189, 191, 202
A Priori Bad Antennas Not Flagged 31 / 107 total a priori bad antennas:
8, 22, 43, 48, 49, 61, 62, 64, 77, 79, 82,
89, 90, 95, 114, 115, 120, 125, 132, 137, 139,
207, 211, 220, 223, 237, 238, 245, 261, 324,
325
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459938.csv

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 9.429393 13.839670 9.292337 0.602100 6.514538 3.451267 0.592177 3.718706 0.034190 0.350292 0.276547
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.315338 1.656960 1.106639 2.162247 0.171438 1.025715 7.202333 2.342607 0.647322 0.654792 0.409501
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.220706 -0.089186 -0.237720 -0.252492 -0.120151 1.335824 1.362978 0.294147 0.646545 0.659551 0.408111
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.677455 -0.851297 0.742285 3.194975 -0.322322 -0.245073 20.065768 13.799803 0.637437 0.642998 0.397064
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.231166 -1.079905 -0.853689 -0.207990 -0.172482 0.590209 3.610422 2.836291 0.647279 0.658194 0.398316
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 3.653187 -0.133920 7.634082 0.188018 2.606717 0.389365 -0.192917 -0.182270 0.483698 0.655012 0.468541
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.673463 -0.575007 -0.309605 -0.774081 -0.460166 0.816878 1.498979 3.257938 0.633955 0.646785 0.402285
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 9.604345 16.342733 8.732641 1.742754 6.519825 3.370976 -0.004126 1.571273 0.032449 0.345215 0.264172
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 9.672691 -0.379479 9.262533 0.359050 6.517178 1.633347 0.517004 1.607177 0.032763 0.663438 0.537309
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 1.085396 1.999721 0.076460 0.122915 0.193683 0.771007 4.981966 3.944439 0.649939 0.663866 0.406142
18 N01 RF_maintenance 100.00% 100.00% 60.19% 0.00% 10.290538 17.583484 9.259590 0.338059 6.664158 4.352563 0.515026 20.149527 0.029546 0.219829 0.166195
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.948894 -1.123966 -0.608308 3.109834 0.442775 0.629432 0.132631 2.910588 0.648796 0.648019 0.396650
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.033811 -0.977106 3.429983 -1.150828 -0.209388 -0.288387 1.224148 -0.459736 0.635974 0.668401 0.412368
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.403338 -0.096969 -0.246000 4.024984 0.409834 0.092705 -0.103130 -0.142767 0.636250 0.622306 0.398886
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.936568 -0.705604 -0.178879 -0.410776 1.937823 0.975613 -0.410824 -1.115335 0.613298 0.628540 0.397542
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.980299 10.115833 9.308836 9.771110 6.641149 7.277349 2.121786 1.812086 0.035786 0.040289 0.006049
28 N01 RF_maintenance 100.00% 0.00% 85.02% 0.00% 11.595532 24.453687 -1.305779 0.962640 3.309948 4.522820 3.792202 17.991187 0.363216 0.163925 0.262989
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 9.637428 10.537815 8.926291 9.391271 6.631339 7.265044 0.499478 0.255847 0.029478 0.037151 0.007687
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.091458 0.185034 -0.449243 0.351087 3.797862 0.348678 23.305542 0.488280 0.656984 0.666712 0.399170
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.338899 -0.913991 0.678734 1.125650 1.292632 0.417441 0.452022 1.453343 0.663133 0.665815 0.400521
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.941981 18.303400 0.002869 2.065541 6.882193 3.208961 34.459058 117.911241 0.600858 0.576435 0.347626
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.057434 11.593052 4.076298 4.429807 6.571263 7.221809 0.793981 0.647414 0.035318 0.043658 0.005616
35 N06 not_connected 100.00% 0.00% 0.00% 0.00% 0.070021 -0.616786 0.701441 -1.334037 -0.666527 -1.062100 5.974634 -0.148542 0.623462 0.623486 0.392761
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.814613 6.907664 -0.001697 0.111064 0.741243 1.576427 2.691108 2.694302 0.644015 0.654289 0.405991
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.414081 0.265060 -1.414685 0.487371 0.430134 1.425030 -0.483223 6.723104 0.657707 0.664873 0.409910
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.153866 0.206440 0.028803 0.352510 0.234606 0.032083 5.961699 1.095651 0.658825 0.671271 0.410879
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 9.027940 0.589490 8.952289 0.324395 6.636072 -0.536114 0.684631 0.037449 0.039130 0.662823 0.524935
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.697330 0.087879 -0.662098 -0.137536 1.493096 0.304344 -0.484372 1.797306 0.660386 0.669744 0.392366
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.220486 11.062158 9.532029 10.216109 6.413108 7.080352 0.908566 1.790485 0.031031 0.029064 0.002266
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.036679 0.568801 -0.535145 0.337781 -0.181963 0.675933 -0.364440 2.715254 0.666495 0.671288 0.400053
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.294986 0.465623 -1.423595 -0.089024 -0.209208 0.626041 -0.722786 -0.315314 0.667257 0.677812 0.398548
45 N05 digital_ok 100.00% 100.00% 100.00% 0.00% 181.655763 182.536197 inf inf 3788.592238 3729.314476 7832.424693 7643.734561 nan nan nan
46 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 213.687498 213.177256 inf inf 2909.968404 2906.102611 6772.926038 6998.435130 nan nan nan
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 10.280807 11.327754 3.904749 4.072225 6.552586 7.179678 1.245741 0.487860 0.030534 0.053312 0.015532
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.103459 0.384583 0.232679 1.311804 1.497991 1.155975 1.691946 -0.819691 0.627051 0.646449 0.395705
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.441566 -0.848290 -0.577947 -0.538496 -0.348154 -1.190047 -0.181910 1.336203 0.582162 0.628659 0.400806
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.112980 2.080093 0.461971 0.686045 2.190366 1.157650 70.720588 35.395246 0.600729 0.639749 0.366843
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 22.074641 3.124963 11.884767 -0.854830 6.815137 4.326874 8.610670 0.345708 0.043137 0.554657 0.430686
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.547224 5.949992 -0.761868 0.302433 0.877004 0.935447 2.091219 1.081615 0.658735 0.672483 0.398707
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.294718 2.494280 -0.340396 -0.097797 1.554065 1.565704 3.512128 5.207166 0.666859 0.678205 0.406134
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.485626 10.755462 9.315533 9.981509 6.598306 7.241699 2.009806 1.214461 0.030647 0.029185 0.001332
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 9.946063 11.372172 9.332808 9.890118 6.640923 7.272792 0.803075 2.681631 0.027781 0.031612 0.003440
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.093593 11.512073 0.210223 10.091873 -0.431964 7.154632 1.122473 0.730482 0.664223 0.040164 0.554737
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 14.105018 2.723525 8.234894 0.356290 4.863000 1.723630 1.167409 2.684125 0.295153 0.673006 0.463343
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 8.996013 10.465955 9.200479 9.875851 6.515452 7.182934 1.127957 0.915355 0.037864 0.036794 0.001438
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.106019 0.771506 9.253156 1.034124 6.406411 2.446340 0.925211 12.714190 0.050246 0.666548 0.547048
60 N05 RF_maintenance 100.00% 0.00% 98.65% 0.00% 0.649290 10.351554 -0.572836 9.908934 0.018045 7.213417 0.706098 2.391541 0.656222 0.076440 0.541897
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.509594 0.878390 -0.581910 -1.567815 1.118950 -1.168490 -0.673073 0.574829 0.600856 0.633583 0.391287
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.085900 0.849652 -1.082619 0.877524 -1.237274 -0.636733 1.109982 -1.377012 0.603348 0.648195 0.399281
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.019054 10.737732 -0.576203 4.462502 -0.459985 7.300215 -0.566839 2.596919 0.623156 0.044873 0.501703
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.020418 -0.076723 -0.834969 -1.062866 -1.271465 -1.354589 0.295777 -0.077936 0.609129 0.608139 0.381627
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.467206 0.907302 0.321392 0.819598 0.270533 1.263132 1.514328 1.440558 0.641435 0.660942 0.412331
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.500615 1.298487 1.822859 1.756204 2.153001 -0.127906 0.010755 1.816147 0.649172 0.665973 0.403236
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.923632 -0.732172 1.259737 1.117510 -0.160421 0.512202 0.631825 2.055284 0.657603 0.671747 0.399768
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 21.333679 24.397796 1.001090 13.033648 2.762177 7.284875 -0.267621 8.779335 0.367878 0.030660 0.275036
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.361467 -0.152173 0.177145 0.451936 -0.539939 1.297130 -0.127967 0.009213 0.662065 0.677383 0.389870
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.675519 -0.004867 -0.590733 -0.262542 0.941031 1.241178 -0.028202 -0.157123 0.670393 0.682839 0.391872
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.240233 0.168206 0.280097 0.923185 0.807585 0.059025 0.951874 1.077633 0.679475 0.682365 0.388246
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.512336 11.546101 0.505022 10.240638 0.154963 7.105038 17.693067 1.570411 0.667208 0.036525 0.548331
73 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 168.802041 167.593355 inf inf 3453.080373 3445.456823 7002.317066 6991.305337 nan nan nan
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.577327 5.008499 -0.139179 -0.888959 -0.206388 2.726149 -1.301549 2.020899 0.671041 0.665787 0.386742
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.325418 0.592538 0.273233 -0.346802 -0.994072 -1.005836 3.030941 -0.949608 0.640698 0.643682 0.390947
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 28.871658 -0.042034 -0.446478 0.755761 1.350797 -0.547453 4.151016 2.888587 0.427065 0.652379 0.397955
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.081180 -0.577119 -1.610024 -0.254164 -1.161493 -1.534591 0.472980 -1.281583 0.610813 0.643226 0.398998
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 2.898034 11.848215 2.586133 4.354436 2.150765 7.154432 -0.807926 0.895412 0.613603 0.050215 0.476545
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.333740 11.222963 -0.362143 8.558285 -0.329122 6.985168 0.131877 1.609340 0.617934 0.041153 0.488827
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.506936 -0.278353 0.035919 1.728413 0.384706 0.190440 -0.434565 -0.215768 0.635474 0.648969 0.398145
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.495769 0.094117 -0.141549 0.241577 0.065590 0.477737 -0.608035 0.701447 0.648330 0.664643 0.396708
84 N08 RF_maintenance 100.00% 44.40% 100.00% 0.00% 18.233159 21.517309 11.960905 12.609746 5.196454 7.205284 3.499205 4.412235 0.230663 0.037470 0.149951
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.169737 -0.157182 0.163570 0.460372 0.222461 -0.096167 -0.802122 -0.416069 0.662864 0.673700 0.392246
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.142809 1.651050 1.120422 0.722212 2.233600 -0.945397 0.257604 17.388565 0.644162 0.650772 0.366440
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.390116 6.854674 0.035692 -0.286517 11.827051 -0.036759 2.588208 3.959971 0.626861 0.688491 0.378171
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.599547 0.589542 0.049951 0.795352 -0.908792 -0.262740 1.188395 0.500030 0.661031 0.676548 0.381710
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.988601 0.248938 -0.035919 0.697118 -0.875375 -0.606348 -0.757956 -0.438119 0.671139 0.675429 0.387193
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.508121 -0.541743 0.750904 1.158153 -0.931425 -0.676133 -0.039537 3.646407 0.660691 0.665039 0.387474
91 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
92 N10 RF_maintenance 100.00% 0.00% 18.98% 0.00% 34.444089 39.674888 0.377313 0.972987 3.595205 4.072062 0.855519 8.652398 0.287137 0.240546 0.092738
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.799447 0.281064 2.121641 0.145150 0.386947 0.721148 3.825010 0.019838 0.646023 0.667752 0.397679
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.412173 10.853207 9.447781 9.778535 6.546207 7.201023 0.694759 0.595495 0.032048 0.026499 0.002386
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.345841 -0.826303 -0.903404 0.441524 -0.784112 -0.716414 -0.201413 1.877828 0.626326 0.653701 0.399919
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 10.588504 11.510777 3.909816 4.528301 6.417791 7.068713 0.703916 0.625983 0.034132 0.040769 0.003247
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.753170 6.869738 0.005079 2.558198 -0.813814 3.261682 5.103828 3.571606 0.568448 0.496956 0.374929
98 N07 digital_ok 0.00% 19.63% 19.31% 0.00% 0.470440 2.964789 -0.058486 -0.187170 -0.413374 0.337169 0.917766 1.881500 0.467760 0.481828 0.293170
99 N07 digital_ok 0.00% 19.58% 18.93% 0.00% 3.539533 -0.622193 0.641132 0.572993 -0.958167 1.575290 0.937481 0.184025 0.463845 0.495939 0.302394
100 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 216.217632 215.856625 inf inf 3390.439345 3245.670829 6309.863344 5541.106023 nan nan nan
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.413249 7.712108 -0.614824 0.825707 0.107303 1.528286 0.920972 1.912920 0.664089 0.675403 0.391457
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.051558 0.771735 -0.879495 1.978393 0.102264 0.480852 -0.316455 6.297611 0.671541 0.667676 0.385642
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.654465 4.421686 -1.243224 -0.534143 2.373156 1.375339 11.618450 4.243600 0.671397 0.681434 0.380358
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.360524 54.682827 6.461719 6.915254 1.682296 2.385537 -0.257271 -0.067662 0.611636 0.651953 0.386358
105 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.004867 0.545543 0.935425 0.977608 0.710045 -0.710435 -0.428969 0.803685 0.659078 0.671323 0.374243
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.581246 0.844563 -1.085380 -1.019147 -0.065145 -0.238270 9.479367 7.738856 0.670314 0.679090 0.383366
108 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% 238.096666 237.868917 inf inf 3395.106809 3195.445417 6241.134986 5098.206979 nan nan nan
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.350507 10.445075 9.292519 9.657662 6.656540 7.275413 0.273890 1.686932 0.026918 0.026836 0.001345
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 24.025668 23.033063 12.408555 12.779607 6.530794 7.100000 3.690080 4.011711 0.024303 0.027172 0.001556
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.105752 10.365922 0.259024 9.753818 0.061576 7.279780 13.963073 2.053976 0.658011 0.037683 0.481331
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.661590 -0.020277 -0.104590 -0.161311 0.537727 1.858547 0.381914 -0.375653 0.650045 0.663292 0.402778
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.296840 11.531176 3.704434 4.427641 6.440522 7.108013 1.204544 0.499290 0.036125 0.030899 0.002628
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.932031 0.686405 -1.239929 -0.316292 0.640975 -0.824627 0.553446 0.816996 0.595025 0.637278 0.402154
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.493727 1.445743 1.111854 1.792368 -0.047638 1.065548 -1.884122 -1.822457 0.610629 0.631756 0.410915
116 N07 digital_ok 0.00% 19.96% 19.31% 0.00% -1.267576 0.105191 -0.148549 0.469058 0.682487 0.398296 0.483856 0.317999 0.466359 0.481972 0.297074
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.336086 11.864859 9.357107 10.219694 6.458680 7.202097 1.117765 3.410433 0.027404 0.032601 0.003615
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.682378 1.159756 -0.248667 0.437286 -0.420401 -0.054174 0.571358 1.269613 0.638347 0.661494 0.400763
119 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.696042 2.120364 2.339695 1.837141 -0.024287 0.961874 0.495552 -2.361943 0.649892 0.673964 0.383119
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.527698 2.759310 -1.199147 5.812845 1.305079 0.701153 30.853898 14.020995 0.674474 0.654011 0.380892
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.778945 6.035450 0.250802 0.546922 0.853726 1.163178 0.310702 -0.549834 0.678504 0.686943 0.385375
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 5.781296 7.563339 0.335519 0.863448 0.715714 0.196595 -0.329053 0.317636 0.681423 0.686866 0.387190
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.447228 -0.059548 -0.255273 0.450524 -0.354849 0.633114 0.888537 0.675908 0.682905 0.689358 0.388450
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.442764 -0.861641 -0.670247 0.743378 -0.458007 -0.664686 -0.443872 -0.042208 0.678774 0.678467 0.386441
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.856492 3.592881 -0.645772 1.264535 8.099780 0.626985 110.185781 2.401999 0.616617 0.670164 0.386294
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.501183 0.465684 -0.078097 0.171200 2.033845 1.362215 -0.223815 0.437960 0.669816 0.683784 0.396748
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 8.656262 9.996899 9.353669 9.868494 6.491928 7.136957 0.091054 0.551287 0.031566 0.026298 0.002387
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% 0.00% 15.58% 0.00% -0.527147 10.789407 -0.101631 4.381335 -0.836480 6.402568 -1.280476 -0.262863 0.632073 0.268848 0.451807
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.745710 0.279426 -0.466002 -1.631343 1.242546 -0.557535 -0.542474 -0.515410 0.615239 0.629240 0.396065
133 N11 not_connected 100.00% 100.00% 0.00% 0.00% 10.857937 -0.313598 3.705327 -1.513347 6.537480 -1.376090 1.238345 -0.509686 0.051116 0.620016 0.476274
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.499434 -0.756109 -0.222871 -1.622731 3.803537 0.421795 22.174986 0.461467 0.615044 0.647522 0.419099
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 8.616484 3.405721 8.906801 2.493353 6.650357 17.546603 1.273628 0.573840 0.041797 0.616402 0.459138
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.187346 -0.748912 -0.436084 -1.414397 1.281549 -0.869681 0.399192 1.108510 0.625949 0.655430 0.407119
138 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 191.495610 191.731840 inf inf 3491.645262 3428.246841 6402.956326 6108.485593 nan nan nan
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.926542 -0.258336 1.214637 -1.190030 -0.181433 -1.049792 0.217097 0.954422 0.649400 0.656448 0.387584
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.596894 -0.594068 -1.149210 -0.614884 -0.631579 -0.755162 5.498839 2.513446 0.662279 0.685462 0.388440
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.145731 -0.642804 -0.741876 0.332163 0.586748 -1.166148 0.566218 -1.365115 0.668207 0.687391 0.385266
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.898588 10.394796 -1.173162 9.916381 1.192749 7.236049 19.760625 1.570529 0.673216 0.051317 0.538866
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% 0.621592 10.829144 5.663207 9.888036 -0.963664 7.042550 0.501785 0.884547 0.616168 0.038690 0.500733
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.120354 0.477181 -0.589778 0.535862 1.082041 0.598135 -0.680170 0.706010 0.679804 0.688726 0.385097
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.988404 1.617237 -0.490179 5.403680 0.164922 9.009591 0.243047 0.534066 0.674399 0.634545 0.396729
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 10.595084 -1.238743 3.716889 -0.288389 6.511727 -1.101077 -0.022039 -1.228794 0.038713 0.674867 0.518772
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.385525 -1.132926 1.041995 2.003019 0.318187 -0.301271 -0.321897 -0.394106 0.659950 0.672056 0.389559
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.595993 0.015833 2.645701 1.430963 0.130567 1.639339 -0.550984 -0.376006 0.646481 0.673739 0.401018
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.768730 0.956709 -1.589702 1.466397 -0.371334 -0.126335 -0.784489 -1.895064 0.661067 0.673973 0.404687
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.725101 -0.185100 1.142303 0.466364 0.188042 -1.018671 -0.367363 -0.172871 0.652906 0.668131 0.410940
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.130733 -0.804871 8.993628 -1.287451 6.650958 0.694004 0.489596 0.576693 0.038199 0.643952 0.481241
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.475495 10.181490 7.526912 9.674435 2.832364 7.291331 0.479463 1.914861 0.459139 0.041295 0.360058
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.181449 -0.048292 -0.294163 0.477996 -0.451578 0.386792 -0.316267 -0.034532 0.629558 0.652263 0.405454
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.624771 -0.190049 -0.737147 -1.255675 1.477374 1.020838 5.158942 11.858404 0.645853 0.667943 0.407965
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.190460 22.679856 -1.634683 -0.972053 -1.157453 6.383316 -0.235114 63.596979 0.621863 0.540350 0.366675
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.840144 -0.724041 -0.496978 -0.981787 -0.424670 1.499647 0.480919 0.546987 0.657669 0.674267 0.391762
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.768654 26.267266 -0.356999 -0.689858 0.129375 0.621537 -0.490596 2.796750 0.662815 0.544661 0.347496
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.688960 0.203790 2.030249 1.080283 0.156265 -0.833235 0.024448 -1.514435 0.669915 0.685723 0.387275
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.017529 1.177576 -0.445152 0.245549 0.024287 0.746778 -0.207576 1.248922 0.679767 0.688512 0.391211
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.491069 0.404460 1.669596 -0.350934 5.298086 1.965287 0.536048 0.580491 0.665635 0.685999 0.384148
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 27.116338 0.247715 2.194949 0.372067 2.657820 0.304307 0.713971 0.085644 0.515975 0.684918 0.381431
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.336772 0.699324 0.211097 2.070045 0.383023 0.680251 5.320120 9.521536 0.672663 0.675753 0.387427
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.166911 -0.322453 -1.060219 3.482362 0.628069 -0.813357 -1.186701 1.452606 0.677629 0.661396 0.399076
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.721879 -0.830763 -0.183145 -0.562861 1.144955 0.470246 -0.279824 0.340691 0.665749 0.680958 0.401708
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.605022 -0.699697 -1.178960 -1.617255 0.286685 0.197384 -0.944961 -1.037992 0.664441 0.679819 0.401483
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.143638 -0.233662 9.476225 -1.073143 6.430932 0.588682 0.643021 1.646118 0.040778 0.672886 0.528377
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.372198 -0.140228 1.512939 3.508780 -0.355322 14.582934 -0.443907 1.459930 0.629686 0.637373 0.394403
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.182728 11.149597 -0.469939 10.040456 1.464555 7.168112 24.781934 2.444383 0.655208 0.056152 0.540364
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.479952 0.163433 -0.244208 0.233417 -0.126704 0.491745 -0.480461 4.272862 0.663504 0.675746 0.396071
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.289834 10.154746 -0.777165 9.648227 0.102673 7.308605 10.503963 2.122666 0.671923 0.051525 0.513030
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.586587 0.270583 0.935184 4.653141 0.817989 -0.715197 0.246017 -0.149312 0.656957 0.635245 0.375998
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.178950 -0.311968 0.570891 3.231559 0.269324 -0.540853 0.739427 0.207098 0.665231 0.665684 0.378432
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 16.127238 -1.188442 7.713412 4.103093 6.841825 -0.885917 0.786914 -0.088981 0.359398 0.653426 0.416899
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.577927 -1.301723 -1.489748 -0.708048 0.545640 -0.631307 -0.465823 -0.823392 0.677638 0.693535 0.397175
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.038595 -0.258171 -1.396361 1.023363 -0.043438 1.708166 1.324817 13.680271 0.675212 0.679865 0.387949
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 8.578515 9.972361 8.833339 9.704737 6.683200 7.288768 2.098396 1.064181 0.028249 0.031861 0.001642
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.032687 -1.331900 -0.852871 -0.061330 -0.128524 -0.945893 -0.306919 -1.275661 0.656802 0.677638 0.410452
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.233977 0.515380 0.926601 -0.587519 1.359395 0.684402 13.908436 2.713720 0.641548 0.663259 0.412484
200 N18 RF_maintenance 100.00% 100.00% 40.18% 0.00% 11.050023 32.591217 3.873075 0.389961 6.678435 5.479706 1.394900 -0.606312 0.042680 0.223607 0.148737
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.574446 4.840194 2.617922 3.597145 2.872886 4.616887 -1.412638 -3.049028 0.649646 0.646317 0.395832
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.538744 0.573857 1.364195 -1.296543 0.194978 0.622102 -1.178756 32.913623 0.658200 0.656081 0.388335
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.209023 3.009577 0.386960 -1.197048 -1.049840 -0.608170 -1.088779 6.874917 0.651190 0.639118 0.383280
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.070471 0.843243 0.747945 -1.154632 1.239700 -1.169238 1.197340 4.383664 0.653198 0.653578 0.385442
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.584683 2.315897 1.101779 -0.937336 0.169816 3.583569 -0.737750 -0.427652 0.634531 0.640176 0.365698
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.490715 11.556597 8.617471 10.389255 6.567773 7.193202 17.684748 66.095308 0.032611 0.033951 0.001167
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 5.886742 7.193210 8.473188 8.864111 6.190462 7.556319 11.794932 21.661523 0.038856 0.038223 0.000708
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 11.650672 11.654046 1.968282 3.409340 -0.586448 -0.604078 -0.186837 0.242636 0.634807 0.643731 0.397747
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.389144 -0.737730 -1.152848 -0.213181 -1.143146 -1.141758 2.584126 -0.669876 0.602823 0.632725 0.402970
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 238.103564 237.858588 inf inf 3200.933203 3203.605760 5175.732194 5219.330942 nan nan nan
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.007752 -0.866321 0.255417 -0.701722 -0.902980 -0.673048 3.040023 -0.981227 0.646189 0.651725 0.391185
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.330965 -0.467797 -1.111776 -0.982499 -0.683708 -1.160697 4.260001 -0.871775 0.638330 0.657606 0.394120
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.176440 -0.564896 -0.208973 -0.127500 -0.392501 -1.215348 5.130067 -1.101261 0.642558 0.665720 0.399026
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.693184 3.295562 -1.646061 1.941326 -0.949822 2.253310 0.367343 1.320209 0.633033 0.561325 0.405574
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.437039 6.149895 4.563073 4.190348 5.143486 5.681194 -3.705485 -3.566954 0.617590 0.640802 0.387226
225 N19 RF_ok 100.00% 0.00% 89.45% 0.00% 1.332856 10.834125 0.758319 4.242111 -1.152502 7.128142 -1.187023 0.635734 0.652148 0.125361 0.539854
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.312451 5.319835 -0.043668 0.837531 -1.343444 1.829235 -0.816387 3.446626 0.644271 0.630584 0.383793
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.614422 0.463787 -1.367492 -0.222009 0.142113 -0.992273 13.285282 0.512713 0.614613 0.646504 0.388790
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.437157 21.058317 -1.034035 -0.655764 1.197338 2.920533 64.291085 66.411094 0.568110 0.514176 0.327332
229 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.638616 0.164422 1.122019 0.961366 -0.423757 -0.126635 10.805304 -1.604104 0.623594 0.646518 0.410643
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.175663 -0.292651 -0.404645 -1.591134 -0.704431 -0.678009 1.926928 -0.715445 0.590679 0.635461 0.411029
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.045563 -0.807566 0.784016 0.319239 -0.960986 -0.429929 -1.737654 -1.764164 0.642317 0.654280 0.404696
239 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.943900 -1.110515 -0.252024 0.081679 -0.992043 -1.077419 1.535946 4.945843 0.641219 0.657363 0.401596
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 15.853577 43.009949 2.136703 0.957747 3.199866 5.110644 5.060101 34.011773 0.508815 0.410614 0.242706
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.785562 3.216586 -0.831350 0.404948 -1.020575 -0.549066 6.337068 20.009525 0.632433 0.610773 0.397560
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 42.753616 1.942808 -0.092143 1.327977 13.896375 0.696154 23.093470 -1.318267 0.374310 0.655344 0.457139
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 50.263780 2.031742 0.691400 -1.536889 4.827031 -0.420312 -0.966915 0.181489 0.366413 0.636667 0.460713
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.064611 1.840256 1.084794 -0.738038 1.774603 0.634141 3.091315 7.814078 0.526335 0.612869 0.394084
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 2.889531 0.841832 2.408379 0.070563 1.766229 -1.113021 -2.521294 -0.299653 0.627226 0.640922 0.403293
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.104470 7.207635 -0.896180 -0.795325 2.858405 3.997780 1.820956 -0.295239 0.329961 0.333242 0.160621
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.441008 1.109243 0.602001 -0.616100 -0.790890 -1.296290 -0.965685 0.044558 0.622448 0.631136 0.401146
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 5.627268 7.114009 8.323573 9.183716 6.293270 7.042418 8.516975 25.058805 0.034645 0.028000 0.005893
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 9.065556 11.266534 4.615752 6.465150 1.931429 7.302171 14.472818 3.057322 0.386537 0.048253 0.301098
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.097871 2.184147 0.867975 1.170735 0.103136 0.802261 2.256819 -0.265935 0.529758 0.551588 0.388584
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.572811 -0.980840 0.986647 -1.537197 0.302839 -0.708597 -1.352713 -0.009213 0.553932 0.561150 0.394923
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.387182 -0.605510 -0.438371 -1.106278 -0.682298 -0.957507 7.490783 1.676706 0.495442 0.558645 0.398160
333 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.506300 2.101309 -0.912794 -1.575804 -0.795350 -0.596667 6.508091 12.630412 0.495430 0.536053 0.383495
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, 21, 27, 28, 29, 30, 32, 34, 35, 36, 37, 38, 40, 42, 45, 46, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 73, 74, 78, 80, 81, 84, 86, 87, 91, 92, 94, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 107, 108, 109, 110, 111, 113, 116, 117, 119, 121, 122, 123, 126, 128, 129, 130, 131, 133, 135, 136, 138, 140, 142, 143, 145, 146, 155, 156, 158, 159, 161, 164, 165, 166, 170, 179, 180, 181, 182, 183, 185, 187, 189, 191, 200, 201, 202, 203, 205, 206, 208, 209, 210, 219, 221, 222, 224, 225, 226, 227, 228, 229, 239, 240, 241, 242, 243, 244, 246, 262, 320, 329, 333]

unflagged_ants: [5, 8, 10, 19, 20, 22, 31, 41, 43, 44, 48, 49, 61, 62, 64, 65, 66, 67, 69, 70, 77, 79, 82, 83, 85, 88, 89, 90, 93, 95, 106, 112, 114, 115, 118, 120, 124, 125, 127, 132, 137, 139, 141, 144, 147, 148, 149, 150, 157, 160, 162, 163, 167, 168, 169, 184, 186, 190, 207, 211, 220, 223, 237, 238, 245, 261, 324, 325]

golden_ants: [5, 10, 19, 20, 31, 41, 44, 65, 66, 67, 69, 70, 83, 85, 88, 93, 106, 112, 118, 124, 127, 141, 144, 147, 148, 149, 150, 157, 160, 162, 163, 167, 168, 169, 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_2459938.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.dev197+g9b7c3f4
In [ ]: