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 = "2459937"
data_path = "/mnt/sn1/2459937"
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: 12-23-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/2459937/zen.2459937.21308.sum.auto_metrics.h5.

Load Ant Metrics¶

In [7]:
use_ant_metrics = False

# get a list of all ant_metrics files
glob_str = os.path.join(data_path, f'zen.{JD}.?????.sum{ant_metrics_ext}')
ant_metrics_files = sorted(glob.glob(glob_str))

# if they exist, load as many of them as possible
if len(ant_metrics_files) > 0:
    print(f'Found {len(ant_metrics_files)} ant_metrics files matching glob {glob_str}')
    ant_metrics_apriori_exants = {}
    ant_metrics_xants_dict = {}
    ant_metrics_dead_ants_dict = {}
    ant_metrics_crossed_ants_dict = {}
    ant_metrics_dead_metrics = {}
    ant_metrics_crossed_metrics = {}
    dead_cuts = {}
    crossed_cuts = {}
    for amf in ant_metrics_files:
        with h5py.File(amf, "r") as infile: # use h5py directly since it's much faster than load_metric_file
            # get out results for this file
            dead_cuts[amf] = infile['Metrics']['dead_ant_cut'][()]
            crossed_cuts[amf] = infile['Metrics']['cross_pol_cut'][()]
            xants = infile['Metrics']['xants'][:]
            dead_ants = infile['Metrics']['dead_ants'][:]
            crossed_ants = infile['Metrics']['crossed_ants'][:]        
            try:
                # look for ex_ants in history
                ex_ants_string = infile['Header']['history'][()].decode()
                ex_ants_string = ex_ants_string.split('--apriori_xants')[1]
                ex_ants_string = ex_ants_string.split('--')[0].strip()
            except:
                ex_ants_string = ''
                    
            # This only works for the new correlation-matrix-based ant_metrics
            if 'corr' in infile['Metrics']['final_metrics'] and 'corrXPol' in infile['Metrics']['final_metrics']:
                ant_metrics_dead_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corr'][ant][()]
                                                 for ant in infile['Metrics']['final_metrics']['corr']}
                ant_metrics_crossed_metrics[amf] = {eval(ant): infile['Metrics']['final_metrics']['corrXPol'][ant][()]
                                                    for ant in infile['Metrics']['final_metrics']['corrXPol']}                       
            else:
                raise(KeywordError)
        
        # organize results by file
        ant_metrics_xants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in xants]
        ant_metrics_dead_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in dead_ants]
        ant_metrics_crossed_ants_dict[amf] = [(int(ant[0]), ant[1].decode()) for ant in crossed_ants]
        ant_metrics_apriori_exants[amf] = [int(ant) for ant in ex_ants_string.split()]
    
    dead_cut = np.median(list(dead_cuts.values()))
    crossed_cut = np.median(list(crossed_cuts.values()))
        
    use_ant_metrics = True
else:
    print(f'No files found matching glob {glob_str}. Skipping ant_metrics.')
