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 = 2459823
Date = 8-31-2022
data_path = "/mnt/sn1/2459823"
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)
89 sum files found between JDs 2459823.25320 and 2459823.27288
89 diff files found between JDs 2459823.25320 and 2459823.27288

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.935540 0.979008 1.375603 1.400994 2.374819 2.212298 2.014637 2.071008 1.626528 2.201484
4 1 2 0.976599 1.072775 1.496299 2.337469 1.956158 2.850734 1.838701 2.606296 1.786708 2.152093
5 1 2 1.039669 0.901105 1.497308 1.071597 2.019563 1.759476 2.933687 1.755862 4.563861 3.861537
7 2 0 0.869397 0.852166 1.106659 1.347141 1.945649 1.975154 1.776528 1.829842 1.582027 1.802676
8 2 0 1.815924 5.659447 5.615002 18.272008 2.672548 9.053929 5.270453 44.384240 6.649496 52.912771
9 2 0 0.843884 0.829378 1.340180 1.513477 1.764655 2.047557 1.960822 2.113442 1.484259 1.753361
10 2 1 0.903483 1.002046 1.656897 1.362285 1.940833 1.941804 1.772866 2.095170 1.695749 2.103020
15 1 3 0.929768 0.939516 1.490841 1.306234 2.558697 2.320157 1.911251 2.206523 2.448248 2.947962
16 1 3 0.878420 0.890087 1.258600 1.165321 2.061342 2.104168 1.806833 1.980318 4.277256 2.659143
17 1 3 0.962196 0.893730 1.258961 1.154351 2.184445 2.130890 1.890148 2.078624 1.889302 1.601065
18 1 0 20.210123 10.098122 1.064118 1.268460 86.749223 40.861771 1.567556 2.112394 1.329332 1.929156
19 2 1 1.373669 0.861278 1.960069 1.166830 2.308614 1.893107 3.988054 1.821102 4.623894 1.552244
20 2 1 0.900509 0.913421 1.340122 1.198520 2.044955 2.265193 1.929484 1.872347 1.679639 1.651529
21 2 2 0.905685 0.803785 1.434007 1.144624 1.830017 2.068452 1.943728 1.997302 1.412463 1.641202
27 1 0 2.276112 3.841677 5.919734 13.852712 10.550455 5.551975 2.832920 2.367041 3.196998 2.210888
28 1 0 47.872952 1.023242 1.204673 1.501346 225.435886 2.185161 2.082562 2.054691 1.715099 3.328667
29 1 1 1.147947 0.999744 2.075617 1.393155 2.078896 2.384741 2.359117 2.452334 2.654689 2.327149
30 1 1 0.967901 0.864033 1.303845 1.380140 2.098252 2.184614 2.238719 2.171416 1.884540 4.759186
31 2 2 0.919255 1.073858 1.509858 1.467958 1.923956 2.193159 2.687280 5.096370 2.920522 7.764637
32 2 2 1.178731 1.315006 0.766127 1.315618 2.089422 2.107199 4.573095 2.756483 3.171921 2.690731
33 2 3 nan nan nan nan nan nan nan nan nan nan
36 3 3 1.021459 0.958698 1.293964 1.379132 2.034376 2.143670 1.802769 2.057734 1.348491 1.576345
37 3 1 0.969405 0.858865 1.582503 1.453409 2.241501 2.147613 2.394276 1.955197 1.918421 1.676915
38 3 1 0.948818 0.973320 1.279641 1.322008 1.914059 2.634899 1.883653 2.284832 1.554861 1.895843
40 4 1 0.911480 0.942936 1.523754 1.277276 2.004229 2.051219 1.937818 2.322071 1.674376 2.037679
41 4 3 0.899120 0.903185 1.459710 2.137128 2.076998 2.175941 2.048808 2.089066 1.550942 2.173845
42 4 0 1.055504 0.873197 1.283058 1.234622 2.558667 2.098748 2.019692 1.996888 1.966694 3.002217
45 5 0 1.089632 0.954009 1.785862 1.306872 2.447966 2.229609 2.116543 2.186910 1.860585 1.850313
46 5 0 1.074056 0.932888 1.411163 1.196573 2.632961 2.187453 2.135570 1.858158 1.868470 1.726094
50 3 3 1.551166 0.831049 1.232136 1.436135 2.332894 2.228939 2.007762 1.871958 2.120665 1.718816
51 3 2 1.318063 0.838211 7.519050 1.524799 1.881473 2.017119 1.759140 2.355224 1.538091 1.723677
52 3 3 0.937983 1.011757 1.348409 1.279215 1.906916 2.003045 1.864435 1.854164 1.570099 1.494913
53 3 2 0.866420 1.038365 1.387860 1.677684 1.826284 3.055820 1.898700 2.166339 1.907207 2.201003
54 4 0 1.083964 0.894964 1.168389 1.195036 2.601885 2.174916 1.958302 1.944325 1.871038 1.802299
55 4 2 0.924106 0.826686 1.962752 1.080732 2.221816 1.733369 2.588135 1.594489 2.121711 1.525955
56 4 1 0.989403 0.993212 1.164972 1.312437 2.139509 1.908896 1.994022 2.024118 2.124050 2.112009
57 4 3 0.884260 0.968425 1.567074 1.536472 2.032945 2.791287 2.055799 2.228509 1.861736 2.647127
65 3 0 0.931242 0.880557 1.140685 1.059574 1.941787 1.950851 1.828236 1.746775 1.681746 1.480742
66 3 0 0.997710 0.845245 1.805868 1.147518 2.404271 2.026145 2.147074 1.780637 1.858436 1.690999
67 3 0 0.865340 0.926753 1.216632 1.379530 2.001112 2.162879 1.898600 1.940872 1.522435 1.637276
68 3 1 0.890146 0.826465 1.252149 1.463570 2.065229 1.983863 2.215881 2.140567 1.806498 1.949923
69 4 1 0.875233 0.959652 1.035262 1.501870 1.924067 2.288632 1.824321 2.333856 1.605217 2.118021
70 4 2 1.283391 1.009256 1.313528 1.503806 3.489326 1.958166 2.433196 2.469885 1.778784 1.879301
71 4 2 0.895178 0.993707 1.278382 1.275913 1.695074 2.109635 1.606134 1.593722 1.613911 1.530626
72 4 0 1.012772 1.107954 1.323787 1.199750 2.133258 2.751606 1.950549 1.973955 2.415068 2.652601
73 5 0 0.993944 1.594528 1.591646 3.973686 2.547487 4.952538 2.782396 1.895702 3.732047 2.031836
81 7 0 1.187700 0.996526 1.609201 1.445531 2.049846 2.018021 2.222930 1.968923 7.309901 1.982384
82 7 0 0.857165 0.881952 1.313956 1.051051 2.087372 1.990704 1.918527 2.071636 1.997999 1.942848
83 7 0 0.894791 0.850040 1.543164 1.400596 2.154847 1.694976 2.679132 1.907155 2.473449 1.646540
84 8 3 1.143287 1.159783 1.588210 1.643422 2.577364 2.676884 2.313369 2.049056 3.019255 3.176575
85 8 0 0.854756 0.866900 1.279765 1.045344 1.670908 1.776827 1.822166 1.827307 1.631202 1.885533
86 8 0 1.412823 1.114419 1.700238 1.397674 2.880847 2.137296 3.712479 4.183350 2.911069 3.608567
87 8 2 1.079670 1.019453 1.469095 1.763833 2.016723 2.043523 2.040006 2.323476 1.658334 2.269128
88 9 0 1.585990 15.830823 5.952173 83.057963 2.599000 31.319908 6.119385 48.757839 7.151211 75.179351
90 9 0 1.242344 1.033001 1.289783 1.528812 2.701965 2.086860 2.297097 2.711382 1.907203 1.577687
91 9 1 nan nan nan nan nan nan nan nan nan nan
92 10 0 2.116818 1.260755 0.594841 0.803695 2.193004 2.003014 2.515636 1.895472 2.835503 2.394615
93 10 0 0.896398 0.896505 1.250135 0.993520 2.250305 1.757793 1.796518 1.736044 1.729188 1.751270
94 10 0 0.870595 1.079724 1.292841 2.049653 1.935954 2.879229 1.831028 2.744942 1.494430 4.090708
98 7 2 0.874252 0.828467 1.440583 1.265360 1.853264 1.735510 1.609601 1.785012 2.048097 1.465178
99 7 2 0.876851 0.931748 1.141384 1.396292 1.808115 2.179050 1.782673 1.853566 2.627438 1.947955
100 7 1 1.122732 0.965188 1.636336 1.577342 2.465517 2.146106 2.138922 2.165672 1.874646 1.869592
101 8 2 0.967742 1.325361 1.522548 1.492302 1.953554 2.396789 2.066177 2.087188 1.818142 1.969785
102 8 0 1.193697 0.876092 3.252647 2.221083 2.855303 1.974769 2.307910 2.317911 2.696552 1.736280
103 8 1 1.133113 0.858383 1.622185 1.458603 2.643810 1.798240 2.190906 1.972064 2.500701 1.597915
104 8 1 1.662344 0.857378 0.372305 1.276330 2.083711 1.716877 4.135348 1.787574 3.187193 1.431540
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.605469 6.014577 5.366179 23.568624 2.568688 12.895251 5.645150 38.980588 16.096320 47.039343
108 9 1 nan nan nan nan nan nan nan nan nan nan
109 10 1 1.259594 1.554392 1.315130 1.779088 3.033737 4.176441 2.038542 2.019795 1.679931 1.671874
110 10 1 1.355128 1.668261 1.594218 0.911990 2.127703 2.014717 2.109038 2.292429 2.232809 1.709921
111 10 1 1.026819 0.984580 1.617047 1.186377 2.412371 1.954548 2.142835 1.815309 2.136148 1.479009
112 10 2 0.837148 0.847044 1.437875 1.113506 2.103622 2.029098 2.106740 1.741109 1.662198 1.748829
116 7 2 0.879511 0.899581 1.229557 1.166995 2.223389 2.049261 2.095890 2.041048 2.128462 1.775756
117 7 3 1.176209 0.905648 1.717694 1.479812 2.377662 1.720182 3.744575 2.168542 4.561532 2.822127
118 7 3 1.520862 0.935826 3.772854 1.726915 2.572050 2.120230 2.900167 2.166683 3.199436 2.797301
119 7 1 0.846195 0.834417 1.432280 1.850631 2.072669 2.081897 1.947108 2.010647 1.687621 1.889946
120 8 1 2.900276 1.021761 7.954569 2.186566 6.488987 2.666485 7.272692 1.701884 18.094295 2.534530
121 8 3 1.376690 1.455230 2.295710 1.178002 3.516838 3.112122 2.741144 2.153724 2.817008 5.865939
122 8 2 1.283782 1.143395 1.732076 1.529469 2.670521 2.228208 2.113719 2.580378 2.335259 2.717864
123 8 3 0.954580 0.906420 1.599069 1.434910 2.192288 2.056183 2.111080 2.320029 1.736417 1.614518
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.035792 1.059726 1.347423 1.190836 2.311664 2.593801 2.579442 2.819146 2.465001 2.600498
128 10 2 0.976897 0.906607 1.427359 1.030243 1.631584 1.972302 1.856975 1.699262 1.840774 1.847933
129 10 3 0.856656 0.804579 1.172802 1.262972 1.695613 1.854709 1.770840 1.839914 1.514883 1.710756
130 10 3 1.056023 0.865926 1.733344 1.264482 2.216345 2.081237 2.036458 1.832087 1.760724 1.834357
135 12 2 0.957767 0.935703 1.112881 1.211514 2.249468 2.119828 1.779768 2.380614 1.811876 2.062336
136 12 2 1.005781 0.981992 1.206312 1.168176 1.981879 1.944673 2.856171 2.293659 1.682952 1.893312
137 7 3 1.727930 10.214515 5.557384 48.909105 2.870531 20.030559 6.489614 51.065848 7.304061 64.981094
138 7 1 0.885745 5.189736 1.858898 32.890092 1.762447 1.870939 2.008267 14.006847 1.382544 17.321683
140 13 2 3.028232 2.493668 8.854944 20.554401 4.435816 2.373159 2.593947 3.094597 3.346517 5.063109
141 13 2 3.771314 0.947746 7.131337 1.321644 15.075604 1.836992 10.385887 1.847194 6.977982 1.795913
142 13 2 2.189029 1.191848 5.371767 1.526190 4.915360 2.173533 2.432203 1.749910 3.207351 3.183547
143 14 2 0.926742 0.900709 1.231372 1.138756 1.834613 1.978418 1.847784 1.830485 1.491563 1.537437
144 14 3 0.912487 1.003165 1.107087 1.228593 2.210300 1.901516 1.857885 1.886578 1.517257 1.605914
145 14 3 2.760968 2.279505 17.928586 12.830133 9.290671 8.870772 2.917013 1.969776 2.446694 1.862498
150 15 1 2.403559 3.096244 13.435820 28.389590 3.874121 3.730072 2.873584 4.948352 3.359061 6.604291
155 12 2 2.534305 1.969855 8.776473 14.937077 3.156536 3.684790 2.915055 2.683489 3.138095 2.252358
156 12 3 0.988123 0.904215 1.136813 1.361081 2.191549 1.741575 1.864777 1.803651 1.448288 1.360188
157 12 3 0.932025 0.910064 1.345606 1.100430 2.036298 2.121289 1.856965 1.752017 1.708021 1.520077
158 12 3 0.975966 0.959724 1.756330 1.331015 2.642759 2.344979 2.449450 2.138900 2.586533 2.312462
160 13 3 2.578159 4.063062 9.633385 19.798024 5.370210 7.647880 2.718573 3.318669 2.401266 2.870788
161 13 0 1.902763 1.049651 1.044979 1.295776 3.230584 2.453609 3.186910 2.191268 4.242074 3.152352
162 13 0 0.906874 0.868325 1.490726 1.182371 2.114807 1.794299 1.894799 1.912171 1.736287 1.683355
163 14 2 0.901884 0.871291 1.422771 1.297663 2.146173 2.104984 2.105714 1.844479 1.669851 1.616643
164 14 2 0.897358 0.879285 1.377220 1.182704 2.115918 2.109464 2.149453 2.661382 1.809914 1.777409
165 14 0 2.527518 2.854321 2.705135 2.198336 8.413164 6.691874 3.195631 3.831183 3.539899 4.600237
166 14 0 0.916063 1.397498 1.247013 1.253480 1.874384 2.490497 1.730405 2.010639 1.571347 2.214619
167 15 1 1.744635 3.447448 4.611374 2.170543 3.115481 2.116247 6.931220 3.759728 7.561855 3.425998
168 15 2 1.811757 1.008388 8.067556 2.490399 3.081431 1.860147 7.505141 3.126017 10.361132 3.640066
169 15 2 1.692061 2.047725 5.127002 10.143046 2.502766 1.993155 5.023041 4.748698 6.179330 5.427086
170 15 2 1.819525 2.886644 5.563812 16.891790 2.823217 2.352681 6.642968 6.154568 7.045632 7.195926
176 12 0 0.875371 0.886608 1.441471 1.551680 2.078750 2.102439 1.890971 1.955861 1.598135 1.846129
177 12 0 1.205835 0.901377 1.680495 1.382206 2.236535 1.986413 3.740599 1.866601 3.893710 1.541261
178 12 0 0.909163 0.931039 1.145592 1.143320 1.990888 2.366384 1.956413 2.087139 1.578734 1.592815
179 12 1 1.049335 0.858554 1.125838 2.246295 1.964344 1.858297 2.879116 2.072899 1.772076 1.886929
180 13 3 1.849441 1.000998 8.215743 1.229021 5.025356 2.242598 3.101814 1.832047 3.033278 1.603120
181 13 3 2.395379 3.834084 1.098416 8.591522 3.719979 5.495629 2.362591 1.798778 2.322045 1.992077
182 13 0 6.038517 1.344747 9.690197 2.549206 15.438521 3.185136 2.465328 3.900909 2.620325 5.532878
183 13 1 0.910217 0.909979 1.411572 1.272593 2.279035 1.873798 2.118115 1.706127 1.910621 1.695363
184 14 0 0.874759 0.827168 1.191769 1.200787 1.773125 2.199043 1.827744 1.956373 1.825613 2.903158
185 14 1 0.870831 0.877728 1.284059 1.425667 2.094613 2.132635 1.884149 2.523025 1.596662 1.564074
186 14 1 0.878419 0.876225 1.189785 1.136003 2.234435 2.218406 1.659429 2.056273 1.425943 1.858296
187 14 1 1.007546 1.221619 1.313410 1.199844 2.178631 2.133593 2.606954 3.291866 2.700553 3.051096
189 15 3 0.909177 0.906585 1.293488 1.167461 2.138576 2.005796 2.101621 1.604653 1.796904 1.591829
190 15 3 2.459953 1.368414 10.363227 1.075925 4.970062 2.044828 3.142388 2.399551 2.893570 2.611219
191 15 3 0.941591 0.927945 1.263037 1.104638 2.094066 2.196392 1.850132 1.919430 1.715702 1.613288
203 18 1 nan nan nan nan nan nan nan nan nan nan
205 19 0 0.129842 0.077700 0.078673 0.021343 0.178265 0.083755 0.065174 0.023079 0.048388 0.023927
206 19 0 0.094624 0.098909 0.023658 0.024003 0.087981 0.094112 0.029292 0.030305 0.025438 0.027588
207 19 1 0.079826 0.071320 0.021078 0.031061 0.074701 0.069946 0.023641 0.020076 0.021648 0.022771
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.103294 0.088548 0.023034 0.021387 0.100408 0.093443 0.028986 0.024230 0.026548 0.025775
224 19 1 0.062614 0.052917 0.016385 0.009079 0.055409 0.049800 0.023711 0.016818 0.033845 0.019456
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 6.053657 3.582512 10.562420 16.144915 5.636134 4.519454 4.021642 2.428462 4.755753 9.267396
321 2 3 nan nan nan nan nan nan nan nan nan nan
323 2 3 nan nan nan nan nan nan nan nan nan nan
324 4 3 0.880570 1.138795 1.773492 2.278387 1.957769 2.394010 1.894885 1.955997 1.503110 2.135913
329 12 1 0.902818 0.967716 1.931008 1.610016 2.337468 1.975698 1.989025 1.980958 1.948182 1.836218
333 12 1 1.122146 0.996046 1.904114 1.401108 2.164697 2.441733 2.233838 2.102119 2.173832 1.695457
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 [ ]: