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 = "2460041"
data_path = "/mnt/sn1/2460041"
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: 4-6-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/2460041/zen.2460041.21310.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/2460041/zen.2460041.?????.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/2460041/zen.2460041.?????.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 2460041
Date 4-6-2023
LST Range 7.523 -- 17.480 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 25
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas 40
Total Number of Nodes 19
Nodes Registering 0s N15
Nodes Not Correlating N05, N07, N10, N14
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 177 / 198 (89.4%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 102 / 198 (51.5%)
Redcal Done? ❌
Never Flagged Antennas 4 / 198 (2.0%)
A Priori Good Antennas Flagged 90 / 93 total a priori good antennas:
5, 7, 9, 10, 15, 16, 17, 19, 20, 21, 29, 30,
31, 37, 38, 40, 41, 42, 44, 45, 53, 54, 55,
56, 65, 66, 67, 69, 70, 71, 72, 81, 83, 85,
86, 88, 91, 93, 94, 101, 103, 105, 106, 107,
109, 111, 112, 118, 121, 122, 123, 124, 127,
128, 136, 140, 141, 144, 145, 146, 147, 148,
149, 150, 151, 157, 158, 160, 161, 162, 163,
164, 165, 166, 167, 168, 169, 170, 171, 172,
181, 182, 183, 184, 186, 187, 189, 190, 191,
202
A Priori Bad Antennas Not Flagged 1 / 105 total a priori bad antennas:
224
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_2460041.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
4 N01 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.989420 1.197434 0.031311 -0.025705 -1.055609 -0.841067 -0.067008 -0.587838 0.027527 0.027599 0.001329
5 N01 digital_ok 0.00% 100.00% 100.00% 0.00% -0.445084 -0.060419 0.282260 0.519162 -0.652965 -0.061132 -0.357311 -0.595886 0.026707 0.025567 0.001168
7 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 0.287874 -0.296797 0.143419 0.275489 0.172163 -0.328375 13.891941 14.195961 0.069975 0.078528 0.014931
8 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.832482 3.091661 0.911133 0.967700 7.071611 6.411416 -4.821170 -5.264750 0.504144 0.504688 0.341722
9 N02 digital_ok 0.00% 100.00% 100.00% 0.00% -0.653258 0.615115 0.458005 0.155010 0.432451 -0.503822 2.113806 -0.832830 0.060603 0.039021 0.020486
10 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 2.689108 1.315959 -0.634072 -0.239685 0.915973 0.795612 14.009453 9.203876 0.029002 0.028154 0.001482
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.441598 3.410912 0.049044 -0.123387 21.249226 46.039768 -0.959142 4.351323 0.402405 0.525670 0.352357
16 N01 digital_ok 0.00% 100.00% 100.00% 0.00% 3.215544 3.867297 -0.653650 -0.849529 -0.260625 0.423764 1.322209 -1.067528 0.030270 0.036451 0.003478
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 2.918311 2.141341 -0.652690 0.215231 58.182851 23.947563 1.667451 8.635323 0.529483 0.367905 0.388744
18 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.222542 0.715700 0.011266 -0.703284 21.748903 3.435843 162.352078 16.396532 0.027820 0.028897 0.001802
19 N02 digital_ok 0.00% 100.00% 100.00% 0.00% -0.382732 -0.796601 0.235974 0.355408 -0.168866 -0.354970 -0.457251 1.269626 0.029567 0.027757 0.001758
20 N02 digital_ok 100.00% 100.00% 100.00% 0.00% 0.195596 0.359561 0.696956 0.092938 -0.217720 -0.025483 11.622392 -0.828718 0.026154 0.027664 0.002102
21 N02 digital_ok 0.00% 100.00% 100.00% 0.00% 0.605463 0.247134 0.195712 0.279145 -0.630964 -0.781598 1.194334 -0.416037 0.028160 0.026369 0.001727
22 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.548713 -0.456665 -1.203721 -1.179890 2.323831 4.334996 2.803460 3.486140 0.031038 0.029672 0.002077
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.859124 0.724309 0.608770 -0.309482 1.182698 -0.938149 3.893887 69.500879 0.025324 0.028974 0.003061
28 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.872289 1.108249 0.592035 -0.541905 1.564651 0.022309 2.708607 5.540213 0.025321 0.029053 0.003187
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 0.175590 0.059864 0.096096 0.131186 0.173088 -0.375998 5.983270 0.844707 0.029040 0.027591 0.001928
30 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 0.988584 2.096430 -0.004451 -0.324002 2.148739 4.623705 33.635689 48.067050 0.027460 0.028213 0.001747
31 N02 digital_ok 0.00% 100.00% 100.00% 0.00% 1.988945 -0.595719 0.857079 0.368349 -0.660429 3.883926 2.850434 3.228026 0.023527 0.026030 0.002183
32 N02 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.222229 1.025917 0.023609 0.077471 -0.938422 -0.540792 -0.557254 1.648265 0.027101 0.026943 0.001196
34 N06 not_connected 0.00% 100.00% 100.00% 0.00% 0.630496 -0.802648 -0.746163 -0.970973 1.284492 0.606994 1.807712 3.735481 0.029306 0.029424 0.001628
35 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.806854 -0.209954 -1.072356 -0.869925 -0.062786 0.486471 13.805797 -0.161808 0.029643 0.029331 0.001529
36 N03 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.195798 0.758205 0.730577 0.625296 -0.414553 -0.650887 1.604468 1.477186 0.024820 0.024693 0.001103
37 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 2.819607 -0.318119 0.055693 1.225431 0.166439 2.026902 1.465692 5.534015 0.026867 0.021608 0.003823
38 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 1.808550 1.217730 0.594786 0.591605 -0.022622 0.513749 10.172657 13.979893 0.024647 0.024572 0.001027
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 3.248313 3.045498 -0.391608 -0.177040 47.668227 44.939141 13.187820 0.996738 0.195849 0.186557 -0.249815
41 N04 digital_ok 100.00% 100.00% 100.00% 0.00% -0.685151 -0.524000 0.356329 0.363516 -0.211624 4.086782 0.696242 0.898254 0.031516 0.029481 0.001919
42 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 0.643528 -0.461972 0.145614 0.456754 -0.359959 -0.939182 0.112517 2.946164 0.035852 0.041016 0.007641
43 N05 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.668427 -0.843362 0.021849 0.329426 -0.278140 0.025598 0.234723 0.181028 0.027485 0.026292 0.001393
44 N05 digital_ok 0.00% 100.00% 100.00% 0.00% 0.402379 -0.546244 0.163594 0.374725 0.619180 -0.043051 -0.007853 -0.102400 0.026850 0.025891 0.001314
45 N05 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
46 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 18.164235 18.082494 inf inf 7512.706428 7586.159586 12690.323070 12685.613632 nan nan nan
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 0.777680 0.769288 -0.770876 -0.830627 1.215301 1.198724 4.783254 0.249990 0.031651 0.044996 0.006938
48 N06 not_connected 0.00% 100.00% 100.00% 0.00% -0.514097 -0.004618 -1.030628 -1.129867 0.002892 1.119634 0.153709 0.748644 0.033095 0.032162 0.002006
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% 2.590365 2.998047 -0.376405 0.160419 43.278093 32.012403 1.842093 15.932102 0.494507 0.524605 0.331921
50 N03 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.872030 0.962376 0.548738 0.767270 0.777932 -0.880283 0.653859 1.582003 0.025438 0.023792 0.001352
51 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 2.339796 1.775907 0.226140 0.238303 9.196619 0.652141 356.161391 0.895454 0.043722 0.026437 0.004047
52 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.908524 0.611548 0.745525 0.673114 -0.805360 -1.205696 11.144640 1.279644 0.026064 0.024973 0.001266
53 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 1.361617 1.592015 0.586336 0.243061 -0.776547 1.296274 11.550457 24.994248 0.049409 0.043929 0.015217
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 3.474374 1.111366 -0.854201 -0.008901 2.150077 -0.688947 5.761017 9.671864 0.039546 0.047741 0.010916
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 2.475410 2.650835 -0.364013 -0.344969 -0.673845 4.415497 1.966981 -0.613167 0.029975 0.028022 0.001966
56 N04 digital_ok 0.00% 100.00% 100.00% 0.00% 0.743574 -0.744709 0.084748 0.522394 -0.130443 2.010670 0.156493 0.350200 0.030434 0.027055 0.001979
57 N04 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.866233 -0.005403 -0.004351 0.165720 -0.572060 -0.307012 0.017928 -0.470299 0.032338 0.037795 0.004769
58 N05 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.991546 0.899129 0.605760 0.701992 1.248957 1.434099 3.460918 2.624292 0.025933 0.024654 0.001257
59 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.794048 -0.083018 0.617638 0.309699 0.769937 -0.876680 1.427485 7.559654 0.027327 0.026784 0.001374
60 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.967096 0.917569 0.052099 0.714370 -0.850904 1.500322 10.078827 4.115766 0.028575 0.024494 0.002494
61 N06 not_connected 100.00% 0.00% 0.00% 0.00% 2.216516 2.942273 -0.577740 -0.140005 36.903512 42.311204 2.197568 1.656080 0.487296 0.521617 0.341642
62 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.379304 0.241958 -1.082673 -1.142161 1.235492 -0.645228 1.556594 7.873672 0.031456 0.031355 0.001806
63 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.049343 0.848392 -1.177899 -0.724314 4.104501 1.778902 27.137136 4.419460 0.038316 0.041437 0.005903
64 N06 not_connected 100.00% 0.00% 0.00% 0.00% 2.591059 3.037055 -0.061801 -0.273448 39.857241 41.441096 6.805511 0.975915 0.518178 0.519235 0.327780
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% -0.628656 -0.233805 1.394083 1.336028 2.109353 2.302194 8.019097 10.437629 0.022357 0.021146 0.001149
66 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 3.977593 -0.212218 -0.691567 1.387066 -0.298038 2.243474 9.019657 11.606433 0.028548 0.020997 0.005024
67 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 2.195627 1.064884 0.255002 0.544043 0.775516 0.147637 8.218709 3.838901 0.026073 0.024757 0.001342
68 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% -0.440685 3.148577 1.422487 -0.164301 1.435656 6.039839 9.115901 0.019977 0.023417 0.028306 0.003963
69 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.502273 0.852405 0.278502 0.097889 0.609270 -0.011491 0.129219 0.960305 0.030737 0.028767 0.002662
70 N04 digital_ok 0.00% 100.00% 100.00% 0.00% -0.508512 -0.777905 0.248102 0.440668 -0.680931 -1.151031 1.048587 -0.310000 0.027352 0.027341 0.001198
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 3.937199 3.278782 -0.297248 -0.418027 50.649167 46.801999 0.046927 1.605986 0.562649 0.542530 0.358580
72 N04 digital_ok 100.00% 20.97% 82.22% 17.78% 2.937722 1.422556 -1.076771 0.550627 55.520371 15.685851 25.689584 2.839526 0.216016 0.114122 -0.107359
73 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 26.222725 26.336635 inf inf 7718.335179 7745.752744 11872.742042 12022.685602 nan nan nan
74 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.619253 0.602250 -0.613449 -0.184503 17.228950 13.240066 147.933623 121.148029 0.028643 0.027627 0.001569
77 N06 not_connected 100.00% 100.00% 100.00% 0.00% -0.165902 -0.815406 -1.180613 -1.218011 -0.468356 -0.974871 11.736099 5.061298 0.030819 0.030428 0.001480
78 N06 not_connected 0.00% 100.00% 100.00% 0.00% -0.587468 -0.054227 -1.133679 -1.165523 0.051370 -0.761966 -0.717923 0.518599 0.041227 0.037687 0.006617
79 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.470059 0.786296 -0.934112 -0.727548 -0.095724 0.996278 0.442001 -1.209403 0.031250 0.030687 0.001374
80 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.346673 0.662790 -1.141108 -0.750780 -0.795600 0.950394 -0.653756 1.046190 0.031563 0.029393 0.002273
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 9.526294 7.372292 7.011944 4.122492 108.691654 33.284563 2203.583717 668.796498 0.017266 0.016738 0.000824
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.295243 8.158291 5.198417 4.062857 48.299103 29.275048 1154.710658 781.612544 0.016473 0.016503 0.000773
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 4.309193 6.895632 3.693336 3.311375 15.992755 19.278385 554.312545 472.925907 0.016704 0.016786 0.000794
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 3.847088 0.337898 -1.195550 1.419635 70.603080 1.622641 2.320234 7.788977 0.532666 0.073200 0.406657
85 N08 digital_ok 0.00% 100.00% 100.00% 0.00% -0.258588 -0.400395 -0.178383 -0.150650 -0.568127 -0.888241 0.007084 0.102244 0.031894 0.030161 0.002694
86 N08 digital_ok 100.00% 100.00% 100.00% 0.00% -0.056983 -0.168155 -0.275444 -0.262792 4.927631 -0.660984 7.422196 14.016397 0.031052 0.030047 0.002370
87 N08 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.876749 1.432036 0.739410 0.073055 0.771462 0.057666 2.766587 0.848860 0.027305 0.028414 0.001528
88 N09 digital_ok 100.00% 100.00% 100.00% 0.00% -0.753348 -0.616129 0.031730 0.080506 -0.629840 -0.995890 14.568917 13.916610 0.029388 0.027535 0.002010
89 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.821623 -0.765196 -0.000855 0.055007 -0.007387 -0.231132 -0.643522 -0.850411 0.032170 0.028373 0.002258
90 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.182386 0.576840 -0.112022 -0.270879 -0.775521 -0.930247 0.104926 0.258205 0.031772 0.029871 0.002309
91 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.821858 -0.661383 0.003048 0.050526 -0.337356 -0.575457 -0.224680 -0.613501 0.027308 0.027274 0.001286
92 N10 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.898532 -0.400461 0.607379 0.299313 1.518487 -0.684888 0.012392 0.127055 0.027175 0.026223 0.001471
93 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 0.837351 0.866958 0.636387 0.726364 1.059051 1.109619 3.830041 2.605166 0.024766 0.024079 0.001111
94 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 0.719302 0.814064 0.666534 0.677554 1.178990 1.354985 1.917285 1.091055 0.024519 0.024341 0.001037
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 2.010485 3.006922 -0.009686 0.445774 34.985094 23.053779 -0.910759 -2.164513 0.376315 0.381424 0.178093
96 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.224958 -0.794297 -1.118198 -0.965087 -1.035340 -0.725715 -0.374191 -1.016663 0.029872 0.029964 0.001740
97 N11 not_connected 100.00% 100.00% 100.00% 0.00% -0.438236 -0.055783 -0.913653 -0.830051 -0.335808 0.636023 -0.332200 7.656748 0.029775 0.029487 0.001674
101 N08 digital_ok 0.00% 100.00% 100.00% 0.00% 0.303439 -0.275713 0.505776 0.635177 -0.727678 -0.869132 1.703940 1.069791 0.026776 0.025079 0.001443
102 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.433932 0.109662 0.010645 0.097819 -0.238105 -0.820728 0.412630 8.275984 0.031902 0.030036 0.002331
103 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 4.405856 1.197105 -0.821420 0.197074 0.829636 -0.837089 11.538866 6.025753 0.029352 0.026233 0.002125
104 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.556820 11.769621 0.458498 3.129577 7.644014 -0.952134 3.771483 28.353789 0.026175 0.017817 0.004874
105 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.633367 -0.553983 0.065045 0.170707 -1.152674 -0.232175 -0.499303 -1.042700 0.029094 0.026795 0.001969
106 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.780040 -0.805479 -0.066374 0.020674 1.355403 0.668050 1.661580 -0.857328 0.029393 0.027672 0.001765
107 N09 digital_ok 0.00% 100.00% 100.00% 0.00% -0.747282 -0.640894 -0.094258 -0.120941 -0.848406 -1.084805 1.470368 3.262657 0.031953 0.030379 0.002222
108 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.494797 -0.477436 0.280248 0.428136 -0.313449 -0.145269 12.908055 0.323392 0.026506 0.026266 0.001224
109 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 0.917879 0.887450 0.631773 0.646324 1.496645 1.621378 0.327023 2.513693 0.026933 0.024993 0.001585
110 N10 RF_maintenance 0.00% 100.00% 100.00% 0.00% 2.418015 2.057894 0.382623 0.424042 -0.984093 0.032622 1.566082 0.377647 0.025498 0.025290 0.000966
111 N10 digital_ok 0.00% 100.00% 100.00% 0.00% -0.779288 0.912192 0.335560 0.671427 -0.028495 1.636487 -0.161277 3.315672 0.026143 0.024384 0.001372
112 N10 digital_ok 0.00% 100.00% 100.00% 0.00% -0.764822 0.723989 0.353973 0.704454 -0.456730 1.589007 -0.121548 2.223766 0.027781 0.024403 0.002184
113 N11 not_connected 0.00% 100.00% 100.00% 0.00% 0.595499 0.698415 -0.841777 -0.729372 0.861442 1.007848 2.507820 0.602582 0.030445 0.029419 0.001368
114 N11 not_connected 0.00% 100.00% 100.00% 0.00% 0.475677 -0.302037 -0.800002 -0.979982 0.704329 -0.900209 -0.257275 -0.867195 0.029391 0.029866 0.001688
115 N11 not_connected 100.00% 0.00% 0.00% 0.00% 2.702166 3.135511 -0.086390 0.273179 40.404114 31.141874 0.356902 -1.751360 0.507610 0.521043 0.340789
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 4.091474 6.755962 3.797112 4.737072 30.295020 37.864484 749.136250 1039.544110 0.017875 0.016313 0.001323
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 4.286653 5.175118 3.872573 4.154626 24.125359 23.007534 679.983333 531.812193 0.016728 0.016369 0.000798
120 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.862237 1.381563 0.975982 0.506197 -0.412947 0.280959 15.903209 18.036697 0.025412 0.025413 0.001237
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.750462 3.840723 0.824868 -0.759248 10.703871 60.383657 1.589227 23.108473 0.548790 0.512868 0.327732
122 N08 digital_ok 0.00% 100.00% 100.00% 0.00% 0.743090 0.639330 0.437636 0.327166 0.264487 -1.001108 1.012897 1.250625 0.026106 0.025879 0.001198
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.142887 3.837049 1.032704 0.654310 2.814925 16.988936 -6.290257 -4.108079 0.550483 0.540652 0.346111
124 N09 digital_ok 0.00% 100.00% 100.00% 0.00% 0.855104 -0.530552 0.680101 0.394943 0.691397 -0.933312 0.440405 0.962283 0.032139 0.028638 0.003000
125 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.560850 -0.838491 0.108135 0.119038 3.075525 0.259923 -0.265516 -0.416708 0.027042 0.026908 0.001217
126 N09 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.711270 -0.529142 0.000855 0.180257 2.389080 -0.815779 0.678897 -0.197807 0.027621 0.026970 0.001373
127 N10 digital_ok 0.00% 100.00% 100.00% 0.00% 0.929474 0.270402 0.605982 0.114320 1.481681 -0.265911 -0.062223 -0.645161 0.025147 0.026702 0.001391
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 0.101994 1.113310 0.167751 -0.028854 -0.738219 0.381730 0.861989 7.906017 0.026777 0.027204 0.001241
131 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.723627 0.647043 -0.975935 -0.660934 -0.482612 1.394663 0.338855 -0.824768 0.032017 0.032452 0.001601
132 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.633992 -0.416314 -1.026418 -0.856518 -1.052859 -0.036542 -0.342568 -0.355851 0.029575 0.029311 0.001582
133 N11 not_connected 0.00% 100.00% 100.00% 0.00% -0.521286 -0.770283 -0.998105 -0.969840 -0.004509 0.306775 0.621010 -0.114388 0.031803 0.030537 0.002110
134 N11 not_connected 0.00% 100.00% 100.00% 0.00% 0.695250 0.705988 -0.804299 -0.734201 0.777067 1.049460 0.060049 0.576698 0.031178 0.029563 0.002317
135 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% 30.098875 30.071739 inf inf 8675.263033 8702.100295 14339.721004 14474.331398 nan nan nan
136 N12 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.455732 9.307504 5.800632 5.247921 66.964076 43.115066 1879.709909 1009.259563 0.016308 0.016210 0.000779
139 N13 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.218020 -0.625867 -1.160099 -0.974224 -0.309928 0.778770 -0.489483 -0.833203 0.032205 0.031242 0.002624
140 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.307046 0.867156 0.195587 -0.006312 1.344663 0.467901 2.939546 3.641965 0.030422 0.029259 0.001798
141 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.727525 1.059985 0.350390 0.018003 -0.398784 0.012608 -0.409138 -0.670084 0.029461 0.028314 0.001641
142 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% 1.029786 0.899147 -0.016953 0.712818 1.175434 1.431758 34.628024 2.523261 0.028919 0.025095 0.002726
143 N14 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.774705 0.903492 0.578969 0.702599 -1.321011 1.354523 0.028338 1.776926 0.090247 0.024682 0.012287
144 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.106410 0.898376 0.185844 -0.089554 -0.306542 5.773747 -0.032006 0.823295 0.028797 0.027824 0.001594
145 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.143116 0.153535 0.253673 0.206723 -0.134904 8.747183 -0.432153 0.177964 0.026740 0.027042 0.001268
146 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.756927 -0.796329 -1.032863 -1.025146 0.441332 0.391377 -0.330762 -1.105089 0.029593 0.029364 0.001641
147 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 30.460169 30.420904 inf inf 7289.226540 7423.371713 10769.972470 11357.504705 nan nan nan
149 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
150 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 24.202568 24.154695 inf inf 6574.545196 6660.002358 13198.293219 13246.060259 nan nan nan
151 N16 digital_ok 0.00% 100.00% 100.00% 0.00% -0.534871 0.059117 -1.056356 -0.805849 0.233513 0.584231 -0.324296 0.256209 0.032044 0.029965 0.002319
155 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% 29.089043 29.060912 inf inf 7399.967843 7383.468784 10117.926938 9916.921298 nan nan nan
156 N12 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.597810 0.947711 0.584171 0.658140 1.360527 1.691904 2.123396 3.423741 0.028982 0.026791 0.001598
157 N12 digital_ok 0.00% 100.00% 100.00% 0.00% -0.625915 -0.808181 0.265220 0.312243 0.041820 -0.276888 -0.359099 -0.543380 0.028784 0.026838 0.001610
158 N12 digital_ok 100.00% 100.00% 100.00% 0.00% 0.038066 0.096130 0.213476 0.293620 -0.647758 -1.092176 5.219887 14.781754 0.026792 0.026152 0.001153
159 N13 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.523866 -0.758760 -1.040712 -0.998126 1.202119 -0.202338 -0.814865 -0.267938 0.032111 0.031292 0.002482
160 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 0.797764 0.430950 0.602828 0.160538 1.285171 -0.404637 0.435155 -0.046515 0.055334 0.034279 0.009456
161 N13 digital_ok 0.00% 100.00% 100.00% 0.00% 0.032751 1.067966 0.254522 0.033942 -0.830468 -0.986514 -0.381130 0.200680 0.034457 0.031210 0.002899
162 N13 digital_ok 100.00% 100.00% 100.00% 0.00% 1.810922 1.337906 -0.174529 0.015861 0.885603 -0.384272 12.318368 0.587131 0.054317 0.036370 0.007516
163 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.329657 -0.567252 0.241316 0.303026 0.944807 0.989917 4.218204 4.357933 0.029195 0.026754 0.001821
164 N14 digital_ok 100.00% 100.00% 100.00% 0.00% -0.159995 -0.561930 0.237134 0.382385 7.076313 -1.080759 -0.041488 0.490255 0.026932 0.026704 0.001306
165 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 0.411546 0.065351 0.039683 0.104036 1.258005 -0.433685 0.378942 -0.391040 0.029228 0.027268 0.001890
166 N14 digital_ok 0.00% 100.00% 100.00% 0.00% -0.859869 1.589059 0.390784 -0.120435 0.160608 -0.998768 0.087907 -0.263594 0.026112 0.027997 0.001508
167 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
168 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
169 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
170 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
171 N16 digital_ok 0.00% 100.00% 100.00% 0.00% 0.099343 -0.751762 -1.080076 -1.157510 0.589531 0.544723 -0.752505 -0.376555 0.030201 0.030390 0.001857
172 N16 digital_ok 0.00% 100.00% 100.00% 0.00% 2.526365 0.680554 -0.758229 -1.115220 -0.613581 0.483004 2.104383 2.021795 0.030405 0.030754 0.002038
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.892323 3.136226 1.133913 1.187118 -1.491959 -1.890347 -7.705826 -5.842419 0.501655 0.500611 0.313310
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.534250 3.223792 -0.504728 -0.200001 49.139092 48.163890 2.012051 2.410240 0.532077 0.514159 0.337529
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.827438 0.802487 -0.163651 0.743102 49.169104 1.185677 31.905651 3.393308 0.553568 0.033732 0.313104
181 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.882532 -0.808260 0.390128 0.407012 0.983705 0.765716 -0.281707 2.247698 0.066093 0.033580 0.011847
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 2.713941 0.929462 0.197343 0.641574 34.297709 1.677529 8.896000 3.243529 0.556351 0.036295 0.335990
183 N13 digital_ok 0.00% 100.00% 100.00% 0.00% -0.135306 -0.197301 0.095529 0.148839 -0.816776 0.722001 -0.587115 0.646266 0.030933 0.029333 0.001900
184 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 0.591093 0.459967 0.515583 0.048760 2.197177 0.139767 1.549068 -0.389247 0.029303 0.027483 0.001815
185 N14 RF_maintenance 0.00% 100.00% 100.00% 0.00% 1.323352 0.409348 -0.177732 -0.003298 -0.218873 -0.691795 0.865755 0.035469 0.028083 0.028109 0.001331
186 N14 digital_ok 0.00% 100.00% 100.00% 0.00% 2.495934 2.014071 -0.411146 -0.309670 -0.045912 0.301828 2.141612 -0.119377 0.031219 0.029492 0.002142
187 N14 digital_ok 100.00% 100.00% 100.00% 0.00% 0.786010 2.090517 0.025122 -0.304311 -0.862268 2.906407 9.737831 3.862017 0.027287 0.027907 0.001356
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
190 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
191 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 30.349650 30.315373 inf inf 7420.358633 7471.515074 11190.022133 11533.329846 nan nan nan
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.786948 3.121521 1.035431 1.214693 2.496577 -2.275333 -6.600353 -8.030076 0.508066 0.498211 0.322433
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.871498 3.086823 1.172351 1.140316 -2.040253 -0.537470 -7.846406 -7.653813 0.500296 0.500904 0.314979
200 N18 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.633352 -0.503054 -0.795889 -0.908752 1.574583 0.236304 2.230067 2.186123 0.039427 0.038119 0.004092
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.692655 3.096722 0.813095 1.090168 10.449742 1.926811 -3.169778 -6.469690 0.529157 0.480248 0.345542
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% -0.270560 -0.045417 -1.109992 -0.843478 -0.231809 -0.602500 -0.615593 9.066554 0.037801 0.066014 0.021209
204 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% -0.420558 0.356643 0.299339 0.084737 1.091039 -0.691668 14.434970 0.585971 0.028134 0.026849 0.001100
205 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.519514 -0.344987 -0.799512 -0.813814 0.653773 -0.512043 0.059874 2.516068 0.029558 0.029513 0.001661
206 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.009176 0.562054 -0.955994 -0.813224 1.839442 1.456132 -0.261585 -1.070086 0.029660 0.029568 0.001687
207 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.587262 -0.771302 -1.033652 -0.980517 0.584840 -0.132348 1.837133 -0.049469 0.043402 0.037032 0.006918
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% 100.00% 100.00% 0.00% -0.299733 0.828164 -0.962648 -0.720892 0.028219 1.055643 -1.092028 1.058295 0.032553 0.030868 0.002452
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.465891 -0.107371 -1.138341 -1.100795 2.680451 3.192782 33.555236 28.138558 0.033255 0.030527 0.002917
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% -0.796008 -0.698779 -1.081184 -1.028868 -0.526147 -0.914491 4.244239 5.321536 0.031408 0.029733 0.002328
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% -0.776323 -0.814342 -1.041486 -0.980398 -0.761622 -0.553589 6.339804 7.323038 0.029560 0.029284 0.001671
223 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.064470 0.586358 -0.976486 -0.828404 0.880285 1.377724 -0.734677 -0.350445 0.067619 0.050719 0.027724
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.904750 3.088724 1.241128 1.199452 -3.300005 -1.601748 -8.224661 -7.424009 0.461919 0.462733 0.333848
225 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.488161 0.831279 -1.090533 -0.760645 -0.839456 1.517158 -0.762858 1.702708 0.030490 0.032274 0.003065
226 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.708663 -0.160709 -0.992972 -1.124327 -0.002892 1.038341 -0.746488 -0.797349 0.029468 0.030081 0.001760
227 N20 RF_ok 0.00% 100.00% 100.00% 0.00% 0.470212 -0.518532 -0.851295 -0.912905 0.523896 0.737273 -0.488510 -1.138244 0.031173 0.029790 0.001988
228 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.741286 0.106370 -1.168055 -0.935320 0.095620 0.947803 -0.272161 -1.098677 0.030092 0.029312 0.001802
229 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% 0.012185 0.466484 -1.176667 -1.114278 -1.237344 -1.493696 5.008674 -0.886925 0.029704 0.029670 0.001819
237 N18 RF_ok 0.00% 100.00% 100.00% 0.00% -0.181489 -0.795933 -0.949129 -0.936375 0.221669 0.134943 0.387804 3.381487 0.029507 0.029283 0.001636
238 N18 RF_ok 0.00% 100.00% 100.00% 0.00% -0.636358 -0.605281 -1.092535 -0.952675 -0.912793 -1.238827 -0.770935 -0.965484 0.029808 0.029370 0.001664
239 N18 RF_ok 0.00% 100.00% 100.00% 0.00% -0.772074 -0.774550 -1.118616 -1.058240 0.352190 -0.319435 -0.204766 -0.007084 0.031476 0.029781 0.002117
240 N19 RF_maintenance 0.00% 100.00% 100.00% 0.00% 0.064272 -0.717996 -0.938850 -0.905625 0.095242 -0.225331 0.098381 -0.105376 0.029496 0.029404 0.001684
241 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.808991 -0.560258 -1.022962 -1.004623 -0.641685 0.143608 -0.747912 -0.974563 0.030489 0.029396 0.002057
242 N19 RF_ok 0.00% 100.00% 100.00% 0.00% -0.663657 0.004618 -1.113178 -1.132610 -0.367765 0.021036 -0.993758 -0.560358 0.029839 0.029509 0.001764
243 N19 RF_ok 0.00% 100.00% 100.00% 0.00% 0.165717 -0.387672 -1.167128 -0.932725 -0.601082 -0.301810 -0.622882 -0.929633 0.029792 0.029333 0.001741
244 N20 RF_maintenance 0.00% 100.00% 100.00% 0.00% -0.176638 -0.512161 -0.951011 -0.870698 -0.097988 1.555968 0.396037 -0.416331 0.031533 0.030366 0.002298
245 N20 RF_ok 0.00% 100.00% 100.00% 0.00% -0.708864 -0.482160 -1.049113 -0.892197 -0.573281 -0.061398 -0.566148 -0.212424 0.030040 0.029372 0.001853
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 2.503024 0.747984 -0.016902 -0.847031 38.694955 1.523139 -0.463046 -0.468445 0.488440 0.031976 0.242686
261 N20 RF_ok 0.00% 100.00% 100.00% 0.00% -0.775858 -0.604423 -1.030852 -0.956539 -0.362783 0.184332 1.672764 -0.503795 0.030231 0.029485 0.001819
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% -0.427358 -0.161106 0.279960 0.297136 0.071016 0.379432 6.081952 8.791481 0.025549 0.025484 0.000880
320 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.926445 3.035216 0.711149 0.539153 14.944545 19.133777 -3.377862 0.632166 0.432880 0.416853 0.316940
324 N04 not_connected 100.00% 0.00% 0.00% 0.00% 2.735782 3.163267 0.436329 0.579321 24.092709 18.773519 -1.081874 -2.509389 0.423628 0.416740 0.308191
325 N09 dish_ok 100.00% 0.00% 0.00% 0.00% 2.795332 3.156618 0.403723 -0.092573 25.517242 39.185950 -1.903458 0.877264 0.450946 0.438061 0.330675
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.374155 3.170726 0.241797 -0.000311 31.076314 39.563022 0.238557 -0.343353 0.428484 0.419263 0.310638
333 N12 dish_maintenance 0.00% 100.00% 100.00% 0.00% -0.272102 -0.374715 -0.909702 -0.838641 0.068172 0.129111 2.484411 -1.060858 0.033998 0.029673 0.003305
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, 5, 7, 8, 9, 10, 15, 16, 17, 18, 19, 20, 21, 22, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 131, 132, 133, 134, 135, 136, 137, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 179, 180, 181, 182, 183, 184, 185, 186, 187, 189, 190, 191, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 220, 221, 222, 223, 225, 226, 227, 228, 229, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 324, 325, 329, 333]

unflagged_ants: [173, 192, 193, 224]

golden_ants: [173, 192, 193]
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_2460041.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 [ ]: