def snr(cmbspec, beam, noise,fsky=0.1, kind='default', A_CB=1., nu=30., B=1., H_I=1., f_a=1., dl=10, n=512, nwanted=400): L = np.arange(5,nwanted)*dl Nlaa = ro.GimmeNl(cmbspec,beam,noise,dl = dl,n=n,nwanted = nwanted)[1] Nlaa = Nlaa[5:len(Nlaa)] if kind == 'default': claa = np.nan_to_num(A_CB*1e-5*2*np.pi/L/(L+1)) elif (kind == 'pmf') or (kind == 'PMF'): claa = np.nan_to_num(2.3e-5 * (30./nu)**4 * B**2 * 2*np.pi/L/(L+1)) elif (kind == 'pseudoscalar') or (kind == 'CS'): claa = np.nan_to_num((H_I/2/np.pi/f_a)**2 * 2*np.pi/L/(L+1)) del_claa = np.sqrt(2./((2.*L+1)*fsky*dl))*(claa+Nlaa) return np.sqrt(np.sum((claa/del_claa)**2))
eepowerspec2d = np.interp(lgrid, np.arange(cmbspec.shape[0]), clee) ell = np.arange(cmbspec.shape[0]) #embed() aapowerspec2d = np.interp(lgrid, L, claa) clrot = ro.ClBB_rot(eepowerspec2d, aapowerspec2d, dl, n, nwanted) clrot=clrot[2:nwanted] return L, clrot ell, Nl = ro.GimmeNl(cmbspec,fwhm,noice,dl=10, nwanted = 21) claa = [] clBBrot = [] del_clbb = [] clbblens = cmbspec[:,2][20:210:10] nlbb = ro.nl_cmb(noice,fwhm)[20:210:10] clbbr = cmbspec_r[20:210:10] summand_clbblens = clbblens[0:19] summand_nlbb = nlbb[0:19] summand_clbbr = clbbr[0:19] r_eff = [] for i in range(1000): sigclaa=delclaa(Nl,fsky,10,ell) mu = 0.0 #embed()
else: test = np.array(array.flat) len_test = len(test) hope = np.zeros(len_test) hope[i] = i new_hope = hope.reshape(len_x, len_y, len_z) ind = np.argwhere(new_hope)[0] x, y, z = ind[0], ind[1], ind[2] return x, y, z fsky = 0.5 noice = 9.8 fwhm = 1.3 Nlaa_ell, Nlaa = ro.GimmeNl(cmbspec, fwhm, noice, dl=10, nwanted=501) Nlaa_del10 = Nlaa[2:100] Nlaa_del100 = Nlaa[100::10] Nlaa_ells_del10 = Nlaa_ell[2:100] Nlaa_ells_del100 = Nlaa_ell[100::10] clbblens = Cl_BB[20:4991:10] nlbb = ro.nl_cmb(noice, fwhm)[20:4991:10] clbblens_ell = np.arange(0, 5001) clbblens_ell = clbblens_ell[20:4991:10] MC_ell = np.arange(2, 5001) MC_ells = MC_ell[18:4991:10] #sig_claa1 = delclaa(Nlaa,fsky,10.,Nlaa_ells) sig_clbb = delclbb(nlbb, clbblens, fsky, 10., clbblens_ell) beta = np.arange(6, 17.1)
nl1 = nl_cmb(3.4, 30) nl2 = nl_cmb(11.8, 3.5) nl3 = nl_cmb(4.5, 1.1) nl_tot = ((1. / (nl0)) + (1. / (nl2)) + (1. / (nl3)))**(-1) #def GimmeClBBRot(cmbspec, kind='default', A_CB=1., nu=30., B=1., H_I=1., f_a=1., dl=8, n=512, nwanted=200): l_rot, ClBBrot = ro.GimmeClBBRot(cmbspec) #def GimmeClBBRes(cmbspec, beam, noise, lnlpp=None, nlpp=None, dl=8, n=512, nwanted=200): l_a0, ClBBares0 = ro.GimmeClBBRes(cmbspec, 1.3, 9.8) l_a1, ClBBares1 = ro.GimmeClBBRes(cmbspec, 30.0, 3.4) l_a2, ClBBares2 = ro.GimmeClBBRes(cmbspec, 3.5, 11.8) l_a3, ClBBares3 = ro.GimmeClBBRes(cmbspec, 1.1, 4.5) #GimmeNl(cmbspec, beam, noise, est='EB', dl=8, n=512, nwanted=200, f_delens=0., lmax_delens=5000, lknee=None, alpha=None): ell, Nl_aa0 = ro.GimmeNl(cmbspec, 1.3, 9.8) ell, Nl_aa1 = ro.GimmeNl(cmbspec, 30, 3.4) ell, Nl_aa2 = ro.GimmeNl(cmbspec, 3.5, 11.8) ell, Nl_aa3 = ro.GimmeNl(cmbspec, 1.1, 4.5) nlaa_tot = np.nan_to_num( ((1. / (Nl_aa0[1:])) + (1. / (Nl_aa2[1:])) + (1. / (Nl_aa3[1:])))**(-1)) #lensing stuff #loading Nl^PP from lensing stuff N_lens = np.loadtxt('mynoise.dat') l = N_lens[:, 0] Nlens = N_lens[:, 1] N_lens1 = np.loadtxt('mynoise1.dat') l1 = N_lens1[:, 0]
def nl_AA(cmbspec, beam, noise, dl=10,n=512,nwanted=400): L = np.arange(5,nwanted)*dl Nlaa = ro.GimmeNl(cmbspec,beam,noise,dl = dl,n=512,nwanted = nwanted)[1] Nlaa = Nlaa[5:len(Nlaa)] return L, Nlaa