Esempio n. 1
0
try:
    ellee,nee = np.loadtxt(args.pp,usecols=[0,1],unpack=True)
    noise_func_ee = interp1d(ellee,nee,bounds_error=False,fill_value=np.inf)
except:
    noise_func_ee = None
    
    
TCMB = 2.7255e6

# Read config
iniFile = "input/params.ini"
Config = SafeConfigParser()
Config.optionxform=str
Config.read(iniFile)

ls,Nls,ellbb,dlbb,efficiency,cc = lensNoise(Config,expName,lensName,beamOverride=None,noiseTOverride=None,lkneeTOverride=None,lkneePOverride=None,alphaTOverride=None,alphaPOverride=None,noiseFuncT=noise_func_tt,noiseFuncP=noise_func_ee)

# File root name for Fisher derivatives
derivRoot = Config.get("fisher","derivRoot")

# Get list of parameters
paramList = Config.get("fisher","paramList").split(',')

# 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.
Esempio n. 2
0
for cambRoot, lab, col in zip(clist, lablist, colist):
    theory = cmb.loadTheorySpectraFromCAMB(cambRoot,
                                           unlensedEqualsLensed=False,
                                           useTotal=False,
                                           TCMB=2.7255e6,
                                           lpad=lmax)

    ls, Nls, ellbb, dlbb, efficiency, cc = lensNoise(
        Config,
        expName,
        lensName,
        beamOverride=None,
        noiseTOverride=None,
        lkneeTOverride=None,
        lkneePOverride=None,
        alphaTOverride=None,
        alphaPOverride=None,
        gradCut=2000,
        deg=2.,
        px=0.1,
        theoryOverride=theory,
        bigell=lmax,
        lensedEqualsUnlensed=False)

    ells = np.arange(2, lmax, 1)
    clkk = theory.gCl("kk", ells)

    pl.add(ells, clkk, label=lab, ls="-", color=col)
    pl.add(ls, Nls, label=lab + " Nl", ls="--", color=col)

ls, Nlslimit, ellbb, dlbb, efficiency, cc = lensNoise(
Esempio n. 3
0
efficiencies = []
mnus = []
sns = []
rs = []
rdelens = []

if True:
    # Get lensing noise curve. If you want to override something from the Config file in order to make plots varying it,
    # change from None to the value you want.

    ls, Nls, ellbb, dlbb, efficiency = lensNoise(Config,
                                                 expName,
                                                 lensName,
                                                 beamOverride=None,
                                                 noiseTOverride=None,
                                                 lkneeTOverride=None,
                                                 lkneePOverride=None,
                                                 alphaTOverride=None,
                                                 alphaPOverride=None)

    efficiencies.append(efficiency)

    printC("Delensing efficiency: " + str(efficiency) + " %",
           color="green",
           bold=True)

    # File root name for Fisher derivatives
    derivRoot = Config.get("fisher", "derivRoot")

    # Get list of parameters
Esempio n. 4
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. 5
0
    lpad=bigell)  #,get_dimensionless=True)
#theoryOverride = None

tellmin, tellmax = list_from_config(Config, expName, 'tellrange')
pellmin, pellmax = list_from_config(Config, expName, 'pellrange')
px = np.round(180. / max(tellmax, pellmax) * 60. * 0.95, 2)

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) + " %",
Esempio n. 6
0
# Read config
iniFile = "input/params.ini"
Config = SafeConfigParser()
Config.optionxform = str
Config.read(iniFile)

px = 180 * 60 / 60000.
gradCut = 60000.

expName = "DM-18arcsec"
lensName = "lensing"
ls, Nls, ellbb, dlbb, efficiency = lensNoise(Config,
                                             expName,
                                             lensName,
                                             px=px,
                                             gradCut=gradCut,
                                             bigell=gradCut,
                                             plot=True)

print efficiency
print ls
print Nls

from orphics.tools.io import Plotter

pl = Plotter(scaleY='log')
pl.add(ls, Nls)
pl._ax.set_ylim(1e-12, 1e-6)
#pl._ax.set_xlim(2,4000)
pl.done("nls.png")