Esempio n. 1
0
# Load fiducials and derivatives
fidCls = tryLoad(derivRoot+'_fCls.csv',',')
dCls = {}
for paramName in paramList:
    dCls[paramName] = tryLoad(derivRoot+'_dCls_'+paramName+'.csv',',')


# Get CMB noise functions and ell ranges.
if (noise_func_tt is None) or (noise_func_ee is None):
    fnTT, fnEE = noiseFromConfig(Config,expName,TCMB=TCMB,beamsOverride=None,noisesOverride=None,lkneeTOverride=None,lkneePOverride=None,alphaTOverride=None,alphaPOverride=None)

tellmin,tellmax = list_from_config(Config,expName,'tellrange')
pellmin,pellmax = list_from_config(Config,expName,'pellrange')

if (noise_func_tt is not None):
    fnTT = cosmology.noise_pad_infinity(noise_func_tt,tellmin,tellmax)
if (noise_func_ee is not None):
    fnEE = cosmology.noise_pad_infinity(noise_func_ee,pellmin,pellmax)
    

# Pad CMB lensing noise with infinity outside L ranges
kellmin,kellmax = list_from_config(Config,'lensing','Lrange')
fnKK = cosmology.noise_pad_infinity(interp1d(ls,Nls,fill_value=np.inf,bounds_error=False),kellmin,kellmax)

# Decide on what ell range to calculate the Fisher matrix
ellrange = np.arange(min(tellmin,pellmin,kellmin),max(tellmax,pellmax,kellmax)).astype(int)
# Get fsky
fsky = Config.getfloat(expName,'fsky')
# Calculate the Fisher matrix and add to other Fishers
Fisher = calcFisher(paramList,ellrange,fidCls,dCls,lambda x: fnTT(x)*TCMB**2.,lambda x: fnEE(x)*TCMB**2.,fnKK,fsky,verbose=True)
Esempio n. 2
0
ls, Nls, ellbb, dclbb, efficiency, cc = lensNoise(
    Config,
    expName,
    lensName,
    beamOverride=None,
    lkneeTOverride=None,
    lkneePOverride=None,
    alphaTOverride=None,
    alphaPOverride=None,
    deg=deg,
    px=px,
    gradCut=gradCut,
    bigell=bigell,
    theoryOverride=theoryOverride,
    noiseFuncT=None,
    noiseFuncP=None,
    nIter=nIter)

kellmin, kellmax = list_from_config(Config, lensName, 'Lrange')
fnKK = cosmo.noise_pad_infinity(
    interp1d(ls, Nls, fill_value=np.inf, bounds_error=False), kellmin, kellmax)
Lrange = np.arange(kellmin, kellmax)
#np.savetxt(outDir+'nlkk'+iterName+'.csv',np.vstack([Lrange,fnKK(Lrange)]).T)
cprint("Delensing efficiency: " + str(efficiency) + " %",
       color="green",
       bold=True)

#j+=1
#i+=1
Esempio n. 3
0
def fisher_from_config(fidCls,
                       dCls,
                       paramList,
                       Config,
                       expName,
                       lensName=None,
                       TCMB=2.7255e6,
                       beamsOverride=None,
                       noisesOverride=None,
                       lkneeTOverride=None,
                       lkneePOverride=None,
                       alphaTOverride=None,
                       alphaPOverride=None,
                       tellminOverride=None,
                       pellminOverride=None,
                       tellmaxOverride=None,
                       pellmaxOverride=None):
    fnTT, fnEE = noiseFromConfig(Config, expName, TCMB, beamsOverride,
                                 noisesOverride, lkneeTOverride,
                                 lkneePOverride, alphaTOverride,
                                 alphaPOverride, tellminOverride,
                                 pellminOverride, tellmaxOverride,
                                 pellmaxOverride)

    tellmin, tellmax = list_from_config(Config, expName, 'tellrange')
    pellmin, pellmax = list_from_config(Config, expName, 'pellrange')
    if tellminOverride is not None: tellmin = tellminOverride
    if tellmaxOverride is not None: tellmax = tellmaxOverride
    if pellminOverride is not None: pellmin = pellminOverride
    if pellmaxOverride is not None: pellmax = pellmaxOverride

    if lensName is not None:
        doLens = True
        ls, Nls, ellbb, dlbb, efficiency, cc = lensNoise(
            Config, expName, lensName, beamsOverride, noisesOverride,
            lkneeTOverride, lkneePOverride, alphaTOverride, alphaPOverride)

        # Pad CMB lensing noise with infinity outside L ranges
        kellmin, kellmax = list_from_config(Config, lensName, 'Lrange')
        fnKK = cosmo.noise_pad_infinity(
            interp1d(ls, Nls, fill_value=np.inf, bounds_error=False), kellmin,
            kellmax)
    else:
        doLens = False
        fnKK = lambda x: np.nan
        kellmin = np.inf
        kellmax = -np.inf

    # Decide on what ell range to calculate the Fisher matrix
    ellrange = np.arange(min(tellmin, pellmin, kellmin),
                         max(tellmax, pellmax, kellmax)).astype(int)
    # Get fsky
    fsky = Config.getfloat(expName, 'fsky')
    # Calculate the Fisher matrix and add to other Fishers
    Fisher = calcFisher(paramList,
                        ellrange,
                        fidCls,
                        dCls,
                        lambda x: fnTT(x) * TCMB**2.,
                        lambda x: fnEE(x) * TCMB**2.,
                        fnKK,
                        fsky,
                        lensing=doLens,
                        verbose=True)

    return Fisher
Esempio n. 4
0
    # Load other Fisher matrices to add
    try:
        otherFisher = loadFishers(Config.get('fisher','otherFishers').split(','))
    except:
        otherFisher = 0.

    # Get CMB noise functions and ell ranges. Note that the same overriding is possible but here the beams and noises have to be lists for the different frequencies.
    fnTT, fnEE = noiseFromConfig(Config,expName,TCMB=TCMB,beamsOverride=None,noisesOverride=[noiseNow],lkneeTOverride=None,lkneePOverride=None,alphaTOverride=None,alphaPOverride=None)

    tellmin,tellmax = list_from_config(Config,expName,'tellrange')
    pellmin,pellmax = list_from_config(Config,expName,'pellrange')

    # Pad CMB lensing noise with infinity outside L ranges
    kellmin,kellmax = list_from_config(Config,'lensing','Lrange')
    fnKK = cosmology.noise_pad_infinity(interp1d(ls,Nls,fill_value=np.inf,bounds_error=False),kellmin,kellmax)

    # Decide on what ell range to calculate the Fisher matrix
    ellrange = np.arange(min(tellmin,pellmin,kellmin),max(tellmax,pellmax,kellmax)).astype(int)
    # Get fsky
    fsky = fskyNow #Config.getfloat(expName,'fsky')
    # Calculate the Fisher matrix and add to other Fishers
    Fisher = otherFisher+calcFisher(paramList,ellrange,fidCls,dCls,lambda x: fnTT(x)*TCMB**2.,lambda x: fnEE(x)*TCMB**2.,fnKK,fsky,verbose=True)
    # Fisher = otherFisher+calcFisher(paramList,ellrange,fidCls,dCls,lambda x: fnTT(x),lambda x: fnEE(x),fnKK,fsky,verbose=True)

    # Get prior sigmas and add to Fisher
    priorList = Config.get("fisher","priorList").split(',')
    for prior,param in zip(priorList,paramList):
        try:
            priorSigma = float(prior)
        except ValueError: