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 = "2460067"
data_path = "/mnt/sn1/2460067"
ant_metrics_ext = ".ant_metrics.hdf5"
redcal_ext = ".known_good.omni.calfits"
nb_outdir = "/home/obs/src/H6C_Notebooks/_rtp_summary_"
good_statuses = "digital_ok,calibration_maintenance,calibration_triage,calibration_ok"
In [4]:
from astropy.time import Time, TimeDelta
utc = Time(JD, format='jd').datetime
print(f'Date: {utc.month}-{utc.day}-{utc.year}')
Date: 5-2-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/2460067/zen.2460067.42141.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 95 ant_metrics files matching glob /mnt/sn1/2460067/zen.2460067.?????.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/2460067/zen.2460067.?????.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])
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [9], line 24
     22 hd = io.HERAData(data_files[0])
     23 unused_ants = [ant for ant in hd.antpos if ant not in ants]    
---> 24 hd_last = io.HERAData(data_files[-1])

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/hera_cal/io.py:521, in HERAData.__init__(self, input_data, upsample, downsample, filetype, **read_kwargs)
    519 temp_paths = copy.deepcopy(self.filepaths)
    520 self.filepaths = self.filepaths[0]
--> 521 self.read(read_data=False, **read_kwargs)
    522 self.filepaths = temp_paths
    524 self._attach_metadata(**read_kwargs)

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/hera_cal/io.py:770, in HERAData.read(self, bls, polarizations, times, time_range, lsts, lst_range, frequencies, freq_chans, axis, read_data, return_data, run_check, check_extra, run_check_acceptability, **kwargs)
    768 try:
    769     if self.filetype in ['uvh5', 'uvfits']:
--> 770         super().read(self.filepaths, file_type=self.filetype, axis=axis, bls=bls, polarizations=polarizations,
    771                      times=times, time_range=time_range, lsts=lsts, lst_range=lst_range, frequencies=frequencies,
    772                      freq_chans=freq_chans, read_data=read_data, run_check=run_check, check_extra=check_extra,
    773                      run_check_acceptability=run_check_acceptability, **kwargs)
    774         self.use_future_array_shapes()
    775         if self.filetype == 'uvfits':

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/pyuvdata/uvdata/uvdata.py:13236, in UVData.read(self, filename, axis, file_type, read_data, skip_bad_files, background_lsts, ignore_name, use_future_array_shapes, allow_rephase, phase_center_radec, unphase_to_drift, phase_frame, phase_epoch, orig_phase_frame, phase_use_ant_pos, fix_old_proj, fix_use_ant_pos, make_multi_phase, antenna_nums, antenna_names, ant_str, bls, frequencies, freq_chans, times, time_range, lsts, lst_range, polarizations, blt_inds, phase_center_ids, keep_all_metadata, run_check, check_extra, run_check_acceptability, strict_uvw_antpos_check, check_autos, fix_autos, phase_type, projected, correct_lat_lon, calc_lst, use_model, data_column, pol_order, ignore_single_chan, raise_error, read_weights, allow_flex_pol, multidim_index, remove_flex_pol, data_array_dtype, use_aoflagger_flags, use_cotter_flags, remove_dig_gains, remove_coarse_band, correct_cable_len, correct_van_vleck, cheby_approx, flag_small_auto_ants, flag_small_sig_ants, propagate_coarse_flags, flag_init, edge_width, start_flag, end_flag, flag_dc_offset, remove_flagged_ants, phase_to_pointing_center, nsample_array_dtype, isource, irec, isb, corrchunk, pseudo_cont, rechunk)
  13217     self.read_ms(
  13218         filename,
  13219         data_column=data_column,
   (...)
  13232         use_future_array_shapes=use_future_array_shapes,
  13233     )
  13235 elif file_type == "uvh5":
> 13236     self.read_uvh5(
  13237         filename,
  13238         antenna_nums=antenna_nums,
  13239         antenna_names=antenna_names,
  13240         ant_str=ant_str,
  13241         bls=bls,
  13242         frequencies=frequencies,
  13243         freq_chans=freq_chans,
  13244         times=times,
  13245         time_range=time_range,
  13246         lsts=lsts,
  13247         lst_range=lst_range,
  13248         polarizations=polarizations,
  13249         blt_inds=blt_inds,
  13250         phase_center_ids=phase_center_ids,
  13251         read_data=read_data,
  13252         data_array_dtype=data_array_dtype,
  13253         keep_all_metadata=keep_all_metadata,
  13254         multidim_index=multidim_index,
  13255         remove_flex_pol=remove_flex_pol,
  13256         background_lsts=background_lsts,
  13257         run_check=run_check,
  13258         check_extra=check_extra,
  13259         run_check_acceptability=run_check_acceptability,
  13260         strict_uvw_antpos_check=strict_uvw_antpos_check,
  13261         fix_old_proj=fix_old_proj,
  13262         fix_use_ant_pos=fix_use_ant_pos,
  13263         check_autos=check_autos,
  13264         fix_autos=fix_autos,
  13265         use_future_array_shapes=use_future_array_shapes,
  13266     )
  13267     select = False
  13269 if select:

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/pyuvdata/uvdata/uvdata.py:12046, in UVData.read_uvh5(self, filename, antenna_nums, antenna_names, ant_str, bls, frequencies, freq_chans, times, time_range, lsts, lst_range, polarizations, blt_inds, phase_center_ids, keep_all_metadata, read_data, data_array_dtype, multidim_index, remove_flex_pol, background_lsts, run_check, check_extra, run_check_acceptability, strict_uvw_antpos_check, fix_old_proj, fix_use_ant_pos, check_autos, fix_autos, use_future_array_shapes)
  12039     raise ValueError(
  12040         "Reading multiple files from class specific "
  12041         "read functions is no longer supported. "
  12042         "Use the generic `uvdata.read` function instead."
  12043     )
  12045 uvh5_obj = uvh5.UVH5()
> 12046 uvh5_obj.read_uvh5(
  12047     filename,
  12048     antenna_nums=antenna_nums,
  12049     antenna_names=antenna_names,
  12050     ant_str=ant_str,
  12051     bls=bls,
  12052     frequencies=frequencies,
  12053     freq_chans=freq_chans,
  12054     times=times,
  12055     time_range=time_range,
  12056     lsts=lsts,
  12057     lst_range=lst_range,
  12058     polarizations=polarizations,
  12059     blt_inds=blt_inds,
  12060     phase_center_ids=phase_center_ids,
  12061     data_array_dtype=data_array_dtype,
  12062     keep_all_metadata=keep_all_metadata,
  12063     read_data=read_data,
  12064     multidim_index=multidim_index,
  12065     remove_flex_pol=remove_flex_pol,
  12066     background_lsts=background_lsts,
  12067     run_check=run_check,
  12068     check_extra=check_extra,
  12069     run_check_acceptability=run_check_acceptability,
  12070     strict_uvw_antpos_check=strict_uvw_antpos_check,
  12071     fix_old_proj=fix_old_proj,
  12072     fix_use_ant_pos=fix_use_ant_pos,
  12073     check_autos=check_autos,
  12074     fix_autos=fix_autos,
  12075     use_future_array_shapes=use_future_array_shapes,
  12076 )
  12077 self._convert_from_filetype(uvh5_obj)
  12078 del uvh5_obj

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/pyuvdata/uvdata/uvh5.py:1081, in UVH5.read_uvh5(self, filename, antenna_nums, antenna_names, ant_str, bls, frequencies, freq_chans, times, time_range, lsts, lst_range, polarizations, blt_inds, phase_center_ids, keep_all_metadata, read_data, data_array_dtype, multidim_index, remove_flex_pol, background_lsts, run_check, check_extra, run_check_acceptability, strict_uvw_antpos_check, fix_old_proj, fix_use_ant_pos, check_autos, fix_autos, use_future_array_shapes)
   1079 # check if object has all required UVParameters set
   1080 if run_check:
-> 1081     self.check(
   1082         check_extra=check_extra,
   1083         run_check_acceptability=run_check_acceptability,
   1084         strict_uvw_antpos_check=strict_uvw_antpos_check,
   1085         allow_flip_conj=True,
   1086         check_autos=check_autos,
   1087         fix_autos=fix_autos,
   1088     )
   1090 return

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/pyuvdata/uvdata/uvdata.py:3252, in UVData.check(self, check_extra, run_check_acceptability, check_freq_spacing, strict_uvw_antpos_check, allow_flip_conj, check_autos, fix_autos)
   3249 # Check internal consistency of numbers which don't explicitly correspond
   3250 # to the shape of another array.
   3251 if self.Nants_data != self._calc_nants_data():
-> 3252     raise ValueError(
   3253         "Nants_data must be equal to the number of unique "
   3254         "values in ant_1_array and ant_2_array"
   3255     )
   3257 if self.Nbls != len(np.unique(self.baseline_array)):
   3258     raise ValueError(
   3259         "Nbls must be equal to the number of unique "
   3260         f"baselines in the data_array. Got {self.Nbls}, not"
   3261         f"{len(np.unique(self.baseline_array))}"
   3262     )

ValueError: Nants_data must be equal to the number of unique values in ant_1_array and ant_2_array

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)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In [17], line 4
      2 to_show = {'JD': [JD]}
      3 to_show['Date'] = f'{utc.month}-{utc.day}-{utc.year}'
----> 4 to_show['LST Range'] = f'{hd.lsts[0] * 12 / np.pi:.3f} -- {hd_last.lsts[-1] * 12 / np.pi:.3f} hours'
      6 # X-engine status
      7 to_show['X-Engine Status'] = x_status_str

NameError: name 'hd_last' is not defined

Table 1: Overall Array Health¶

In [18]:
HTML(table.render())
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In [18], line 1
----> 1 HTML(table.render())

NameError: name 'table' is not defined
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_2460067.csv
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In [19], line 4
      2 outpath = os.path.join(nb_outdir, f'array_health_table_{JD}.csv')
      3 print(f'Now saving Table 2 to a csv at {outpath}')
----> 4 df.replace({'\u2705': 'Y'}, regex=True).replace({'\u274C': 'N'}, regex=True).replace({'<br>': ' '}, regex=True).to_csv(outpath)

AttributeError: 'numpy.ndarray' object has no attribute 'replace'

Build DataFrame¶

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

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

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

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

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

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

Table 2: RTP Per-Antenna Metrics Summary Table¶

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

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

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

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

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

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

In [21]:
HTML(table.render())
Out[21]:
Ant Node A Priori Status Auto Metrics Flags Dead Fraction in Ant Metrics (Jee) Dead Fraction in Ant Metrics (Jnn) Crossed Fraction in Ant Metrics ee Shape Modified Z-Score nn Shape Modified Z-Score ee Power Modified Z-Score nn Power Modified Z-Score ee Temporal Variability Modified Z-Score nn Temporal Variability Modified Z-Score ee Temporal Discontinuties Modified Z-Score nn Temporal Discontinuties Modified Z-Score Average Dead Ant Metric (Jee) Average Dead Ant Metric (Jnn) Average Crossed Ant Metric
4 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.823190 7.751990 -0.875716 -0.596277 -1.261589 49.652424 -0.614496 23.947506 0.578342 0.486074 0.389778
5 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.420449 0.328337 0.651434 3.124242 -0.421599 1.282197 0.094312 0.892855 0.593483 0.567390 0.398222
7 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.429690 0.052473 -0.232827 0.395693 -0.324565 5.182693 2.269225 12.396850 0.602671 0.587424 0.391366
8 N02 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.308134 1.195565 1.044607 0.917363 -0.645788 -0.868210 -1.814993 -1.701412 0.563877 0.553791 0.365950
9 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.529080 -0.234223 2.871758 -0.055394 1.427828 0.393090 2.706369 -0.105299 0.570980 0.578108 0.371659
10 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.789241 -0.534262 -0.398321 -0.220587 -0.357588 5.534145 -0.918889 0.710233 0.593151 0.576201 0.396569
15 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 10.408474 -0.178978 -0.463817 -0.199321 0.610100 -0.063263 -0.204502 1.155628 0.463758 0.583388 0.379610
16 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.185432 0.811555 0.238970 0.681895 1.968012 -0.952873 -1.435665 -1.896957 0.584512 0.570734 0.384491
17 N01 digital_ok 100.00% 0.00% 0.00% 0.00% 0.209426 2.313562 1.016572 7.318856 0.233953 0.594837 0.439046 3.551052 0.594906 0.442194 0.424564
18 N01 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.043278 4.530533 0.977449 1.395927 2.552819 10.344423 4.712086 12.291432 0.573625 0.376856 0.429366
19 N02 digital_ok 100.00% 0.00% 0.00% 0.00% -0.071036 0.085176 -0.003504 3.426814 0.148261 11.531911 0.020674 7.680460 0.604880 0.586696 0.387542
20 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.404973 -0.732533 1.881129 -0.127685 4.169644 0.249791 1.109091 0.058585 0.594555 0.596862 0.375329
21 N02 digital_ok 0.00% 0.00% 0.00% 0.00% 0.381913 0.353045 0.245488 0.497861 1.545644 2.103195 0.678868 0.566574 0.596377 0.594070 0.379874
22 N06 not_connected 100.00% 0.00% 0.00% 0.00% -1.062630 -0.855865 -0.567366 -0.795794 7.505582 2.866283 0.184332 -0.451128 0.573261 0.566369 0.380916
27 N01 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.181171 17.535464 8.071747 5.351091 3.316490 18.630175 3.411297 52.231512 0.071130 0.072498 -0.035097
28 N01 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.937955 10.345307 8.218060 3.660440 1.085909 12.734656 1.644227 12.714898 0.031366 0.264391 0.202981
29 N01 digital_ok 0.00% 0.00% 0.00% 0.00% -0.552167 0.078039 0.108078 0.327314 -0.114033 1.268819 0.829497 2.842207 0.607541 0.606848 0.375757
30 N01 digital_ok 0.00% 0.00% 0.00% 0.00% 0.115525 -0.666652 0.384878 -0.339401 0.678479 0.223134 0.384142 -0.064002 0.614033 0.612309 0.379478
31 N02 digital_ok 100.00% 0.00% 0.00% 0.00% 0.531279 -0.116199 1.191855 2.685680 3.984746 7.756580 2.020514 24.149234 0.623198 0.603998 0.392188
32 N02 RF_maintenance 100.00% 0.00% 0.00% 0.00% 12.614524 12.558791 0.182041 0.294100 17.607167 15.923245 10.525316 9.735201 0.505539 0.523887 0.205400
34 N06 not_connected 100.00% 100.00% 0.00% 0.00% 6.800114 -0.691230 4.703412 -0.780490 0.775552 0.281974 1.269287 0.182451 0.044031 0.584628 0.430403
35 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.674060 -0.635391 -0.321228 -0.107739 -1.589435 1.021337 -1.142195 0.226135 0.589325 0.573753 0.391945
36 N03 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.125534 3.647885 1.150751 1.015698 7.938385 5.460723 2.626099 3.051619 0.595123 0.575681 0.400716
37 N03 digital_ok 100.00% 0.00% 100.00% 0.00% -0.554473 14.155819 -0.896117 10.677764 2.629131 3.599881 0.983765 5.140049 0.592223 0.032712 0.475652
38 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.032217 -0.071767 0.137070 0.589727 1.954637 4.119005 0.819568 4.279069 0.591981 0.584510 0.381245
40 N04 digital_ok 100.00% 0.00% 0.00% 100.00% 0.019533 1.180099 0.270926 0.050346 9.983177 7.675706 28.187747 2.536888 0.213017 0.208922 -0.295225
41 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.608659 0.744942 1.408771 1.968836 1.414301 4.308735 0.616799 0.976128 0.606617 0.605108 0.380117
42 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.120924 1.840698 -0.132670 -0.173862 1.912174 3.635559 -0.103562 1.762054 0.234102 0.222706 -0.295642
43 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.762607 0.079176 -0.904415 0.981724 -1.334390 1.430452 -0.782824 0.777842 0.623988 0.618624 0.387438
44 N05 digital_ok 0.00% 0.00% 0.00% 0.00% -0.464744 0.451695 -0.446854 0.694094 -0.545354 0.870016 -0.387200 0.288635 0.628391 0.627671 0.389838
45 N05 digital_ok 0.00% 0.00% 0.00% 0.00% 0.823725 1.153188 0.940494 0.947446 -0.229976 2.090568 0.322326 1.554545 0.614206 0.611404 0.382311
46 N05 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.033621 -0.409282 0.296446 -0.609923 3.477425 1.160414 0.609875 0.164892 0.613468 0.616299 0.382858
47 N06 not_connected 100.00% 100.00% 100.00% 0.00% 6.333190 7.781517 4.636316 4.770397 1.314654 0.459076 2.326547 0.812119 0.031316 0.055077 0.015993
48 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.566243 -0.282448 -0.906709 -0.044319 -0.354521 -0.975386 -0.723870 -1.312744 0.587881 0.586699 0.373676
49 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.510370 -0.722543 0.260725 -0.733103 -1.048497 -0.465913 -0.000836 1.170445 0.566839 0.575614 0.372369
50 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.306775 0.410923 0.624207 1.660578 1.185929 1.448464 0.299508 0.550553 0.587603 0.571012 0.397479
51 N03 dish_maintenance 100.00% 0.00% 0.00% 0.00% 1.478419 0.736150 0.224314 0.092871 34.514593 0.043847 101.893379 0.104711 0.590018 0.582921 0.382008
52 N03 RF_maintenance 0.00% 0.00% 0.00% 0.00% 3.247431 2.517143 0.776001 0.579643 0.863896 0.294956 0.218335 0.752333 0.608948 0.594388 0.386569
53 N03 digital_ok 100.00% 0.00% 0.00% 0.00% 0.152573 0.230242 0.234784 -0.884448 5.036395 1.801446 8.130277 4.986401 0.609698 0.597232 0.382965
54 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 3.649361 1.175955 0.720113 -0.616244 -0.736153 8.764036 -1.244625 -0.282534 0.330443 0.371923 0.154580
55 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.090444 28.123234 -0.092945 6.132231 0.636059 0.955756 2.120107 0.703363 0.238795 0.041967 0.074156
56 N04 digital_ok 100.00% 0.00% 0.00% 0.00% -0.339047 0.594398 -0.817034 1.441142 -0.958660 4.586794 -0.432598 1.706680 0.619746 0.613104 0.381632
57 N04 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.245242 0.041072 -0.708695 0.273827 2.131582 0.722675 -0.203456 0.786000 0.618569 0.614579 0.377706
58 N05 RF_maintenance 100.00% 100.00% 100.00% 0.00% 5.555264 7.311457 8.239893 8.789110 2.758715 2.406347 2.304016 2.341398 0.038488 0.037864 0.002227
59 N05 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.212885 0.823471 8.261552 1.261470 0.566034 2.959508 0.746532 10.887755 0.046641 0.617413 0.463391
60 N05 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.089934 7.300933 0.386802 8.810679 0.005827 1.316220 0.343205 2.653204 0.604638 0.073435 0.479244
61 N06 not_connected 100.00% 100.00% 0.00% 0.00% 6.676299 -0.773102 4.446582 -0.169043 0.514661 -0.081522 0.198206 0.485499 0.035988 0.587600 0.415000
62 N06 digital_ok 0.00% 0.00% 0.00% 0.00% -0.467772 -0.102285 0.511718 -0.190830 0.170140 -0.473120 0.352367 -1.032701 0.563217 0.585231 0.364333
63 N06 not_connected 100.00% 0.00% 100.00% 0.00% -0.609195 7.595868 -0.888165 5.058506 0.933892 1.423612 -0.479379 2.651747 0.593515 0.046108 0.470924
64 N06 not_connected 0.00% 0.00% 0.00% 0.00% -0.652921 -0.502764 -0.574103 0.247019 2.584705 0.111223 -0.090183 0.971947 0.580306 0.562913 0.379221
65 N03 digital_ok 100.00% 100.00% 100.00% 0.00% 13.661764 12.959970 10.360186 10.497043 1.201483 1.718493 4.161533 5.634488 0.023939 0.032490 0.009085
66 N03 digital_ok 100.00% 13.68% 100.00% 0.00% 1.247368 13.280169 0.780320 10.615733 -0.190239 1.651764 -1.762066 5.910799 0.211013 0.047100 0.092286
67 N03 digital_ok 0.00% 0.00% 0.00% 0.00% -0.394947 0.171592 0.000744 1.533954 0.572880 0.612431 3.195959 1.162877 0.614132 0.597005 0.393327
68 N03 dish_maintenance 100.00% 100.00% 0.00% 0.00% 14.509734 -0.415145 10.409513 -0.274291 1.276648 -0.092953 4.845455 -0.688366 0.034951 0.599140 0.476113
69 N04 digital_ok 100.00% 0.00% 0.00% 0.00% 0.868086 5.129394 1.345861 -0.184066 5.372502 10.246491 4.814352 2.406683 0.624755 0.612296 0.383039
70 N04 digital_ok 0.00% 0.00% 0.00% 100.00% -0.090927 1.734854 1.173262 2.640658 0.919126 1.681727 1.367507 0.818339 0.233944 0.219102 -0.293928
71 N04 digital_ok 0.00% 0.00% 0.00% 0.00% 2.825833 0.144757 -0.002080 0.624490 0.967628 1.751898 0.069663 0.997466 0.631210 0.623978 0.383749
72 N04 digital_ok 100.00% 0.00% 100.00% 0.00% 0.620563 7.559943 2.153626 8.919264 9.599317 0.482508 15.407356 1.419134 0.255493 0.085657 0.003095
73 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.343741 0.751950 -0.339941 0.318218 -0.509400 21.674090 0.116953 2.802112 0.639160 0.632050 0.396144
74 N05 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.935664 -0.118266 -0.787338 0.052086 -0.570387 4.623653 -0.871558 0.821960 0.636045 0.632660 0.394293
77 N06 not_connected 100.00% 0.00% 0.00% 0.00% 9.746990 6.352982 -0.496615 -0.648159 10.917730 2.837933 2.359131 -0.079054 0.478842 0.496967 0.234070
78 N06 not_connected 100.00% 0.00% 0.00% 0.00% 13.448611 -0.272640 0.179884 -0.073305 0.759749 -1.017711 0.631320 -0.624115 0.441262 0.595805 0.364756
79 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.147368 -0.674921 0.923152 -0.409111 0.164479 -0.449106 2.399939 0.286613 0.571052 0.586964 0.378963
80 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.848432 0.825313 -0.688233 0.724813 -1.437230 -0.292850 -0.624219 -1.631583 0.590995 0.573627 0.392822
81 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 104.132603 22.892028 29.251486 16.571859 256.543120 67.051300 634.018520 178.276375 0.017408 0.016761 0.001075
82 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 21.761772 37.475610 20.138459 20.704788 248.347436 220.117568 540.703628 513.508469 0.016678 0.016237 0.000958
83 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 16.945544 27.981305 17.366031 20.328859 184.228791 201.097229 392.578110 486.824446 0.016493 0.016148 0.000756
84 N08 RF_maintenance 100.00% 0.00% 100.00% 0.00% 1.222252 14.195509 0.444408 10.675421 -1.664720 1.367445 -1.690365 4.386376 0.604546 0.051642 0.468932
85 N08 digital_ok 0.00% 0.00% 0.00% 0.00% -0.475361 -0.033324 -0.592927 -0.355937 -1.717953 1.567488 -0.999832 0.142386 0.622048 0.611740 0.380904
86 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 0.397274 0.439144 0.752392 0.418216 0.973603 2.009879 0.238162 11.984555 0.622418 0.610233 0.372160
87 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 17.053583 2.042817 2.823359 -0.789708 7.966321 0.736013 4.878397 -0.566411 0.496950 0.627802 0.364198
88 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.220774 0.913277 0.864775 1.348316 0.288093 0.268395 0.898457 0.670114 0.629325 0.623093 0.373713
89 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.616601 0.339595 0.832755 1.222780 0.073374 -0.037493 0.000836 0.433041 0.626151 0.620344 0.381054
90 N09 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.331718 -0.787158 0.098083 -0.938036 0.111994 -0.239760 -0.025172 0.648612 0.625211 0.623884 0.385572
91 N09 digital_ok 0.00% 0.00% 0.00% 0.00% 0.046686 0.253914 0.969982 0.846818 -0.394023 0.804918 0.332197 0.339427 0.612021 0.615787 0.380665
92 N10 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.888232 0.265391 8.252287 0.724598 0.638967 3.132061 0.650498 1.109787 0.036228 0.616289 0.433968
93 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 6.109743 7.465900 8.316097 8.848256 1.177750 0.718198 2.150943 2.061076 0.031746 0.025375 0.003352
94 N10 digital_ok 100.00% 100.00% 0.00% 0.00% 6.442180 1.148865 8.398008 6.181281 0.615198 9.259329 1.006340 0.773969 0.029179 0.528510 0.362374
95 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.357933 -0.706420 0.094802 -0.568430 -0.430604 -0.981280 0.547774 -0.656956 0.578658 0.598071 0.383212
96 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.139173 10.550259 0.036596 -0.485496 -1.890964 2.779728 -1.381281 1.189624 0.588969 0.494604 0.369684
97 N11 not_connected 100.00% 0.00% 0.00% 0.00% -0.917008 1.078748 -0.646045 0.617403 -0.791664 1.965989 -0.048012 5.844125 0.581730 0.563418 0.383663
101 N08 digital_ok 100.00% 0.00% 0.00% 0.00% 3.680722 3.838502 0.380380 1.256453 0.019168 1.357697 0.015187 0.571557 0.607102 0.600448 0.385924
102 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.794692 0.194302 -0.895986 -0.299140 -0.881250 0.815224 -0.734715 2.894150 0.622825 0.615318 0.380621
103 N08 digital_ok 100.00% 0.00% 0.00% 0.00% -0.151977 2.133316 -0.759599 -0.198362 1.327723 3.477022 0.016407 13.295133 0.617768 0.617816 0.367611
104 N08 RF_maintenance 100.00% 0.00% 0.00% 0.00% 3.810777 29.745583 0.821597 5.485046 2.958548 2.759049 0.932126 2.628545 0.617330 0.600250 0.377850
105 N09 digital_ok 0.00% 0.00% 0.00% 0.00% -0.004172 0.425787 0.260562 0.840834 1.469578 0.628666 0.143137 0.300740 0.629861 0.619745 0.379169
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 0.00% 0.00% 0.00% 0.00% 0.099899 0.540224 0.095826 -0.276329 0.000765 0.593017 0.145184 2.046193 0.622268 0.615267 0.380735
108 N09 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.212878 1.585946 1.093838 2.268930 2.814954 0.932825 11.732995 0.591939 0.611615 0.614486 0.376592
109 N10 digital_ok 100.00% 100.00% 100.00% 0.00% 5.761143 7.381902 8.311121 8.651405 0.642183 0.737944 0.747690 1.753659 0.067438 0.037561 0.021532
110 N10 RF_maintenance 100.00% 0.00% 0.00% 0.00% 16.825661 -0.047349 0.790175 0.211925 2.349556 0.918599 0.457637 -0.000526 0.504811 0.614154 0.368897
111 N10 digital_ok 100.00% 0.00% 100.00% 0.00% 0.282177 7.316493 0.796368 8.711121 53.144862 0.811325 13.645881 2.386435 0.602009 0.063050 0.467334
112 N10 digital_ok 100.00% 0.00% 0.00% 100.00% -0.127972 3.146346 1.409223 7.585262 1.012647 0.075609 0.629612 1.006712 0.231629 0.154552 -0.257035
113 N11 not_connected 0.00% 0.00% 0.00% 0.00% 2.359923 1.885916 1.515425 1.362625 -0.268670 -0.266491 -2.673254 -2.445856 0.573556 0.564462 0.376323
114 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.785174 2.744978 1.232902 3.370234 -0.829615 1.279184 -2.290270 1.070119 0.566301 0.478275 0.380446
115 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.985348 -1.058639 -0.425002 -0.739399 -0.370596 -1.154254 -0.339260 -0.692418 0.565685 0.562000 0.368304
117 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 22.031806 23.937398 19.335468 17.193377 129.829703 98.011997 357.904440 240.119383 0.017382 0.016549 0.001372
118 N07 digital_ok 100.00% 100.00% 100.00% 0.00% 22.349926 22.153622 20.592010 19.559038 283.164761 162.043315 592.252708 395.006051 0.016518 0.016283 0.000799
120 N08 RF_maintenance 0.00% 0.00% 0.00% 0.00% 1.385854 0.695868 2.445795 -0.122718 3.133856 -0.146984 0.607891 -0.148333 0.606459 0.613209 0.377884
121 N08 digital_ok 100.00% 2.11% 0.00% 0.00% 1.166713 1.771994 0.853773 4.668693 0.285563 2.179501 -1.007560 9.793613 0.571149 0.601975 0.377281
122 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.896222 2.482864 -0.077615 -0.443659 2.749743 -0.286020 -0.230886 -0.371503 0.629237 0.627307 0.378561
123 N08 digital_ok 0.00% 0.00% 0.00% 0.00% 2.060855 1.449467 1.349844 0.176083 -0.057376 -1.224442 -2.104289 -1.474398 0.599541 0.618714 0.375678
124 N09 digital_ok 100.00% 100.00% 0.00% 0.00% 5.958367 0.438411 8.418872 0.951454 0.551196 0.603065 0.749905 1.174160 0.042593 0.631639 0.446426
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 digital_ok 100.00% 100.00% 0.00% 0.00% 5.694541 -0.793672 8.253858 -0.882903 0.621951 0.872652 0.622685 1.440724 0.036432 0.618026 0.434703
128 N10 digital_ok 0.00% 0.00% 0.00% 0.00% 0.152528 -0.750636 -0.161710 -0.810762 0.578367 -0.243991 -0.109376 0.569151 0.613629 0.607939 0.391986
131 N11 not_connected 100.00% 0.00% 0.00% 0.00% -1.088064 7.113475 -0.799404 4.946616 -0.847699 0.340592 -0.772288 0.702872 0.603553 0.244802 0.441260
132 N11 not_connected 0.00% 0.00% 0.00% 0.00% -1.265313 -0.262033 -0.886802 -0.237085 2.489501 0.205963 -0.420085 -0.047521 0.590218 0.577611 0.386621
133 N11 not_connected 0.00% 0.00% 0.00% 0.00% -0.202478 -1.156223 -0.326977 -0.936467 0.089193 -0.525319 -0.215161 -0.092937 0.580205 0.578679 0.382588
134 N11 not_connected 0.00% 0.00% 0.00% 0.00% 1.123267 1.160110 2.321799 0.883541 2.373004 -0.636461 3.262754 -1.978467 0.500289 0.550084 0.377962
135 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% 1.615434 -0.818968 -0.223940 -0.512651 10.277257 0.057734 0.662492 0.104724 0.573008 0.569856 0.390957
136 N12 digital_ok 100.00% 100.00% 0.00% 0.00% 5.384330 -0.426548 8.055951 0.115259 0.872404 0.392095 1.391579 0.575422 0.040210 0.576809 0.421664
137 N07 RF_maintenance 100.00% 100.00% 100.00% 0.00% 16.176980 39.650343 17.338074 19.455717 148.252946 152.123613 342.675116 306.918546 0.016503 0.016197 0.000611
139 N13 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.091580 -0.347214 -0.000744 -0.596296 -1.505069 -0.044866 -1.144706 0.497829 0.595722 0.588494 0.374061
140 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 8.483493 0.078342 -0.515897 -0.874237 109.197356 23.664386 95.175174 18.051494 0.545129 0.603484 0.354139
141 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.144117 -0.812523 0.379453 -0.503743 0.027099 -1.119545 0.043254 -0.948535 0.625793 0.615217 0.372647
142 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.286067 7.356168 -0.007408 8.818191 6.484082 2.750510 16.284652 2.908591 0.630062 0.046102 0.517242
143 N14 RF_maintenance 100.00% 100.00% 100.00% 0.00% 6.182485 7.169146 8.133075 8.791853 0.777806 0.799228 0.620463 1.841634 0.123877 0.034057 0.076047
144 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.176167 -0.747461 -0.043440 -0.252760 -0.485560 1.320333 -0.282580 -0.975528 0.625865 0.614857 0.381923
145 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.144348 0.023784 0.201339 0.405856 -0.216884 4.144519 -0.017528 0.637993 0.625978 0.617759 0.383446
146 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.427312 -0.971975 -0.493738 -0.747667 -0.564001 -0.325474 -0.455816 -0.277988 0.606575 0.610779 0.391611
147 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
148 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
149 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
150 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
151 N16 digital_ok 100.00% 0.00% 0.00% 0.00% 8.892501 -0.509397 -0.524905 1.216264 -0.039863 1.247396 -0.342852 7.069806 0.474055 0.555792 0.341638
155 N12 RF_maintenance 100.00% 100.00% 0.00% 0.00% 5.697359 -0.576755 8.165306 -0.056222 1.106602 1.241391 1.977347 0.360340 0.041069 0.560213 0.417736
156 N12 RF_maintenance 100.00% 0.00% 100.00% 0.00% 0.279588 7.247447 5.898452 8.689148 1.041446 0.904660 1.141006 1.977788 0.486852 0.040411 0.378878
157 N12 digital_ok 0.00% 0.00% 0.00% 0.00% 0.522714 0.150768 0.684051 1.051428 -0.000765 0.692513 0.343672 0.330357 0.584268 0.580653 0.391061
158 N12 digital_ok 100.00% 0.00% 0.00% 0.00% -0.581137 -0.688853 -0.651027 -0.583344 0.316277 2.642649 0.985512 7.588634 0.598573 0.592417 0.393292
159 N13 RF_maintenance 100.00% 0.00% 0.00% 0.00% 0.065074 7.941196 0.160637 -0.062501 2.055893 7.167869 0.151984 0.562328 0.570271 0.503580 0.365383
160 N13 digital_ok 100.00% 100.00% 0.00% 0.00% 6.249092 -0.373001 8.237584 0.061507 0.676143 1.115672 0.803682 0.191466 0.046736 0.608624 0.483364
161 N13 digital_ok 100.00% 0.00% 0.00% 0.00% 0.315367 16.051870 0.620495 0.684673 0.599082 1.000076 0.073736 0.564113 0.616354 0.502382 0.364497
162 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.978409 -1.006721 -0.676979 -0.692786 0.670502 1.020776 3.098035 -0.362626 0.620367 0.619036 0.373850
163 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 0.318331 0.818498 0.552554 0.847394 1.958634 6.719005 0.916434 1.074487 0.622859 0.622088 0.384478
164 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.472892 0.729281 1.173226 1.329608 1.654324 1.859289 2.502620 1.901660 0.620877 0.614317 0.372396
165 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 9.700943 -0.066840 0.412065 0.069965 4.856484 0.413475 1.763454 -0.035274 0.530369 0.618050 0.368244
166 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -0.104247 -0.601443 1.028603 -0.380591 0.937646 -0.401763 0.118394 -1.102835 0.627988 0.617691 0.387450
167 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
168 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
169 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
170 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
171 N16 digital_ok 0.00% 0.00% 0.00% 0.00% -0.386200 -1.260128 0.634420 -0.826316 -1.093756 -1.015595 0.126869 -0.255454 0.552255 0.569785 0.373269
172 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.544355 -0.013399 1.061619 -0.079343 -0.825348 -0.933095 -2.208618 -0.686417 0.575789 0.567843 0.387090
173 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.414740 2.039977 1.560725 1.423859 -0.197240 -0.193078 -2.719497 -2.303795 0.543870 0.526498 0.375083
179 N12 RF_maintenance 100.00% 0.00% 0.00% 0.00% -0.121590 -0.058593 0.448009 0.600889 1.761097 1.832408 0.009021 5.431954 0.594722 0.591852 0.392051
180 N13 RF_maintenance 100.00% 0.00% 100.00% 0.00% -0.198094 7.738001 -0.345297 8.890392 1.222504 0.785847 7.428128 2.179593 0.605047 0.052865 0.502736
181 N13 digital_ok 0.00% 0.00% 0.00% 0.00% 1.040200 0.410128 1.453694 1.164277 0.466903 0.938787 0.248991 2.970777 0.613560 0.608624 0.388154
182 N13 digital_ok 100.00% 0.00% 100.00% 0.00% -0.503537 7.204941 -0.683264 8.630320 0.400199 0.882983 0.466115 2.629084 0.623928 0.048747 0.481661
183 N13 digital_ok 0.00% 0.00% 0.00% 0.00% -0.226819 0.653643 0.760901 1.125955 0.373100 0.463232 0.284643 0.424229 0.619673 0.611572 0.379497
184 N14 digital_ok 100.00% 0.00% 0.00% 0.00% 8.097050 -0.009038 7.036075 0.190035 1.377958 -0.024744 0.764172 0.137150 0.340352 0.618416 0.423890
185 N14 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.280029 0.111674 -0.672003 0.310532 -0.320291 0.313351 -0.278712 0.342826 0.622514 0.615811 0.384355
186 N14 digital_ok 0.00% 0.00% 0.00% 0.00% -1.010923 -0.940604 -0.523212 -0.928832 -0.322329 -0.780390 -0.853115 -0.448806 0.619603 0.614812 0.378511
187 N14 digital_ok 0.00% 0.00% 0.00% 0.00% 0.219341 -0.952009 0.127057 -0.705542 2.519261 1.244022 1.172003 -0.502604 0.618713 0.603783 0.386164
189 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
190 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
191 N15 digital_ok 100.00% 100.00% 100.00% 0.00% nan nan inf inf nan nan nan nan nan nan nan
192 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 1.803169 2.167517 1.271523 1.504875 -0.875077 -0.182530 -2.370832 -2.667983 0.557063 0.528863 0.381867
193 N16 digital_ok 0.00% 0.00% 0.00% 0.00% 2.601512 1.778754 1.672881 1.310433 -0.064353 -0.344660 -2.824262 -2.454331 0.543182 0.529005 0.374965
200 N18 RF_maintenance 100.00% 100.00% 0.00% 0.00% 6.797011 17.837292 4.585026 0.391430 1.320697 7.872741 1.668408 7.154161 0.041487 0.243603 0.160068
201 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.984965 1.519332 0.785408 1.209046 -0.941351 -0.507454 -1.817225 -2.364970 0.590628 0.562487 0.385883
202 N18 digital_ok 100.00% 100.00% 100.00% 0.00% 14.559847 5.245015 15.696255 10.616363 60.260229 51.081117 166.669438 130.229057 0.017039 0.024327 0.006012
204 N19 RF_maintenance 100.00% 0.00% 0.00% 0.00% 5.731045 6.389769 1.562120 -0.244551 3.455177 1.121998 13.944858 0.767734 0.613880 0.603866 0.377927
205 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 4.588644 -0.864990 3.448745 -0.526403 0.457461 2.151950 1.023016 5.863652 0.382331 0.592610 0.421856
206 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 0.633280 2.036434 1.342626 2.828857 0.078153 -0.389315 0.416930 0.802481 0.557536 0.504383 0.361833
207 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 1.190260 -0.950349 -0.678848 -0.668908 0.595828 -0.446160 3.541677 -0.401974 0.575279 0.589672 0.371913
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.171939 7.562861 -0.357833 5.055369 0.462139 0.706221 -0.144114 1.249478 0.564873 0.040568 0.478176
220 N18 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.982635 -1.032914 -0.563305 -0.848817 -0.514749 -0.055345 0.208500 -0.551024 0.587875 0.573393 0.381291
221 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.797731 -0.885271 -0.623931 -0.727561 0.588564 0.518466 1.927143 -0.347960 0.582192 0.583535 0.375247
222 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.611170 -0.845601 -0.855901 -0.729062 -0.494990 -1.235825 0.157499 -0.804923 0.590852 0.587324 0.371987
223 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.857715 0.024834 -0.113043 1.571574 -1.119622 3.587936 -0.094768 11.673235 0.584420 0.549216 0.374632
224 N19 RF_ok 0.00% 0.00% 0.00% 0.00% 2.850873 2.000813 1.839785 1.463060 0.184663 -0.164945 -3.001675 -2.533977 0.550817 0.544204 0.351914
225 N19 RF_ok 100.00% 0.00% 100.00% 0.00% -0.632741 7.235303 -0.320577 4.884650 -1.694957 0.921734 -1.129484 1.746414 0.591302 0.152872 0.477701
226 N19 RF_ok 100.00% 0.00% 0.00% 0.00% -0.690719 8.201031 -0.846718 -0.556870 -0.509749 0.678327 -0.620705 -0.095034 0.590688 0.485644 0.374061
227 N20 RF_ok 0.00% 0.00% 0.00% 0.00% 1.035663 -0.539752 2.202355 -0.262404 2.410631 1.240967 3.560546 2.556799 0.510151 0.564617 0.381791
228 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.392019 -0.400709 -0.302937 -0.238946 -0.285061 3.600804 -0.614393 0.745401 0.568145 0.550464 0.364325
229 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.306126 -0.262348 -0.328269 -0.065570 -0.168234 -1.338477 -1.060472 -1.332537 0.568845 0.557434 0.381286
237 N18 RF_ok 0.00% 0.00% 0.00% 0.00% 0.931811 -0.816867 0.725492 -0.361000 2.487197 -0.483102 0.277168 -0.282306 0.542467 0.561816 0.384145
238 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -0.464951 -0.844540 -0.247340 -0.443839 -1.831273 -1.306762 -1.227041 -1.034790 0.585705 0.568349 0.391309
239 N18 RF_ok 0.00% 0.00% 0.00% 0.00% -1.028568 -1.084069 -0.936724 -0.846012 -0.722913 -0.481156 -0.585837 0.360787 0.581788 0.573393 0.381516
240 N19 RF_maintenance 0.00% 0.00% 0.00% 0.00% 0.854737 -0.526538 1.199021 -0.631015 -0.996528 -0.718830 0.607256 -0.218261 0.544865 0.573183 0.380239
241 N19 RF_ok 0.00% 0.00% 0.00% 0.00% -1.230129 -1.118712 -0.932838 -0.771822 -1.413596 -1.051979 0.332645 -0.768309 0.583792 0.573253 0.382853
242 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 9.132835 -0.398775 -0.532966 -0.211011 4.967347 -0.943018 2.182727 -0.924611 0.462593 0.567458 0.363717
243 N19 RF_ok 100.00% 0.00% 0.00% 0.00% 7.438267 -0.934836 -0.218198 -0.316466 -0.551140 -0.680970 -1.124664 -0.170783 0.496724 0.565268 0.367412
244 N20 RF_maintenance 0.00% 0.00% 0.00% 0.00% -0.082093 -0.647508 0.266082 -0.030052 0.915152 3.423710 1.116040 1.405681 0.564348 0.561797 0.363098
245 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.478981 -0.593059 -0.182394 -0.804041 -0.898703 0.035064 -1.322689 -0.026106 0.568706 0.554895 0.372916
246 N20 dish_maintenance 100.00% 0.00% 100.00% 0.00% -0.727507 7.868011 -0.805839 4.736710 2.097985 0.523154 -0.184773 0.702846 0.564986 0.039508 0.472793
261 N20 RF_ok 0.00% 0.00% 0.00% 0.00% -0.793105 -0.792912 -0.634605 -0.939394 -0.473485 -1.128157 0.562743 -0.509621 0.567078 0.551940 0.382582
262 N20 dish_maintenance 100.00% 0.00% 0.00% 0.00% 5.393806 7.135501 0.484074 0.627728 0.366631 0.745510 0.096641 0.482027 0.568310 0.553680 0.385077
320 N03 dish_maintenance 0.00% 0.00% 0.00% 0.00% 1.148375 -0.156779 0.620310 -0.113433 0.404681 0.809981 -1.755135 -0.567447 0.478439 0.459054 0.363132
324 N04 not_connected 0.00% 0.00% 0.00% 0.00% 0.704620 0.732163 -0.079847 -0.016874 -0.376580 -0.635480 -0.892896 -1.264345 0.471661 0.451071 0.352798
325 N09 dish_ok 0.00% 0.00% 0.00% 0.00% 0.004172 -0.799583 -0.178247 -0.256820 -0.521791 0.660134 -1.167751 0.139402 0.494424 0.468764 0.367862
329 N12 dish_maintenance 100.00% 100.00% 100.00% 0.00% 6.818139 7.763834 4.138752 4.787991 0.719350 0.468083 0.829067 0.727368 0.041624 0.039826 0.002052
333 N12 dish_maintenance 0.00% 0.00% 0.00% 0.00% 0.934237 0.128929 0.135023 -0.227706 1.352949 0.127588 0.738936 0.301971 0.481446 0.476107 0.357433
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, 10, 15, 17, 18, 19, 20, 22, 27, 28, 31, 32, 34, 36, 37, 38, 40, 41, 42, 47, 51, 53, 54, 55, 56, 58, 59, 60, 61, 63, 65, 66, 68, 69, 70, 72, 73, 74, 77, 78, 81, 82, 83, 84, 86, 87, 92, 93, 94, 96, 97, 101, 103, 104, 106, 108, 109, 110, 111, 112, 117, 118, 121, 124, 125, 126, 127, 131, 135, 136, 137, 140, 142, 143, 145, 147, 148, 149, 150, 151, 155, 156, 158, 159, 160, 161, 163, 165, 167, 168, 169, 170, 179, 180, 182, 184, 189, 190, 191, 200, 202, 204, 205, 208, 209, 210, 211, 223, 225, 226, 242, 243, 246, 262, 329]

unflagged_ants: [5, 8, 9, 16, 21, 29, 30, 35, 43, 44, 45, 46, 48, 49, 50, 52, 57, 62, 64, 67, 71, 79, 80, 85, 88, 89, 90, 91, 95, 102, 105, 107, 113, 114, 115, 120, 122, 123, 128, 132, 133, 134, 139, 141, 144, 146, 157, 162, 164, 166, 171, 172, 173, 181, 183, 185, 186, 187, 192, 193, 201, 206, 207, 220, 221, 222, 224, 227, 228, 229, 237, 238, 239, 240, 241, 244, 245, 261, 320, 324, 325, 333]

golden_ants: [5, 9, 16, 21, 29, 30, 44, 45, 62, 67, 71, 85, 88, 91, 105, 107, 122, 123, 128, 141, 144, 146, 157, 162, 164, 166, 171, 172, 173, 181, 183, 186, 187, 192, 193]
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_2460067.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 [ ]: