def maths(image, cutoff, mask): os.system('rm -r ' + mask) maths = mirexec.TaskMaths() maths.exp = "<" + image + ">" maths.mask = "<" + image + ">" + ".gt." + str(cutoff) maths.out = mask tout = maths.snarf()
def maths(imname, cutoff, maskname): os.system('rm -r ' + maskname) maths = mirexec.TaskMaths() maths.exp = imname maths.mask = imname + '.gt.' + str(cutoff) maths.out = maskname maths.snarf()
def mkfmod(): ''' Uses image properties to cutout a single rectangular region from a mask. S.fipe = X,Y,xp,yp,l X,Y: Size of the model image (pixels) xp,yp: Pixel coords of the source to be peeled l: Pixel length of displacement from source ''' # First, the size of the image S.fipe = S.fipe.split(',') X = int(S.fipe[0]) Y = int(S.fipe[1]) xp = int(S.fipe[2]) yp = int(S.fipe[3]) l = int(S.fipe[4]) model = S.fipe[5] polygon = 'polygon(1,1,' + str(xp - l) + ',1,' + str(xp - l) + ',' + str(yp + l) polygon = polygon + ',' + str(xp + l) + ',' + str(yp + l) + ',' + str(xp + l) + ',1,' polygon = polygon + str(X) + ',1,' + str(X) + ',' + str(Y) + ',1,' + str( Y) + ')' maths = mirexec.TaskMaths() maths.exp = model maths.region = polygon maths.out = 'fmod' tout = maths.snarf() acos.taskout(maths, tout, 'maths.txt')
def maths(image, cutoff, mask): shrun('rm -r ' + mask) maths = mirexec.TaskMaths() maths.exp = image maths.mask = image + ".gt." + str(cutoff) maths.out = mask tout = maths.snarf()
def maths(settings, fname): settings.gt = round(settings.gt, 10) maths = mirexec.TaskMaths() maths.exp = settings.image maths.mask = settings.image + '.gt.' + str(settings.gt) maths.out = settings.mask #maths.region=settings.clean_region; tout = maths.snarf() acos.taskout(maths, tout, fname)
def fp_models(ppoly, fpoly, model): ''' Uses the vertices defined in pgon to ''' maths = mirexec.TaskMaths() maths.exp = model maths.mask = model maths.region = ppoly maths.out = model.replace("src", "src_p") tout = restor.snarf() acos.taskout(maths, tout, 'maths.txt') maths = mirexec.TaskMaths() maths.exp = model maths.mask = model maths.region = fpoly maths.out = model.replace("src", "src_f") tout = restor.snarf() acos.taskout(maths, tout, 'maths.txt')
def mk_lsm(options): ''' mk_lsm: The module that makes the NVSS LSM using the miriad task IMGEN. Needs options.infile (template) and options.outfile (name of output point source model) ''' # NOTE: Classic cos^6 model of the WSRT PB used to calculate apparent fluxes. Here we use c=68. PB = lambda c, v, r: (pl.cos(c * v * r))**6 # NOTE: Grab the central coordinates from the template file. c = getradec(options.infile) print c ra0 = c.ra.deg dec0 = c.dec.deg # NOTE: Query the NVSS around the central pointing L, M, N, S = query_nvss(options, ra0, dec0, s='>10.', proj='NCP') L_asec = L * 3600. M_asec = M * 3600. pl.scatter(L_asec, M_asec, c=S * 1000, s=S) pl.xlabel('L offset (arcsec)') pl.ylabel('M offset (arcsec)') pl.colorbar() pl.savefig(options.infile + '-nvss-lsm.pdf', dpi=300) pl.close() n = 20 modfiles = '' # NOTE: Make the LSM! imgen = mirexec.TaskImGen() for j in range(0, 1 + N / n): imgen.in_ = options.infile imgen.out = 'tmod' + str(j) os.system('rm -r ' + str(imgen.out)) objs = '' spars = '' for i in range(0, n): if (i + j * n < N): objs += 'point,' d2point = L[i + j * n]**2 + M[i + j * n]**2 S_app = S[i + j * n] * PB(c=68, v=1.420, r=d2point) spars += str(S_app / 1e3) + ',' + str( L_asec[i + j * n]) + ',' + str(M_asec[i + j * n]) + ',' imgen.factor = 0 imgen.object = objs[:-1] imgen.spar = spars[:-1] imgen.snarf() modfiles += '<' + imgen.out + '>+' maths = mirexec.TaskMaths() maths.exp = modfiles[0:-1] os.system('rm -r ' + options.outfile) maths.out = options.outfile maths.snarf() os.system('rm -r tmod*')