ellin, clkszin = np.loadtxt("data/clkszkk_lmax3000.csv", delimiter=',', unpack=True) clkzfunc = interp1d(ellin, clkszin, bounds_error=False, fill_value=0.) clksz = clkzfunc(frange) clksz_bias = clksz * Clkk sigCls = fidCls.copy() * 0. sigCls[:, 4] = clksz_bias.copy() # Calculate the Fisher matrix and add to other Fishers cmbFisher = calcFisher(paramList, ellrange, fidCls, dCls, fnTT, fnEE, fnKK, fsky, verbose=True) Fisher = otherFisher + cmbFisher # Get prior sigmas and add to Fisher priorList = Config.get("fisher", "priorList").split(',') for prior, param in zip(priorList, paramList): try: priorSigma = float(prior) except ValueError: continue ind = paramList.index(param) Fisher[ind, ind] += 1. / priorSigma**2.
dCls = {} for paramName in paramList: dCls[paramName] = tryLoad(derivRoot+'_dCls_'+paramName+'.csv',',') # Get CMB noise functions and ell ranges. if (noise_func_tt is None) or (noise_func_ee is None): fnTT, fnEE = noiseFromConfig(Config,expName,TCMB=TCMB,beamsOverride=None,noisesOverride=None,lkneeTOverride=None,lkneePOverride=None,alphaTOverride=None,alphaPOverride=None) tellmin,tellmax = list_from_config(Config,expName,'tellrange') pellmin,pellmax = list_from_config(Config,expName,'pellrange') if (noise_func_tt is not None): fnTT = cosmology.noise_pad_infinity(noise_func_tt,tellmin,tellmax) if (noise_func_ee is not None): fnEE = cosmology.noise_pad_infinity(noise_func_ee,pellmin,pellmax) # Pad CMB lensing noise with infinity outside L ranges kellmin,kellmax = list_from_config(Config,'lensing','Lrange') fnKK = cosmology.noise_pad_infinity(interp1d(ls,Nls,fill_value=np.inf,bounds_error=False),kellmin,kellmax) # Decide on what ell range to calculate the Fisher matrix ellrange = np.arange(min(tellmin,pellmin,kellmin),max(tellmax,pellmax,kellmax)).astype(int) # Get fsky fsky = Config.getfloat(expName,'fsky') # Calculate the Fisher matrix and add to other Fishers Fisher = calcFisher(paramList,ellrange,fidCls,dCls,lambda x: fnTT(x)*TCMB**2.,lambda x: fnEE(x)*TCMB**2.,fnKK,fsky,verbose=True) np.savetxt(saveName,Fisher)
else: kellmin = np.inf kellmax = -np.inf # Decide on what ell range to calculate the Fisher matrix ellrange = np.arange(min(tellmin, pellmin, kellmin), max(tellmax, pellmax, kellmax)).astype(int) # Get fsky fsky = Config.getfloat(expName, 'fsky') # Calculate the Fisher matrix and add to other Fishers if noLens: Fisher = otherFisher + calcFisher(paramList, ellrange, fidCls, dCls, lambda x: fnTT(x) * TCMB**2., lambda x: fnEE(x) * TCMB**2., None, fsky, lensing=False, verbose=True) else: Fisher = otherFisher + calcFisher(paramList, ellrange, fidCls, dCls, fnTT, fnEE, fnKK, fsky, lensing=True, verbose=True)