Пример #1
0
 def calc_b(self):
     PNd = self.PT(en.map_mul(self.iN, self.d))
     Uw1_s = en.harm2map(
         en.map_mul(self.hS,
                    en.rand_gauss_harm(self.d.shape[-3:], self.d.wcs)))
     Uw1_a = np.zeros(self.T.shape[0])
     Uw1 = self.dof.zip(Uw1_s, Uw1_a)
     PNw2 = self.PT(
         en.map_mul(self.hN, en.rand_gauss(self.d.shape, self.d.wcs)))
     return PNd + Uw1 + PNw2
Пример #2
0
m += dust; add(res, m, "dust")
# 7. Add zodiacal light (invisible)
# 8. Add refraction (shift everything by about 1 arcmin for simplicity)
# 9. Add the atmosphere (large-scale blobs, high amplitude)
cl_atm = parse_powlaw(args.atm)
atm = enmap.rand_map(shape, wcs, cl_atm)
m += atm; add(res, m, "atm")
# 10. Add polarization angle errors (3 degrees, say)
m = enmap.rotate_pol(m, args.angerr*np.pi/180)
add(res, m, "polerr")

# 11. Sidelobe
linfo = parse_sidelobe(args.sidelobe)
lobe  = sim_sidelobe(shape, wcs, linfo)
m += lobe; add(res, m, "sidelobe")

# 12. Blur
m = blur(m, args.beam*np.pi/180/60/(8*np.log(2))*0.5)
add(res, m, "beam")

# 13. Add white noise
white = enmap.rand_gauss(shape, wcs)*(np.array([args.white]+[args.white*2**0.5]*2)/args.res)[:,None,None]
m += white; add(res, m, "noise")

# 14. Add glitches (localized features with even higher amplitude)
ginfo = parse_points(args.glitch)
glitch = sim_points(shape, wcs, ginfo)
m += glitch; add(res, m, "glitch")

output(res, args.odir)
Пример #3
0
wibox = ibox.copy()
wibox[:, :] = utils.widen_box(ibox[:, :])
srate = nsamp / wt

# output box
icorners = utils.box2corners(ibox)
ocorners = hor2cel(icorners.T, t0)
obox = utils.minmax(ocorners, -1)[:, :2]
wobox = utils.widen_box(obox)

# define a pixelization
shape, wcs = enmap.geometry(pos=wobox[:, ::-1],
                            res=args.res * utils.arcmin,
                            proj="cea")
nphi = int(2 * np.pi / (args.res * utils.arcmin))
map_orig = enmap.rand_gauss((ncomp, ) + shape, wcs).astype(dtype)
print "map shape %s" % str(map_orig.shape)

pbox = np.array([[0, 0], shape], dtype=int)
# define a test tod
bore = np.zeros([nsamp, 3], dtype=ptype)
bore[:, 0] = (wt * np.linspace(0, 1, nsamp, endpoint=False))
bore[:, 1] = (args.az + args.waz / 2 * utils.triangle_wave(
    np.linspace(0, 1, nsamp, endpoint=False) * 20)) * utils.degree
bore[:, 2] = (args.el + args.wel / 2 * utils.triangle_wave(
    np.linspace(0, 1, nsamp, endpoint=False))) * utils.degree
#bore = (ibox[None,0] + np.random.uniform(0,1,size=(nsamp,3))*(ibox[1]-ibox[0])[None,:]).astype(ptype)
tod = np.zeros((ndet, nsamp), dtype=dtype)
psi = np.arange(nsamp) * 2 * np.pi / 100
hwp = np.zeros([nsamp, 2])
hwp[:, 0] = np.cos(psi)
Пример #4
0
        return enmap.samewcs(solver.x.reshape(b.shape), b)


# Try solving
trifilter = Trifilter(map, iP, S, N)
L.info("Filtering map")
pmap = trifilter.solve(map, verbose=args.verbose, nmin=nmin)
L.info("Writing pmap")
enmap.write_map(args.odir + "/pmap.fits", pmap[0])

# Estimate uncertainty with a couple of other realizations
varmap = inoise * 0
nsim = 2
for i in range(nsim):
    L.info("Filtering sim %d" % i)
    r = enmap.rand_gauss(map.shape,
                         map.wcs) * (inoise + np.max(inoise) * 1e-4)[0]**-0.5
    c = enmap.rand_map(map.shape, map.wcs, ps_cmb)
    sim = r + c
    sim_flt = trifilter.solve(sim, verbose=args.verbose, nmin=nmin)
    enmap.write_map(args.odir + "/sim%d.fits" % i, sim[0])
    enmap.write_map(args.odir + "/sim_flt%d.fits" % i, sim_flt[0])
    varmap += sim_flt[None, :] * sim_flt[:, None]
varmap /= nsim

L.info("Writing pstd_raw")
enmap.write_map(args.odir + "/pstd_raw.fits", varmap[0, 0]**0.5)

# Smooth var map to reduce noise
L.info("Computing significance")
varmap = enmap.smooth_gauss(varmap[0, 0], 15 * np.pi / 180 / 60)[None, None]
# Create signal-to-noise map
Пример #5
0
 def calc_b(self):
     rand_term = [
         self.Tmul(c, mat, enmap.rand_gauss(self.d.shape, self.d.wcs))
         for c, mat in zip(self.mode, self.hmats)
     ]
     return self.Nd + np.sum(rand_term, 0)
Пример #6
0
# units
ibox[:,1:] *= utils.degree
wibox = ibox.copy()
wibox[:,:] = utils.widen_box(ibox[:,:])
srate = nsamp/wt

# output box
icorners = utils.box2corners(ibox)
ocorners = hor2cel(icorners.T, t0)
obox     = utils.minmax(ocorners, -1)[:,:2]
wobox    = utils.widen_box(obox)

# define a pixelization
shape, wcs = enmap.geometry(pos=wobox[:,::-1], res=args.res*utils.arcmin, proj="cea")
nphi = int(2*np.pi/(args.res*utils.arcmin))
map_orig = enmap.rand_gauss((ncomp,)+shape, wcs).astype(dtype)
print "map shape %s" % str(map_orig.shape)

pbox = np.array([[0,0],shape],dtype=int)
# define a test tod
bore = np.zeros([nsamp,3],dtype=ptype)
bore[:,0] = (wt*np.linspace(0,1,nsamp,endpoint=False))
bore[:,1] = (args.az + args.waz/2*utils.triangle_wave(np.linspace(0,1,nsamp,endpoint=False)*20))*utils.degree
bore[:,2] = (args.el + args.wel/2*utils.triangle_wave(np.linspace(0,1,nsamp,endpoint=False)))*utils.degree
#bore = (ibox[None,0] + np.random.uniform(0,1,size=(nsamp,3))*(ibox[1]-ibox[0])[None,:]).astype(ptype)
tod = np.zeros((ndet,nsamp),dtype=dtype)
psi = np.arange(nsamp)*2*np.pi/100
hwp = np.zeros([nsamp,2])
hwp[:,0] = np.cos(psi)
hwp[:,1] = np.sin(psi)
if not args.hwp: hwp[0] = 0