Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- show the spectral coverage for different SGs to identify overlapping ones...
- Last mod: 25 Feb 2017
- '''
- import numpy as np
- import matplotlib.pyplot as plt
- import matplotlib.patches as patches
- visList = ['../member.uid___A001_X879_X45e/DaisyCalMS/science_calibrated.ms',
- '../member.uid___A001_X879_X462/DaisyCalMS/science_calibrated.ms',
- '../member.uid___A001_X879_X466/DaisyCalMS/science_calibrated.ms',
- '../member.uid___A001_X879_X46a/DaisyCalMS/science_calibrated.ms',
- '../member.uid___A001_X879_X46e/DaisyCalMS/science_calibrated.ms']
- fig5 = plt.figure()
- ax5 = fig5.add_subplot(111)
- for i, vv in enumerate(visList):
- tb.open(vv + "/SPECTRAL_WINDOW")
- freqs = np.squeeze(tb.getcol("CHAN_FREQ"))/1.e9 # GHz
- tb.close()
- for spw in range(freqs.shape[-1]):
- xlow = freqs[:, spw].min()
- xhi = freqs[:, spw].max()
- ylo, yhi = i/float(len(visList)), (i+1)/float(len(visList))
- p = patches.Rectangle((xlow, ylo), abs(xhi - xlow) , abs(yhi - ylo), alpha=0.5) # xy, width, height
- ax5.annotate(str(spw), (freqs[:, spw].mean(), abs(yhi - ylo)/2+ylo))
- ax5.add_patch(p)
- # plt.xlim(83, 116)
- # plt.show()
- # raw_input(" ")
- plt.xlim(83, 116)
- plt.title(" Spectral Coverage for ADFS sources")
- plt.xlabel("observed freq [GHz]")
- ylabel = ax5.get_yticks().tolist()
- ylabel = [jj[ jj.find('_X4')+1 : jj.find('/D') ] for jj in visList]
- ax5.set_yticklabels(ylabel)
- plt.ylabel("SG file")
- plt.show()
- # fig1 = plt.gcf()
- User_input = raw_input('Save figure? (Y/N): ')
- if User_input == 'Y':
- filename = "spectral_coverage.png"
- Plotpath = './'
- fig5.savefig(Plotpath + filename, dpi=100, format='png',
- bbox_inches="tight", pad_inches=0.1)
- print "-- Saved figure as : %s --" % (Plotpath + filename)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement