optfolder = recfolder + '/fastpm_%0.4f/wedge_kmin0.03_%s/L1024-N0256-R/thermal-%s-hex/ZA/opt_s999_h1massA_fourier_rsdpos/' % ( aa, wed, th) if nc == 256: dd = BigFileMesh(optfolder + 'datap/', 'mapp').paint() dn = BigFileMesh(optfolder + 'datan/', 'mapp').paint() else: dd = BigFileMesh(optfolder + 'datap_up/', 'mapp').paint() dn = BigFileMesh(optfolder + 'datan_up/', 'mapp').paint() dn -= dd if kk is None: kk = dd.r2c().x pd2 = FFTPower(dd, mode='2d', Nmu=Nmu).power k2, modes2, pd2 = pd2['k'], pd2['modes'], pd2['power'] pn2 = FFTPower(dn, mode='2d', Nmu=Nmu).power['power'] #Lost due to wedge wedang = mapnoise.wedge(1 / aa - 1, att=wed, angle=True) wedmu = mapnoise.wedge(1 / aa - 1, att=wed, angle=False) mask = getmask(kk, wedang, kmin=0.03) lostw = 1 - mask.sum() / mask.size #lost due to noise: noisedom = 0 k0 = 10 for ii in range(Nmu - 1): if mus[ii] < wedmu: pass else: noisedom += modes2[k0:][pn2[k0:, ii] > 2 * pd2[k0:, ii], ii].sum() lostn = noisedom / modes2.sum()
cfg = yaml.load(ymlfile) for i in cfg['basep'].keys(): locals()[i] = cfg['basep'][i] zz = 1 / aa - 1 if upsample: ncd = nc * 2 else: ncd = nc truth_pm = ParticleMesh(BoxSize=bs, Nmesh=(ncd, ncd, ncd), dtype='f8') comm = truth_pm.comm rank = comm.rank kmin, angle = cfg['mods']['kmin'], cfg['mods']['angle'] h1model = HImodels.ModelA(aa) if angle is None: angle = numpy.round( mapnoise.wedge(zz, att=cfg['mods']['wopt'], angle=True), 0) if rank == 0: print(angle) try: spread except: spread = 1. if numd <= 0: num = -1 else: num = int(bs**3 * numd) if rank == 0: print('Number of objects : ', num) objfunc = getattr(objectives, cfg['mods']['objective']) map = getattr(lab, cfg['mods']['map']) #
#cosmo = Planck15.clone(Omega_cdm = 0.2685, h = 0.6711, Omega_b = 0.049) cosmodef = {'omegam':0.309167, 'h':0.677, 'omegab':0.048} cosmo = Cosmology.from_dict(cosmodef) ######################################### #Set parameters here ## cfname = sys.argv[1] with open(cfname, 'r') as ymlfile: cfg = yaml.load(ymlfile) for i in cfg['basep'].keys(): locals()[i] = cfg['basep'][i] kmin, angle = cfg['mods']['kmin'], cfg['mods']['angle'] h1model = HImodels.ModelA(aa) zz = 1/aa-1 if angle is None: angle = numpy.round(mapnoise.wedge(zz, att=cfg['mods']['wopt'], angle=True), 0) if rank == 0: print(angle) try: spread except : spread = 1. truth_pm = ParticleMesh(BoxSize=bs, Nmesh=(nc, nc, nc), dtype='f8') comm = truth_pm.comm rank = comm.rank if numd <= 0: num = -1 else: num = int(bs**3 * numd) if rank == 0: print('Number of objects : ', num) objfunc = getattr(objectives, cfg['mods']['objective']) map = getattr(lab, cfg['mods']['map'])