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 = 2459845
Date = 9-22-2022
data_path = "/mnt/sn1/2459845"
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)
2185 sum files found between JDs 2459845.20741 and 2459845.74975
2185 diff files found between JDs 2459845.20741 and 2459845.74975
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Input In [3], in <cell line: 19>()
     17 times_uvf = np.unique(uvf.time_array)
     18 times_uvd = np.unique(uvd.time_array)
---> 19 idx_times = [np.where(time_uvd == times_uvf)[0][0] for time_uvd in times_uvd]
     20 uvd.flag_array[:,0,:,:] = np.repeat(uvf.flag_array[idx_times], len(bls), axis=0)

Input In [3], in <listcomp>(.0)
     17 times_uvf = np.unique(uvf.time_array)
     18 times_uvd = np.unique(uvd.time_array)
---> 19 idx_times = [np.where(time_uvd == times_uvf)[0][0] for time_uvd in times_uvd]
     20 uvd.flag_array[:,0,:,:] = np.repeat(uvf.flag_array[idx_times], len(bls), axis=0)

IndexError: index 0 is out of bounds for axis 0 with size 0

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')
In [10]:
utils.plot_antFeatureMap_2700ns(uvd, _data_cleaned_sq, JD, pol='ee')

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')
In [13]:
utils.plot_antFeatureMap_noise(uvd_diff, d_even, d_odd, JD, pol='ee')
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 46.811465 28.624084 25.723036 5.486776 243.211833 161.661356 1.250887 0.600645 1.141519 1.040403
4 1 2 8.310963 15.040884 3.079761 1.679240 44.102508 86.767985 0.261404 0.339813 0.214773 0.562810
5 1 2 9.279993 10.463566 2.894468 1.664140 55.751212 56.266615 0.423120 0.148916 0.301354 0.371624
7 2 0 18.580642 16.128546 2.907039 4.354787 102.872889 82.227843 0.456545 0.368191 0.462484 0.510124
8 2 0 1.253936 1.898301 0.181305 2.676124 7.467317 9.485860 0.232949 4.217743 0.073646 4.486242
9 2 0 18.184654 21.786620 2.137126 7.642111 108.197516 110.300456 0.558134 0.327805 0.559452 0.689467
10 2 1 17.306096 18.361977 2.959037 3.190782 108.199465 107.932044 0.654550 0.521959 0.544962 0.683518
15 1 3 15.031978 13.388091 2.085350 2.944150 66.498851 59.065228 0.139787 0.109004 0.308577 0.355030
16 1 3 11.158198 9.795401 1.041486 8.370725 66.586834 55.259992 0.178840 0.105446 0.423028 0.347743
17 1 3 18.518274 20.539977 2.347085 1.822090 107.574374 100.858946 0.234407 0.201210 0.503130 0.547856
18 1 0 5.553857 14.750662 0.573689 2.951507 25.382686 90.479068 0.037418 0.095527 0.090123 0.591047
19 2 1 13.023541 14.697037 1.578452 2.157136 82.033097 81.627384 0.272308 0.235485 0.409176 0.895246
20 2 1 17.555560 24.712857 0.945440 5.098952 105.242694 144.470448 0.233660 0.216989 0.536605 0.867065
21 2 2 29.020532 29.919439 24.479017 6.195593 166.368796 163.317239 0.324109 0.196036 0.769968 0.961240
22 6 0 31.167632 35.678861 15.181667 41.616463 173.546321 158.245755 0.967244 0.321575 1.382823 1.819142
27 1 0 1.324164 0.814546 0.939066 8.022267 0.033401 0.037434 0.013208 0.008024 0.017130 0.006825
28 1 0 14.585238 25.113194 2.029525 1.729977 91.700316 131.334165 0.195263 0.118427 0.190682 0.520944
29 1 1 17.702080 16.865615 1.635061 0.837889 103.384246 87.211893 0.395078 0.160639 0.602343 0.478879
30 1 1 13.170957 24.770618 3.220436 3.824593 72.944758 140.006451 0.155825 0.228388 0.366324 1.798710
31 2 2 33.958232 23.699647 4.238955 4.958995 176.559325 127.489281 0.411987 0.264199 0.932575 0.782749
32 2 2 27.310549 21.713493 10.735328 2.068173 153.926061 120.276149 0.584055 0.169846 0.552876 0.246944
33 2 3 26.728944 20.088557 22.430521 5.230633 103.619046 106.896561 0.135077 0.154499 0.492377 0.576358
34 6 0 43.536463 49.802619 6.877897 98.745027 199.544602 0.910334 0.811836 0.172854 1.054855 0.173327
35 6 0 32.080737 27.111700 18.999565 34.021927 162.048279 125.956320 2.247583 0.524613 0.950650 2.195061
36 3 3 33.818497 17.960416 39.147904 34.209824 159.448779 73.730027 0.707115 0.214406 0.951630 0.516877
37 3 1 14.793354 26.826843 3.255632 4.455604 81.024605 154.901352 0.233619 0.406112 0.435433 0.949351
38 3 1 32.920837 25.947816 3.328439 16.031105 194.615023 132.567402 0.486537 0.296289 1.077056 0.754422
40 4 1 38.562627 23.612967 12.884537 5.191759 217.459797 124.341893 0.497374 0.239302 1.088784 0.778201
41 4 3 36.437312 25.770972 7.860047 6.310923 200.076328 134.932116 0.415221 0.459369 0.958098 1.088468
42 4 0 47.454180 27.750091 3.834059 1.612679 255.538492 143.756858 0.467355 0.256001 1.192893 0.932800
44 5 1 48.661889 36.149544 74.728630 8.099451 205.169941 146.823003 0.520772 0.306686 1.029216 0.794394
45 5 0 28.573360 27.905521 3.764418 2.719076 157.169269 146.060642 0.450169 0.217220 0.919275 0.787092
46 5 0 12.850191 26.364645 2.759732 13.547819 0.207803 136.516973 0.017530 0.321610 0.029160 0.850415
47 6 1 28.747284 36.612265 25.463811 4.623047 164.623718 168.737942 0.866311 0.394823 0.877497 1.133248
48 6 2 22.207045 22.155903 17.601750 16.789434 131.176251 118.175984 1.532210 0.770050 0.837994 1.183447
49 6 2 27.241157 38.118862 6.672642 4.155761 142.717929 180.989653 3.089478 1.387052 0.893214 1.344128
50 3 3 10.487908 9.743488 22.939934 20.996703 44.966696 40.066932 0.135371 0.098311 0.277243 0.271814
51 3 2 32.175606 47.263413 2.445196 27.054443 175.348276 1.060444 0.519922 0.121725 0.913777 0.099223
52 3 3 17.497513 12.912996 37.258363 28.301159 74.183509 52.487959 0.179681 0.102205 0.371475 0.344999
53 3 2 40.653139 38.518934 3.542678 9.845876 217.722819 197.893073 0.504905 0.593620 1.199515 1.426447
54 4 0 56.868357 75.578066 16.488126 17.643155 317.417275 1.369937 0.656675 0.092210 1.681193 0.077169
55 4 2 41.299883 32.172408 19.891563 11.163872 220.968482 165.725908 0.397091 0.291318 1.120367 0.937195
56 4 1 45.380166 24.175349 7.662469 2.193301 248.964838 130.219772 0.742328 0.332985 1.303159 0.783120
57 4 3 45.489409 25.214289 7.318579 5.357072 237.481544 127.700717 0.421648 0.052246 1.270919 0.346909
58 5 1 238.282135 109.815094 674.587933 436.427825 4.347268 2.126850 0.255929 0.101047 0.266851 0.085333
59 5 1 55.977104 30.328821 157.751918 82.478258 289.851914 142.196175 0.473792 0.283304 1.403647 0.849846
61 6 1 47.425525 33.568500 29.222788 55.370491 249.960605 184.677300 1.057790 0.344138 1.399946 1.195077
62 6 2 21.938336 22.391126 17.840684 15.086645 118.186541 121.262000 1.441010 0.925509 0.757612 0.947651
63 6 3 80.596280 22.859597 221.468856 38.557788 1.565977 120.690325 1.127227 1.021805 2.341330 1.660760
64 6 3 23.605008 36.820378 15.978538 29.444730 134.219465 176.861916 2.220769 2.242943 0.926434 3.414503
65 3 0 35.124433 32.870094 2.652226 5.639516 187.916428 160.093499 0.651691 0.469243 1.109470 1.097531
66 3 0 45.680985 30.403040 10.054123 11.780726 249.268052 160.241765 0.495877 0.578031 1.350067 0.978960
67 3 0 14.119338 26.958876 0.901695 3.851687 68.638248 143.977212 0.154405 0.303379 0.375132 0.870719
68 3 1 184.725855 26.611978 47.859233 5.598937 3.379943 133.847387 0.497389 0.304588 0.664523 0.867391
69 4 1 46.931076 33.295838 4.058439 22.934122 266.454790 183.208999 0.453099 0.313302 1.481263 1.337117
70 4 2 20.186837 14.165307 3.295299 0.867622 112.538543 82.402635 0.268827 0.183977 0.563778 0.488044
71 4 2 47.522297 26.521131 11.408055 3.558313 260.607145 146.246619 0.614030 0.226715 1.528358 0.884976
72 4 0 49.012857 25.097122 19.882287 2.592874 265.742231 133.689966 0.604981 0.192763 1.449001 0.670098
73 5 0 34.364969 49.749103 7.264453 68.533574 198.642518 1.278943 0.394901 0.098894 0.971326 0.092590
75 5 3 650.223212 23.693307 197.680709 6.355380 14.294946 123.873044 4.747757 0.177763 7.954403 0.703472
77 6 1 33.021385 23.855414 26.683064 35.986471 182.482387 110.244019 0.408932 0.305575 0.820299 0.701049
78 6 3 21.631186 28.071048 21.254776 30.769350 121.029778 141.512689 0.965063 0.521727 0.779951 0.569342
81 7 0 45.155040 35.957356 12.918077 8.579946 246.385334 188.054519 0.769345 0.377326 1.267926 1.103921
82 7 0 48.923664 35.111458 20.585198 13.020453 250.652173 195.565949 0.561155 0.832195 1.161634 1.250169
83 7 0 43.070049 23.517401 2.689408 1.903430 248.062914 125.624439 0.774573 0.345468 1.040699 0.759557
84 8 3 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
85 8 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
86 8 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
87 8 2 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
88 9 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
89 9 2 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
90 9 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
91 9 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
92 10 0 25.312113 20.357804 4.385687 16.867038 148.452212 107.282599 0.268555 0.226691 0.299040 0.267781
93 10 0 24.275094 25.544158 6.335091 3.063573 151.787841 140.539321 0.404069 0.158354 0.662333 0.792747
94 10 0 21.584235 18.287748 11.090411 2.985102 120.981251 98.898875 0.283218 0.179731 0.562054 1.308513
98 7 2 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
99 7 2 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
100 7 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
101 8 2 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
102 8 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
103 8 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
104 8 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
105 9 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
106 9 3 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
107 9 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
108 9 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
109 10 1 1.990184 24.888627 4.903929 12.837074 0.047771 132.884461 0.032575 0.228848 0.050396 0.860489
110 10 1 26.889256 23.167105 3.229823 1.905006 147.858984 141.860861 0.382051 0.430230 0.641997 0.681206
111 10 1 2.672002 23.630069 2.163756 1.748452 8.198110 126.028093 0.035684 0.201748 0.057578 0.783029
112 10 2 23.101659 33.594823 9.190027 5.011992 135.664172 181.657012 0.492754 0.204460 0.696975 0.873296
116 7 2 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
117 7 3 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
118 7 3 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
119 7 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
120 8 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
121 8 3 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
122 8 2 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
123 8 3 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
124 9 2 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
125 9 3 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
126 9 3 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
127 10 2 26.111838 27.119242 2.268726 5.087248 154.591149 147.679786 0.314684 0.174872 0.777206 0.929419
128 10 2 15.920839 26.642113 1.221093 3.675151 80.341650 139.703676 0.353013 0.281734 0.374317 0.931861
129 10 3 11.568662 19.212666 3.370882 5.497956 60.389141 108.970792 0.181954 0.358211 0.268719 0.755782
130 10 3 30.466653 25.171322 15.009970 3.027822 162.147591 132.920313 0.445601 0.314107 0.733791 0.693453
135 12 2 38.957357 26.707064 8.052948 4.740237 203.792344 151.155333 0.321536 0.203483 1.473899 1.104710
136 12 2 35.197934 40.377900 5.723418 12.878109 201.964904 211.945769 0.402549 0.714766 1.157863 1.335843
137 7 3 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
138 7 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
140 13 2 21.796071 11.186606 10.335685 1.631182 0.359924 0.191627 0.032801 0.053478 0.057340 0.039769
141 13 2 29.522447 22.299088 9.246763 6.173993 151.585808 121.551084 1.154460 0.129146 1.703360 0.619814
142 13 2 132.919916 21.900709 25.665433 1.844961 2.509579 120.332585 0.229146 0.118271 0.304612 0.198606
143 14 2 1.499778 2.895411 0.328144 2.853797 8.820885 16.285608 0.184714 2.720071 0.193704 2.607366
144 14 3 13.678084 20.633946 3.257663 1.902081 76.624184 118.788287 0.118723 0.167592 0.381519 0.684371
145 14 3 2.155377 2.721643 2.710692 12.192011 0.046711 0.065672 0.009837 0.008232 0.011586 0.008187
147 15 0 7.875297 10.240378 14.077556 12.155302 33.954352 43.343766 0.139673 0.155439 0.183945 0.277378
148 15 0 7.950723 7.317769 16.389253 15.953978 34.419633 31.839454 0.121219 0.088438 0.155545 0.196679
149 15 0 6.080620 7.268919 16.623547 15.771040 0.097859 30.395388 0.006130 0.071057 0.006523 0.150421
150 15 1 1.696072 2.723394 6.033093 4.642325 0.031714 0.047351 0.009655 0.004412 0.010450 0.003512
155 12 2 11.674590 12.338468 1.464183 4.598755 0.186919 0.228825 0.014208 0.043657 0.021168 0.035651
156 12 3 35.301405 27.416834 5.340929 8.332987 189.946912 135.459980 0.577918 0.389998 0.976229 0.966550
157 12 3 42.263405 32.487651 8.248630 2.973522 242.607870 165.276208 1.210420 0.349805 1.359094 1.138699
158 12 3 32.024014 2.370648 2.049234 12.300797 166.071987 0.058749 0.603593 0.015500 0.959344 0.014271
160 13 3 120.007091 15.222735 75.248733 165.077956 2.213843 0.414481 0.284153 0.331445 0.354985 0.316345
161 13 0 44.116155 23.150184 5.140699 4.921941 229.047282 122.762747 0.915979 0.335365 0.698155 0.832529
162 13 0 39.060864 24.551613 5.332753 1.801647 222.931648 133.635197 0.864886 0.316299 1.102079 0.720690
163 14 2 24.277453 17.070176 2.343349 1.995503 127.541511 79.442720 0.336879 0.144670 0.605853 0.516065
164 14 2 14.815613 15.629233 4.592590 6.021955 76.055208 89.005127 0.202155 0.231032 0.349124 0.560894
165 14 0 7.937898 8.455626 16.308793 3.801724 32.679472 36.491112 0.121693 0.227325 0.166574 0.224825
166 14 0 8.074297 8.859276 17.625015 19.797348 32.544726 35.431050 0.056870 0.042157 0.179088 0.223074
167 15 1 13.538433 23.010761 2.717402 10.114538 85.846161 123.489229 0.227940 0.229959 0.535489 0.740860
168 15 2 11.779727 11.485169 1.512678 1.486401 72.915956 61.590609 0.237038 0.127076 0.389574 0.320964
169 15 2 14.891698 16.193830 3.670505 1.156347 93.117252 101.827999 0.195345 0.224891 0.452685 0.573594
170 15 2 10.153548 8.040242 0.838466 0.801838 52.524445 50.040761 0.121855 0.174678 0.291634 0.335926
176 12 0 38.967429 35.613944 4.993532 3.546795 216.774171 196.681716 0.789120 0.537619 1.554927 1.469298
177 12 0 39.135112 34.026284 6.440949 15.102538 206.801733 189.661080 0.435107 0.499305 1.272958 1.417272
178 12 0 36.083014 28.678166 9.176539 3.563569 184.409277 150.448030 0.407627 0.236549 1.223318 1.047562
179 12 1 34.696314 24.092834 5.897361 1.526927 199.640000 131.753559 0.487594 0.266355 1.303366 0.911609
180 13 3 6.847734 29.453092 7.967558 10.959791 22.003136 149.975347 0.041538 0.263987 0.112591 0.978833
181 13 3 33.489305 71.774205 7.682638 40.660178 177.212506 1.335926 0.532953 0.099056 0.555129 0.088200
182 13 0 8.283524 14.767578 45.646662 2.876312 0.793245 84.858143 0.232232 5.760137 0.261225 5.408228
183 13 1 47.013345 27.173714 6.691384 4.070500 264.732131 139.949673 0.491575 0.236820 1.369279 0.834219
184 14 0 10.870820 9.648686 17.516955 20.930543 48.877493 39.224928 0.094337 0.073353 0.264169 0.227754
185 14 1 15.247434 21.343816 1.489247 3.215203 68.762584 126.081221 0.186312 0.425106 0.372764 0.808942
186 14 1 17.586445 14.851325 3.192086 2.342637 95.530894 72.250776 0.250479 0.254327 0.522779 0.397835
187 14 1 21.019601 26.202537 3.443508 3.420566 127.171520 125.011434 0.312195 0.289223 0.762382 0.988011
189 15 3 17.203792 11.050596 4.589710 2.148283 95.665934 50.695027 0.143282 0.060771 0.500529 0.275676
190 15 3 1.154548 17.092097 9.659293 1.793438 0.041850 98.759673 0.032298 0.141119 0.042642 0.667674
191 15 3 13.247665 12.934343 1.894504 0.743126 80.414608 77.690695 0.149041 0.153074 0.409445 0.410311
320 3 2 6.056482 6.785949 12.830748 1.277045 0.102261 40.523661 0.028939 0.420342 0.038369 0.322348
321 2 3 35.379273 32.187259 34.398524 3.846038 194.730705 159.086194 2.257142 1.739188 1.745917 1.507652
322 5 3 9.613830 19.038131 3.974908 3.902678 53.543304 101.767003 0.567576 0.579521 0.483602 0.830443
323 2 3 24.699024 27.760300 2.700269 30.395846 125.146090 129.881423 1.690519 0.145878 1.211780 0.844827
324 4 3 19.662465 23.338639 3.646496 2.222041 103.017290 107.984575 1.402163 0.688707 0.935233 0.932696
325 9 2 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
329 12 1 34.025997 24.600805 35.964352 2.088156 174.384204 125.940803 1.663594 0.334226 1.450088 1.017286
333 12 1 23.208571 32.775970 1.977452 2.112874 122.161200 123.279638 0.922349 0.319696 0.938477 0.908001
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 [ ]: