예제 #1
0
def test():
    np.random.seed(0)
    scene = SceneHealpixCMB(256, kind='IQU')
    acq = PlanckAcquisition(150, scene, true_sky=SKY)
    obs = acq.get_observation()
    invNtt = acq.get_invntt_operator()
    chi2_red = np.sum((obs - SKY) * invNtt(obs - SKY) / SKY.size)
    assert abs(chi2_red - 1) <= 0.001
예제 #2
0
def test_noiseless():
    sampling = create_random_pointings([0, 90], 100, 10)
    acq_qubic = QubicAcquisition(150, sampling)
    acq_planck = PlanckAcquisition(150, acq_qubic.scene, true_sky=SKY)
    acq_fusion = QubicPlanckAcquisition(acq_qubic, acq_planck)
    np.random.seed(0)
    y1 = acq_fusion.get_observation()
    np.random.seed(0)
    y2 = acq_fusion.get_observation(noiseless=True) + acq_fusion.get_noise()
    assert_same(y1, y2)
예제 #3
0
mp.figure(1)
_max = [300, 5, 5]
for i, (inp, rec, iqu) in enumerate(zip(maps_convolved.T, maps_recon.T, 'IQU')):
    inp[cov < cov.max() * 0.01] = hp.UNSEEN
    rec[cov < cov.max() * 0.01] = hp.UNSEEN
    diff = inp - rec
    diff[cov < cov.max() * 0.01] = hp.UNSEEN
    hp.gnomview(inp, rot=center_gal, reso=5, xsize=700, fig=1,
        sub=(3, 3, i + 1), min=-_max[i], max=_max[i], title='Input, {}'.format(iqu))
    hp.gnomview(rec, rot=center_gal, reso=5, xsize=700, fig=1,
        sub=(3, 3, i + 4), min=-_max[i], max=_max[i], title='Recon, {}'.format(iqu))
    hp.gnomview(diff, rot=center_gal, reso=5, xsize=700, fig=1,
        sub=(3, 3, i+7), min=-_max[i], max=_max[i], title='Diff, {}'.format(iqu))

# Now let's play with the fusion acquisition
planck = PlanckAcquisition(band, a.scene, true_sky=maps_convolved)
acq_fusion = QubicPlanckAcquisition(a, acq_planck)

TOD, maps_convolved = a.get_observation(x0)
maps_recon_fusion = a.tod2map(TOD, tol=tol)

mp.figure(2)
for i, (inp, rec, iqu) in enumerate(zip(maps_convolved.T, maps_recon_fusion.T, 'IQU')):
    inp[cov < cov.max() * 0.01] = hp.UNSEEN
    rec[cov < cov.max() * 0.01] = hp.UNSEEN
    diff = inp - rec
    diff[cov < cov.max() * 0.01] = hp.UNSEEN
    hp.gnomview(inp, rot=center_gal, reso=5, xsize=700, fig=1,
        sub=(3, 3, i + 1), min=-_max[i], max=_max[i], title='Input, {}'.format(iqu))
    hp.gnomview(rec, rot=center_gal, reso=5, xsize=700, fig=1,
        sub=(3, 3, i + 4), min=-_max[i], max=_max[i], title='Recon, {}'.format(iqu))
예제 #4
0
x0 = read_map(PATH + 'syn256_pol.fits')

q = MultiQubicInstrument(NPOINTS=NPOINTS,
                         NFREQS=NFREQS,
                         filter_name=filter_name,
                         detector_nep=detector_nep)

C_nf = q.get_convolution_peak_operator()
conv_sky_ = C_nf(x0)

fwhm_t = np.sqrt(q.synthbeam.peak150.fwhm**2 - C_nf.fwhm**2)
C_transf = HealpixConvolutionGaussianOperator(fwhm=fwhm_t)

acq = MultiQubicAcquisition(q, sampling, scene=scene)
acq_planck = PlanckAcquisition(np.int(filter_name / 1e9),
                               scene,
                               true_sky=conv_sky_)
H = acq.get_operator()
COV = acq.get_coverage(H)

conv_sky = C_transf(conv_sky_)

x_rec_fusion = read_map('maps_test/fusion_n{}_N{}_s{}_mi{}.fits'.format(
    NFREQS, NPOINTS, len(sampling), maxiter))

x_rec_qubic = read_map('maps_test/qubic_n{}_N{}_s{}_mi{}.fits'.format(
    NFREQS, NPOINTS, len(sampling), maxiter))


# some display
def display(input, msg, iplot=1):
예제 #5
0
racenter = 0.0  # deg
deccenter = -57.0  # deg
maxiter = 1000
tol = 5e-6

sky = read_map(PATH + 'syn256_pol.fits')
nside = 256
sampling = create_random_pointings([racenter, deccenter], 1000, 10)
scene = QubicScene(nside)

acq_qubic = QubicAcquisition(150, sampling, scene, effective_duration=1)
convolved_sky = acq_qubic.instrument.get_convolution_peak_operator()(sky)
cov = acq_qubic.get_coverage()
mask = cov < cov.max() * 0.2
acq_planck = PlanckAcquisition(150,
                               acq_qubic.scene,
                               true_sky=convolved_sky,
                               mask=mask)
acq_fusion = QubicPlanckAcquisition(acq_qubic, acq_planck)

H = acq_fusion.get_operator()
invntt = acq_fusion.get_invntt_operator()
y = acq_fusion.get_observation()

A = H.T * invntt * H
b = H.T * invntt * y

solution_fusion = pcg(A, b, disp=True, maxiter=maxiter, tol=tol)

acq_qubic = QubicAcquisition(150, sampling, scene, effective_duration=1)
H = acq_qubic.get_operator()
invntt = acq_qubic.get_invntt_operator()