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 = "2460134"
data_path = "/mnt/sn1/2460134"
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: 7-8-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/2460134/zen.2460134.42116.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 360 ant_metrics files matching glob /mnt/sn1/2460134/zen.2460134.?????.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/2460134/zen.2460134.?????.sum.known_good.omni.calfits. Skipping redcal chisq.

Figure out some general properties¶

In [9]:
# Parse some general array properties, taking into account the fact that we might be missing some of the metrics
ants = []
pols = []
antpol_pairs = []

if use_auto_metrics:
    ants = sorted(set(bl[0] for bl in auto_metrics['modzs']['r2_shape_modzs']))
    pols = sorted(set(bl[2] for bl in auto_metrics['modzs']['r2_shape_modzs']))
if use_ant_metrics:
    antpol_pairs = sorted(set([antpol for dms in ant_metrics_dead_metrics.values() for antpol in dms.keys()]))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))
if use_redcal:
    antpol_pairs = sorted(set([ant for cspa in cspa_med_dict.values() for ant in cspa.keys()]) | set(antpol_pairs))
    antpols = sorted(set(antpol[1] for antpol in antpol_pairs))
    ants = sorted(set(antpol[0] for antpol in antpol_pairs) | set(ants))
    pols = sorted(set(utils.join_pol(ap, ap) for ap in antpols) | set(pols))

# Figure out remaining antennas not in data and also LST range
data_files = sorted(glob.glob(os.path.join(data_path, 'zen.*.sum.uvh5')))
hd = io.HERAData(data_files[0])
unused_ants = [ant for ant in hd.antpos if ant not in ants]    
hd_last = io.HERAData(data_files[-1])

Load a priori antenna statuses and node numbers¶

In [10]:
# try to load a priori antenna statusesm but fail gracefully if this doesn't work.
a_priori_statuses = {ant: 'Not Found' for ant in ants}
nodes = {ant: np.nan for ant in ants + unused_ants}
try:
    from hera_mc import cm_hookup

    # get node numbers
    hookup = cm_hookup.get_hookup('default')
    for ant_name in hookup:
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in nodes:
            if hookup[ant_name].get_part_from_type('node')['E<ground'] is not None:
                nodes[ant] = int(hookup[ant_name].get_part_from_type('node')['E<ground'][1:])
    
    # get apriori antenna status
    for ant_name, data in hookup.items():
        ant = int("".join(filter(str.isdigit, ant_name)))
        if ant in a_priori_statuses:
            a_priori_statuses[ant] = data.apriori

except Exception as err:
    print(f'Could not load node numbers and a priori antenna statuses.\nEncountered {type(err)} with message: {err}')

Summarize auto metrics¶

In [11]:
if use_auto_metrics:
    # Parse modzs
    modzs_to_check = {'Shape': 'r2_shape_modzs', 'Power': 'r2_power_modzs', 
                      'Temporal Variability': 'r2_temp_var_modzs', 'Temporal Discontinuties': 'r2_temp_diff_modzs'}
    worst_metrics = []
    worst_zs = []
    all_modzs = {}
    binary_flags = {rationale: [] for rationale in modzs_to_check}

    for ant in ants:
        # parse modzs and figure out flag counts
        modzs = {f'{pol} {rationale}': auto_metrics['modzs'][dict_name][(ant, ant, pol)] 
                 for rationale, dict_name in modzs_to_check.items() for pol in pols}
        for pol in pols:
            for rationale, dict_name in modzs_to_check.items():
                binary_flags[rationale].append(auto_metrics['modzs'][dict_name][(ant, ant, pol)] > mean_round_modz_cut)

        # parse out all metrics for dataframe
        for k in modzs:
            col_label = k + ' Modified Z-Score'
            if col_label in all_modzs:
                all_modzs[col_label].append(modzs[k])
            else:
                all_modzs[col_label] = [modzs[k]]
                
    mean_round_modz_cut = auto_metrics['parameters']['mean_round_modz_cut']
else:
    mean_round_modz_cut = 0

Summarize ant metrics¶

In [12]:
if use_ant_metrics:
    a_priori_flag_frac = {ant: np.mean([ant in apxa for apxa in ant_metrics_apriori_exants.values()]) for ant in ants}
    dead_ant_frac = {ap: {ant: np.mean([(ant, ap) in das for das in ant_metrics_dead_ants_dict.values()])
                                 for ant in ants} for ap in antpols}
    crossed_ant_frac = {ant: np.mean([np.any([(ant, ap) in cas for ap in antpols])
                                      for cas in ant_metrics_crossed_ants_dict.values()]) for ant in ants}
    ant_metrics_xants_frac_by_antpol = {antpol: np.mean([antpol in amx for amx in ant_metrics_xants_dict.values()]) for antpol in antpol_pairs}
    ant_metrics_xants_frac_by_ant = {ant: np.mean([np.any([(ant, ap) in amx for ap in antpols])
                                     for amx in ant_metrics_xants_dict.values()]) for ant in ants}
    average_dead_metrics = {ap: {ant: np.nanmean([dm.get((ant, ap), np.nan) for dm in ant_metrics_dead_metrics.values()]) 
                                 for ant in ants} for ap in antpols}
    average_crossed_metrics = {ant: np.nanmean([cm.get((ant, ap), np.nan) for ap in antpols 
                                                for cm in ant_metrics_crossed_metrics.values()]) for ant in ants}
else:
    dead_cut = 0.4
    crossed_cut = 0.0

Summarize redcal chi^2 metrics¶

In [13]:
if use_redcal:
    cspa = {ant: np.nanmedian(np.hstack([cspa_med_dict[cal][ant] for cal in redcal_files])) for ant in antpol_pairs}
    redcal_prior_flag_frac = {ant: np.mean([np.any([afd[ant, ap] and not ant in flagged_by_redcal_dict[cal] for ap in antpols])
                                            for cal, afd in post_redcal_ant_flags_dict.items()]) for ant in ants}
    redcal_flagged_frac = {ant: np.mean([ant in fbr for fbr in flagged_by_redcal_dict.values()]) for ant in ants}

Get FEM switch states¶

In [14]:
HHautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.sum.autos.uvh5"))
diffautos = sorted(glob.glob(f"{data_path}/zen.{JD}.*.diff.autos.uvh5"))

try:
    db = mc.connect_to_mc_db(None)
    session = db.sessionmaker()
    startJD = float(HHautos[0].split('zen.')[1].split('.sum')[0])
    stopJD = float(HHautos[-1].split('zen.')[1].split('.sum')[0])
    start_time = Time(startJD,format='jd')
    stop_time = Time(stopJD,format='jd')

    # get initial state by looking for commands up to 3 hours before the starttime
    # this logic can be improved after an upcoming hera_mc PR
    # which will return the most recent command before a particular time.
    search_start_time = start_time - TimeDelta(3*3600, format="sec")
    initial_command_res = session.get_array_signal_source(starttime=search_start_time, stoptime=start_time)
    if len(initial_command_res) == 0:
        initial_source = "Unknown"
    elif len(command_res) == 1:
        initial_source = initial_command_res[0].source
    else:
        # multiple commands
        times = []
        sources = []
        for obj in command_res:
            times.append(obj.time)
            sources.append(obj.source)
        initial_source = sources[np.argmax(times)]
    
    # check for any changes during observing
    command_res = session.get_array_signal_source(starttime=start_time, stoptime=stop_time)
    if len(command_res) == 0:
        # still nothing, set it to None
        obs_source = None
    else:
        obs_source_times = []
        obs_source = []
        for obj in command_res:
            obs_source_times.append(obj.time)
            obs_source.append(obj.source)

    if obs_source is not None:
        command_source = [initial_source] + obs_source
    else:
        command_source = initial_source
    
    res = session.get_antenna_status(starttime=startTime, stoptime=stopTime)
    fem_switches = {}
    right_rep_ant = []
    if len(res) > 0:
        for obj in res:
            if obj.antenna_number not in fem_switches.keys():
                fem_switches[obj.antenna_number] = {}
            fem_switches[obj.antenna_number][obj.antenna_feed_pol] = obj.fem_switch
        for ant, pol_dict in fem_switches.items():
            if pol_dict['e'] == initial_source and pol_dict['n'] == initial_source:
                right_rep_ant.append(ant)
except Exception as e:
    print(e)
    initial_source = None
    command_source = None
    right_rep_ant = []
name 'startTime' is not defined

Find X-engine Failures¶

In [15]:
read_inds = [1, len(HHautos)//2, -2]
x_status = [1,1,1,1,1,1,1,1]
s = UVData()
s.read(HHautos[1])

nants = len(s.get_ants())
freqs = s.freq_array[0]*1e-6
nfreqs = len(freqs)

antCon = {a: None for a in ants}
rightAnts = []
for i in read_inds:
    s = UVData()
    d = UVData()
    s.read(HHautos[i])
    d.read(diffautos[i])
    for pol in [0,1]:
        sm = np.abs(s.data_array[:,0,:,pol])
        df = np.abs(d.data_array[:,0,:,pol])
        sm = np.r_[sm, np.nan + np.zeros((-len(sm) % nants,len(freqs)))]
        sm = np.nanmean(sm.reshape(-1,nants,nfreqs),axis=1)
        df = np.r_[df, np.nan + np.zeros((-len(df) % nants,len(freqs)))]
        df = np.nanmean(df.reshape(-1,nants,nfreqs),axis=1)

        evens = (sm + df)/2
        odds = (sm - df)/2
        rat = np.divide(evens,odds)
        rat = np.nan_to_num(rat)
        for xbox in range(0,8):
            xavg = np.nanmean(rat[:,xbox*192:(xbox+1)*192],axis=1)
            if np.nanmax(xavg)>1.5 or np.nanmin(xavg)<0.5:
                x_status[xbox] = 0
    for ant in ants:
        for pol in ["xx", "yy"]:
            if antCon[ant] is False:
                continue
            spectrum = s.get_data(ant, ant, pol)
            stdev = np.std(spectrum)
            med = np.median(np.abs(spectrum))
            if (initial_source == 'digital_noise_same' or initial_source == 'digital_noise_different') and med < 10:
                antCon[ant] = True
            elif (initial_source == "load" or initial_source == 'noise') and 80000 < stdev <= 4000000 and antCon[ant] is not False:
                antCon[ant] = True
            elif initial_source == "antenna" and stdev > 500000 and med > 950000 and antCon[ant] is not False:
                antCon[ant] = True
            else:
                antCon[ant] = False
            if np.min(np.abs(spectrum)) < 100000:
                antCon[ant] = False
for ant in ants:
    if antCon[ant] is True:
        rightAnts.append(ant)
            
x_status_str = ''
for i,x in enumerate(x_status):
    if x==0:
        x_status_str += '\u274C '
    else:
        x_status_str += '\u2705 '

Build Overall Health DataFrame¶

In [16]:
def comma_sep_paragraph(vals, chars_per_line=40):
    outstrs = []
    for val in vals:
        if (len(outstrs) == 0) or (len(outstrs[-1]) > chars_per_line):
            outstrs.append(str(val))
        else:
            outstrs[-1] += ', ' + str(val)
    return ',<br>'.join(outstrs)
In [17]:
# Time data
to_show = {'JD': [JD]}
to_show['Date'] = f'{utc.month}-{utc.day}-{utc.year}'
to_show['LST Range'] = f'{hd.lsts[0] * 12 / np.pi:.3f} -- {hd_last.lsts[-1] * 12 / np.pi:.3f} hours'

# X-engine status
to_show['X-Engine Status'] = x_status_str

# Files
to_show['Number of Files'] = len(data_files)

# Antenna Calculations
to_show['Total Number of Antennas'] = len(ants)

to_show[' '] = ''
to_show['OPERATIONAL STATUS SUMMARY'] = ''

status_count = {status: 0 for status in status_colors}
for ant, status in a_priori_statuses.items():
    if status in status_count:
        status_count[status] = status_count[status] + 1
    else:
        status_count[status] = 1
to_show['Antenna A Priori Status Count'] = '<br>'.join([f'{status}: {status_count[status]}' for status in status_colors if status in status_count and status_count[status] > 0])

to_show['Commanded Signal Source'] = ', '.join(command_source if hasattr(command_source, '__iter__') else [str(command_source)])
to_show['Antennas in Commanded State (reported)'] = f'{len(right_rep_ant)} / {len(ants)} ({len(right_rep_ant) / len(ants):.1%})'
to_show['Antennas in Commanded State (observed)'] = f'{len(rightAnts)} / {len(ants)} ({len(rightAnts) / len(ants):.1%})'

if use_ant_metrics:
    to_show['Cross-Polarized Antennas'] = ', '.join([str(ant) for ant in ants if (np.max([dead_ant_frac[ap][ant] for ap in antpols]) + crossed_ant_frac[ant] == 1) 
                                                                                 and (crossed_ant_frac[ant] > .5)])

# Node calculations
nodes_used = set([nodes[ant] for ant in ants if np.isfinite(nodes[ant])])
to_show['Total Number of Nodes'] = len(nodes_used)
if use_ant_metrics:
    node_off = {node: True for node in nodes_used}
    not_correlating = {node: True for node in nodes_used}
    for ant in ants:
        for ap in antpols:
            if np.isfinite(nodes[ant]):
                if np.isfinite(average_dead_metrics[ap][ant]):
                    node_off[nodes[ant]] = False
                if dead_ant_frac[ap][ant] < 1:
                    not_correlating[nodes[ant]] = False
    to_show['Nodes Registering 0s'] = ', '.join([f'N{n:02}' for n in sorted([node for node in node_off if node_off[node]])])
    to_show['Nodes Not Correlating'] = ', '.join([f'N{n:02}' for n in sorted([node for node in not_correlating if not_correlating[node] and not node_off[node]])])

# Pipeline calculations    
to_show['  '] = ''
to_show['NIGHTLY ANALYSIS SUMMARY'] = ''
    
all_flagged_ants = []
if use_ant_metrics:
    to_show['Ant Metrics Done?'] = '\u2705'
    ant_metrics_flagged_ants = [ant for ant in ants if ant_metrics_xants_frac_by_ant[ant] > 0]
    all_flagged_ants.extend(ant_metrics_flagged_ants)
    to_show['Ant Metrics Flagged Antennas'] = f'{len(ant_metrics_flagged_ants)} / {len(ants)} ({len(ant_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Ant Metrics Done?'] = '\u274C'
if use_auto_metrics:
    to_show['Auto Metrics Done?'] = '\u2705'
    auto_metrics_flagged_ants = [ant for ant in ants if ant in auto_ex_ants]
    all_flagged_ants.extend(auto_metrics_flagged_ants)    
    to_show['Auto Metrics Flagged Antennas'] = f'{len(auto_metrics_flagged_ants)} / {len(ants)} ({len(auto_metrics_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Auto Metrics Done?'] = '\u274C'
if use_redcal:
    to_show['Redcal Done?'] = '\u2705'    
    redcal_flagged_ants = [ant for ant in ants if redcal_flagged_frac[ant] > 0]
    all_flagged_ants.extend(redcal_flagged_ants)    
    to_show['Redcal Flagged Antennas'] = f'{len(redcal_flagged_ants)} / {len(ants)} ({len(redcal_flagged_ants) / len(ants):.1%})' 
else:
    to_show['Redcal Done?'] = '\u274C' 
to_show['Never Flagged Antennas'] = f'{len(ants) - len(set(all_flagged_ants))} / {len(ants)} ({(len(ants) - len(set(all_flagged_ants))) / len(ants):.1%})'

# Count bad antennas with good statuses and vice versa
n_apriori_good = len([ant for ant in ants if a_priori_statuses[ant] in good_statuses.split(',')])
apriori_good_flagged = []
aprior_bad_unflagged = []
for ant in ants:
    if ant in set(all_flagged_ants) and a_priori_statuses[ant] in good_statuses.split(','):
        apriori_good_flagged.append(ant)
    elif ant not in set(all_flagged_ants) and a_priori_statuses[ant] not in good_statuses.split(','):
        aprior_bad_unflagged.append(ant)
to_show['A Priori Good Antennas Flagged'] = f'{len(apriori_good_flagged)} / {n_apriori_good} total a priori good antennas:<br>' + \
                                            comma_sep_paragraph(apriori_good_flagged)
to_show['A Priori Bad Antennas Not Flagged'] = f'{len(aprior_bad_unflagged)} / {len(ants) - n_apriori_good} total a priori bad antennas:<br>' + \
                                            comma_sep_paragraph(aprior_bad_unflagged)

# Apply Styling
df = pd.DataFrame(to_show)
divider_cols = [df.columns.get_loc(col) for col in ['NIGHTLY ANALYSIS SUMMARY', 'OPERATIONAL STATUS SUMMARY']]
try:
    to_red_columns = [df.columns.get_loc(col) for col in ['Cross-Polarized Antennas', 'Nodes Registering 0s', 
                                                          'Nodes Not Correlating', 'A Priori Good Antennas Flagged']]
except:
    to_red_columns = []
def red_specific_cells(x):
    df1 = pd.DataFrame('', index=x.index, columns=x.columns)
    for col in to_red_columns:
        df1.iloc[col] = 'color: red'
    return df1

df = df.T
table = df.style.hide_columns().apply(red_specific_cells, axis=None)
for col in divider_cols:
    table = table.set_table_styles([{"selector":f"tr:nth-child({col+1})", "props": [("background-color", "black"), ("color", "white")]}], overwrite=False)

Table 1: Overall Array Health¶

In [18]:
HTML(table.render())
Out[18]:
JD 2460134
Date 7-8-2023
LST Range 18.642 -- 20.577 hours
X-Engine Status ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
Number of Files 360
Total Number of Antennas 205
OPERATIONAL STATUS SUMMARY
Antenna A Priori Status Count dish_maintenance: 9
RF_maintenance: 62
RF_ok: 18
digital_maintenance: 3
digital_ok: 83
not_connected: 30
Commanded Signal Source None
Antennas in Commanded State (reported) 0 / 205 (0.0%)
Antennas in Commanded State (observed) 0 / 205 (0.0%)
Cross-Polarized Antennas
Total Number of Nodes 19
Nodes Registering 0s N05, N09, N14, N18, N19
Nodes Not Correlating
NIGHTLY ANALYSIS SUMMARY
Ant Metrics Done? ✅
Ant Metrics Flagged Antennas 82 / 205 (40.0%)
Auto Metrics Done? ✅
Auto Metrics Flagged Antennas 117 / 205 (57.1%)
Redcal Done? ❌
Never Flagged Antennas 88 / 205 (42.9%)
A Priori Good Antennas Flagged 36 / 83 total a priori good antennas:
7, 15, 17, 37, 38, 40, 42, 44, 45, 51, 53,
86, 88, 91, 105, 106, 107, 112, 121, 140, 141,
144, 145, 146, 151, 153, 158, 161, 163, 164,
165, 183, 186, 187, 202, 325
A Priori Bad Antennas Not Flagged 41 / 122 total a priori bad antennas:
8, 16, 22, 35, 36, 48, 49, 50, 52, 57, 63,
64, 68, 79, 80, 84, 95, 97, 102, 113, 114,
115, 127, 132, 133, 134, 135, 139, 155, 156,
175, 179, 195, 244, 245, 261, 324, 332, 333,
336, 340
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_2460134.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 0.00% 0.00% 0.00% 0.00% -0.334074 -0.441556 0.059816 -0.850802 0.513580 -0.227902 0.137266 -0.330922 0.815990 0.523218 0.606997
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -1.637083 13.390374 -1.398176 -0.820064 -1.373669 -0.868249 -0.919598 -0.107416 0.813872 0.398195 0.591308
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.328950 0.596324 -0.162619 2.565298 0.597339 1.248961 -0.102914 0.807653 0.822343 0.519906 0.603818
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -1.289213 -0.394079 -1.186329 -0.457043 -0.223381 1.147116 1.502281 12.196475 0.816584 0.535099 0.588613
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.402446 1.973832 0.857628 0.912378 0.057144 0.111660 -1.811154 -1.295907 0.801571 0.498742 0.591607
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.528578 0.330359 2.928596 0.340936 0.719423 0.255317 1.268269 0.145712 0.814172 0.533607 0.597639
10 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -1.097998 -1.372939 -1.310053 -1.173832 -1.123482 -0.452898 0.484287 -0.079697 0.812211 0.516341 0.600253
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 12.077129 -0.430981 0.265781 -0.531628 -0.843870 -0.210662 0.421717 1.296588 0.685721 0.535149 0.460446
16 N01 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.183276 -0.619206 -0.924881 -0.980251 -1.738776 -1.685920 -1.214064 -1.038793 0.819302 0.542405 0.590846
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.731785 2.682487 1.219081 3.399735 1.000892 1.001798 0.366779 6.907749 0.821871 0.520289 0.599033
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.199824 6.794601 0.480746 1.575417 0.671353 -0.474247 10.229066 30.411976 0.746376 0.293556 0.622106
19 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.678202 0.059210 -0.650675 -0.162499 -0.773229 -0.900470 0.078044 -1.236738 0.822317 0.538844 0.591212
20 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.045582 -0.221424 -0.147401 0.658361 -0.170460 0.441713 1.488636 0.481583 0.817858 0.544600 0.583023
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% -0.242143 -0.116574 -0.548634 -0.130388 0.148988 0.673895 -0.193312 0.084148 0.818881 0.530328 0.596005
22 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.476292 -1.173427 1.091929 -0.569812 -0.444598 -0.987473 0.276959 -0.298219 0.779740 0.493815 0.589794
27 N01 RF_ok 100.00% 100.00% 100.00% 0.00% 13.525450 16.486106 9.615649 3.692429 1.271028 0.652485 5.030687 24.151372 0.046587 0.173703 0.126017
28 N01 RF_ok 100.00% 0.00% 35.56% 0.00% -0.487003 12.747483 0.307075 4.641084 0.121647 -0.805130 0.198580 9.096660 0.821663 0.205905 0.725621
29 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 7.764971 8.993354 10.318473 10.577592 1.390593 1.193266 2.909291 1.924314 0.032090 0.039685 0.008536
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.088615 -1.460710 -0.192237 -1.239493 -1.396322 -0.713533 1.452474 0.118113 0.812978 0.549502 0.580470
31 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.071395 0.734545 -0.073525 1.984631 0.225367 0.945659 0.629512 0.811265 0.822132 0.548997 0.586871
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 18.595504 -0.663501 0.091787 -0.671066 -0.620255 -0.781384 3.698825 2.358873 0.737971 0.548826 0.484562
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 8.796547 -0.389897 6.000999 -0.739439 1.382308 -1.605817 1.126787 -0.594424 0.042370 0.515148 0.379195
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.535337 -1.161409 -0.574775 -1.455218 -1.722359 -1.260409 -1.327792 -0.770393 0.808435 0.510267 0.602103
36 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.341246 3.054454 0.579702 0.288617 1.263604 0.556307 0.459078 0.524557 0.816362 0.519892 0.598761
37 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 7.810111 7.099502 4.336101 5.673790 1.121791 0.979989 0.882877 12.883573 0.821520 0.525008 0.597740
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% -0.667321 -0.215086 -0.526788 0.698649 0.108143 0.742388 2.310818 4.246784 0.822802 0.538692 0.593491
40 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.207850 1.087944 0.634103 0.662119 0.461975 0.436160 2.734264 28.972243 0.823485 0.548953 0.586949
41 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.291445 0.962053 -0.121775 2.769772 0.279493 0.839254 -0.107981 0.594859 0.822227 0.544118 0.587073
42 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.561385 1.705552 -0.012966 5.089189 0.485182 0.587226 0.126767 1.368955 0.824570 0.534599 0.592871
43 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
44 N05 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
45 N05 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
46 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
47 N06 not_connected 100.00% 0.00% 100.00% 0.00% 7.772508 9.277258 5.782909 5.821787 1.105112 1.181963 1.931767 0.706555 0.269089 0.059691 0.209483
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.733935 0.003145 -1.247072 -0.359942 -1.496958 -1.331337 -0.982918 -1.280132 0.814477 0.518289 0.590038
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -1.201619 -0.779131 0.324888 -1.236851 -0.247139 -1.566668 0.659339 -0.774944 0.801497 0.506222 0.591153
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.082002 0.125469 -0.014980 0.359206 0.686613 0.680766 -0.112387 0.133404 0.821361 0.523913 0.602951
51 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 1.425129 0.508624 -0.580782 0.798033 0.630797 0.447836 66.879597 3.999307 0.816106 0.536620 0.582269
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.109817 2.012629 0.334743 -0.273126 0.901959 0.052152 2.266853 0.199234 0.826869 0.542164 0.584314
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.128459 0.267193 -0.369469 -0.381295 0.038983 -0.067622 5.008191 0.631796 0.827362 0.557960 0.577476
54 N04 dish_maintenance 100.00% 0.00% 0.00% 0.00% 9.528404 3.584024 1.660790 2.941147 0.195275 0.068022 1.413689 0.871109 0.376707 0.399180 0.172248
55 N04 RF_maintenance 100.00% 100.00% 0.00% 0.00% 32.343634 -1.572721 7.351841 -1.453437 1.410659 -0.899708 0.596272 1.911096 0.040781 0.537657 0.395616
56 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.230046 0.725651 -0.680960 0.060289 0.377824 0.485645 -0.267913 2.285582 0.822368 0.550280 0.580011
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.732711 0.327221 -0.086552 -0.111104 0.226175 0.176179 0.394691 0.648491 0.821722 0.555177 0.585806
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
59 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
60 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 8.608397 -1.109436 5.663995 -1.013774 1.381202 -0.817062 0.352012 1.372881 0.034311 0.528471 0.391186
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% -0.544590 0.327291 1.311983 -0.250239 -1.116806 -1.193142 1.171318 -1.263809 0.787404 0.525066 0.559875
63 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.720194 3.012184 -1.300388 1.536042 -1.377883 0.762975 0.000780 -1.987381 0.818532 0.487184 0.597030
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.709144 -1.154687 -1.517376 -0.476551 -1.266665 -0.639194 -0.648297 0.218625 0.809186 0.508902 0.584741
65 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.292013 -0.600312 0.221313 -0.904495 0.475747 -0.379905 -0.000780 -0.041245 0.819205 0.519274 0.609235
66 N03 digital_ok 0.00% 0.00% 0.00% 0.00% 0.824562 0.096252 0.032001 0.519611 0.200291 0.686946 -0.144328 0.728852 0.804803 0.534573 0.577029
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.678109 -0.302926 -0.555600 0.733663 0.330392 0.691872 2.460667 0.661405 0.820023 0.550436 0.574734
68 N03 RF_ok 0.00% 0.00% 0.00% 0.00% 0.723025 -0.185435 0.986125 0.638970 0.877734 0.868182 0.311328 1.521834 0.825951 0.551784 0.575854
69 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.464203 -0.395834 0.360036 -0.127718 0.973387 0.434347 1.900003 0.423939 0.828098 0.556859 0.578117
70 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 0.458002 0.143912 1.543882 0.437182 1.256975 0.575669 0.512378 1.797449 0.816964 0.559915 0.569630
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.754284 -0.154653 -0.885735 0.055697 -0.178024 0.512363 -0.450519 0.475676 0.823137 0.556443 0.579649
72 N04 digital_ok 0.00% 0.00% 0.00% 0.00% -0.017729 0.399557 -0.311048 0.153492 -0.130802 0.319912 0.135746 -0.001988 0.821863 0.559788 0.587826
73 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
74 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 7.886477 0.172943 -1.106578 -1.062931 -0.789637 -1.689561 2.595905 -0.534624 0.742352 0.527827 0.505999
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 12.679062 0.066572 -0.357873 -0.186054 -1.096706 -1.195242 3.892295 -0.882690 0.661244 0.536094 0.401779
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.157619 -1.181425 0.237771 -1.486009 -0.123071 -1.058372 0.674258 -0.512343 0.809843 0.535218 0.571759
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.547061 1.655366 -0.962358 0.744949 -1.800595 -0.079512 -1.042136 -1.750933 0.810246 0.499513 0.591531
84 N08 RF_ok 0.00% 0.00% 0.00% 0.00% 0.437131 1.686278 0.409363 0.844117 -0.498559 0.001053 -1.757562 -1.630465 0.809222 0.514644 0.567642
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.766523 -0.876724 -1.214972 -0.809749 -1.382072 -0.415231 -1.066331 -0.224408 0.823435 0.556117 0.568806
86 N08 digital_ok 100.00% 100.00% 0.00% 0.00% 7.796151 0.043361 9.234530 0.044838 1.382223 -0.029675 0.377099 11.834229 0.048112 0.553036 0.376782
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 19.957646 2.264763 2.435223 -1.156767 -0.584839 -0.744253 0.694713 -0.222136 0.701087 0.558092 0.431428
88 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
89 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
90 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
91 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
92 N10 RF_maintenance 100.00% 100.00% 100.00% 0.00% 7.646288 8.759420 10.585710 10.871426 1.390616 1.200140 2.269917 2.278772 0.027555 0.034046 0.004081
93 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.041990 9.229595 -0.005695 10.992979 -0.807355 1.135924 -0.945909 2.864477 0.258670 0.055822 -0.051703
94 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.174063 0.954274 0.434281 5.205155 0.890298 0.248416 0.513685 1.035700 0.832067 0.525663 0.584687
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.002783 -0.670873 -0.855732 -0.799937 -0.675087 -1.699239 0.631572 -0.674723 0.802853 0.542097 0.558786
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% 0.244753 12.289186 -0.125007 -0.448525 -1.055379 -1.011771 -1.399133 1.796971 0.815789 0.423256 0.558093
97 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.572906 0.232881 -1.519955 -0.145272 -1.202551 -0.652867 -0.752648 2.780670 0.809080 0.511132 0.584014
101 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 3.133825 3.431635 -0.259943 0.515742 0.017675 0.428806 -0.153955 0.664844 0.822611 0.538018 0.583863
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.412741 -0.090912 -1.480029 -0.824878 -0.907844 -0.269722 -0.746518 3.897613 0.828013 0.544651 0.577689
103 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.079086 2.315184 -1.370174 -0.009945 -1.528606 0.459671 -0.313495 1.194721 0.820023 0.551772 0.564107
104 N08 dish_maintenance 100.00% 0.00% 0.00% 0.00% 3.168163 33.140685 3.799588 5.766534 -0.000948 0.611896 1.110947 1.016382 0.819791 0.533546 0.591428
105 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
106 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
107 N09 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
108 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
109 N10 RF_maintenance 100.00% 0.00% 100.00% 0.00% 4.986015 8.986199 -1.235337 10.751873 0.005748 1.193453 -0.382867 1.708397 0.446087 0.041488 0.324072
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.446635 -0.507409 -0.676494 -0.611660 -1.142163 -0.383109 -1.193312 -0.308590 0.732191 0.557316 0.455974
111 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 7.267502 1.043569 0.714953 0.831558 0.910515 0.454687 14.360763 0.616646 0.779072 0.561449 0.525838
112 N10 digital_ok 100.00% 0.00% 0.00% 0.00% 3.387427 -0.508688 8.849301 -0.577083 -1.333567 -1.619781 0.484243 -1.203755 0.685217 0.555744 0.475174
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.358862 2.854537 1.372466 1.435512 0.647837 0.629608 -2.086643 -2.032432 0.795806 0.510733 0.568113
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.129374 -0.622192 1.138797 -1.484226 0.380116 -0.960532 -1.975160 -0.537497 0.796086 0.537117 0.563543
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.598602 -0.905756 -1.139053 -0.892828 -1.028388 -1.696978 -0.422841 -1.013771 0.806434 0.521764 0.581567
120 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 2.968693 -0.081969 1.999388 -0.129845 1.223540 0.661217 8.243410 6.098502 0.814117 0.533409 0.568385
121 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 1.294453 1.484334 0.573871 5.365906 -0.283827 0.414308 -1.399320 6.762571 0.808046 0.528609 0.567466
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.090126 1.730046 -0.429340 -1.312404 0.093963 -0.831755 -0.112935 -0.593241 0.821115 0.550167 0.575420
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 1.780621 0.652685 1.186518 0.009945 0.455420 -0.905612 -1.754306 -1.430751 0.801781 0.532228 0.581313
124 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
125 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
126 N09 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
127 N10 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.138293 0.069493 1.536699 -0.067317 0.972541 0.378797 0.708792 1.156060 0.818809 0.553279 0.588086
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.206622 -0.393753 0.161877 -0.579551 0.544622 -0.083147 1.331304 1.737802 0.826448 0.558256 0.580808
131 N11 not_connected 100.00% 0.00% 48.89% 0.00% -1.289270 8.571936 -1.123934 6.113065 -1.611413 0.591738 -0.966802 0.739585 0.813317 0.209254 0.638761
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.348749 -1.169964 -1.300015 -1.219473 -1.653282 -0.537499 0.482683 -0.274748 0.816341 0.544270 0.568073
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.187334 -1.242828 -1.267061 -1.413992 -1.045957 -1.392707 -0.635613 -0.422352 0.811990 0.537072 0.576766
134 N11 not_connected 0.00% 0.00% 0.00% 0.00% 0.403392 1.915516 2.093050 0.839356 -0.456260 -0.082158 2.043700 -1.871595 0.765536 0.500185 0.572997
135 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.121564 0.002988 -1.133218 0.672971 -1.488550 0.580504 -0.501575 0.822378 0.797362 0.483782 0.601936
136 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.977630 5.375342 -1.485195 0.447215 -0.753167 0.570058 -0.669570 2.133805 0.810305 0.473606 0.600573
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.255307 -0.934573 -0.279797 -1.317119 -1.452552 -1.031405 -1.294976 0.419481 0.805951 0.505036 0.580007
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 5.026544 -0.018644 0.148406 0.260415 1.789225 0.883851 52.190975 11.464331 0.787909 0.528719 0.546938
141 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 8.047001 -0.093446 10.562926 0.270659 1.378139 0.711197 0.862699 0.263648 0.060802 0.532415 0.436042
142 N13 RF_ok 100.00% 0.00% 0.00% 0.00% -0.430658 -0.019781 -0.064348 -0.284660 0.677893 0.332573 7.663368 2.715183 0.816559 0.535123 0.585555
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
144 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
145 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
146 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
147 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.746751 -0.184571 1.875661 0.641412 0.845362 0.655362 0.424100 0.479311 0.823959 0.550204 0.587667
148 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.254379 -0.026183 -0.109729 0.344755 0.419304 0.509654 -0.179878 0.401467 0.827554 0.552151 0.583223
149 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.231736 -0.165818 0.803459 -0.086128 1.462634 0.189720 1.095340 -0.039715 0.826366 0.561083 0.575062
150 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.201306 -0.233082 0.372617 0.033033 0.450161 0.189623 1.413452 0.635035 0.829210 0.562238 0.572368
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 8.704160 -0.765193 -1.092288 0.518240 -0.872808 -0.104361 -0.303527 4.544671 0.693405 0.538750 0.438957
152 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.156338 -1.234644 -1.132781 -1.106187 -1.085911 -0.932257 1.259646 -0.361274 0.817642 0.533972 0.577389
153 N16 digital_ok 100.00% 100.00% 0.00% 0.00% 7.912169 -0.723739 5.776903 -0.937974 1.386668 -0.859551 1.010699 -0.234566 0.042808 0.531922 0.372557
154 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -1.084301 -1.310188 -0.988343 -1.517131 -1.667089 -1.272909 -1.126344 -0.701213 0.805057 0.509452 0.595421
155 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.371258 -1.589508 0.312396 -1.182970 -0.814545 -0.974606 -1.728212 -0.270996 0.807520 0.480285 0.624830
156 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.961152 0.001072 3.196382 0.391878 1.023046 0.554054 2.860449 0.379712 0.806863 0.492734 0.607615
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.384380 0.000127 0.038907 0.285215 0.545871 0.161197 0.034136 0.055764 0.811824 0.504043 0.600964
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.079038 -0.432664 -0.279816 -0.079967 0.671332 0.330136 1.533636 8.912912 0.818235 0.507742 0.601662
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.157060 7.614560 0.524571 -0.232069 -0.114851 -0.141401 0.185813 1.676619 0.790964 0.397258 0.585770
160 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.067141 0.160159 0.632201 4.438928 -0.260584 0.691727 -1.854078 5.236058 0.805232 0.501655 0.592217
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% -0.145559 18.250278 0.269341 -0.107543 0.701381 -0.616424 0.082111 -0.058085 0.814945 0.403000 0.573018
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -1.193821 -0.102663 -1.180701 0.091392 -0.560719 0.190693 1.264840 0.705310 0.818883 0.530444 0.600301
163 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
164 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
165 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
166 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
167 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.065371 0.463433 0.223162 0.539695 0.690840 0.769394 0.264709 1.250780 0.818438 0.542378 0.597877
168 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.659405 -0.304106 0.327280 0.063342 0.599430 0.201388 0.092208 0.822043 0.821737 0.549876 0.586100
169 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.243768 -0.608406 0.262743 -0.350006 0.576394 -0.032818 -0.036795 0.071727 0.828259 0.550722 0.581045
170 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 1.163600 0.552428 2.013471 0.642247 1.343140 0.772095 2.266204 0.158688 0.822215 0.555338 0.575885
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.937385 -0.744764 0.301674 0.171906 -0.218581 -0.298093 0.063916 0.324796 0.801544 0.522207 0.562746
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.609314 -0.387704 -0.767325 -0.513181 -1.779293 -0.259666 -1.036855 0.125981 0.815204 0.527266 0.583103
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.215848 2.771658 1.301633 1.385242 0.614633 0.598363 -2.058301 -1.992920 0.791180 0.495308 0.588919
174 N16 digital_maintenance 100.00% 100.00% 100.00% 0.00% 8.847137 9.761103 5.707017 5.833830 1.382233 1.192843 0.934882 0.567295 0.030741 0.030789 0.001449
175 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.340824 2.623082 0.639257 1.092415 -0.238840 0.213282 -1.639122 -1.018170 0.792189 0.461828 0.617983
179 N12 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.314040 0.269456 1.149752 0.976202 0.848501 1.026746 0.272339 0.565506 0.806376 0.503536 0.599170
180 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.464573 6.768904 0.860452 0.063300 0.884687 -0.335043 12.475384 -1.138375 0.811899 0.444574 0.590350
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 0.773999 0.581578 0.441174 0.561016 0.880140 -0.890830 0.062478 1.967256 0.817016 0.513078 0.601181
182 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.654529 8.832851 -0.546265 10.769872 -1.617033 1.188913 -1.232561 2.274894 0.811366 0.048413 0.704704
183 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.681815 9.497208 0.014909 10.853610 0.192010 1.198386 0.160055 2.148524 0.797100 0.040182 0.675801
184 N14 dish_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
185 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
186 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
187 N14 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
189 N15 digital_ok 0.00% 0.00% 0.00% 0.00% 0.788992 1.902398 0.514596 0.896709 -0.364022 0.086201 -1.795245 -1.675419 0.795456 0.488967 0.589485
190 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.269799 -0.482459 0.094814 -0.232215 0.391336 -0.001053 0.345943 -0.070666 0.822035 0.544678 0.581337
191 N15 digital_ok 0.00% 0.00% 0.00% 0.00% -0.260985 0.014447 0.513265 1.058695 1.355516 0.739963 3.695193 0.388135 0.821867 0.539171 0.583844
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.586258 3.151406 1.526717 1.601246 0.858555 0.807200 -2.070641 -2.010341 0.782265 0.480010 0.577749
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.589897 2.551681 1.529581 1.270617 0.833792 0.475150 -2.107256 -2.017742 0.781145 0.483193 0.583705
194 N16 digital_maintenance 100.00% 100.00% 0.00% 0.00% 7.897303 -1.521754 5.682796 -1.484992 1.382944 -1.375714 0.515514 -0.679120 0.036095 0.510298 0.414465
195 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.645828 0.009312 0.761399 -0.520318 -0.154346 -1.536560 -1.868536 -1.209225 0.787952 0.492263 0.607934
200 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
201 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
204 N19 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_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
208 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 3.770272 4.906938 6.092001 10.616355 0.748582 0.719627 1.293410 35.620263 0.793239 0.037670 0.703154
209 N20 dish_maintenance 100.00% 100.00% 100.00% 0.00% 3.231481 3.958880 9.905685 10.398244 1.359768 1.212588 11.477945 18.015990 0.031371 0.033202 0.001306
210 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.662610 5.502852 -0.040584 0.210802 0.318124 0.252498 0.176608 0.280706 0.821790 0.517428 0.592109
211 N20 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.443260 8.925090 -0.415935 6.235060 -0.311239 1.197094 0.393333 2.234129 0.801034 0.038696 0.702006
213 N16 digital_maintenance 100.00% 0.00% 100.00% 0.00% 2.228351 9.844152 1.290742 5.950153 0.602240 1.085201 4.102735 1.406426 0.784400 0.089370 0.710790
214 N21 not_connected 100.00% 100.00% 0.00% 0.00% 8.371647 0.055355 5.819402 -1.336688 1.384522 -0.709771 0.867313 -0.391434 0.044942 0.481052 0.411369
220 N18 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
221 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
222 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
223 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
224 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
225 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
226 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
227 N20 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
228 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
229 N20 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
237 N18 RF_ok 100.00% 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% nan nan inf inf nan nan nan nan nan nan nan
239 N18 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
240 N19 RF_maintenance 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
241 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
242 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
243 N19 RF_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -1.320733 -0.266007 -0.384369 0.712138 -0.137331 0.014885 0.516961 1.763286 0.796788 0.463174 0.609939
245 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.459227 -0.788741 -0.707130 -1.342194 -1.714394 -1.041390 -1.162430 2.239560 0.810601 0.485299 0.611040
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% 1.779715 9.124398 3.027150 5.865514 -1.251006 1.194772 1.122415 1.442999 0.728682 0.036866 0.636386
261 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.421000 -0.792454 -0.654477 -1.222789 -1.796992 -1.408161 -1.048347 -0.908620 0.801738 0.472163 0.612057
262 N20 RF_maintenance 100.00% 0.00% 0.00% 0.00% 4.614102 7.282666 -0.015668 0.255319 0.592971 0.876785 0.427367 0.844416 0.806506 0.482980 0.616535
320 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.799791 -0.702957 -1.433457 -1.505711 -0.740551 -1.343256 -0.549452 -0.346310 0.783111 0.398650 0.638844
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.805431 1.180645 -0.235383 -0.089131 -1.234788 -1.004705 -0.365236 -1.212633 0.774337 0.382234 0.626392
325 N09 digital_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% 100.00% 100.00% 0.00% 8.663843 9.010490 5.793889 6.275483 1.384164 1.195453 1.261321 1.831280 0.039240 0.037428 0.002482
332 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.265246 0.379921 0.304196 -0.567645 -0.765657 -1.546940 -0.877599 -0.459437 0.759302 0.397760 0.626151
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% -0.419371 -0.000127 0.676011 -0.723551 0.215235 -0.355707 0.559892 0.285612 0.743640 0.377144 0.611370
336 N21 not_connected 0.00% 0.00% 0.00% 0.00% 1.371905 1.088899 -0.401963 -0.409203 -1.449567 -1.405825 2.633192 -1.019558 0.753304 0.365570 0.622865
340 N21 not_connected 0.00% 0.00% 0.00% 0.00% 2.487862 2.215651 1.230848 0.772847 0.438751 -0.145473 -2.016807 -1.835425 0.733912 0.364158 0.604418
In [22]:
# print ex_ants for easy copy-pasting to YAML file
proposed_ex_ants = [ant for i, ant in enumerate(ants) if np.any([col[i] > 0 for col in bar_cols.values()])]
print('ex_ants: [' + ", ".join(str(ant) for ant in proposed_ex_ants) + ']')
print(f'\nunflagged_ants: [{", ".join([str(ant) for ant in ants if ant not in proposed_ex_ants])}]')
# "golden" means no flags and good a priori status
golden_ants = ", ".join([str(ant) for ant in ants if ((ant not in proposed_ex_ants) and (a_priori_statuses[ant] in good_statuses.split(',')))])
print(f'\ngolden_ants: [{golden_ants}]')
ex_ants: [4, 7, 15, 17, 18, 27, 28, 29, 32, 34, 37, 38, 40, 42, 43, 44, 45, 46, 47, 51, 53, 54, 55, 58, 59, 60, 61, 73, 74, 77, 78, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96, 104, 105, 106, 107, 108, 109, 110, 111, 112, 120, 121, 124, 125, 126, 131, 136, 140, 141, 142, 143, 144, 145, 146, 151, 153, 158, 159, 160, 161, 163, 164, 165, 166, 174, 180, 182, 183, 184, 185, 186, 187, 194, 200, 201, 202, 204, 205, 206, 207, 208, 209, 210, 211, 213, 214, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 237, 238, 239, 240, 241, 242, 243, 246, 262, 325, 329]

unflagged_ants: [3, 5, 8, 9, 10, 16, 19, 20, 21, 22, 30, 31, 35, 36, 41, 48, 49, 50, 52, 56, 57, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 79, 80, 84, 85, 95, 97, 101, 102, 103, 113, 114, 115, 122, 123, 127, 128, 132, 133, 134, 135, 139, 147, 148, 149, 150, 152, 154, 155, 156, 157, 162, 167, 168, 169, 170, 171, 172, 173, 175, 179, 181, 189, 190, 191, 192, 193, 195, 244, 245, 261, 320, 324, 332, 333, 336, 340]

golden_ants: [3, 5, 9, 10, 19, 20, 21, 30, 31, 41, 56, 62, 65, 66, 67, 69, 70, 71, 72, 85, 101, 103, 122, 123, 128, 147, 148, 149, 150, 152, 154, 157, 162, 167, 168, 169, 170, 171, 172, 173, 181, 189, 190, 191, 192, 193, 320]
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_2460134.csv
In [24]:
# Load antenna positions
data_list = sorted(glob.glob(os.path.join(data_path, f'zen.{JD}.?????.sum.uvh5')))
hd = io.HERAData(data_list[len(data_list) // 2])

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Metadata¶

In [27]:
from hera_qm import __version__
print(__version__)
from hera_cal import __version__
print(__version__)
2.1.1.dev3+gb291d34
3.2.3.dev158+gd5cadd5
In [ ]: