#Starting: # Needs data sets: # B0319_0317.ms import timing import time global msplot_results global msplot_comment n1333_results = {} n1333_comment = {} def examine_data(): print 'EXAMINE DATA' mp.open('B0319_0317.ms') mp.array() mp.uvcoverage() mp.uvdist() mp.uvdist(what='phase') mp.gaintime() mp.gaintime(what='phase') mp.gainchannel() mp.gainchannel(what='phase') #avg channel plots for gaintime, uvdist test=mp.close() d={'EXAMINE_DATA': test} comment={'EXAMINE_DATA': ''} n1333_results.update(d) n1333_comment.update(comment) def calibrate_data(): print "CALIBRATE DATA" cb.open('B0319_0317.ms') cb.initcalset() # just to be safe #vary t=time to adjust how much time averaging #when t is small, yields solution per integration cb.setsolve(type='M',t=3,table='B0319.M') cb.solve() #plot M solution table with calplot cb.reset() cb.setapply(type='M',table='B0319.M') #set t=time large to get a single solution in time for each channel cb.setsolve(type='MF',t=30000,table='B0319.MF') cb.solve() #plot MF solution table with calplot cb.reset() cb.setapply(type='M',table='B0319.M') cb.setapply(type='MF',table='B0319.MF') cb.correct() test=cb.done() d={'CALIBRATE_DATA': test} comment={'CALIBRATE_DATA': ''} n1333_results.update(d) n1333_comment.update(comment) def examine_calibration(): print "EXAMINE CALIBRATION" cp.open('B0319.M') cp.plot() # does PHASE cp.setdata() cp.plot() # does AMP cp.close() #cp.open('B0319.MF') #cp.plot() test=cp.close() d={'EXAMINE_CALIBRATION': test} comment={'EXAMINE_CALIBRATION': 'MF segfaults'} n1333_results.update(d) n1333_comment.update(comment) def examine_corrected_data(): print "EXAMINE CORRECTED DATA" mp.open('B0319_0317.ms') mp.uvdist(column='corrected') mp.uvdist(column='corrected',what='phase') mp.gaintime(column='corrected') mp.gaintime(column='corrected',what='phase') mp.gainchannel(column='corrected') mp.gainchannel(column='corrected',what='phase') #avg channel plots for gaintime, uvdist test=mp.close() d={'EXAMINE_CORRECTED_DATA': test} comment={'EXAMINE_CORRECTED_DATA': ''} n1333_results.update(d) n1333_comment.update(comment) def n1333_atf(): timing.start() EXAMINE_DATA = True CALIBRATE_DATA = True EXAMINE_CALIBRATION = True EXAMINE_CORRECTED_DATA = True if (EXAMINE_DATA): examine_data() if (CALIBRATE_DATA): calibrate_data() if (EXAMINE_CALIBRATION): examine_calibration() if (EXAMINE_CORRECTED_DATA): examine_corrected_data() timing.finish() print 'MS plot interface time is: ',timing.milli()/1000. return True n1333_atf() print '---' print 'N1333_ATF: ' print ' Working: ',n1333_results.values().count(True) print ' Fail: ',n1333_results.values().count(False) print '---' format = "%25s %7s %35s" for k,v,c in zip(n1333_results.keys(),n1333_results.values(),n1333_comment.values()): print format % (k,v,c)