In [1]:
import os
os.environ['HDF5_USE_FILE_LOCKING'] = 'FALSE'
import h5py
import hdf5plugin
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
import matplotlib.patches as mpatches
import matplotlib.gridspec as gridspec
import numpy as np
from pyuvdata import UVCal, UVData, UVFlag
import pyuvdata
import os
import sys
import glob
import uvtools as uvt
from astropy.time import Time
from astropy.coordinates import EarthLocation, SkyCoord, AltAz, Angle
import pandas
import warnings 
import copy
from hera_notebook_templates import utils
import hera_qm
from hera_mc import cm_hookup
import h5py
import importlib
from scipy import stats
import scipy
import pandas as pd
from IPython.display import display, HTML
#warnings.filterwarnings('ignore')

%matplotlib inline
%config InlineBackend.figure_format = 'retina'
In [2]:
#get data location
JD = os.environ['JULIANDATE']
data_path = os.environ['DATA_PATH']
nb_outdir = os.environ['NB_OUTDIR']
utc = Time(JD, format='jd').datetime
print(f'JD = {JD}')
print(f'Date = {utc.month}-{utc.day}-{utc.year}')
print(f'data_path = "{data_path}"')
JD = 2459927
Date = 12-13-2022
data_path = "/mnt/sn1/2459927"
In [3]:
# Load in data
HHfiles, difffiles, uvdx, uvdy = utils.load_data_ds(data_path,JD)
    
uvd = UVData()
uvd_diff = UVData()
uvd.read(HHfiles[0])
use_ants = [int(ant) for ant in uvd.get_ants()]
bls = [(ant, ant) for ant in use_ants]
uvd.read(HHfiles[::10], skip_bad_files=True, bls=bls)
uvd_diff.read(difffiles[::10], skip_bad_files=True, bls=bls)
lsts = uvd.lst_array

flagfile = glob.glob(os.path.join(HHfiles[0].split('zen')[0],'zen.{}*total_stage_1_threshold_flags.h5'.format(JD)))
uvf = UVFlag()
uvf.read(flagfile)
bls = [(ant, ant) for ant in uvd.get_ants()]
times_uvf = np.unique(uvf.time_array)
times_uvd = np.unique(uvd.time_array)
idx_times = [np.where(time_uvd == times_uvf)[0][0] for time_uvd in times_uvd]
uvd.flag_array[:,0,:,:] = np.repeat(uvf.flag_array[idx_times], len(bls), axis=0)
149 sum files found between JDs 2459927.59352 and 2459927.62663
149 diff files found between JDs 2459927.59352 and 2459927.62663

LST Coverage¶

Shows the LSTs (in hours) and JDs for which data is collected. Green represents data, red means no data.

In [4]:
utils.plot_lst_coverage(uvd)

Delay spectrum¶

Delay spectrum CLEANed using uvtools.dspec.high_pass_fourier_filter with 7th-order Blackman-Harris window function. Odd/even visibilities are used to remove noise bias.

In [5]:
_data_cleaned_sq, d_even, d_odd = utils.clean_ds(bls, uvd, uvd_diff, N_threads=14)

Waterfalls of delay spectra for autocorrelation¶

These plots show autocorrelation delay spectrum waterfalls of each antenna that is active and whose status qualifies for this notebook. For nn/ee polarization, the autocorrelation delay spectrum is normalized by the max of the delay spectrum. For ne polarization, the autocorrelation delay spectrum is normalized by max(sqrt(|nn| * |ee|)). ne and en are the same for autocorrelations, and thus only ne is shown here. The delay spectra are presented in dB with 10*log10($|\tilde{V}|$).

For each node, antennas are ordered by SNAP number, and within that by SNAP input number. The antenna number label color corresponds to the a priori status of that antenna.

nn polarization¶

In [6]:
utils.plot_wfds(uvd, _data_cleaned_sq, 0)

ee polarization¶

In [7]:
utils.plot_wfds(uvd, _data_cleaned_sq, 1)

ne polarization¶

In [8]:
utils.plot_wfds(uvd, _data_cleaned_sq, 2)

Analysis of 2700ns features in delay spectra¶

This plot shows the relative amplitude at 2700 ns feature. The relative amplitude is calculated in dB with the mean amplitude at 2500-3000 ns compared to the mean amplitude at 2000-2500 ns. Larger values of relative feature amplitude indicate higher probability of detecting the peak at 2700 ns. Antennas in the same node are grouped by the shaded region.

In [9]:
utils.plot_antFeatureMap_2700ns(uvd, _data_cleaned_sq, JD, pol='nn')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [9], line 1
----> 1 utils.plot_antFeatureMap_2700ns(uvd, _data_cleaned_sq, JD, pol='nn')

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/hera_notebook_templates/utils.py:2265, in plot_antFeatureMap_2700ns(uvd, _data_sq, JD, pol)
   2263             plt.text(antPos[1]-3,antPos[2],str(antNum),color='white')
   2264 plt.title('Antenna map - {} polarization (JD{})'.format(pol, JD))
-> 2265 cbar = fig.colorbar(sm)
   2266 cbar.set_label('2700ns Feature Amplitude (dB)')

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/matplotlib/figure.py:1256, in FigureBase.colorbar(self, mappable, cax, ax, use_gridspec, **kwargs)
   1254 if cax is None:
   1255     if ax is None:
-> 1256         raise ValueError(
   1257             'Unable to determine Axes to steal space for Colorbar. '
   1258             'Either provide the *cax* argument to use as the Axes for '
   1259             'the Colorbar, provide the *ax* argument to steal space '
   1260             'from it, or add *mappable* to an Axes.')
   1261     current_ax = self.gca()
   1262     userax = False

ValueError: Unable to determine Axes to steal space for Colorbar. Either provide the *cax* argument to use as the Axes for the Colorbar, provide the *ax* argument to steal space from it, or add *mappable* to an Axes.
In [10]:
utils.plot_antFeatureMap_2700ns(uvd, _data_cleaned_sq, JD, pol='ee')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [10], line 1
----> 1 utils.plot_antFeatureMap_2700ns(uvd, _data_cleaned_sq, JD, pol='ee')

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/hera_notebook_templates/utils.py:2265, in plot_antFeatureMap_2700ns(uvd, _data_sq, JD, pol)
   2263             plt.text(antPos[1]-3,antPos[2],str(antNum),color='white')
   2264 plt.title('Antenna map - {} polarization (JD{})'.format(pol, JD))
-> 2265 cbar = fig.colorbar(sm)
   2266 cbar.set_label('2700ns Feature Amplitude (dB)')

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/matplotlib/figure.py:1256, in FigureBase.colorbar(self, mappable, cax, ax, use_gridspec, **kwargs)
   1254 if cax is None:
   1255     if ax is None:
-> 1256         raise ValueError(
   1257             'Unable to determine Axes to steal space for Colorbar. '
   1258             'Either provide the *cax* argument to use as the Axes for '
   1259             'the Colorbar, provide the *ax* argument to steal space '
   1260             'from it, or add *mappable* to an Axes.')
   1261     current_ax = self.gca()
   1262     userax = False

ValueError: Unable to determine Axes to steal space for Colorbar. Either provide the *cax* argument to use as the Axes for the Colorbar, provide the *ax* argument to steal space from it, or add *mappable* to an Axes.

This plot shows a matrix representing the 2700ns feature correlation of each baseline. The color bar indicates the amplitude of 2700ns (mean amplitude of 2500-3000ns delay spectrum) in dB which is the same as that in the above plot.

In [11]:
# utils.CorrMatrix_2700ns(uvd, HHfiles, difffiles, flagfile, JD, N_threads=14)

Analysis of noise floor in delay spectra¶

This plot shows the ratio of delay spectrum to noise floor (averaged over 1000-4000ns). Near 1 indicates the delay spectrum reaches to the noise floor, which may mean good.

In [12]:
utils.plot_antFeatureMap_noise(uvd_diff, d_even, d_odd, JD, pol='nn')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [12], line 1
----> 1 utils.plot_antFeatureMap_noise(uvd_diff, d_even, d_odd, JD, pol='nn')

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/hera_notebook_templates/utils.py:2405, in plot_antFeatureMap_noise(uvd, d_even, d_odd, JD, pol)
   2403             plt.text(antPos[1]-3,antPos[2],str(antNum),color='white')
   2404 plt.title('Antenna map - {} polarization (JD{})'.format(pol, JD))
-> 2405 cbar = fig.colorbar(sm)
   2406 cbar.set_label('Ratio of delay spectrum to noise floor (dB)')

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/matplotlib/figure.py:1256, in FigureBase.colorbar(self, mappable, cax, ax, use_gridspec, **kwargs)
   1254 if cax is None:
   1255     if ax is None:
-> 1256         raise ValueError(
   1257             'Unable to determine Axes to steal space for Colorbar. '
   1258             'Either provide the *cax* argument to use as the Axes for '
   1259             'the Colorbar, provide the *ax* argument to steal space '
   1260             'from it, or add *mappable* to an Axes.')
   1261     current_ax = self.gca()
   1262     userax = False

ValueError: Unable to determine Axes to steal space for Colorbar. Either provide the *cax* argument to use as the Axes for the Colorbar, provide the *ax* argument to steal space from it, or add *mappable* to an Axes.
In [13]:
utils.plot_antFeatureMap_noise(uvd_diff, d_even, d_odd, JD, pol='ee')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [13], line 1
----> 1 utils.plot_antFeatureMap_noise(uvd_diff, d_even, d_odd, JD, pol='ee')

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/hera_notebook_templates/utils.py:2405, in plot_antFeatureMap_noise(uvd, d_even, d_odd, JD, pol)
   2403             plt.text(antPos[1]-3,antPos[2],str(antNum),color='white')
   2404 plt.title('Antenna map - {} polarization (JD{})'.format(pol, JD))
-> 2405 cbar = fig.colorbar(sm)
   2406 cbar.set_label('Ratio of delay spectrum to noise floor (dB)')

File ~/mambaforge/envs/RTP/lib/python3.10/site-packages/matplotlib/figure.py:1256, in FigureBase.colorbar(self, mappable, cax, ax, use_gridspec, **kwargs)
   1254 if cax is None:
   1255     if ax is None:
-> 1256         raise ValueError(
   1257             'Unable to determine Axes to steal space for Colorbar. '
   1258             'Either provide the *cax* argument to use as the Axes for '
   1259             'the Colorbar, provide the *ax* argument to steal space '
   1260             'from it, or add *mappable* to an Axes.')
   1261     current_ax = self.gca()
   1262     userax = False

ValueError: Unable to determine Axes to steal space for Colorbar. Either provide the *cax* argument to use as the Axes for the Colorbar, provide the *ax* argument to steal space from it, or add *mappable* to an Axes.
In [14]:
# get the ratio of delay spectum to noise for different freqeuncy bands and pols
ds_noise_ratio = utils.get_ds_noise_ratio(uvd, uvd_diff, bls)

nodes, antDict, inclNodes = utils.generate_nodeDict(uvd)
ants = uvd.get_ants()
# build dataframe
to_show = {'Ant': ants, 'Node': [int(antDict[ant]['node']) for ant in ants], 'Snap': [int(antDict[ant]['snapLocs'][0]) for ant in ants]}
df = pd.DataFrame(to_show)
 
cols_ratio = []
for key in ds_noise_ratio.keys():
    if(key[0] == 40):
        col = r'Full '
    else:
        col = r'{}-{} MHz '.format(key[0], key[1])
    col += key[2]
    df[col] = ds_noise_ratio[key]
    cols_ratio.append(col)
    

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

ratio_cut = 3
# style dataframe
table = df.style.hide_index() \
          .applymap(lambda val: 'color: red' if val > ratio_cut else '', subset=cols_ratio) \
          .set_table_styles([dict(selector="th",props=[('max-width', f'70pt')])])

This table shows the ratio of the delay spectrum to the noise level from diff files for different frequency bands and pols. The ratio > 3 is colored in red

In [15]:
HTML(table.render())
Out[15]:
Ant Node Snap Full nn Full ee 50-85 MHz nn 50-85 MHz ee 120-155 MHz nn 120-155 MHz ee 155-190 MHz nn 155-190 MHz ee 190-225 MHz nn 190-225 MHz ee
3 1 2 1.985589 3.390450 0.997340 11.519708 2.074659 3.613409 1.873999 2.474630 1.966255 1.793234
4 1 2 0.933631 0.904629 1.552066 1.541981 1.817873 2.145656 2.128262 2.172889 2.019452 2.077025
5 1 2 0.808907 0.832426 1.485107 1.272361 1.534548 1.643278 1.920651 1.785793 2.063803 1.945754
7 2 0 0.799423 0.904208 1.330360 1.733167 1.818318 2.084858 1.881950 1.688992 1.743669 1.925359
8 2 0 0.958325 0.946390 1.615422 1.451976 1.872963 1.880247 2.149232 2.048837 1.901969 2.123022
9 2 0 0.874239 1.075662 1.398018 3.001582 1.883518 2.824654 1.826559 1.733447 1.637582 1.564319
10 2 1 0.856893 1.831901 1.321741 1.323494 1.605475 4.254758 2.031542 2.418955 1.682524 4.184224
15 1 3 1.505240 3.068819 1.396272 4.719278 2.090481 4.040022 2.376093 1.975667 1.965844 1.807150
16 1 3 0.926350 1.491533 1.783700 4.398931 1.918289 2.030049 1.996307 2.029643 2.187861 2.004949
17 1 3 0.955813 0.865906 1.841380 1.379231 2.047675 1.956020 2.114850 1.792134 1.859193 1.610878
18 1 0 35.587405 2.813578 1.402560 4.945376 92.864467 5.154618 1.751443 2.379152 1.758107 1.949903
19 2 1 0.925196 0.888397 1.783303 1.867407 2.216037 2.118993 2.101203 2.017312 1.979943 2.284679
20 2 1 0.926276 0.872044 1.489533 1.529864 1.801290 1.902552 1.929965 1.737663 1.918189 1.892440
21 2 2 0.824700 0.884633 1.472548 1.294715 1.855192 1.953777 1.904368 1.886556 2.007972 1.601914
22 6 0 0.871697 0.822013 2.679079 1.595069 1.976019 2.039584 1.921468 2.045161 2.117090 1.800896
27 1 0 6.334168 5.104006 5.800512 15.201698 14.102828 9.164397 2.846743 2.719061 3.400855 1.971122
28 1 0 18.481113 1.398901 1.524053 1.560468 56.012617 1.874096 2.272907 1.973257 2.939854 2.291872
29 1 1 1.264410 2.972937 6.453517 11.047848 2.039321 4.185506 2.217056 2.177142 3.066447 2.147498
30 1 1 0.919656 0.890013 1.390117 1.221274 1.901874 1.630318 1.839475 1.745207 1.601204 1.405568
31 2 2 0.887039 0.802080 1.330423 1.289029 1.820402 1.613727 1.968931 1.673480 1.838044 1.727711
32 2 2 0.871120 1.322672 1.528211 0.753759 2.055422 3.381285 2.028460 2.059169 1.610533 1.631894
34 6 0 2.203497 1.680200 4.892664 5.144866 3.332914 3.005090 2.435646 2.985160 3.362889 2.011050
35 6 0 0.931670 0.851645 1.403255 1.787572 1.875885 1.825165 1.785835 1.985036 2.018081 2.127220
36 3 3 1.006584 1.025035 1.813504 1.666762 1.870118 1.971072 1.796895 1.802694 1.750538 1.707218
37 3 1 1.135835 0.831742 1.603579 1.603204 2.365271 1.951554 2.184317 2.211325 2.005837 2.368040
38 3 1 0.925682 1.124268 2.155877 1.260652 2.047446 2.180617 1.996770 2.299231 2.136753 1.971566
40 4 1 0.896331 1.514993 1.459219 5.802594 1.965792 3.752902 2.034111 3.346070 1.770083 2.133552
41 4 3 0.898303 0.979138 1.462420 1.687650 2.149057 1.644032 2.128878 1.842105 1.922445 1.588158
42 4 0 1.747473 1.248227 8.025000 4.458822 1.880211 1.863494 2.369290 1.911287 2.547191 1.821122
43 5 2 0.859974 0.920629 1.297566 1.526146 1.879118 1.815564 1.739806 1.977143 1.593229 1.878457
44 5 1 0.843663 0.891173 1.439538 1.502542 1.638836 2.085838 1.900350 1.912346 1.884704 2.225894
45 5 0 1.116272 0.857505 2.345657 1.483286 2.635578 1.674498 2.477025 1.944207 2.272176 1.652502
46 5 0 0.850861 0.877797 1.903405 1.382220 1.810766 1.802065 2.168377 1.889447 1.972636 1.734641
47 6 1 1.810334 1.687178 4.399497 15.856939 2.252339 6.322530 2.570083 2.277808 3.090189 1.877531
48 6 2 0.909878 0.998828 1.746485 4.100795 1.682444 1.885760 1.949597 1.981197 1.971628 1.780894
49 6 2 0.940907 0.893345 1.805432 1.623895 1.929069 1.979633 2.102811 1.843852 2.069779 1.877458
50 3 3 0.889341 1.754425 1.583386 1.162156 1.688015 2.040109 2.001166 1.746273 1.755136 1.715974
51 3 2 0.893437 7.208518 1.532293 14.405575 1.869852 13.906963 2.245494 3.623146 1.813929 2.926386
52 3 3 1.078859 1.122967 1.771198 2.063826 1.947065 1.991289 1.893601 2.119747 1.927948 1.927343
53 3 2 0.998123 1.137010 2.795044 2.393211 2.601646 2.685566 2.508365 2.704364 2.216648 2.503077
54 4 0 2.724688 3.793007 2.566932 7.874193 2.445255 4.808113 3.868931 2.275525 3.095345 1.779359
55 4 2 nan nan nan nan nan nan nan nan nan nan
56 4 1 2.787139 0.859584 5.737278 1.423045 3.397999 1.954854 2.440254 2.078787 2.411364 2.171316
57 4 3 1.187692 3.311564 2.288079 4.429371 2.737834 5.035791 2.427637 2.091170 2.736533 2.293294
58 5 1 3.080219 3.478094 3.393186 14.019540 3.018447 5.520671 2.441517 3.350729 2.793723 1.858537
59 5 1 0.934796 1.548666 1.700247 6.913754 1.884369 2.526706 2.144866 2.320980 2.024109 2.080386
60 5 2 5.870911 0.852452 7.208081 1.222605 10.728567 1.756337 3.537410 1.680584 3.088374 1.834793
61 6 1 0.952763 0.850020 1.587814 1.724539 1.897553 2.307588 2.059362 2.267709 2.083547 2.112885
62 6 2 0.886619 0.981774 1.813973 1.350152 1.937053 2.583421 1.906486 1.944321 1.870938 2.130908
63 6 3 6.374821 1.292110 10.201674 7.321487 4.510385 1.874387 3.205385 2.784371 3.716931 2.101296
64 6 3 0.988930 0.943388 1.567878 1.538667 2.029163 1.717426 2.268600 1.972960 2.530543 1.760861
65 3 0 1.071909 0.878200 2.591564 1.276671 2.472461 1.876103 2.255546 1.813884 2.093137 2.017031
66 3 0 0.365489 0.336134 1.012871 0.655599 0.935247 0.869855 0.826512 0.815932 0.703104 0.752545
67 3 0 0.911869 0.850687 1.602176 1.343217 1.876638 1.872090 1.727128 1.807820 1.762921 1.663501
68 3 1 4.504820 1.777828 7.877352 1.738307 10.758856 2.153554 5.000350 2.536862 6.430641 2.595316
69 4 1 0.909822 0.864870 1.321602 1.282895 1.541174 1.897493 1.691039 2.043017 1.767400 1.695236
70 4 2 nan nan nan nan nan nan nan nan nan nan
71 4 2 nan nan nan nan nan nan nan nan nan nan
72 4 0 1.746424 0.995923 5.362255 1.376054 2.860575 2.163101 2.756332 1.914591 2.755118 1.922749
73 5 0 0.855519 0.849169 1.364526 1.633035 1.736577 1.893807 1.760193 2.011005 1.841325 2.011510
74 5 2 0.938744 0.899685 1.726441 1.713645 2.010153 2.070980 1.931772 2.179444 2.063605 2.951191
77 6 1 0.936777 0.857637 1.490869 1.496053 1.996053 1.816578 1.852660 1.741189 1.830556 1.620926
78 6 3 0.951531 2.074460 2.329900 2.417737 1.679442 4.357985 1.980982 2.612258 1.921538 2.422733
79 11 3 0.879281 0.919159 1.549128 1.898339 1.639799 2.035954 1.681549 2.249085 1.934709 2.100038
80 11 2 2.607766 1.035862 11.911156 1.835160 3.484560 1.852403 2.649294 1.789282 3.765966 2.027544
81 7 0 6.042607 0.945458 12.496758 1.745645 13.796126 2.135439 2.965086 3.282889 4.010858 4.275588
82 7 0 0.880773 0.816837 1.419818 1.520465 1.720503 1.804916 1.856069 1.849796 1.778873 1.800352
83 7 0 1.011245 0.888751 1.319638 1.585821 1.698654 1.906945 1.751432 1.972907 2.133712 1.935542
84 8 3 19.756049 45.504138 30.225414 116.744604 14.355701 29.425695 23.134392 61.741956 4.264922 1.715324
85 8 0 0.853619 0.843926 2.029701 1.559320 1.823518 1.696528 1.798993 1.619642 1.853470 1.916737
86 8 0 1.027149 0.865832 1.967534 1.254423 2.016528 2.061120 2.178338 1.882847 2.375117 4.239936
87 8 2 0.981419 2.598159 1.697874 3.533521 1.856870 5.348979 2.121553 12.887135 3.174480 4.231860
88 9 0 0.831543 0.845699 1.412318 1.543796 1.603586 1.530481 1.551910 1.722290 1.640072 1.824944
89 9 2 0.913628 0.889003 1.469511 1.531487 2.012706 1.733367 1.840387 1.883688 2.025324 1.808054
90 9 0 3.588240 2.163857 1.691070 2.265023 15.426406 10.151633 2.235236 2.339006 2.957124 2.151341
91 9 1 0.944664 0.884334 1.477702 1.384797 1.880065 1.746235 1.890211 1.657410 1.760206 1.937516
92 10 0 2.614917 1.524866 1.494352 0.773514 2.546124 2.570692 2.682441 2.030297 2.990859 2.545224
93 10 0 0.854911 1.361482 1.262196 2.426176 1.937666 3.483224 1.917433 2.016818 1.908743 2.181540
94 10 0 1.622802 2.854701 4.758937 5.406154 2.500140 2.957362 2.759380 2.022651 3.464910 1.820257
95 11 3 0.927437 0.926155 1.968994 1.816312 1.925884 2.037586 2.305513 1.999929 2.226713 2.120882
96 11 2 1.504005 1.672404 7.855044 6.217280 2.565476 3.835704 3.046341 2.473118 4.199840 2.205557
97 11 1 1.271927 1.046799 3.424898 1.318004 2.294087 1.517814 2.149149 1.995605 2.362975 12.605411
98 7 2 0.907090 0.942554 1.585805 1.609498 1.761819 1.745931 1.982754 1.768984 3.003722 2.025464
99 7 2 0.961720 0.950982 1.614971 2.002580 2.144089 2.209549 2.209464 2.209340 4.033946 3.064303
100 7 1 nan nan nan nan nan nan nan nan nan nan
101 8 2 1.038091 0.847040 1.843493 1.485915 2.085543 1.853661 1.919954 1.838378 2.354542 1.916060
102 8 0 0.965879 0.955420 2.009266 2.201638 1.695669 2.157256 1.746801 2.152773 2.089007 2.347340
103 8 1 1.195473 1.052797 3.005359 1.456501 3.177665 1.797705 2.747069 2.115011 3.021702 4.933791
104 8 1 2.784685 0.817161 1.160075 1.507045 2.880393 1.673328 3.419505 1.852274 4.417671 1.970827
105 9 1 0.848669 0.878833 1.440767 1.376291 1.966559 1.883269 2.027913 1.797858 2.056128 2.190135
106 9 3 0.964877 1.002860 1.444626 2.390067 1.951344 2.602974 1.997628 1.912754 1.828876 2.335042
107 9 0 0.963718 1.297442 2.605853 2.351760 2.047791 1.855220 2.787159 2.009882 3.792184 4.571735
108 9 1 1.550993 1.911343 1.481107 5.701760 2.233653 3.426352 2.004906 2.493317 4.013433 1.994014
109 10 1 2.555232 1.432681 11.872937 5.420791 5.718044 3.002245 2.501687 2.356684 3.504335 2.089616
110 10 1 2.108486 1.758617 5.067795 4.092154 2.552446 3.097006 2.818658 2.426602 3.688050 1.853100
111 10 1 2.214387 0.865383 16.367077 1.313359 4.215494 1.829389 3.137677 1.652709 3.959598 1.721647
112 10 2 0.850600 0.817054 1.334795 1.561336 1.623480 2.014314 1.816325 1.814589 1.691479 3.904846
113 11 3 1.760749 2.157556 15.485990 12.101116 2.648573 2.534303 3.060890 2.442498 3.788225 2.201139
114 11 2 1.053565 0.948018 1.519079 1.752005 1.849836 1.939138 1.992509 1.898859 1.856478 1.797734
115 11 0 0.907614 0.800215 1.838046 1.625396 1.813399 1.601045 1.788410 1.701971 1.884665 1.664728
116 7 2 0.869954 0.889270 1.446674 1.507990 1.913498 1.739854 1.873714 1.875312 2.061415 2.037834
117 7 3 3.435030 1.513578 12.085006 5.880202 7.188893 2.611403 3.110048 1.813740 2.860455 1.751942
118 7 3 0.954546 0.912372 1.478514 1.297732 1.917421 1.800858 1.990258 1.820248 1.890352 1.639714
119 7 1 nan nan nan nan nan nan nan nan nan nan
120 8 1 0.973659 1.003229 1.836469 1.560503 1.775971 2.205954 2.165313 2.129121 3.729722 2.734431
121 8 3 0.927009 1.030602 1.893074 1.924100 1.978655 2.407363 2.199460 2.145836 2.879272 2.903436
122 8 2 0.885659 0.885855 1.911498 1.682296 1.680149 1.824944 1.860011 1.802674 2.476121 2.402554
123 8 3 0.914752 0.880635 1.900535 1.756912 1.773766 1.999581 1.980667 1.935432 2.657155 2.385441
124 9 2 0.897065 0.945882 1.431316 1.644649 1.813222 1.958209 1.936117 2.101228 1.892634 2.051697
125 9 3 0.899912 0.832779 1.722137 1.502466 1.831599 1.627293 1.828630 1.634072 1.905723 2.031388
126 9 3 0.917888 2.312529 2.734319 1.535529 2.056412 3.212372 2.005558 2.241658 2.102509 3.911318
127 10 2 1.014331 0.819800 1.819022 1.218740 1.955192 1.774166 1.757936 1.737307 1.942577 1.642570
128 10 2 2.302260 1.229778 8.415079 2.661379 2.971818 2.497188 2.549130 2.189093 2.679104 2.156852
129 10 3 nan nan nan nan nan nan nan nan nan nan
130 10 3 nan nan nan nan nan nan nan nan nan nan
131 11 0 1.549682 0.834683 1.779876 1.692346 2.306349 1.914330 2.529244 2.040863 2.795758 1.939065
132 11 1 0.923618 0.856888 1.825296 1.529997 2.255879 1.952514 2.303545 1.870380 2.226256 1.997665
133 11 0 0.967206 4.590947 3.354432 28.937361 2.080084 5.619325 2.273266 2.877079 2.020208 2.460573
135 12 2 1.029663 1.151804 1.662973 1.661602 2.376074 2.749961 2.248369 1.933921 2.112872 1.882432
136 12 2 0.969190 0.838691 1.701706 3.118098 1.643868 1.881775 1.699823 1.750826 1.567937 2.000131
137 7 3 1.237989 1.006923 3.266759 2.269573 2.621317 2.177176 2.593546 2.034053 2.744318 2.311348
138 7 1 nan nan nan nan nan nan nan nan nan nan
139 13 1 0.979829 0.867220 2.091925 2.038921 1.937653 2.236403 2.094478 2.273163 1.975091 2.720063
140 13 2 0.835210 0.875334 1.373471 1.790990 1.618996 1.656754 1.708613 1.858681 1.928199 1.902911
141 13 2 0.896917 0.870140 1.808155 1.390420 1.895634 1.793835 2.556175 1.974893 2.135246 1.715616
142 13 2 2.140815 1.081536 4.940607 1.502841 5.007888 2.199468 2.812847 2.374446 3.876206 2.056818
143 14 2 0.904481 0.825339 1.430972 1.166642 1.647629 1.662189 2.088279 1.603362 1.907799 1.665885
144 14 3 nan nan nan nan nan nan nan nan nan nan
145 14 3 nan nan nan nan nan nan nan nan nan nan
146 14 3 nan nan nan nan nan nan nan nan nan nan
147 15 0 0.837466 0.899490 1.636531 1.814603 2.012805 1.875375 1.934155 1.842853 1.879751 1.740517
148 15 0 0.823966 0.805356 1.254725 1.414147 1.575265 1.779488 1.653765 1.822496 1.614021 1.760639
149 15 0 0.851711 0.848914 2.176174 1.484888 1.815121 1.911054 1.945166 1.950088 2.002597 2.037504
150 15 1 0.945865 0.867131 1.516080 1.638303 1.607878 1.752544 1.851441 1.883915 2.097376 2.208877
155 12 2 0.978105 1.280910 1.849786 10.222355 2.033412 2.742823 2.204048 2.252310 2.093651 2.208416
156 12 3 2.752104 1.741735 11.571327 10.956708 3.716249 3.023596 3.507357 3.530170 3.295611 1.839815
157 12 3 0.958888 0.877046 1.384243 1.477085 2.060266 1.960386 1.982603 2.089148 2.154088 2.500990
158 12 3 1.282270 0.848969 2.797718 1.433441 2.950314 1.757599 2.921178 1.848773 3.297252 2.006725
159 13 1 1.946054 0.872958 1.442438 1.621094 2.838779 1.952094 2.081021 2.061743 2.640095 1.769141
160 13 3 0.887421 0.895621 1.571271 1.650228 1.904641 1.875365 1.972538 1.820037 2.159318 2.107631
161 13 0 2.012902 0.852357 2.691082 1.415305 5.193758 1.985729 4.343377 2.079877 2.733009 1.711852
162 13 0 0.908304 0.926711 1.923915 1.678278 1.944804 1.778082 2.049520 2.106490 3.018165 3.338705
163 14 2 0.932247 0.868126 1.946173 1.601487 2.158553 2.007420 2.120852 2.117650 2.024902 1.984353
164 14 2 0.899653 0.864224 1.532992 1.265860 1.865655 1.941117 2.094621 1.867867 2.065048 1.745725
165 14 0 0.828503 2.567977 1.680672 1.186134 1.941622 3.137164 2.061375 2.816973 2.052296 2.697037
166 14 0 0.872145 0.815239 1.557462 1.119247 1.652684 1.657615 1.991570 1.596817 1.807204 1.617924
167 15 1 0.903511 0.834970 1.377303 1.548554 1.916747 1.704659 1.849932 1.866918 1.722935 1.894407
168 15 2 0.872988 0.807424 1.479591 1.579054 1.813972 2.365390 2.060865 2.006844 1.753408 1.755639
169 15 2 1.083530 0.959871 1.578322 1.374921 1.916720 1.726335 1.989902 1.778056 2.201321 1.458315
170 15 2 1.005325 1.429639 2.204634 4.301644 2.370633 3.443980 2.773112 2.132727 2.394102 1.968688
179 12 1 0.863754 0.868316 1.296858 1.754457 1.831211 1.867664 1.807203 1.749779 1.982288 1.854672
180 13 3 5.961264 1.724954 13.614340 1.821015 7.460743 2.070913 2.692579 2.389008 2.756273 2.523405
181 13 3 0.897792 0.843374 1.823425 1.394827 1.808786 1.910194 2.345719 2.087854 2.245759 2.217202
182 13 0 0.810040 0.942703 1.930451 1.311708 1.969545 1.722307 2.070993 1.761642 2.019944 3.587046
183 13 1 1.022091 0.849035 3.119647 1.656951 2.065637 1.731625 2.355071 1.885254 2.085122 1.733700
184 14 0 0.833907 0.856988 1.478481 1.556233 1.745505 1.793872 1.915645 1.958354 1.859494 1.859085
185 14 1 0.864266 1.707563 1.272209 3.198270 1.781074 2.215358 1.732513 2.073560 1.916510 1.967566
186 14 1 0.871676 0.911970 1.544714 1.664601 1.720656 1.859002 1.809201 2.038617 1.724098 1.914585
187 14 1 0.914202 0.878241 1.291923 1.624633 1.766576 1.999199 1.819913 2.025425 1.751595 2.159408
189 15 3 1.812123 2.000274 18.370195 10.296600 2.872693 2.354064 2.690103 1.975662 2.850431 2.098644
190 15 3 0.896717 0.837420 1.640827 1.534410 1.844387 1.971405 2.089939 1.980418 1.835834 2.015551
191 15 3 0.924101 0.869824 1.725021 1.691286 2.069861 2.191855 1.893062 2.336924 1.988411 1.913535
200 18 0 1.906358 6.512892 1.278678 15.464688 2.054414 5.774015 1.965076 10.087584 1.908323 2.100581
201 18 0 0.812322 0.855387 1.982937 2.120755 1.782073 2.017305 1.971808 2.053563 1.964150 1.858056
202 18 0 1.812449 0.899428 4.431438 1.769515 4.224729 1.863211 3.291717 2.079320 2.754933 1.950302
203 18 1 nan nan nan nan nan nan nan nan nan nan
205 19 0 1.241123 0.833533 3.420648 1.467111 3.036068 1.722838 2.393040 1.877459 2.359595 1.584131
206 19 0 1.033777 0.932619 2.667487 1.878486 2.498208 1.752417 2.193851 1.898044 1.885711 1.784046
207 19 1 0.864957 0.940634 1.833258 2.096578 1.924212 2.021677 1.986224 2.167973 1.572285 2.004150
208 20 2 15.786264 16.628843 82.166801 173.837478 13.687403 8.320476 13.848315 28.596597 2.950624 1.691015
209 20 2 6.015488 6.530085 12.598091 27.112873 1.989089 2.809423 2.324914 10.478820 1.932325 2.004879
210 20 2 0.940202 1.160485 1.789922 2.739694 1.935512 2.221300 1.846593 1.853343 1.841727 1.803852
211 20 0 0.843944 0.862360 1.986498 2.373168 1.709647 2.023647 1.914954 1.901772 1.876693 2.110474
219 18 1 nan nan nan nan nan nan nan nan nan nan
220 18 2 0.877027 1.257102 1.847947 6.811239 1.930932 2.572958 2.108513 2.629487 2.050218 2.215783
221 18 2 0.972346 1.708615 1.581970 5.999068 2.017011 4.984246 1.884554 4.072024 1.899873 3.698361
222 18 2 0.965440 0.966427 1.671228 1.493388 1.664136 1.762682 1.737929 1.728613 1.844445 1.746281
223 19 1 0.877290 0.916697 1.716408 1.912747 1.986085 1.897443 2.144497 1.895310 1.775081 1.568975
224 19 1 0.824577 4.766156 1.763861 25.347784 1.711344 1.771623 2.029089 1.755473 2.218286 3.577683
225 19 2 1.876943 0.865478 10.130375 2.200883 2.505441 1.977317 3.035434 2.347961 3.771098 2.277833
226 19 2 1.010852 0.825638 2.171472 1.840928 1.963931 1.671625 1.849213 1.892866 1.784920 1.575034
227 20 3 0.900770 0.970118 2.141650 2.146233 1.774154 2.147348 1.914100 2.309058 1.627819 2.159635
228 20 3 1.783440 1.170691 1.751483 2.004606 2.112195 2.009389 1.818167 1.997896 1.808370 1.871668
229 20 3 0.835835 0.819318 1.694265 1.886718 1.543360 1.754244 1.738502 1.853473 1.907790 1.678619
237 18 3 0.908636 0.872623 1.593542 1.850428 1.979496 2.351903 2.060861 2.100803 1.868417 2.057241
238 18 3 0.946671 0.816475 2.047686 1.551918 2.231991 1.696201 2.214400 1.624988 2.328114 1.893437
239 18 3 0.910523 0.832913 1.793039 1.888274 1.930638 1.855920 1.851798 2.000547 1.694299 1.926640
240 19 2 3.791172 2.750536 1.259985 2.348350 3.182759 2.465897 2.356259 2.206015 2.625114 2.523280
241 19 3 1.048952 0.942085 1.631410 2.373825 2.366423 2.146090 2.115318 2.038669 1.914385 1.981383
242 19 3 0.892011 3.072676 1.916005 0.987423 1.953527 3.850513 2.149584 2.683015 2.155397 3.263731
243 19 3 0.954174 2.695142 1.681870 1.337446 2.075872 3.811548 1.826457 2.486080 1.825176 2.767558
244 20 0 0.987808 1.405028 1.650901 6.753253 1.856105 2.391165 1.908525 2.136577 1.764781 1.914766
245 20 0 0.915752 0.873278 1.659097 1.862975 1.855417 1.764418 1.842740 2.027071 1.781035 1.948558
246 20 1 1.173129 1.305249 2.140549 2.117667 1.817709 1.705160 2.014749 1.865347 1.908989 1.706437
261 20 1 0.822575 0.805523 1.892793 1.986484 1.847826 1.708960 2.160044 1.872153 1.816250 1.781665
262 20 1 5.438217 4.316416 11.220741 10.307580 2.255826 2.183425 1.778765 2.244896 2.139216 1.763616
320 3 2 4.942913 4.681885 7.388061 10.668523 13.722899 13.664906 8.123111 8.968028 8.824303 4.545029
324 4 3 0.935562 1.017455 1.635609 1.666609 1.734623 2.012142 1.969264 1.973235 1.753912 1.767087
325 9 2 0.920181 0.896950 1.677124 2.043017 2.024851 1.876230 2.117319 1.940825 2.017190 1.879508
329 12 1 0.950999 0.969308 1.721189 3.104906 1.712391 1.703399 1.960390 1.992376 1.679694 1.767450
333 12 1 0.939357 1.234067 1.463137 2.467042 1.787763 3.228691 1.657979 1.980694 1.561591 1.871478
In [16]:
csv_file = os.path.join(nb_outdir, 'ds_noise_ratio_{}.csv'.format(JD))
df.to_csv(csv_file, index=False)

Delay spectrum and autocorrelation plot per baseline per polarization for a given frequency (sub-)band¶

Left panel: time averaged delay spectum of autocorrelation in dB with 10*log10($|\tilde{V}|$) (blue) and noise from diff file representing the expected variance of the delay spectrum (red). The time-averaging is performed by 1. binning three time integrations of each even and odd visibility, 2. Fouier transform the binned even and odd visibilities, and 3. multiply the even and odd delay spectra at alternating time bin and average the squared delay spectrum along the time axis. This helps to reduce the noise bias. Both autocorrelation delay spectrum and diff delay spectrum are averaged in the same way

Right panel: time averaged autocorrelations w/o (orange) and w/ xRFI flags (blue). Flagged one is shifted from the unflagged one for clarity

In [17]:
utils.interactive_plots_dspec(bls, uvd, uvd_diff, JD)
In [ ]: