def Forecast_Cellyy(self, ellBinEdges, fsky, constraint='None'): ellMids = old_div((ellBinEdges[1:] + ellBinEdges[:-1]), 2) cls_tsz = self.fgs.tSZ(self.evalells,self.freq[0],self.freq[0]) / self.cc.c['TCMBmuK']**2. \ / ((self.evalells+1.)*self.evalells) * 2.* np.pi cls_yy = old_div(cls_tsz, (f_nu(self.cc.c, self.freq[0]))**2) # Normalized to get Cell^yy LF = LensForecast() if (constraint == 'None'): LF.loadGenericCls("yy", self.evalells, cls_yy, self.evalells, self.N_ll_tsz) elif (constraint == 'cmb'): LF.loadGenericCls("yy", self.evalells, cls_yy, self.evalells, self.N_ll_tsz_c_cmb) elif (constraint == 'cib'): LF.loadGenericCls("yy", self.evalells, cls_yy, self.evalells, self.N_ll_tsz_c_cib) else: return "Wrong option" sn, errs = LF.sn(ellBinEdges, fsky, "yy") # not squared cls_out = np.interp(ellMids, self.evalells, cls_yy) return ellMids, cls_out, errs, sn
def Forecast_CellrsxEE(self, ellBinEdges, fsky, option='None'): ellMids = old_div((ellBinEdges[1:] + ellBinEdges[:-1]), 2) cls_rsxEE = self.fgs.rs_crossEE( self.evalells, self.fgs.nu_rs) / self.cc.c['TCMBmuK']**2. / ( (self.evalells + 1.) * self.evalells) * 2. * np.pi LF = LensForecast() if (option == 'None'): LF.loadGenericCls("ee", self.evalells, cls_rsxEE, self.evalells, self.N_ll_rsxEE) elif (option == 'NoILC'): LF.loadGenericCls("ee", self.evalells, cls_rsxEE, self.evalells, self.N_ll_rsx_NoFG) elif (option == 'Onlyfg'): LF.loadGenericCls("ee", self.evalells, cls_rsxEE, self.evalells, self.N_ll_rsxEE - self.N_ll_rsx_NoFG) else: return "Wrong option" sn, errs = LF.sn(ellBinEdges, fsky, "ee") # not squared cls_out = np.interp(ellMids, self.evalells, cls_rsxEE) return ellMids, cls_out, errs, sn
def Forecast_Cellrsx(self, ellBinEdges, fsky, option='None'): ellMids = old_div((ellBinEdges[1:] + ellBinEdges[:-1]), 2) cls_rsx = self.fgs.rs_cross(self.evalells,self.freq[0]) / self.cc.c['TCMBmuK']**2. \ / ((self.evalells+1.)*self.evalells) * 2.* np.pi cls_rsx = old_div(cls_rsx, (self.fgs.rs_nu( self.freq[0]))) # Normalized to get Cell^rsrs fiducial LF = LensForecast() if (option == 'None'): LF.loadGenericCls("rr", self.evalells, cls_rsx, self.evalells, self.N_ll_rsx) elif (option == 'NoILC'): LF.loadGenericCls("rr", self.evalells, cls_rsx, self.evalells, self.N_ll_noILC) else: return "Wrong option" sn, errs = LF.sn(ellBinEdges, fsky, "rr") # not squared cls_out = np.interp(ellMids, self.evalells, cls_rsx) return ellMids, cls_out, errs, sn
def Forecast_Cellcmb(self,ellBinEdges,fsky,constraint='None'): ellMids = old_div((ellBinEdges[1:] + ellBinEdges[:-1]), 2) cls_cmb = self.cc.clttfunc(self.evalells) LF = LensForecast() if (constraint=='None'): LF.loadGenericCls("tt",self.evalells,cls_cmb,self.evalells,self.N_ll_cmb) elif (constraint=='tsz'): LF.loadGenericCls("tt",self.evalells,cls_cmb,self.evalells,self.N_ll_cmb_c_tsz) else: return "Wrong option" sn,errs = LF.sn(ellBinEdges,fsky,"tt") # not squared cls_out = np.interp(ellMids,self.evalells,cls_cmb) return ellMids,cls_out,errs,sn
def Forecast_CellrsxEE(self,ellBinEdges,fsky,option='None'): ellMids = old_div((ellBinEdges[1:] + ellBinEdges[:-1]), 2) cls_rsxEE = self.fgs.rs_crossEE(self.evalells,self.fgs.nu_rs)/self.cc.c['TCMBmuK']**2./((self.evalells+1.)*self.evalells) * 2.* np.pi cls_rs = self.fgs.rs_auto(self.evalells,self.fgs.nu_rs,self.fgs.nu_rs) / self.cc.c['TCMBmuK']**2.\ / ((self.evalells+1.)*self.evalells) * 2.* np.pi cls_cmbEE = self.cc.cleefunc(self.evalells) LF = LensForecast() if (option=='None'): LF.loadGenericCls("rr",self.evalells,cls_rs,self.evalells,self.N_ll_rsxEE_c_cmb)#self.N_ll_rsxEE) LF.loadGenericCls("xx",self.evalells,cls_rsxEE,self.evalells,self.N_ll_rsx*0.0) LF.loadGenericCls("ee",self.evalells,cls_cmbEE,self.evalells,self.N_ll_rsxEE_c_rs)#self.N_ll_cmb) Nellrs = self.N_ll_rsxEE_c_cmb NellcmbEE = self.N_ll_rsxEE_c_rs elif (option=='NoILC'): LF.loadGenericCls("rr",self.evalells,cls_rs,self.evalells,self.N_ll_rsxEE_NoFG) LF.loadGenericCls("xx",self.evalells,cls_rsxEE,self.evalells,self.N_ll_rsx*0.0) LF.loadGenericCls("ee",self.evalells,cls_cmbEE,self.evalells,self.N_ll_cmbee_NoFG) Nellrs = self.N_ll_rsxEE_NoFG NellcmbEE = self.N_ll_cmbee_NoFG else: return "Wrong option" sn2=(2.*self.evalells+1.)*np.nan_to_num((cls_rsxEE**2)/((cls_rs+Nellrs)*(cls_cmbEE+NellcmbEE)+(cls_rsxEE)**2))#**2)#)/(cls_cmbEE+NellcmbEE)) snsq=fsky/2.*sum(sn2) sn=np.sqrt(snsq) cls_out = np.interp(ellMids,self.evalells,cls_rsxEE) ellMids = (ellBinEdges[1:] + ellBinEdges[:-1]) / 2 ellWidths = np.diff(ellBinEdges) covs = [] for ell_left,ell_right in zip(ellBinEdges[:-1],ellBinEdges[1:]): ClSum = LF._bin_cls("rr",ell_left,ell_right)*LF._bin_cls("ee",ell_left,ell_right)+(LF._bin_cls("xx",ell_left,ell_right))**2 ellMid = (ell_right+ell_left)/2. ellWidth = ell_right-ell_left var = ClSum/(2.*ellMid+1.)/ellWidth/fsky covs.append(var) #print(LF._bin_cls("xx",ell_left,ell_right)) errs=np.sqrt(np.array(covs)) return ellMids,cls_out,errs,sn
def Forecast_Cellrsx(self,ellBinEdges,fsky,option='None'): ellMids = (ellBinEdges[1:] + ellBinEdges[:-1])/ 2. cls_rsx = self.fgs.rs_cross(self.evalells,self.fgs.nu_rs) / self.cc.c['TCMBmuK']**2.\ / ((self.evalells+1.)*self.evalells) * 2.* np.pi cls_rs = self.fgs.rs_auto(self.evalells,self.fgs.nu_rs,self.fgs.nu_rs) / self.cc.c['TCMBmuK']**2.\ / ((self.evalells+1.)*self.evalells) * 2.* np.pi cls_cmb = self.cc.clttfunc(self.evalells) LF = LensForecast() if (option=='None'): LF.loadGenericCls("rr",self.evalells,cls_rs,self.evalells,self.N_ll_rs_c_cmb)#self.N_ll_rsx) LF.loadGenericCls("xx",self.evalells,cls_rsx,self.evalells,self.N_ll_rsx*0.0) LF.loadGenericCls("tt",self.evalells,cls_cmb,self.evalells,self.N_ll_cmb_c_rs)#self.N_ll_cmb) Nellrs = self.N_ll_rs_c_cmb #self.N_ll_rsx Nellcmb = self.N_ll_cmb_c_rs #self.N_ll_cmb elif (option=='NoILC'): LF.loadGenericCls("rr",self.evalells,cls_rs,self.evalells,self.N_ll_rsx_NoFG) LF.loadGenericCls("xx",self.evalells,cls_rsx,self.evalells,self.N_ll_rsx*0.0) LF.loadGenericCls("tt",self.evalells,cls_cmb,self.evalells,self.N_ll_cmb_NoFG) Nellrs = self.N_ll_rsx_NoFG Nellcmb = self.N_ll_cmb_NoFG else: return "Wrong option" sn2=(2.*self.evalells+1.)*np.nan_to_num((cls_rsx**2)/((cls_rs+Nellrs)*(cls_cmb+Nellcmb)+(cls_rsx)**2)) snsq=fsky/2.*sum(sn2) sn=np.sqrt(snsq) cls_out = np.interp(ellMids,self.evalells,cls_rsx) #errs = cls_out * 0.0 + 1. ellMids = (ellBinEdges[1:] + ellBinEdges[:-1]) / 2 ellWidths = np.diff(ellBinEdges) covs = [] for ell_left,ell_right in zip(ellBinEdges[:-1],ellBinEdges[1:]): ClSum = LF._bin_cls("rr",ell_left,ell_right)*LF._bin_cls("tt",ell_left,ell_right)+(LF._bin_cls("xx",ell_left,ell_right))**2 ellMid = (ell_right+ell_left)/2. ellWidth = ell_right-ell_left var = ClSum/(2.*ellMid+1.)/ellWidth/fsky covs.append(var) errs=np.sqrt(np.array(covs)) ''' ellMids = (ellBinEdges[1:] + ellBinEdges[:-1])/ 2. ellWidth = (ellBinEdges[1:] - ellBinEdges[:-1]) #cls_rsx = self.fgs.rs_cross(self.evalells,self.freq[0]) / self.cc.c['TCMBmuK']**2.\ # / ((self.evalells+1.)*self.evalells) * 2.* np.pi #print (cls_rsx, self.freq[0],self.fgs.nu_rs) cls_rsx = self.fgs.rs_cross(self.evalells,self.fgs.nu_rs) / self.cc.c['TCMBmuK']**2.\ / ((self.evalells+1.)*self.evalells) * 2.* np.pi cls_rs = self.fgs.rs_auto(self.evalells,self.fgs.nu_rs,self.fgs.nu_rs) / self.cc.c['TCMBmuK']**2.\ / ((self.evalells+1.)*self.evalells) * 2.* np.pi cls_cmb = self.cc.clttfunc(self.evalells) print (cls_rsx,cls_rs, cls_cmb) LF = LensForecast() if (option=='None'): LF.loadGenericCls("rr",self.evalells,cls_rsx,self.evalells,self.N_ll_rsx) #LF.loadGenericCls("tt",self.evalells,cls_cmb,self.evalells,self.N_ll_cmb) Nellrsx = self.N_ll_rs_c_cmb #self.N_ll_rsx Nellcmb = self.N_ll_cmb_c_rs #self.N_ll_cmb elif (option=='NoILC'): LF.loadGenericCls("rr",self.evalells,cls_rsx,self.evalells,self.N_ll_rsx_NoFG) #LF.loadGenericCls("tt",self.evalells,cls_cmb,self.evalells,self.N_ll_rsx_NoFG) Nellrsx = self.N_ll_rsx_NoFG Nellcmb = self.N_ll_cmb_NoFG else: return "Wrong option" print (Nellrsx,Nellcmb) #vars, _, _ = LF.KnoxCov("rr","tt",ellBinEdges,fsky) #sn,errs = LF.sn(ellBinEdges,fsky,"rr") # not squared ind = np.isfinite(Nellrsx) sn = np.sqrt ( fsky / 2 * np.sum( (2.*self.evalells[ind] + 1) * (cls_rsx[ind]**2) / ((cls_rs[ind] + Nellrsx[ind])* (cls_cmb[ind] + Nellcmb[ind])) ) ) errs = 1.#np.sqrt(vars) cls_out = np.interp(ellMids,self.evalells,cls_rsx) #errs = cls_out * 0.0 + 1. return ellMids,cls_out,errs,sn ''' return ellMids,cls_out,errs,sn
ind = paramList.index(param) Fisher[ind,ind] += 1./priorSigma**2. # get index of mnu and print marginalized constraint indMnu = paramList.index('mnu') mnu = np.sqrt(np.linalg.inv(Fisher)[indMnu,indMnu])*1000. cprint("Sum of neutrino masses 1-sigma: "+ str(mnu) + " meV",color="green",bold=True) mnus.append(mnu) # CLKK S/N ============================================ # Calculate Clkk S/N Clkk = fidCls[:,4] frange = np.array(range(len(Clkk))) snrange = np.arange(kellmin,kellmax) LF = LensForecast() LF.loadKK(frange,Clkk,ls,Nls) sn,errs = LF.sn(snrange,fsky,"kk") cprint("Lensing autopower S/N: "+ str(sn),color="green",bold=True) # pl = Plotter(scaleY='log',xscale='log') # pl.add(frange,Clkk) # pl.add(ls,Nls) # pl._ax.set_ylim(-max(Clkk),max(Clkk)) # pl.done("clkk.png") sns.append(sn) # r Forecast ============================================