Commit 004a983b authored by Maude Le Jeune's avatar Maude Le Jeune
Browse files

+ binmatrix

bug map2cov
parent df8cba6d
......@@ -23,6 +23,28 @@ from numpy import *
import spherelib_bin
def get_binMatrix(bins, btype='flat'):
""" Compute binning matrix
"""
lmin = int(bins[ 0, 0])
lmax = int(bins[-1,-1])
Q = shape(bins)[0]
Mbins = zeros ((Q, lmax+1-lmin))
for q in range(Q):
ellmin = int(bins[q,0])
ellmax = int(bins[q,1])
rg = arange(ellmin,ellmax+1).astype(int32)
if btype=='flat':
Mbins[q,rg-lmin] = 2*rg+1
##squeeze(lnmodes[rg]/(1.0*sum(lnmodes[rg])))
elif btype=='llp1':
Mbins[q,rg-lmin] = rg*(rg+1)
nrm = sum(Mbins[q,rg-lmin])
Mbins[q,rg-lmin] /= 1.0*nrm
return Mbins
def bin_stat (covmat, bin, nmode=None):
""" Perform the averaging of spectral covariance matrices over flat bins.
......
......@@ -77,6 +77,7 @@ def mask_correction (cov, mask, corr="fsky", nmode=None):
for i in range(nmap):
for j in range(i,nmap):
cov[i,j,:] = linalg.solve(mll , squeeze(cov[i,j,:]))
cov[j,i,:] = cov[i,j,:]
if nmode is not None:
nmode *= fsky
return fsky
......
......@@ -85,7 +85,7 @@ def map2cov (maptab, zone, reg=0):
nin = shape(maptab)[0]
npix = max(zone)
npix = int(max(zone))
ncross = nin*(nin+1)/2
covtab = zeros((ncross, npix))
nmode = zeros((npix))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment