示例#1
0
import numpy as np
import matplotlib.pyplot as mp
from qubic import (create_random_pointings, gal2equ,
                  read_spectra,
                  compute_freq,
                  QubicScene,
                  QubicMultibandInstrument,
                  QubicPolyAcquisition,
                  PlanckAcquisition,
                  QubicPlanckAcquisition,
                  QubicPolyPlanckAcquisition)

nside = 256
# Observe a patch at the galactic north pole
center_gal = 0, 90
center = gal2equ(center_gal[0], center_gal[1])

band = 150
tol = 1e-4

# Compute frequencies at which we sample the TOD.
# As input we set 150 [GHz] - the central frequency of the band and
# the relative bandwidth -- 0.25.
# The bandwidth is assumed to be uniform.
# The number of frequencies is set by an optional parameter Nfreq, 
# which is, by default, 15 for 150 GHz band
# and 20 for 220 GHz band.
Nbfreq, nus_edge, nus, deltas, Delta, Nbbands = compute_freq(band, 0.25)

# Use random pointings for the test
p = create_random_pointings(center, 1000, 10)
from __future__ import division
from qubic import (
    create_random_pointings, gal2equ, QubicAcquisition, QubicScene,
    tod2map_all)
import healpy as hp
import matplotlib.pyplot as mp
import numpy as np
import qubic

# 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

示例#3
0
qubicinst = QubicInstrument('monochromatic',nside=nside)
detectors=qubicinst.detector.packed
mp.clf()
mp.plot(detectors.center[:,0], detectors.center[:,1],'ro')

################# random pointings ##########################################
racenter = 0.0
deccenter = -57.0
center = equ2gal(racenter, deccenter)

################## new way of making the MC
nsmap = 16
thgal, phgal = hp.pix2ang(nsmap, np.arange(12 * nsmap**2))
llgal = np.degrees(phgal) - 180
bbgal = 90 - np.degrees(thgal)
ra, dec = gal2equ(llgal, bbgal)

mp.clf()
mp.subplot(211, projection='mollweide')
mp.plot(np.radians(llgal),np.radians(bbgal), '.')
mp.title('Galactic')
mp.subplot(212, projection='mollweide')
mp.plot(np.radians(ra-180), np.radians(dec), '.')
mp.title('Equatorial')

#### create pointings at the center of each healpix pixel
npointings = 12 * nsmap**2
initpointing = create_random_pointings([ra[0], dec[0]], npointings, 0.001)
bar = progress_bar(npointings)
for i in np.arange(npointings):
    bla = create_random_pointings([ra[i], dec[i]], 2, 0.01)
示例#4
0
outpath = ''


def setup():
    global outpath
    outpath = 'test-' + str(uuid1())[:8]
    os.mkdir(outpath)


def teardown():
    shutil.rmtree(outpath)

input_map = read_map(qubic.data.PATH + 'syn256_pol.fits')
np.random.seed(0)
center = gal2equ(0, 90)
sampling = create_random_pointings(center, 100, 10)

ptg = [1., 0, 180]
ptg2 = [1., 1, 180]
pta = np.asarray(ptg)
pta2 = np.asarray(ptg2)
ptgs = ptg, [ptg], [ptg, ptg], [[ptg, ptg], [ptg2, ptg2, ptg2]], \
       pta, [pta], [pta, pta], [[pta, pta], [pta2, pta2, pta2]], \
       np.asarray([pta]), np.asarray([pta, pta]), [np.asarray([pta, pta])], \
       [np.asarray([pta, pta]), np.asarray([pta2, pta2, pta2])]
block_n = [[1], [1], [2], [2, 3],
           [1], [1], [2], [2, 3],
           [1], [2], [2], [2, 3], [2, 3]]
caltree = QubicCalibration(detarray='CalQubic_DetArray_v1.fits')
selection = np.zeros((32, 32), dtype=bool)
d150G = d150Q.copy()
d150G['effective_duration'] = 1

#
# 220 Qubic patch
d220Q = d150Q.copy()
d220Q['filter_nu'] = 220e9
# 220 GC patch
d220G = d220Q.copy()
d150G['effective_duration'] = 1

# Qubic patch - galactic coordinates
centerQ = qubic.equ2gal(d150Q['RA_center'], d150Q['DEC_center'])
# Galactic center patch - galactic coordinates 
centerG = np.array([0,0])
d150G['RA_center'], d150G['DEC_center'] = qubic.gal2equ(centerG[0], centerG[1])
d220G['RA_center'], d220G['DEC_center'] = d150G['RA_center'], d150G['DEC_center']

centers = [centerQ, centerQ, centerG, centerG]
dictionaries = [d150Q, d220Q, d150G, d220G]

regions = ['Qubic_field', 'GalCen_field']
bands = ['150', '220']

nf_recon = d150Q['nf_recon']

print(" =========== DONE ======== ")

print("# Read coverage maps")
coveragesmaps = fsed.coverage(dictionaries, regions, bands)
示例#6
0
outpath = ''


def setup():
    global outpath
    outpath = 'test-' + str(uuid1())[:8]
    os.mkdir(outpath)


def teardown():
    shutil.rmtree(outpath)


input_map = read_map(qubic.data.PATH + 'syn256_pol.fits')
np.random.seed(0)
center = gal2equ(0, 90)
sampling = create_random_pointings(center, 100, 10)

ptg = [1., 0, 180]
ptg2 = [1., 1, 180]
pta = np.asarray(ptg)
pta2 = np.asarray(ptg2)
ptgs = ptg, [ptg], [ptg, ptg], [[ptg, ptg], [ptg2, ptg2, ptg2]], \
       pta, [pta], [pta, pta], [[pta, pta], [pta2, pta2, pta2]], \
       np.asarray([pta]), np.asarray([pta, pta]), [np.asarray([pta, pta])], \
       [np.asarray([pta, pta]), np.asarray([pta2, pta2, pta2])]
block_n = [[1], [1], [2], [2, 3], [1], [1], [2], [2, 3], [1], [2], [2], [2, 3],
           [2, 3]]
caltree = QubicCalibration(detarray='CalQubic_DetArray_v1.fits')
selection = np.zeros((32, 32), dtype=bool)
selection[30:, 30:] = True