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 = "2459973"
data_path = "/mnt/sn1/2459973"
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: 1-28-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/2459973/zen.2459973.21294.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 1851 ant_metrics files matching glob /mnt/sn1/2459973/zen.2459973.?????.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/2459973/zen.2459973.?????.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 2459973
Date 1-28-2023
LST Range 3.051 -- 13.013 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
Total Number of Antennas 196
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 196 (0.0%)
Antennas in Commanded State (observed) 0 / 196 (0.0%)
Cross-Polarized Antennas 96
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 58 / 196 (29.6%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 116 / 196 (59.2%)
Redcal Done? ❌
Never Flagged Antennas 80 / 196 (40.8%)
A Priori Good Antennas Flagged 48 / 93 total a priori good antennas:
3, 7, 9, 10, 15, 16, 29, 37, 40, 42, 54, 55,
56, 71, 72, 81, 85, 86, 88, 94, 101, 103, 107,
109, 111, 121, 122, 123, 128, 136, 140, 143,
144, 151, 158, 161, 162, 164, 165, 170, 173,
182, 185, 189, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 35 / 103 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 89, 90, 95, 114, 115, 125, 132, 133, 137,
139, 166, 211, 220, 222, 226, 237, 238, 239,
245, 261, 324, 325, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459973.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.05% 0.00% 10.217702 12.774726 10.395936 -1.061790 7.517664 2.453221 0.117401 6.063705 0.031363 0.351246 0.282979
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.248796 1.462714 -0.629685 0.823410 2.650817 2.607417 4.270656 3.373086 0.620688 0.637039 0.396306
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.554247 -0.024637 0.258897 0.080398 -0.050783 1.992959 1.794936 0.051128 0.623919 0.639338 0.393626
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.079924 0.248242 -1.298954 -0.067650 -0.074470 0.231640 13.376435 11.251403 0.631144 0.646658 0.387337
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.198591 -1.196379 -0.618092 0.056837 -0.471590 0.573714 1.988010 1.423503 0.629533 0.643506 0.383787
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.532907 -0.373757 8.638666 -0.348662 4.506537 -0.129194 -0.058546 -0.504466 0.459824 0.640976 0.457992
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 2.135088 -0.843303 6.529196 -1.452852 2.334033 0.907057 2.020643 -0.181501 0.543911 0.639998 0.424789
15 N01 digital_ok 100.00% 100.00% 0.05% 0.00% 10.419151 16.987079 9.779005 0.073041 7.532475 2.491963 -0.343218 2.123096 0.031571 0.354358 0.275637
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.457865 -0.809359 10.361079 0.732718 7.526445 2.131407 0.035963 2.881817 0.030795 0.644568 0.528521
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.990488 1.658235 0.343399 0.508660 0.262933 0.376959 2.777089 2.008334 0.632673 0.648771 0.390297
18 N01 RF_maintenance 100.00% 100.00% 34.74% 0.00% 11.107915 18.192255 10.339777 -0.472270 7.713112 5.564762 0.037502 12.021113 0.028492 0.237208 0.184044
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.886736 -0.756158 -1.246240 -0.723248 -0.710841 1.222201 -0.552154 1.942461 0.637551 0.656751 0.384650
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.643501 -0.991076 2.473321 -1.075631 0.325355 0.458484 3.086807 -0.731191 0.625907 0.655295 0.392289
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.030679 0.415809 -0.806252 -0.013853 0.539302 1.333164 -0.164788 -0.189602 0.625698 0.633130 0.379942
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.682359 -0.536185 0.269159 -0.257356 1.291726 1.704507 -0.483080 -1.070840 0.601269 0.616769 0.386649
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.708468 11.819631 10.400868 10.999961 7.673052 8.473975 1.296415 0.769632 0.032505 0.035219 0.004077
28 N01 RF_maintenance 100.00% 0.00% 85.09% 0.00% 11.063608 25.325057 -0.318059 2.956468 4.101073 7.372886 3.747383 12.315711 0.370754 0.167043 0.271313
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.472914 12.299851 9.978215 10.581811 7.671393 8.467334 0.038842 -0.426639 0.029280 0.034436 0.005330
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.288690 0.196740 -0.755009 0.593542 3.303797 0.675823 0.007589 -0.078825 0.641433 0.658398 0.381945
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.070677 -1.107151 1.045771 1.268224 1.207504 0.090614 0.217169 2.164057 0.648305 0.656421 0.379289
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.162289 23.542833 -0.091504 2.896051 2.484850 0.589172 22.087590 28.819435 0.628472 0.554533 0.352938
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.982552 13.458139 4.655609 5.133806 7.616467 8.422082 0.215166 -0.219640 0.033202 0.046336 0.009298
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.682289 -0.748642 1.329287 -1.383615 -0.467960 -0.735194 -1.442444 -0.746050 0.612365 0.609739 0.382227
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.040871 25.805276 13.746718 13.838259 7.822628 8.455957 2.808020 2.495684 0.030179 0.027900 0.001556
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.297187 0.485395 -1.375189 1.538898 0.887662 0.884397 -0.540844 5.228416 0.627430 0.636994 0.399716
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.314682 0.064927 0.225617 0.702562 -0.383346 0.220646 2.363678 0.792366 0.634378 0.646753 0.399469
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 9.841870 3.457474 10.005792 0.546090 7.619865 -0.515372 0.019967 -0.183907 0.035620 0.629857 0.487272
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.631071 0.256410 -0.343345 0.047095 2.030157 0.309347 0.148600 3.080758 0.641066 0.658569 0.377208
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.765692 -0.290580 4.809067 6.251237 -0.267209 -0.604906 -0.335581 -0.839298 0.620471 0.626608 0.367790
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.334732 0.599187 -0.228856 0.688004 -0.392594 0.410274 -0.710981 1.418336 0.655861 0.660188 0.378940
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.538206 0.236142 -1.373548 0.178983 -0.240438 0.369720 -1.013161 -0.795853 0.652220 0.668571 0.380326
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.935917 1.526886 0.229654 0.543506 -0.700565 1.466959 -0.380891 0.669767 0.640586 0.654228 0.377503
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.265158 0.056358 -0.845164 -1.277041 -0.709472 -0.228893 -0.711046 -1.135470 0.645643 0.666738 0.395230
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.174335 13.175955 4.471354 4.746877 7.551464 8.338256 0.165923 -0.678801 0.030591 0.049698 0.013226
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.093660 0.780483 0.507325 1.580827 -0.533839 1.807235 -0.670552 -1.737429 0.615944 0.633151 0.389466
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.137264 -0.151905 -1.067373 0.131998 0.267591 -0.730995 0.192126 0.204019 0.570698 0.615025 0.395480
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.728918 7.583530 0.540799 1.284388 2.626125 3.218534 60.902209 55.409355 0.586039 0.591590 0.365821
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 23.011669 4.117698 13.193624 -0.615737 7.837242 3.526083 5.663996 2.533723 0.038717 0.529596 0.408635
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.161516 6.332179 -0.498601 0.599987 0.690759 0.570475 2.225166 0.662434 0.638429 0.649128 0.392221
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.860491 3.133064 -0.038562 0.311124 1.356319 1.947786 2.445650 3.456395 0.649026 0.660345 0.395416
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 26.927028 -0.842560 5.228466 3.361784 1.420147 -0.870641 3.235220 0.342622 0.460438 0.646416 0.376132
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.754804 13.159542 10.421558 11.124739 7.634090 8.413829 0.139663 1.176024 0.027881 0.029738 0.001979
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.065842 1.709959 5.866063 8.157476 0.624522 1.538710 -0.807862 -0.328395 0.606400 0.579715 0.355892
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 23.173826 1.212052 7.583911 0.709316 5.865112 0.435785 4.397960 1.413139 0.403770 0.667751 0.403706
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.832646 12.211650 10.296432 11.122983 7.517812 8.351108 0.485520 0.054301 0.034092 0.034102 0.001536
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.941284 0.493068 10.366628 1.527933 7.341597 2.335510 -0.105226 5.406837 0.047585 0.657378 0.527343
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.221910 12.143255 -0.512158 11.153813 -0.485718 8.390954 0.328979 1.155289 0.640609 0.072801 0.515229
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.378537 -0.183241 -0.657793 -1.450407 1.374296 -1.251167 -0.831688 -0.129691 0.593691 0.625841 0.381779
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.613729 0.759065 -0.764066 1.008361 -0.092452 -0.635355 1.052229 -1.023022 0.583632 0.632563 0.394418
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.147760 12.615891 -0.433904 5.164024 0.462951 8.513065 0.309390 1.223802 0.612744 0.044452 0.492317
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.013241 -0.053271 -0.834081 -0.926208 -0.953806 -1.186865 1.752563 -0.409714 0.599171 0.593568 0.374864
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.684401 1.395723 0.500843 1.183062 -0.153659 0.717633 0.835183 0.097796 0.616859 0.633483 0.404847
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.643112 1.546223 -1.619275 -1.149877 2.665014 -0.463360 -0.483885 -0.059092 0.631524 0.650028 0.402103
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.592246 2.009507 -0.217502 1.394071 -0.673159 0.404834 0.477506 3.173077 0.642422 0.641431 0.386638
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 20.071033 26.306387 1.124290 14.551451 3.235971 8.449865 -0.030795 6.223567 0.374967 0.028005 0.279682
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.722348 -0.340862 0.380428 0.814833 -0.257262 1.123099 -0.283331 -0.421342 0.643020 0.662821 0.376891
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.583317 -0.300310 -0.322774 0.053352 0.990037 1.542848 0.691150 0.193145 0.654767 0.669709 0.375480
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.537456 -0.063235 0.592647 1.187433 0.421856 -0.577280 0.700244 0.678750 0.662734 0.673306 0.366437
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.357687 13.352036 10.783536 11.535504 7.374029 8.175210 0.048393 0.062356 0.030193 0.032457 0.002893
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.823902 0.898657 -1.559314 -0.986388 0.979123 -0.347331 -0.601492 -0.854966 0.662752 0.675908 0.376169
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.475674 0.024791 -0.126079 -0.593057 -0.399548 1.461906 -1.111589 1.866452 0.660152 0.671873 0.375851
77 N06 not_connected 100.00% 0.05% 0.00% 0.00% 58.475676 0.895943 0.593668 -0.596239 3.870564 -1.120022 6.921365 -1.059551 0.320261 0.628702 0.454962
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 32.002774 -0.014261 -0.488716 0.898345 1.397435 -0.496490 2.273340 0.276384 0.448279 0.639399 0.382411
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.533637 12.908348 -1.577902 5.179152 -0.941019 8.292923 0.559256 -0.796310 0.600713 0.038739 0.474513
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.550995 13.762049 0.320015 5.077991 -0.771475 8.344897 -0.751911 0.227350 0.608234 0.047291 0.480928
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.156921 13.027531 -0.028627 9.707900 0.079933 8.016498 -0.319356 0.517826 0.594112 0.036525 0.462484
82 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.035137 0.190211 0.362284 2.932313 -0.187581 11.986030 -0.012933 0.525866 0.614605 0.609182 0.385620
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.405113 0.252950 0.141846 0.589005 0.061314 -0.271100 -0.635792 0.525836 0.627632 0.643175 0.388413
84 N08 RF_maintenance 100.00% 53.86% 100.00% 0.00% 19.613145 23.430397 13.303285 14.091627 6.330039 8.435512 2.451572 2.749079 0.212676 0.035265 0.138689
85 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.315736 0.555820 1.790518 1.542074 4.825022 -0.069789 -0.381760 -0.368558 0.638242 0.656087 0.379972
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.973800 0.014841 1.903457 1.737571 4.693055 -0.322357 0.547077 14.405379 0.628517 0.653559 0.363196
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 11.933326 4.373573 -0.374781 -0.479865 13.332181 4.567132 126.807658 97.087263 0.607603 0.668999 0.349430
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.658415 0.455331 0.324248 1.068513 -0.477832 -0.136566 5.103133 2.034551 0.652393 0.667107 0.362960
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.437274 0.485052 0.141052 1.022388 -0.458966 -0.745462 -0.625145 -0.601904 0.658059 0.668874 0.367795
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.085387 -0.508054 0.884107 3.698474 -0.605807 2.408787 0.358639 2.642697 0.648660 0.641579 0.365974
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.164819 -0.052871 0.441871 0.462823 -0.812104 -0.726177 0.233484 -0.163265 0.646980 0.666767 0.383517
92 N10 RF_maintenance 100.00% 0.05% 8.48% 0.00% 33.928692 36.773316 0.553272 1.538563 4.486913 2.563412 4.416577 6.606331 0.301764 0.260534 0.086127
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 2.148587 -0.277474 2.482415 -1.134658 1.477218 0.780969 2.573211 -0.048803 0.635816 0.659338 0.390693
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.259680 12.629795 10.537060 11.016438 7.588762 8.374685 0.185666 -0.160928 0.030124 0.026530 0.001871
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.236317 -0.470770 -0.901466 0.620204 -0.215080 -0.121031 -0.358837 0.534997 0.612698 0.638072 0.393699
96 N11 not_connected 100.00% 0.00% 0.00% 100.00% 10.940501 6.439387 3.407196 4.619597 2.850752 6.575037 -2.018203 -3.244265 0.273076 0.225763 -0.254234
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.932922 5.608189 -0.957368 1.708578 1.023494 2.651772 0.463919 5.718205 0.597823 0.544436 0.382012
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.052531 8.471066 -0.409240 1.246540 -0.209666 1.429080 0.920266 1.475488 0.645670 0.656333 0.381516
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.519951 1.211874 -1.496482 -0.822468 0.747526 0.499461 -0.632719 6.192468 0.655877 0.666458 0.377822
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.965433 5.481611 1.051944 -1.462615 44.884845 1.238394 7.905838 4.288741 0.636323 0.671922 0.377401
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.330651 58.103106 -0.586890 7.646462 3.251421 0.635632 0.527835 1.098813 0.661829 0.641677 0.369303
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.328495 0.294610 0.163950 1.078617 0.538842 -0.846242 -0.439450 -0.233126 0.658683 0.669849 0.364624
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 1.406757 1.383255 -1.209375 -0.300507 1.402583 -0.520506 0.165956 1.092613 0.659147 0.672131 0.365061
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.097652 0.094257 -0.235598 -0.350796 0.215217 -0.121687 4.638074 3.883168 0.657571 0.674201 0.371378
108 N09 RF_maintenance 100.00% 100.00% 0.05% 0.00% 10.332980 41.041068 10.340311 0.942965 7.613313 3.056033 0.704568 3.081239 0.033152 0.300559 0.172966
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
111 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.255699 -0.428705 0.159093 0.142608 0.548491 2.977189 0.688476 -0.867805 0.637901 0.652430 0.396427
113 N11 not_connected 100.00% 0.00% 100.00% 0.00% 4.192425 13.498785 3.684729 5.160027 3.009086 8.230192 -2.636726 -0.168049 0.621347 0.076719 0.481018
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.298667 0.802748 0.378754 -0.310865 2.971034 -0.524383 -0.581557 -0.748075 0.603733 0.620437 0.382693
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.147407 -0.923369 -1.204161 -0.725104 -0.359746 -1.101755 -0.146792 0.885381 0.584126 0.608178 0.392692
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.185729 13.630065 10.470345 11.496074 7.437871 8.356968 0.382240 1.974241 0.027979 0.030350 0.001852
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.013241 1.465888 -0.080262 0.660978 -0.192421 -0.021682 0.063917 0.367873 0.622745 0.642367 0.393634
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.565042 2.148714 2.768422 -0.942231 -0.360757 1.065077 0.667079 -0.687821 0.635144 0.667518 0.385357
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.180895 2.952531 -1.490674 6.357177 0.673074 -0.472818 6.643425 12.961940 0.654034 0.642742 0.363407
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.556517 6.554164 0.299259 0.950570 0.719763 1.269806 0.425182 -0.656015 0.649367 0.672726 0.373674
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.567529 8.412894 0.719742 1.198168 0.207986 -0.165867 -0.379403 -0.042713 0.665324 0.675618 0.372997
124 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.180993 0.026087 0.013853 0.745707 -0.754493 0.118807 0.761326 0.048133 0.665023 0.678126 0.375947
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.235750 -0.292884 -0.239130 1.056320 0.496112 -0.279853 0.474062 -0.135180 0.660132 0.667221 0.369530
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.820279 -1.059222 -0.683627 1.063288 6.038813 0.109692 50.786555 -0.507534 0.630001 0.662405 0.374495
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.693830 0.233869 0.305463 0.427384 2.274692 0.946153 -0.097803 0.055329 0.655457 0.671446 0.382965
128 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 1.427930 11.772794 7.532982 11.124197 1.974923 8.283215 -0.896210 -0.181266 0.556311 0.031456 0.394183
131 N11 not_connected 100.00% 0.00% 0.05% 0.00% -0.681073 11.986425 -0.022831 4.995706 -0.678511 7.338330 -0.861583 -0.404153 0.624204 0.304592 0.431506
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.575571 2.001749 -0.432091 -1.571190 1.850064 -0.822232 0.688006 0.113460 0.605367 0.607439 0.375392
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.058663 0.489901 -0.908074 1.632888 -1.128921 0.932753 -0.711877 -0.788917 0.596063 0.625175 0.402314
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.230934 -1.141673 -1.150023 -1.655272 1.538550 0.967410 22.223054 -0.091368 0.595287 0.626232 0.409573
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 9.439148 4.975976 9.953236 -0.584849 7.690749 0.795025 0.658866 1.605461 0.038944 0.613782 0.463548
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.044031 -0.537193 -0.057627 -1.640818 1.842527 -0.186805 0.604855 0.817043 0.606148 0.637974 0.398761
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.046531 -0.235037 1.464634 -1.192534 0.770636 -0.878571 -0.655997 0.441927 0.632426 0.639837 0.378021
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.745219 -0.920173 -1.018554 -0.527409 -0.658902 -0.479028 4.819885 2.793260 0.648024 0.666941 0.377981
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.241227 -0.672623 -0.439234 0.441780 1.547681 -0.820019 0.678430 -1.251048 0.651484 0.672373 0.374541
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.312071 12.156453 -0.908301 11.164748 2.223381 8.442705 18.449218 0.585782 0.648148 0.045677 0.532373
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -1.288786 -0.346746 -0.936019 0.710294 -0.205153 5.869789 -0.511645 -1.180936 0.664653 0.674109 0.375521
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.459225 0.256292 -1.275107 2.215132 0.089248 18.844494 -0.409855 -0.074563 0.664282 0.660819 0.375835
145 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.625587 12.278008 10.351235 11.202854 7.382430 8.492222 -0.102659 1.636020 0.077843 0.030084 0.036709
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.125360 -0.768230 1.400956 -1.016645 0.766338 -0.998176 -1.407410 -0.270836 0.649947 0.655607 0.375526
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.417873 -1.613425 1.291090 2.542954 0.094650 -0.424501 0.502597 -0.392327 0.646650 0.655162 0.379607
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.134009 0.150676 -0.768170 -0.590961 1.451173 1.814376 -0.728579 -0.955991 0.650421 0.665874 0.391822
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.075179 -1.234601 -1.125413 -1.530032 0.576961 1.277359 0.140905 -0.400006 0.643846 0.659852 0.395918
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.621943 -0.752212 -1.333894 -1.496812 -0.859227 0.333128 0.851263 0.740584 0.643058 0.655085 0.397000
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 19.768550 0.735395 -0.263140 0.484789 4.618918 -1.163581 7.162688 -0.457095 0.515047 0.591486 0.357777
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.832027 -0.840550 10.114585 -1.244147 7.730278 -0.241264 1.088845 1.127876 0.041667 0.624853 0.488333
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.690638 11.921010 8.412196 10.890286 3.911269 8.483251 0.735210 0.840882 0.442221 0.037473 0.346956
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.020567 -0.239060 -0.041420 0.798325 -0.599346 0.640216 -0.237759 -0.371495 0.611662 0.634817 0.397285
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.011874 -0.233062 -0.376351 -0.569427 2.032314 2.205168 3.414510 9.397168 0.628094 0.650834 0.397420
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.278654 25.510677 -1.633362 -0.815583 -0.190549 3.963052 -0.436237 24.795875 0.601839 0.510308 0.353665
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.862850 -0.930963 -0.312311 -0.744703 -0.670035 1.920149 0.574308 0.254697 0.639700 0.656749 0.381386
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.967638 28.399401 -0.082487 -0.486244 0.060962 0.532227 -0.447316 0.431277 0.646440 0.534787 0.342049
162 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.930000 -1.037278 -0.742694 -1.362325 1.416870 1.252256 4.590902 -0.058070 0.648070 0.671622 0.380564
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.252129 1.129269 -0.250812 0.499126 -0.416838 1.070685 -0.477209 0.793435 0.658714 0.669372 0.381099
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.791589 0.543677 1.057676 1.497174 4.385443 1.934310 0.738767 0.766222 0.650789 0.664163 0.370712
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 31.036686 0.116635 -0.506938 -0.923847 4.544831 -0.052706 4.393221 -0.251051 0.515196 0.668468 0.373277
166 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.378314 2.835788 -0.473414 2.936730 -0.144405 3.229446 2.301972 -0.554883 0.648910 0.654962 0.376797
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.794050 -0.782745 -1.608856 0.055123 1.554194 0.021682 0.013831 3.270856 0.657102 0.664792 0.385283
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.021384 -1.034269 0.135217 -0.321171 1.265728 0.664365 -0.490690 0.613472 0.647637 0.660443 0.392418
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.738210 -1.095438 -1.011228 -1.647166 0.433687 0.541571 -0.882705 1.690664 0.647319 0.660394 0.393327
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.105970 -0.386381 10.680841 -0.639189 7.421126 -0.274245 1.316714 6.028995 0.039763 0.656545 0.529355
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.676359 2.318515 -1.500979 0.276098 -0.904801 1.122386 -0.572862 0.760072 0.591592 0.570881 0.368074
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 12.362606 12.759243 3.991573 4.768719 7.767524 8.501569 1.847434 3.565252 0.037972 0.043010 0.004241
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.964233 -0.704237 -0.359663 -1.356740 1.961714 1.462504 -0.175395 0.426433 0.594710 0.647140 0.397952
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.228024 12.835442 -1.604730 11.305307 0.691320 8.328201 13.632869 1.046106 0.639853 0.052256 0.534571
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.495014 0.023571 0.506979 0.690623 -0.326866 -0.352313 -0.501005 2.826995 0.644154 0.656474 0.386069
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.463062 11.870347 -1.168622 10.859860 1.207652 8.519605 8.846062 0.716168 0.653211 0.045669 0.506857
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.033331 0.998858 -0.911452 0.180574 0.853834 -0.410358 0.654283 0.245217 0.643137 0.656390 0.369533
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.859364 -0.621591 -1.635335 -0.298818 -0.496674 0.249008 -0.007589 0.237563 0.653259 0.667523 0.369811
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 35.486012 -0.276667 -0.332009 -1.442147 7.821329 0.653231 8.618077 0.371310 0.521067 0.664969 0.378182
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.865684 -0.754334 0.438946 -0.540122 -0.708946 -0.830757 -0.428307 1.475420 0.654750 0.667316 0.384225
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.754487 0.624371 0.084166 1.427973 0.605276 0.296458 -0.120351 -1.462862 0.643352 0.657036 0.379176
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.348203 11.752638 9.936357 10.994622 7.817883 8.527940 2.559510 1.357271 0.028006 0.030435 0.000981
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.166263 -1.330993 -0.691522 0.086215 -0.558114 -0.085200 -0.334189 -1.154557 0.640650 0.659989 0.401181
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.501611 0.256397 1.297722 -0.349021 0.047496 0.798023 9.498140 0.092571 0.628607 0.644750 0.397141
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 5.833247 6.467401 4.699173 4.597891 5.490570 6.428136 -2.997635 -3.283758 0.589058 0.600854 0.385166
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 6.756579 0.146842 4.926932 0.948306 5.816417 1.490374 -3.045960 -0.111375 0.573388 0.612396 0.412731
200 N18 RF_maintenance 100.00% 100.00% 70.72% 0.00% 12.001600 34.025501 4.423956 1.233881 7.749911 3.307372 0.726711 13.314979 0.038066 0.188211 0.123928
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.936001 4.787244 3.106619 4.014607 1.850125 5.345345 -0.465858 -2.636950 0.628993 0.626321 0.382065
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.762179 2.624612 1.602230 -1.303522 0.774889 0.234876 -1.141290 18.202328 0.637142 0.622947 0.378375
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.358991 2.381013 0.531671 -0.915749 -0.487184 -0.415276 -0.861902 5.376490 0.625536 0.616075 0.374742
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.126997 2.791850 1.755310 -1.112064 10.101471 -0.339185 0.969817 3.719228 0.627530 0.610218 0.380926
207 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.703324 1.967678 -1.189450 -0.164554 0.467349 -0.514592 3.665794 -0.508895 0.587032 0.599676 0.376972
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.347045 -1.159754 0.409407 -0.592683 -0.727811 -0.915753 2.358347 -1.285954 0.623478 0.630307 0.381202
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 0.361489 -0.380828 -1.021045 -0.935407 3.867329 -0.943495 4.518540 -1.008702 0.610431 0.634425 0.384664
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.192823 -0.329855 -0.205121 -0.055665 -0.296222 -0.799332 3.585311 -1.498158 0.617756 0.641268 0.388389
223 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
224 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
225 N19 RF_ok 100.00% 0.00% 90.87% 0.00% 1.520246 12.305767 0.910569 4.943103 -0.723105 8.203090 -0.986975 0.432790 0.624772 0.145892 0.513339
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.229206 2.449713 0.060425 1.092912 -0.797991 1.954017 -0.805792 -0.781050 0.620176 0.620789 0.381113
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 1.486820 0.484847 -1.517488 -0.144974 0.038481 -0.618432 10.845764 0.749955 0.586962 0.619604 0.376624
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.667723 19.571988 -0.769234 -0.531727 1.784527 3.265407 69.604987 76.881657 0.517831 0.496152 0.297221
229 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.062152 0.049725 1.532960 1.147366 -0.353077 0.614615 4.351856 -1.538078 0.604465 0.618441 0.392815
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.412920 -0.352063 -0.219707 -1.633302 -0.656705 -0.447961 -0.364349 -0.921999 0.565086 0.612675 0.400333
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.484160 -0.565249 1.398472 0.786174 -0.231746 -0.626293 -1.467577 -1.815831 0.617334 0.629307 0.393611
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.533169 -0.705139 0.384857 0.508529 0.134024 -0.704666 -0.262532 0.242188 0.614930 0.630925 0.393075
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 26.401806 48.334438 0.622438 0.778051 4.013933 5.533285 41.452852 27.491139 0.466315 0.397995 0.247315
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.937025 3.328912 -0.822016 0.707102 -0.697290 -0.039216 3.373957 13.197850 0.603080 0.581429 0.389354
242 N19 RF_ok 100.00% 5.13% 0.00% 0.00% 46.535810 1.855223 0.150481 1.545845 10.107450 1.213706 25.142382 -1.052330 0.358232 0.627844 0.453750
243 N19 RF_ok 100.00% 4.75% 0.00% 0.00% 58.010773 2.131839 0.842424 -1.578309 4.625996 -0.546802 -0.562662 -0.222470 0.266442 0.607300 0.480223
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.560274 1.908030 1.461518 -0.543924 1.587326 1.191995 3.318569 6.859262 0.493563 0.583948 0.383074
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.359709 1.770011 -0.430228 -1.564162 -0.931735 -0.863354 -0.902381 0.492364 0.597606 0.599897 0.386084
246 N20 RF_maintenance 100.00% 0.05% 0.05% 0.00% 8.265763 6.680652 -0.757086 -0.077824 3.062908 3.073131 1.201953 -0.611865 0.328015 0.327866 0.159531
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.552773 1.405003 0.714568 -0.600924 -0.429583 -1.094519 -0.544119 0.821879 0.595291 0.598170 0.389472
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.269799 7.328922 9.518775 10.448627 7.127860 7.820789 10.446220 16.778773 0.030558 0.026845 0.003451
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 5.710454 12.793899 2.507565 7.362484 0.874048 8.513739 29.422422 1.363735 0.455116 0.044561 0.365833
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.360467 2.391537 1.082478 1.325876 0.655745 0.948640 3.014260 1.582219 0.507789 0.522515 0.379198
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.518232 -1.103024 1.197198 -1.576618 0.617970 -1.078418 -1.236556 -0.274806 0.538331 0.541806 0.396451
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 4.305866 -0.549936 1.008953 -1.192793 5.025844 -0.964757 4.514930 0.871750 0.440339 0.534325 0.387203
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 3.380875 1.749656 -0.640737 -1.589798 -0.418699 -0.911006 1.297151 1.370726 0.473940 0.513518 0.373948
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, 10, 15, 16, 18, 27, 28, 29, 32, 34, 36, 37, 40, 42, 47, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 92, 94, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 113, 117, 120, 121, 122, 123, 126, 128, 131, 135, 136, 140, 142, 143, 144, 145, 151, 155, 156, 158, 159, 161, 162, 164, 165, 170, 173, 179, 180, 182, 185, 189, 191, 192, 193, 200, 201, 202, 205, 206, 207, 208, 209, 210, 221, 223, 224, 225, 227, 228, 229, 240, 241, 242, 243, 244, 246, 262, 320, 329]

unflagged_ants: [5, 8, 17, 19, 20, 21, 22, 30, 31, 35, 38, 41, 43, 44, 45, 46, 48, 49, 53, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 83, 89, 90, 91, 93, 95, 105, 106, 112, 114, 115, 118, 124, 125, 127, 132, 133, 137, 139, 141, 146, 147, 148, 149, 150, 157, 160, 163, 166, 167, 168, 169, 171, 181, 183, 184, 186, 187, 190, 211, 220, 222, 226, 237, 238, 239, 245, 261, 324, 325, 333]

golden_ants: [5, 17, 19, 20, 21, 30, 31, 38, 41, 44, 45, 53, 65, 66, 67, 69, 70, 83, 91, 93, 105, 106, 112, 118, 124, 127, 141, 146, 147, 148, 149, 150, 157, 160, 163, 167, 168, 169, 171, 181, 183, 184, 186, 187, 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_2459973.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.dev13+gd6c757c
3.2.1
In [ ]: