Example #1
0
    if bpstr == '':
        bpstr = gainstr
    print 'BP calibration with scans %s' % bpstr

# assume data in place, look for cal tables 
g0name = msfile[:-3]+'.g0'
b1name = msfile[:-3]+'.b1'
g1name = msfile[:-3]+'.g1'
if fluxmodel:        # if doing flux scale, define name
    fluxfile = g0name
else:
    fluxfile = ''

if bpstr:   # doing full bp cal first
    bpms = msfile[:-3] + '_bp.ms'
    bpms2 = qrtt.asdm2ms(asdmfile, bpms, bpstr, inttime='1s')   # integrate down to 1s during split
    if not os.path.exists(b1name):

        # flag data with quack, rflag, and clip of zeros
        print 'Starting flagging of bp file...'
        flagdata(vis=bpms2, mode='unflag')
        flagdata(vis=bpms2, mode='manual', antenna='ea06')
        flagdata(vis=bpms2, mode='shadow')
        flagdata(vis=bpms2, mode='clip', clipzeros=True)
        flagdata(vis=bpms2, mode='rflag')
        flagdata(vis=bpms2, mode='extend', growaround=True, extendpols=True)
        flagdata(vis=bpms2, mode='quack', quackinterval=15)
        flags = flagdata(vis=bpms2, mode='summary')
        print 'Gain flag summary:'
        print flags
Example #2
0
bpfile = msfile[:-3] + '.b1'
flagmode = 'medcht1.5badbp2'
if asdmfile[-1] == '/':
    asdmfile = asdmfile[:-1]
nskip = 300
iterint = 100

# run prep and search
goodscans = qrtt.prep(asdmfile, workdir=workdir, intentfilter=intentfilter)    # set up asdm and telcal files, get scans of interest (tuple with scannum, name, nints)

if os.path.exists(telcalfile) or os.path.exists(gainfile):    # need to have telcal ready to proceed
    for scan in scans:
        for i in range(len(dms)-1):
            dmbin0 = dms[i]
            dmbin1 = dms[i+1]
            dmarr = dmarrall[dmbin0:dmbin1]
            msfile2 = qrtt.asdm2ms(asdmfile, msfile, str(goodscans[scan][0]))            # convert asdm to ms for a scan. returns new ms file name
            candsfile = 'cands_' + msfile2[:-3] + '_dm' + str(dmbin0) + '-' + str(dmbin1) + '.pkl'     # cands filename
            print 'Searching %s for dmbins from %d to %d' % (msfile2, dmbin0, dmbin1)
            if os.path.exists(candsfile):
                print '%s candidate file already exists. Stopping.' % candsfile
            else:
                d = leanpipet.pipe_thread(filename=msfile2, nints=goodscans[scan][2]-(nskip+iterint), nskip=nskip, iterint=iterint, spw=[0,1], chans=chans, dmarr=dmarr, fwhmsurvey=0.5, fwhmfield=0.5, selectpol=['RR','LL'], scan=0, datacol='data', size=0, res=0, sigma_image=threshold, searchtype='imageall', gainfile=gainfile, bpfile=bpfile, filtershape=None, savecands=True, candsfile=candsfile, flagmode=flagmode, nthreads=nthreads)    # skip 200 ints to avoid mystery data at start

# tell node manager that we're done here...
if os.uname()[1] == 'jvla.local':
    pass
else:
    finishedfile = 'tracking_dir/' + os.uname()[1] + '.finished'
    open(finishedfile, 'a').close()