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 = "2459908"
data_path = "/mnt/sn1/2459908"
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: 11-24-2022
In [5]:
# Per-season options
def ant_to_report_url(ant):
    return f'https://htmlpreview.github.io/?https://github.com/HERA-Team/H6C_Notebooks/blob/main/antenna_report/antenna_{ant}_report.html'

Load Auto Metrics¶

In [6]:
use_auto_metrics = False

# find the auto_metrics file
glob_str = os.path.join(data_path, f'zen.{JD}*.auto_metrics.h5')
auto_metrics_file = sorted(glob.glob(glob_str))

# if it exists, load and extract relevant information
if len(auto_metrics_file) > 0:
    auto_metrics_file = auto_metrics_file[0]
    print(f'Found auto_metrics results file at {auto_metrics_file}.')
    
    auto_metrics = load_metric_file(auto_metrics_file)
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
    auto_ex_ants = auto_metrics['ex_ants']['r2_ex_ants']
    
    use_auto_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping auto_metrics.')
Found auto_metrics results file at /mnt/sn1/2459908/zen.2459908.25246.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/2459908/zen.2459908.?????.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/2459908/zen.2459908.?????.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 2459908
Date 11-24-2022
LST Range 23.731 -- 9.693 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1851
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 7
dish_ok: 1
RF_maintenance: 52
RF_ok: 19
digital_ok: 98
not_connected: 24
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 201 (0.0%)
Antennas in Commanded State (observed) 0 / 201 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 18
Nodes Registering 0s N20
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 70 / 201 (34.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 130 / 201 (64.7%)
Redcal Done? ❌
Never Flagged Antennas 71 / 201 (35.3%)
A Priori Good Antennas Flagged 57 / 98 total a priori good antennas:
3, 7, 9, 15, 19, 29, 30, 37, 38, 42, 51, 53,
54, 55, 56, 59, 68, 71, 72, 81, 84, 86, 88,
93, 94, 101, 103, 107, 108, 109, 111, 117,
118, 121, 122, 123, 124, 127, 129, 130, 136,
142, 143, 146, 155, 158, 161, 164, 165, 170,
181, 182, 183, 185, 187, 189, 191
A Priori Bad Antennas Not Flagged 30 / 103 total a priori bad antennas:
8, 22, 43, 46, 48, 62, 64, 74, 77, 79, 82,
95, 115, 120, 125, 132, 137, 138, 139, 148,
149, 150, 168, 220, 221, 223, 238, 239, 324,
333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459908.csv

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
3 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.617361 0.054583 8.228698 0.402920 6.347146 0.799176 0.897520 2.181779 0.034115 0.676741 0.576884
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.050709 2.498701 0.758853 -1.124509 2.885065 3.473692 22.544015 45.221866 0.671873 0.675183 0.413905
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.094134 0.052391 -0.298242 -0.255210 -0.194479 1.098288 2.647813 0.047789 0.670141 0.680181 0.411927
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.031317 -0.661767 0.607103 2.417072 -0.314294 -0.081953 15.082162 16.790118 0.664326 0.672183 0.406565
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.546214 -1.086745 -0.846612 -0.165662 -0.071379 1.142463 3.402983 3.487374 0.667833 0.681563 0.405739
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.455483 0.245977 6.833280 0.189493 3.077736 0.856030 0.069833 -0.348906 0.492725 0.675324 0.475333
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.812467 -0.437936 -1.227478 -0.540214 -0.289201 0.702493 -0.219793 0.077276 0.654114 0.670939 0.411552
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.837023 0.343993 7.730126 1.161055 6.353536 1.191653 0.239212 17.502608 0.032706 0.677567 0.557995
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -1.042043 -1.550668 -0.554618 0.277305 0.738938 1.085593 2.512281 2.276551 0.677524 0.687179 0.411796
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.514452 0.987910 -0.231515 -0.001140 0.430367 0.697341 0.826314 0.963480 0.674161 0.688464 0.409950
18 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.597652 10.409166 8.210730 0.270807 6.446647 0.111806 0.827711 28.587039 0.028956 0.468051 0.382422
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 1.511841 -0.930883 0.573616 1.011459 0.182496 0.092389 2.066198 7.088665 0.664627 0.688148 0.401180
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.608218 -1.182138 2.871686 -1.453961 0.583724 -0.357155 1.791721 -0.227327 0.653814 0.694195 0.416299
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.451704 -0.233042 -0.376546 3.693014 0.585276 -0.740655 0.225654 -0.150426 0.656100 0.648894 0.406226
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.801009 -0.832889 -0.058165 -0.551387 1.591421 0.121222 -0.507623 -1.258536 0.630003 0.654004 0.404412
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 10.166041 11.359317 8.252662 8.823299 6.449466 5.742962 2.621040 1.787478 0.032870 0.037499 0.004289
28 N01 RF_maintenance 100.00% 0.00% 83.95% 0.00% 12.752355 27.267958 0.952957 0.820124 3.370912 5.346624 4.051824 16.673435 0.366320 0.165705 0.260943
29 N01 digital_ok 100.00% 0.00% 100.00% 0.00% -1.551794 11.795636 -0.141026 8.483179 -0.398153 5.727692 -0.114166 0.244803 0.677041 0.035862 0.595947
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% -0.801825 0.006076 -0.596885 0.299990 1.373840 0.813340 10.644533 0.154830 0.677250 0.694125 0.400855
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.028400 -0.846353 0.729057 1.118019 1.097705 0.819009 1.492157 2.912890 0.684514 0.692643 0.402167
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.371355 22.982493 0.053610 1.952262 10.651326 4.155813 10.999793 5.009750 0.606985 0.590006 0.305202
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 12.406209 -0.862436 3.576902 -0.269682 6.389408 -1.033424 1.105198 -0.525809 0.044159 0.672196 0.524836
35 N06 not_connected 100.00% 0.00% 0.00% 0.00% -1.364547 -0.456293 -0.698702 -1.338746 7.680149 -1.284695 0.440280 -0.290920 0.624486 0.649468 0.400017
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.769761 8.103967 -0.163425 0.207790 0.668405 2.109044 0.765606 1.928015 0.659232 0.678755 0.405346
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.531457 0.448357 -1.269985 0.488556 0.190230 1.189597 -0.699372 8.678946 0.672769 0.688458 0.414776
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.239665 0.061780 -0.109164 0.392634 0.434842 0.687039 6.383176 1.462364 0.674176 0.692109 0.415261
40 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.236893 0.933844 -0.145897 0.340444 -0.486110 0.543610 -0.479886 -0.137255 0.673436 0.687288 0.403932
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.084190 0.380959 -0.846833 -0.146181 0.595892 0.148068 -0.435210 0.759493 0.679886 0.689269 0.391168
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 11.473823 12.332439 8.432860 9.204638 6.337871 5.700941 1.974289 2.649268 0.034842 0.032383 0.000854
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.508440 0.669884 -0.289651 0.318384 -0.584457 0.340507 -1.023868 2.265148 0.692451 0.697720 0.403572
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.617178 0.458750 -1.329258 -0.059848 -0.204343 0.671666 -0.823956 -0.487310 0.689221 0.704425 0.400291
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.612715 3.194584 -0.042745 0.088560 -0.324357 1.348325 -0.030150 3.267017 0.677160 0.681083 0.390508
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.950094 1.675188 0.988159 1.198131 -0.389533 -0.773501 0.226608 -1.781374 0.667812 0.702036 0.414051
47 N06 not_connected 100.00% 100.00% 0.00% 0.00% 11.674117 0.918381 3.421770 -1.463965 6.368773 -1.622847 0.945315 5.182129 0.038594 0.659644 0.506773
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.067169 0.526935 0.070625 0.905117 3.566059 -0.610114 -0.742480 -2.295113 0.640727 0.674482 0.408185
49 N06 not_connected 100.00% 0.00% 0.00% 0.00% -0.070814 -0.240683 -0.581727 -1.543485 -0.172615 -1.150159 0.854312 15.274387 0.594271 0.644947 0.403622
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.647446 25.627816 -0.028358 1.111596 1.151116 1.141083 21.130636 32.861139 0.651779 0.602943 0.371963
51 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 267.193738 266.872508 inf inf 4898.776871 4897.627687 10443.085290 10438.899609 nan nan nan
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.095205 6.557987 -0.549979 0.296712 0.144046 1.346348 0.933313 0.912029 0.678794 0.698429 0.402859
53 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 183.790440 185.429188 inf inf 3766.348476 3664.094806 7352.808122 7187.642218 nan nan nan
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.662575 12.044779 8.259442 9.014982 6.420062 5.727957 2.374610 1.263149 0.032782 0.032651 0.001362
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 1.467790 12.769026 0.456929 8.935886 1.936149 5.731164 3.552108 2.579679 0.680367 0.034854 0.541746
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% -0.149079 12.863062 0.054594 9.104832 -0.296567 5.681771 2.209131 0.818323 0.683484 0.038273 0.558151
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 29.166452 1.145987 4.717047 0.360201 4.382394 0.583466 3.735711 2.003164 0.488225 0.699241 0.407659
58 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 23.113898 11.644427 -0.627356 8.909347 5.192680 5.772094 6.103975 2.772254 0.377240 0.036667 0.258868
59 N05 digital_ok 100.00% 100.00% 0.00% 0.00% 11.354343 0.722681 8.184625 1.481008 6.322586 1.838516 1.645988 8.468414 0.051999 0.693276 0.547163
60 N05 RF_maintenance 100.00% 0.00% 99.41% 0.00% 0.789186 11.544620 -0.560414 8.943293 -0.253583 5.710372 0.636323 2.714579 0.676098 0.079849 0.532081
61 N06 not_connected 100.00% 0.00% 0.00% 0.00% 9.777038 0.073842 2.609025 -0.971744 4.496599 -1.612175 -0.207369 0.810335 0.394622 0.662309 0.458657
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.575355 1.022300 -1.561703 0.609075 -1.090962 -1.173298 0.644952 -1.551929 0.625835 0.676639 0.407617
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 0.146870 11.980445 -0.581357 4.085649 -0.599586 5.750152 -0.552730 2.717055 0.621063 0.042686 0.476290
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.263092 0.331573 -1.363714 -0.436603 0.769095 -1.369397 2.098825 -0.208430 0.600424 0.611267 0.382819
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.318025 1.256902 0.149445 0.674227 0.815256 1.342618 1.135706 1.514399 0.655784 0.690549 0.414903
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.280288 1.659569 1.437478 1.561048 1.524240 0.419118 -0.204721 2.291315 0.663782 0.692017 0.407719
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.962499 -0.649140 1.521124 1.515448 -0.240601 0.730979 0.645667 1.538732 0.671087 0.695475 0.400237
68 N03 digital_ok 100.00% 0.00% 100.00% 0.00% 0.394463 27.898681 0.257254 11.754930 0.078960 5.687093 1.422475 9.359165 0.682073 0.031809 0.553011
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.166834 -0.098747 0.057516 0.370262 -0.328858 1.277032 0.030581 0.510640 0.681986 0.704601 0.395614
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.508862 0.017520 -0.674755 -0.250066 0.352695 1.421151 0.636117 0.682293 0.690918 0.709150 0.394525
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.554777 0.115212 0.170657 0.847254 0.412831 0.270442 0.869679 1.140743 0.699290 0.709243 0.392138
72 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 2.660430 0.488976 0.341159 0.807798 0.127808 0.313184 14.620599 1.102754 0.686296 0.704628 0.389200
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.297724 0.856895 -0.951885 1.923390 -0.120463 4.966887 -0.320232 0.057309 0.699686 0.699511 0.396471
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.325995 1.488925 -0.123624 -0.780291 -0.499860 1.056582 -1.024694 1.495024 0.693062 0.703366 0.391745
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.384621 -0.036468 0.145229 -1.100066 -1.002416 -1.565652 -1.465177 -0.606664 0.656139 0.647750 0.398222
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 32.906736 0.074705 -0.686126 0.566250 2.100038 -1.368482 0.830636 0.174794 0.440068 0.663525 0.394199
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.115724 -0.532389 -0.824744 -1.234126 -1.029393 -1.098096 1.648444 -0.712188 0.629278 0.660696 0.405734
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 9.302128 13.283790 1.806809 3.979804 4.856940 5.671503 10.811088 0.938307 0.310153 0.038935 0.211336
81 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -0.584450 -1.124502 -0.530233 2.595121 -0.465616 16.609144 0.062531 0.757683 0.634959 0.651499 0.392152
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.338249 -0.258808 -0.134421 1.522455 0.111293 -0.201452 -0.448420 -0.406612 0.654222 0.676420 0.399036
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.568581 0.097502 -0.340247 0.170321 0.123171 -0.190747 -0.546369 0.591505 0.666568 0.691927 0.396906
84 N08 digital_ok 100.00% 19.88% 100.00% 0.00% 20.945092 24.655310 10.631041 11.377064 5.088994 5.639519 4.875679 5.815793 0.244854 0.035882 0.165761
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.873131 3.746199 1.885361 0.408034 -0.995372 1.258382 -0.359301 1.064276 0.661249 0.696284 0.393016
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.262042 -0.255558 1.541759 1.212633 2.092591 -0.246895 -0.005460 19.625915 0.669727 0.697342 0.386787
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 13.699267 7.217722 0.879071 -0.176693 13.994741 0.852675 3.754489 1.590537 0.616103 0.717039 0.359655
88 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 0.598694 0.456995 -0.013597 0.744466 -0.873897 0.238680 4.430743 1.458381 0.684352 0.702653 0.378879
89 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
90 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.540659 -0.347952 1.026622 0.972207 -0.832032 -0.042822 -0.007213 4.842211 0.676801 0.695725 0.388445
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.679098 0.363651 0.001140 0.159537 -0.342386 0.200681 0.049858 -0.232203 0.675882 0.700228 0.398467
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.548376 -0.169075 -0.724335 0.361355 -0.480033 -1.607993 0.237840 0.047142 0.633200 0.674713 0.412579
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.896851 12.836076 3.413454 4.125572 6.293426 5.636688 1.134876 0.591946 0.033062 0.037519 0.002661
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.858925 4.052836 0.139456 0.302450 -0.860776 -1.075376 -1.143194 10.894032 0.621898 0.606851 0.402317
98 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.840270 0.899833 -0.189894 0.033971 -0.018444 0.502925 0.077477 2.354561 0.631674 0.667290 0.406524
99 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.155086 -0.605876 0.421397 0.653024 -0.579156 1.048642 1.928352 -0.364159 0.638330 0.677042 0.406702
100 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -1.237340 -0.516789 -0.282950 0.769112 0.629530 0.189329 0.914842 2.523632 0.658697 0.685570 0.396291
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.718202 8.071714 -0.688550 0.706143 0.037322 1.286805 0.568192 0.429386 0.683918 0.704562 0.392280
102 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.320527 0.877440 -0.730924 1.769143 -0.515534 -0.114385 -0.420490 6.437317 0.689730 0.697272 0.385750
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.505090 5.270770 3.109414 0.238800 2.023359 2.546390 6.878546 5.110285 0.668698 0.708979 0.389405
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.180423 61.203883 5.590281 6.250684 1.962003 3.583620 0.832060 2.107186 0.634333 0.679985 0.390511
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.030247 0.047224 -0.318058 0.634195 0.490142 0.014168 -0.071018 -0.118175 0.691820 0.705537 0.379113
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.350257 0.582262 0.850756 0.897425 -0.131747 -0.178239 -0.173049 0.324312 0.678493 0.702957 0.384451
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 1.107769 0.537995 -0.632844 -0.134054 0.069249 -0.158060 4.382567 5.468986 0.688553 0.705543 0.386061
108 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 10.755904 3.905644 8.199036 -0.358465 6.398744 0.535867 1.945312 -0.078854 0.041839 0.706875 0.502207
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.556568 11.687802 8.243789 8.725809 6.461699 5.758190 0.553768 1.659815 0.028833 0.031749 0.001495
110 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 15.472677 26.292966 0.413617 11.509905 10.090751 5.597576 24.906945 4.438394 0.614825 0.031066 0.398321
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% -0.044139 11.610674 0.152790 8.813071 0.017951 5.758575 2.292426 2.183939 0.665439 0.035992 0.480420
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.078593 0.814217 -0.234834 -0.209249 0.322305 1.043806 0.539368 -0.367353 0.656118 0.678975 0.414681
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.703767 12.871790 3.231527 4.038268 6.302094 5.649746 1.638123 0.554739 0.034774 0.030712 0.002321
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.655127 0.563374 0.763603 -0.640665 4.246828 -1.216081 1.916979 -0.537657 0.533304 0.652167 0.429809
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.536972 1.119771 1.853564 1.084864 1.347084 -0.828643 -2.235659 -1.192474 0.616040 0.649937 0.423199
116 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.336053 0.184934 -0.321068 0.364389 0.826976 0.167369 -0.221551 -0.211097 0.624515 0.657106 0.406892
117 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 11.619801 13.228362 8.283249 9.217653 6.322797 5.732295 1.455142 3.678286 0.027769 0.031129 0.002100
118 N07 digital_ok 100.00% 0.00% 0.00% 0.00% -0.470733 0.957985 -0.334219 0.461039 -0.056392 0.175395 5.278819 6.185744 0.656910 0.689627 0.403063
119 N07 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.589792 1.302768 -1.525068 1.352620 0.087249 6.619371 -0.206905 1.568810 0.672556 0.681740 0.389545
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 2.790045 2.644853 1.945294 1.428521 0.003096 -0.267090 0.677761 -2.618560 0.669724 0.705003 0.382876
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.028412 4.520773 -0.410359 1.430087 1.508440 16.273711 30.806647 17.342782 0.690556 0.708698 0.383964
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.711093 6.894251 1.035375 0.471938 2.182226 1.076081 1.418167 -0.452681 0.696144 0.715979 0.388175
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.613741 8.957460 0.116702 0.741013 0.541873 0.954018 -0.466034 0.234233 0.702503 0.718586 0.387871
124 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.187341 -1.131801 -0.568535 0.679199 -0.004073 -0.003096 -0.329335 -0.307515 0.689952 0.706284 0.386682
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.086429 1.530324 -0.613775 0.647537 8.448144 0.655918 12.720322 0.221709 0.645313 0.705744 0.394722
127 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 0.104579 0.183912 -0.273623 0.129226 1.194746 1.486193 2.497402 4.495099 0.682934 0.707784 0.403551
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.644825 0.417579 1.038387 0.716738 -0.370507 1.328322 -0.325775 1.335954 0.672153 0.698749 0.405427
129 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
130 N10 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
131 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.722437 12.996049 3.451142 4.240449 6.380707 5.694422 2.726897 -0.283778 0.033920 0.039365 0.002293
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.790567 0.645272 -0.023370 -0.976333 -0.267517 -0.767613 1.200672 0.112425 0.621285 0.639519 0.411076
133 N11 not_connected 100.00% 100.00% 79.58% 0.00% 12.185435 17.412758 3.240434 2.951123 6.373358 5.186776 1.547782 0.547190 0.042527 0.184081 0.101990
135 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan 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 0.00% 0.00% 0.00% 0.00% 0.008640 -0.732305 -0.557316 -0.368903 1.040790 1.297949 1.020039 1.695765 0.640168 0.675126 0.408715
138 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.038498 0.062690 -0.082755 0.750391 0.100231 0.651726 1.959561 0.153895 0.663366 0.689981 0.405114
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.956028 -0.392821 1.035498 -1.256695 0.143918 -1.945770 -0.952505 0.671221 0.668416 0.683741 0.389454
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.763395 3.457311 -0.159930 2.140367 -1.062870 1.461895 2.529325 -1.699174 0.685117 0.701352 0.382926
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.358248 -0.876703 -0.870090 0.136435 0.035717 -2.099994 0.282833 -1.513661 0.687265 0.713088 0.385154
142 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.636024 11.588032 -1.234980 8.945379 1.191283 5.730310 22.336953 1.791379 0.692124 0.047689 0.563864
143 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.575603 -0.233015 4.859142 -0.170363 -0.628235 1.209734 -0.251648 -0.097590 0.639774 0.717728 0.417328
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.134551 -0.361635 -0.567310 2.938621 0.877027 -0.643834 -0.485105 -0.065350 0.694846 0.697599 0.390019
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.220291 2.401379 -0.236784 5.967939 0.541163 13.514522 0.135543 0.671139 0.689035 0.629349 0.417383
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 11.939081 1.563559 3.249539 0.480914 6.330426 -1.556103 0.230730 -1.686125 0.038344 0.702989 0.572208
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.488377 -1.273856 0.923987 1.750845 1.223818 -0.015058 -0.128605 -0.281285 0.671447 0.695731 0.397820
148 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.708062 -0.014284 2.244785 1.319977 -0.560470 0.808167 -0.458381 -0.297378 0.656111 0.696219 0.414191
149 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.928626 1.016619 -1.244151 1.131594 -0.545201 -0.858083 -0.577182 -2.103232 0.665558 0.692336 0.417054
150 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.649316 -0.027551 0.933765 0.275715 0.231493 -1.814208 -1.887677 -1.608271 0.656801 0.685719 0.429731
155 N12 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.274824 11.256031 0.257735 8.706759 13.269799 5.733481 1.466686 0.725058 0.630084 0.060323 0.510400
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -0.008640 0.016862 -0.009963 0.405923 -0.014678 0.683290 -0.155616 0.027618 0.643583 0.672810 0.410593
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.265358 0.100167 -0.831507 -0.779163 0.743419 1.564771 4.789552 15.503167 0.662777 0.687172 0.412294
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.152494 22.412837 -1.515353 -1.016643 -1.490207 4.638152 -0.074339 60.673258 0.639997 0.586856 0.378012
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.782649 -0.715402 -0.615043 -0.897867 -0.245319 0.972330 0.175649 0.196500 0.678035 0.700609 0.393288
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.745828 29.833002 -0.500355 -0.638260 -0.211987 -0.602826 -0.354646 0.530236 0.682130 0.582954 0.348304
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.694211 -0.099085 1.781702 0.705113 0.755557 -1.456599 -0.969205 -1.819291 0.689228 0.712640 0.385006
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.202902 1.192623 -0.543736 0.251902 -0.197508 0.828102 -0.050528 1.083527 0.696731 0.711314 0.393245
164 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.288938 0.452928 2.070758 -0.396685 15.615488 1.982326 0.888238 0.867959 0.675257 0.713251 0.394307
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 31.224383 0.181160 1.823142 0.331904 1.948518 0.554701 6.769145 -0.338535 0.528042 0.705125 0.393456
166 N14 RF_maintenance 100.00% 0.00% 12.97% 0.00% -0.559136 5.257721 -0.158637 7.523112 0.222228 14.123405 4.734294 2.838363 0.687479 0.459354 0.459863
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.509588 -1.230610 -0.940877 3.358653 0.194042 -0.623546 -1.153396 1.669583 0.688726 0.684592 0.407682
168 N15 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.724634 -0.703800 -0.341428 -0.506485 0.951878 0.886028 0.014854 0.820037 0.674273 0.702776 0.414035
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.049496 1.694801 -1.179570 -1.504200 -0.021139 -0.768955 -0.737308 -0.647836 0.669284 0.685196 0.411792
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 11.422512 -0.223424 8.386518 -1.117458 6.302674 3.597185 0.912293 2.451222 0.038285 0.690542 0.578090
179 N12 RF_maintenance 100.00% 100.00% 81.31% 0.00% 11.531854 11.961860 8.379488 9.238508 6.221040 5.242646 0.737951 1.019678 0.074010 0.172981 0.100225
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.195858 12.401165 0.122271 9.052230 -0.166563 5.690240 25.401833 2.334052 0.667594 0.054401 0.561759
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.518505 0.349174 -0.533376 0.245417 0.257242 0.524763 -0.417661 4.452393 0.682515 0.697610 0.396115
182 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.090053 4.048545 -1.245859 2.279871 -0.500347 1.798035 10.096617 -2.190353 0.690788 0.694179 0.395980
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.424328 1.771217 0.449240 4.151584 0.775352 -1.430428 0.544342 -0.129920 0.675643 0.652055 0.382495
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.320342 -0.586699 -0.349679 3.080362 0.363943 -0.142205 0.298920 0.069464 0.680780 0.686858 0.387134
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 15.585040 -1.335224 7.187775 3.612472 6.084466 -1.262922 0.011829 0.536017 0.325984 0.676250 0.441505
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.214730 3.287160 0.378546 2.040787 -1.119493 1.061580 -0.626030 -3.020681 0.691279 0.699894 0.404221
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 1.193663 2.934976 0.949215 1.702098 -0.480206 0.291802 -0.190813 4.636913 0.683252 0.699869 0.399337
189 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 8.605782 8.924065 2.607367 1.033702 3.773062 4.997262 0.462189 0.327417 0.347829 0.378011 0.180289
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.804186 3.663067 -1.091862 2.355207 -0.430302 1.808271 -0.545319 -3.195971 0.662695 0.678005 0.428236
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.658199 0.379055 0.680192 -0.489612 0.074251 0.429000 17.602589 0.153477 0.641713 0.676543 0.435893
200 N18 RF_maintenance 100.00% 100.00% 35.12% 0.00% 12.417095 36.949850 3.406957 0.179608 6.469516 4.774345 1.754780 -0.875432 0.047293 0.225749 0.162578
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.366238 6.155067 3.866328 3.090212 5.145671 3.464781 -3.759544 -3.423199 0.633316 0.657729 0.391760
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 1.057735 1.923269 0.440305 -0.216068 -0.556648 -1.001431 -0.108993 3.619239 0.665665 0.646171 0.395994
203 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.375395 2.530485 0.309827 -1.082153 -0.886441 -0.546951 -1.224053 8.479980 0.660370 0.658780 0.394249
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.745584 0.658559 -0.940080 -1.233433 11.659792 -1.538992 1.888877 3.971096 0.644233 0.664193 0.395383
207 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.784312 1.868597 0.942128 -0.491906 0.624064 4.382606 -0.979031 -0.844692 0.638751 0.656809 0.383596
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 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
219 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.061172 -1.071034 -0.222272 -0.619310 -1.436199 -1.726199 2.302254 -1.018848 0.658624 0.666481 0.402668
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.821150 0.032399 -0.805773 -0.814020 -0.328291 -1.600756 2.230730 -0.393068 0.627963 0.670725 0.409381
222 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 1.189492 0.485957 0.374885 -0.725847 -0.839301 3.268873 4.826596 1.945955 0.657972 0.671847 0.403667
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.797945 1.008230 -1.509057 -1.206158 -0.987199 0.677315 0.138729 1.671522 0.640484 0.664964 0.398307
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.500923 6.760911 4.024496 3.504502 5.209480 4.398222 -3.919584 -4.020978 0.629713 0.645736 0.400984
225 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
227 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
228 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
229 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
237 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 5.794483 1.718569 1.078977 -1.401609 0.537810 -0.977220 3.696046 -0.591280 0.537562 0.644923 0.443421
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.579158 -0.736688 0.787298 0.252684 -0.387170 -1.331724 -1.657478 -0.014854 0.654797 0.662415 0.415681
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.313626 2.802615 -0.292879 1.173537 -0.446131 1.345465 -0.278548 3.683378 0.649881 0.595824 0.426091
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
244 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
245 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
246 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
261 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
320 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.183856 2.282760 0.782472 0.861949 0.921793 -0.594581 0.384863 -1.057008 0.534884 0.552866 0.404095
325 N09 dish_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
329 N12 dish_maintenance 100.00% 0.00% 0.00% 0.00% 2.052354 -0.665399 -1.429273 -1.162842 -0.718902 -1.190416 6.256015 1.057253 0.503430 0.557099 0.408075
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.729257 0.490411 -0.998452 -1.531568 -0.997780 -0.763233 1.084933 1.740400 0.500469 0.550577 0.403093
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 9, 15, 18, 19, 27, 28, 29, 30, 32, 34, 35, 36, 37, 38, 42, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 63, 68, 71, 72, 73, 78, 80, 81, 84, 86, 87, 88, 89, 90, 92, 93, 94, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 113, 114, 117, 118, 119, 121, 122, 123, 124, 126, 127, 129, 130, 131, 133, 135, 136, 142, 143, 145, 146, 155, 156, 158, 159, 161, 164, 165, 166, 170, 179, 180, 181, 182, 183, 185, 187, 189, 191, 200, 201, 203, 205, 206, 207, 208, 209, 210, 211, 219, 222, 224, 225, 226, 227, 228, 229, 237, 240, 241, 242, 243, 244, 245, 246, 261, 262, 320, 325, 329]

unflagged_ants: [5, 8, 10, 16, 17, 20, 21, 22, 31, 40, 41, 43, 44, 45, 46, 48, 62, 64, 65, 66, 67, 69, 70, 74, 77, 79, 82, 83, 85, 91, 95, 98, 99, 100, 105, 106, 112, 115, 116, 120, 125, 128, 132, 137, 138, 139, 140, 141, 144, 147, 148, 149, 150, 157, 160, 162, 163, 167, 168, 169, 184, 186, 190, 202, 220, 221, 223, 238, 239, 324, 333]

golden_ants: [5, 10, 16, 17, 20, 21, 31, 40, 41, 44, 45, 65, 66, 67, 69, 70, 83, 85, 91, 98, 99, 100, 105, 106, 112, 116, 128, 140, 141, 144, 147, 157, 160, 162, 163, 167, 169, 184, 186, 190, 202]
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_2459908.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

# Figure out where to draw the nodes
node_centers = {}
for node in sorted(set(list(nodes.values()))):
    if np.isfinite(node):
        this_node_ants = [ant for ant in ants + unused_ants if nodes[ant] == node]
        if len(this_node_ants) == 1:
            # put the node label just to the west of the lone antenna 
            node_centers[node] = hd.antpos[ant][node] + np.array([-14.6 / 2, 0, 0])
        else:
            # put the node label between the two antennas closest to the node center
            node_centers[node] = np.mean([hd.antpos[ant] for ant in this_node_ants], axis=0)
            closest_two_pos = sorted([hd.antpos[ant] for ant in this_node_ants], 
                                     key=lambda pos: np.linalg.norm(pos - node_centers[node]))[0:2]
            node_centers[node] = np.mean(closest_two_pos, axis=0)
In [25]:
def Plot_Array(ants, unused_ants, outriggers):
    plt.figure(figsize=(16,16))
    
    plt.scatter(np.array([hd.antpos[ant][0] for ant in hd.data_ants if ant in ants]), 
                np.array([hd.antpos[ant][1] for ant in hd.data_ants if ant in ants]), c='w', s=0)

    # connect every antenna to their node
    for ant in ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', zorder=0)

    rc_color = '#0000ff'
    antm_color = '#ffa500'
    autom_color = '#ff1493'

    # Plot 
    unflagged_ants = []
    for i, ant in enumerate(ants):
        ant_has_flag = False
        # plot large blue annuli for redcal flags
        if use_redcal:
            if redcal_flagged_frac[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=7 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=rc_color, alpha=redcal_flagged_frac[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot medium green annuli for ant_metrics flags
        if use_ant_metrics: 
            if ant_metrics_xants_frac_by_ant[ant] > 0:
                ant_has_flag = True
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=6 * (2 - 1 * float(not outriggers)), fill=True, lw=0,
                                                color=antm_color, alpha=ant_metrics_xants_frac_by_ant[ant]))
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, color='w'))
        
        # plot small red annuli for auto_metrics
        if use_auto_metrics:
            if ant in auto_ex_ants:
                ant_has_flag = True                
                plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=5 * (2 - 1 * float(not outriggers)), fill=True, lw=0, color=autom_color)) 
        
        # plot black/white circles with black outlines for antennas
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4 * (2 - 1 * float(not outriggers)), fill=True, color=['w', 'k'][ant_has_flag], ec='k'))
        if not ant_has_flag:
            unflagged_ants.append(ant)

        # label antennas, using apriori statuses if available
        try:
            bgc = matplotlib.colors.to_rgb(status_colors[a_priori_statuses[ant]])
            c = 'black' if (bgc[0]*0.299 + bgc[1]*0.587 + bgc[2]*0.114) > 186 / 256 else 'white'
        except:
            c = 'k'
            bgc='white'
        plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color=c, backgroundcolor=bgc)

    # label nodes
    for node in sorted(set(list(nodes.values()))):
        if not np.isnan(node) and not np.all(np.isnan(node_centers[node])):
            plt.text(node_centers[node][0], node_centers[node][1], str(node), va='center', ha='center', bbox={'color': 'w', 'ec': 'k'})
    
    # build legend 
    legend_objs = []
    legend_labels = []
    
    # use circles for annuli 
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgecolor='k', markerfacecolor='w', markersize=13))
    legend_labels.append(f'{len(unflagged_ants)} / {len(ants)} Total {["Core", "Outrigger"][outriggers]} Antennas Never Flagged')
    legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='k', markersize=15))
    legend_labels.append(f'{len(ants) - len(unflagged_ants)} Antennas {["Core", "Outrigger"][outriggers]} Flagged for Any Reason')

    if use_auto_metrics:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=autom_color, markersize=15))
        legend_labels.append(f'{len([ant for ant in auto_ex_ants if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas Flagged by Auto Metrics')
    if use_ant_metrics: 
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=antm_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum([frac for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants]), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in ant_metrics_xants_frac_by_ant.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Ant Metrics\n(alpha indicates fraction of time)')        
    if use_redcal:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markeredgewidth=2, markeredgecolor=rc_color, markersize=15))
        legend_labels.append(f'{np.round(np.sum(list(redcal_flagged_frac.values())), 2)} Antenna-Nights on' 
                             f'\n{np.sum([frac > 0 for ant, frac in redcal_flagged_frac.items() if ant in ants])} {["Core", "Outrigger"][outriggers]} Antennas '
                             'Flagged by Redcal\n(alpha indicates fraction of time)')

    # use rectangular patches for a priori statuses that appear in the array
    for aps in sorted(list(set(list(a_priori_statuses.values())))):
        if aps != 'Not Found':
            legend_objs.append(plt.Circle((0, 0), radius=7, fill=True, color=status_colors[aps]))
            legend_labels.append(f'A Priori Status:\n{aps} ({[status for ant, status in a_priori_statuses.items() if ant in ants].count(aps)} {["Core", "Outrigger"][outriggers]} Antennas)')

    # label nodes as a white box with black outline
    if len(node_centers) > 0:
        legend_objs.append(matplotlib.patches.Patch(facecolor='w', edgecolor='k'))
        legend_labels.append('Node Number')

    if len(unused_ants) > 0:
        legend_objs.append(matplotlib.lines.Line2D([0], [0], marker='o', color='w', markerfacecolor='grey', markersize=15, alpha=.2))
        legend_labels.append(f'Anntenna Not In Data')
        
    
    plt.legend(legend_objs, legend_labels, ncol=2, fontsize='large', framealpha=1)
    
    if outriggers:
        pass
    else:
        plt.xlim([-200, 150])
        plt.ylim([-150, 150])        
       
    # set axis equal and label everything
    plt.axis('equal')
    plt.tight_layout()
    plt.title(f'Summary of {["Core", "Outrigger"][outriggers]} Antenna Statuses and Metrics on {JD}', size=20)    
    plt.xlabel("Antenna East-West Position (meters)", size=12)
    plt.ylabel("Antenna North-South Position (meters)", size=12)
    plt.xticks(fontsize=12)
    plt.yticks(fontsize=12)
    xlim = plt.gca().get_xlim()
    ylim = plt.gca().get_ylim()    
        
    # plot unused antennas
    plt.autoscale(False)    
    for ant in unused_ants:
        if nodes[ant] in node_centers:
            plt.plot([hd.antpos[ant][0], node_centers[nodes[ant]][0]], 
                     [hd.antpos[ant][1], node_centers[nodes[ant]][1]], 'k', alpha=.2, zorder=0)
        
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='w', ec=None, alpha=1, zorder=0))
        plt.gca().add_artist(plt.Circle(tuple(hd.antpos[ant][0:2]), radius=4, fill=True, color='grey', ec=None, alpha=.2, zorder=0))
        if hd.antpos[ant][0] < xlim[1] and hd.antpos[ant][0] > xlim[0]:
            if hd.antpos[ant][1] < ylim[1] and hd.antpos[ant][1] > ylim[0]:
                plt.text(hd.antpos[ant][0], hd.antpos[ant][1], str(ant), va='center', ha='center', color='k', alpha=.2) 

Figure 1: Array Plot of Flags and A Priori Statuses¶

This plot shows all antennas, which nodes they are connected to, and their a priori statuses (as the highlight text of their antenna numbers). It may also show (depending on what is finished running):

  • Whether they were flagged by auto_metrics (red circle) for bandpass shape, overall power, temporal variability, or temporal discontinuities. This is done in a binary fashion for the whole night.
  • Whether they were flagged by ant_metrics (green circle) as either dead (on either polarization) or crossed, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.
  • Whether they were flagged by redcal (blue circle) for high chi^2, with the transparency indicating the fraction of the night (i.e. number of files) that were flagged.

Note that the last fraction does not include antennas that were flagged before going into redcal due to their a priori status, for example.

In [26]:
core_ants = [ant for ant in ants if ant < 320]
outrigger_ants = [ant for ant in ants if ant >= 320]
Plot_Array(ants=core_ants, unused_ants=unused_ants, outriggers=False)
if len(outrigger_ants) > 0:
    Plot_Array(ants=outrigger_ants, unused_ants=sorted(set(unused_ants + core_ants)), outriggers=True)

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.5.dev11+g87299d5
3.1.5.dev171+gc8e6162
In [ ]: