forked from damonge/CoLoRe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
combine_cl.py
71 lines (49 loc) · 1.12 KB
/
combine_cl.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
61
62
63
64
65
66
67
68
69
70
71
from pylab import *
from tools import *
from healpy import *
import healpy as hp
import glob,os
#cls
clt=read_cl("cl_R4.fits")
clt[0]=0.
nbar=2066239./(4*pi)
clsn=ones_like(clt)*1/nbar
#p2=getPixWin2(256)
files=glob.glob("batch/cl_map256_cat*.fits")
#no rsd
#clt=read_cl("cl_norsd_R4.fits")
#files=glob.glob("batch/cl_map_norsd_gal*.fits")
cls=[]
for file in files:
print(file)
cls.append(hp.read_cl(file))
#[plot(cl) for cl in cls]
clm=mean(cls,0,dtype=float64)
lmax=min([len(clm),len(clt),len(clsn)])-1
clsn=clsn[0:lmax]
clt=clt[0:lmax]
clm=clm[0:lmax]
#c=cov(transpose(cls))
#cc=cov2cor(c)
#sig2=diag(c)
#l=arange(shape(cls)[1])
#errorbar(l,clm,yerr=sqrt(sig2))
#cut clt and put monopole to 0
#clt=clt[0:len(clm)]
res=clm-clt
snlevel=mean(clm[400:]-clt[400:])
print("sn level={}".format(snlevel))
#p2=p2[0:len(clm)]
figure()
plot(clt+clsn,'r',label=r"$C_\ell^{th}+SN$")
plot(clm,'k',label=r"$<C_\ell^i>$")
plot(clm-(clt+clsn),label='residue')
#plot(clsn,'r',label='SN')
#plot(clsn*p2,label='SN*pixwin')
axhline(0,color='k',lw=0.5)
legend()
xlabel(r"$\ell$")
ylabel(r"$C_\ell$")
xlim(0,500)
tight_layout()
show()