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 = "2460121"
data_path = "/mnt/sn1/2460121"
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: 6-25-2023
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/2460121/zen.2460121.21284.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/2460121/zen.2460121.?????.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/2460121/zen.2460121.?????.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 2460121
Date 6-25-2023
LST Range 12.774 -- 22.731 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 205
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
RF_maintenance: 62
RF_ok: 18
digital_maintenance: 3
digital_ok: 83
not_connected: 30
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 205 (0.0%)
Antennas in Commanded State (observed) 0 / 205 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 83 / 205 (40.5%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 113 / 205 (55.1%)
Redcal Done? ❌
Never Flagged Antennas 91 / 205 (44.4%)
A Priori Good Antennas Flagged 36 / 83 total a priori good antennas:
7, 15, 17, 31, 37, 38, 40, 42, 44, 51, 53,
86, 112, 121, 123, 128, 140, 141, 144, 145,
146, 151, 153, 158, 161, 162, 163, 164, 165,
169, 170, 181, 183, 186, 187, 202
A Priori Bad Antennas Not Flagged 44 / 122 total a priori bad antennas:
8, 16, 22, 35, 36, 46, 48, 49, 50, 52, 57,
63, 64, 68, 73, 79, 80, 84, 89, 90, 94, 95,
97, 108, 113, 114, 120, 125, 126, 132, 135,
136, 155, 175, 179, 195, 201, 228, 229, 244,
245, 261, 324, 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_2460121.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 0.00% 0.00% 0.00% 0.00% -0.017648 -0.513251 0.009655 -0.979289 0.471574 -0.637466 -0.054920 -0.478863 0.697376 0.598763 0.445098
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.765869 12.052943 -1.397063 -0.953212 -1.690669 -0.802429 -0.848664 4.908027 0.704110 0.501299 0.437190
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.138146 1.622047 -0.063800 2.817584 0.431925 1.762162 -0.083168 0.696820 0.711060 0.597817 0.447210
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.548183 -0.580046 -1.201022 -0.565674 -0.667926 -0.202862 5.012246 8.647772 0.713577 0.614430 0.439971
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.401985 2.581821 1.145218 1.190619 0.168515 -0.034310 -1.805084 -1.423014 0.689051 0.581368 0.433378
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.649527 0.075008 2.869922 0.122599 1.726665 0.423951 2.051853 -0.136054 0.701796 0.607878 0.440446
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.026454 -1.221825 -0.226718 -1.314648 -1.533925 -1.172683 -1.144373 -0.070609 0.698894 0.590962 0.442805
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 12.813577 -0.815340 0.180591 -0.805274 -1.029044 -0.392511 0.602750 1.152489 0.618789 0.617732 0.396756
16 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.832303 -0.249602 -0.870977 -0.977365 -1.968117 -2.046381 -1.189909 -1.196173 0.714990 0.616165 0.436761
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.696033 2.288308 1.143971 3.393804 1.553207 1.979432 0.478984 8.222989 0.716997 0.607938 0.436130
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.829489 6.304545 -0.330338 1.513591 1.497958 0.344009 41.687401 27.718106 0.665509 0.392166 0.502494
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.075929 -0.632089 -0.912982 -0.350951 -0.564459 0.281293 -0.373191 2.243792 0.722035 0.627379 0.438450
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.158367 -0.378796 1.551811 0.261764 1.790333 0.404595 1.191193 0.091368 0.720248 0.622778 0.438343
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.359968 -0.422559 -0.674400 -0.308110 -0.317335 0.211907 0.107220 -0.031422 0.714246 0.611446 0.437911
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.203049 -1.419717 0.660585 -1.314145 -0.426542 -1.015308 0.263254 -0.669391 0.669315 0.579478 0.439247
27 N01 RF_ok 100.00% 100.00% 70.70% 0.00% 12.674337 17.108585 10.643477 3.274682 1.622495 0.857681 5.500683 34.857609 0.049476 0.195827 0.147997
28 N01 RF_ok 100.00% 0.00% 6.70% 0.00% -0.154384 12.433608 0.253866 4.734974 0.613108 -0.302558 0.078363 25.968826 0.719795 0.295010 0.593661
29 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 7.036178 8.684498 11.362667 11.673146 1.631922 1.217837 3.210231 2.083262 0.032577 0.040411 0.008267
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.386272 -1.419637 -0.824524 -1.417645 -1.873225 -1.210963 -0.071280 -0.568922 0.723146 0.633186 0.431852
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.387780 0.195533 -0.194717 0.356439 0.490613 0.586761 0.197331 6.457713 0.733263 0.633863 0.437034
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.135952 -0.940476 0.092252 -1.355936 -1.143240 -1.129042 1.075567 0.672404 0.638607 0.623644 0.362816
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 8.113997 0.202866 6.568036 -0.637275 1.623263 -1.950634 1.240237 -0.979175 0.045328 0.601300 0.452145
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.503241 -1.166922 -0.760339 -1.587091 -1.914163 -1.708119 -1.133339 -0.860959 0.701655 0.592893 0.443192
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.635791 2.671417 0.542177 0.209573 1.054173 0.531953 0.289950 0.655576 0.696009 0.587240 0.435789
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 7.667122 6.845905 4.436386 5.916343 2.503168 2.311851 0.951769 14.092343 0.704505 0.595259 0.431037
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.855223 -0.673410 -0.728062 0.144669 -0.242474 0.493152 1.834099 9.562912 0.713584 0.613737 0.432630
40 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.626621 0.933094 0.590727 0.439527 0.760312 0.525010 0.621976 26.004885 0.723164 0.629962 0.427656
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.374841 1.733770 0.010228 2.529379 0.493026 1.434897 -0.061052 0.577552 0.728111 0.631288 0.429888
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.848908 3.171879 0.151052 5.208335 0.734302 1.652623 0.552647 2.887844 0.734508 0.623256 0.441904
43 N05 RF_maintenance 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.469591 0.454364 0.252231
44 N05 digital_ok 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.346651 0.251612 0.224516
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.039610 1.768429 0.274831 0.047530 0.580787 0.350261 0.175291 2.899947 0.729912 0.630217 0.436114
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.828268 -1.425586 -0.470330 -1.523224 -0.086078 -1.506589 0.111260 -0.713022 0.726970 0.633237 0.440897
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 7.301838 9.089614 6.375525 6.394417 1.623475 1.217753 -2.087905 -2.322877 0.037415 0.031533 0.007013
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.861512 0.607086 -1.461322 -0.104990 -1.246832 -1.369256 -0.494470 -1.454040 0.707006 0.599271 0.436268
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.734724 -0.762350 0.147751 -1.305039 -0.239195 -2.009296 0.006626 0.305520 0.686705 0.587891 0.433873
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.258421 -0.326401 0.593052 0.253580 0.784346 0.606054 2.618809 -0.073599 0.694284 0.586640 0.432084
51 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.321889 -0.065816 -0.548455 0.542032 -0.194728 0.776923 74.884174 0.905971 0.699009 0.604708 0.421439
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.830082 1.642172 0.467286 -0.336982 0.910390 -0.004585 2.380202 0.578491 0.715448 0.616941 0.423557
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.225953 -0.034680 -0.270709 -0.371244 0.368378 0.121342 4.888134 3.638483 0.723733 0.632687 0.422110
54 N04 dish_maintenance 100.00% 0.00% 0.00% 0.00% 11.721823 4.094364 1.969114 2.846007 0.454285 0.158015 2.122069 1.220938 0.384912 0.424323 0.166917
55 N04 RF_maintenance 100.00% 100.00% 0.00% 0.00% 34.123701 -1.332377 7.914017 -1.473499 1.732856 -1.571267 0.772926 2.333455 0.042317 0.630535 0.472566
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.390125 2.736769 -0.793988 -0.026564 -0.197243 1.530173 -0.224554 1.583673 0.736420 0.632846 0.415154
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.836190 -0.630459 -0.713297 -0.779380 -0.273078 -0.493622 0.534556 0.238231 0.735548 0.645777 0.427682
58 N05 RF_maintenance 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.365369 0.319595 0.216826
59 N05 RF_maintenance 100.00% 99.95% 99.95% 0.00% 148.976815 148.958117 inf inf 933.331441 930.792650 4268.346997 4781.760401 0.451149 0.401632 0.175781
60 N05 RF_maintenance 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.403321 0.427268 0.202289
61 N06 not_connected 100.00% 100.00% 94.97% 0.00% 7.975672 -0.222391 6.195132 -0.412370 1.621838 1.188617 -2.272468 -2.400698 0.029869 0.067403 0.034082
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% -0.835636 0.828123 0.042827 -0.138375 -0.573128 -1.454757 0.616927 -1.546526 0.694741 0.602706 0.426495
63 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.442499 3.715327 -1.216892 1.906718 -2.039435 0.711515 -0.743650 -2.247316 0.709157 0.566155 0.442019
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.984615 -1.004104 -1.273674 -0.676207 -1.267665 -0.888815 1.293068 -0.200170 0.697087 0.583532 0.431337
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.116799 -0.693693 0.048262 -0.631797 0.522084 -0.149463 -0.104038 0.087320 0.693995 0.584730 0.440051
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.113049 -0.404507 0.197159 0.271452 0.450176 0.846705 -0.060055 0.469635 0.692244 0.602821 0.425936
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -1.175107 -0.016933 -0.815557 0.750336 -0.309727 0.962087 3.064442 1.475284 0.712760 0.617352 0.423306
68 N03 RF_ok 0.00% 0.00% 0.00% 0.00% 1.446635 0.334270 1.014374 0.781116 1.246149 0.915289 0.547664 1.325089 0.722317 0.629951 0.421132
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.327453 -0.123985 0.202845 -0.174581 0.583325 0.032504 1.198923 0.610733 0.727811 0.637298 0.419539
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.347566 0.248102 1.816663 0.376802 1.350450 0.606302 0.672123 2.539097 0.722692 0.646039 0.418406
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.933421 -0.347662 -0.948661 -0.162268 -0.450758 0.039580 -0.437528 0.457640 0.737081 0.650561 0.424242
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.439368 -0.263047 -0.343992 -0.358135 0.107310 -0.069007 0.961721 0.135434 0.736921 0.652187 0.425986
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.235671 1.744644 -0.217093 1.317309 0.284772 2.249128 0.507441 3.533260 0.736556 0.644472 0.428663
74 N05 RF_maintenance 100.00% 99.95% 99.95% 0.00% nan nan inf inf nan nan nan nan 0.316581 0.354173 0.163923
77 N06 not_connected 100.00% 94.97% 94.97% 0.00% 13.099823 1.670913 -0.968263 -1.548551 1.614608 1.174014 -1.914568 -2.258465 0.059529 0.067939 0.020933
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 13.759446 0.601287 -0.396530 -0.042548 -1.224771 -1.400072 0.130607 -0.577674 0.576146 0.608961 0.333106
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.295675 -1.132608 0.174719 -1.600817 -0.365861 -1.632234 0.694531 -0.794751 0.694850 0.603472 0.425976
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.586069 2.183428 -0.921257 0.976549 -2.037509 -0.280158 -1.100691 -1.931541 0.702781 0.578189 0.439885
84 N08 RF_ok 0.00% 0.00% 0.00% 0.00% 1.446272 2.322190 0.543623 1.099522 -0.591236 -0.126924 -1.611231 -1.813809 0.707286 0.595279 0.419031
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -1.108718 -0.809283 -1.492897 -1.501150 -1.202429 -1.229420 -0.530130 -0.348385 0.723287 0.633855 0.420203
86 N08 digital_ok 100.00% 100.00% 0.00% 0.00% 7.102698 -0.566776 10.185753 -0.506565 1.618843 -0.304144 1.030574 11.019320 0.050384 0.637358 0.442551
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 20.581580 1.866085 1.938538 -1.214019 1.811315 -0.708791 66.339820 3.616976 0.640269 0.651278 0.346885
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.320003 0.240539 0.155429 0.852976 0.373378 0.625360 1.005678 0.359914 0.730138 0.642615 0.419901
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.211002 -0.013479 0.201094 0.488932 0.429886 0.552089 -0.109514 0.034095 0.733206 0.643150 0.427259
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.473155 0.129975 -0.127607 1.156696 0.338370 0.995890 0.158719 0.992403 0.732109 0.637336 0.429920
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.336413 -0.104394 0.341519 0.101860 0.567807 0.253699 0.198574 -0.100191 0.724976 0.634203 0.439888
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.837680 8.428503 11.653643 11.996275 1.631496 1.228638 2.739681 2.775769 0.028195 0.037196 0.004709
93 N10 RF_maintenance 100.00% 14.43% 94.86% 5.14% 0.974687 8.967713 0.423304 12.152914 -0.472988 1.147005 -1.394187 3.265659 0.295663 0.064874 -0.000576
94 N10 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.173202 2.504935 0.354873 3.280147 0.837790 1.782587 0.528421 1.335068 0.730131 0.613825 0.439928
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.595102 -0.113717 -0.837003 -0.663893 -1.068822 -1.986126 0.085544 -1.046568 0.697592 0.609019 0.426309
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.698448 13.592712 -0.036517 -0.666138 -1.259360 -1.516205 -1.320845 1.718406 0.704141 0.501180 0.411689
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.664430 0.165893 -1.413775 -0.772693 -1.407989 -1.011354 -0.516776 3.784753 0.694240 0.580808 0.430980
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.857302 3.138260 -0.452175 0.420400 0.037458 0.625238 -0.301367 0.069985 0.713376 0.611393 0.428871
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.502661 -0.223543 -1.608447 -0.993172 -1.265175 -0.630970 -0.662088 5.219311 0.720641 0.623586 0.427236
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.069203 1.633075 -1.300122 0.236882 -1.750492 0.465848 -0.611869 2.077952 0.720442 0.630072 0.419126
104 N08 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.915588 36.881679 2.327686 6.437624 1.181482 2.611089 2.159377 1.790589 0.720425 0.619156 0.430107
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.726511 -0.077327 -0.290658 0.533811 -0.013934 0.567487 0.036528 0.008905 0.723980 0.635859 0.423798
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.089311 -1.209275 0.559170 -0.277254 0.571613 -0.263967 0.922855 -0.310323 0.727981 0.633338 0.428970
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.449729 1.448662 -0.817807 -1.333518 -0.304659 -1.187429 0.371587 1.122610 0.727170 0.631389 0.421110
108 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.779270 1.896907 -1.017935 0.243953 -0.791440 0.206280 -0.137101 1.205082 0.725828 0.632702 0.432728
109 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 5.401758 8.685102 -1.345649 11.874185 0.425126 1.222962 -0.266276 1.850762 0.433054 0.043107 0.314045
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.595609 -0.782869 -0.756711 -0.835313 -1.116241 -0.648688 -0.855195 -0.398866 0.633675 0.628718 0.355395
111 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.984306 1.274151 0.438577 1.055320 1.440365 1.301476 16.360088 0.956568 0.687732 0.627481 0.415979
112 N10 digital_ok 100.00% 99.73% 99.62% 0.00% 126.241120 126.398126 inf inf 892.447801 905.899822 4418.456993 4642.031913 0.397597 0.523004 0.448605
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 3.478897 3.544940 1.728189 1.793739 0.809063 0.591645 -2.209020 -2.302952 0.688184 0.575025 0.422458
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.866131 -0.444260 1.344707 -1.635820 0.384192 -1.622019 -2.046593 -0.773675 0.680522 0.594987 0.418775
115 N11 not_connected 100.00% 99.57% 99.57% 0.00% 148.274419 147.895054 inf inf 1067.909388 1031.923727 6200.611651 5932.907327 0.588075 0.562866 0.389626
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.164172 -0.016158 2.112887 -0.140536 1.897434 0.205344 3.403231 1.828664 0.707320 0.609198 0.431693
121 N08 digital_ok 100.00% 0.97% 0.00% 0.00% 1.978156 2.567437 0.785044 5.350054 -0.240442 1.966154 0.572760 7.807201 0.675976 0.599979 0.423753
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.214434 1.804147 -0.823084 -1.489754 -0.452226 -1.291764 -0.298475 -0.888893 0.721444 0.625651 0.432343
123 N08 digital_ok 0.00% 0.00% 0.05% 0.00% 3.032531 1.577208 1.512229 0.254964 0.607158 -1.067750 -1.804065 -1.510158 0.696770 0.613978 0.432190
124 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% 7.140270 9.252623 11.843870 12.276602 1.625427 1.226635 1.668066 4.812556 0.042737 0.044484 0.003333
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.473111 -1.002802 2.283482 0.095491 2.160935 0.209211 1.085418 -0.136525 0.717596 0.626743 0.437038
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.085384 1.298545 0.017443 0.201286 0.031776 0.080556 1.840631 0.533926 0.725892 0.627018 0.440516
127 N10 RF_maintenance 100.00% 99.73% 99.73% 0.00% 101.659184 100.102330 inf inf 885.079655 884.674846 4314.369972 4313.476179 0.428427 0.403118 0.262546
128 N10 digital_ok 100.00% 99.57% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.619546 0.560760 0.302783
131 N11 not_connected 100.00% 99.62% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.483860 0.451203 0.332998
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.954422 -1.265203 -1.154036 -1.405648 -1.893099 -1.452391 -0.860575 -0.603640 0.705085 0.599779 0.420122
133 N11 not_connected 100.00% 99.51% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.553104 0.542345 0.363063
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.081405 2.617204 2.174023 1.154139 -0.178706 -0.087078 5.142028 -1.857499 0.635922 0.561272 0.426511
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.246797 0.354582 -1.313694 0.615218 -1.631241 0.746789 -0.814472 0.743029 0.670514 0.551876 0.442499
136 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.149715 0.333978 -1.494436 0.174730 -0.745340 0.277162 -0.519511 2.084065 0.687158 0.557472 0.447270
139 N13 RF_maintenance 100.00% 99.84% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.398565 0.480494 0.324655
140 N13 digital_ok 100.00% 99.73% 99.73% 0.00% nan nan inf inf nan nan nan nan 0.462332 0.551049 0.374189
141 N13 digital_ok 100.00% 99.73% 99.73% 0.00% 132.951896 133.105198 inf inf 926.936446 922.322550 5023.968390 4958.027326 0.573763 0.549604 0.228134
142 N13 RF_ok 100.00% 99.62% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.611904 0.542191 0.293860
143 N14 RF_maintenance 100.00% 99.57% 99.57% 0.00% 144.705034 144.748735 inf inf 919.713628 918.236561 4944.712222 4870.732580 0.454776 0.426235 0.332559
144 N14 digital_ok 100.00% 99.57% 99.57% 0.00% 149.314388 149.521555 inf inf 1003.843092 1018.212141 5524.434892 5772.038510 0.555181 0.475038 0.354183
145 N14 digital_ok 100.00% 99.57% 99.51% 0.00% nan nan inf inf nan nan nan nan 0.492906 0.479391 0.307450
146 N14 digital_ok 100.00% 99.51% 99.62% 0.00% nan nan inf inf nan nan nan nan 0.477890 0.431408 0.278318
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.421060 -0.117637 1.108147 0.616144 1.253700 0.786659 0.383000 0.061528 0.723962 0.625233 0.433022
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.387512 -0.014898 -0.227520 0.336340 0.189644 0.544540 -0.208946 -0.018577 0.728161 0.624969 0.431609
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.213686 -0.431097 0.298487 -0.141349 0.631616 0.236058 1.645776 1.114703 0.727466 0.628426 0.430824
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.022957 -0.338926 0.011083 -0.077265 0.586374 0.263157 0.200378 -0.197547 0.726484 0.624863 0.426744
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 8.841356 -0.604026 -1.153267 0.544528 -1.136095 -0.069340 -0.164522 4.981761 0.625104 0.594710 0.359868
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.396302 -1.370866 -1.372860 -1.277170 -1.474323 -1.415430 1.021871 -0.579825 0.702123 0.595238 0.424162
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 7.232099 -0.591369 6.326352 -1.071208 1.625329 -1.169069 1.361727 0.145716 0.045156 0.584049 0.433703
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.012790 -0.862572 -1.062239 -1.598739 -2.043672 -1.786108 -0.941490 -0.589007 0.679839 0.568477 0.430279
155 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.480002 -1.064605 0.144294 -1.317476 -1.051759 -1.664062 -1.294120 -0.785335 0.662027 0.550088 0.444170
156 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.195791 -0.142798 4.002967 0.270387 1.842561 0.436498 3.599549 -0.014623 0.669410 0.559218 0.438415
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.297113 0.042428 -0.071619 0.238723 0.308924 0.419555 0.012960 -0.006626 0.684617 0.568440 0.441343
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.549140 -0.414652 -0.165793 -0.131273 0.478057 0.103663 1.483121 9.769012 0.690106 0.577099 0.445368
159 N13 RF_maintenance 100.00% 99.78% 99.78% 0.00% 144.645746 144.696782 inf inf 928.376929 917.139307 5043.876200 4862.203156 0.667359 0.561339 0.267132
160 N13 RF_maintenance 100.00% 99.68% 99.68% 0.00% 148.782263 148.751376 inf inf 938.293255 934.202465 5064.698408 5023.117936 0.361739 0.435128 0.317086
161 N13 digital_ok 100.00% 99.68% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.589229 0.433178 0.362068
162 N13 digital_ok 100.00% 99.68% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.587764 0.524904 0.328881
163 N14 digital_ok 100.00% 99.57% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.486584 0.353072 0.287928
164 N14 digital_ok 100.00% 99.51% 99.57% 0.00% 127.144538 129.029369 inf inf 776.532026 766.651771 4045.906371 4062.197283 0.454126 0.415917 0.284713
165 N14 digital_ok 100.00% 99.68% 99.73% 0.00% nan nan inf inf nan nan nan nan 0.427552 0.319476 0.271564
166 N14 RF_maintenance 100.00% 99.68% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.530472 0.470332 0.229526
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.500927 0.117163 0.275868 0.315568 0.924655 0.535454 0.069972 1.796475 0.720148 0.618884 0.442997
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.521360 -0.565869 0.431732 -0.010838 0.956936 0.220385 0.314391 0.476888 0.723819 0.624214 0.433917
169 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -0.120049 4.672351 0.299230 -0.126186 0.794546 -0.478827 -0.032741 0.505585 0.727163 0.588679 0.436376
170 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 3.008755 0.502457 2.474578 0.510618 2.423347 0.692165 4.728887 0.633313 0.705760 0.622594 0.414712
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.501186 -0.360941 0.550677 0.480344 -0.278488 -0.361782 0.201562 0.682545 0.690553 0.586509 0.413173
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.199975 -0.148335 -0.725976 -0.434184 -1.905952 -0.498793 -0.628807 0.676858 0.703810 0.589946 0.426876
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.458993 3.564808 1.726334 1.767241 0.831634 0.574698 -2.207493 -2.196005 0.669214 0.555371 0.421484
174 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 8.183880 9.583986 6.244121 6.419183 1.625880 1.222795 1.152336 0.601008 0.030928 0.030824 0.001551
175 N21 not_connected 0.00% 0.00% 0.00% 0.00% 2.285160 3.035742 0.884922 1.243094 -0.181882 0.004585 -1.841801 -1.659080 0.663240 0.535137 0.437419
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.292831 0.400859 0.409813 0.814972 0.509063 0.883739 0.109312 0.534355 0.685060 0.570875 0.446181
180 N13 RF_maintenance 100.00% 99.62% 99.62% 0.00% nan nan inf inf nan nan nan nan 0.477638 0.533957 0.272198
181 N13 digital_ok 100.00% 99.73% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.322778 0.359286 0.228781
182 N13 RF_maintenance 100.00% 99.73% 99.78% 0.00% nan nan inf inf nan nan nan nan 0.530539 0.369948 0.405216
183 N13 digital_ok 100.00% 99.68% 99.73% 0.00% nan nan inf inf nan nan nan nan 0.582482 0.554840 0.460217
184 N14 dish_maintenance 100.00% 99.62% 99.62% 0.00% nan nan inf inf nan nan nan nan 0.472111 0.481386 0.340428
185 N14 RF_maintenance 100.00% 99.78% 99.73% 0.00% 131.369786 130.961862 inf inf 943.933232 923.407488 5124.112820 4837.453276 0.277022 0.347323 0.195227
186 N14 digital_ok 100.00% 99.57% 99.68% 0.00% nan nan inf inf nan nan nan nan 0.616508 0.495905 0.295324
187 N14 digital_ok 100.00% 99.62% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.513249 0.433369 0.331191
189 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.659792 2.209419 0.763395 0.954738 -0.319828 -0.317683 -1.872474 -2.003836 0.695469 0.579184 0.432237
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.075099 0.021701 -0.014775 -0.418298 0.503627 -0.364536 0.219763 -0.241779 0.722577 0.611741 0.431195
191 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.054014 0.501728 0.272201 0.608708 0.933578 0.795057 3.149267 0.178597 0.719341 0.614208 0.424584
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.765746 3.877972 1.930037 1.973940 1.041042 0.777066 -2.283452 -2.319028 0.669277 0.556374 0.416032
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 3.830183 3.383429 1.966765 1.715171 1.075269 0.528816 -2.271298 -2.308451 0.663165 0.554407 0.418665
194 N16 digital_maintenance 100.00% 100.00% 0.00% 0.00% 7.429948 -0.794534 5.657828 -1.320997 1.626422 -1.976334 0.753200 -0.846681 0.039311 0.573032 0.473650
195 N21 not_connected 0.00% 0.00% 0.00% 0.00% 2.647309 0.578774 1.023496 -0.487435 0.012990 -1.806873 -1.835971 -1.390928 0.658049 0.557498 0.433790
200 N18 RF_maintenance 100.00% 100.00% 0.00% 0.00% 8.047854 -1.223194 6.432006 -1.402917 1.629074 -1.378625 1.806734 -0.630865 0.046607 0.555374 0.478759
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.731539 3.014119 0.674582 1.554842 -0.318376 0.358382 -1.760436 -2.289526 0.671084 0.532046 0.462043
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.369428 0.833925 -0.208129 0.706833 -1.380331 0.024981 -1.385255 8.705488 0.680409 0.540429 0.464450
204 N19 RF_maintenance 100.00% 99.51% 99.51% 0.00% nan nan inf inf nan nan nan nan 0.661817 0.540183 0.408482
205 N19 RF_ok 100.00% 99.62% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.582149 0.455089 0.371848
206 N19 RF_ok 100.00% 99.57% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.671499 0.462857 0.389856
207 N19 RF_maintenance 100.00% 99.51% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.583047 0.443027 0.298098
208 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 2.971955 5.711636 6.826805 11.618428 0.866609 1.191574 1.381773 40.941769 0.674448 0.040324 0.572360
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 4.330790 4.852908 11.037636 11.253513 1.623778 1.032085 19.957752 16.831415 0.032712 0.036110 0.001316
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.098531 4.449540 -0.201803 0.139172 0.140419 0.201973 0.077386 0.055139 0.714131 0.596968 0.425357
211 N20 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.325906 8.677278 -0.486498 6.860095 -0.655992 1.221482 0.044494 2.355194 0.687755 0.041411 0.570781
213 N16 digital_maintenance 100.00% 0.00% 91.68% 0.00% 3.313834 9.519471 1.647771 6.542185 0.734185 1.098287 3.842004 1.558946 0.658486 0.111007 0.564886
214 N21 not_connected 100.00% 100.00% 0.00% 0.00% 7.734404 0.641707 6.364269 -1.222393 1.623424 -1.884923 1.042706 -0.420044 0.048269 0.549957 0.489749
220 N18 RF_maintenance 100.00% 99.57% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.452503 0.536017 0.418703
221 N18 RF_ok 100.00% 99.62% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.485774 0.524427 0.385105
222 N18 RF_ok 100.00% 99.57% 99.62% 0.00% nan nan inf inf nan nan nan nan 0.433143 0.321823 0.363516
223 N19 RF_ok 100.00% 99.51% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.611631 0.546683 0.374363
224 N19 RF_maintenance 100.00% 99.41% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.604902 0.550114 0.387123
225 N19 RF_maintenance 100.00% 99.51% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.451811 0.450211 0.321438
226 N19 RF_ok 100.00% 99.24% 99.51% 0.00% nan nan inf inf nan nan nan nan 0.591910 0.392729 0.396580
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 0.464158 -0.821284 0.494586 -1.237464 -0.053395 -2.085422 15.449294 2.356817 0.678575 0.578316 0.434172
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.039701 -0.959502 -0.905230 -1.124623 -1.940272 -1.173439 0.039216 0.208708 0.691504 0.575770 0.427846
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.279769 0.557917 -0.618882 -0.060056 -1.749835 -1.389269 0.190226 -1.649898 0.692609 0.573913 0.433014
237 N18 RF_ok 100.00% 99.41% 99.41% 0.00% nan nan inf inf nan nan nan nan 0.613975 0.518421 0.355168
238 N18 RF_ok 100.00% 99.51% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.500746 0.441402 0.288243
239 N18 RF_ok 100.00% 99.57% 99.62% 0.00% nan nan inf inf nan nan nan nan 0.494570 0.414510 0.398996
240 N19 RF_maintenance 100.00% 99.46% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.487010 0.448232 0.360697
241 N19 RF_ok 100.00% 99.46% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.500707 0.404851 0.357819
242 N19 RF_ok 100.00% 99.46% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.424746 0.384947 0.344137
243 N19 RF_ok 100.00% 99.24% 99.30% 0.00% nan nan inf inf nan nan nan nan 0.485337 0.418792 0.363941
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.204482 -0.366253 -0.635798 -0.009655 -0.814096 -0.299729 0.401690 1.884394 0.677514 0.556775 0.439599
245 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.076178 -0.953545 -0.642929 -1.609079 -1.875822 -1.548094 -1.290763 0.121780 0.693122 0.570779 0.437263
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 2.525115 8.871406 3.540452 6.408955 -0.669175 1.221252 1.559315 1.560558 0.591026 0.039091 0.484501
261 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.013479 -0.455611 -0.784929 -1.143078 -1.836612 -2.078654 1.718714 -1.067654 0.673628 0.555435 0.438882
262 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.429394 6.765774 -0.117865 -0.011357 0.316160 0.571660 -0.003183 0.708744 0.682773 0.564237 0.442855
320 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.655288 -0.621196 -1.531328 -1.470000 -1.281635 -1.580748 -0.484920 0.189716 0.604855 0.449279 0.417793
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.455261 1.831442 -0.146786 0.085491 -1.284275 -1.186500 -0.922414 -1.285605 0.586460 0.436333 0.403820
325 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.191850 -1.354308 -0.254143 -1.382423 -1.484725 -1.381669 -1.417397 -0.522464 0.621644 0.479351 0.429066
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 7.967625 8.750263 6.359499 6.921855 1.623821 1.223791 1.605536 1.857202 0.041204 0.041401 0.002344
332 N21 not_connected 100.00% 99.46% 99.57% 0.00% nan nan inf inf nan nan nan nan 0.519965 0.406196 0.258673
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% -0.355559 3.432094 -0.581392 1.603595 -0.733193 0.411819 1.108609 -2.271629 0.570597 0.402880 0.401783
336 N21 not_connected 100.00% 99.41% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.617311 0.561016 0.303471
340 N21 not_connected 100.00% 99.46% 99.46% 0.00% nan nan inf inf nan nan nan nan 0.596176 0.544855 0.313184
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 7, 15, 17, 18, 27, 28, 29, 31, 32, 34, 37, 38, 40, 42, 43, 44, 47, 51, 53, 54, 55, 58, 59, 60, 61, 74, 77, 78, 86, 87, 92, 93, 96, 102, 104, 109, 110, 111, 112, 115, 121, 123, 124, 127, 128, 131, 133, 134, 139, 140, 141, 142, 143, 144, 145, 146, 151, 153, 156, 158, 159, 160, 161, 162, 163, 164, 165, 166, 169, 170, 174, 180, 181, 182, 183, 184, 185, 186, 187, 194, 200, 202, 204, 205, 206, 207, 208, 209, 210, 211, 213, 214, 220, 221, 222, 223, 224, 225, 226, 227, 237, 238, 239, 240, 241, 242, 243, 246, 262, 329, 332, 336, 340]

unflagged_ants: [3, 5, 8, 9, 10, 16, 19, 20, 21, 22, 30, 35, 36, 41, 45, 46, 48, 49, 50, 52, 56, 57, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 79, 80, 84, 85, 88, 89, 90, 91, 94, 95, 97, 101, 103, 105, 106, 107, 108, 113, 114, 120, 122, 125, 126, 132, 135, 136, 147, 148, 149, 150, 152, 154, 155, 157, 167, 168, 171, 172, 173, 175, 179, 189, 190, 191, 192, 193, 195, 201, 228, 229, 244, 245, 261, 320, 324, 325, 333]

golden_ants: [3, 5, 9, 10, 19, 20, 21, 30, 41, 45, 56, 62, 65, 66, 67, 69, 70, 71, 72, 85, 88, 91, 101, 103, 105, 106, 107, 122, 147, 148, 149, 150, 152, 154, 157, 167, 168, 171, 172, 173, 189, 190, 191, 192, 193, 320, 325]
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_2460121.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.1.1.dev3+gb291d34
3.2.3.dev158+gd5cadd5
In [ ]: