Exemplo n.º 1
0
ellval=(ellmin+ellmax)/2
deltaell=(ellmax+1-ellmin)/2
binspec=pyquad.binspectrum(spectra,ellmin,ellmax)
inputspectrum=binspec


mp.clf()
mp.plot(spectra[0],spectra[4]*(spectra[0]*(spectra[0]+1))/(2*np.pi),lw=3)
mp.xlabel('$\ell$')
mp.xscale('log')
mp.ylabel('$\ell(\ell+1)C_\ell/(2\pi)$')
mp.xlim(0,np.max(ellmax)*1.2)
errorbar(binspec[:,0],binspec[:,4]*binspec[:,0]*(binspec[:,0]+1)/(2*np.pi),xerr=deltaell,fmt='ro')

# window functions
ds_dcb=pyquad.compute_ds_dcb_line_par(output_map,maskok,ellmin,ellmax,fwhm,24)

####### Save results #######################
from pysimulators import FitsArray
import pickle
## Covariance matrix
#FitsArray(covmc,copy=False).save('covmc.dat')
## Pointing
#out=open('saved_ptg.dat','wb')
    #cPickle.dump({'pointings':pointings, 'cmap':cmap, 'mask':mask,
#             'signoise':signoise},out)
#out.close()
## dS/dCb
FitsArray(ds_dcb,copy=False).save('ds_dcb_linlog.dat')
## ell range
out=open('saved_ellrange_linlog.dat','wb')
Exemplo n.º 2
0
clf()
xlim(0,np.max(maxell))
plot(ell,spectra[4]*(ell*(ell+1))/(2*np.pi),lw=3)
errorbar(ellval,inputspectrum[:,4]*ellval*(ellval+1)/(2*np.pi),xerr=deltaell,fmt='ro')

nside=256
npix=4000
fwhm=30./60*np.pi/180

# calculate ds_dcb
map_orig=hp.synfast(spectra[4],nside,fwhm=fwhm,pixwin=True)
mapin=map_orig.copy()
mapin[npix:mapin.size]=0
mask= mapin != 0
#ds_dcb=pyquad.compute_ds_dcb(mapin,mask,ellmin,ellmax,fwhm)
ds_dcb=pyquad.compute_ds_dcb_line_par(mapin,mask,ellmin,ellmax,fwhm,24)

# Now iterate
nbmc=1
signoise=0.01
guess=inputspectrum[:,4]*0.5
allcl=np.zeros((ellbins,nbmc))
alldcl=np.zeros((ellbins,nbmc))
for i in arange(nbmc):
    print(i)
    map_orig=hp.synfast(spectra[4],nside,fwhm=fwhm,pixwin=True)
    #map_orig=map_orig[0]
    mapin=map_orig.copy()
    mapin[npix:mapin.size]=0
    mask= mapin != 0
    map=mapin.copy()