# 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()
chans = range(6,122)+range(134,250) # 128 ch/spw version cutting 5% of channels from each edge plus bad chans at bottom filtershape = 'b' # time filter res = 58 # imaging parameters. set res=size=0 to define from uv coords npix = 512 size = npix*res dmarrall = [0,19.2033,38.4033,57.6025,76.8036,96.0093,115.222,134.445,153.68,172.93,192.198,211.486,230.797,250.133,269.498,288.894,308.323,327.788,347.292,366.837,386.426,406.062,425.747,445.484,465.276,485.125,505.033,525.005,545.042,565.147,585.322,605.571,625.896,646.3,666.786,687.355,708.012,728.759,749.598,770.532,791.565,812.699,833.936,855.28,876.733,898.299,919.979,941.778,963.697,985.741,1007.91,1030.21,1052.64,1075.21,1097.92,1120.76,1143.76,1166.9,1190.19,1213.63,1237.23,1260.99,1284.92,1309.01,1333.27,1357.7,1382.31,1407.09,1432.06,1457.22,1482.56,1508.1,1533.83,1559.76,1585.89,1612.23,1638.77,1665.53,1692.51,1719.7,1747.12,1774.77,1802.64,1830.75,1859.1,1887.69,1916.53,1945.61,1974.95,2004.54,2034.39,2064.51,2094.9,2125.56,2156.49,2187.71,2219.21,2250.99,2283.07,2315.45,2348.13,2381.12,2414.41,2448.02,2481.94,2516.19,2550.77,2585.68,2620.92,2656.51,2692.44,2728.72,2765.36,2802.36,2839.72,2877.45,2915.55,2954.04,2992.91] dtarr = [1,2,4,8] # integer to integrate in time for independent searches flagmode = 'ring2medcht1.5badbp2blstd3' # flagging # set up cal files gainfile = msfile[:-3] + '.g1' bpfile = msfile[:-3] + '.b1' telcalfile = '' # set up ms and define nints msfile2 = parseasdm.asdm2ms(asdmfile, msfile, scan) goodscans = parseasdm.getscans(asdmfile)[:48] # only consider scans that have bdfs intlist = [sc[2] for sc in goodscans if sc[0] == int(scan)] if len(intlist) > 0: nints = intlist[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:
# Usage: # batch_filler.py asdmfile msfileroot scanlist # # asdmfile is input asdm, msroot is converted ms filename root (includes '.ms', but stuff gets added before that). # next is scan numbers (0 based, comma-delimited), MS file name will use MS scan number instead. iterates over scans. # similarly, the dmbins are given as comma-delimited list. a single run will use pairs of these numbers. "0,30,60" will run with 0-30, then 30-60. # 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 # run prep and search goodscans = parseasdm.getscans(asdmfile, namefilter='J1911') print goodscans #msfile2 = parseasdm.asdm2ms(asdmfile, msfile, str(goodscans[int(scan)][0])) # if scans indexed zero-based 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=25600, res=50, sigma_image=10, searchtype='', filtershape=None, savecands=False, candsfile='', flagmode='') # make pkl file only # tell node manager that we're done here... finishedfile = 'tracking_dir/' + os.uname()[1] + '.ready_' + str(n.random.randint(100)) open(finishedfile, 'a').close()