Esempio n. 1
0
    try:
        obeam = jointmap.read_beam(("fwhm", float(args.obeam)))
    except ValueError:
        obeam = jointmap.read_beam(("transfun", args.obeam))
else:
    obeam = None

# We have two modes, depending on what args.area is.
# 1. area is an enmap. Will loop over tiles in that area, and output padded tiles
#    to output directory
# 2. area is a dec1:dec2,ra1:ra2 bounding box. Will process that area as a single
#    tile, and output it and debugging info to output directory
bounds = parse_bounds(args.area)
if bounds is None:
    # Tiled, so read geometry
    shape, wcs = jointmap.read_geometry(args.area)
    tshape = np.array([args.tsize, args.tsize])
    ntile = np.floor((shape[-2:] + tshape - 1) / tshape).astype(int)
    tyx = [(y, x) for y in range(ntile[0] - 1, -1, -1)
           for x in range(ntile[1])]
    for i in range(comm.rank, len(tyx), comm.size):
        y, x = tyx[i]
        ofile_map = args.odir + "/map_padtile/tile%(y)03d_%(x)03d.fits" % {
            "y": y,
            "x": x
        }
        ofile_div = args.odir + "/div_padtile/tile%(y)03d_%(x)03d.fits" % {
            "y": y,
            "x": x
        }
        utils.mkdir(os.path.dirname(ofile_map))
Esempio n. 2
0
	# Output total catalogue
	apod_slice  = (slice(args.apod_edge,-args.apod_edge), slice(args.apod_edge,-args.apod_edge))
	shape, wcs = enmap.slice_geometry(info.model.shape, info.model.wcs, ffpad_slice[-2:])
	shape, wcs = enmap.slice_geometry(shape, wcs, apod_slice)
	box        = enmap.box(shape, wcs)
	jointmap.write_catalogue(prefix + "catalogue" + tname, info.catalogue, box)

# We have two modes, depending on what args.area is.
# 1. area is an enmap. Will loop over tiles in that area, and output padded tiles
#    to output directory
# 2. area is a dec1:dec2,ra1:ra2 bounding box. Will process that area as a single
#    tile, and output it and debugging info to output directory
bounds = parse_bounds(args.area)
if bounds is None:
	# Tiled, so read geometry
	shape, wcs = jointmap.read_geometry(args.area)
	shape  = shape[-2:]
	tshape = np.array([args.tsize,args.tsize])
	ntile  = np.floor((shape[-2:]+tshape-1)/tshape).astype(int)
	tyx    = [(y,x) for y in range(ntile[0]-1,-1,-1) for x in range(ntile[1])]
	for i in range(comm.rank, len(tyx), comm.size):
		y, x = tyx[i]
		if debug_tile is not None and not (y == debug_tile[0] and x == debug_tile[1]):
			continue
		prefix  = args.odir + "/"
		if args.cont and os.path.isfile(prefix + "catalogue.fits"):
			if verbosity >= 1:
				print "%3d skipping %3d %3d (already done)" % (comm.rank, y, x)
			continue
		if verbosity >= 1:
			print "%3d processing %3d %3d" % (comm.rank, y, x)
Esempio n. 3
0
	coadder = jointmap.AutoCoadder.read(datasets, box, pad=args.pad, verbose=True, dtype=dtype,
			cache_dir=args.odir, read_cache=args.cont)
	coadder.analyze(ref_beam, mode=args.mode,
			apod_val=args.apod_val, apod_alpha=args.apod_alpha, apod_edge=args.apod_edge,
			filter_kxrad=args.kxrad, filter_kx_ymax_scale=args.kx_ymax_scale, filter_highpass=args.highpass)
	if args.slice: coadder.set_slice(args.slice)
	coadder.calc_precon()
	coadder.calc_rhs()
	res = coadder.solve(verbose=True, cg_tol=args.cg_tol, dump_dir=args.odir, maxiter=args.maxiter)
	if res is None: print "No data found"
	else:
		enmap.write_map(args.odir + "/map.fits", res.map)
		enmap.write_map(args.odir + "/div.fits", res.div)
else:
	# We will loop over tiles in the area defined by template
	shape, wcs = jointmap.read_geometry(args.template)
	pre   = (ncomp,)
	shape = pre + shape
	tshape = np.array([args.tilesize,args.tilesize])
	ntile  = np.floor((shape[-2:]+tshape-1)/tshape).astype(int)
	tyx = [(y,x) for y in range(ntile[0]-1,-1,-1) for x in range(ntile[1])]
	for i in range(comm.rank, len(tyx), comm.size):
		y, x = tyx[i]
		if args.cont and os.path.isfile(args.odir + "/map_padtile%(y)03d_%(x)03d.fits" % {"y":y,"x":x}):
			print "%3d skipping %3d %3d" % (comm.rank, y, x)
			continue
		print "%3d processing %3d %3d" % (comm.rank, y, x)
		tpos = np.array(tyx[i])
		pbox = np.array([tpos*tshape,np.minimum((tpos+1)*tshape,shape[-2:])])
		box  = enmap.pix2sky(shape, wcs, pbox.T).T
		# Set up the coadder