HMF.sigN = siggrid.copy() SZProf = SZ_Cluster_Model(cc, clusterDict, rms_noises=noise, fwhms=beam, freqs=freq, lknee=lknee, alpha=alpha) h = 0.05 # s80, As = getA(fparams,constDict,zrange,kmax=11.) # s8zs = As*s80 dNFid_dmzq = HMF.N_of_mqz_SZ(lndM * massMultiplier, qbins, SZProf) np.save(bigDataDir + "N_mzq_" + saveId + "_fid_sigma8", getNmzq(dNFid_dmzq, mgrid, zrange, qbins)) origPk = HMF.pk.copy() print("Calculating derivatives for overall power ...") HMF.pk = origPk.copy() HMF.pk[:, :] *= (1. + old_div(h, 2.))**2. dNUp_dmqz = HMF.N_of_mqz_SZ(lndM * massMultiplier, qbins, SZProf) Nup = getNmzq(dNUp_dmqz, mgrid, zrange, qbins) HMF.pk = origPk.copy() HMF.pk[:, :] *= (1. - old_div(h, 2.))**2. dNDn_dmqz = HMF.N_of_mqz_SZ(lndM * massMultiplier, qbins, SZProf) Ndn = getNmzq(dNDn_dmqz, mgrid, zrange, qbins) dNdp = old_div((Nup - Ndn), h)
rms_noises=noise, fwhms=beam, freqs=freq, lknee=lknee, alpha=alpha, v3mode=v3mode, fsky=fsky) if (YWLcorrflag == 1): dN_dmqz = HMF.N_of_mqz_SZ_corr(lndM * massMultiplier, qbin_edges, SZProf) else: dN_dmqz = HMF.N_of_mqz_SZ(lndM * massMultiplier, qbin_edges, SZProf) if rank == 0: np.save(bigDataDir + "N_mzq_" + saveId + "_w0_ppf_fid", getNmzq(dN_dmqz, mexp_edges, z_edges, qbin_edges)) print("Waiting for ups and downs...") for i in range(1, numcores): data = np.empty(dN_dmqz.shape, dtype=np.float64) comm.Recv(data, source=i, tag=77) if i == 1: dUp = data.copy() elif i == 2: dDn = data.copy() Nup = getNmzq(dUp, mexp_edges, z_edges, qbin_edges) Ndn = getNmzq(dDn, mexp_edges, z_edges, qbin_edges) dNdp = old_div((Nup - Ndn), w0Step) np.save(bigDataDir + "Nup_mzq_" + saveId + "_w0_ppf", Nup) np.save(bigDataDir + "Ndn_mzq_" + saveId + "_w0_ppf", Ndn)
passParams[myParam] = fparams[myParam] - old_div(stepSizes[myParam],2.) if rank!=0: print(rank,myParam,fparams[myParam],passParams[myParam]) cc = ClusterCosmology(passParams,constDict,clTTFixFile=clttfile) HMF = Halo_MF(cc,mexp_edges,z_edges) HMF.sigN = siggrid.copy() SZProf = SZ_Cluster_Model(cc,clusterDict,rms_noises = noise,fwhms=beam,freqs=freq,lknee=lknee,alpha=alpha,v3mode=v3mode,fsky=fsky) if (YWLcorrflag == 1): dN_dmqz = HMF.N_of_mqz_SZ_corr(lndM*massMultiplier,qbin_edges,SZProf) else: dN_dmqz = HMF.N_of_mqz_SZ(lndM*massMultiplier,qbin_edges,SZProf) if rank==0: #np.save(bigDataDir+"N_dzmq_"+saveId+"_fid",dN_dmqz) np.save(sfisher.fid_file(bigDataDir,saveId),getNmzq(dN_dmqz,mexp_edges,z_edges,qbin_edges)) dUps = {} dDns = {} print("Waiting for ups and downs...") for i in range(1,numcores): data = np.empty(dN_dmqz.shape, dtype=np.float64) comm.Recv(data, source=i, tag=77) myParamIndex = old_div((i+1),2)-1 if i%2==1: dUps[inParamList[myParamIndex]] = data.copy() elif i%2==0: dDns[inParamList[myParamIndex]] = data.copy() for param in inParamList: # dN = (dUps[param]-dDns[param])/stepSizes[param]
cc = ClusterCosmology(uppassparams,constDict,clTTFixFile=clttfile) HMF = Halo_MF(cc,mexp_edges,z_edges) HMF.sigN = siggrid.copy() SZProf = SZ_Cluster_Model(cc,clusterDict,rms_noises = noise,fwhms=beam,freqs=freq,lknee=lknee,alpha=alpha) Nup = HMF.N_of_mqz_SZ(lndM*massMultiplier,qbin_edges,SZProf) cc = ClusterCosmology(dnpassparams,constDict,clTTFixFile=clttfile) HMF = Halo_MF(cc,mexp_edges,z_edges) HMF.sigN = siggrid.copy() SZProf = SZ_Cluster_Model(cc,clusterDict,rms_noises = noise,fwhms=beam,freqs=freq,lknee=lknee,alpha=alpha) Ndn = HMF.N_of_mqz_SZ(lndM*massMultiplier,qbin_edges,SZProf) dNdp = old_div((getNmzq(Nup,mexp_edges,z_edges,qbin_edges)-getNmzq(Ndn,mexp_edges,z_edges,qbin_edges)),val) Nz = dNdp.copy().sum(axis=-1).sum(axis=0) Nm = dNdp.copy().sum(axis=-1).sum(axis=-1) Nq = dNdp.copy().sum(axis=0).sum(axis=0) yNzs[key].append((val,Nz,Nm,Nq)) pl = Plotter(labelX="$z$",labelY="$dN$") xstep = 0.01 for i,val in enumerate(vals): assert yNzs[key][i][0]==val pl.add(getCents(z_edges)+((i-old_div(len(vals),2))*xstep),yNzs[key][i][1],label=key+" "+str(val))