Commit f5adceda authored by Maude Le Jeune's avatar Maude Le Jeune
Browse files

unbeam cov ok

parent fde32660
......@@ -29,3 +29,4 @@ from fitsfunc2 import *
from bin import *
from alm import *
from utils import *
from cov import *
......@@ -17,7 +17,42 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see
from pylab import *
import bin
def unbeamcov (cov, beams, max_inv=10000):
""" Correct covariance matrices from beam effect
cov: 3D array, symetric covariance matrices
beams: vector, beam fwhm in arcmin
max_inv: upper limit for inversion
nin = shape(cov)[0]
lmax = shape(cov)[2]-1;
ib = zeros((nin, lmax+1))
for m in range(nin):
ib[m,:] = squeeze(1/bin.gaussbeam(beams[m], lmax))
ib[m,[ib[m,:]>max_inv]] = max_inv
for ell in range(lmax+1):
cov[:,:,ell] = dot(dot(diag(ib[:,ell]),cov[:,:,ell]),diag(ib[:,ell]))
def plotautocov (cov, figfile=None, leg=None):
nmap = shape(cov)[0]
for m in range(nmap):
if leg is not None:
if figfile is None:
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