clplot.py 791 Bytes
Newer Older
Maude Le Jeune's avatar
Maude Le Jeune committed
1 2 3 4 5 6 7 8 9 10 11 12
""" clplot.py

Make a plot. 
"""

import healpy as hp
import pylab as pl
import spherelib as sp

load_param('cmb',  globals(), ["input_cl"])

## load cls
Maude Le Jeune's avatar
Maude Le Jeune committed
13 14
cl_cmb = pl.loadtxt(glob_seg('clcmb', 'cl*.txt')[0])
cl_mll = pl.loadtxt(glob_seg('clcmb', 'cl*mll*.txt')[0])
Maude Le Jeune's avatar
Maude Le Jeune committed
15 16 17

## smoothed cls
dloverl = 0.05
Maude Le Jeune's avatar
Maude Le Jeune committed
18 19
bin_cl_cmb = sp.smooth_cl(cl_cmb, dloverl=dloverl)
bin_cl_mll = sp.smooth_cl(cl_mll, dloverl=dloverl)
Maude Le Jeune's avatar
Maude Le Jeune committed
20 21 22 23 24 25 26

## input cls
inp_cls = pl.loadtxt(input_cl)[0:lmax+1,0]

## make a plot
ell = pl.arange(lmax+1)
pl.figure()
Maude Le Jeune's avatar
Maude Le Jeune committed
27 28
pl.plot(ell, ell*(ell+1)*bin_cl_cmb/(2*pl.pi))
pl.plot(ell, ell*(ell+1)*bin_cl_mll/(2*pl.pi))
Maude Le Jeune's avatar
Maude Le Jeune committed
29
pl.plot(ell, ell*(ell+1)*inp_cls/(2*pl.pi), color="black")
Maude Le Jeune's avatar
Maude Le Jeune committed
30
pl.legend([ "empirical", "mll", "input"], loc="upper right")
Maude Le Jeune's avatar
Maude Le Jeune committed
31 32
pl.savefig(get_data_fn("cls.png"))
pl.savefig(get_data_fn("cls.pdf"))