from AIPS import AIPS, AIPSDisk from AIPSTask import AIPSTask, AIPSList from AIPSData import AIPSUVData, AIPSImage from snatch import snatch #import copy, optparse, os, sys, re, time # # AIPS configuration # AIPS.userno = 1523 def run_fring(uvdata,calver,refant,cals): fring = AIPSTask('fring') fring.indata = uvdata fring.gainuse = calver fring.flagver = 1 fring.docalib = 1 fring.refant = refant fring.solint = 4 fring.aparm[1] = 4 fring.aparm[6] = 2 fring.aparm[7] = 6 fring.aparm[9] = 0 fring.dparm[1] = 1 fring.dparm[4] = 3.99 fring.calsour = AIPSList(cals) fring.input() fring() def run_clcal(uvdata,snver,calver,refant): clcal = AIPSTask('clcal') clcal.indata = uvdata clcal.opcode = 'CALI' clcal.interpol = 'AMBG' clcal.doblank = 1 clcal.refant = refant clcal.snver = snver clcal.gainver = calver clcal.gainuse = calver+1 clcal.input() clcal() def run_split_line( uvdata, target, bchan, echan ): split = AIPSTask('split') split.indata = uvdata print uvdata.disk split.source[1] = target split.outdisk = uvdata.disk split.docalib = 2 split.bchan = bchan split.echan = echan split.aparm[1] = 2 split.input() split() contset = AIPSUVData( 'INBEAM FRING', 'UVCOP', 1, 1) lineset = AIPSUVData( 'UHEROH FRING', 'UVCOP', 1, 1) refant = 5 target = 'UHER.PT' refsource = ['UHERREF'] # # Do some silly checks, data sets exist, expected number of cal tables # if not contset.exists() or not lineset.exists(): raise RuntimeError, "Datasets seem not available" if lineset.table_highver('AIPS CL')!=5 and lineset.table_highver('AIPS SN')!=3: raise RuntimeError, "Line set not in right state" # # For continuum CL can be 6 or 7 and SN 4 or 5 # if contset.table_highver('AIPS CL')==5 and contset.table_highver('AIPS SN')==3: run_fring(contset, 5, refant, refsource ) if contset.table_highver('AIPS CL')==5 and contset.table_highver('AIPS SN')==4: run_clcal( contset, 4, 5, refant ) if contset.table_highver('AIPS CL')!=6 and contset.table_highver('AIPS SN')!=4: raise RuntimeError, "Cont set not in right state" table = 4 snt = snatch(contset, lineset, table, table) res = snt.run() run_clcal( lineset, 4, 5, refant ) run_split_line( lineset, target, 145, 145 ) print "DONE"