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 = 2459828
Date = 9-5-2022
data_path = "/mnt/sn1/2459828"
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)
372 sum files found between JDs 2459828.25316 and 2459828.33616
372 diff files found between JDs 2459828.25316 and 2459828.33616

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 0.984377 0.996858 1.389747 1.594384 1.976718 1.816018 1.656976 1.741687 1.706237 2.152208
4 1 2 1.040045 0.945336 1.505621 1.576001 2.154109 2.168871 1.922821 2.263121 2.501834 2.711919
5 1 2 0.866374 0.998504 1.403934 1.625921 1.609060 1.950993 1.830857 2.024253 4.840529 4.881660
7 2 0 0.914935 0.960839 1.635945 2.395582 1.938908 1.836398 1.758352 1.724187 2.427971 3.062393
8 2 0 1.259013 25.551400 3.873202 66.111925 2.431923 112.587214 2.504512 103.622725 3.674667 124.627688
9 2 0 0.878423 0.908020 1.282306 1.307123 1.933154 1.928078 1.838328 2.155633 2.067879 2.163983
10 2 1 0.918978 1.032517 1.402973 1.562699 1.803742 2.388507 1.691485 2.450507 1.829432 5.248599
15 1 3 1.421977 1.270768 1.660063 1.425224 2.375740 2.099462 1.957722 1.712250 6.327639 5.082145
16 1 3 0.974078 1.019445 1.572496 1.298221 2.002869 1.806805 2.219682 1.738969 5.274797 3.067122
17 1 3 1.021924 1.211925 1.502977 1.379891 1.947702 1.737680 1.701139 1.715547 1.893604 2.069089
18 1 0 50.468987 32.123173 5.550518 3.288484 234.986793 157.319503 1.721327 2.007792 2.183680 2.143389
19 2 1 0.966233 1.196189 1.551809 1.608374 1.641386 2.251545 1.803077 1.880470 2.121842 3.794380
20 2 1 0.948870 0.934732 1.407978 1.269259 1.744500 1.878703 1.809847 1.758443 1.774802 2.173460
21 2 2 0.926343 0.850567 1.348059 1.489674 1.714334 1.882066 1.887908 1.904265 2.123612 2.664372
27 1 0 3.960438 5.796665 7.402842 15.598442 11.021290 5.661727 3.362235 2.096333 3.571687 1.890141
28 1 0 47.288267 1.380992 6.380466 1.433557 251.695516 2.053231 2.092504 2.314415 3.320230 4.342109
29 1 1 1.092364 1.011922 1.450939 1.426750 1.962406 1.845936 2.334830 2.550671 5.132231 3.898853
30 1 1 1.023996 1.148120 1.320089 1.651761 1.905482 2.053515 2.102037 2.855795 2.598437 4.062742
31 2 2 1.024421 1.227835 1.296284 1.485713 1.815155 2.150044 1.952915 3.816919 2.746178 6.260197
32 2 2 1.048414 2.185489 1.409458 0.764322 1.928378 3.140926 2.876498 9.538204 2.288875 4.402590
33 2 3 55.215911 0.955287 2.471244 1.880361 271.483820 1.965302 1.740736 1.803438 2.248111 2.510009
36 3 3 1.481848 1.340524 1.684094 1.487569 1.902301 1.989700 1.912535 1.682826 2.219937 2.367824
37 3 1 1.012561 0.929699 2.280420 1.230937 2.026822 1.990001 1.800976 1.995258 2.072131 2.797402
38 3 1 0.899289 1.071035 1.498765 1.584750 1.708706 2.615366 1.868244 2.574198 2.079020 2.557304
40 4 1 0.927286 1.258078 1.739579 1.526316 1.934545 2.149380 1.830851 2.256121 1.681727 2.935220
41 4 3 0.921106 1.474884 1.441126 3.390707 1.677827 2.053367 1.635082 1.814868 1.543622 3.086326
42 4 0 1.085741 0.984181 1.482325 1.274221 2.783663 1.942255 1.897637 2.159394 3.261324 5.522977
45 5 0 1.035734 1.240743 2.056247 1.581696 1.996303 2.096049 2.153232 1.933094 2.230191 2.331992
46 5 0 1.244739 1.179605 1.608682 1.435519 2.460573 2.180600 1.737748 1.506580 2.221204 2.507186
50 3 3 0.866559 1.330802 1.778847 1.276678 2.259960 1.869066 1.989197 1.842102 2.329433 1.714033
51 3 2 3.643834 0.867275 12.549853 1.931516 1.887763 2.001991 1.652204 1.863483 1.757482 3.114019
52 3 3 1.468852 1.596356 1.503338 1.925916 2.193616 2.180727 1.962618 1.866935 2.209767 2.416424
53 3 2 1.059846 1.296781 2.387229 2.156012 2.235512 3.086189 2.034527 2.337710 3.046104 3.392785
54 4 0 1.136108 0.845597 1.237557 1.155062 2.340961 2.069550 1.780219 1.711421 2.344460 2.832348
55 4 2 0.919118 0.979837 1.480049 1.410238 1.894019 1.856450 1.916031 1.668812 2.327716 2.492831
56 4 1 1.126754 1.353431 1.485885 1.533342 2.441384 2.207882 2.150818 1.982453 3.107197 2.901353
57 4 3 1.008862 1.572228 1.564489 3.315747 1.918539 3.169785 1.869523 1.954365 2.068374 2.411000
65 3 0 1.034506 0.989406 2.081996 1.372139 2.355735 1.826991 2.042783 1.829470 2.255354 2.079230
66 3 0 1.389129 1.015332 3.326095 1.668688 3.860321 2.061502 2.655721 1.833532 2.702451 2.518368
67 3 0 0.876100 0.971778 1.508529 1.373537 1.763107 1.865474 1.557207 1.890509 2.052948 2.011232
68 3 1 0.955000 0.889071 1.326041 1.609584 1.908326 1.894412 1.592376 1.841645 1.578756 3.361714
69 4 1 0.961862 1.258185 1.426072 1.684038 2.003828 2.251146 2.086834 2.060134 2.234319 2.822626
70 4 2 1.373463 1.675754 1.458889 1.675150 2.785629 2.561238 2.938059 2.605896 2.206285 3.180872
71 4 2 1.024521 1.280870 1.400367 1.631098 1.760561 2.062322 1.891988 1.821966 1.985394 1.995945
72 4 0 1.033548 0.974249 1.390542 1.544346 2.259271 2.074647 1.746245 1.768198 2.370331 2.623838
73 5 0 1.062882 2.269938 1.678754 4.953581 2.340348 4.902280 2.071332 1.747990 3.046484 2.057208
81 7 0 1.366942 1.612682 1.625578 1.896198 2.117174 2.622062 2.309136 2.476590 7.385145 4.902203
82 7 0 1.043652 1.073929 1.344539 1.305303 1.708369 1.909349 1.795868 1.858150 2.471860 3.463481
83 7 0 0.953119 1.059897 1.500153 1.971645 1.846033 1.719137 2.052683 2.001386 2.805248 2.249911
84 8 3 1.446533 2.123363 1.710765 3.220872 1.965929 2.100646 1.865828 2.330566 5.142173 7.330333
85 8 0 0.900642 1.028577 1.635230 1.534421 1.738352 2.048774 1.833885 2.372884 2.828937 4.013178
86 8 0 1.516838 1.707883 1.905323 1.646060 3.255257 2.320614 3.041296 4.752971 6.071975 7.119537
87 8 2 1.299414 1.344493 1.581036 1.696744 1.679305 2.314277 1.602185 4.145566 2.652925 3.474901
88 9 0 0.907650 30.243292 3.063885 120.903134 1.821034 93.520784 1.835286 81.624906 2.505682 128.502756
90 9 0 0.847281 0.947134 1.534369 1.506689 2.171104 1.692477 2.056080 1.715297 2.511390 2.818311
91 9 1 nan nan nan nan nan nan nan nan nan nan
92 10 0 2.987341 1.948959 0.704651 0.880262 4.640508 2.303925 3.241720 2.114461 3.521719 2.540978
93 10 0 0.887620 1.034438 1.523952 1.389292 2.170544 2.174400 1.808925 1.822171 2.374035 2.528811
94 10 0 0.927439 1.230192 1.331021 1.553262 1.915632 2.066544 1.912265 2.038274 2.022690 5.112791
98 7 2 1.140035 0.829851 1.464020 1.853075 2.273333 1.937997 2.066853 1.899966 4.117703 2.404633
99 7 2 1.020566 1.124340 1.469935 1.525763 1.813217 1.843422 1.825306 1.964485 3.417099 3.189634
100 7 1 1.056526 1.103826 1.806933 1.765030 1.878859 1.974695 1.781584 1.858677 2.341542 2.502597
101 8 2 1.440065 1.549229 1.413992 1.479660 1.996374 1.733811 1.703900 1.573995 2.444368 3.317255
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 1.349944 1.045532 1.543863 1.302839 2.143540 1.665001 1.867329 1.552781 2.943907 1.947375
104 8 1 3.286736 1.665207 0.622889 1.534931 5.024389 2.159802 5.223441 1.773454 6.391006 2.396771
105 9 1 nan nan nan nan nan nan nan nan nan nan
106 9 3 nan nan nan nan nan nan nan nan nan nan
107 9 0 1.748024 20.724978 3.135783 47.589083 1.803771 87.495692 5.552547 85.166434 8.194310 86.031367
108 9 1 nan nan nan nan nan nan nan nan nan nan
109 10 1 2.011468 2.086591 1.803567 2.072497 5.027303 3.761530 1.768457 2.060600 1.981132 2.122379
110 10 1 0.838913 1.351719 1.640275 1.471073 1.965926 2.544645 1.705741 2.361352 1.870649 1.927688
111 10 1 0.930531 0.996308 1.907358 1.112006 2.427859 1.786867 2.045112 1.608045 1.888600 1.682691
112 10 2 0.916211 0.888401 1.353157 1.268181 1.836439 1.750636 1.815966 1.874911 1.906577 2.230129
116 7 2 0.867032 0.816177 1.396590 1.190361 1.982049 1.755307 1.567598 1.440105 3.171879 2.159962
117 7 3 0.923650 1.005509 1.458823 1.453933 1.657243 1.940261 1.736046 2.240655 3.160763 4.542598
118 7 3 1.939977 1.044104 4.636109 1.940362 2.923516 2.060235 3.697967 2.100610 4.036155 3.929591
119 7 1 0.806619 0.924046 1.275472 1.707259 1.657163 1.865775 1.759134 1.874471 2.432477 2.837414
120 8 1 3.850881 1.952890 11.936189 3.584830 7.929303 5.427835 10.436717 2.512120 30.060802 5.921280
121 8 3 1.658027 1.397800 2.573816 1.342509 3.705166 3.078687 3.106498 1.979673 5.069964 15.443223
122 8 2 1.531433 1.558558 1.633833 1.697935 2.270926 1.906788 2.348102 2.590241 3.869272 2.758604
123 8 3 1.466399 1.348873 1.622188 1.504409 2.040116 1.882974 1.781154 1.640102 2.755483 2.381406
125 9 3 nan nan nan nan nan nan nan nan nan nan
126 9 3 nan nan nan nan nan nan nan nan nan nan
127 10 2 1.231114 1.422481 2.242675 1.331200 2.965909 2.753947 3.519133 2.723845 3.503969 3.509296
128 10 2 0.990060 1.111962 1.364757 1.799877 1.986274 2.202839 1.975516 2.101677 2.377683 4.293637
129 10 3 0.912725 0.951013 1.303511 1.289820 1.760577 1.921744 1.779631 1.606017 1.691020 1.853164
130 10 3 1.134741 1.030902 2.073499 1.325226 2.279791 1.816223 2.188789 1.708792 2.172767 2.258933
135 12 2 1.101593 1.439404 1.500544 1.581081 2.742018 3.551622 2.412022 2.648622 2.415764 3.647520
136 12 2 1.024398 1.240005 1.178702 1.459511 1.830442 2.084792 3.034553 2.372844 1.885449 1.761607
137 7 3 0.906742 26.499357 1.728486 91.319195 1.697033 94.770192 1.840909 81.158050 2.646654 107.403994
138 7 1 0.792320 0.883817 1.355731 1.818938 1.709637 1.847764 1.757283 1.894166 2.181751 3.111931
140 13 2 3.184656 5.998339 14.656896 46.142765 3.357090 2.649408 3.897661 10.210369 6.995716 20.985158
141 13 2 5.684642 1.286558 11.302074 1.378475 19.024419 2.070500 11.717070 1.699399 7.937165 1.979013
142 13 2 3.995528 1.834931 7.188000 1.988164 8.232602 2.873889 2.930380 2.027949 4.319760 4.463825
143 14 2 1.090071 0.941953 2.407095 1.602942 2.598887 1.703673 2.521720 1.939007 2.708987 2.603950
144 14 3 1.148232 1.382460 1.632115 1.454536 2.564347 2.234815 1.924019 1.988585 1.847272 2.728123
145 14 3 6.803353 4.335882 18.851101 19.424522 20.799546 12.343500 2.995513 1.896882 2.637229 1.998377
150 15 1 2.738092 5.733551 18.444158 46.090334 4.473802 10.072229 3.559422 8.370884 5.315273 12.940050
155 12 2 2.463501 4.102167 6.140067 18.874958 3.038578 3.714522 3.128227 2.825012 3.591947 2.040243
156 12 3 1.329120 1.377322 1.803447 2.205350 2.276897 2.095692 1.857263 1.993328 1.715957 1.913161
157 12 3 1.176551 1.332007 1.732681 1.500343 2.322594 1.992763 1.986928 1.701506 2.031199 1.876316
158 12 3 1.474772 2.128073 4.043005 4.885521 4.523460 4.641583 3.469406 1.750178 3.500104 1.888405
160 13 3 3.510953 4.808470 14.623347 24.073933 6.894722 9.034671 4.265801 4.228555 3.354215 2.920686
161 13 0 2.953645 1.184965 1.092430 1.630026 4.387544 2.169028 3.503983 1.876262 6.285161 3.865766
162 13 0 1.021813 1.181832 1.291722 1.667068 1.775426 1.810190 1.803293 1.801074 1.519312 2.102090
163 14 2 0.973110 1.074071 1.799848 1.404682 2.331922 1.933529 2.257742 1.637072 2.461918 2.083678
164 14 2 0.946980 1.060490 1.411546 1.446125 2.048080 1.892023 1.863441 2.370464 2.213528 2.382035
165 14 0 nan nan nan nan nan nan nan nan nan nan
166 14 0 nan nan nan nan nan nan nan nan nan nan
167 15 1 2.693092 13.657979 1.797967 77.546116 3.699856 3.245563 2.496924 2.848459 2.377250 3.092907
168 15 2 1.567102 1.472642 4.054422 3.498685 2.514563 2.018818 5.168169 6.232026 8.088278 5.961185
169 15 2 1.284741 10.398775 3.466332 48.763553 2.229213 17.855114 3.462037 18.189297 7.139937 23.806623
170 15 2 1.350377 13.067197 3.034787 57.212942 2.626132 26.775446 3.959020 26.816250 6.016829 31.449159
176 12 0 0.889728 1.030395 1.398637 1.570457 1.854546 1.732132 1.878152 1.755805 2.372081 1.970551
177 12 0 1.022798 1.218542 1.241397 1.565448 1.746213 2.057123 1.619695 1.914138 1.727321 2.092519
178 12 0 0.916921 0.885304 1.324464 1.307300 1.801444 1.902589 1.716516 1.925898 2.064277 1.996079
179 12 1 1.475359 0.990194 1.384433 1.924089 2.599969 1.987080 3.032902 1.932569 2.159881 2.971738
180 13 3 1.985694 1.350909 13.168404 1.438165 5.269504 2.210529 3.342237 1.795844 2.996589 2.205114
181 13 3 2.659302 4.854153 1.022094 10.724383 4.678660 7.909179 2.283006 1.850125 2.288646 1.941322
182 13 0 1.096152 1.782141 2.046991 3.598288 3.317456 4.958230 1.713312 3.188639 1.803562 4.985208
183 13 1 1.082850 1.102148 1.580964 1.685828 2.673746 1.954311 1.747659 1.735018 2.611898 2.350723
184 14 0 nan nan nan nan nan nan nan nan nan nan
185 14 1 0.933614 1.325679 1.455259 1.969319 2.074377 2.173484 1.905993 2.746907 2.242457 2.413022
186 14 1 0.992939 1.134971 1.355970 1.554088 1.962912 2.158442 1.843628 2.007537 2.042058 2.437940
187 14 1 1.056628 1.469532 1.535850 2.202692 2.131314 2.937997 2.885003 3.676044 7.150156 9.515133
189 15 3 1.113191 1.424284 1.679122 1.356088 2.037617 2.028632 1.764524 1.641597 1.514103 1.761901
190 15 3 2.873869 2.142622 11.883615 0.983598 4.432713 2.215428 3.090314 2.295383 3.024194 3.246281
191 15 3 1.025945 1.118819 2.186042 1.658340 1.976747 1.963693 2.004305 1.813046 1.652491 1.711406
203 18 1 nan nan nan nan nan nan nan nan nan nan
205 19 0 0.071612 0.081055 0.031074 0.017593 0.079410 0.064573 0.022877 0.017672 0.022332 0.019734
206 19 0 0.082948 0.067646 0.018982 0.018144 0.079670 0.049349 0.020769 0.015960 0.024075 0.019340
207 19 1 0.069970 0.063405 0.018074 0.016057 0.071024 0.061227 0.017024 0.015083 0.017886 0.016886
220 18 2 nan nan nan nan nan nan nan nan nan nan
221 18 2 nan nan nan nan nan nan nan nan nan nan
222 18 2 nan nan nan nan nan nan nan nan nan nan
223 19 1 0.078281 0.089962 0.015958 0.018773 0.059838 0.069106 0.016221 0.020003 0.018928 0.020241
224 19 1 0.040904 0.064156 0.008440 0.010836 0.037579 0.104842 0.015527 0.026424 0.028093 0.034361
241 19 3 nan nan nan nan nan nan nan nan nan nan
242 19 3 nan nan nan nan nan nan nan nan nan nan
243 19 3 nan nan nan nan nan nan nan nan nan nan
320 3 2 5.057550 4.282015 11.828804 29.469712 6.560585 5.720097 7.016710 3.681760 5.626989 3.493657
321 2 3 0.941083 1.647599 1.612951 2.154557 1.779133 2.127917 1.887493 1.921254 1.977132 2.383070
323 2 3 1.007519 2.370227 3.187748 4.496164 1.694765 2.519285 1.701528 1.929343 1.778015 2.587754
324 4 3 1.060230 1.861848 2.731571 48.353151 1.786625 2.628988 1.740249 1.902166 1.668518 1.979553
329 12 1 1.338648 1.454008 4.616593 23.105320 1.972490 1.919338 1.763904 1.717788 2.027944 1.997566
333 12 1 1.297624 1.169997 1.872733 1.710241 2.395498 2.644481 1.998106 1.810294 1.887549 1.748197
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 [ ]: