Single File Calibration¶

by Josh Dillon, Aaron Parsons, Tyler Cox, and Zachary Martinot, last updated April 4, 2023

This notebook is designed to infer as much information about the array from a single file, including pushing the calibration and RFI mitigation as far as possible. Calibration includes redundant-baseline calibration, RFI-based calibration of delay slopes, model-based calibration of overall amplitudes, and a full per-frequency phase gradient absolute calibration if abscal model files are available.

Here's a set of links to skip to particular figures and tables:

• Figure 1: RFI Flagging¶

• Figure 2: Plot of autocorrelations with classifications¶

• Figure 3: Summary of antenna classifications prior to calibration¶

• Figure 4: Redundant calibration of a single baseline group¶

• Figure 5: Absolute calibration of redcal degeneracies¶

• Figure 6: chi^2 per antenna across the array¶

• Figure 7: Summary of antenna classifications after redundant calibration¶

• Table 1: Complete summary of per antenna classifications¶

In [1]:
import time
tstart = time.time()
In [2]:
import os
os.environ['HDF5_USE_FILE_LOCKING'] = 'FALSE'
import h5py
import hdf5plugin  # REQUIRED to have the compression plugins available
import numpy as np
from scipy import constants, interpolate
import copy
import glob
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
pd.set_option('display.max_rows', 1000)
from uvtools.plot import plot_antpos, plot_antclass
from hera_qm import ant_metrics, ant_class, xrfi
from hera_cal import io, utils, redcal, apply_cal, datacontainer, abscal
from hera_notebook_templates.data import DATA_PATH as HNBT_DATA
from IPython.display import display, HTML
import linsolve
display(HTML("<style>.container { width:100% !important; }</style>"))
_ = np.seterr(all='ignore')  # get rid of red warnings
%config InlineBackend.figure_format = 'retina'
In [3]:
# this enables better memory management on linux
import ctypes
def malloc_trim():
    try:
        ctypes.CDLL('libc.so.6').malloc_trim(0) 
    except OSError:
        pass

Parse inputs and outputs¶

To use this notebook interactively, you will have to provide a sum filename path if none exists as an environment variable. All other parameters have reasonable default values.

In [4]:
# figure out whether to save results
SAVE_RESULTS = os.environ.get("SAVE_RESULTS", "TRUE").upper() == "TRUE"

# get infile names
SUM_FILE = os.environ.get("SUM_FILE", None)
# SUM_FILE = '/mnt/sn1/2459797/zen.2459797.30001.sum.uvh5'  # If sum_file is not defined in the environment variables, define it here.
DIFF_FILE = SUM_FILE.replace('sum', 'diff')

# get outfilenames
AM_FILE = (SUM_FILE.replace('.uvh5', '.ant_metrics.hdf5') if SAVE_RESULTS else None)
ANTCLASS_FILE = (SUM_FILE.replace('.uvh5', '.ant_class.csv') if SAVE_RESULTS else None)
OMNICAL_FILE = (SUM_FILE.replace('.uvh5', '.omni.calfits') if SAVE_RESULTS else None)
OMNIVIS_FILE = (SUM_FILE.replace('.uvh5', '.omni_vis.uvh5') if SAVE_RESULTS else None)

for fname in ['SUM_FILE', 'DIFF_FILE', 'AM_FILE', 'ANTCLASS_FILE', 'OMNICAL_FILE', 'OMNIVIS_FILE']:
    print(f"{fname} = '{eval(fname)}'")
SUM_FILE = '/mnt/sn1/2460121/zen.2460121.41976.sum.uvh5'
DIFF_FILE = '/mnt/sn1/2460121/zen.2460121.41976.diff.uvh5'
AM_FILE = '/mnt/sn1/2460121/zen.2460121.41976.sum.ant_metrics.hdf5'
ANTCLASS_FILE = '/mnt/sn1/2460121/zen.2460121.41976.sum.ant_class.csv'
OMNICAL_FILE = '/mnt/sn1/2460121/zen.2460121.41976.sum.omni.calfits'
OMNIVIS_FILE = '/mnt/sn1/2460121/zen.2460121.41976.sum.omni_vis.uvh5'

Parse settings¶

Load settings relating to the operation of the notebook, then print what was loaded (or default).

In [5]:
# parse plotting settings
PLOT = os.environ.get("PLOT", "TRUE").upper() == "TRUE"
if PLOT:
    %matplotlib inline

# parse omnical settings
OC_MAX_DIMS = int(os.environ.get("OC_MAX_DIMS", 4))
OC_MIN_DIM_SIZE = int(os.environ.get("OC_MIN_DIM_SIZE", 8))
OC_SKIP_OUTRIGGERS = os.environ.get("OC_SKIP_OUTRIGGERS", "TRUE").upper() == "TRUE"
OC_MIN_BL_LEN = float(os.environ.get("OC_MIN_BL_LEN", 1))
OC_MAX_BL_LEN = float(os.environ.get("OC_MAX_BL_LEN", 1e100))
OC_MAXITER = int(os.environ.get("OC_MAXITER", 50))
OC_MAX_RERUN = int(os.environ.get("OC_MAX_RERUN", 4))
OC_USE_GPU = os.environ.get("SAVE_RESULTS", "FALSE").upper() == "TRUE"

# parse RFI settings
RFI_DPSS_HALFWIDTH = float(os.environ.get("RFI_DPSS_HALFWIDTH", 300e-9))
RFI_NSIG = float(os.environ.get("RFI_NSIG", 6))

# parse abscal settings
ABSCAL_MODEL_FILES_GLOB = os.environ.get("ABSCAL_MODEL_FILES_GLOB", None)
ABSCAL_MIN_BL_LEN = float(os.environ.get("ABSCAL_MIN_BL_LEN", 1.0))
ABSCAL_MAX_BL_LEN = float(os.environ.get("ABSCAL_MAX_BL_LEN", 140.0))

# print settings
for setting in ['PLOT', 'SAVE_RESULTS', 'OC_MAX_DIMS', 'OC_MIN_DIM_SIZE', 'OC_SKIP_OUTRIGGERS', 
                'OC_MIN_BL_LEN', 'OC_MAX_BL_LEN', 'OC_MAXITER', 'OC_MAX_RERUN',
                'OC_USE_GPU', 'RFI_DPSS_HALFWIDTH', 'RFI_NSIG', 'ABSCAL_MODEL_FILES_GLOB', 
                'ABSCAL_MIN_BL_LEN', 'ABSCAL_MAX_BL_LEN']:
    print(f'{setting} = {eval(setting)}')
PLOT = True
SAVE_RESULTS = True
OC_MAX_DIMS = 4
OC_MIN_DIM_SIZE = 8
OC_SKIP_OUTRIGGERS = True
OC_MIN_BL_LEN = 1.0
OC_MAX_BL_LEN = 1e+100
OC_MAXITER = 50
OC_MAX_RERUN = 4
OC_USE_GPU = False
RFI_DPSS_HALFWIDTH = 3e-07
RFI_NSIG = 6.0
ABSCAL_MODEL_FILES_GLOB = None
ABSCAL_MIN_BL_LEN = 1.0
ABSCAL_MAX_BL_LEN = 140.0

Parse bounds¶

Load settings related to classifying antennas as good, suspect, or bad, then print what was loaded (or default).

In [6]:
# ant_metrics bounds for low correlation / dead antennas
am_corr_bad = (0, float(os.environ.get("AM_CORR_BAD", 0.3)))
am_corr_suspect = (float(os.environ.get("AM_CORR_BAD", 0.3)), float(os.environ.get("AM_CORR_SUSPECT", 0.5)))

# ant_metrics bounds for cross-polarized antennas
am_xpol_bad = (-1, float(os.environ.get("AM_XPOL_BAD", -0.1)))
am_xpol_suspect = (float(os.environ.get("AM_XPOL_BAD", -0.1)), float(os.environ.get("AM_XPOL_SUSPECT", 0)))

# bounds on solar altitude (in degrees)
good_solar_altitude = (-90, float(os.environ.get("SUSPECT_SOLAR_ALTITUDE", 0)))
suspect_solar_altitude = (float(os.environ.get("SUSPECT_SOLAR_ALTITUDE", 0)), 90)

# bounds on zeros in spectra
good_zeros_per_eo_spectrum = (0, int(os.environ.get("MAX_ZEROS_PER_EO_SPEC_GOOD", 2)))
suspect_zeros_per_eo_spectrum = (0, int(os.environ.get("MAX_ZEROS_PER_EO_SPEC_SUSPECT", 8)))

# bounds on autocorrelation power
auto_power_good = (float(os.environ.get("AUTO_POWER_GOOD_LOW", 5)), float(os.environ.get("AUTO_POWER_GOOD_HIGH", 30)))
auto_power_suspect = (float(os.environ.get("AUTO_POWER_SUSPECT_LOW", 1)), float(os.environ.get("AUTO_POWER_SUSPECT_HIGH", 60)))

# bounds on autocorrelation slope
auto_slope_good = (float(os.environ.get("AUTO_SLOPE_GOOD_LOW", -0.4)), float(os.environ.get("AUTO_SLOPE_GOOD_HIGH", 0.4)))
auto_slope_suspect = (float(os.environ.get("AUTO_SLOPE_SUSPECT_LOW", -0.6)), float(os.environ.get("AUTO_SLOPE_SUSPECT_HIGH", 0.6)))

# bounds on autocorrelation RFI
auto_rfi_good = (0, float(os.environ.get("AUTO_RFI_GOOD", 0.015)))
auto_rfi_suspect = (0, float(os.environ.get("AUTO_RFI_SUSPECT", 0.03)))

# bounds on autocorrelation shape
auto_shape_good = (0, float(os.environ.get("AUTO_SHAPE_GOOD", 0.1)))
auto_shape_suspect = (0, float(os.environ.get("AUTO_SHAPE_SUSPECT", 0.2)))

# bounds on chi^2 per antenna in omnical
oc_cspa_good = (0, float(os.environ.get("OC_CSPA_GOOD", 2)))
oc_cspa_suspect = (0, float(os.environ.get("OC_CSPA_SUSPECT", 3)))

# print bounds
for bound in ['am_corr_bad', 'am_corr_suspect', 'am_xpol_bad', 'am_xpol_suspect', 
              'good_solar_altitude', 'suspect_solar_altitude',
              'good_zeros_per_eo_spectrum', 'suspect_zeros_per_eo_spectrum',
              'auto_power_good', 'auto_power_suspect', 'auto_slope_good', 'auto_slope_suspect',
              'auto_rfi_good', 'auto_rfi_suspect', 'auto_shape_good', 'auto_shape_suspect',
              'oc_cspa_good', 'oc_cspa_suspect']:
    print(f'{bound} = {eval(bound)}')
am_corr_bad = (0, 0.2)
am_corr_suspect = (0.2, 0.4)
am_xpol_bad = (-1, -0.1)
am_xpol_suspect = (-0.1, 0.0)
good_solar_altitude = (-90, 0.0)
suspect_solar_altitude = (0.0, 90)
good_zeros_per_eo_spectrum = (0, 2)
suspect_zeros_per_eo_spectrum = (0, 8)
auto_power_good = (5.0, 30.0)
auto_power_suspect = (1.0, 60.0)
auto_slope_good = (-0.4, 0.4)
auto_slope_suspect = (-0.6, 0.6)
auto_rfi_good = (0, 0.015)
auto_rfi_suspect = (0, 0.03)
auto_shape_good = (0, 0.1)
auto_shape_suspect = (0, 0.2)
oc_cspa_good = (0, 2.0)
oc_cspa_suspect = (0, 3.0)

Load sum and diff data¶

In [7]:
hd = io.HERADataFastReader(SUM_FILE)
data, _, _ = hd.read(read_flags=False, read_nsamples=False)
hd_diff = io.HERADataFastReader(DIFF_FILE)
diff_data, _, _ = hd_diff.read(read_flags=False, read_nsamples=False)
In [8]:
ants = sorted(set([ant for bl in hd.bls for ant in utils.split_bl(bl)]))
auto_bls = [bl for bl in data if (bl[0] == bl[1]) and (utils.split_pol(bl[2])[0] == utils.split_pol(bl[2])[1])]
antpols = sorted(set([ant[1] for ant in ants]))
In [9]:
# print basic information about the file
print(f'File: {SUM_FILE}')
print(f'JDs: {hd.times} ({np.median(np.diff(hd.times)) * 24 * 3600:.5f} s integrations)')
print(f'LSTS: {hd.lsts * 12 / np.pi } hours')
print(f'Frequencies: {len(hd.freqs)} {np.median(np.diff(hd.freqs)) / 1e6:.5f} MHz channels from {hd.freqs[0] / 1e6:.5f} to {hd.freqs[-1] / 1e6:.5f} MHz')
print(f'Antennas: {len(hd.data_ants)}')
print(f'Polarizations: {hd.pols}')
File: /mnt/sn1/2460121/zen.2460121.41976.sum.uvh5
JDs: [2460121.41970323 2460121.41981508] (9.66368 s integrations)
LSTS: [17.75368406 17.75637577] hours
Frequencies: 1536 0.12207 MHz channels from 46.92078 to 234.29871 MHz
Antennas: 205
Polarizations: ['nn', 'ee', 'ne', 'en']

Classify good, suspect, and bad antpols¶

Run ant_metrics¶

This classifies antennas as cross-polarized, low-correlation, or dead. Such antennas are excluded from any calibration.

In [10]:
am = ant_metrics.AntennaMetrics(SUM_FILE, DIFF_FILE, sum_data=data, diff_data=diff_data)
am.iterative_antenna_metrics_and_flagging(crossCut=am_xpol_bad[1], deadCut=am_corr_bad[1])
am.all_metrics = {}  # this saves time and disk by getting rid of per-iteration information we never use
if SAVE_RESULTS:
    am.save_antenna_metrics(AM_FILE, overwrite=True)
In [11]:
# Turn ant metrics into classifications
totally_dead_ants = [ant for ant, i in am.xants.items() if i == -1]
am_totally_dead = ant_class.AntennaClassification(good=[ant for ant in ants if ant not in totally_dead_ants], bad=totally_dead_ants)
am_corr = ant_class.antenna_bounds_checker(am.final_metrics['corr'], bad=[am_corr_bad], suspect=[am_corr_suspect], good=[(0, 1)])
am_xpol = ant_class.antenna_bounds_checker(am.final_metrics['corrXPol'], bad=[am_xpol_bad], suspect=[am_xpol_suspect], good=[(-1, 1)])
ant_metrics_class = am_totally_dead + am_corr + am_xpol

Mark sun-up (or high solar altitude) data as suspect¶

In [12]:
min_sun_alt = np.min(utils.get_sun_alt(hd.times))
solar_class = ant_class.antenna_bounds_checker({ant: min_sun_alt for ant in ants}, good=[good_solar_altitude], suspect=[suspect_solar_altitude])

Classify antennas responsible for 0s in visibilities as bad:¶

This classifier looks for X-engine failure or packet loss specific to an antenna which causes either the even visibilities (or the odd ones, or both) to be 0s.

In [13]:
zeros_class = ant_class.even_odd_zeros_checker(data, diff_data, good=good_zeros_per_eo_spectrum, suspect=suspect_zeros_per_eo_spectrum)
In [14]:
# delete diffs to save memory
del diff_data, hd_diff
malloc_trim()

Examine and classify autocorrelation power, slope, and RFI occpancy¶

These classifiers look for antennas with too high or low power, to steep a slope, or too much excess RFI.

In [15]:
auto_power_class = ant_class.auto_power_checker(data, good=auto_power_good, suspect=auto_power_suspect)
auto_slope_class = ant_class.auto_slope_checker(data, good=auto_slope_good, suspect=auto_slope_suspect, edge_cut=100, filt_size=17)
cache = {}
auto_rfi_class = ant_class.auto_rfi_checker(data, good=auto_rfi_good, suspect=auto_rfi_suspect, 
                                            filter_half_widths=[RFI_DPSS_HALFWIDTH], nsig=RFI_NSIG, cache=cache)
auto_class = auto_power_class + auto_slope_class + auto_rfi_class
In [16]:
del cache
malloc_trim()

Find and flag RFI¶

In [17]:
# Compute int_count for all unflagged autocorrelations averaged together
int_time = 24 * 3600 * np.median(np.diff(data.times_by_bl[auto_bls[0][0:2]]))
chan_res = np.median(np.diff(data.freqs))
final_class = ant_metrics_class + zeros_class + auto_class
int_count = int(int_time * chan_res) * (len(final_class.good_ants) + len(final_class.suspect_ants))
avg_auto = {(-1, -1, 'ee'): np.mean([data[bl] for bl in auto_bls if final_class[utils.split_bl(bl)[0]] != 'bad'], axis=0)}
# Flag RFI first with channel differences and then with DPSS
antenna_flags, _ = xrfi.flag_autos(avg_auto, int_count=int_count, nsig=(RFI_NSIG * 5))
_, rfi_flags = xrfi.flag_autos(avg_auto, int_count=int_count, flag_method='dpss_flagger',
                               flags=antenna_flags, freqs=data.freqs, filter_centers=[0],
                               filter_half_widths=[RFI_DPSS_HALFWIDTH], eigenval_cutoff=[1e-9], nsig=RFI_NSIG)
malloc_trim()
In [18]:
def rfi_plot():
    plt.figure(figsize=(12, 5), dpi=100)
    plt.semilogy(hd.freqs / 1e6, np.where(rfi_flags, np.nan, avg_auto[(-1, -1, 'ee')])[1], label = 'Average Good or Suspect Autocorrelation', zorder=100)
    plt.semilogy(hd.freqs / 1e6, np.where(False, np.nan, avg_auto[(-1, -1, 'ee')])[1], 'r', lw=.5, label=f'{np.sum(rfi_flags[0])} Channels Flagged for RFI')
    plt.legend()
    plt.xlabel('Frequency (MHz)')
    plt.ylabel('Uncalibrated Autocorrelation')
    plt.tight_layout()

Figure 1: RFI Flagging¶

This figure shows RFI identified using the average of all autocorrelations---excluding bad antennas---for the first integration in the file.

In [19]:
rfi_plot()
In [20]:
def autocorr_plot(cls):    
    fig, axes = plt.subplots(1, 2, figsize=(14, 5), dpi=100, sharey=True, gridspec_kw={'wspace': 0})
    labels = []
    colors = ['darkgreen', 'goldenrod', 'maroon']
    for ax, pol in zip(axes, antpols):
        for ant in cls.ants:
            if ant[1] == pol:
                color = colors[cls.quality_classes.index(cls[ant])]
                ax.semilogy(np.mean(data[utils.join_bl(ant, ant)], axis=0), color=color, lw=.5)
        ax.set_xlabel('Channel', fontsize=12)
        ax.set_title(f'{utils.join_pol(pol, pol)}-Polarized Autos')

    axes[0].set_ylabel('Raw Autocorrelation', fontsize=12)
    axes[1].legend([matplotlib.lines.Line2D([0], [0], color=color) for color in colors], 
                   [cls.capitalize() for cls in auto_class.quality_classes], ncol=1, fontsize=12, loc='upper right', framealpha=1)
    plt.tight_layout()

Classify antennas based on shapes, excluding RFI-contamined channels¶

In [21]:
auto_shape_class = ant_class.auto_shape_checker(data, good=auto_shape_good, suspect=auto_shape_suspect,
                                                flag_spectrum=np.sum(rfi_flags, axis=0).astype(bool), antenna_class=final_class)
auto_class += auto_shape_class

Figure 2: Plot of autocorrelations with classifications¶

This figure shows a plot of all autocorrelations in the array, split by polarization. Antennas are classified based on their autocorrelations into good, suspect, and bad, by examining power, slope, and RFI-occupancy.

In [22]:
if PLOT: autocorr_plot(auto_class)

Summarize antenna classification prior to redundant-baseline calibration¶

In [23]:
final_class = ant_metrics_class + solar_class + zeros_class + auto_class
In [24]:
def array_class_plot(cls, extra_label=""):
    outriggers = [ant for ant in hd.data_ants if ant >= 320]

    if len(outriggers) > 0:
        fig, axes = plt.subplots(1, 2, figsize=(14, 6), dpi=100, gridspec_kw={'width_ratios': [2, 1]})
        plot_antclass(hd.antpos, cls, ax=axes[0], ants=[ant for ant in hd.data_ants if ant < 320], legend=False, title=f'HERA Core{extra_label}')
        plot_antclass(hd.antpos, cls, ax=axes[1], ants=outriggers, radius=50, title='Outriggers')
    else:
        fig, axes = plt.subplots(1, 1, figsize=(9, 6), dpi=100)
        plot_antclass(hd.antpos, cls, ax=axes, ants=[ant for ant in hd.data_ants if ant < 320], legend=False, title=f'HERA Core{extra_label}')

Figure 3: Summary of antenna classifications prior to calibration¶

This figure shows the location and classification of all antennas prior to calibration. Antennas are split along the diagonal, with ee-polarized antpols represented by the southeast half of each antenna and nn-polarized antpols represented by the northwest half. Outriggers are split from the core and shown at exaggerated size in the right-hand panel. This classification includes ant_metrics, a count of the zeros in the even or odd visibilities, and autocorrelation power, slope, and RFI occupancy. An antenna classified as bad in any classification will be considered bad. An antenna marked as suspect any in any classification will be considered suspect unless it is also classified as bad elsewhere.

In [25]:
if PLOT: array_class_plot(final_class)

Perform redundant-baseline calibration¶

In [26]:
def classify_off_grid(reds, all_ants):
    '''Returns AntennaClassification of all_ants where good ants are in reds while bad ants are not.'''
    ants_in_reds = set([ant for red in reds for bl in red for ant in utils.split_bl(bl)])
    on_grid = [ant for ant in all_ants if ant in ants_in_reds]
    off_grid = [ant for ant in all_ants if ant not in ants_in_reds]
    return ant_class.AntennaClassification(good=on_grid, bad=off_grid)
In [27]:
def per_pol_filter_reds(reds, pols=['nn', 'ee'], **kwargs):
    '''Performs redcal filtering separately on polarizations (which might have different min_dim_size issues).'''
    return [red for pol in pols for red in redcal.filter_reds(copy.deepcopy(reds), pols=[pol], **kwargs)]

Perform iterative redcal¶

In [28]:
redcal_start = time.time()
rc_settings = {'max_dims': OC_MAX_DIMS, 'oc_conv_crit': 1e-10, 'gain': 0.4, 'run_logcal': False,
               'oc_maxiter': OC_MAXITER, 'check_after': OC_MAXITER, 'use_gpu': OC_USE_GPU}
fr_settings = {'max_dims': OC_MAX_DIMS, 'min_dim_size': OC_MIN_DIM_SIZE, 'min_bl_cut': OC_MIN_BL_LEN, 'max_bl_cut': OC_MAX_BL_LEN}

# figure out and filter reds and classify antennas based on whether or not they are on the main grid
reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], pol_mode='2pol')
reds = per_pol_filter_reds(reds, ex_ants=final_class.bad_ants, antpos=hd.data_antpos, **fr_settings)

if OC_SKIP_OUTRIGGERS:
    reds = redcal.filter_reds(reds, ex_ants=[ant for ant in ants if ant[0] >= 320])
redcal_class = classify_off_grid(reds, ants)

# perform first stage of redundant calibration, 
meta, sol = redcal.redundantly_calibrate(data, reds, **rc_settings)
malloc_trim()
max_dly = np.max(np.abs(list(meta['fc_meta']['dlys'].values())))
med_cspa = {ant: np.nanmedian(meta['chisq_per_ant'][ant]) for ant in meta['chisq_per_ant']}
cspa_class = ant_class.antenna_bounds_checker(med_cspa, good=np.array(oc_cspa_good)*5, suspect=np.array(oc_cspa_suspect)*5, bad=(0, np.inf))
redcal_class += cspa_class
print(f'Removing {cspa_class.bad_ants} for high chi^2.')

# iteratively rerun redundant calibration
for i in range(OC_MAX_RERUN):
    # refilter reds and update classification to reflect new off-grid ants, if any
    reds = per_pol_filter_reds(reds, ex_ants=(final_class + redcal_class).bad_ants, antpos=hd.data_antpos, **fr_settings)
    reds = sorted(reds, key=len, reverse=True)
    redcal_class += classify_off_grid(reds, ants)
    ants_in_reds = set([ant for red in reds for bl in red for ant in utils.split_bl(bl)])    
    if np.logical_or(*[np.all([redcal_class[ant] == 'bad' for ant in sol.gains if ant[1] == pol]) for pol in ['Jee', 'Jnn']]):
        print('An entire polarization has been flagged. Stopping redcal.')
        for ant in redcal_class:
            redcal_class[ant] = 'bad'
        break   

    # re-run redundant calibration using previous solution, updating bad and suspicious antennas
    meta, sol = redcal.redundantly_calibrate(data, reds, sol0=sol, **rc_settings)
    malloc_trim()
    
    # recompute chi^2 for bad antennas without bad antennas to make sure they are actually bad
    med_cspa = {ant: np.nanmedian(meta['chisq_per_ant'][ant]) for ant in meta['chisq_per_ant']}
    sol2 = redcal.RedSol(sol.reds, gains={ant: sol[ant] for ant in med_cspa if med_cspa[ant] <= oc_cspa_suspect[1]}, vis=sol.vis)
    new_chisq_per_ant = {ant: np.array(meta['chisq_per_ant'][ant]) for ant in sol2.gains}
    redcal.expand_omni_gains(sol2, reds, data, chisq_per_ant=new_chisq_per_ant)
    for ant in med_cspa:
        if ant in new_chisq_per_ant:
            if np.any(np.isfinite(new_chisq_per_ant[ant])):
                if not np.all(np.isclose(new_chisq_per_ant[ant], 0)):
                    new_med_cspa = np.nanmedian(new_chisq_per_ant[ant])
                    if new_med_cspa > 0:
                        med_cspa[ant] = np.min([med_cspa[ant], new_med_cspa])
    
    # remove bad antennas
    cspa_class = ant_class.antenna_bounds_checker(med_cspa, good=oc_cspa_good, suspect=oc_cspa_suspect, bad=[(-np.inf, np.inf)])
    redcal_class += cspa_class
    print(f'Removing {cspa_class.bad_ants} for high chi^2.')
    if len(cspa_class.bad_ants) == 0:
        break  # no new antennas to flag

print(f'Finished redcal in {(time.time() - redcal_start) / 60:.2f} minutes.')
Removing set() for high chi^2.
Removing {(4, 'Jnn'), (41, 'Jee'), (17, 'Jee'), (151, 'Jee'), (86, 'Jnn'), (103, 'Jee')} for high chi^2.
Removing {(109, 'Jee')} for high chi^2.
Removing set() for high chi^2.
Finished redcal in 3.85 minutes.
In [29]:
final_class += redcal_class

Expand solution to include calibratable baselines excluded from redcal (e.g. because they were too long)¶

In [30]:
expanded_reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], pol_mode='2pol')
expanded_reds = per_pol_filter_reds(expanded_reds, ex_ants=(ant_metrics_class + solar_class + zeros_class + auto_class).bad_ants,
                                    max_dims=OC_MAX_DIMS, min_dim_size=OC_MIN_DIM_SIZE)
if OC_SKIP_OUTRIGGERS:
    expanded_reds = redcal.filter_reds(expanded_reds, ex_ants=[ant for ant in ants if ant[0] >= 320])
redcal.expand_omni_vis(sol, expanded_reds, data, chisq=meta['chisq'], chisq_per_ant=meta['chisq_per_ant'])
In [31]:
# now figure out flags, nsamples etc.
omni_flags = {ant: (~np.isfinite(g)) | (ant in final_class.bad_ants) for ant, g in sol.gains.items()}
vissol_flags = datacontainer.RedDataContainer({bl: ~np.isfinite(v) for bl, v in sol.vis.items()}, reds=sol.vis.reds)
single_nsamples_array = np.ones((len(hd.times), len(hd.freqs)), dtype=float)
nsamples = datacontainer.DataContainer({bl: single_nsamples_array for bl in data})
vissol_nsamples = redcal.count_redundant_nsamples(nsamples, [red for red in expanded_reds if red[0] in vissol_flags], 
                                                  good_ants=[ant for ant in final_class if ant not in final_class.bad_ants])
for bl in vissol_flags:
    vissol_flags[bl][vissol_nsamples[bl] == 0] = True
sol.make_sol_finite()        

Fix the firstcal delay slope degeneracy using RFI transmitters¶

In [32]:
# find channels clearly contaminated by RFI
not_bad_ants = [ant for ant in final_class.ants if final_class[ant] != 'bad']
if len(not_bad_ants) > 0:
    chan_flags = np.mean([xrfi.detrend_medfilt(data[utils.join_bl(ant, ant)], Kf=8, Kt=2) for ant in not_bad_ants], axis=(0, 1)) > 5

    # hardcoded RFI transmitters and their headings
    # channel: frequency (Hz), heading (rad), chi^2
    phs_sol = {359: ( 90744018.5546875, 0.7853981, 23.3),
               360: ( 90866088.8671875, 0.7853981, 10.8),
               385: ( 93917846.6796875, 0.7853981, 27.3),
               386: ( 94039916.9921875, 0.7853981, 18.1),
               400: ( 95748901.3671875, 6.0632738, 24.0),
               441: (100753784.1796875, 0.7853981, 21.7),
               442: (100875854.4921875, 0.7853981, 19.4),
               455: (102462768.5546875, 6.0632738, 18.8),
               456: (102584838.8671875, 6.0632738,  8.8),
               471: (104415893.5546875, 0.7853981, 13.3),
               484: (106002807.6171875, 6.0632738, 21.2),
               485: (106124877.9296875, 6.0632738,  4.0),
              1181: (191085815.4296875, 0.7853981, 26.3),
              1182: (191207885.7421875, 0.7853981, 27.0),
              1183: (191329956.0546875, 0.7853981, 25.6),
              1448: (223678588.8671875, 2.6075219, 25.7),
              1449: (223800659.1796875, 2.6075219, 22.6),
              1450: (223922729.4921875, 2.6075219, 11.6),
              1451: (224044799.8046875, 2.6075219,  5.9),
              1452: (224166870.1171875, 2.6075219, 22.6),
              1510: (231246948.2421875, 0.1068141, 23.9)}

    if not np.isclose(hd.freqs[0], 46920776.3671875, atol=0.001) or len(hd.freqs) != 1536:
        # We have less frequencies than usual (maybe testing)
        phs_sol = {np.argmin(np.abs(hd.freqs - freq)): (freq, heading, chisq) for chan, (freq, heading, chisq) in phs_sol.items() if hd.freqs[0] <= freq <= hd.freqs[-1]}


    rfi_chans = [chan for chan in phs_sol if chan_flags[chan]]
    print('Channels used for delay-slope calibration with RFI:', rfi_chans)
    rfi_angles = np.array([phs_sol[chan][1] for chan in rfi_chans])
    rfi_headings = np.array([np.cos(rfi_angles), np.sin(rfi_angles), np.zeros_like(rfi_angles)])
    rfi_chisqs = np.array([phs_sol[chan][2] for chan in rfi_chans])
    
    # resolve firstcal degeneracy with delay slopes set by RFI transmitters, update cal
    RFI_dly_slope_gains = abscal.RFI_delay_slope_cal([red for red in expanded_reds if red[0] in sol.vis], hd.antpos, sol.vis, hd.freqs, rfi_chans, rfi_headings, rfi_wgts=rfi_chisqs**-1,
                                                     min_tau=-max_dly, max_tau=max_dly, delta_tau=0.1e-9, return_gains=True, gain_ants=sol.gains.keys())
    sol.gains = {ant: g * RFI_dly_slope_gains[ant] for ant, g in sol.gains.items()}
    apply_cal.calibrate_in_place(sol.vis, RFI_dly_slope_gains)
    malloc_trim()
Channels used for delay-slope calibration with RFI: [359, 360, 385, 386, 400, 441, 442, 455, 456, 471, 484, 485]

Perform absolute amplitude calibration using a model of autocorrelations¶

In [33]:
# Load simulated and then downsampled model of autocorrelations that includes receiver noise, then interpolate to upsample
hd_model = io.HERADataFastReader(f'{HNBT_DATA}/SSM_autocorrelations_downsampled.uvh5')
model, _, _ = hd_model.read(read_flags=False, read_nsamples=False)
per_pol_interpolated_model = {}
for bl in model:
    sorted_lsts, lst_indices = np.unique(model.lsts, return_index=True)
    periodic_model = np.vstack([model[bl][lst_indices, :], model[bl][lst_indices[0], :]])
    periodic_lsts = np.append(sorted_lsts, sorted_lsts[0] + 2 * np.pi)
    lst_interpolated = interpolate.CubicSpline(periodic_lsts, periodic_model, axis=0, bc_type='periodic')(data.lsts)
    per_pol_interpolated_model[bl[2]] = interpolate.CubicSpline(model.freqs, lst_interpolated, axis=1)(data.freqs)
model = {bl: per_pol_interpolated_model[bl[2]] for bl in auto_bls if utils.split_bl(bl)[0] not in final_class.bad_ants}
In [34]:
# Run abscal and update omnical gains with abscal gains
if len(model) > 0:
    redcaled_autos = {bl: sol.calibrate_bl(bl, data[bl]) for bl in auto_bls if utils.split_bl(bl)[0] not in final_class.bad_ants}
    g_abscal = abscal.abs_amp_logcal(model, redcaled_autos, verbose=False, return_gains=True, gain_ants=sol.gains)
    sol.gains = {ant: g * g_abscal[ant] for ant, g in sol.gains.items()}
    apply_cal.calibrate_in_place(sol.vis, g_abscal)
    del redcaled_autos, g_abscal
In [35]:
del hd_model, model
malloc_trim()

Full absolute calibration of phase gradients¶

If an ABSCAL_MODEL_FILES_GLOB is provided, try to perform a full absolute calibration of tip-tilt phase gradients across the array using that those model files. Specifically, this step calibrates omnical visbility solutions using unique baselines simulated with a model of the sky and HERA's beam.

In [36]:
if ABSCAL_MODEL_FILES_GLOB is not None:
    abscal_model_files = sorted(glob.glob(ABSCAL_MODEL_FILES_GLOB))
else:
    # try to find files on site
    abscal_model_files = sorted(glob.glob('/mnt/sn1/abscal_models/H4C_1/abscal_files_unique_baselines/zen.2458894.?????.uvh5'))
    if len(abscal_model_files) == 0:
        # try to find files at NRAO
        abscal_model_files = sorted(glob.glob('/lustre/aoc/projects/hera/zmartino/hera_calib_model/H4C_1/abscal_files_unique_baselines/zen.2458894.?????.uvh5'))
print(f'Found {len(abscal_model_files)} abscal model files{" in " + os.path.dirname(abscal_model_files[0]) if len(abscal_model_files) > 0 else ""}.')
Found 425 abscal model files in /mnt/sn1/abscal_models/H4C_1/abscal_files_unique_baselines.
In [37]:
# Try to perform a full abscal of phase
if len(abscal_model_files) == 0:
    DO_FULL_ABSCAL = False
    print('No model files found... not performing full absolute calibration of phase gradients.')
elif np.all([ant in final_class.bad_ants for ant in ants]):
    DO_FULL_ABSCAL = False
    print('All antennas classified as bad... skipping absolute calibration of phase gradients.')
else:
    abscal_start = time.time()
    # figure out which model files match the LSTs of the data
    matched_model_files = sorted(set(abscal.match_times(SUM_FILE, abscal_model_files, filetype='uvh5')))
    if len(matched_model_files) == 0:
        DO_FULL_ABSCAL = False
        print(f'No model files found matching the LSTs of this file after searching for {(time.time() - abscal_start) / 60:.2f} minutes. '
              'Not performing full absolute calibration of phase gradients.')
    else:
        DO_FULL_ABSCAL = True
        # figure out appropriate model times to load
        hdm = io.HERAData(matched_model_files)
        all_model_times, all_model_lsts = abscal.get_all_times_and_lsts(hdm, unwrap=True)
        d2m_time_map = abscal.get_d2m_time_map(data.times, np.unwrap(data.lsts), all_model_times, all_model_lsts, extrap_limit=.5)
In [38]:
if DO_FULL_ABSCAL:
    abscal_meta = {}
    for pol in ['ee', 'nn']:
        print(f'Performing absolute phase gradient calibration of {pol}-polarized visibility solutions...')
        
        # load matching times and baselines
        unflagged_data_bls = [bl for bl in vissol_flags if not np.all(vissol_flags[bl]) and bl[2] == pol]
        model_bls = copy.deepcopy(hdm.bls)
        model_antpos = hdm.data_antpos
        if len(matched_model_files) > 1:  # in this case, it's a dictionary
            model_bls = list(set([bl for bls in list(hdm.bls.values()) for bl in bls]))
            model_antpos = {ant: pos for antpos in hdm.data_antpos.values() for ant, pos in antpos.items()}
        data_bls, model_bls, data_to_model_bl_map = abscal.match_baselines(unflagged_data_bls, model_bls, data.antpos, model_antpos=model_antpos, 
                                                                         pols=[pol], data_is_redsol=True, model_is_redundant=True, tol=1.0,
                                                                         min_bl_cut=ABSCAL_MIN_BL_LEN, max_bl_cut=ABSCAL_MAX_BL_LEN, verbose=True)
        model, model_flags, _ = io.partial_time_io(hdm, np.unique([d2m_time_map[time] for time in data.times]), bls=model_bls)
        model_bls = [data_to_model_bl_map[bl] for bl in data_bls]
        
        # rephase model to match in lsts
        model_blvecs = {bl: model.antpos[bl[0]] - model.antpos[bl[1]] for bl in model.keys()}
        utils.lst_rephase(model, model_blvecs, model.freqs, data.lsts - model.lsts,
                          lat=hdm.telescope_location_lat_lon_alt_degrees[0], inplace=True)

        # run abscal and apply 
        abscal_meta[pol], delta_gains = abscal.complex_phase_abscal(sol.vis, model, sol.reds, data_bls, model_bls)
        
        # apply gains
        sol.gains = {antpol : g * delta_gains.get(antpol, 1) for antpol, g in sol.gains.items()}
        apply_cal.calibrate_in_place(sol.vis, delta_gains)            
    
    del hdm, model, model_flags, delta_gains
    malloc_trim()
    
    print(f'Finished absolute calibration of tip-tilt phase slopes in {(time.time() - abscal_start) / 60:.2f} minutes.')
Performing absolute phase gradient calibration of ee-polarized visibility solutions...
Selected 307 data baselines and 307 model baselines to load.
WARNING:jax._src.lib.xla_bridge:No GPU/TPU found, falling back to CPU. (Set TF_CPP_MIN_LOG_LEVEL=0 and rerun for more info.)
Performing absolute phase gradient calibration of nn-polarized visibility solutions...
Selected 366 data baselines and 366 model baselines to load.
Finished absolute calibration of tip-tilt phase slopes in 0.79 minutes.
In [39]:
def redundant_group_plot():
    if np.all([ant in final_class.bad_ants for ant in ants]):
        print('All antennas classified as bad. Nothing to plot.')
        return
    
    fig, axes = plt.subplots(2, 2, figsize=(14, 6), dpi=100, sharex='col', sharey='row', gridspec_kw={'hspace': 0, 'wspace': 0})
    for i, pol in enumerate(['ee', 'nn']):
        reds_here = redcal.get_reds(hd.data_antpos, pols=[pol], pol_mode='1pol')
        red = sorted(redcal.filter_reds(reds_here, ex_ants=final_class.bad_ants), key=len, reverse=True)[0]
        rc_data = {bl: sol.calibrate_bl(bl, data[bl]) for bl in red}
        for bl in red:
            axes[0, i].plot(hd.freqs/1e6, np.angle(rc_data[bl][0]), alpha=.5, lw=.5)
            axes[1, i].semilogy(hd.freqs/1e6, np.abs(rc_data[bl][0]), alpha=.5, lw=.5)
        axes[0, i].plot(hd.freqs / 1e6, np.angle(sol.vis[red[0]][0]), lw=1, c='k')
        axes[1, i].semilogy(hd.freqs / 1e6, np.abs(sol.vis[red[0]][0]), lw=1, c='k', label=f'Baseline Group:\n{red[0]}')
        axes[1, i].set_xlabel('Frequency (MHz)')
        axes[1, i].legend(loc='upper right')
    axes[0, 0].set_ylabel('Visibility Phase (radians)')
    axes[1, 0].set_ylabel('Visibility Amplitude (Jy)')
    plt.tight_layout()
In [40]:
def abscal_degen_plot():
    if DO_FULL_ABSCAL:
        fig, axes = plt.subplots(3, 1, figsize=(14, 6), dpi=100, sharex=True, gridspec_kw={'hspace': .05})

        for ax, pol in zip(axes[:2], ['ee', 'nn']):
            for kk in range(abscal_meta[pol]['Lambda_sol'].shape[-1]):
                ax.plot(hd.freqs[~rfi_flags[0]] * 1e-6, abscal_meta[pol]['Lambda_sol'][0, ~rfi_flags[0], kk], '.', ms=1, label=f"Component {kk}")

            ax.set_ylim(-np.pi-0.5, np.pi+0.5)
            ax.set_xlabel('Frequency (MHz)')
            ax.set_ylabel('Phase Gradient\nVector Component')
            ax.legend(markerscale=20, title=f'{pol}-polarization', loc='lower right')
            ax.grid()
            
        for pol, color in zip(['ee', 'nn'], ['b', 'r']):
            axes[2].plot(hd.freqs[~rfi_flags[0]]*1e-6, abscal_meta[pol]['Z_sol'].real[0, ~rfi_flags[0]], '.', ms=1, label=pol, color=color)
        axes[2].set_ylim(-.25, 1.05)
        axes[2].set_ylabel('Re[Z($\\nu$)]')
        axes[2].legend(markerscale=20, loc='lower right')
        axes[2].grid()            
        plt.tight_layout()

Figure 4: Redundant calibration of a single baseline group¶

The results of a redundant-baseline calibration of a single integration and a single group, the one with the highest redundancy in each polarization after antenna classification and excision based on the above, plus the removal of antennas with high chi^2 per antenna. The black line is the redundant visibility solution. Each thin colored line is a different baseline group. Phases are shown in the top row, amplitudes in the bottom, ee-polarized visibilities in the left column, and nn-polarized visibilities in the right.

In [41]:
if PLOT: redundant_group_plot()

Figure 5: Absolute calibration of redcal degeneracies¶

This figure shows the per-frequency phase gradient solutions across the array for both polarizations and all components of the degenerate subspace of redundant-baseline calibraton. While full HERA only has two such tip-tilt degeneracies, a subset of HERA can have up to OC_MAX_DIMS (depending on antenna flagging). In addition to the absolute amplitude, this is the full set of the calibration degrees of freedom not constrainted by redcal. This figure also includes a plot of Re[Z(ν)]Re[Z(ν)], the complex objective function which varies from -1 to 1 and indicates how well the data and the absolute calibration model have been made to agree. Perfect agreement is 1.0 and good agreement is anything above ∼∼0.5 Decorrelation yields values closer to 0, where anything below ∼∼0.3 is suspect.

In [42]:
if PLOT: abscal_degen_plot()

Attempt to calibrate some flagged antennas¶

This attempts to calibrate bad antennas using information from good or suspect antennas without allowing bad antennas to affect their calibration. However, introducing 0s in gains or infs/nans in gains or visibilities can create problems down the line, so those are removed.

In [43]:
expanded_reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], pol_mode='2pol')
sol.vis.build_red_keys(expanded_reds)
redcal.expand_omni_gains(sol, expanded_reds, data, chisq_per_ant=meta['chisq_per_ant'])
redcal.expand_omni_vis(sol, expanded_reds, data)

# Replace zeros in gains and infs/nans in gains/sols
for ant in sol.gains:
    zeros_in_gains = (sol.gains[ant] == 0)
    if ant in omni_flags:
        omni_flags[ant][zeros_in_gains] = True
    sol.gains[ant][zeros_in_gains] = 1.0 + 0.0j
sol.make_sol_finite()
malloc_trim()
In [44]:
def array_chisq_plot():
    fig, axes = plt.subplots(1, 2, figsize=(14, 5), dpi=100)
    for ax, pol in zip(axes, ['ee', 'nn']):
        ants_to_plot = set([ant for ant in meta['chisq_per_ant'] if utils.join_pol(ant[1], ant[1]) == pol])
        cspas = np.array([np.nanmedian(meta['chisq_per_ant'][ant]) for ant in ants_to_plot])
        xpos = [hd.antpos[ant[0]][0] for ant in ants_to_plot]
        ypos = [hd.antpos[ant[0]][1] for ant in ants_to_plot]
        scatter = ax.scatter(xpos, ypos, s=300, c=cspas, lw=.25, edgecolors=np.where(np.isfinite(cspas) & (cspas > 0), 'none', 'k'), 
                             norm=matplotlib.colors.LogNorm(vmin=1, vmax=oc_cspa_suspect[1]))
        for ant in ants_to_plot:
            ax.text(hd.antpos[ant[0]][0], hd.antpos[ant[0]][1], ant[0], va='center', ha='center', fontsize=8,
                    c=('r' if ant in final_class.bad_ants else 'w'))
        plt.colorbar(scatter, ax=ax, extend='both')
        ax.axis('equal')
        ax.set_xlabel('East-West Position (meters)')
        ax.set_ylabel('North-South Position (meters)')
        ax.set_title(f'{pol}-pol $\\chi^2$ / Antenna (Red is Flagged)')
    plt.tight_layout()

Figure 6: chi^2 per antenna across the array¶

This plot shows median (taken over time and frequency) of the normalized chi^2 per antenna. The expectation value for this quantity when the array is perfectly redundant is 1.0. Antennas that are classified as bad for any reason have their numbers shown in red. Some of those antennas were classified as bad during redundant calibration for high chi^2. Some of those antennas were originally excluded from redundant calibration because they were classified as bad earlier for some reason. See here for more details. Note that the color scale saturates at below 1 and above 10.

In [45]:
if PLOT: array_chisq_plot()

Figure 7: Summary of antenna classifications after redundant calibration¶

This figure is the same as Figure 2, except that it now includes additional suspect or bad antennas based on redundant calibration. This can include antennas with high chi^2, but it can also include antennas classified as "bad" because they would add extra degeneracies to calibration.

In [46]:
if PLOT: array_class_plot(final_class, extra_label=", Post-Redcal")
In [47]:
to_show = {'Antenna': [f'{ant[0]}{ant[1][-1]}' for ant in ants]}
classes = {'Antenna': [final_class[ant] if ant in final_class else '-' for ant in ants]}
to_show['Dead?'] = [{'good': 'No', 'bad': 'Yes'}[am_totally_dead[ant]] if (ant in am_totally_dead) else '' for ant in ants]
classes['Dead?'] = [am_totally_dead[ant] if (ant in am_totally_dead) else '' for ant in ants]
for title, ac in [('Low Correlation', am_corr),
                  ('Cross-Polarized', am_xpol),
                  ('Solar Alt', solar_class),
                  ('Even/Odd Zeros', zeros_class),
                  ('Autocorr Power', auto_power_class),
                  ('Autocorr Slope', auto_slope_class),
                  ('RFI in Autos', auto_rfi_class),
                  ('Autocorr Shape', auto_shape_class)]:
    to_show[title] = [f'{ac._data[ant]:.2G}' if (ant in ac._data) else '' for ant in ants]
    classes[title] = [ac[ant] if ant in ac else '' for ant in ants]
    
to_show['Redcal chi^2'] = [f'{np.nanmedian(meta["chisq_per_ant"][ant]):.3G}' if (ant in meta['chisq_per_ant']) else '-' for ant in ants]
classes['Redcal chi^2'] = [redcal_class[ant] if ant in redcal_class else '' for ant in ants]

df = pd.DataFrame(to_show)
df_classes = pd.DataFrame(classes)
colors = {'good': 'darkgreen', 'suspect': 'goldenrod', 'bad': 'maroon'}
df_colors = df_classes.applymap(lambda x: f'background-color: {colors.get(x, None)}')

table = df.style.hide() \
                .apply(lambda x: pd.DataFrame(df_colors.values, columns=x.columns), axis=None) \
                .set_properties(subset=['Antenna'], **{'font-weight': 'bold', 'border-right': "3pt solid black"}) \
                .set_properties(subset=df.columns[1:], **{'border-left': "1pt solid black"}) \
                .set_properties(**{'text-align': 'center', 'color': 'white'})

Table 1: Complete summary of per-antenna classifications¶

This table summarizes the results of the various classifications schemes detailed above. As before, green is good, yellow is suspect, and red is bad. The color for each antenna (first column) is the final summary of all other classifications. Antennas missing from redcal χ2χ2 were excluded redundant-baseline calibration, either because they were flagged by ant_metrics or the even/odd zeros check, or because they would add unwanted extra degeneracies.

In [48]:
HTML(table.to_html())
Out[48]:
Antenna Dead? Low Correlation Cross-Polarized Solar Alt Even/Odd Zeros Autocorr Power Autocorr Slope RFI in Autos Autocorr Shape Redcal chi^2
3e No 0.84 0.6 -80 0 40 0.49 0 0.039 1.52
3n No 0.82 0.6 -80 0 48 0.35 0 0.024 1.41
4e No 0.84 0.6 -80 0 55 0.31 0.0026 0.048 1.48
4n No 0.81 0.6 -80 0 52 0.53 0 0.088 5.71
5e No 0.86 0.61 -80 0 40 0.44 0.00065 0.024 1.5
5n No 0.85 0.61 -80 0 22 0.56 0.0029 0.11 1.66
7e No 0.87 0.61 -80 0 50 0.38 0 0.021 1.48
7n No 0.86 0.61 -80 0 45 0.4 0 0.015 1.62
8e No 0.86 0.62 -80 0 80 0.11 0.05 0.15 2.09
8n No 0.85 0.62 -80 0 82 0.095 0 0.16 2.14
9e No 0.88 0.62 -80 0 21 0.62 0.002 0.097 3.06
9n No 0.87 0.62 -80 0 39 0.42 0 0.032 1.65
10e No 0.87 0.64 -80 0 66 0.21 0.026 0.096 1.99
10n No 0.87 0.64 -80 0 50 0.33 0 0.024 1.63
15e No 0.82 0.58 -80 0 32 0.7 0.0013 0.17 6.66
15n No 0.85 0.58 -80 0 47 0.35 0 0.016 1.7
16e No 0.86 0.59 -80 0 60 0.26 0 0.069 3.12
16n No 0.86 0.59 -80 0 59 0.25 0 0.067 1.87
17e No 0.89 0.59 -80 0 32 0.52 0 0.058 3.47
17n No 0.88 0.59 -80 0 19 0.61 0.0065 0.12 5.43
18e No 0.86 0.68 -80 0 42 0.37 0.18 0.073 3.26
18n No 0.76 0.68 -80 0 27 0.45 0.078 0.13 1.81
19e No 0.89 0.61 -80 0 47 0.41 0 0.012 1.63
19n No 0.88 0.61 -80 0 44 0.42 0 0.025 1.86
20e No 0.89 0.61 -80 0 30 0.58 0.00033 0.072 1.58
20n No 0.88 0.61 -80 0 38 0.43 0 0.034 2.07
21e No 0.89 0.63 -80 0 45 0.42 0.00065 0.019 1.61
21n No 0.88 0.63 -80 0 43 0.35 0 0.021 1.76
22e No 0.87 0.64 -80 0 32 0.47 0.0013 0.035 1.64
22n No 0.86 0.64 -80 0 48 0.31 0 0.03 1.55
27e No 0.059 0.25 -80 0 0.96 0.76 0.42 0.53 1.19
27n No 0.3 0.25 -80 0 9.5 0.69 0.28 0.25 2.25
28e No 0.88 0.72 -80 0 38 0.48 0 0.028 1.83
28n No 0.66 0.72 -80 0 9.5 0.5 0.17 0.25 1.75
29e No 0.031 0.0079 -80 0 0.73 0.5 0.15 0.15 1.1
29n No 0.043 0.0079 -80 0 0.69 0.56 0.1 0.16 1.13
30e No 0.89 0.59 -80 0 62 0.29 0 0.071 1.94
30n No 0.89 0.59 -80 0 51 0.32 0 0.034 1.84
31e No 0.9 0.61 -80 0 42 0.43 0 0.017 1.62
31n No 0.89 0.61 -80 0 38 0.47 0 0.045 1.92
32e No 0.87 0.54 -80 0 37 1.2 0.00033 0.24 10.6
32n No 0.89 0.54 -80 0 51 0.3 0 0.04 2.22
34e No 0.045 0.7 -80 0 2.9 0.56 0.036 0.15 1.16
34n No 0.86 0.7 -80 0 63 0.24 0 0.08 2.53
35e No 0.87 0.62 -80 0 61 0.24 0 0.079 2.49
35n No 0.85 0.62 -80 0 54 0.31 0 0.044 1.48
36e No 0.82 0.58 -80 0 36 0.31 0.0029 0.049 1.9
36n No 0.79 0.58 -80 0 39 0.25 0.00033 0.052 1.93
37e No 0.83 0.57 -80 0 14 0.28 0.0059 0.17 2.08
37n No 0.81 0.57 -80 0 9.1 0.26 0.017 0.17 2.23
38e No 0.84 0.57 -80 0 46 0.43 0 0.017 2.7
38n No 0.82 0.57 -80 0 39 0.44 0 0.032 2.21
40e No 0.87 0.57 -80 0 36 0.54 0 0.052 2.07
40n No 0.86 0.57 -80 0 37 0.43 0.032 0.048 7.35
41e No 0.88 0.55 -80 0 40 0.44 0 0.017 4.71
41n No 0.87 0.55 -80 0 22 0.52 0.0013 0.1 4.09
42e No 0.9 0.59 -80 0 40 0.48 0 0.037 1.69
42n No 0.89 0.59 -80 0 11 0.57 0.0081 0.15 2.41
43e Yes -80 1.5E+03 0 0 0 INF 0
43n Yes -80 1.5E+03 0 0 0 INF 0
44e Yes -80 1.5E+03 0 0 0 INF 0
44n Yes -80 1.5E+03 0 0 0 INF 0
45e No 0.91 0.58 -80 0 37 0.45 0.00065 0.028 1.58
45n No 0.89 0.58 -80 0 39 0.29 0 0.073 2.03
46e No 0.9 0.63 -80 0 43 0.42 0.00065 0.011 1.62
46n No 0.89 0.63 -80 0 55 0.28 0 0.04 1.69
47e No 0.03 0.0027 -80 0 3.1 0.53 0.12 0.14 1.15
47n No 0.028 0.0027 -80 0 3.1 0.58 0.093 0.16 1.16
48e No 0.88 0.62 -80 0 52 0.34 0 0.041 2.79
48n No 0.85 0.62 -80 0 67 0.2 0 0.098 2.06
49e No 0.87 0.62 -80 0 37 0.46 0.00065 0.023 2.82
49n No 0.84 0.62 -80 0 56 0.28 0 0.055 1.47
50e No 0.82 0.58 -80 0 35 0.51 0.00065 0.047 1.58
50n No 0.79 0.58 -80 0 38 0.39 0 0.037 1.76
51e No 0.83 0.56 -80 0 43 0.51 0.37 0.046 3.2
51n No 0.81 0.56 -80 0 36 0.42 0 0.042 2.41
52e No 0.84 0.57 -80 0 36 0.3 0.00033 0.058 3.61
52n No 0.82 0.57 -80 0 43 0.25 0 0.042 3.19
53e No 0.86 0.55 -80 0 41 0.41 0 0.022 5.14
53n No 0.84 0.55 -80 0 43 0.31 0 0.03 6.95
54e No 0.52 0.26 -80 0 13 0.61 0.028 0.16 7.71
54n No 0.59 0.26 -80 1 10 0.2 0.0013 0.13 9.04
55e No 0.042 0.66 -80 0 2 2 0.022 0.43 1.1
55n No 0.86 0.66 -80 0 56 0.31 0 0.044 4.49
56e No 0.9 0.53 -80 0 47 0.39 0 0.025 2.15
56n No 0.88 0.53 -80 0 44 0.27 0.0039 0.096 3.07
57e No 0.91 0.58 -80 0 44 0.4 0 0.016 1.88
57n No 0.89 0.58 -80 0 46 0.36 0.00033 0.012 2.16
58e Yes -80 1.5E+03 0 0 0 INF 0
58n Yes -80 1.5E+03 0 0 0 INF 0
59e Yes -80 1.5E+03 0 0 0 INF 0
59n Yes -80 1.5E+03 0 0 0 INF 0
60e Yes -80 1.5E+03 0 0 0 INF 0
60n Yes -80 1.5E+03 0 0 0 INF 0
61e No 0.028 0.0076 -80 0 3.2 0.56 0.049 0.16 1.15
61n No 0.036 0.0076 -80 0 22 0.038 0.01 0.12 1.14
62e No 0.88 0.61 -80 0 36 0.42 0.00033 0.016 2.89
62n No 0.85 0.61 -80 0 67 0.16 0 0.11 1.93
63e No 0.87 0.61 -80 0 56 0.29 0.00033 0.062 2.64
63n No 0.82 0.61 -80 0 91 0.039 0 0.19 2.08
64e No 0.85 0.61 -80 0 48 0.37 0 0.035 1.87
64n No 0.83 0.61 -80 0 44 0.36 0 0.012 1.42
65e No 0.82 0.59 -80 0 40 0.45 0.00065 0.033 1.77
65n No 0.79 0.59 -80 0 45 0.35 0 0.019 1.67
66e No 0.83 0.57 -80 0 38 0.5 0.00033 0.035 2.31
66n No 0.81 0.57 -80 0 39 0.42 0 0.029 1.89
67e No 0.85 0.56 -80 0 47 0.4 0 0.017 2.62
67n No 0.83 0.56 -80 0 36 0.49 0 0.051 2.52
68e No 0.86 0.56 -80 0 33 0.56 0.016 0.065 5.52
68n No 0.84 0.56 -80 0 35 0.49 0 0.054 5.28
69e No 0.87 0.55 -80 0 38 0.51 0 0.039 4.71
69n No 0.86 0.55 -80 0 42 0.45 0 0.03 6.84
70e No 0.89 0.56 -80 0 27 0.57 0 0.079 3.44
70n No 0.87 0.56 -80 0 37 0.45 0 0.04 4.81
71e No 0.89 0.56 -80 0 48 0.24 0 0.053 2.59
71n No 0.88 0.56 -80 0 42 0.43 0 0.027 3.61
72e No 0.91 0.58 -80 0 43 0.51 0 0.034 2.19
72n No 0.89 0.58 -80 0 43 0.4 0 0.019 2.26
73e No 0.91 0.59 -80 0 42 0.45 0 0.023 2.11
73n No 0.89 0.59 -80 0 32 0.43 0 0.063 2.24
74e Yes -80 1.5E+03 0 0 0 INF 0
74n Yes -80 1.5E+03 0 0 0 INF 0
77e No 0.032 0.0033 -80 0 29 0.75 0.0094 0.15 1.14
77n No 0.033 0.0033 -80 0 32 -0.06 0.0088 0.16 1.14
78e No 0.81 0.53 -80 0 36 0.6 0.00033 0.17 9.97
78n No 0.85 0.53 -80 0 68 0.19 0 0.1 1.95
79e No 0.86 0.59 -80 0 36 0.47 0.00033 0.028 1.72
79n No 0.84 0.59 -80 0 52 0.31 0 0.038 1.39
80e No 0.84 0.6 -80 0 60 0.29 0 0.069 1.68
80n No 0.8 0.6 -80 0 79 0.12 0 0.15 1.77
84e No 0.85 0.57 -80 0 75 0.11 0.021 0.13 3.39
84n No 0.83 0.57 -80 0 81 0.073 0 0.16 3.69
85e No 0.87 0.57 -80 0 52 0.33 0 0.043 1.85
85n No 0.85 0.57 -80 0 52 0.3 0 0.039 2.09
86e No 0.054 0.65 -80 0 1 0.51 0.0072 0.15 1.33
86n No 0.87 0.65 -80 0 44 0.36 0 0.021 4.48
87e No 0.86 0.48 -80 0 20 1.4 0.023 0.36 12
87n No 0.87 0.48 -80 0 50 0.21 0 0.054 2.36
88e No 0.9 0.57 -80 0 38 0.48 0 0.03 3.21
88n No 0.88 0.57 -80 0 33 0.42 0 0.046 3.16
89e No 0.91 0.6 -80 0 38 0.45 0 0.031 5.29
89n No 0.89 0.6 -80 0 36 0.43 0 0.038 4.8
90e No 0.91 0.6 -80 0 41 0.43 0 0.016 2.08
90n No 0.89 0.6 -80 0 32 0.47 0.00033 0.057 2.26
91e No 0.91 0.63 -80 0 37 0.45 0.00098 0.031 2.11
91n No 0.88 0.63 -80 0 39 0.39 0 0.028 1.91
92e No 0.029 0.013 -80 0 0.68 0.5 0.044 0.14 1.11
92n No 0.048 0.013 -80 0 0.64 0.56 0.19 0.14 1.12
93e No 0.29 -0.23 -80 0 72 0.16 0 0.12 2.55
93n No 0.17 -0.23 -80 0 0.62 0.6 0.1 0.15 1.16
94e No 0.89 0.61 -80 0 37 0.49 0.00033 0.037 1.71
94n No 0.86 0.61 -80 0 19 0.61 0.0029 0.12 2.42
95e No 0.87 0.59 -80 0 44 0.44 0.00033 0.02 1.59
95n No 0.83 0.59 -80 0 62 0.24 0 0.077 1.81
96e No 0.84 0.56 -80 0 68 0.2 0 0.11 2.53
96n No 0.79 0.56 -80 0 41 0.72 0 0.17 3.9
97e No 0.84 0.59 -80 0 50 0.36 0.00033 0.034 1.51
97n No 0.81 0.59 -80 0 45 0.42 0.0091 0.026 1.45
101e No 0.86 0.58 -80 0 43 0.22 0 0.053 1.8
101n No 0.84 0.58 -80 0 37 0.2 0 0.075 1.8
102e No 0.87 0.57 -80 0 53 0.35 0 0.039 1.61
102n No 0.85 0.57 -80 0 49 0.39 0 0.022 2.25
103e No 0.88 0.55 -80 0 56 0.3 0 0.063 4.45
103n No 0.86 0.55 -80 0 39 0.28 0 0.058 2.53
104e No 0.89 0.58 -80 0 23 0.36 0.00033 0.086 1.93
104n No 0.86 0.58 -80 0 9.8 2.3 0.025 0.54 4.04
105e No 0.89 0.58 -80 0 41 0.44 0.00033 0.018 2.64
105n No 0.87 0.58 -80 0 36 0.4 0 0.037 2.82
106e No 0.9 0.6 -80 0 36 0.46 0.00033 0.043 5.09
106n No 0.88 0.6 -80 0 42 0.36 0 0.019 3.99
107e No 0.9 0.57 -80 0 46 0.43 0 0.022 2.81
107n No 0.88 0.57 -80 0 48 0.24 0 0.053 2.59
108e No 0.9 0.61 -80 0 47 0.4 0.00033 0.027 1.95
108n No 0.88 0.61 -80 0 36 0.32 0 0.059 2.06
109e No 0.6 0.48 -80 0 34 0.3 0.0049 0.13 2.87
109n No 0.049 0.48 -80 0 0.66 0.57 0.12 0.15 1.18
110e No 0.86 0.5 -80 0 58 0.81 0.0046 0.13 7.41
110n No 0.87 0.5 -80 0 45 0.36 0 0.019 1.78
111e No 0.89 0.59 -80 0 37 0.49 0.00065 0.041 1.75
111n No 0.86 0.59 -80 0 33 0.49 0 0.068 1.6
112e Yes -80 1.5E+03 0 0 0 INF 0
112n Yes -80 1.5E+03 0 0 0 INF 0
113e No 0.84 0.59 -80 0 88 0.063 0.013 0.18 1.84
113n No 0.8 0.59 -80 0 89 0.053 0 0.18 1.72
114e No 0.83 0.57 -80 0 83 0.086 0.0065 0.17 2.74
114n No 0.81 0.57 -80 0 53 0.28 0 0.057 1.56
115e Yes -80 1.5E+03 0 0 0 INF 0
115n Yes -80 1.5E+03 0 0 0 INF 0
120e No 0.87 0.59 -80 0 25 0.53 0.0016 0.09 1.6
120n No 0.84 0.59 -80 0 41 0.39 0 0.028 2.03
121e No 0.85 0.58 -80 0 76 0.13 0.021 0.14 2.24
121n No 0.85 0.58 -80 0 11 0.41 0.0098 0.15 2.05
122e No 0.87 0.59 -80 0 46 0.23 0 0.059 1.96
122n No 0.85 0.59 -80 0 53 0.19 0 0.063 1.85
123e No 0.86 0.6 -80 0 84 0.048 0.068 0.18 2.67
123n No 0.85 0.6 -80 0 72 0.083 0 0.12 2.72
124e No 0.047 -0.00086 -80 0 0.64 0.52 0.064 0.14 1.22
124n No 0.052 -0.00086 -80 0 0.59 0.61 0.15 0.15 1.26
125e No 0.9 0.61 -80 0 25 0.51 0.00065 0.08 1.97
125n No 0.88 0.61 -80 0 40 0.45 0 0.028 2.03
126e No 0.9 0.63 -80 0 38 0.4 0.00065 0.027 1.93
126n No 0.88 0.63 -80 0 38 0.27 0 0.039 2.03
127e Yes -80 1.5E+03 0 0 0 INF 0
127n Yes -80 1.5E+03 0 0 0 INF 0
128e Yes -80 1.5E+03 0 0 0 INF 0
128n Yes -80 1.5E+03 0 0 0 INF 0
131e Yes -80 1.5E+03 0 0 0 INF 0
131n Yes -80 1.5E+03 0 0 0 INF 0
132e No 0.85 0.57 -80 0 56 0.27 0 0.06 1.59
132n No 0.82 0.57 -80 0 50 0.32 0 0.026 1.8
133e Yes -80 1.5E+03 0 0 0 INF 0
133n Yes -80 1.5E+03 0 0 0 INF 0
134e No 0.81 0.59 -80 0 21 0.56 0.0029 0.079 1.41
134n No 0.76 0.59 -80 0 81 0.1 0 0.15 1.75
135e No 0.81 0.62 -80 0 55 0.35 0 0.048 1.52
135n No 0.78 0.62 -80 0 36 0.46 0.00065 0.046 1.41
136e No 0.83 0.61 -80 0 54 0.34 0 0.035 1.49
136n No 0.8 0.61 -80 0 39 0.46 0.0016 0.044 1.45
139e Yes -80 1.5E+03 0 0 0 INF 0
139n Yes -80 1.5E+03 0 0 0 INF 0
140e Yes -80 1.5E+03 0 0 0 INF 0
140n Yes -80 1.5E+03 0 0 0 INF 0
141e Yes -80 1.5E+03 0 0 0 INF 0
141n Yes -80 1.5E+03 0 0 0 INF 0
142e Yes -80 1.5E+03 0 0 0 INF 0
142n Yes -80 1.5E+03 0 0 0 INF 0
143e Yes -80 1.5E+03 0 0 0 INF 0
143n Yes -80 1.5E+03 0 0 0 INF 0
144e Yes -80 1.5E+03 0 0 0 INF 0
144n Yes -80 1.5E+03 0 0 0 INF 0
145e Yes -80 1.5E+03 0 0 0 INF 0
145n Yes -80 1.5E+03 0 0 0 INF 0
146e Yes -80 1.5E+03 0 0 0 INF 0
146n Yes -80 1.5E+03 0 0 0 INF 0
147e No 0.9 0.61 -80 0 32 0.57 0.0016 0.067 2.04
147n No 0.87 0.61 -80 0 36 0.46 0 0.039 1.96
148e No 0.88 0.6 -80 0 41 0.42 0.00065 0.018 2.99
148n No 0.86 0.6 -80 0 38 0.41 0 0.034 2.29
149e No 0.87 0.58 -80 0 37 0.48 0.00098 0.037 2.34
149n No 0.85 0.58 -80 0 42 0.41 0 0.022 2.62
150e No 0.86 0.57 -80 0 40 0.43 0.00065 0.023 2.18
150n No 0.84 0.57 -80 0 41 0.43 0 0.024 2.88
151e No 0.81 0.51 -80 0 45 0.48 0.00065 0.14 8.63
151n No 0.82 0.51 -80 0 34 0.42 0 0.035 2.05
152e No 0.84 0.56 -80 0 49 0.35 0.00065 0.035 1.41
152n No 0.81 0.56 -80 0 48 0.34 0 0.021 1.86
153e No 0.047 0.62 -80 0 3.1 0.52 0.15 0.14 1.18
153n No 0.79 0.62 -80 0 47 0.37 0 0.018 1.59
154e No 0.8 0.56 -80 0 58 0.27 0.00065 0.066 1.35
154n No 0.77 0.56 -80 0 53 0.31 0 0.044 1.61
155e No 0.79 0.62 -80 0 71 0.18 0.01 0.11 3.59
155n No 0.77 0.62 -80 0 56 0.28 0 0.054 2.1
156e No 0.83 0.61 -80 0 15 0.59 0.0039 0.12 1.5
156n No 0.79 0.61 -80 0 38 0.41 0.00033 0.034 1.79
157e No 0.82 0.6 -80 0 40 0.41 0 0.024 1.62
157n No 0.8 0.6 -80 0 38 0.43 0.00033 0.037 2.05
158e No 0.84 0.61 -80 0 42 0.45 0 0.019 1.68
158n No 0.81 0.61 -80 0 41 0.41 0 0.022 1.77
159e Yes -80 1.5E+03 0 0 0 INF 0
159n Yes -80 1.5E+03 0 0 0 INF 0
160e Yes -80 1.5E+03 0 0 0 INF 0
160n Yes -80 1.5E+03 0 0 0 INF 0
161e Yes -80 1.5E+03 0 0 0 INF 0
161n Yes -80 1.5E+03 0 0 0 INF 0
162e Yes -80 1.5E+03 0 0 0 INF 0
162n Yes -80 1.5E+03 0 0 0 INF 0
163e Yes -80 1.5E+03 0 0 0 INF 0
163n Yes -80 1.5E+03 0 0 0 INF 0
164e Yes -80 1.5E+03 0 0 0 INF 0
164n Yes -80 1.5E+03 0 0 0 INF 0
165e Yes -80 1.5E+03 0 0 0 INF 0
165n Yes -80 1.5E+03 0 0 0 INF 0
166e Yes -80 1.5E+03 0 0 0 INF 0
166n Yes -80 1.5E+03 0 0 0 INF 0
167e No 0.89 0.62 -80 0 38 0.47 0.00065 0.034 1.9
167n No 0.87 0.62 -80 0 38 0.43 0 0.037 1.72
168e No 0.88 0.59 -80 0 37 0.49 0.00065 0.032 2.99
168n No 0.86 0.59 -80 0 40 0.41 0 0.023 2.63
169e No 0.87 0.58 -80 0 38 0.47 0.00065 0.031 2.1
169n No 0.84 0.58 -80 0 40 0.52 0.00033 0.052 2.66
170e No 0.86 0.56 -80 0 24 0.64 0.0023 0.099 4.68
170n No 0.84 0.56 -80 0 37 0.48 0 0.043 2.78
171e No 0.84 0.56 -80 0 33 0.45 0.00098 0.031 1.71
171n No 0.82 0.56 -80 0 34 0.44 0 0.035 1.97
172e No 0.83 0.56 -80 0 61 0.26 0 0.078 2.55
172n No 0.81 0.56 -80 0 43 0.41 0 0.023 2.12
173e No 0.79 0.56 -80 0 87 0.059 0 0.18 1.81
173n No 0.76 0.56 -80 0 89 0.047 0 0.18 2.23
174e No 0.032 0.00092 -80 0 3.2 0.57 0.11 0.16 1.15
174n No 0.029 0.00092 -80 0 3.1 0.61 0.042 0.16 1.14
175e No 0.78 0.57 -80 0 77 0.13 0 0.15 1.83
175n No 0.73 0.57 -80 0 82 0.083 0 0.16 1.75
179e No 0.83 0.62 -80 0 36 0.5 0.00033 0.04 1.59
179n No 0.81 0.62 -80 0 34 0.49 0.00065 0.055 1.42
180e Yes -80 1.5E+03 0 0 0 INF 0
180n Yes -80 1.5E+03 0 0 0 INF 0
181e Yes -80 1.5E+03 0 0 0 INF 0
181n Yes -80 1.5E+03 0 0 0 INF 0
182e Yes -80 1.5E+03 0 0 0 INF 0
182n Yes -80 1.5E+03 0 0 0 INF 0
183e Yes -80 1.5E+03 0 0 0 INF 0
183n Yes -80 1.5E+03 0 0 0 INF 0
184e Yes -80 1.5E+03 0 0 0 INF 0
184n Yes -80 1.5E+03 0 0 0 INF 0
185e Yes -80 1.5E+03 0 0 0 INF 0
185n Yes -80 1.5E+03 0 0 0 INF 0
186e Yes -80 1.5E+03 0 0 0 INF 0
186n Yes -80 1.5E+03 0 0 0 INF 0
187e Yes -80 1.5E+03 0 0 0 INF 0
187n Yes -80 1.5E+03 0 0 0 INF 0
189e No 0.84 0.6 -80 0 76 0.14 0 0.14 2.36
189n No 0.82 0.6 -80 0 79 0.11 0 0.15 2.43
190e No 0.85 0.57 -80 0 41 0.49 0.00065 0.03 2.21
190n No 0.83 0.57 -80 0 43 0.42 0 0.019 2.31
191e No 0.85 0.56 -80 0 39 0.49 0.00098 0.033 2.26
191n No 0.82 0.56 -80 0 36 0.5 0 0.054 2.26
192e No 0.8 0.55 -80 0 90 0.05 0.0046 0.19 2.1
192n No 0.77 0.55 -80 0 92 0.035 0 0.19 1.98
193e No 0.79 0.56 -80 0 91 0.045 0.0046 0.19 1.91
193n No 0.77 0.56 -80 0 88 0.056 0 0.18 1.86
194e No 0.04 0.65 -80 0 3.7 0.52 0.037 0.16 1.14
194n No 0.77 0.65 -80 0 55 0.27 0 0.057 1.39
195e No 0.78 0.57 -80 0 79 0.12 0 0.15 2.06
195n No 0.75 0.57 -80 0 64 0.21 0 0.092 2
200e No 0.048 0.73 -80 0 3 0.56 0.22 0.15 1.18
200n No 0.81 0.73 -80 0 50 0.33 0 0.027 1.34
201e No 0.84 0.66 -80 0 75 0.16 0 0.13 2.19
201n No 0.81 0.66 -80 0 86 0.067 0 0.17 2.34
202e No 0.85 0.66 -80 0 66 0.23 0 0.096 2.25
202n No 0.84 0.66 -80 0 33 0.48 0.0023 0.05 1.32
204e Yes -80 1.5E+03 0 0 0 INF 0
204n Yes -80 1.5E+03 0 0 0 INF 0
205e Yes -80 1.5E+03 0 0 0 INF 0
205n Yes -80 1.5E+03 0 0 0 INF 0
206e Yes -80 1.5E+03 0 0 0 INF 0
206n Yes -80 1.5E+03 0 0 0 INF 0
207e Yes -80 1.5E+03 0 0 0 INF 0
207n Yes -80 1.5E+03 0 0 0 INF 0
208e No 0.86 0.73 -80 0 6.4 0.37 0.035 0.082 2.19
208n No 0.037 0.73 -80 0 0.68 0.0035 0.33 0.23 1.11
209e No 0.035 -0.0025 -80 0 0.76 0.099 0.33 0.2 1.13
209n No 0.035 -0.0025 -80 0 0.74 0.062 0.39 0.21 1.12
210e No 0.85 0.57 -80 0 40 0.18 0.00065 0.069 2.07
210n No 0.82 0.57 -80 0 38 0.2 0 0.06 1.92
211e No 0.83 0.68 -80 0 42 0.43 0.0013 0.01 1.73
211n No 0.043 0.68 -80 0 2.8 0.57 0.16 0.15 1.15
213e No 0.78 0.61 -80 0 86 0.062 0 0.18 1.76
213n No 0.31 0.61 -80 0 3.2 0.64 0.097 0.15 1.24
214e No 0.05 0.69 -80 0 3.1 0.54 0.062 0.16 1.17
214n No 0.75 0.69 -80 0 57 0.27 0 0.073 1.45
220e Yes -80 1.5E+03 0 0 0 INF 0
220n Yes -80 1.5E+03 0 0 0 INF 0
221e Yes -80 1.5E+03 0 0 0 INF 0
221n Yes -80 1.5E+03 0 0 0 INF 0
222e Yes -80 1.5E+03 0 0 0 INF 0
222n Yes -80 1.5E+03 0 0 0 INF 0
223e Yes -80 1.5E+03 0 0 0 INF 0
223n Yes -80 1.5E+03 0 0 0 INF 0
224e Yes -80 1.5E+03 0 0 0 INF 0
224n Yes -80 1.5E+03 0 0 0 INF 0
225e Yes -80 1.5E+03 0 0 0 INF 0
225n Yes -80 1.5E+03 0 0 0 INF 0
226e Yes -80 1.5E+03 0 0 0 INF 0
226n Yes -80 1.5E+03 0 0 0 INF 0
227e No 0.85 0.6 -80 0 34 0.5 0.00065 0.043 1.62
227n No 0.82 0.6 -80 0 56 0.28 0 0.056 1.67
228e No 0.83 0.57 -80 0 58 0.24 0 0.077 1.72
228n No 0.81 0.57 -80 0 47 0.32 0 0.024 1.63
229e No 0.82 0.58 -80 0 62 0.26 0.00033 0.083 2.62
229n No 0.79 0.58 -80 0 68 0.18 0 0.1 1.96
237e Yes -80 1.5E+03 0 0 0 INF 0
237n Yes -80 1.5E+03 0 0 0 INF 0
238e Yes -80 1.5E+03 0 0 0 INF 0
238n Yes -80 1.5E+03 0 0 0 INF 0
239e Yes -80 1.5E+03 0 0 0 INF 0
239n Yes -80 1.5E+03 0 0 0 INF 0
240e Yes -80 1.5E+03 0 0 0 INF 0
240n Yes -80 1.5E+03 0 0 0 INF 0
241e Yes -80 1.5E+03 0 0 0 INF 0
241n Yes -80 1.5E+03 0 0 0 INF 0
242e Yes -80 1.5E+03 0 0 0 INF 0
242n Yes -80 1.5E+03 0 0 0 INF 0
243e Yes -80 1.5E+03 0 0 0 INF 0
243n Yes -80 1.5E+03 0 0 0 INF 0
244e No 0.84 0.62 -80 0 43 0.38 0.00065 0.011 1.5
244n No 0.82 0.62 -80 0 38 0.42 0.00033 0.026 1.57
245e No 0.83 0.6 -80 0 61 0.25 0 0.082 2.25
245n No 0.81 0.6 -80 0 53 0.33 0 0.038 1.61
246e No 0.8 0.66 -80 0 14 0.64 0.013 0.075 2.13
246n No 0.037 0.66 -80 0 3.1 0.58 0.21 0.16 1.17
261e No 0.82 0.61 -80 0 60 0.25 0.00033 0.078 2.46
261n No 0.8 0.61 -80 0 58 0.26 0 0.062 1.45
262e No 0.82 0.61 -80 0 39 0.21 0.0023 0.077 1.69
262n No 0.8 0.61 -80 0 40 0.12 0.00065 0.083 1.63
320e No 0.64 0.48 -80 0 50 0.29 0.0023 0.048 -
320n No 0.54 0.48 -80 0 50 0.27 0.002 0.048 -
324e No 0.64 0.5 -80 0 66 0.2 0.00033 0.11 -
324n No 0.55 0.5 -80 0 69 0.16 0 0.11 -
325e No 0.7 0.54 -80 0 66 0.21 0 0.096 -
325n No 0.65 0.54 -80 0 50 0.32 0.00065 0.032 -
329e No 0.042 0.0037 -80 0 3.1 0.55 0.087 0.15 -
329n No 0.044 0.0037 -80 0 2.7 0.57 0.037 0.15 -
332e Yes -80 1.5E+03 0 0 0 INF -
332n Yes -80 1.5E+03 0 0 0 INF -
333e No 0.56 0.43 -80 0 42 0.38 0.0013 0.031 -
333n No 0.4 0.43 -80 0 87 0.056 0 0.18 -
336e Yes -80 1.5E+03 0 0 0 INF -
336n Yes -80 1.5E+03 0 0 0 INF -
340e Yes -80 1.5E+03 0 0 0 INF 0
340n Yes -80 1.5E+03 0 0 0 INF 0
In [49]:
# Save antenna classification table as a csv
if SAVE_RESULTS:
    for ind, col in zip(np.arange(len(df.columns), 0, -1), df_classes.columns[::-1]):
        df.insert(int(ind), col + ' Class', df_classes[col])
    df.to_csv(ANTCLASS_FILE)    
In [50]:
print('Final Ant-Pol Classification:\n\n', final_class)
Final Ant-Pol Classification:

 Jee:
----------
suspect (84 antpols):
3, 4, 5, 7, 19, 20, 21, 22, 28, 31, 36, 37, 38, 40, 42, 45, 46, 48, 49, 50, 52, 53, 56, 57, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 79, 80, 85, 88, 89, 90, 91, 94, 95, 97, 101, 102, 104, 105, 106, 107, 108, 111, 120, 122, 125, 126, 132, 134, 135, 136, 147, 148, 149, 150, 152, 154, 156, 157, 158, 167, 168, 169, 171, 179, 190, 191, 210, 211, 227, 228, 244, 262

bad (121 antpols):
8, 9, 10, 15, 16, 17, 18, 27, 29, 30, 32, 34, 35, 41, 43, 44, 47, 51, 54, 55, 58, 59, 60, 61, 74, 77, 78, 84, 86, 87, 92, 93, 96, 103, 109, 110, 112, 113, 114, 115, 121, 123, 124, 127, 128, 131, 133, 139, 140, 141, 142, 143, 144, 145, 146, 151, 153, 155, 159, 160, 161, 162, 163, 164, 165, 166, 170, 172, 173, 174, 175, 180, 181, 182, 183, 184, 185, 186, 187, 189, 192, 193, 194, 195, 200, 201, 202, 204, 205, 206, 207, 208, 209, 213, 214, 220, 221, 222, 223, 224, 225, 226, 229, 237, 238, 239, 240, 241, 242, 243, 245, 246, 261, 320, 324, 325, 329, 332, 333, 336, 340


Jnn:
----------
suspect (99 antpols):
3, 5, 7, 9, 10, 15, 16, 19, 20, 21, 22, 30, 31, 32, 35, 36, 37, 38, 41, 42, 45, 46, 49, 50, 51, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 79, 85, 87, 88, 89, 90, 91, 97, 101, 102, 103, 105, 106, 107, 108, 110, 111, 114, 120, 121, 122, 125, 126, 132, 135, 136, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 167, 168, 169, 170, 171, 172, 179, 190, 191, 194, 200, 202, 210, 214, 227, 228, 244, 245, 261, 262

bad (106 antpols):
4, 8, 17, 18, 27, 28, 29, 34, 40, 43, 44, 47, 48, 58, 59, 60, 61, 62, 63, 74, 77, 78, 80, 84, 86, 92, 93, 94, 95, 96, 104, 109, 112, 113, 115, 123, 124, 127, 128, 131, 133, 134, 139, 140, 141, 142, 143, 144, 145, 146, 159, 160, 161, 162, 163, 164, 165, 166, 173, 174, 175, 180, 181, 182, 183, 184, 185, 186, 187, 189, 192, 193, 195, 201, 204, 205, 206, 207, 208, 209, 211, 213, 220, 221, 222, 223, 224, 225, 226, 229, 237, 238, 239, 240, 241, 242, 243, 246, 320, 324, 325, 329, 332, 333, 336, 340

Save calibration solutions¶

In [51]:
# update flags in omnical gains and visibility solutions
for ant in omni_flags:
    omni_flags[ant] |= rfi_flags
for bl in vissol_flags:
    vissol_flags[bl] |= rfi_flags
In [52]:
if SAVE_RESULTS:
    add_to_history = 'Produced by file_calibration notebook with the following environment:\n' + '=' * 65 + '\n' + os.popen('conda env export').read() + '=' * 65    
    
    hd_vissol = io.HERAData(SUM_FILE)
    hc_omni = hd_vissol.init_HERACal(gain_convention='divide', cal_style='redundant')
    hc_omni.update(gains=sol.gains, flags=omni_flags, quals=meta['chisq_per_ant'], total_qual=meta['chisq'])
    hc_omni.history += add_to_history
    hc_omni.write_calfits(OMNICAL_FILE, clobber=True)
    del hc_omni
    malloc_trim()
    
    # output results, harmonizing keys over polarizations
    all_reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], pol_mode='2pol')
    bl_to_red_map = {bl: red[0] for red in all_reds for bl in red}
    hd_vissol.read(bls=[bl_to_red_map[bl] for bl in sol.vis], return_data=False)
    hd_vissol.empty_arrays()
    hd_vissol.history += add_to_history
    hd_vissol.update(data={bl_to_red_map[bl]: sol.vis[bl] for bl in sol.vis}, 
                     flags={bl_to_red_map[bl]: vissol_flags[bl] for bl in vissol_flags}, 
                     nsamples={bl_to_red_map[bl]: vissol_nsamples[bl] for bl in vissol_nsamples})
    hd_vissol.write_uvh5(OMNIVIS_FILE, clobber=True)
    del hd_vissol
    malloc_trim()    
File exists; clobbering

Output fully flagged calibration file if OMNICAL_FILE is not written¶

In [53]:
if SAVE_RESULTS and not os.path.exists(OMNICAL_FILE):
    print(f'WARNING: No calibration file produced at {OMNICAL_FILE}. Creating a fully-flagged placeholder calibration file.')
    hd_writer = io.HERAData(SUM_FILE)
    io.write_cal(OMNICAL_FILE, freqs=hd_writer.freqs, times=hd_writer.times,
                 gains={ant: np.ones((hd_writer.Ntimes, hd_writer.Nfreqs), dtype=np.complex64) for ant in ants},
                 flags={ant: np.ones((len(data.times), len(data.freqs)), dtype=bool) for ant in ants},
                 quality=None, total_qual=None, outdir='', overwrite=True, history=utils.history_string(add_to_history), 
                 x_orientation=hd_writer.x_orientation, telescope_location=hd_writer.telescope_location, lst_array=np.unique(hd_writer.lsts),
                 antenna_positions=np.array([hd_writer.antenna_positions[hd_writer.antenna_numbers == antnum].flatten() for antnum in set(ant[0] for ant in ants)]),
                 antnums2antnames=dict(zip(hd_writer.antenna_numbers, hd_writer.antenna_names)))

Output empty visibility file if OMNIVIS_FILE is not written¶

In [54]:
if SAVE_RESULTS and not os.path.exists(OMNIVIS_FILE):
    print(f'WARNING: No omnivis file produced at {OMNIVIS_FILE}. Creating an empty visibility solution file.')
    hd_writer = io.HERAData(SUM_FILE)
    hd_writer.initialize_uvh5_file(OMNIVIS_FILE, clobber=True)

TODO: Perform nucal¶

Metadata¶

In [55]:
for repo in ['pyuvdata', 'hera_cal', 'hera_filters', 'hera_qm', 'hera_notebook_templates']:
    exec(f'from {repo} import __version__')
    print(f'{repo}: {__version__}')
pyuvdata: 2.3.0
hera_cal: 3.2.3.dev158+gd5cadd5
hera_filters: 0.1.0
hera_qm: 2.1.1.dev3+gb291d34
hera_notebook_templates: 0.1.dev486+gfb8560a
In [56]:
print(f'Finished execution in {(time.time() - tstart) / 60:.2f} minutes.')
Finished execution in 7.19 minutes.