def get_qubic_map(instrument, sampling, scene, input_maps, withplanck=True, covlim=0.1): acq = QubicAcquisition(instrument, sampling, scene, photon_noise=False) C = acq.get_convolution_peak_operator() coverage = acq.get_coverage() observed = coverage > covlim * np.max(coverage) acq_restricted = acq[:, :, observed] H = acq_restricted.get_operator() x0_convolved = C(input_maps) if not withplanck: pack = PackOperator(observed, broadcast='rightward') y_noiseless = H(pack(x0_convolved)) noise = acq.get_noise() y = y_noiseless + noise print(std(noise)) invntt = acq.get_invntt_operator() A = H.T * invntt * H b = (H.T * invntt)(y) preconditioner = DiagonalOperator(1 / coverage[observed], broadcast='rightward') solution_qubic = pcg(A, b, M=preconditioner, disp=True, tol=1e-3, maxiter=1000) maps = pack.T(solution_qubic['x']) maps[~observed] = 0 else: acq_planck = PlanckAcquisition(150, acq.scene, true_sky=x0_convolved, fix_seed=True) acq_fusion = QubicPlanckAcquisition(acq, acq_planck) map_planck_obs=acq_planck.get_observation() 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=1000, tol=1e-3) maps = solution_fusion['x'] maps[~observed] = 0 x0_convolved[~observed,:]=0 return(maps, x0_convolved, observed)
#hp.mollview(mapq) #hp.mollview(mapu) x0=np.array([mapi,mapq,mapu]).T ### Prepare input / output data nside = 64 scene = QubicScene(nside, kind='IQU') acq = QubicAcquisition(instrument, sampling, scene) C = acq.get_convolution_peak_operator() coverage = acq.get_coverage() observed = coverage > 0.1*np.max(coverage) acq_restricted = acq[:, :, observed] H = acq_restricted.get_operator() x0_convolved = C(x0) acq_planck = PlanckAcquisition(150, acq.scene, true_sky=x0_convolved, fix_seed=True, factor=1) acq_fusion = QubicPlanckAcquisition(acq, acq_planck) map_planck_obs=acq_planck.get_observation() H = acq_fusion.get_operator() invntt = acq_fusion.get_invntt_operator() A = H.T * invntt * H ### Questions # - how to have input map at 256 and reconstructed at 64 ? # - am I getting new QUBIC noise by calling twice acq_fusion.get_observation() # if not: how to do it ? # - Actually I want to make maps with 50% of the detectors rather than calling it twice # - The Planck noise will be on both maps, and will therefore remain as a bias ? # - I need to try with pure QUBIC reconstruction as well