Example #1
0
from fslens.sims import sims,sims_generic

lib_dir = './temp/test_ffs13'
prefix = 'ffs13'
sN_uKamin = 35.
HD_res = 13
LD_res = 13
nsims = 100
Beam_FWHM_amin =  5.

lmax_cl = 10000
base_path = './inputs/planck_lensing_wp_highL_bestFit_20130627_'
#base_path = '/Users/jcarron/SpyderProjects/jpipe/inputs/cls/base_plikHM_TT_lowTEB_lensing_'
if not os.path.exists(lib_dir):
    try : os.mkdir(lib_dir)
    except : print " ** unable to creat lib_dir ",lib_dir

cl_unl = camb.spectra_fromcambfile(base_path+'lenspotentialCls.dat',lmax = lmax_cl)['tt'][:]
cl_len = camb.spectra_fromcambfile(base_path+'lensedCls.dat',lmax = lmax_cl)['tt'][:]
cl_pp =  camb.spectra_fromcambfile(base_path+'lenspotentialCls.dat',lmax = lmax_cl)['pp'][:]

cl_noise = (sN_uKamin * np.pi / 180. / 60.) ** 2 * np.ones(30000)  # simple flat noise Cls
lib_noise = sims.ffs_Gauss_simlib(lib_dir + '/noise', cl_noise, LD_res, nsims_max = nsims)
lib_cmb_unl = sims.ffs_Gauss_simlib(lib_dir + '/cmb_unl', cl_unl, HD_res, nsims_max = nsims)
lib_pp = sims.ffs_Gauss_simlib(lib_dir + '/pp', cl_pp, HD_res, nsims_max = nsims)
lib_OO = None
lib_displ = sims.ffs_displ_2dsim(lib_pp, lib_OO, lib_dir=lib_dir + '/displ', cache_sims = True)
lib_cmb_len = sims.lencmb_sim_lib(lib_cmb_unl, lib_displ, lib_dir =lib_dir + '/cmb_len', cache_sims=True)  # Library for lensed CMB
lib_sim = sims.ffs_sim_lib(lib_cmb_len,lib_noise,Beam_FWHM_amin, mask_map = None, cache_sims=True, lib_dir=lib_dir + '/ffs_sim')

base_libs = [lib_noise,lib_pp,lib_cmb_unl,lib_OO]
Example #2
0
cl_noise = (sN_uKamin * np.pi / 180. / 60.) ** 2 * np.ones(30000)  # simple flat noise Cls

bins_l = np.int64(np.linspace(10.,3000,100))
bins_u = bins_l[1:] -1
bins_l = bins_l[0:len(bins_l)-1]
binner = jc_utils.binner(bins_l,bins_u)
del bins_l,bins_u


path_to_libs = '/Users/jcarron/data/flatsky_lens_simlibs/test_wPL2015' if path_to_libs is None else path_to_libs
path_to_figs = path_to_libs + '/figs'

if not os.path.exists(path_to_libs) :os.mkdir(path_to_libs)
if not os.path.exists(path_to_figs) :os.mkdir(path_to_figs)

lib_noise = sims.ffs_Gauss_simlib(path_to_libs + '/noise', cl_noise, HD_res, nsims_max = nsims)
lib_cmb_unl = sims.ffs_Gauss_simlib(path_to_libs + '/unl_cmb', cl_unl, HD_res, nsims_max = nsims)
lib_pp = sims.ffs_Gauss_simlib(path_to_libs + '/pp', cl_pp, HD_res, nsims_max = nsims)
lib_OO = None
lib_displ = sims.ffs_displ_2dsim(lib_pp, lib_OO, lib_dir=path_to_libs + '/displ', cache_sims = True)
lib_cmb_len = sims.lencmb_sim_lib(lib_cmb_unl, lib_displ, lib_dir =path_to_libs + '/cmb_len', cache_sims=True)  # Library for lensed CMB


# Dumping params for convenience
f = open(path_to_libs+'/params.dat', 'w')
f.write('LD res,  HD res, sN_uKamin, beam_FWHM_amin, nsims\n')
f.write(str(LD_res)+'\n')
f.write(str(LD_res)+'\n')
f.write(str(np.round(sN_uKamin,2))+'\n')
f.write(str(np.round(beam_FWHM_amin,2))+'\n')
f.write(str(nsims)+'\n')