Found 1850 ant_metrics files matching glob /mnt/sn1/2459937/zen.2459937.?????.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/2459937/zen.2459937.?????.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 2459937
Date 12-23-2022
LST Range 0.689 -- 10.646 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 1850
Total Number of Antennas 201
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
dish_ok: 1
RF_maintenance: 54
RF_ok: 19
digital_ok: 94
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
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 70 / 201 (34.8%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 116 / 201 (57.7%)
Redcal Done? ❌
Never Flagged Antennas 82 / 201 (40.8%)
A Priori Good Antennas Flagged 49 / 94 total a priori good antennas:
3, 7, 9, 15, 16, 21, 29, 30, 40, 42, 54, 55,
56, 71, 72, 81, 86, 94, 98, 99, 100, 101, 103,
107, 109, 111, 116, 121, 122, 123, 124, 128,
129, 130, 136, 143, 146, 148, 158, 161, 165,
170, 182, 183, 185, 187, 189, 191, 202
A Priori Bad Antennas Not Flagged 37 / 107 total a priori bad antennas:
4, 8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 77, 79, 82, 90, 95, 102, 115, 125, 137,
139, 207, 211, 220, 221, 222, 223, 229, 237,
238, 239, 245, 261, 324, 333
In [19]:
# write to csv
outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/array_health_table_2459937.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.139289 14.486105 9.344169 0.673674 7.414335 3.356606 3.163839 5.092211 0.039586 0.372248 0.295952
4 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.251950 1.000235 1.039378 1.705417 -0.161287 0.188601 3.750271 0.254421 0.662586 0.676311 0.386277
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.045895 -0.192908 -0.166796 -0.114719 -0.092874 1.698486 1.491008 0.484096 0.666263 0.678594 0.376339
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.909471 -1.283686 0.870440 3.224407 0.137513 -0.716406 7.674548 6.716389 0.654655 0.663289 0.368319
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.181569 -1.335451 -0.828480 -0.200670 -0.080361 0.579163 0.837555 1.320958 0.664796 0.676615 0.372500
9 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.152557 -0.343375 7.701355 0.141815 3.851403 0.274375 0.390689 1.617233 0.503256 0.673372 0.452734
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.101859 -1.018020 -0.292237 -0.758410 0.019233 1.243055 1.501618 3.790454 0.650341 0.666730 0.379263
15 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.366462 17.011317 8.767047 1.755814 7.422457 3.794206 2.778420 3.465456 0.037212 0.368064 0.284141
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 10.396629 -0.526699 9.312608 0.497821 7.421982 1.734817 3.274810 2.574188 0.037693 0.684219 0.557884
17 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.674065 1.784553 0.244069 0.136637 0.611676 0.529136 0.627513 0.754655 0.668529 0.684032 0.375829
18 N01 RF_maintenance 100.00% 100.00% 35.51% 0.00% 11.033595 21.684659 9.297013 0.102699 7.549482 7.995688 3.048230 23.575338 0.032299 0.240231 0.182814
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.478763 -1.165646 -0.590555 3.226933 0.415892 0.467193 0.338176 3.650532 0.670042 0.667912 0.368321
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.149571 -0.996175 3.569049 -1.188552 0.015987 -0.802705 1.665968 -1.443973 0.655255 0.687561 0.385561
21 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.336229 -0.553081 -0.152823 4.194189 0.667193 0.331509 1.086324 3.666947 0.655689 0.647699 0.372006
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.914779 -0.620800 -0.065720 -0.265308 1.650093 1.211025 -0.050373 -0.911584 0.628674 0.648472 0.376897
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.683453 11.141489 9.349231 9.781073 7.532672 7.960107 4.266976 4.925701 0.039678 0.043939 0.005557
28 N01 RF_maintenance 100.00% 0.00% 79.57% 0.00% 13.224673 27.768230 -1.326465 0.815918 3.616774 8.526104 3.207376 26.571015 0.386642 0.172933 0.282201
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 10.384528 11.578033 8.957029 9.392343 7.518902 7.943578 3.112600 3.827377 0.032344 0.040883 0.008682
30 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.319069 -0.121519 -0.202334 0.360028 1.217815 0.453804 12.568902 0.660274 0.671910 0.689247 0.369599
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.428219 -1.238633 0.831327 0.939140 1.691695 -0.047822 0.602842 2.439732 0.684058 0.690740 0.367901
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.313634 18.069406 -0.126939 2.138408 5.169155 5.758994 8.255029 32.798660 0.632074 0.609611 0.319394
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.882319 12.729314 3.963010 4.281682 7.497110 7.937436 3.723161 4.482086 0.039341 0.047318 0.005138
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.953583 -0.190766 -0.079010 -1.595003 -1.029341 -0.937236 2.106839 1.562698 0.636505 0.643840 0.368423
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.316092 7.490420 0.049869 0.158127 0.617413 1.360744 0.824868 1.002588 0.669035 0.679954 0.367151
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.740135 0.306099 -1.396912 1.172300 1.470209 1.349609 -0.633866 2.607086 0.680553 0.691547 0.372406
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.088714 0.178264 -0.017434 0.334609 0.077232 1.484123 2.054702 1.165499 0.681106 0.696577 0.375416
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 9.784260 0.271120 8.982321 0.279053 7.501519 -0.113842 3.102418 -0.370764 0.044041 0.687907 0.543323
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.633270 -0.073349 -0.425581 -0.181323 2.037491 0.211024 -0.494010 0.482109 0.681030 0.693614 0.363417
42 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.976049 12.099255 9.603403 10.262018 7.302365 7.760799 2.975707 4.516333 0.034925 0.031877 0.002943
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.369727 0.471317 -0.565657 0.389707 -0.674116 0.528283 -0.339824 0.714800 0.687009 0.693994 0.368284
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.947937 0.274849 -1.510150 -0.119677 -0.680222 0.796863 -1.124651 -0.151305 0.685512 0.703190 0.371536
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.392138 1.576619 -0.023580 0.323752 -0.451105 1.195642 0.090558 2.135684 0.678884 0.689434 0.362681
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.223837 1.694185 1.229442 1.554731 -0.355836 0.414915 0.561114 -0.643982 0.671131 0.695789 0.385048
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 11.047981 12.419602 3.790025 3.920194 7.465840 7.883839 3.740145 4.088245 0.030978 0.056279 0.016669
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.108648 0.449204 -0.206533 1.373292 1.766557 1.176716 -0.313947 -1.483579 0.640510 0.666258 0.378915
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.248276 -0.738134 -0.611203 -0.697681 0.219529 -1.238862 0.165919 0.208393 0.598986 0.651750 0.379942
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.322399 1.661035 0.289677 0.698534 0.721202 0.934494 17.042794 8.914675 0.632733 0.675988 0.344905
51 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 23.122833 3.451347 11.979130 -0.730258 7.649035 5.112083 8.618061 0.446265 0.046745 0.587191 0.461065
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.259010 6.502409 -0.690947 0.317500 0.922965 0.737711 0.934917 0.775995 0.682333 0.698797 0.365515
53 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.330851 2.495231 -0.178128 0.038049 1.058037 2.023626 1.180467 2.993914 0.689189 0.702627 0.370284
54 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.179901 11.771732 9.360982 10.002476 7.475896 7.910016 4.222146 4.517363 0.033553 0.032087 0.001357
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 10.647793 12.429953 9.373495 9.904675 7.509382 7.932562 3.198378 5.533636 0.029174 0.035783 0.005459
56 N04 digital_ok 100.00% 0.00% 100.00% 0.00% -0.133180 12.562959 0.222135 10.126181 -0.271350 7.836707 0.874519 4.124914 0.685053 0.044882 0.559633
57 N04 RF_maintenance 100.00% 0.00% 0.00% 0.00% 15.093562 0.133647 8.803391 0.984045 5.460498 0.563999 3.406275 1.537464 0.315330 0.701985 0.466190
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 9.759861 11.466740 9.250892 9.898428 7.433174 7.892797 4.055247 4.774181 0.041877 0.040790 0.001656
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.846714 0.610520 9.317025 1.282489 7.304385 2.326364 3.237412 6.769908 0.056032 0.694355 0.552515
60 N05 RF_maintenance 100.00% 0.00% 98.27% 0.00% 0.723382 11.367336 -0.545067 9.927151 -0.129239 7.905469 0.069794 5.438056 0.678302 0.087811 0.533397
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.741530 1.211838 -0.780328 -1.612229 1.293699 -1.139150 -0.718451 -0.795318 0.623792 0.658983 0.367879
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.203956 0.460782 -1.065779 0.749091 -0.938246 -0.529860 -0.261041 -1.386448 0.619800 0.669179 0.379317
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.137894 11.846128 -0.673974 4.310631 -0.389459 7.984868 -0.753775 5.487386 0.640050 0.050031 0.487573
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.041154 0.121649 -1.038109 -1.151197 -1.084947 -1.295678 -0.202118 1.318347 0.626019 0.635446 0.359910
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.444746 0.960393 0.222926 0.847048 -0.055110 1.138163 0.332279 0.394734 0.666783 0.689702 0.375288
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.319325 1.267155 2.214664 1.765276 2.807434 0.102458 0.570079 1.288478 0.672366 0.694550 0.369466
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -1.139641 -0.886800 1.260289 1.162860 -0.275514 1.065113 0.747307 2.350939 0.683607 0.699496 0.363447
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 22.369620 25.828469 1.047804 13.125970 2.982344 7.960933 1.466516 10.140991 0.401541 0.035722 0.300637
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.173102 -0.499091 0.096369 0.551708 -0.540440 1.601775 -0.213581 0.015811 0.686073 0.703551 0.357017
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.512501 -0.341029 -0.435423 -0.171359 1.280123 1.484014 -0.486468 -0.422159 0.690632 0.705260 0.359790
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 7.694313 -0.088313 0.368820 0.787152 0.960935 -0.170352 0.492664 0.546582 0.700206 0.708282 0.356608
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 2.337665 12.619072 0.515142 10.284611 -0.048169 7.786656 4.505739 4.491093 0.688598 0.041450 0.554222
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.031485 0.984954 -1.416062 1.344066 0.732651 0.839924 -0.596304 0.924865 0.698213 0.701508 0.363650
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.550078 0.782503 -0.396994 -0.807738 0.056915 1.837349 -1.113635 0.975567 0.691592 0.703837 0.363648
77 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.572722 0.430507 0.047675 -0.499515 -1.029984 -0.940992 0.006255 -1.952579 0.658683 0.667845 0.367844
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 30.675485 -0.285273 -0.354170 0.679967 1.623765 -0.354262 1.574764 0.470979 0.448852 0.674878 0.385454
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.361711 -0.625776 -1.745527 -0.404525 -0.948135 -1.416322 -0.675107 -2.093559 0.629120 0.666813 0.379216
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% 2.781363 12.998361 2.562077 4.212114 2.336685 7.860683 0.606644 4.348273 0.628633 0.052565 0.482576
81 N07 digital_ok 100.00% 0.00% 100.00% 0.00% -0.527586 12.232883 -0.230716 8.565535 -0.567924 7.674965 -0.298135 4.769334 0.644579 0.044926 0.492525
82 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.109353 -0.389601 0.103777 1.845933 0.026566 -0.072854 -0.337296 0.230874 0.659241 0.677849 0.364641
83 N07 digital_ok 0.00% 0.00% 0.00% 0.00% -0.654443 -0.187611 -0.046666 0.240524 -0.298807 -0.649247 -0.596274 0.190771 0.672368 0.691548 0.363049
84 N08 RF_maintenance 100.00% 24.27% 100.00% 0.00% 19.792999 22.681615 12.115219 12.688416 6.171623 7.906285 4.524224 6.500377 0.252002 0.042521 0.156833
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 0.099890 -0.001257 0.250764 0.475403 -0.642922 -0.317682 -0.430386 -0.215878 0.685360 0.700321 0.359594
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.276782 1.767775 0.684489 0.730432 3.379128 -1.024235 -0.246822 13.136962 0.671765 0.678784 0.335146
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.446988 7.165874 -0.702304 -0.318405 -0.285570 1.013457 -0.337568 0.733614 0.697005 0.712594 0.350031
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.733102 0.540995 0.129015 0.600431 -0.647315 -0.142157 -0.020936 -0.023642 0.684816 0.704794 0.348456
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 0.00% 0.00% 0.00% 0.00% -0.442866 -0.863378 0.836537 1.140146 -0.690578 -0.919181 0.189347 1.598332 0.684745 0.697656 0.351748
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.539086 -0.393664 0.198702 0.109320 -0.730658 -0.646785 0.162666 0.224465 0.681647 0.701386 0.364864
92 N10 RF_maintenance 100.00% 0.00% 4.70% 0.00% 36.563970 41.694905 0.448812 1.081415 4.057314 4.486814 1.789290 8.218142 0.318856 0.269656 0.097452
93 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 1.991071 0.135489 1.347470 -0.436474 0.677895 0.702848 2.872023 -0.341165 0.671181 0.694127 0.370152
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.159925 11.871817 9.499524 9.795994 7.484650 7.895455 3.269342 4.043464 0.035888 0.027940 0.003875
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.274309 -0.352955 -1.207206 0.433580 -0.564665 0.022491 -0.887973 -0.234698 0.639601 0.673619 0.379664
96 N11 not_connected 100.00% 100.00% 100.00% 0.00% 11.381848 12.614055 3.809532 4.401924 7.322305 7.768362 3.346286 4.235037 0.037710 0.043561 0.003265
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 1.190254 7.441382 -0.002787 2.401635 0.183767 4.165024 1.373696 2.474039 0.590507 0.544091 0.347353
98 N07 digital_ok 0.00% 1.08% 0.97% 0.00% 0.755006 1.593558 -0.101654 -0.177045 -0.450740 0.424633 1.990881 2.409181 0.573853 0.593899 0.322348
99 N07 digital_ok 0.00% 0.70% 0.00% 0.00% 3.698346 -0.702311 0.760520 0.208121 -0.911493 1.422985 1.665901 0.201944 0.562364 0.610730 0.335780
100 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 236.635357 236.348714 inf inf 4275.210436 4273.713530 7633.224409 7299.845474 nan nan nan
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 7.980334 8.371599 -0.620186 0.916346 -0.144072 1.444321 -0.062260 1.007446 0.686344 0.701606 0.361414
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.091739 0.619781 -1.214127 2.082832 0.538010 0.085009 -1.339564 2.829771 0.692998 0.694902 0.354484
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.142757 4.492863 -1.060969 -0.420667 3.190064 0.942810 2.575019 2.881805 0.691355 0.705028 0.350179
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.694218 58.443366 6.422273 6.745504 1.727399 0.926342 0.182921 1.536122 0.641945 0.687549 0.358674
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.574379 -0.055730 0.000630 0.651301 0.674866 -0.468506 -0.242988 -0.143598 0.696656 0.705331 0.346071
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.207588 0.439109 0.699228 0.846859 1.044153 -0.557372 -0.026334 0.106610 0.684184 0.699306 0.343647
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 3.985510 1.010795 -0.409009 -0.467438 1.443885 -0.032067 6.950967 3.052492 0.689940 0.710849 0.350436
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 10.253038 39.672887 9.300246 0.711137 7.480891 4.373333 3.764451 3.552309 0.042646 0.307819 0.150044
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 10.065122 11.454259 9.329298 9.665046 7.553729 7.950261 2.894090 4.812345 0.026775 0.027858 0.001492
110 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 25.302274 24.487398 12.540322 12.881991 7.445363 7.810995 5.161478 6.139295 0.027204 0.031322 0.002047
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% -0.028776 11.327394 0.236231 9.760886 -0.562643 7.967618 6.999207 5.109837 0.678907 0.042166 0.470427
112 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.899316 -0.188334 -0.000630 0.012670 0.234260 1.877318 0.127119 0.192279 0.669570 0.688922 0.376675
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 12.177469 12.644928 3.595650 4.293916 7.353564 7.811063 3.712793 4.005435 0.040422 0.031550 0.004572
114 N11 not_connected 100.00% 100.00% 100.00% 0.00% 14.668173 11.728500 14.467113 10.632817 13.093470 9.366823 303.898032 113.762407 0.023674 0.031326 0.004423
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.268240 1.266206 1.030563 1.790530 0.070019 1.253317 -1.455933 -1.809780 0.630848 0.659068 0.388738
116 N07 digital_ok 0.00% 1.30% 0.97% 0.00% -1.261107 0.034322 -0.817752 -0.125569 -0.021804 0.023844 0.880635 0.529834 0.566296 0.590987 0.328685
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.092484 12.945339 9.420150 10.254810 7.363226 7.912317 3.371257 6.004645 0.028585 0.036825 0.005116
118 N07 digital_ok 0.00% 0.00% 0.00% 0.00% 0.401227 0.971601 -0.372423 0.408808 -0.126084 0.053171 0.457775 0.862773 0.660162 0.686801 0.372479
119 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 242.568382 242.380265 inf inf 3187.880044 3125.289026 5233.959878 4961.377797 nan nan nan
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.949714 2.227747 2.299023 1.853425 1.274931 1.092019 11.018192 2.409216 0.667930 0.689463 0.353174
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 2.697651 2.959895 -1.128399 5.902558 0.836817 1.595272 12.931868 12.080574 0.693155 0.681569 0.345544
122 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 8.402491 6.472901 0.172333 0.656471 0.758629 1.227678 0.324231 0.120160 0.700783 0.710263 0.349636
123 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 6.291577 8.339573 0.456887 0.803852 0.487181 0.091402 0.279271 0.957766 0.704260 0.713267 0.351977
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% 1.189168 -0.344661 -0.721896 0.610377 -0.427900 -0.682357 0.207183 -0.052600 0.694022 0.704176 0.346887
126 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.480721 3.181123 -1.210931 1.247555 2.940718 1.606291 7.857357 1.208791 0.692652 0.698834 0.351704
127 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.308983 0.216679 0.167561 0.235367 2.502503 1.326467 -0.120542 0.114212 0.691462 0.711085 0.364024
128 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 9.417513 10.970027 9.408640 9.896432 7.402386 7.839058 2.767251 4.025260 0.035409 0.027414 0.003958
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% 0.00% 12.11% 0.00% -0.328480 11.782768 -0.353088 4.232048 -0.978831 7.113672 -1.256990 2.212035 0.648916 0.320884 0.428203
132 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.784669 0.587068 -1.321476 -1.759277 8.967203 -0.901370 -0.724460 -0.972606 0.625584 0.656083 0.376172
133 N11 not_connected 100.00% 100.00% 0.00% 0.00% 11.691024 -0.130729 3.585964 -1.618304 7.456649 -0.891729 3.807467 -0.654945 0.059010 0.649298 0.493293
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.879151 -0.912113 -0.123638 -1.787858 2.377359 0.827856 8.724798 -0.741856 0.634173 0.670819 0.394360
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 9.351691 2.032047 8.931131 0.881627 7.536295 12.533315 3.859800 0.758424 0.047159 0.656640 0.473730
137 N07 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.239237 -0.930524 -0.164117 -1.549207 1.690639 -0.252592 -0.042945 -0.935763 0.645820 0.679229 0.378394
138 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 228.944451 229.111666 inf inf 3461.110428 3503.598318 6050.566374 6221.479692 nan nan nan
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.576073 -0.365864 1.136421 -1.300959 0.369727 -1.332213 -0.812266 -1.286329 0.666594 0.678349 0.364144
140 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.399589 -0.641239 -1.262191 -0.638791 -0.318789 -0.650028 0.500043 -0.030509 0.682866 0.705462 0.358747
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.406517 -0.892162 -0.587988 0.257756 1.731000 -1.189485 -0.006255 -1.381663 0.688770 0.707130 0.354534
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.286452 11.354544 -0.945347 9.933354 2.407224 7.934900 12.422349 4.715574 0.693728 0.053837 0.534370
143 N14 digital_ok 100.00% 0.00% 100.00% 0.00% 0.980646 11.871999 5.906477 9.929500 -0.239822 7.735635 0.107303 4.244228 0.634672 0.042433 0.495394
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.463262 0.397653 -0.531432 0.638690 -0.278947 1.492923 -0.371397 0.307036 0.699443 0.711747 0.349992
145 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.266630 1.243957 -0.449286 4.499365 -0.254677 9.161246 0.114122 2.490055 0.695634 0.677885 0.351068
146 N14 digital_ok 100.00% 100.00% 0.00% 0.00% 11.428517 -1.354176 3.593318 -0.522656 7.432807 -0.701223 2.748378 -1.823423 0.043941 0.698702 0.537720
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.674916 -1.435688 0.927875 2.027652 -0.928940 -0.377663 0.181111 1.101939 0.684077 0.699277 0.356184
148 N15 digital_ok 100.00% 1.78% 0.00% 0.00% -1.820288 -0.317605 2.892060 1.537924 6.490119 1.428258 6.590078 0.637774 0.657266 0.699171 0.369380
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.684407 0.787611 -1.784007 1.386458 -0.478079 -0.199972 0.214136 -0.420880 0.680247 0.694908 0.378982
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.795815 -0.205338 1.118263 0.358359 0.299094 -1.171119 -0.728492 -0.843953 0.669342 0.690722 0.386363
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 9.854272 -0.873523 9.020086 -1.484996 7.541148 0.378265 3.034395 -0.053606 0.043689 0.664651 0.486226
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.100436 11.193607 7.655841 9.677145 3.598665 7.968499 1.489311 5.173599 0.473595 0.045658 0.351134
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.001257 -0.257150 -0.294687 0.472692 -0.353575 0.797355 0.008171 0.255033 0.648387 0.675922 0.381449
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.443315 -0.349365 -0.508487 -1.177455 1.995762 1.813856 0.794503 5.517349 0.663146 0.689322 0.382952
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.236379 19.401191 -1.779404 -1.229175 -0.820907 4.168958 -0.779904 36.917405 0.637306 0.595498 0.347647
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.720963 -1.076870 -0.483758 -0.883381 -0.543182 1.380725 -0.300378 -0.283255 0.677451 0.695387 0.363293
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.987219 27.349776 -0.254739 -0.775590 -0.104622 0.830068 -0.370238 0.450683 0.681060 0.571264 0.317579
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.458570 -0.044583 1.862167 0.964012 -0.015987 -1.002608 -0.175856 -0.988604 0.685364 0.701984 0.363899
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.171387 1.149508 -0.420318 0.265440 0.094365 1.415004 -0.369421 0.406824 0.697704 0.708519 0.359313
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.874267 0.264236 1.208858 -0.252111 2.908866 1.818882 0.359027 0.227090 0.687479 0.706928 0.350802
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 29.544191 0.039694 2.044808 0.364459 3.128028 0.333226 2.809228 0.259453 0.539611 0.706101 0.351898
166 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.323695 0.763828 0.314524 1.914419 0.409864 0.628330 0.722575 6.001255 0.691071 0.698061 0.354924
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.174710 -0.530163 -1.383177 3.462313 1.194076 -0.410340 -1.143736 2.538399 0.698338 0.689230 0.361687
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.909355 -0.975586 -0.041476 -0.533859 1.518574 0.678081 -0.160100 -0.152290 0.687884 0.705519 0.368385
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.715337 -0.896608 -1.130246 -1.795455 0.931842 0.386663 -0.673875 -1.693805 0.686541 0.704286 0.369185
170 N15 digital_ok 100.00% 100.00% 0.00% 0.00% 10.904680 -0.569229 9.542691 -1.224629 7.328900 0.084802 3.161626 1.363634 0.045002 0.699113 0.551704
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.461855 -0.156070 1.589571 4.031256 0.114212 14.933901 0.383260 2.219481 0.647643 0.654183 0.365748
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.170393 12.169033 -0.350138 10.068042 2.003235 7.867557 5.580577 5.188105 0.671230 0.059168 0.534160
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.228066 -0.151923 -0.301159 0.162279 0.149843 0.103417 -0.340011 3.050754 0.681134 0.695678 0.368679
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% 0.138316 11.140895 -0.756167 9.651119 -0.148213 7.987436 2.892794 4.951964 0.690045 0.054777 0.506452
183 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.584735 0.225622 1.116605 4.666985 0.815017 -0.543654 0.193312 0.626474 0.674493 0.658280 0.344072
184 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.332680 -0.597456 0.617182 3.265639 0.036547 -0.616825 0.596257 2.333434 0.687829 0.692979 0.343476
185 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 18.449238 -1.387125 7.475591 4.196548 7.653995 -1.011361 1.744374 1.138302 0.414074 0.674202 0.388910
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.673077 -1.507577 -1.798552 -0.923057 1.407080 -0.175610 -0.744267 -1.175904 0.695698 0.710349 0.368655
187 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.011986 -0.443421 -1.654785 1.194218 0.126060 2.140252 -0.321785 8.608216 0.694181 0.702255 0.355585
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 9.358315 10.972322 8.857263 9.708844 7.601500 7.981960 4.167257 4.440130 0.030509 0.036396 0.003224
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.253427 -1.485522 -0.866790 -0.066427 -0.397408 -0.377245 -0.374313 -1.608426 0.678711 0.699568 0.379849
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% -1.588749 0.370773 1.054108 -0.589180 0.162146 0.538451 7.657210 0.165484 0.665277 0.689774 0.376702
200 N18 RF_maintenance 100.00% 100.00% 19.51% 0.00% 11.914626 35.533660 3.741070 0.276175 7.585405 5.646679 3.800345 2.786037 0.049108 0.243917 0.162813
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.532255 4.981809 2.637945 3.731140 2.392252 4.875657 -0.539164 0.824932 0.661826 0.660498 0.376972
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 0.552009 1.086566 1.279416 -1.659766 0.683002 0.432965 -0.903675 23.349314 0.671260 0.671118 0.364619
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% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
206 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.655738 2.898053 0.990810 -1.484149 0.377167 2.839474 -0.822504 -1.047621 0.652863 0.657378 0.342255
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.470208 13.361818 8.624813 11.488219 7.277902 8.302955 15.342813 94.991940 0.035164 0.034834 0.001526
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.422472 7.694651 8.428857 8.692024 7.131304 8.254898 12.815943 14.396002 0.043838 0.042091 0.001060
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 12.182227 12.189582 1.922525 3.540258 -0.472009 -0.396264 0.601732 2.242896 0.660902 0.673554 0.356287
211 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 0.719655 -0.939819 -1.431158 -0.337890 -0.731396 -0.921569 -0.568190 -1.725837 0.625275 0.659716 0.371661
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.370781 -1.241514 0.090503 -0.806369 -0.911470 -1.168609 1.672983 -1.805483 0.659156 0.667153 0.371513
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.089238 -0.183421 -1.399317 -1.095940 -0.185867 -1.128011 2.464121 -1.592107 0.651381 0.672843 0.371829
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.122473 -0.725700 -0.541322 -0.276386 -0.501548 -0.778538 0.074699 -1.849862 0.656635 0.679917 0.375729
223 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.754801 3.773208 -1.775034 1.795163 -0.658568 2.008834 0.048459 0.251397 0.648507 0.582378 0.381743
224 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 6.816572 6.534785 4.713165 4.377438 5.947632 6.133556 0.341342 1.460622 0.627572 0.651363 0.376056
225 N19 RF_ok 100.00% 0.00% 83.35% 0.00% 1.282573 11.928975 0.536551 4.087485 -0.952214 7.818544 -1.147095 4.023098 0.667363 0.141440 0.544192
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 0.117410 8.872193 -0.205933 0.845234 -1.209161 2.422304 -1.058261 2.860145 0.662703 0.638070 0.352997
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 2.204503 0.440753 -1.706323 -0.311454 0.334642 -1.063295 9.802125 -1.366846 0.635750 0.668363 0.360784
228 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 6.109582 20.593753 -1.102017 -0.734090 0.162888 4.186051 10.164729 8.441539 0.602971 0.573161 0.316545
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.526101 -0.105082 0.996005 0.938037 -0.430200 0.121602 1.988960 -1.633076 0.646710 0.671075 0.376883
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 1.684806 -0.008415 -0.295433 -1.770578 -0.590258 -0.388219 -0.359436 -1.640910 0.600522 0.648619 0.392363
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.008076 -0.686336 1.046617 0.520048 -0.236924 -0.830642 -1.398865 -1.598409 0.652175 0.664206 0.385636
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.848854 -0.948166 0.116933 0.360863 -0.691131 -0.912938 -0.515329 1.019580 0.653481 0.668974 0.381105
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.325948 47.851363 2.105015 0.976307 3.540883 5.216200 0.915365 6.571676 0.521237 0.440814 0.233533
241 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 1.824306 3.672808 -1.103387 0.315440 -0.695406 -0.423375 2.750026 9.940391 0.644902 0.627870 0.368561
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 35.593531 1.357938 -0.538096 0.922384 8.684118 0.240714 15.820925 -0.683073 0.485887 0.673416 0.398623
243 N19 RF_ok 100.00% 0.27% 0.00% 0.00% 58.708178 2.362354 0.581607 -1.725253 5.725195 -0.289343 1.498384 -0.418635 0.316554 0.652961 0.484646
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.570304 1.847275 1.050537 -0.960868 1.707139 0.479527 1.438740 3.293049 0.550611 0.637553 0.372667
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 3.323596 1.070159 2.687721 0.473002 2.424231 -0.257938 -0.932578 -1.078977 0.644344 0.661244 0.376799
246 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.526143 7.595425 -0.574436 -0.407738 3.059097 4.291982 2.186369 2.356341 0.359818 0.358523 0.162156
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.270960 1.151852 0.360435 -0.802870 -0.670327 -1.133098 -1.007642 -0.890556 0.641005 0.650488 0.369340
262 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.253719 7.712854 8.549769 9.060589 7.721770 7.795473 13.458385 18.231065 0.037703 0.030602 0.006375
320 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 10.036568 12.191833 4.665028 6.373264 3.083883 7.968912 11.885020 5.618269 0.406630 0.052209 0.313896
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 1.154382 2.243985 0.797022 1.174363 0.917307 0.786038 0.478433 -1.076468 0.553599 0.575623 0.357230
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.870702 -1.040115 -1.084211 -0.685927 0.120594 -0.688044 4.737338 1.050205 0.526660 0.597157 0.366224
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 2.848755 2.260980 -0.914487 -1.712096 -0.625615 -0.542925 2.212925 1.484093 0.509294 0.570020 0.386550
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, 7, 9, 15, 16, 18, 21, 27, 28, 29, 30, 32, 34, 36, 40, 42, 47, 50, 51, 52, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 78, 80, 81, 84, 86, 87, 89, 92, 94, 96, 97, 98, 99, 100, 101, 103, 104, 107, 108, 109, 110, 111, 113, 114, 116, 117, 119, 120, 121, 122, 123, 124, 126, 128, 129, 130, 131, 132, 133, 135, 136, 138, 142, 143, 145, 146, 148, 155, 156, 158, 159, 161, 165, 166, 170, 179, 180, 182, 183, 185, 187, 189, 191, 200, 201, 202, 203, 205, 206, 208, 209, 210, 219, 224, 225, 226, 227, 228, 240, 241, 242, 243, 244, 246, 262, 320, 325, 329]

unflagged_ants: [4, 5, 8, 10, 17, 19, 20, 22, 31, 35, 37, 38, 41, 43, 44, 45, 46, 48, 49, 53, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 77, 79, 82, 83, 85, 88, 90, 91, 93, 95, 102, 105, 106, 112, 115, 118, 125, 127, 137, 139, 140, 141, 144, 147, 149, 150, 157, 160, 162, 163, 164, 167, 168, 169, 181, 184, 186, 190, 207, 211, 220, 221, 222, 223, 229, 237, 238, 239, 245, 261, 324, 333]

golden_ants: [5, 10, 17, 19, 20, 31, 37, 38, 41, 44, 45, 53, 65, 66, 67, 69, 70, 83, 85, 88, 91, 93, 105, 106, 112, 118, 127, 140, 141, 144, 147, 149, 150, 157, 160, 162, 163, 164, 167, 168, 169, 181, 184, 186, 190]
In [23]:
# write to csv
outpath = os.path.join(nb_outdir, f'rtp_summary_table_{JD}.csv')
print(f'Now saving Table 2 to a csv at {outpath}')
df.to_csv(outpath)
Now saving Table 2 to a csv at /home/obs/src/H6C_Notebooks/_rtp_summary_/rtp_summary_table_2459937.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.dev197+g9b7c3f4
In [ ]: