forked from damonge/CoLoRe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resnew.py
60 lines (50 loc) · 1.28 KB
/
resnew.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import batch as b
from pylab import *
from tools import *
#clip
data="outputs/bench3/clmean.fits"
model="model/tophat_clip3_ngrid1024.fits"
#lognormal
data="outputs/bench0/clmean.fits"
model="model/tophat_dens0_ngrid1024.fits"
truth=mrdfits(model,1)
t=mrdfits(data,1)
cols=t.dtype.names[1:]
l=t.ell
do_legend=True
newfig=True
newfig=False
zval=(0,0.1,0.2,0.3,0.4,0.5)
Nz=5000
Nsamp=41253*Nz*0.1
print("Nz={} mean Ngal={}".format(Nz,Nsamp))
nbar=Nsamp/(4*np.pi)
if newfig:
fig=figure(figsize=(12,10))
#fig.suptitle(model)
for i in range(1,5):
if i==1 :
ax=subplot(2,2,i)
else:
subplot(2,2,i,sharex=ax,sharey=ax)
ishell=i+1
clt=truth[cols[i-1]]
clt[0]=0
clrec=t[cols[i-1]]
cvar=2*(clt+1/nbar)**2/(2*l+1)
plot(clrec,'k',label=r"$<C_\ell^i>-SN$",lw=3)
plot(clt,'r',label=r"$C_\ell^{th}$",lw=1)
plot(clrec-clt,'b',label='residue')
fill_between(l,clt+sqrt(cvar),clt-sqrt(cvar),color='r',alpha=0.1)
plot(l,clrec-clt)
zmax=zval[ishell]
zmin=zval[ishell-1]
legend()
title(r"$z\in [{},{}]$".format(zmin,zmax),fontsize=14)
#text(0.4, 0.9,r"$z\in [{},{}]$".format(zmin,zmax), transform=gca().transAxes,fontsize=12)
ax0()
xlabel(r"$\ell$")
xlim(0,250)
ylabel(r"$C_\ell$")
ylim(-2e-4,2e-4)
tight_layout()