In [1]:
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 = 2459776
Date = 7-15-2022
data_path = "/mnt/sn1/2459776"
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)
1862 sum files found between JDs 2459776.41746 and 2459776.83376
1862 diff files found between JDs 2459776.41746 and 2459776.83376
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/tmp/ipykernel_3292/2615544659.py in <module>
     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)

/tmp/ipykernel_3292/2615544659.py 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 10log10($|\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 nan nan nan nan nan nan nan nan nan nan
4 1 2 nan nan nan nan nan nan nan nan nan nan
5 1 2 nan nan nan nan nan nan nan nan nan nan
7 2 0 367.641057 398.276527 173.282552 55.973692 1830.399234 1754.096895 1.958553 3.047680 3.904507 7.720671
8 2 0 86.808432 110.142625 2.982646 163.133156 357.513171 439.388679 2.308911 164.753527 2.240719 212.865282
9 2 0 22.658747 19.933390 1.831293 0.517058 128.078298 98.489183 0.378218 0.116960 1.987733 0.716348
10 2 1 567.861234 362.531925 85.096105 51.807570 2850.976832 1689.528047 1.892982 2.380659 1.496285 3.111133
15 1 3 26.978223 19.680814 20.143865 7.828344 200.019849 102.767774 0.236095 0.092274 0.585873 0.282771
16 1 3 249.169350 307.126187 6.272118 166.848435 1360.312194 1585.858067 1.993447 1.889505 6.322367 4.006425
17 1 3 266.625531 358.975244 80.767776 62.984859 1408.890446 1738.991978 1.752804 1.805109 2.006028 2.532716
18 1 0 465.517306 312.309397 135.473690 16.144012 1924.432740 1570.584016 1.955050 1.619824 1.829889 1.880687
19 2 1 351.546419 274.045703 53.792911 9.008755 1745.334524 1245.302604 1.651066 2.436488 2.187205 9.059640
20 2 1 354.630432 963.312260 121.227393 535.759516 1809.747165 4987.349354 1.664407 1.544254 1.711667 2.415440
21 2 2 646.722312 818.914931 844.100134 91.743488 3485.837314 4518.206429 1.777682 1.489678 2.254053 2.580463
27 1 0 9.255913 14.120669 1.693988 99.403206 0.217313 0.690788 0.076745 0.231916 0.103119 0.509397
28 1 0 365.962926 248.951284 113.979402 85.297305 1280.013054 1259.845603 2.531546 2.117575 3.507667 4.510071
29 1 1 311.355600 261.049938 30.153426 107.120143 1599.418561 1390.398485 3.618139 3.677191 4.098863 4.949668
30 1 1 749.664294 536.155445 603.031433 145.045638 3218.835369 2897.903498 2.406152 2.692762 1.758459 2.677713
31 2 2 809.020964 1051.665046 136.725054 374.016816 3925.455539 5618.064141 2.389819 3.121313 2.252920 4.808234
32 2 2 409.714657 523.568436 162.816416 27.982452 2048.776817 2801.598177 4.577700 6.114773 4.445806 6.289545
33 2 3 535.631048 405.018915 450.637635 66.547108 1804.985421 1969.390435 1.603316 1.698923 1.454922 2.198550
36 3 3 565.291779 338.880862 1264.856016 669.758044 2226.021146 1317.751598 3.171383 2.371054 1.425744 4.447285
37 3 1 328.853387 491.585137 27.841515 151.757108 1479.769758 2471.994421 2.583462 2.209117 3.223263 2.488500
38 3 1 269.527483 572.252753 6.181976 236.088677 1341.801623 3180.136702 2.596690 2.874026 1.713475 2.342369
40 4 1 641.191870 453.588498 71.695380 40.449328 3563.337227 2366.717464 1.965772 1.850896 1.841432 7.060228
41 4 3 357.503517 208.414359 65.491695 29.709875 1574.135713 1102.783652 1.782116 1.835783 1.398531 2.309252
42 4 0 403.080416 251.309080 45.611905 51.498414 2055.797226 1188.832931 1.860720 2.338868 2.494942 7.307427
45 5 0 674.270546 462.597953 49.416405 16.194606 3684.492201 2608.291026 3.952677 1.854410 3.295289 2.645146
46 5 0 409.737433 298.768710 102.426030 42.121933 1965.885393 1407.140186 1.968071 1.568510 1.884048 3.813548
50 3 3 304.236287 440.760026 649.014558 929.068656 1304.660744 1789.112346 2.848801 3.288698 2.054367 1.699598
51 3 2 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
52 3 3 6569.311420 755.133777 15157.680188 785.894526 112.037423 2643.951196 6.192179 2.120316 6.005110 3.007596
53 3 2 25.119317 23.863695 4.394623 2.961239 143.242265 136.992287 0.739116 0.875011 7.805656 7.640308
54 4 0 425.476444 404.011967 35.955617 64.893401 2214.982803 1974.497622 2.084191 1.882807 2.812234 6.354940
55 4 2 232.319566 794.971605 123.277495 138.859739 1083.183839 4242.864294 3.036583 1.753234 2.508223 2.524289
56 4 1 255.800982 247.400091 37.506280 45.952649 1190.773908 1290.933954 2.351176 2.362649 2.207692 4.377346
57 4 3 300.491104 826.419691 119.378965 670.915183 1617.878648 13.975496 2.660978 1.969364 2.139669 1.704059
65 3 0 403.489643 383.336847 8.426754 12.872487 2189.949951 1930.513886 2.773491 2.313168 2.058465 1.758080
66 3 0 146.956744 81.271170 36.437389 38.935962 937.900354 483.646465 1.042381 0.934920 6.700190 6.410939
67 3 0 3101.958359 342.390025 1258.976470 67.741741 5717.097143 1720.580966 2.574158 1.980231 2.531423 2.105861
68 3 1 607.398766 383.966874 240.585948 96.302724 3225.321056 1936.760031 1.806236 2.709224 1.978648 4.949217
69 4 1 327.808055 237.685434 61.000978 89.168525 1563.666203 1298.315319 2.699219 2.416566 3.176130 5.113107
70 4 2 284.073765 611.162279 16.609694 473.115630 1319.260966 3036.657612 6.763877 3.414833 3.474811 2.375870
71 4 2 266.533064 291.286884 25.655876 83.651666 1183.940480 1402.021286 2.175039 1.900637 1.508771 1.982850
72 4 0 219.436857 455.106511 65.989581 30.049510 1087.037918 2006.724343 1.759398 1.852661 1.716227 2.618631
73 5 0 736.189908 458.456235 201.672783 75.059770 3748.155192 2389.177862 1.632801 2.091265 2.124816 5.283613
81 7 0 187.616629 525.446950 12.093815 40.192499 1004.152441 2372.772558 5.494398 2.792178 14.959063 6.800792
82 7 0 525.535868 386.855854 20.461794 296.592534 2286.255436 2022.856739 1.770985 2.385268 1.949712 2.361384
83 7 0 222.366335 189.250429 19.436254 48.306586 944.870216 929.069303 1.721458 2.000747 1.564023 2.207113
84 8 3 155.339524 165.043541 12.186075 10.989457 644.252591 680.696089 2.563243 2.634635 13.777064 18.585791
85 8 0 728.154676 410.050217 259.975947 1411.565028 14.514307 6.623447 4.165093 1.733678 5.672921 2.872392
86 8 0 217.569641 1042.283911 225.981017 582.243092 6.265553 17.429643 5.406985 1.796687 10.896924 4.482543
87 8 2 87.963515 127.204578 1.635862 6.858579 368.708030 535.732776 2.507752 3.171029 3.857334 9.337515
88 9 0 107.823912 114.216800 197.338333 207.847222 4.123061 5.485496 4.467019 2.411590 4.349032 1.851243
90 9 0 188.891748 827.053824 116.464315 153.358886 898.474609 4347.280900 48.843399 3.792806 71.339169 6.983115
91 9 1 1210.831057 60.600247 456.812355 342.409023 19.458176 2.595100 6.254847 2.021377 5.634003 1.870331
92 10 0 445.388804 320.664592 106.918489 145.167942 2286.401389 1624.275898 1.648745 1.613632 1.877626 2.253555
93 10 0 190.884511 563.601983 1384.406073 172.874283 3.891098 2943.660099 3.316101 1.500310 3.650727 1.442025
94 10 0 366.066476 386.724243 28.840983 14.132724 1810.759070 2159.992458 1.655007 3.053935 1.814126 30.120487
98 7 2 906.200915 410.253445 323.616899 39.622320 3912.738207 1776.036520 2.922712 2.017434 5.025000 1.909199
99 7 2 450.648921 238.375313 107.573085 22.827367 2137.654556 1095.044691 1.989769 2.492938 3.946456 10.639791
100 7 1 319.374722 292.452944 68.746366 150.507219 1670.877761 1332.055498 1.985326 1.662336 1.665288 2.105230
101 8 2 163.168230 135.277709 10.286817 16.297880 749.275869 671.117120 2.112573 2.448547 1.936604 13.296898
102 8 0 2053.218678 628.606714 934.707901 913.163953 35.916623 10.990327 4.948097 5.510314 7.094499 6.604334
103 8 1 139.116788 130.032751 32.597576 22.719833 701.864779 681.183602 2.256172 1.801786 3.210000 4.008985
104 8 1 2109.839380 185.017691 315.573199 38.096304 5612.179080 859.601591 2.403292 1.785844 18.745727 1.948616
105 9 1 1335.826470 1092.097293 319.360250 1150.168055 20.543490 16.821850 4.783743 2.522796 5.346397 1.831597
106 9 3 347.018092 347.450670 21.036401 47.337678 1506.725963 1578.610220 2.824874 4.206736 4.494414 3.513377
107 9 0 927.323221 1000.366983 50.879256 275.322029 15.416298 17.787488 3.792824 6.556778 6.135135 13.758366
108 9 1 207.169845 302.143627 34.056398 45.874066 989.353795 1443.962640 1.766960 1.867463 2.026056 2.280024
109 10 1 337.869458 280.845981 99.507410 33.686320 1717.888879 1273.879987 1.829500 1.737288 1.983069 2.643719
110 10 1 259.928818 267.282217 48.131455 34.917605 1164.153130 1475.044217 1.750250 3.102060 1.477874 2.441828
111 10 1 237.292655 360.440672 4.876564 34.582394 1200.225755 1689.457950 2.512538 1.656089 2.211910 1.809046
112 10 2 255.773426 333.631791 31.307467 111.773162 1203.951420 1576.088031 1.684326 1.714739 1.867294 2.095869
116 7 2 289.925044 570.789197 66.649501 284.042083 1414.645244 3063.726031 2.055234 2.086546 2.386790 1.988308
117 7 3 175.745369 238.534366 72.481889 46.606343 933.262644 1086.920164 2.606886 4.373660 3.179843 5.424940
118 7 3 284.768691 224.544515 26.332115 34.933270 1410.912048 1059.244040 1.643002 2.343284 2.225029 3.155964
119 7 1 291.974684 166.720937 106.090226 7.142371 1617.295471 746.663375 3.019776 1.812434 8.488434 3.035570
120 8 1 2588.664026 140.815262 609.650089 3.758625 44.750342 723.350155 11.094237 1.649513 28.281935 3.094394
121 8 3 241.456970 173.483447 12.715836 13.979935 1085.409060 763.367657 3.710553 3.934784 7.075784 53.726762
122 8 2 155.816086 201.815378 9.265659 13.387088 683.905448 877.909358 3.955281 2.465986 5.412601 3.514073
123 8 3 110.243246 131.449968 9.044405 2.438163 519.257051 549.013361 2.224355 1.848152 3.419277 4.034150
125 9 3 86.225607 271.239648 103.891891 71.932188 3.765468 4.733616 3.585844 1.983092 3.887250 1.877334
126 9 3 383.219712 624.614175 63.722709 488.369839 6.272019 10.201192 4.304737 1.719777 3.760678 1.614808
127 10 2 374.432086 543.855888 158.936532 132.840231 1923.147188 2949.442871 5.224857 4.423396 7.336820 6.451791
128 10 2 27.615506 18.022808 0.892411 6.906662 161.237941 93.464647 0.354320 0.151069 3.055691 0.894826
129 10 3 279.180595 369.232380 11.655323 178.932583 1305.804706 2015.423050 1.634793 1.803166 1.337485 3.214208
130 10 3 35.008659 247.613528 10.737069 101.863177 210.479458 17.420763 0.540206 0.581574 1.461442 1.497719
135 12 2 273.366999 360.296304 13.746209 12.070768 1344.596882 1720.111238 2.087855 1.481072 1.690769 1.771940
136 12 2 246.641462 299.519415 23.275873 119.711065 1267.973813 1346.638325 4.389715 3.061524 4.544928 4.512196
137 7 3 748.719548 1356.325796 3523.540667 99.116811 12.959934 21.273208 4.157006 1.898007 4.660575 1.987505
138 7 1 337.934691 148.375840 59.311305 1562.646506 1663.821769 2.572399 2.106187 1.769393 5.590631 1.930046
140 13 2 272.947660 284.845458 5.681697 11.400440 1369.461255 1496.258859 1.501685 2.087572 1.665657 4.919893
141 13 2 1796.297663 473.025932 996.466948 111.777076 2537.349523 2514.131250 8.290675 1.615564 7.862862 2.090538
142 13 2 905.243101 791.622447 172.299804 381.974953 14.568909 4446.174494 3.025021 1.598713 3.758293 2.869545
143 14 2 233.662935 446.702776 129.714736 32.801953 1164.655360 2520.041226 2.950026 2.066606 2.354127 2.342162
144 14 3 928.338054 929.855468 724.997364 40.165320 4345.952863 4815.158765 1.724990 1.424795 1.990518 1.758117
145 14 3 886.105516 2052.221617 603.885251 939.227308 13.826810 32.905167 3.432812 1.865505 2.996843 1.804634
150 15 1 114.602461 90.913552 60.211502 129.671268 3.040367 3.046482 0.926005 4.966445 1.506646 9.874266
155 12 2 4106.881982 993.051579 794.741717 298.711321 63.053685 15.964728 3.555372 1.945237 4.089583 1.907623
156 12 3 305.615493 387.716119 215.680281 13.809944 1440.364040 1943.965025 1.918271 2.544386 1.765715 3.070764
157 12 3 235.318907 431.726398 66.933506 30.521064 1170.106321 2204.052371 2.163789 1.895335 1.838520 2.136152
158 12 3 464.304184 651.779551 64.724356 220.425727 2364.332969 3552.227765 2.758389 1.932506 2.777966 3.436568
160 13 3 2355.137551 189.759400 1057.094775 869.832265 37.144667 3.636241 3.778775 4.918234 4.140840 6.015527
161 13 0 nan nan nan nan nan nan nan nan nan nan
162 13 0 nan nan nan nan nan nan nan nan nan nan
163 14 2 564.415249 506.929254 20.065847 85.440792 2861.582159 2297.916110 1.798057 1.653099 1.641396 2.798615
164 14 2 546.866003 400.805353 246.967749 168.176443 2870.639669 1940.069130 1.954916 2.410061 2.303837 1.862886
165 14 0 690.544923 223.210638 1659.488528 262.087841 2599.302427 1007.160295 2.887120 5.905065 6.206007 4.352500
166 14 0 300.706982 331.605844 576.786367 725.002773 1165.761132 1442.508940 2.394381 4.385025 2.594087 3.823461
167 15 1 4.713600 6.429723 1.196831 2.582350 27.469205 33.634315 0.263113 0.324301 0.611161 0.500394
168 15 2 56.735494 94.456359 4.353502 11.298675 244.919064 361.246700 6.398521 6.836661 7.363963 11.115089
169 15 2 70.474709 65.537681 3.926480 103.652805 316.351210 280.345672 4.408692 33.060283 6.657429 58.206287
170 15 2 80.914442 72.620017 3.845238 114.860370 359.498371 275.192390 4.084259 53.106523 4.672124 71.577987
176 12 0 257.916064 355.117632 61.083703 15.940233 1237.310074 1561.975886 2.961974 2.623043 1.847584 2.080140
177 12 0 647.712406 234.586491 87.970086 33.100758 3617.653430 1223.808732 1.738437 2.012396 1.815852 2.416888
178 12 0 274.568191 317.407053 62.250779 61.876780 1388.627184 1635.313677 1.935037 2.223710 1.890940 2.213157
179 12 1 399.492618 457.110162 31.445852 116.158233 2055.181509 2524.031586 4.956083 2.394739 2.969200 2.159836
180 13 3 347.435108 238.557567 863.819235 82.464500 80.339441 1179.106448 2.871976 1.633521 2.104976 2.055562
181 13 3 1266.430526 369.355874 279.135904 951.338045 3032.977245 6.116163 1.997341 1.805725 2.486854 1.689396
182 13 0 nan nan nan nan nan nan nan nan nan nan
183 13 1 458.212853 390.858583 106.933863 123.620854 2388.174730 1776.858935 2.016949 2.277506 2.162211 3.220174
184 14 0 826.628902 799.913932 1274.947364 1889.677148 2902.012755 3054.031296 1.784357 1.835857 1.878770 3.144687
185 14 1 378.905506 226.255461 112.747672 37.279453 1874.742620 1031.841280 2.545938 3.591621 2.743925 3.148805
186 14 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.842836 0.782360 6.893472 7.151826
187 14 1 239.641596 700.550766 43.286118 184.000398 1296.531983 3403.308034 3.206770 3.220976 4.957386 7.611109
189 15 3 47.327421 49.217829 5.320273 3.470642 287.813418 261.021282 0.324513 0.251438 0.610169 0.431942
190 15 3 253.135853 366.112687 1761.321058 90.735328 4.065890 1856.822462 3.319377 2.302408 2.883187 4.160558
191 15 3 320.423157 396.554187 33.863009 13.754028 1536.132559 2026.351875 1.659090 1.756606 2.037929 1.903069
203 18 1 nan nan nan nan nan nan nan nan nan nan
205 19 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
206 19 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
207 19 1 76.112319 68.409810 16.486808 8.264856 372.288019 282.237393 1.852978 1.790985 2.005991 1.752565
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 126.193898 85.899305 34.879627 21.746138 575.905536 406.771439 1.613646 1.854808 1.750222 2.130099
224 19 1 18.253003 19.752565 0.926220 2.101268 82.684893 81.753607 2.738612 7.688381 5.590524 8.811259
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 1467.721173 307.077114 2557.920881 3341.045028 24.207520 6.451087 8.691065 9.018915 9.144739 11.323518
321 2 3 164.244620 175.854977 87.824123 8.053690 672.957283 757.847350 1.815022 2.436580 1.603064 3.091431
323 2 3 117.089252 325.943081 57.011292 480.351481 501.672790 1675.937307 2.177819 1.944981 2.062995 2.285492
324 4 3 111.386803 122.993425 10.709976 60.184176 456.890349 471.564491 1.972457 1.614208 1.758012 2.114244
329 12 1 154.635864 397.159959 138.427995 73.770656 665.397515 1931.307086 2.390660 1.970935 1.673601 6.016592
333 12 1 184.066681 565.351236 38.868608 370.669698 693.748025 1831.221762 2.034864 1.852535 1.470599 1.919379
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 [ ]: