示例#1
0
else:
    print 'That scan is not in filtered scan list. Not a target field?'
    exit()

for i in range(len(dms)):
    dmbin0 = dms[i]
    try:
        if len(dms) == 1:
            dmbin1 = dms[i]+1
        else:
            dmbin1 = dms[i+1]
    except IndexError:
        break

    if dms[i] == -1:      # option to search all dm defined in script
        dmbin0 = 0
        dmbin1 = len(dmarrall)

    dmarr = dmarrall[dmbin0:dmbin1]

    candsfile = 'cands_' + msfile2[:-3] + '_dm' + str(dmbin0) + '-' + str(dmbin1) + '.pkl'     # cands filename
    print 'Searching %s for dmbin from %d to %d' % (msfile2, dmbin0, dmbin1)
    if os.path.exists(candsfile):
        print '%s candidate file already exists. Stopping.' % candsfile
    else:
        d = leanpipedt.pipe_thread(filename=msfile2, nints=nints, nskip=nskip, iterint=iterint, spw=spw, chans=chans, dmarr=dmarr, dtarr=dtarr, fwhmsurvey=0.5, fwhmfield=0.5, selectpol=['RR','LL'], scan=0, datacol='data', size=size, res=res, sigma_image=threshold, searchtype='imageall', gainfile=gainfile, bpfile=bpfile, filtershape=filtershape, 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...
finishedfile = 'tracking_dir/' + os.uname()[1] + '.finished'
open(finishedfile, 'a').close()
示例#2
0
# iteration over dms happens within iteration over scans.
# next two arguments define range of dmbins to search (0-32 here).
# working directory should have asdm file and telcal file named asdmfil+".GN"

import leanpipedt, parseasdm
import sys, os, argparse
import numpy as n

parser = argparse.ArgumentParser()
parser.add_argument("asdmfile", help="input asdm file name")
parser.add_argument("msfile", help="root of output ms file name")
parser.add_argument("scan", help="scan to select from asdmfile")
args = parser.parse_args(); asdmfile = args.asdmfile.rstrip('/'); msfile = args.msfile; scan = args.scan

npix = 256  # small number
res = 58

# run prep and search
try:
    goodscans = parseasdm.getscans(asdmfile, namefilter='')  # only get scans with bdfs
    print goodscans
    msfile2 = parseasdm.asdm2ms(asdmfile, msfile, scan)    # if scans indexed by scan number
    d = leanpipedt.pipe_thread(filename=msfile2, nints=100, nskip=0, iterint=100, spw=[0,1], chans=range(64), dmarr=[0], fwhmsurvey=0.5, fwhmfield=0.5, selectpol=['RR','LL'], scan=0, datacol='data', size=npix*res, res=res, sigma_image=10, searchtype='', filtershape=None, savecands=False, candsfile='', flagmode='')    # make pkl file only
except:
    print 'Processing of %s failed with %s exception.' % (msfile2, sys.exc_info()[0])

# tell node manager that we're done here...
finishedfile = 'tracking_dir/' + os.uname()[1] + '.ready_' + str(n.random.randint(100000))
print 'Writing %s' % finishedfile
open(finishedfile, 'a').close()