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 = "2460092"
data_path = "/mnt/sn1/2460092"
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: 5-27-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/2460092/zen.2460092.42118.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 361 ant_metrics files matching glob /mnt/sn1/2460092/zen.2460092.?????.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/2460092/zen.2460092.?????.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 'startTime' 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 2460092
Date 5-27-2023
LST Range 15.882 -- 17.823 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 361
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: 94
not_connected: 24
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, 42, 70, 112
Total Number of Nodes 19
Nodes Registering 0s
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 79 / 198 (39.9%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 103 / 198 (52.0%)
Redcal Done? ❌
Never Flagged Antennas 93 / 198 (47.0%)
A Priori Good Antennas Flagged 48 / 94 total a priori good antennas:
5, 7, 15, 16, 17, 29, 30, 31, 37, 38, 40, 41,
42, 55, 62, 66, 70, 81, 83, 86, 93, 94, 109,
111, 112, 118, 121, 124, 127, 136, 147, 148,
149, 150, 160, 161, 165, 166, 167, 168, 169,
170, 181, 182, 184, 189, 190, 191
A Priori Bad Antennas Not Flagged 47 / 104 total a priori bad antennas:
8, 22, 35, 36, 43, 46, 48, 49, 50, 52, 57,
63, 64, 73, 74, 79, 80, 89, 90, 95, 102, 108,
113, 115, 120, 126, 132, 133, 135, 139, 185,
201, 220, 222, 224, 226, 237, 238, 239, 240,
241, 242, 243, 320, 324, 325, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2460092.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 100.00% 99.72% 100.00% 0.00% nan nan inf inf nan nan nan nan 0.203682 0.122807 0.089628
5 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.034513 -0.149258 -0.555384 0.305304 -0.302852 0.378289 0.299071 6.199642 0.578868 0.566957 0.385397
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.534633 1.612379 1.483308 1.495834 0.625794 0.653129 -1.097289 -1.076701 0.553561 0.541599 0.370233
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 2.039033 -0.646212 3.733407 -0.425688 2.065241 -0.066642 1.758340 -0.486758 0.580842 0.575358 0.375782
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.716590 -0.852287 -0.322674 -0.608628 -0.974586 -0.325119 -1.010880 -0.382308 0.570029 0.561886 0.376515
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
16 N01 digital_ok 100.00% 99.72% 99.72% 0.00% nan nan inf inf nan nan nan nan 0.321167 0.241288 0.126047
17 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
18 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.643183 0.391809 -0.276334 0.947380 -0.111728 1.186515 -0.307315 1.713586 0.602239 0.599071 0.384467
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.528936 -0.843799 2.174294 -0.363429 1.672056 -0.038151 1.710489 0.454287 0.604206 0.594188 0.381446
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.101004 0.029913 -0.093673 0.276168 -0.019052 0.463225 0.023440 0.013044 0.593691 0.587955 0.377611
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.291735 -0.835017 1.681905 -0.240665 0.448670 -0.279563 1.184340 0.352873 0.553089 0.556372 0.380747
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
28 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
30 N01 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.417786 1.820706 1.105876 5.343963 1.150680 2.369159 2.147268 3.776147 0.619807 0.603376 0.388110
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.598289 -0.778245 0.519783 -0.964144 -0.758371 -0.537349 2.151167 2.291148 0.549340 0.605027 0.347080
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 4.264555 -0.390425 9.884151 -0.433906 1.709246 -0.817397 2.442652 0.559045 0.039116 0.574532 0.425776
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.248007 -1.019058 -0.148063 -0.420894 -0.700197 -0.310669 0.350490 0.851188 0.572010 0.568356 0.379998
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.634082 1.106722 1.282748 0.863844 1.085212 0.784240 0.383025 0.451845 0.555151 0.536547 0.357796
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.935581 9.542871 -0.832343 19.529923 -0.793378 1.701027 -0.765501 3.132438 0.572484 0.029922 0.457831
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.248435 0.376434 0.006969 1.493956 0.164138 1.274973 1.588238 5.164487 0.586598 0.575947 0.377728
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.228726 -0.178480 0.536438 -0.409444 0.582911 0.049829 21.000970 2.976858 0.227089 0.225375 -0.320810
41 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.532327 2.276963 1.230303 5.055268 0.987364 2.409119 1.877278 2.660902 0.619044 0.606376 0.393751
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.322505 -0.521545 -0.138027 -0.823351 0.042209 -0.299827 -0.119389 -0.047434 0.241588 0.233548 -0.324285
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.932688 0.309340 -0.797844 0.934546 -0.850193 0.953070 -0.652268 0.700956 0.631529 0.629052 0.393723
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.100572 0.319125 -0.644027 0.614762 -0.336684 0.569282 -0.529849 0.001640 0.624066 0.629271 0.388322
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.548155 0.333151 0.944655 0.736397 1.017502 0.610795 0.190377 0.443583 0.632706 0.628669 0.393716
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.298559 -1.108044 0.198030 -0.942865 0.442161 -0.667656 -0.043131 -0.565551 0.623011 0.620034 0.400571
47 N06 not_connected 100.00% 97.78% 97.78% 0.00% nan nan inf inf nan nan nan nan 0.394588 0.373640 0.347729
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.824452 0.240608 -0.813701 0.217184 -1.038464 -0.369421 -0.092455 -1.092068 0.582705 0.573996 0.374962
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.596586 -0.353336 0.324458 -0.424128 0.140879 -0.945002 0.085242 1.174510 0.571457 0.561875 0.381545
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.449372 0.677716 0.081277 1.666357 0.412726 1.418828 2.336185 1.705279 0.559094 0.542474 0.363048
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 0.171025 -0.539811 0.106489 0.170547 0.326462 0.391217 35.217845 0.340707 0.574680 0.565119 0.367411
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.673500 0.187735 0.053180 -0.184365 0.342829 0.024948 2.216075 0.119464 0.594481 0.577988 0.371540
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.439217 -0.347124 -0.201795 -0.315022 0.088031 -0.804398 3.046752 0.822485 0.612778 0.594684 0.387381
54 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.258528 2.008580 0.718088 -0.576848 1.497627 1.539491 1.149853 1.442592 0.315603 0.372877 0.199230
55 N04 digital_ok 100.00% 33.24% 100.00% 0.00% 0.125668 16.096903 0.166900 13.265951 -0.479243 1.750515 0.264140 1.139454 0.244548 0.044530 0.094782
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.873147 2.694405 -0.902060 2.812894 -0.726978 2.179344 0.123319 1.808494 0.637635 0.629756 0.382678
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.801432 -0.553254 -0.500852 -0.582525 -0.917212 -0.116423 -0.264193 0.455505 0.642988 0.641846 0.387318
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 3.580376 4.382529 15.718290 16.295345 1.679866 1.622724 1.625798 1.472720 0.035969 0.036612 0.002465
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 3.885800 0.760027 15.715364 1.010372 1.680714 0.871951 1.143471 0.665053 0.061571 0.641372 0.509669
60 N05 RF_maintenance 100.00% 0.00% 75.07% 0.00% -0.132838 4.236730 0.279515 16.318274 0.234387 1.543560 1.520315 4.370230 0.624324 0.150723 0.504210
61 N06 not_connected 100.00% 98.34% 98.06% 0.28% nan nan inf inf nan nan nan nan 0.418819 0.434796 0.306413
62 N06 digital_ok 100.00% 0.00% 100.00% 0.00% 0.463139 4.694358 1.959429 9.230696 0.388883 1.623847 1.007273 0.963388 0.574985 0.055109 0.466884
63 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.446237 2.380085 -0.659285 2.132304 -1.031784 1.186114 -0.544871 -1.177614 0.586341 0.540987 0.389003
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.904581 -0.546620 -0.722699 0.185175 -0.489741 0.077802 2.804900 2.246299 0.575023 0.563045 0.374814
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.269044 -0.595473 0.563046 -0.161200 0.830450 0.095785 -0.048523 -0.014927 0.562450 0.546052 0.371363
66 N03 digital_ok 100.00% 41.55% 100.00% 0.00% 1.093693 9.059105 1.075370 19.398105 0.310831 1.596623 -1.062158 4.600086 0.207433 0.067993 0.090332
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.699625 0.559761 -0.034768 1.581071 0.280807 1.436110 2.866536 2.266060 0.601245 0.587778 0.371457
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 9.907147 0.259079 19.369461 0.182936 1.777070 -0.500608 3.934905 -0.830695 0.031711 0.592090 0.484830
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 1.097538 0.079481 1.628043 -0.659217 1.423895 -0.223299 1.431170 -0.239145 0.631121 0.617947 0.373161
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% 0.675482 1.653430 1.463417 2.776118 0.907825 1.955940 2.666121 1.928826 0.274353 0.259672 -0.311516
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.654623 0.044264 -0.286278 0.541041 0.048702 0.662396 1.967057 2.746778 0.651367 0.649437 0.383410
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.482339 -1.219651 -0.343865 -0.825655 0.121102 -0.713380 1.151491 0.241637 0.658428 0.655486 0.388839
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.809437 1.930290 -0.676603 3.135077 -0.450838 1.375370 -0.259634 2.391573 0.654294 0.654334 0.388721
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.842362 -0.453942 -0.522982 -0.090955 -0.772279 0.058450 2.038147 3.067751 0.639679 0.648305 0.392972
77 N06 not_connected 100.00% 96.95% 96.95% 0.00% 48.931346 49.355608 inf inf 392.132429 391.926797 3767.352314 3722.069273 0.498344 0.487031 0.382118
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 5.551783 0.336160 0.892395 0.366968 -0.442045 -0.340781 -0.113635 -1.034469 0.488354 0.587381 0.349850
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.193022 -0.980787 1.073853 -0.789521 0.405135 -0.674436 0.650304 -0.426723 0.580343 0.581595 0.373225
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.534791 1.352699 -0.395970 1.319223 -0.951016 0.513922 -0.980946 -1.202092 0.572712 0.545473 0.379620
81 N07 digital_ok 100.00% 98.06% 97.78% 0.00% nan nan inf inf nan nan nan nan 0.448155 0.522839 0.421619
82 N07 RF_maintenance 100.00% 98.06% 98.34% 0.28% 76.902880 76.413185 inf inf 370.472736 378.284664 2941.522685 3099.238214 0.521377 0.414906 0.399753
83 N07 digital_ok 100.00% 98.06% 97.51% 0.00% 64.967469 65.503643 inf inf 393.553962 390.941555 3866.059563 3851.903907 0.519911 0.564371 0.409444
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.728159 10.418593 0.718267 19.452317 -0.093750 1.485822 -1.163509 3.627747 0.606144 0.057219 0.427917
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.449432 -0.898758 -0.571310 -0.702297 -1.053889 -0.348333 -0.908036 -0.547889 0.634327 0.628915 0.381133
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.208600 -0.339352 1.227089 0.174586 1.500251 0.521203 2.704364 7.232568 0.653005 0.647393 0.378374
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.085661 0.131668 2.979771 -0.588221 3.769396 -0.696310 82.994645 4.719819 0.594678 0.653701 0.345935
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.151902 0.637486 0.877785 1.738098 0.835269 1.546433 0.376504 0.464560 0.662223 0.659119 0.379960
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.217374 0.290859 0.829527 1.151890 0.920015 1.181589 0.006673 0.177649 0.668494 0.667648 0.395297
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.375392 -0.722773 1.456288 -0.629782 1.131732 -0.992310 0.470872 -0.627904 0.655120 0.657201 0.392304
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.229324 0.183979 0.888248 0.723437 0.941303 0.855142 0.251515 0.080885 0.649540 0.653015 0.409117
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 3.780639 -0.151206 15.799333 0.492335 1.685579 0.453017 1.245364 0.302287 0.031965 0.631638 0.455661
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 3.824688 4.452671 15.833629 16.384816 1.686531 1.625358 2.146749 2.023738 0.028706 0.024843 0.001843
94 N10 digital_ok 100.00% 100.00% 55.12% 0.00% 4.063258 3.806546 16.004793 15.790372 1.653385 1.096778 1.618701 1.075948 0.025242 0.268929 0.190828
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.388222 -0.333714 -0.017759 -0.185062 -0.289129 -0.741409 -0.249533 -0.998098 0.583014 0.585194 0.377225
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.369445 5.604524 0.449065 -0.102968 -0.197863 -0.694597 -1.124756 -0.034992 0.578159 0.511436 0.341447
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.121447 0.506531 -0.819334 0.873351 -0.612590 0.603197 -0.466766 4.205456 0.569522 0.557318 0.368937
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.890803 1.343574 0.104737 1.103240 0.390341 0.999878 0.342903 0.786260 0.620226 0.608622 0.380933
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.077175 -0.248699 -0.985748 -0.314216 -0.620166 0.009886 -0.746301 3.177977 0.637802 0.629826 0.380037
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.413398 0.260431 1.264075 -0.754066 0.475219 -0.305268 -1.109176 0.928756 0.628514 0.644384 0.369190
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.991342 20.700671 3.264472 7.979586 1.835550 3.414690 2.635359 3.599331 0.658124 0.647347 0.381096
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.361232 0.281919 0.371727 1.357415 0.394787 1.215213 0.027429 0.268498 0.658657 0.659857 0.374071
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.119485 -0.444682 0.544751 0.453564 0.771845 0.552157 0.574749 0.014382 0.664702 0.665915 0.389185
107 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.033240 -0.629351 -0.111405 -0.559024 -0.009886 -0.366795 0.431673 0.421935 0.659355 0.660324 0.389678
108 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.779669 1.788089 1.576419 2.764333 1.302720 1.791755 1.818909 0.742726 0.649980 0.655325 0.397701
109 N10 digital_ok 100.00% 75.35% 100.00% 0.00% 3.618039 4.399772 15.858495 16.114189 1.614072 1.640040 2.270410 2.956412 0.138703 0.034464 0.090908
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.385674 -0.487453 2.352825 0.053240 -0.612682 0.174490 0.292812 -0.304466 0.554510 0.631340 0.352470
111 N10 digital_ok 100.00% 56.79% 74.79% 25.21% 1.288269 4.302259 12.540055 16.051021 -0.169959 1.462160 2.066923 3.825607 0.176638 0.076389 -0.136187
112 N10 digital_ok 100.00% 0.00% 0.00% 100.00% 0.819029 1.421923 1.656526 12.456673 1.084444 0.289773 0.835177 1.075095 0.234670 0.185507 -0.296083
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.174980 2.253519 1.968162 2.026082 1.068997 1.107027 -1.141045 -1.183826 0.557669 0.549006 0.365792
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.877681 1.216232 1.687457 4.917496 0.861605 0.752059 -1.057117 1.465676 0.543908 0.522613 0.348031
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.044504 -0.602136 -0.718190 -0.370425 -0.503941 -0.841779 -0.544143 -0.743656 0.552853 0.544064 0.363791
117 N07 RF_maintenance 100.00% 97.23% 97.51% 0.00% nan nan inf inf nan nan nan nan 0.593224 0.519915 0.459075
118 N07 digital_ok 100.00% 99.45% 98.89% 0.00% nan nan inf inf nan nan nan nan 0.403584 0.440820 0.367390
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.882245 -0.638619 2.894728 -0.645274 2.116989 -0.242080 1.706233 -0.425534 0.631966 0.627074 0.381884
121 N08 digital_ok 100.00% 1.39% 0.00% 0.00% -0.526684 2.709476 -0.528723 6.811921 -0.297619 2.802072 11.941437 5.590804 0.574957 0.637567 0.388696
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.579624 0.360413 -0.162696 -0.841040 0.383261 -0.502552 0.008324 -0.388132 0.656968 0.652502 0.382357
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.947622 0.699866 1.790446 0.645195 0.919124 -0.124328 -1.124465 -1.129750 0.637340 0.652230 0.385817
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 3.728243 -0.077893 16.001711 0.791746 1.703016 0.931895 3.671602 2.165875 0.041776 0.669766 0.459176
125 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.865145 -0.059547 11.046233 1.677912 0.455203 1.346463 1.482147 0.539627 0.562473 0.659973 0.408481
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.203235 0.280121 0.825754 1.152062 0.999307 0.982098 1.118666 0.556884 0.657941 0.659615 0.403111
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 3.749423 -0.866472 15.792247 -0.578585 1.681746 -0.946736 1.091626 -0.637672 0.032857 0.635254 0.454039
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.638491 -0.466875 -0.503338 -0.264866 -0.082425 -0.846314 0.517680 0.062857 0.630362 0.629037 0.412732
131 N11 not_connected 100.00% 0.00% 40.72% 0.00% -0.698226 3.885401 -0.707626 9.723886 -1.033866 0.731240 -0.870697 0.848542 0.576361 0.310079 0.417041
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.677410 -0.952083 -0.584437 -0.661159 -1.011847 -0.513496 -0.908346 -0.559649 0.575499 0.571344 0.365676
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.879470 -0.929369 -0.611721 -0.893442 -0.578067 -1.036547 -0.529219 -0.665197 0.554140 0.547950 0.356831
134 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.088979 1.550390 3.533394 1.415777 0.880009 0.599009 3.945567 -1.203941 0.498984 0.501936 0.348599
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.141949 -1.124619 -0.848139 -0.965103 -0.840884 -0.744011 -0.262972 -0.340168 0.525476 0.516664 0.367260
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 3.516566 -0.164688 15.473679 0.066579 1.675791 0.170828 1.413725 0.284078 0.035992 0.539378 0.395066
137 N07 RF_maintenance 100.00% 98.89% 98.89% 0.00% nan nan inf inf nan nan nan nan 0.271528 0.282826 0.237646
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.453314 -0.592598 0.322944 -0.787283 -0.402710 -0.638527 -1.125426 0.120844 0.602150 0.597296 0.374303
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.165957 -1.069141 0.454548 -0.845295 0.477597 -0.850283 0.352879 0.438191 0.640577 0.625814 0.376585
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.434439 -0.391349 0.180136 -0.310410 0.308688 -0.874283 -0.140465 -0.990958 0.649390 0.635764 0.380597
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.643707 4.404423 -0.422414 16.351677 -0.275700 1.609787 5.788888 1.882802 0.655966 0.046114 0.519960
143 N14 RF_maintenance 100.00% 73.68% 100.00% 0.00% 3.858971 4.378056 15.459768 16.326660 1.645661 1.625733 1.051673 1.800525 0.159336 0.029153 0.111099
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.748963 1.281731 -0.370821 1.428644 -0.165064 1.247920 0.082988 0.883514 0.668341 0.663888 0.394557
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.336946 1.361243 0.670303 2.010761 0.638102 1.768925 0.040774 0.710149 0.663760 0.656155 0.388252
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.935794 -1.050466 -0.530055 -0.878944 -0.565881 -0.802836 -0.257826 0.425230 0.630390 0.636139 0.400362
147 N15 digital_ok 100.00% 98.61% 99.17% 0.00% nan nan inf inf nan nan nan nan 0.481114 0.375390 0.460547
148 N15 digital_ok 100.00% 98.89% 98.34% 0.00% nan nan inf inf nan nan nan nan 0.550843 0.595484 0.600485
149 N15 digital_ok 100.00% 98.89% 99.17% 0.00% nan nan inf inf nan nan nan nan 0.364270 0.355998 0.331668
150 N15 digital_ok 100.00% 98.89% 98.61% 0.00% nan nan inf inf nan nan nan nan 0.374727 0.434730 0.349352
151 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.743875 0.116326 -0.480650 1.345306 -0.458414 0.663734 0.162087 3.298478 0.514484 0.563899 0.342964
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 3.637241 -0.599077 15.663133 -0.047800 1.679458 0.312550 2.123095 0.022522 0.036961 0.532420 0.403489
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 2.415886 4.412599 7.100667 16.191702 2.212096 1.623146 3.883535 2.119377 0.541862 0.037353 0.422456
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.323444 0.423756 0.678067 0.939378 0.674545 0.814460 -0.017444 0.067291 0.569624 0.567003 0.374289
158 N12 digital_ok 0.00% 0.00% 0.00% 0.00% -1.012922 -1.224144 -0.901699 -0.918270 -0.824301 -0.811145 0.437940 3.819613 0.590573 0.583001 0.380594
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.118692 4.417537 0.615774 0.711032 0.192424 -0.609104 -0.016388 0.022432 0.591196 0.511939 0.349243
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 3.940310 -0.759289 15.738828 -0.395607 1.687399 -0.088675 1.256383 -0.395959 0.045112 0.627702 0.503367
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.198568 10.659326 0.500571 1.087765 0.526379 -0.552108 -0.085103 -0.142571 0.644422 0.555752 0.344359
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.282780 -0.924245 -0.084079 -0.780958 -0.722072 -0.790354 -0.816541 -0.784015 0.643738 0.642814 0.383649
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.112619 0.488337 0.435972 0.672379 0.651491 0.660095 1.001418 1.195734 0.655740 0.653965 0.387040
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 1.259744 0.789929 2.260664 1.187254 2.515469 0.951859 1.474975 0.569374 0.648538 0.646934 0.379285
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 5.387841 -0.449020 1.621313 -0.143556 -0.132730 0.062882 0.769907 -0.124607 0.587690 0.648079 0.354326
166 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 3.830943 -0.289326 15.971302 -0.016638 1.686450 -0.551472 1.262134 -1.011249 0.032237 0.628343 0.462926
167 N15 digital_ok 100.00% 98.89% 98.61% 0.00% nan nan inf inf nan nan nan nan 0.327147 0.366817 0.355475
168 N15 digital_ok 100.00% 98.89% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.448011 0.559462 0.432753
169 N15 digital_ok 100.00% 99.17% 98.89% 0.00% nan nan inf inf nan nan nan nan 0.407129 0.533956 0.437390
170 N15 digital_ok 100.00% 98.89% 98.61% 0.00% nan nan inf inf nan nan nan nan 0.305599 0.347493 0.262641
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 0.167580 -1.185672 1.560699 -0.635230 0.470348 -0.530744 0.167795 -0.423714 0.558070 0.565047 0.373512
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.630184 0.594610 1.460101 0.449350 0.637837 -0.114881 -1.186237 -1.013854 0.530729 0.532223 0.355032
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.181706 2.224499 1.958155 1.993184 1.054669 1.079366 -1.148467 -1.157044 0.502716 0.489806 0.340667
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.212799 1.272164 0.715844 2.405316 0.751822 1.599513 0.198947 5.883349 0.599899 0.591512 0.387801
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.754920 4.621271 -0.790924 16.452927 -0.537909 1.617141 4.996093 2.092377 0.606021 0.054932 0.495826
181 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 1.728884 1.948837 2.548762 3.057356 1.741385 2.024649 0.680171 6.196621 0.625733 0.618582 0.386860
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.673772 4.401726 -0.396959 16.090034 -1.025958 1.610625 1.447950 2.346346 0.638308 0.049939 0.478285
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.307264 1.178280 0.524294 1.175970 0.525257 0.934414 0.394132 0.667644 0.643690 0.636901 0.372612
184 N14 digital_ok 100.00% 32.13% 0.00% 0.00% 3.651871 0.036049 14.893633 0.616638 1.063550 0.432288 1.091240 -0.059684 0.337729 0.641032 0.434792
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.708951 -0.244310 -0.924613 0.268153 -0.674841 0.325929 -0.603471 -0.155741 0.640736 0.641093 0.381620
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.490036 -1.085842 -0.262370 -0.873244 -0.835038 -0.845323 -0.979621 -0.786186 0.627035 0.628703 0.380486
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.570560 -0.157762 -0.298629 -0.125367 -0.162579 -0.704521 -0.001640 -0.949416 0.626224 0.621368 0.398586
189 N15 digital_ok 100.00% 98.34% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.455690 0.491534 0.330222
190 N15 digital_ok 100.00% 98.06% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.487988 0.492582 0.446400
191 N15 digital_ok 100.00% 97.51% 97.78% 0.00% nan nan inf inf nan nan nan nan 0.396374 0.509715 0.435311
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.392245 2.478001 1.306215 2.192673 0.488166 1.235280 -0.820061 -0.864873 0.531145 0.500646 0.368896
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.418163 2.154061 2.183990 1.941156 1.241530 1.041474 -0.502054 -0.594258 0.498900 0.488446 0.342765
200 N18 RF_maintenance 100.00% 100.00% 38.78% 0.00% 4.264919 -0.483501 9.723842 -0.948582 1.696599 -0.579673 1.868185 -0.211734 0.047066 0.217632 0.083510
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.048196 1.960263 1.039980 1.819079 0.241716 0.904954 -1.200472 -1.232466 0.600062 0.577273 0.384533
202 N18 digital_ok 0.00% 0.00% 0.00% 0.00% 0.109431 -0.973186 0.276263 -0.839364 -0.402972 -0.818741 -1.059414 2.380836 0.619135 0.616739 0.381827
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.744992 2.122444 2.180905 -0.628458 1.579070 -0.382491 9.432100 -0.286774 0.624816 0.619819 0.372590
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 2.004538 -0.631305 6.940037 -0.493099 -0.524993 -0.255163 1.988688 8.604938 0.514134 0.621025 0.413720
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.893650 1.051551 3.955173 4.548474 1.045169 1.109788 1.761241 2.023298 0.569892 0.561437 0.359452
207 N19 RF_ok 100.00% 100.00% 0.00% 0.00% 4.221601 -1.069834 9.351608 -0.693657 1.722979 -0.536477 2.234294 1.285870 0.043848 0.602151 0.502085
208 N20 dish_maintenance 100.00% 97.51% 96.68% 0.00% nan nan inf inf nan nan nan nan 0.290021 0.396606 0.312277
209 N20 dish_maintenance 100.00% 98.34% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.369188 0.386609 0.341451
210 N20 dish_maintenance 100.00% 97.78% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.466739 0.457788 0.402350
211 N20 RF_ok 100.00% 98.89% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.280694 0.647599 0.453391
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.519994 -1.038382 -0.287009 -0.914792 -0.836156 -0.679487 -0.608747 -0.613155 0.606326 0.599588 0.382826
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% -0.943440 -0.875150 -0.882274 -0.982686 -0.939260 -0.769373 10.044618 -0.724716 0.609173 0.602473 0.378138
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.525754 -0.450140 -0.525890 -0.506424 -1.003510 -1.001732 0.123925 -0.889112 0.606195 0.602222 0.372838
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.755297 0.972945 -0.077330 3.191574 -0.189081 0.962697 -0.335471 4.500612 0.605050 0.576919 0.378670
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.567265 2.321211 2.333892 2.104777 1.361375 1.153912 -1.075318 -1.167403 0.558805 0.554707 0.362641
225 N19 RF_ok 100.00% 0.00% 59.28% 0.00% 0.023170 4.071411 0.098444 9.723585 -0.549102 1.218734 -1.097964 1.718081 0.589870 0.234766 0.494138
226 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.860149 2.510949 -0.940531 -0.552893 -1.007068 -0.309781 -0.751219 -0.681338 0.581930 0.519241 0.381879
227 N20 RF_ok 100.00% 98.06% 97.78% 0.00% nan nan inf inf nan nan nan nan 0.447914 0.524338 0.403725
228 N20 RF_maintenance 100.00% 98.89% 98.61% 0.00% nan nan inf inf nan nan nan nan 0.256288 0.170602 0.105208
229 N20 RF_maintenance 100.00% 99.17% 98.89% 0.28% nan nan inf inf nan nan nan nan 0.370162 0.413946 -0.005401
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.089050 -0.970776 0.746645 -0.781610 0.355405 -0.578098 0.918142 -0.625997 0.574077 0.572306 0.382472
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.108029 -0.068538 0.121906 0.108172 -0.583900 -0.522707 -1.077551 -1.099609 0.589684 0.582634 0.384786
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.005436 -0.421983 -0.982676 -0.428921 -0.878495 -0.912842 -0.351800 -0.472878 0.596018 0.585208 0.383840
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.001079 -0.570223 0.225061 -0.700209 -0.476160 -0.940095 -1.090855 -0.428154 0.589438 0.585745 0.377345
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.842129 -0.730005 -0.725894 -0.502471 -1.022815 -0.965908 -0.610815 -0.920881 0.591280 0.583639 0.384207
242 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.757390 -0.180444 -0.600933 -0.210743 -0.349526 -0.792487 1.524496 -0.767030 0.519741 0.568053 0.363156
243 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 1.738359 -0.964798 -0.035672 -0.657670 0.131672 -0.460767 1.988634 -0.479337 0.516272 0.562975 0.377517
244 N20 RF_maintenance 100.00% 97.51% 97.51% 0.00% nan nan inf inf nan nan nan nan 0.645321 0.617076 0.285254
245 N20 RF_ok 100.00% 97.23% 97.78% 0.00% nan nan inf inf nan nan nan nan 0.453221 0.448001 0.330238
246 N20 dish_maintenance 100.00% 98.34% 98.34% 0.00% nan nan inf inf nan nan nan nan 0.475903 0.518110 0.278787
261 N20 RF_ok 100.00% 98.61% 98.06% 0.00% nan nan inf inf nan nan nan nan 0.418283 0.493759 0.231561
262 N20 dish_maintenance 100.00% 97.51% 96.40% 0.00% nan nan inf inf nan nan nan nan 0.336271 0.525720 0.393935
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.303553 1.385241 1.047098 1.215338 0.319565 0.494407 -1.048700 -0.840385 0.415766 0.345069 0.273374
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.813918 0.875259 0.313277 0.440414 -0.298741 -0.172929 -1.006641 -1.121386 0.415421 0.362604 0.278683
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.235655 -1.083744 0.182765 -0.538535 -0.533507 -0.308285 -1.114756 -0.384330 0.465740 0.421079 0.312307
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 4.171766 4.537490 9.536716 10.256871 1.688680 1.621840 1.149795 1.009710 0.037609 0.036352 0.002111
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 0.001079 -0.365907 0.017759 -0.500540 -0.119284 -0.437529 1.188255 -0.321181 0.404025 0.351778 0.260329
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, 15, 16, 17, 18, 27, 28, 29, 30, 31, 32, 34, 37, 38, 40, 41, 42, 47, 51, 55, 58, 59, 60, 61, 62, 66, 68, 70, 77, 78, 81, 82, 83, 84, 86, 87, 92, 93, 94, 96, 97, 104, 109, 110, 111, 112, 114, 117, 118, 121, 124, 125, 127, 131, 134, 136, 137, 142, 143, 147, 148, 149, 150, 155, 156, 159, 160, 161, 165, 166, 167, 168, 169, 170, 179, 180, 181, 182, 184, 189, 190, 191, 200, 204, 205, 206, 207, 208, 209, 210, 211, 221, 223, 225, 227, 228, 229, 244, 245, 246, 261, 262, 329]

unflagged_ants: [8, 9, 10, 19, 20, 21, 22, 35, 36, 43, 44, 45, 46, 48, 49, 50, 52, 53, 54, 56, 57, 63, 64, 65, 67, 69, 71, 72, 73, 74, 79, 80, 85, 88, 89, 90, 91, 95, 101, 102, 103, 105, 106, 107, 108, 113, 115, 120, 122, 123, 126, 128, 132, 133, 135, 139, 140, 141, 144, 145, 146, 151, 157, 158, 162, 163, 164, 171, 172, 173, 183, 185, 186, 187, 192, 193, 201, 202, 220, 222, 224, 226, 237, 238, 239, 240, 241, 242, 243, 320, 324, 325, 333]

golden_ants: [9, 10, 19, 20, 21, 44, 45, 53, 54, 56, 65, 67, 69, 71, 72, 85, 88, 91, 101, 103, 105, 106, 107, 122, 123, 128, 140, 141, 144, 145, 146, 151, 157, 158, 162, 163, 164, 171, 172, 173, 183, 186, 187, 192, 193, 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_2460092.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 [ ]: