Ejemplo n.º 1
0
def ProcessAndwriteSpectra(cl_vec,
                           filterArray,
                           name,
                           fields,
                           ar1,
                           ar2,
                           spTag,
                           binnedBeamDict=None,
                           iar=None):

    countAll = 0
    count1 = 0
    for l1 in fields:
        count1 += 1
        count2 = 0
        for l2 in fields:
            count2 += 1
            if count2 < count1: continue

            # remove filter
            cl = cl_vec[countAll * Nbin:(countAll + 1) *
                        Nbin] * filterArray[l1 + l2]**2

            # There is an additional correction for the autos as MCM had a transfer
            # function B_l_AR1*B_l_AR_2
            if iar != None:
                cl *= binnedBeamDict[sps[0]][iar -
                                             1] / binnedBeamDict[sps[0]][iar]

            gName = '%s/%s_%s%s_%sx%s_%s.dat' % (specDir, name, l1, l2, ar1,
                                                 ar2, spTag)

            speckMisc.writeBinnedSpectrum(lBin, cl, binCount, gName)

            countAll += 1
Ejemplo n.º 2
0
def ProcessAndwriteSpectra(cl_vec,filterArray,name,fields,ar1,ar2,spTag,binnedBeamDict=None,iar=None):
    
    countAll=0
    count1=0
    for l1 in fields:
        count1+=1
        count2=0
        for l2 in fields:
            count2+=1
            if count2<count1: continue
            
            # remove filter
            cl=cl_vec[countAll*Nbin:(countAll+1)*Nbin]*filterArray[l1+l2]**2
            
            # There is an additional correction for the autos as MCM had a transfer
            # function B_l_AR1*B_l_AR_2
            if iar !=None:
                cl*= binnedBeamDict[sps[0]][iar-1]/binnedBeamDict[sps[0]][iar]
            
            
            gName = '%s/%s_%s%s_%sx%s_%s.dat'%(specDir,name,l1,l2,ar1,ar2,spTag)
            
            speckMisc.writeBinnedSpectrum(lBin,cl,binCount,gName)
            
            countAll+=1
Ejemplo n.º 3
0
        U_rot = U.copy()

        Q_rot.data = Q.data * numpy.cos(2 * phi) + U.data * numpy.sin(2 * phi)
        U_rot.data = -Q.data * numpy.sin(2 * phi) + U.data * numpy.cos(2 * phi)

        Q_rot.writeFits(patchDir + os.path.sep + 'Q_map_%s_%s_%d' %
                        (array, season, i),
                        overWrite=True)
        U_rot.writeFits(patchDir + os.path.sep + 'U_map_%s_%s_%d' %
                        (array, season, i),
                        overWrite=True)

    os.system('HQcompileSpectra.py global.dict')
    os.system('HQcomputeAnalyticCovariance.py global.dict')

    print 'only seasonTags[0] arrayTags[0] at the moment'
    l, cl_EB, error_EB = numpy.loadtxt('spectra/spectrum_EB_%sx%s_%sx%s.dat' %
                                       (array, array, season, season),
                                       unpack=True)

    speckMisc.writeBinnedSpectrum(
        l, cl_EB, error_EB, 'spectrum_EB_%sx%s_%sx%s_%d.dat' %
        (array, array, season, season, count))
    chi2[count] = numpy.mean(cl_EB**2 / error_EB**2)

    print phi, chi2[count]
    count += 1

pylab.plot(ang, chi2)
pylab.show()
            meanAutoSpec_B[l2+l1,spTag]=meanAutoSpec_B[l1+l2,spTag]
            meanAutoSpec_AB[l2+l1,spTag]=meanAutoSpec_AB[l1+l2,spTag]


            meanNoise_A[l1+l2,spTag]=meanAutoSpec_A[l1+l2,spTag]-meanCrossSpec[l1+l2,spTag]
            meanNoise_A[l2+l1,spTag]=meanNoise_A[l1+l2,spTag]

            meanNoise_B[l1+l2,spTag]=meanAutoSpec_B[l1+l2,spTag]-meanCrossSpec[l1+l2,spTag]
            meanNoise_B[l2+l1,spTag]=meanNoise_B[l1+l2,spTag]

            meanNoise_AB[l1+l2,spTag]=meanAutoSpec_AB[l1+l2,spTag]-meanCrossSpec[l1+l2,spTag]
            meanNoise_AB[l2+l1,spTag]=meanNoise_AB[l1+l2,spTag]


            fName = '%s/noise_%s%s_%sx%s_%sx%s.dat'%(specDir,l1,l2,arrays[0],arrays[0],sps[0],sps[0])
            speckMisc.writeBinnedSpectrum(lbin,meanNoise_A[l1+l2,spTag]/nDivs,binWeight[l1+l2,spTag],fName)

            fName = '%s/noise_%s%s_%sx%s_%sx%s.dat'%(specDir,l1,l2,arrays[-1],arrays[-1],sps[1],sps[1])
            speckMisc.writeBinnedSpectrum(lbin,meanNoise_B[l1+l2,spTag]/nDivs,binWeight[l1+l2,spTag],fName)


            fName = '%s/noise_%s%s_%sx%s_%sx%s.dat'%(specDir,l1,l2,arrays[0],arrays[-1],sps[0],sps[1])
            speckMisc.writeBinnedSpectrum(lbin,meanNoise_AB[l1+l2,spTag]/nDivs,binWeight[l1+l2,spTag],fName)




c=0
count1=0
for l1 in fields:
    count1+=1
Ejemplo n.º 5
0
    for i in xrange(nDivs):
            
        T = liteMap.liteMapFromFits('%s/%s/T_map_%s_%s_%d'%(dir,patchDir,array,season,i))
        Q = liteMap.liteMapFromFits('%s/%s/Q_map_%s_%s_%d'%(dir,patchDir,array,season,i))
        U = liteMap.liteMapFromFits('%s/%s/U_map_%s_%s_%d'%(dir,patchDir,array,season,i))
        
        Q_rot=Q.copy()
        U_rot=U.copy()
        
        Q_rot.data=Q.data*numpy.cos(2*phi)+U.data*numpy.sin(2*phi)
        U_rot.data=-Q.data*numpy.sin(2*phi)+U.data*numpy.cos(2*phi)

        Q_rot.writeFits(patchDir+os.path.sep+'Q_map_%s_%s_%d'%(array,season,i),overWrite=True)
        U_rot.writeFits(patchDir+os.path.sep+'U_map_%s_%s_%d'%(array,season,i),overWrite=True)

    os.system('HQcompileSpectra.py global.dict')
    os.system('HQcomputeAnalyticCovariance.py global.dict')

    print 'only seasonTags[0] arrayTags[0] at the moment'
    l,cl_EB,error_EB=numpy.loadtxt('spectra/spectrum_EB_%sx%s_%sx%s.dat'%(array,array,season,season),unpack=True)


    speckMisc.writeBinnedSpectrum(l,cl_EB,error_EB,'spectrum_EB_%sx%s_%sx%s_%d.dat'%(array,array,season,season,count))
    chi2[count]=numpy.mean(cl_EB**2/error_EB**2)

    print phi,chi2[count]
    count+=1

pylab.plot(ang,chi2)
pylab.show()