Beispiel #1
0
from cosmoslik import SlikPlugin, arguments, param_shortcut, SlikFunction
param = param_shortcut('start','scale')

class cosmology(SlikPlugin):


    def __init__(self,
                 model = '',
                #  As = 2.4e-9,
                #  ns = 0.96,
                #  ombh2 = 0.0225,
                #  omch2 = 0.12,
                #  tau = 0.09,
                #  H0 = None,
                #  massive_neutrinos = 1,
                #  massless_neutrinos = 2.046,
                #  omk = 0,
                #  omnuh2 = 0.00064,
                #  nrun = 0,
                #  w = -1,
                 **kwargs):

        super().__init__(**arguments(exclude=["model"]))
        model = model.lower()

        if 'lcdm' in model:
            self.As     = param(2.1e-9,  0.03e-9)
            self.ns     = param(0.96,    0.006)
            self.ombh2  = param(0.0221,  0.0002)
            self.omch2  = param(0.12,    0.002)
            self.tau    = param(0.09,    0.01,  min=0)
DL_DATA - File which contains data Cl's. 
OUTPUT - Output file root. 

DL and DL_DATA should be text files with two columns, corresponding to l, Dl, starting at l=0.
"""

import sys
sys.path.append('../julia_code/cosmoslik')
from cosmoslik import param_shortcut, lsum, get_plugin, SlikDict, SlikPlugin, Slik, mpi
from cosmoslik.chains import load_chain
from numpy import identity, exp, inf, hstack, load, zeros, arange, pi, sqrt, loadtxt, save, array
from numpy.random import normal

        
param = param_shortcut('start','scale')

class main(SlikPlugin):
    
    def __init__(self):
        super(SlikPlugin,self).__init__()
        
        #
        # The Cl, Nl, fsky, and lranges used in the likelihood
        #
        self.nl_fid = 0.00015048 * exp( arange(2501)**2 * 7.69112e-7 ) * (arange(2501)**2/2/pi)
        self.fsky = 0.3
        self.lrange = (2,2501)
        self.lslice = slice(*self.lrange)
        self.ells = arange(*self.lrange)
        #