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 = "2459993"
data_path = "/mnt/sn1/2459993"
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: 2-17-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/2459993/zen.2459993.21299.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 1111 ant_metrics files matching glob /mnt/sn1/2459993/zen.2459993.?????.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/2459993/zen.2459993.?????.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 2459993
Date 2-17-2023
LST Range 4.367 -- 10.448 hours
X-Engine Status ✅ ✅ ❌ ✅ ✅ ✅ ✅ ✅
Number of Files 1111
Total Number of Antennas 198
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 10
dish_ok: 1
RF_maintenance: 50
RF_ok: 19
digital_ok: 93
not_connected: 25
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 198 (0.0%)
Antennas in Commanded State (observed) 0 / 198 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s N08
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 85 / 198 (42.9%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 130 / 198 (65.7%)
Redcal Done? ❌
Never Flagged Antennas 64 / 198 (32.3%)
A Priori Good Antennas Flagged 55 / 93 total a priori good antennas:
3, 7, 10, 15, 16, 17, 19, 29, 40, 41, 42, 45,
53, 54, 55, 56, 71, 72, 81, 83, 85, 86, 93,
94, 101, 103, 107, 109, 111, 112, 118, 121,
122, 123, 124, 127, 136, 140, 144, 151, 158,
161, 165, 170, 173, 182, 183, 184, 186, 187,
189, 191, 192, 193, 202
A Priori Bad Antennas Not Flagged 26 / 105 total a priori bad antennas:
8, 22, 35, 43, 46, 48, 49, 61, 62, 64, 73,
74, 89, 90, 115, 125, 126, 133, 220, 222, 228,
229, 241, 245, 261, 325
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_2459993.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% 100.00% 0.00% 11.779451 13.304223 9.473089 10.227988 10.069923 10.885963 0.784779 2.118567 0.028648 0.028050 0.001087
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.261666 -0.808626 1.129537 0.225134 1.390342 0.404878 11.817730 2.080591 0.567273 0.611773 0.412906
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.212480 -0.157799 0.118360 0.216564 0.342144 1.794253 1.421222 1.558570 0.585620 0.610278 0.396938
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.316417 -0.007838 -1.315945 -0.140636 0.069073 0.518905 5.324797 10.628497 0.599598 0.629065 0.393366
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.362971 -1.456188 -0.619619 0.152934 -0.372780 0.364811 0.543783 1.805675 0.598465 0.625542 0.384930
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.489970 -0.540804 2.812124 -1.021578 1.174292 -0.053958 2.062244 -0.054547 0.573268 0.627620 0.397470
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 4.920205 -0.614066 -1.254444 -1.270701 1.824981 1.049754 3.587848 2.824136 0.584669 0.625707 0.388024
15 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 12.088501 13.029503 8.906503 9.642847 10.069852 10.879087 0.335994 1.523389 0.028848 0.026927 0.001866
16 N01 digital_ok 100.00% 100.00% 0.00% 0.00% 12.060718 -0.671009 9.441064 0.796616 10.066583 2.015550 0.778634 2.749475 0.028967 0.616842 0.464658
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 1.340119 2.345828 0.368827 0.552656 0.406135 0.592045 8.201242 4.431244 0.594515 0.626121 0.400724
18 N01 RF_maintenance 100.00% 100.00% 81.28% 0.00% 12.761117 18.418596 9.418341 -0.385753 10.242215 8.989051 0.705233 16.387015 0.027957 0.188317 0.133993
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.141350 -0.707474 -1.149587 2.641920 -0.671729 6.266974 0.191132 6.657503 0.607098 0.624138 0.382665
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.284045 -1.608784 1.428042 -0.931258 2.232637 0.499541 1.847444 -0.471310 0.602810 0.635208 0.386172
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 1.504656 1.207061 -0.737838 0.066232 0.278921 2.175470 -0.030833 0.250300 0.589908 0.618593 0.377420
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.358242 -0.155434 0.663540 0.127999 0.802389 1.617301 -0.774736 -1.133995 0.572053 0.605315 0.384839
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.289139 12.353708 9.474668 10.034458 10.210294 10.950378 1.796631 2.545125 0.030482 0.031913 0.003100
28 N01 RF_maintenance 100.00% 0.00% 97.48% 0.00% 12.600912 26.965797 0.366142 2.953770 5.468216 9.505774 4.034549 16.403026 0.292404 0.114852 0.227300
29 N01 digital_ok 100.00% 100.00% 100.00% 0.00% 12.154728 12.937110 9.089315 9.653605 10.172296 10.910391 0.699025 1.433475 0.028173 0.029981 0.002282
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 1.025726 0.242640 1.733655 -1.310653 0.270151 -0.263549 1.425953 -0.253096 0.592335 0.641993 0.402528
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.022229 -1.375220 0.890650 0.518503 1.323540 -0.193882 0.143678 2.321657 0.618190 0.641674 0.384670
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.142121 27.647735 0.462997 3.003623 5.605447 1.224852 52.247469 10.434821 0.538702 0.517216 0.280778
34 N06 not_connected 100.00% 100.00% 100.00% 0.00% 13.822717 14.062270 4.187264 4.635474 10.154252 10.899011 0.859447 1.650136 0.031534 0.035062 0.002539
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% 1.044243 -0.695106 1.543623 -1.076271 0.223636 -1.197623 -1.175203 -0.233098 0.584763 0.600356 0.379957
36 N03 RF_maintenance 100.00% 100.00% 100.00% 0.00% 30.136385 29.299697 12.544392 12.635282 10.300395 10.866794 3.303072 4.214048 0.026324 0.024794 0.001821
37 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.137031 0.296970 -1.002449 0.869154 1.669223 1.333240 -0.916668 2.266091 0.586917 0.617268 0.409756
38 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.188198 0.031792 0.170296 0.561623 -0.488750 0.331068 2.783455 0.898314 0.587141 0.610365 0.401159
40 N04 digital_ok 100.00% 100.00% 0.00% 0.00% 11.417085 1.325360 9.114100 0.597572 10.145651 -0.187892 0.700631 0.988320 0.031787 0.606752 0.428165
41 N04 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.274180 2.668349 -0.701841 8.094577 1.052472 3.668627 -0.979044 0.305657 0.617126 0.515513 0.421655
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.255603 0.022320 0.237694 0.723123 -0.479392 0.120835 -1.099382 0.963144 0.621206 0.640433 0.393491
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -1.553335 0.436208 -0.369841 -0.361614 -0.710004 0.654688 -1.141031 -0.804618 0.621816 0.652066 0.388069
45 N05 digital_ok 100.00% 0.00% 0.00% 0.00% -0.350949 6.098500 0.144874 0.805386 -0.925324 2.243710 -0.328487 13.812527 0.615320 0.634379 0.372803
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.076982 0.301688 -0.839944 -0.937525 -0.631978 0.162891 -0.568482 -1.018747 0.620451 0.655345 0.397795
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 12.660714 13.798161 4.094749 4.274066 10.135953 10.816906 1.935978 1.437563 0.032286 0.039787 0.005853
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.516058 1.443162 -0.056784 1.760495 -0.854307 2.293846 -0.429399 -1.734360 0.581604 0.624767 0.392996
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.289347 -0.006640 -0.978049 0.172533 1.627018 -0.105986 -0.229886 1.317910 0.544190 0.604305 0.389833
50 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.119999 9.842789 0.372832 1.234287 3.929026 5.054516 15.006614 73.421126 0.546909 0.561686 0.374094
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 10.959423 4.608005 0.038723 1.865038 4.314456 4.049612 19.337135 2.907614 0.429340 0.463515 0.257516
52 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 8.584878 7.399883 -0.562546 0.645070 1.028343 0.798925 1.364113 0.817743 0.591010 0.625367 0.407260
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.275030 3.223097 -1.323691 -0.928424 1.133121 1.298455 1.733326 6.369493 0.601509 0.635049 0.416252
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 32.915417 -0.525616 4.271414 -0.615609 2.280396 -0.379986 4.011823 0.820287 0.408962 0.635215 0.411783
55 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.137624 13.186612 8.983458 9.630848 10.128494 10.856485 0.539471 2.628527 0.028153 0.028086 0.000890
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 3.924823 0.549192 -0.774216 1.506510 -0.443833 1.641105 -0.661494 1.337211 0.601027 0.639756 0.395341
57 N04 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 11.406450 12.711154 9.381848 10.152327 10.050224 10.826163 1.069426 1.843448 0.030228 0.029271 0.001796
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 12.329122 1.302479 8.957903 0.736681 9.865274 1.657636 0.405347 6.386837 0.036356 0.641222 0.469813
60 N05 RF_maintenance 100.00% 0.00% 97.84% 0.00% 0.543812 12.561897 -0.564746 10.179402 -0.335177 10.868383 5.818607 2.847787 0.618002 0.054217 0.495223
61 N06 not_connected 0.00% 0.00% 0.00% 0.00% 2.752274 0.123125 -0.626489 -1.285749 1.796440 -1.168702 -0.804673 -0.023833 0.560465 0.610998 0.381669
62 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.467459 1.500552 -1.094703 1.151425 0.071167 -0.133708 0.411590 -0.967938 0.560169 0.619514 0.389113
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% 2.404119 13.162883 -0.097852 4.661986 1.368794 10.975097 -0.353087 2.834669 0.576486 0.039356 0.446071
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% 0.328078 -0.001825 -0.547435 -0.778322 -0.543276 -0.864250 1.574336 0.003403 0.573685 0.589132 0.372513
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.135874 1.115308 0.425464 1.129750 -0.422386 0.374328 2.058626 0.465625 0.565253 0.608101 0.413512
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 1.199644 2.070633 -1.330678 -0.753458 2.684937 -0.348263 -0.470180 0.501636 0.585276 0.625780 0.416624
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.704366 -0.441262 -0.254588 1.321648 -0.539622 0.743677 0.077034 2.224563 0.592143 0.620815 0.406086
68 N03 dish_maintenance 100.00% 0.00% 100.00% 0.00% 21.295907 27.972198 1.051361 13.305964 4.524941 10.879174 0.514236 7.349296 0.285012 0.025529 0.189384
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.277546 0.141216 0.313953 0.877083 -0.309108 1.793733 -0.547112 -0.123416 0.598118 0.631046 0.405597
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.244729 0.118241 -0.251586 0.144091 0.510590 1.440949 -0.032815 -0.143088 0.598718 0.632461 0.399717
71 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 4.674310 -0.247792 0.520779 1.155282 -0.134873 -0.232927 2.014584 0.248304 0.597229 0.642778 0.393962
72 N04 digital_ok 100.00% 100.00% 100.00% 0.00% 12.445391 13.913596 9.844445 10.537040 9.939820 10.679049 0.706550 1.836190 0.030930 0.031201 0.003204
73 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.593631 0.807868 -1.369578 -0.838608 1.214102 0.085538 -0.715220 -0.892395 0.628936 0.656310 0.385671
74 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.061593 0.414240 0.135672 -0.443775 0.044868 2.168280 -0.997641 1.900106 0.632227 0.656052 0.382710
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 58.984192 21.209635 0.513769 -0.239435 5.388824 4.871704 3.872342 20.769191 0.314399 0.521873 0.327943
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 37.398001 1.167525 -0.271492 1.480329 2.692613 0.763709 1.775302 -0.165422 0.409010 0.630330 0.392058
79 N11 not_connected 100.00% 0.00% 100.00% 0.00% 1.921483 13.480184 -1.317146 4.681296 -0.489925 10.783950 0.427817 1.122468 0.572778 0.033906 0.441108
80 N11 not_connected 100.00% 0.00% 100.00% 0.00% -0.357635 14.424507 0.565784 4.587317 -0.754861 10.825917 -0.457194 2.033314 0.586464 0.038669 0.447382
81 N07 digital_ok 100.00% 66.43% 99.64% 0.00% -0.246750 13.575572 0.017673 8.857428 -0.119309 10.529237 0.116705 2.384512 0.249916 0.032934 0.178091
82 N07 RF_maintenance 0.00% 66.43% 66.43% 0.00% 3.349398 1.810036 -1.053529 -0.115987 -0.199413 -0.966034 -0.472937 1.031279 0.259287 0.267998 0.161735
83 N07 digital_ok 0.00% 66.43% 66.43% 0.00% -0.655297 -0.143208 0.155125 0.539494 0.079259 -0.353139 -0.656153 0.133501 0.259041 0.262195 0.152948
84 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
85 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
86 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
87 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% 263.248828 262.618645 inf inf 2889.036263 2877.131646 5003.731989 5045.566594 nan nan nan
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.856590 -0.305623 0.287220 0.939691 -0.361786 -0.310416 2.369893 0.338884 0.611802 0.638731 0.378609
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.772935 0.510999 0.067817 1.009580 -0.436914 -0.963356 -0.761498 -0.564294 0.616679 0.649897 0.378136
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.116533 -0.046317 -1.308134 -0.430431 -0.906039 -0.910603 0.046913 1.529750 0.628049 0.660095 0.381068
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.450127 -0.171169 0.378060 0.472555 -1.015323 -0.940953 -0.003403 0.179640 0.612940 0.652292 0.382539
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.892378 0.352765 9.363809 0.300571 10.264172 1.705533 0.420067 0.201158 0.032317 0.655693 0.425497
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.235690 12.848061 9.509788 10.253649 10.026001 10.810482 1.794818 2.392972 0.027380 0.025968 0.000915
94 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 12.931569 13.119318 9.619271 10.053418 10.599472 10.870370 1.208231 1.649453 0.026272 0.026276 0.001082
95 N11 not_connected 100.00% 0.00% 0.00% 0.00% 8.219713 4.253566 -0.565500 0.858659 0.795503 0.475716 1.330827 0.809232 0.522017 0.582052 0.359330
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 5.387224 22.220528 3.796450 1.774996 4.385599 2.805922 -2.163893 -1.111590 0.582893 0.501216 0.355109
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.773544 5.090293 -0.423334 1.006335 0.029359 3.562511 0.052089 7.528223 0.544936 0.561238 0.360844
101 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 278.182304 277.963295 inf inf 3651.422826 3651.334281 7158.456670 7158.320749 nan nan nan
102 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
103 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 274.761838 274.297781 inf inf 3225.702799 3272.326701 5994.061148 6184.873971 nan nan nan
104 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.421596 -0.199468 0.147078 1.040274 0.704262 -0.705531 -0.493060 -0.350118 0.612340 0.637574 0.380460
106 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.983717 -1.148294 -1.023180 -0.295389 1.313700 -0.294846 0.094175 0.226456 0.618355 0.637036 0.370621
107 N09 digital_ok 100.00% 0.00% 0.00% 0.00% 10.786419 3.022600 -0.749143 -1.018050 1.459418 -0.073541 9.407517 6.005403 0.613792 0.657450 0.365749
108 N09 RF_maintenance 100.00% 100.00% 0.00% 0.00% 11.948281 44.051789 9.421633 1.051017 10.161838 5.622477 1.288991 2.157269 0.029387 0.241747 0.130234
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 11.732482 12.688889 9.452406 9.920170 10.245232 10.957080 0.508156 2.402364 0.031410 0.029856 0.002149
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.625356 16.895049 5.924983 -0.063684 2.479616 0.091646 0.118785 -0.721488 0.586718 0.600589 0.359420
111 N10 digital_ok 100.00% 0.00% 98.11% 0.00% 39.108023 12.669397 0.747553 10.007154 5.762453 10.935918 8.903885 2.594276 0.469711 0.046406 0.323779
112 N10 digital_ok 100.00% 79.03% 97.84% 0.00% 5.227290 12.516066 7.044473 10.115868 2.780118 10.736811 0.184338 1.585276 0.191443 0.054117 -0.097801
113 N11 not_connected 100.00% 100.00% 100.00% 0.00% 14.079342 14.098084 3.844613 4.676803 10.000390 10.758140 1.188097 1.660001 0.032047 0.031213 0.000782
114 N11 not_connected 100.00% 0.00% 0.00% 0.00% 4.955044 1.179036 0.952169 -0.080322 2.213940 -0.676898 -0.522681 -0.007073 0.558771 0.610464 0.386719
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.013634 -0.907769 -0.808846 0.215902 -0.157646 -0.783147 -0.514517 -0.862712 0.550692 0.606311 0.398450
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 12.850303 14.247409 9.546622 10.499163 9.999641 10.867520 1.031907 3.739117 0.027766 0.026373 0.001137
118 N07 digital_ok 0.00% 66.43% 66.43% 0.00% 0.653164 1.563245 -0.146971 0.678432 -0.117607 -0.179680 0.258605 0.898649 0.255831 0.265805 0.160702
120 N08 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
121 N08 digital_ok 100.00% 100.00% 100.00% 0.00% 271.668447 271.765722 inf inf 2725.940246 2725.687231 4599.217380 4615.635580 nan nan nan
122 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
123 N08 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 12.051542 -0.386895 9.692039 0.766643 9.972744 -0.352565 0.601242 0.454526 0.035349 0.653967 0.452701
125 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.254056 -0.132989 -0.161369 0.967045 1.134100 0.809066 1.653107 2.070223 0.626064 0.645200 0.372373
126 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.249143 -1.052710 -1.006747 1.047402 2.299867 -0.298747 3.542370 -0.408262 0.629491 0.650720 0.376349
127 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 11.520698 0.359856 9.355178 1.052985 10.212997 2.188549 0.388547 26.805147 0.031039 0.660551 0.425749
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% -0.569711 -0.155934 -1.258556 -0.268441 -0.799495 1.012056 0.191668 3.515572 0.635231 0.660747 0.392428
131 N11 not_connected 100.00% 0.00% 23.13% 0.00% -0.319302 12.680997 0.215652 4.550246 -0.524395 9.735788 -0.802870 1.036473 0.589802 0.262803 0.423547
132 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.715404 0.395920 -0.150201 -1.353123 5.535953 -0.530371 0.385604 -0.469203 0.577194 0.606903 0.383909
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.846715 -1.521396 -1.131246 -0.339256 -1.024888 -1.172303 -0.483010 0.695515 0.552580 0.610164 0.404607
134 N11 not_connected 100.00% 100.00% 100.00% 0.00% 13.143601 14.026475 3.980665 4.643105 9.984388 10.788609 0.455337 1.777698 0.034061 0.031304 0.001998
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.563108 -1.010903 -1.033079 -1.347431 2.453177 0.939773 11.555628 0.136768 0.535256 0.599556 0.423995
136 N12 digital_ok 100.00% 99.10% 0.00% 0.00% 11.004522 -0.227454 9.063503 -0.647673 10.223448 0.457025 1.231145 -0.455365 0.034840 0.599873 0.421758
137 N07 RF_maintenance 0.00% 66.43% 66.43% 0.00% -0.501325 -0.799345 0.056784 -1.307347 0.997243 -0.582534 0.538545 0.935879 0.249597 0.264668 0.163349
139 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% 238.758406 237.840226 inf inf 2730.096528 2728.831814 4589.313071 4566.236430 nan nan nan
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 5.109075 -1.191945 -1.228120 -0.137690 10.833120 0.720282 68.889713 9.228835 0.568796 0.625079 0.406662
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.325462 -0.589876 -0.373784 0.627460 1.672350 -0.694294 0.917987 -0.751464 0.593731 0.635323 0.401213
142 N13 RF_maintenance 100.00% 0.00% 98.65% 0.00% 1.853595 12.519218 -0.776154 10.187067 2.455601 10.929086 13.464073 2.392706 0.604888 0.039077 0.478599
143 N14 RF_maintenance 100.00% 98.02% 100.00% 0.00% 12.745323 12.598455 9.347395 10.160915 9.743567 10.933683 0.674128 2.482466 0.062047 0.026942 0.024731
144 N14 digital_ok 100.00% 0.00% 0.00% 0.00% -0.911760 -0.019728 -1.241235 5.403974 0.238083 7.715488 -0.459715 0.217519 0.627790 0.609825 0.384312
145 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.849369 -0.132487 1.405008 1.159054 0.082566 2.570449 0.085562 -0.873833 0.620506 0.654012 0.378791
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.055210 0.581506 -0.610569 0.374869 -0.695492 0.128031 -0.751161 -1.496552 0.603909 0.642775 0.379769
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.582033 -1.369249 1.218164 2.427900 -0.154673 -0.796809 0.557202 0.366850 0.619555 0.643977 0.380268
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.512271 0.258172 -0.648564 -0.425044 1.399291 2.089021 -0.161221 -0.288922 0.623977 0.657068 0.399216
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.158388 -1.304005 -0.863052 -1.212521 -0.641658 1.103751 0.214478 0.040064 0.619696 0.650942 0.400625
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.841835 3.398400 -0.902822 -1.186909 -0.588258 -0.456532 0.302853 0.402071 0.621339 0.632803 0.392412
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 25.960776 1.133018 0.052986 0.545142 6.072975 -0.792595 5.383263 -0.238585 0.470679 0.575170 0.359514
155 N12 RF_maintenance 100.00% 98.83% 0.00% 0.00% 11.374656 -1.085039 9.211353 -1.114292 10.263060 0.861941 1.733682 1.638672 0.035394 0.602582 0.428462
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.788494 12.535957 7.808887 9.965032 5.715663 10.981054 1.193204 2.619995 0.369661 0.032103 0.277171
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.259136 -0.106255 -0.073257 0.796685 -0.267654 0.607482 -0.353749 0.011719 0.560885 0.606640 0.414041
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% 0.317765 0.085705 -0.229774 -0.053906 1.794031 1.691214 2.788600 14.310071 0.572500 0.616781 0.420095
159 N13 RF_maintenance 100.00% 100.00% 100.00% 0.00% 274.517486 274.599023 inf inf 3669.079748 3670.351297 6753.038038 6733.078425 nan nan nan
160 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.693684 -0.792781 -0.566952 -0.542655 -0.751288 1.575620 -0.389707 0.692829 0.585997 0.630162 0.405816
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -1.048097 30.814739 -0.036330 -0.369227 0.243458 1.693242 -0.500090 0.749369 0.597562 0.504590 0.342539
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.340544 -1.233766 0.222523 -1.094399 0.970716 1.561316 3.287778 -0.190309 0.613290 0.647850 0.392794
163 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.340239 1.564094 -0.228757 0.564289 -0.344436 1.050554 -0.456527 1.298530 0.621919 0.650665 0.390055
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.098794 0.286971 -0.447309 1.487595 0.027031 1.784019 0.129492 0.737797 0.620787 0.640342 0.378279
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 33.476245 0.315000 -0.474600 -0.720401 6.075098 0.002659 12.435699 0.488731 0.490757 0.654310 0.387536
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.349270 0.072922 0.548041 0.774225 -0.115568 -0.434074 -0.073726 -1.054249 0.622300 0.657485 0.378260
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.164867 -1.029846 -1.382352 -0.858672 1.443995 0.117178 -0.734087 1.209224 0.627011 0.657399 0.390258
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.014836 -1.429836 0.176456 -0.217804 1.078729 0.426901 -0.225581 1.234039 0.623652 0.650792 0.398506
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.881728 -0.982329 -0.926961 -1.336113 0.974586 0.571082 -0.460487 -0.309323 0.625641 0.653669 0.402210
170 N15 digital_ok 100.00% 99.73% 0.00% 0.00% 12.788297 -0.547468 9.739813 -0.450222 9.995641 -0.210848 2.330224 4.533430 0.033725 0.648866 0.470311
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.082636 1.716458 -1.114118 -0.473770 -0.813424 0.754626 -0.438186 1.599246 0.560841 0.572385 0.365312
173 N16 digital_ok 100.00% 100.00% 100.00% 0.00% 14.237015 13.197854 3.573787 4.298080 10.302141 10.963712 2.462531 4.641235 0.034604 0.035885 0.001892
179 N12 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
180 N13 RF_maintenance 100.00% 0.00% 98.74% 0.00% -0.065024 13.300796 -1.351134 10.319431 0.486179 10.826663 14.317703 2.982657 0.586213 0.046131 0.484595
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.433341 0.001825 0.738825 0.661653 0.007527 -0.100656 -0.084891 3.281420 0.594615 0.630761 0.400342
182 N13 digital_ok 100.00% 0.00% 98.92% 0.00% 0.060669 12.471974 -1.016151 9.909228 -0.138953 10.992488 2.884272 2.315954 0.613201 0.041022 0.465048
183 N13 digital_ok 100.00% 100.00% 100.00% 0.00% 263.301899 263.092727 inf inf 2742.783507 2624.913776 4619.499423 3998.327019 nan nan nan
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 27.348634 -0.328668 4.985238 -1.198454 10.472249 1.070226 9.978546 0.364228 0.448265 0.647962 0.399714
185 N14 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.604988 -0.029261 3.937613 0.920209 5.603003 0.053287 -0.846678 -0.188075 0.590929 0.648989 0.398196
186 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 4.340037 -0.671603 0.696156 -0.167912 -0.508511 -0.916844 -0.407179 -0.773117 0.604578 0.653254 0.394217
187 N14 digital_ok 100.00% 38.07% 0.00% 0.00% 10.677369 -0.723172 8.428259 0.282065 8.439481 1.935773 0.913100 -0.224141 0.222052 0.648354 0.475560
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% 10.705415 12.322917 9.028792 10.027281 10.243424 11.013420 4.586672 3.700370 0.028799 0.028132 0.001220
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -1.078644 -1.384657 -0.695292 0.353779 -0.568927 -0.007527 -0.224850 -0.943957 0.614563 0.647315 0.402651
191 N15 digital_ok 100.00% 0.00% 0.00% 0.00% 1.176863 0.207438 1.203423 -0.265801 0.142693 0.638760 4.879510 1.349811 0.592172 0.628880 0.395755
192 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 3.815267 9.100182 3.350154 4.665128 6.662106 8.723437 0.288757 -1.003328 0.575412 0.569739 0.392425
193 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 8.603454 1.099814 4.995797 1.571978 8.082076 2.328610 -2.194635 -0.322660 0.535757 0.591175 0.420342
200 N18 RF_maintenance 100.00% 100.00% 97.30% 0.00% 13.835013 41.072006 3.971245 -0.054260 10.284535 6.010359 1.456652 10.080040 0.035947 0.147061 0.090194
201 N18 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.519742 6.827676 3.203883 4.030161 3.826019 6.875593 -0.583220 -0.956600 0.577922 0.597177 0.388848
202 N18 digital_ok 100.00% 0.00% 0.00% 0.00% 1.075853 3.913719 1.778259 -1.179625 1.529713 -0.147077 -0.574078 19.250037 0.595006 0.599778 0.384132
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 9.173877 17.125055 1.048396 -0.924982 -0.054238 0.824020 10.173869 1.680888 0.599304 0.641931 0.396240
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 9.802806 1.153156 3.194472 -1.138731 7.027695 0.129108 13.186614 4.342625 0.353320 0.614465 0.457195
206 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.430880 6.234853 -1.053324 2.214817 9.317541 3.834193 -0.403065 0.479647 0.581567 0.498455 0.395967
207 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 271.233111 271.109263 inf inf 3655.016511 3656.688495 7180.575972 7195.130504 nan nan nan
208 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
210 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
211 N20 RF_ok 100.00% 0.00% 100.00% 0.00% 0.605095 13.206583 -1.066420 4.702186 -0.830169 10.755081 -0.160463 2.023201 0.557190 0.034616 0.472809
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.393459 -1.257258 0.670549 -0.344246 -0.428961 -0.230503 2.343002 -1.031469 0.578810 0.600964 0.387769
221 N18 RF_ok 100.00% 0.00% 0.00% 0.00% 2.781019 -0.532240 -0.804169 -0.649476 2.782063 -0.566860 6.192744 -0.810453 0.562133 0.609623 0.392316
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.356309 -0.220066 0.067073 0.142314 -0.229452 -0.291380 2.928558 -1.065274 0.580744 0.618454 0.392226
223 N19 RF_ok 100.00% 100.00% 100.00% 0.00% 274.356537 274.191540 inf inf 2635.247873 2613.935531 4162.904118 4027.409677 nan nan nan
224 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
225 N19 RF_ok 100.00% 0.00% 97.39% 0.00% -0.386305 12.838396 0.943763 4.462579 -0.684553 10.660074 -1.064981 2.380908 0.597080 0.109535 0.501643
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.199725 26.264594 -0.231440 0.688912 -1.058274 4.605910 -0.912778 0.138891 0.586831 0.488823 0.362100
227 N20 RF_ok 100.00% 0.00% 0.00% 0.00% 5.328929 0.045282 1.707326 -1.072760 2.806313 3.693880 5.561256 3.987592 0.470204 0.599026 0.420121
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.240999 -0.233126 1.239631 -1.265593 1.074380 -1.050783 -0.303305 0.460101 0.572409 0.585752 0.378285
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.525880 0.957046 1.005718 1.427487 0.055414 1.842752 2.404911 -1.642451 0.575516 0.602841 0.406648
237 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
238 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 240.321593 240.004359 inf inf 2768.406276 2574.959540 5254.013025 4855.969777 nan nan nan
239 N18 RF_ok 100.00% 100.00% 100.00% 0.00% 249.527816 249.211020 inf inf 2341.883609 2328.074717 5481.116884 5510.095765 nan nan nan
240 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.617559 -0.343933 0.279881 -0.317237 0.218041 -1.095650 8.419837 4.272298 0.568204 0.604284 0.396463
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -0.240580 -0.950219 -0.102491 0.220084 -0.788374 -0.904693 0.325833 -0.902039 0.570945 0.611789 0.405286
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 21.118548 1.851494 1.021774 1.671781 4.275021 1.814520 3.164564 -0.246041 0.467142 0.607096 0.402907
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 25.702954 -1.059182 1.353535 -1.394347 3.706782 -0.335645 -0.392696 -0.049349 0.440392 0.593259 0.389436
244 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.328975 -1.337894 -1.060643 -0.850454 -0.037786 -0.462586 1.947705 5.356168 0.539756 0.601715 0.398208
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.458756 0.034190 1.318684 -0.494088 0.957585 -0.362357 -1.512066 -0.108740 0.569922 0.595815 0.391658
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 0.326017 14.293471 0.020873 3.633285 -0.536569 10.903594 -0.798092 1.364857 0.559006 0.033869 0.472022
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.336590 2.339093 0.468720 -0.172926 -0.278654 -0.403626 2.512903 -0.636871 0.567049 0.572422 0.382525
262 N20 dish_maintenance 100.00% 44.64% 70.93% 0.00% 14.457151 14.796965 4.980980 5.208923 4.981514 7.449967 0.453805 3.177864 0.220885 0.203732 0.111695
320 N03 dish_maintenance 100.00% 100.00% 100.00% 0.00% 16.495053 13.560090 6.250169 6.688497 10.221949 10.966950 0.942482 2.975174 0.046622 0.039382 0.007879
324 N04 not_connected 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 1.833997 -0.782071 1.371262 -1.330947 1.235905 -0.696882 -0.912549 0.624318 0.500910 0.522303 0.379632
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
333 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [3, 4, 7, 10, 15, 16, 17, 18, 19, 27, 28, 29, 32, 34, 36, 40, 41, 42, 45, 47, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 68, 71, 72, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 92, 93, 94, 95, 96, 97, 101, 102, 103, 104, 107, 108, 109, 110, 111, 112, 113, 114, 117, 118, 120, 121, 122, 123, 124, 127, 131, 132, 134, 135, 136, 137, 139, 140, 142, 143, 144, 151, 155, 156, 158, 159, 161, 165, 170, 173, 179, 180, 182, 183, 184, 185, 186, 187, 189, 191, 192, 193, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 221, 223, 224, 225, 226, 227, 237, 238, 239, 240, 242, 243, 244, 246, 262, 320, 324, 329, 333]

unflagged_ants: [5, 8, 9, 20, 21, 22, 30, 31, 35, 37, 38, 43, 44, 46, 48, 49, 61, 62, 64, 65, 66, 67, 69, 70, 73, 74, 88, 89, 90, 91, 105, 106, 115, 125, 126, 128, 133, 141, 145, 146, 147, 148, 149, 150, 157, 160, 162, 163, 164, 166, 167, 168, 169, 171, 181, 190, 220, 222, 228, 229, 241, 245, 261, 325]

golden_ants: [5, 9, 20, 21, 30, 31, 37, 38, 44, 65, 66, 67, 69, 70, 88, 91, 105, 106, 128, 141, 145, 146, 147, 148, 149, 150, 157, 160, 162, 163, 164, 166, 167, 168, 169, 171, 181, 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_2459993.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.0.5.dev13+gd6c757c
3.2.1
In [ ]: