Esempio n. 1
0
def write_reference():
    np.random.seed(0)
    p = create_random_pointings([0, 90], NPTG, ANGLE)
    FitsArray([p.azimuth, p.elevation, p.pitch, p.angle_hwp]).save(FILEPTG)
    for kind, map, filename in zip(['I', 'IQU'], [MAPIQU[..., 0], MAPIQU],
                                   [FILETODI, FILETODIQU]):
        acq = QubicAcquisition(INSTRUMENT, p, nside=256, kind=kind)
        tod = acq.get_observation(map, noiseless=True)
        FitsArray(tod).save(filename)
Esempio n. 2
0
acq_planck = PlanckAcquisition(150, acq_qubic.scene, true_sky=convolved_sky)
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()
y, sky_convolved = acq_qubic.get_observation(sky, convolution=True)

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

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


# some display
def display(input, msg, iplot=1):
    out = []
    for i, (kind, lim) in enumerate(zip('IQU', [50, 5, 5])):
        map = input[..., i]
        out += [hp.gnomview(map, rot=center, reso=5, xsize=800, min=-lim,
                            max=lim, title=msg + ' ' + kind,
                            sub=(3, 3, iplot + i), return_projected_map=True)]
# read the input map
x0 = qubic.io.read_map(qubic.data.PATH + 'syn256_pol.fits', field='I_STOKES')
nside = 256

# let's take the galactic north pole as the center of the observation field
center_gal = 0, 90
center = gal2equ(center_gal[0], center_gal[1])

# sampling model
np.random.seed(0)
sampling = create_random_pointings(center, 1000, 10)
scene = QubicScene(nside, kind='I')

# acquisition model
acq = QubicAcquisition(150, sampling, scene)
y, x0_convolved = acq.get_observation(x0, convolution=True, noiseless=True)

# map-making
x, coverage = tod2map_all(acq, y, disp=True, tol=1e-4, coverage_threshold=0)
mask = coverage > 0


# some display
def display(x, title):
    x = x.copy()
    x[~mask] = np.nan
    hp.gnomview(x, rot=center_gal, reso=5, xsize=600, min=-200, max=200,
                title=title)

display(x0, 'Original map')
display(x0_convolved, 'Convolved original map')
Esempio n. 4
0
                                     angspeed_psi, maxpsi)
scene = QubicScene(nside)

# get the acquisition model
acquisition = QubicAcquisition(150,
                               sampling,
                               scene,
                               synthbeam_fraction=0.99,
                               detector_tau=0.01,
                               detector_nep=1.e-17,
                               detector_fknee=1.,
                               detector_fslope=1)

# simulate the timeline
tod, x0_convolved = acquisition.get_observation(x0,
                                                convolution=True,
                                                noiseless=True)

# reconstruct using two methods
map_all, cov_all = tod2map_all(acquisition, tod, tol=1e-2)
map_each, cov_each = tod2map_each(acquisition, tod, tol=1e-2)


# some display
def display(map, cov, msg, sub):
    for i, (kind, lim) in enumerate(zip('IQU', [200, 10, 10])):
        map_ = map[..., i].copy()
        mask = cov == 0
        map_[mask] = np.nan
        hp.gnomview(map_,
                    rot=center,
Esempio n. 5
0
from __future__ import division
from qubic import (create_random_pointings, gal2equ, QubicAcquisition,
                   QubicScene, tod2map_all)
import numpy as np
import qubic

# read the input map
input_map = qubic.io.read_map(qubic.data.PATH + 'syn256_pol.fits',
                              field='I_STOKES')
nside = 256

# let's take the galactic north pole as the center of the observation field
center_gal = 0, 90
center = gal2equ(center_gal[0], center_gal[1])

# sampling model
np.random.seed(0)
sampling = create_random_pointings(center, 1000, 10)
scene = QubicScene(nside, kind='I')

# acquisition model
acq = QubicAcquisition(150, sampling, scene)
hit = acq.get_hitmap()

# Produce the Time-Ordered data
tod = acq.get_observation(input_map)
output_map, coverage = tod2map_all(acq, tod)

print(acq.comm.rank, output_map[coverage > 0][:5])
print(acq.comm.rank, hit[hit > 0][:10])
Esempio n. 6
0
 def func(kind, map, filename):
     acq = QubicAcquisition(INSTRUMENT, p, nside=256, kind=kind)
     tod = acq.get_observation(map, noiseless=True)
     ref = FitsArray(filename)
     np.testing.assert_almost_equal(tod, ref)
Esempio n. 7
0
                               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()
y, sky_convolved = acq_qubic.get_observation(sky, convolution=True)

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

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


# some display
def display(input, msg, iplot=1):
    out = []
    for i, (kind, lim) in enumerate(zip('IQU', [50, 5, 5])):
        map = input[..., i]
        out += [
            hp.gnomview(map,
                        rot=center,
Esempio n. 8
0
from qubic import (
    create_random_pointings, gal2equ, QubicAcquisition, QubicScene,
    tod2map_all)
import numpy as np
import qubic

# read the input map
input_map = qubic.io.read_map(qubic.data.PATH + 'syn256_pol.fits',
                              field='I_STOKES')
nside = 256

# let's take the galactic north pole as the center of the observation field
center_gal = 0, 90
center = gal2equ(center_gal[0], center_gal[1])

# sampling model
np.random.seed(0)
sampling = create_random_pointings(center, 1000, 10)
scene = QubicScene(nside, kind='I')

# acquisition model
acq = QubicAcquisition(150, sampling, scene)
hit = acq.get_hitmap()

# Produce the Time-Ordered data
tod = acq.get_observation(input_map)
output_map, coverage = tod2map_all(acq, tod)

print acq.comm.rank, output_map[coverage > 0][:5]
print acq.comm.rank, hit[hit > 0][:10]