def get_lens_result(res=1.,lmax=400,dtype=np.float64,seed=1): shape,wcs = enmap.fullsky_geometry(res=np.deg2rad(res)) shape = (3,) + shape # ells = np.arange(lmax) ps_cmb,ps_lens = powspec.read_camb_scalar(DATA_PREFIX+"test_scalCls.dat") ps_lensinput = np.zeros((4,4,ps_cmb.shape[-1])) ps_lensinput[0,0] = ps_lens ps_lensinput[1:,1:] = ps_cmb lensed = lensing.rand_map(shape, wcs, ps_lensinput, lmax=lmax, maplmax=None, dtype=dtype, seed=seed, phi_seed=None, oversample=2.0, spin=[0,2], output="lu", geodesic=True, verbose=False, delta_theta=None) return lensed
# Make a full-sky enlib geometry in CAR pfile = camb_root + "_lenspotentialCls.dat" ps = powspec.read_camb_full_lens(pfile).astype(dtype) cache_loc = "/gpfs01/astro/workarea/msyriac/data/depot/falafel/" try: assert cache Xmap = enmap.read_map("%slensed_map_seed_%d.fits" % (cache_loc, seed)) ikappa = enmap.read_map("%skappa_map_seed_%d.fits" % (cache_loc, seed)) print("Loaded cached maps...") except: print("Making random lensed map...") with bench.show("lensing"): Xmap, ikappa, = enlensing.rand_map(shape[-2:], wcs, ps, lmax=mlmax, dtype=dtype, output="lk", seed=seed) if cache: enmap.write_map("%slensed_map_seed_%d.fits" % (cache_loc, seed), Xmap) enmap.write_map("%skappa_map_seed_%d.fits" % (cache_loc, seed), ikappa) print("Maps have been cached.") else: print("Loading lensed map...") sim_location = "/gpfs01/astro/workarea/msyriac/data/sims/dw/" Xmap = enmap.read_map(sim_location + "fullskyLensedMapUnaberrated_T_00001.fits")
for j, task in enumerate(my_tasks): # Get CMB and Phi seeds cmb_set, phi_set, iii = jobs[task] cmb_seed = seedgen.get_cmb_seed(cmb_set, iii) phi_seed = seedgen.get_phi_seed(phi_set, iii) logging.info( f'rank {rank}, task {task}, doing cmb_set {cmb_set}, phi_set {phi_set}, iteration {iii}' ) # Make lensed map with bench.mark("lensing"): l_tqu_map, = lensing.rand_map((3, ) + shape, wcs, ps, lmax=args.lmax, output="l", phi_seed=phi_seed, seed=cmb_seed, verbose=(True if rank == 0 else False)) if rank == 0: logging.info(f'BENCH:\n{bench.stats}') map_list = [l_tqu_map] map_name_list = ['fullskyLensedUnaberratedCMB'] if not (args.skip_aberration): if rank == 0: logging.info('doing aberration') #Note - we are aberrating and not modulating! The #modulation is a frequency-dependent, so is done
start = time.time() for cmbSet in range(p['START_SET'], p['STOP_SET']): for iii in range(iMin, iMax): print('rank', rank, 'doing cmbSet', cmbSet, 'iii' , iii, \ ', iMin', iMin, ', iMax', iMax, 'calling lensing.rand_map', time.time() - start) #Turn this off for now as the interpol routine is not compiling for me ATM phiSeed = seedgen.get_phi_seed(iii) cmbSeed = seedgen.get_cmb_seed(cmbSet, iii) uTquMap, lTquMap, pMap = lensing.rand_map((3, ) + shape, wcs, ps, lmax=p['LMAX'], output="ulp", verbose=True, phi_seed=phiSeed, seed=cmbSeed) mapList = [uTquMap, lTquMap, pMap] mapNameList = ['fullskyUnlensedCMB', 'fullskyLensedCMB', 'fullskyPhi'] if False: print( 'temporarily doing a gaussian random field -- lensed = unlensed' ) print('calling curvedsky.rand_map') uTquMap = curvedsky.rand_map((3, ) + shape, wcs,
from pixell import enmap, lensing, curvedsky as cs, utils import numpy as np import os, sys from enlib import bench shape, wcs = enmap.fullsky_geometry(res=1.0 * utils.arcmin) lmax = 8000 theory = cosmology.default_theory() ps = cosmology.enmap_power_from_orphics_theory(theory, lensed=False) with bench.show('lens'): uTquMap, lTquMap, pMap = lensing.rand_map((3, ) + shape, wcs, ps, lmax=lmax, output="ulp", verbose=True, phi_seed=0, seed=0, dtype=np.float32, delta_theta=60 * utils.degree) """ dtheta = 10 deg : 273 s , 21 GB dtheta = 20 deg : 271 s , 22 GB dtheta = 40 deg : 268 s , 26 GB dtheta = 60 deg : 267 s , 28 GB OMP_NUM_THREADS=10 dtheta = 10 deg : dtheta = 20 deg : 364 s , 13 GB dtheta = 40 deg : dtheta = 60 deg : 357 s , 20 GB