# 1.  Introduction and use

Xpure works using two 'methods' :

• Classic :
• compute 1st and 2nd derivative of apodized mask, save the spins maps in .fits format
• Mll matrix construction from spins masks, save the spins maps in .fits format
• spectra estimation : generate simulations if cl model given in argument, or computes spectra from data if maps given in argument
• Optimized :
• mask spins optimization within ell binning : compute 1st and 2nd derivative of apodized mask, save the spins maps in .fits format
• Mll matrix construction for all spins masks
• spectra estimation : generate simulations if cl model given in argument, or computes spectra from data if maps given in argument

Xpure also takes a 'mode' argument :

• 0 : standard pCl (Xpol)
• 1 : Pure speudo (pure E and pure B)
• 2 : hybride (standard E, pure B)

## 1.1  Routines details

### Apodization :

The binnary 'myapodizemask' takes in argument

• the output path of the apodized mask,
• minpix (unkown parameter)
• inside (unkown parameter)

call ex :

 Intensity myapodizemask ${BINARY_MASK_I1}${APODIZED_MASK_I1} -minpix 1 -inside 1 -radius ${radius} Polar myapodizemask${BINARY_MASK_P1} ${APODIZED_MASK_P1} -minpix 1 -inside 1 -radius${radius}

### Spins :

The binnary 'scalar2spin' takes in argument a parameter file that we'll call 'param_all.par' that contains :

• nside = healpix resolution
• lmax = maximum multipole (should not exceed 2*Nside)
• window_spin0 = output.fits of 'myapodizemask'
• inverseNoise = inverse noise weighting

call ex :

 Intensity scalar2spin param_all_I11.par >& output_scalar2spinI11 Polar scalar2spin param_all_P11.par >& output_scalar2spinP11

### Optimization :

• iteration_max = ${ITERATION_MAX} • accuracy = PCG accuracy (in 1.e-10 units) • lmax = max ell • nbin = number of apodized masks • BinFile = binfile.txt (! format .txt !! ) • nside = resolution • fwhm = float : Beamwidth in arcminute • maskBinary =$mask.fits
• cell = cell.fits , input fiducial spectra : vector of length 2lmax+2, with lmax+1 for EE spectrum and lmax+1 for BB spectrum
• noise = noisemap.fits : a .fits file of resolution nside, with each pixel noise value \sigma_p^2 = (\sigma_n /60/180)^2 for a noise level of \sigma_n [\mu K.arcmin] . Does not depend on nside ! refer to next section for inhomogeneous noise.

call ex . :

• notes :
• Too many proc can crash the PCG
• too closed bins (small \Delta \ell ) can induce PCG crash (observed on 1% sky patch)
• some noise maps can induce PCG crash. Advice : slightly change the value of the noise map. Exemple with bicep (1% sky patch): 14.14 muK.acmin does work, but 14.0muK.acmin does.

### Mll' matrix :

The binnary 'x2pure_create_mll' takes in argument a parameter file that we'll call 'createMll.par' that contains :

• nside = healpix resolution
• lmax = maximum multipole (should not exceed 2*Nside) it is very likely that too low lmax can cause spectrum bias due to bad mll construction when using x2pure routine with optimized spins masks !
• nmask = number of apodized masks used to build the Mll
• maskfile${i}_T =${output_spin0_I1}_bin${i}.fits • maskfile${i}_E_spin0 = ${output_spin0_P1}_bin${i}.fits
• maskfile${i}_E_spin1 =${output_spin1_P1}_bin${i}.fits • maskfile${i}_E_spin2 = ${output_spin2_P1}_bin${i}.fits
• maskfile${i}_B_spin0 =${output_spin0_P1}_bin${i}.fits • maskfile${i}_B_spin1 = ${output_spin1_P1}_bin${i}.fits
• maskfile${i}_B_spin2 =${output_spin2_P1}_bin${i}.fits • mllfile_TT_TT_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_TT_TT_BinMask${i}.fits • mllfile_EE_EE_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEE_EE_pcg${i}.fits • mllfile_EE_BB_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEE_BB_pcg${i}.fits • mllfile_EE_EB_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEE_EB_pcg${i}.fits • mllfile_BB_BB_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinBB_BB_pcg${i}.fits • mllfile_BB_EE_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinBB_EE_pcg${i}.fits • mllfile_BB_EB_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinBB_EB_pcg${i}.fits • mllfile_TE_TE_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinTE_TE_pcg${i}.fits • mllfile_TE_TB_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinTE_TB_pcg${i}.fits • mllfile_TB_TE_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinTB_TE_pcg${i}.fits • mllfile_TB_TB_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinTB_TB_pcg${i}.fits • mllfile_EB_EB_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEB_EB_pcg${i}.fits • mllfile_EB_EE_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEB_EE_pcg${i}.fits • mllfile_EB_BB_${i} = ${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEB_BB_pcg${i}.fits • Note : • each mask/mll are labeled with a number 'i' corresponding to the apodizaed mask number used. • Numbers of proc must be a multiple of to number of optimized masks. (to be verifyed) call ex :  x2pure_create_mll createMll.par ### Spectra estimation The binnary 'x2pure' takes in argument a parameter file that we'll call 'xpure.par' that contains : • nside = healpix resolution • nmaps = number of maps (=2 if cross-correlation). • nmask = number of apodized masks used to build the Mll • inpCellfile = input spectra for simulation (not needed if data maps provided). internal simualtions spectra are biased downard. Use external CMB maps. Noise can be added to CMB maps in x2pure using the • inpBellfile = spectra beam.fits for simulations generated internally • bellfile${j} = spectra beam.fits of map j
• mapfile${j} = mapj.fits • lmax = lmax binning ? it is very likely that too low lmax can cause spectrum bias due to bad mll construction when using x2pure routine with optimized spins masks. • lmaxSim = lmax used in simulation ? it is very likely that too low lmax can cause spectrum bias due to bad mll construction when using x2pure routine with optimized spins masks. • maskfile${i}_T = ${output_spin0_I1}_bin${i}.fits
• maskfile${i}_E_spin0 =${output_spin0_P1}_bin${i}.fits • maskfile${i}_E_spin1 = ${output_spin1_P1}_bin${i}.fits
• maskfile${i}_E_spin2 =${output_spin2_P1}_bin${i}.fits • maskfile${i}_B_spin0 = ${output_spin0_P1}_bin${i}.fits
• maskfile${i}_B_spin1 =${output_spin1_P1}_bin${i}.fits • maskfile${i}_B_spin2 = ${output_spin2_P1}_bin${i}.fits
• mllfile_TT_TT_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_TT_TT_BinMask${i}.fits
• mllfile_EE_EE_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEE_EE_pcg${i}.fits
• mllfile_EE_BB_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEE_BB_pcg${i}.fits
• mllfile_EE_EB_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEE_EB_pcg${i}.fits
• mllfile_BB_BB_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinBB_BB_pcg${i}.fits
• mllfile_BB_EE_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinBB_EE_pcg${i}.fits
• mllfile_BB_EB_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinBB_EB_pcg${i}.fits
• mllfile_TE_TE_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinTE_TE_pcg${i}.fits
• mllfile_TE_TB_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinTE_TB_pcg${i}.fits
• mllfile_TB_TE_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinTB_TE_pcg${i}.fits
• mllfile_TB_TB_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinTB_TB_pcg${i}.fits
• mllfile_EB_EB_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEB_EB_pcg${i}.fits
• mllfile_EB_EE_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEB_EE_pcg${i}.fits
• mllfile_EB_BB_${i} =${OUTPUTMLL}/mll_ns${NSIDE_USER}_spinEB_BB_pcg${i}.fits
• noise_biasT_1 = noise bias temperatur = pixel temperature noise \sigma_t = sigmaT1
• noise_biasT_2_2 = noise bias cross ? Not tested yet
• noise_biasT_1_2 = Not tested yet
• noise_biasP_1 = noise bias polar = pixel polar noise \sigma_p = \sigma_t * \sqrt 2 = sigmaP1
• noise_biasP_2_2 = noise bias cross ? Not tested yet
• noise_biasP_1_2 = Not tested yet
• sigmaT1 = pixel temperature noise for map 1 \sigma_T (sigmaT2 for map 2, etc... )
• sigmaP1 = pixel polarization noise \sigma_P = \sigma_T * \sqrt 2 \$}, (sigmaP2 for map 2, etc... )
• nhitfileT : nhit file for inhomogeneous noise refer to next section for explanations
• nhitfileP : nhit file for inhomogeneous noise refer to next section for explanations
• bintab = binning.fits (ex: [2,10,50, 100] will compute spectra between 2 and 10, then between 10 and 50, and 50 to 100, then 100 to lmax.
• mask_list = masklist.fits , array that maps which spectra bin must be computed with which apodized mask. Ex : [1,1,2,3] will use the first apodized mask for the two first bin, then the second mask for the third bin, and finally the third mask for the last bin. Caution. X2pure will compute the power spectrum if masklist.fits is wrongly build (bad lmax, wrong number of bins, etc...).

call ex :

 x2pure xpure.par
• notes :
• Too much jobs proc can bias the reconstructed spectra !
• Numbers of proc must be a multiple of the number of optimized masks. (ex. for 6 masks, use 30 proc per call).
• Simulated spectra from input inpCellfile are sistematically biased in x2pure. Solution : use external maps (generated via healpy/pix). In that case, one must compute spectra up to the lmax used for cmb generated maps (synfast(lmax=...)). Beams and pixwindow are assumed in x2pure => external CMB maps must be generated using the same beams and pixwindow as the input given to x2pure.

### Using inhomogeneous noise :

For a given noise level \sigma_n [\mu K\cdot arcmin] , we have a mean pixel variance of \displaystyle \sigma_0^2 = \frac 1 A \frac{\sigma_n^2}{60^2} , with A the pixel area. Let n_i be the map of number of hits per pixel, and V_i the weighted noise variance map. We have \displaystyle V_i = \frac{\sigma_0^2}{ n_i} \frac{\sum_j n_j}{n_{pix}} = \frac{\sigma_0^2}{ n_i / <n_i>} .

• PCG :
• For homogeneous noise, the noise variance maps given to the PCG is \sigma_p^2 = (\sigma_n /60/180)^2 for a noise level of \sigma_n [\mu K.arcmin] . It does not depends on nside.
• For inhomogeneous noise, the new noise variance maps must be written \displaystyle \frac{\sigma_p^2}{ n_i / <n_i>}
• x2pure :
• For inhomogeneous noise, the input value for sigmaP and sigmaT can remain the same, and hitfileT and hitfileP are thus given by n_i / <n_i> . X2pure will compute the masp using a vairance map \displaystyle V_i = \frac{\sigma_P^2}{n_i / <n_i>} , with \sigma_P = \sigma_0 .