Gitlab is now running v13.9.0 - More info -> here <-

Commit 7cbed580 authored by perdereau's avatar perdereau

typos + add plotting tracks with selection of good track in datacard files

parent 9313f687
scripts in this folder :
viewtfmap.py (+mynormalize) : reading and f\plotting from t-f map
viewtfmap.py (+mynormalize) : reading and plotting from t-f map
(or t-ra) fits files written by visiavg
cmp_simddat.py : to plot fitted and input tracks (visi vs time at some freq) used in the fitting of pointing & phase with satellites (and sources)
......
......@@ -7,7 +7,7 @@ from matplotlib import pyplot as plt
# data and fitted results from trkacxfit
# this will also plot the difference (in gray, scale on the right)
# unused tracks are alsor plotted
#numero_antenne = 0,1,2,3 pour 1H, 2H,...
#numero_antenne = 1,2,.. pour 1H, 2H,...
# make_fig_scan_xc(filename,cross,nombre_de_traces)
# plots of all cross-cor visi comparision between
......@@ -15,10 +15,11 @@ from matplotlib import pyplot as plt
# this will also plot the difference (in gray, scale on the right)
# for the real part
# unused tracks are alsor plotted
# cross = 0,1,...,5 pour 1Hx2H, 1Hx3H, ...,3Hx4H
# cross = 1,...,6 pour 1Hx2H, 1Hx3H, ...,3Hx4H
names_ac=['1H','2H','3H','4H']
names_xc=['1Hx2H','1Hx3H','1Hx4H','2Hx3H','2Hx4H','3Hx4H']
#cx_1_check_gal.fits
keynam='HIERARCH NOM_OBJET'
......@@ -114,7 +115,7 @@ def make_fig_scan(ffnam,ant,ntot):
#plt.figure(figsize=(20,17))
f, axarr = plt.subplots(nrows,ncols,figsize=(ncols*4,nrows*4))
axarf=axarr.flatten()
f.suptitle('Antenna '+str(ant))
f.suptitle('Auto '+names_ac[ant-1])
for ip in np.arange(ntot):
i=get_num(ant,ip+1,ntot)
......@@ -147,7 +148,8 @@ def make_fig_scan_xc(ffnam,cross,ntot):
f, axarr = plt.subplots(nrows,ncols,figsize=(ncols*4,nrows*4))
axarf=axarr.flatten()
f.suptitle('CrossCor '+str(cross))
f.suptitle('CrossCor '+names_xc[cross-1])
for ip in np.arange(ntot):
i=get_num_cx(cross,ip+1,ntot)
......@@ -179,4 +181,133 @@ def make_fig_scan_xc(ffnam,cross,ntot):
plt.tight_layout()
plt.subplots_adjust(top=0.9)
def get_good_xctrks(datac):
flist = open(datac ,"r")
ntrk =0
ngtrk=0
goods=[]
for line in flist :
iok=0
if "@trk" in line :
print 'found track '
ntrk=ntrk+1
if "NOCX" in line :
goods.append(iok)
continue
if "NOACX" in line :
goods.append(iok)
continue
ngtrk=ngtrk+1
goods.append(1 )
return ntrk,ngtrk,goods
def get_good_actrks(datac):
flist = open(datac ,"r")
ntrk =0
ngtrk=0
goods=[]
for line in flist :
iok=0
if "@trk" in line :
print 'found track '
ntrk=ntrk+1
if "NOAC" in line :
goods.append(iok)
continue
if "NOACX" in line :
goods.append(iok)
continue
ngtrk=ngtrk+1
goods.append(1 )
return ntrk,ngtrk,goods
def make_fig_scan_xc_sel(ffnam,cross,datac):
hda=fits.open(ffnam)
ntot,nok,goods=get_good_xctrks(datac)
print ntot,nok,goods
nrows=np.int(np.sqrt(nok))
ncols=nok/ nrows
ncols=ncols+nok-ncols*nrows
print str(nrows)+ " " +str(ncols)
f, axarr = plt.subplots(nrows,ncols,figsize=(ncols*4,nrows*4))
axarf=axarr.flatten()
f.suptitle('CrossCor '+names_xc[cross-1])
ipl=0
for ip in np.arange(ntot):
if goods[ip]==0 :
continue
i=get_num_cx(cross,ip+1,ntot)
print hda[i].header[keynam]
print hda[i+1].header[keynam]
#axarf[ip ].plot(hda[i].data,label='Signal')
#axarf[ip ].plot(hda[i+1].data,label='Simu')
#axarf[ip ].legend()
axarf[ipl].plot(hda[i].data,label='Real')
axarf[ipl].plot(hda[i+1].data,label='Imag')
axarf[ipl].plot(hda[i+2].data,label='simu(real)',linestyle=":")
axarf[ipl].plot(hda[i+3].data,label='simu(imag)',linestyle=":")
axarf[ipl].legend()
vmaxr=np.max(hda[i].data)*1.2
vminr=np.min(hda[i].data)*1.2
vmaxi=np.max(hda[i+1].data)*1.2
vmini=np.min(hda[i+1].data)*1.2
vmax=np.max((vmaxr,vmaxi))
vmin=np.min((vminr,vmini))
axarf[ipl].set_ylim((vmin,vmax))
axarf[ipl].set_title('Track '+str(ip))
axarf[ipl].set(xlabel='time (mn)', ylabel='signal (AU)')
ax2 = axarf[ipl].twinx()
ax2.plot((hda[i].data-hda[i+2].data)/(vmax-vmin),label='Data-Simu (real)',color='gray')
ax2.set_ylim((-1,1))
ax2.legend(loc=3)
ipl=ipl+1
plt.tight_layout()
plt.subplots_adjust(top=0.9)
def make_fig_scan_sel(ffnam,ant, datac ):
ntot,nok,goods=get_good_actrks(datac)
print ntot,nok,goods
hda=fits.open(ffnam)
nrows=np.int(np.sqrt(nok))
ncols=nok/ nrows
ncols=ncols+nok-ncols*nrows
print str(nrows)+ " " +str(ncols)
#plt.figure(figsize=(20,17))
f, axarr = plt.subplots(nrows,ncols,figsize=(ncols*4,nrows*4))
axarf=axarr.flatten()
f.suptitle('Auto '+names_ac[ant-1])
ipl=0
for ip in np.arange(ntot):
if goods[ip]==0 :
continue
i=get_num(ant,ip+1,ntot)
print hda[i].header[keynam]
print hda[i+1].header[keynam]
axarf[ipl ].plot(hda[i].data,label='Signal')
axarf[ipl ].plot(hda[i+1].data,label='Simu')
axarf[ipl ].legend()
vscale=np.max(hda[i].data)-1.
vmin=1-0.2*vscale
vmax=(1.+vscale)*1.1
axarf[ipl ].set_ylim((vmin,vmax))
axarf[ipl].set_title('Track '+str(ip))
axarf[ipl].set(xlabel='time (mn)', ylabel='signal (AU)')
ax2 = axarf[ipl].twinx()
ax2.plot(hda[i].data-hda[i+1].data,label='Data-Simu',color='gray')
ax2.set_ylim((-1,9))
ax2.legend(loc=2)
ipl=ipl+1
plt.tight_layout()
plt.subplots_adjust(top=0.9)
......@@ -29,8 +29,8 @@ names = ['1H','2H','3H','4H','1V','2V','3V','4V','1Hx2H','1Hx3H','1Hx4H','2Hx3H'
# the for the cross-correlations - the TF amplitudes are complex : in each case one HDU with real part, one with imaginary part averages
# and two for their respective variances
# NB the variance computation is optional
# at the end of the fits files, acddition HDUs contain 1D data (in reverse order) : times (center of bins), frequencies and RA
# (omitted in the case od RA-freq maps
# at the end of the fits files, acddition HDUs contain 1D data (in reverse order) : times (center of bins, in seconds),
# frequencies (MHz) and RA (hours, omitted in the case of RA-freq maps
#
# --------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment