コード例 #1
0
    def __init__(self, varyalpha=False, varybeta=False, varyilam=False,\
                       varymu=False, varyOk=False,
                       alpha=1, beta=1, mu=1, ilam=1, eps=1, curv=0):
        """Is better to start the chains at masses equal one, othewise
        may take much longer"""

        #eps => 1=Quintes, -1=Panthom

        self.varyOk = varyOk
        self.varymu = varymu
        self.varyilam = varyilam
        self.varybeta = varybeta
        self.varyalpha = varyalpha

        self.Ok = curv
        self.alpha = alpha
        self.beta = beta
        self.mu = mu
        self.ilam = ilam
        self.eps = eps

        self.lna = np.linspace(-6, 0, 500)
        self.z = np.exp(-self.lna) - 1.
        self.zvals = np.linspace(0, 5, 200)

        LCDMCosmology.__init__(self, mnu=0)
        self.updateParams([])
コード例 #2
0
    def __init__(self,
                 varymquin=False,
                 varymphan=False,
                 varyiniphi=False,
                 varybeta=False):
        ## two parameters: Om and h
        """Is better to start the chains at masses equal one, othewise
        may take much longer"""

        self.varymquin = varymquin
        self.varymphan = varymphan
        self.varybeta = varybeta

        self.varyiniphi = varyiniphi

        self.mquin = 0 if (varymphan and (not varymquin)) else mquin_par.value
        self.mphan = 0 if (varymquin and (not varymphan)) else mphan_par.value
        self.beta = 0 if (not varybeta) else beta_par.value
        self.iniphi = iniphi_par.value

        LCDMCosmology.__init__(self, mnu=0)

        self.lna = np.linspace(-10, 0, 500)
        self.z = np.exp(-self.lna) - 1.
        self.zvals = np.linspace(0, 3, 100)

        self.cte = 3.0 * self.h**2
        self.n = 2.
        self.m = 2
        self.chatty = True

        self.qp = 1

        self.updateParams([])
コード例 #3
0
    def __init__(self,
                 varyw=False,
                 varywa=False,
                 varyOk=False,
                 varyq0=True,
                 varyj0=True,
                 varyOmega0=True):
        # three parameters: w, wa, Ok

        self.varyw = varyw
        self.varywa = varywa
        self.varyOk = varyOk

        self.varyq0 = varyq0
        self.varyj0 = varyj0
        self.varyOmega0 = varyOmega0

        self.Ok = Ok_par.value
        self.w0 = w_par.value
        self.wa = wa_par.value

        self.q0 = q0.value
        self.j0 = j0.value
        self.Omega0 = Omega0.value

        LCDMCosmology.__init__(self)
コード例 #4
0
    def __init__(self, varyalpha=True, varyOk=False):
        ## two parameters: Om and h
        """Is better to start the chains at masses equal one, othewise
        may take much longer"""

        self.varyalpha = varyalpha
        self.varyOk = varyOk

        self.alpha = alpha_par.value
        self.Ok = Ok_par.value

        #Compute Vcap either analytically or find it
        self.fixVcap = False

        #Pick one for initial conditions
        #self.inic  = 'Matter'
        #self.a_in  = 5e-3
        self.inic = 'Radiation'
        self.a_in = 5e-5

        self.ndots = 1000
        self.zvals = np.linspace(0, 4, 50)
        self.ascal = np.linspace(self.a_in, 1, self.ndots)

        LCDMCosmology.__init__(self, mnu=0)
        self.updateParams([])
コード例 #5
0
    def __init__(self, varyw=True, varyOk=True):
        # two parameters: Om and h

        self.varyw = varyw
        self.varyOk = varyOk

        self.Ok = Ok_par.value
        self.dw0 = dw_par.value

        LCDMCosmology.__init__(self)
コード例 #6
0
    def __init__(self, varyw=True, varywa=True, varyOk=True):
        # three parameters: w, wa, Ok

        self.varyw = varyw
        self.varywa = varywa
        self.varyOk = varyOk

        self.Ok = Ok_par.value
        self.w0 = w_par.value
        self.wa = wa_par.value
        LCDMCosmology.__init__(self)
コード例 #7
0
 def __init__(self, polyvary=['Om1', 'Om2', 'Ok'], Ok_prior=0.1):
     # Ok, LCDM has Omega_m, we also have Omega_1 and Omega_2
     # and Lambda is then what remains
     ##
     self.Ok = Ok_par.value
     self.Om1 = Om1_par.value
     self.Om2 = Om2_par.value
     self.varyOm1 = 'Om1' in polyvary
     self.varyOm2 = 'Om2' in polyvary
     self.varyOk = 'Ok' in polyvary
     self.Ok_prior = Ok_prior
     LCDMCosmology.__init__(self, mnu=0)
コード例 #8
0
 def freeParameters(self):
     l = LCDMCosmology.freeParameters(self)
     if (self.varymquin): l.append(mquin_par)
     if (self.varymphan): l.append(mphan_par)
     if (self.varyiniphi): l.append(iniphi_par)
     if (self.varybeta): l.append(beta_par)
     return l
コード例 #9
0
    def updateParams(self, pars):
        ok = LCDMCosmology.updateParams(self, pars)
        if not ok:
            return False
        for p in pars:
            if p.name == "mquin":
                self.mquin = p.value
            elif p.name == "mphan":
                self.mphan = p.value
            elif p.name == "iniphi":
                self.iniphi = p.value
            elif p.name == 'beta':
                self.beta = p.value

        #Searches initial conditions and computes the Hubble function
        self.search_ini()
        if self.chatty:
            print('phi, phan, beta, ini', self.mquin, self.mphan, self.beta,
                  self.iniphi)
        if False:
            #if self.mid != 0:
            "Useful for testing purposes"
            quin, dquin, phan, dphan = self.solution

            w1 = 0.5 * dquin**2 + self.qp * 0.5 * dphan**2 - self.Vtotal(
                quin, phan, 0) / self.cte - self.Vtotal(quin, phan,
                                                        0) / self.cte
            w2 = 0.5 * dquin**2 + self.qp * 0.5 * dphan**2 + self.Vtotal(
                quin, phan, 0) / self.cte + self.Vtotal(quin, phan,
                                                        0) / self.cte

            plt.plot(self.zvals, self.logatoz(w1 / w2))
            plt.title('mquin %f, mphan %f' % (self.mquin, self.mphan))
            plt.show()
        return True
コード例 #10
0
 def freeParameters(self):
     l = LCDMCosmology.freeParameters(self)
     if self.varyOm1: l.append(Om1_par)
     if self.varyOm2: l.append(Om2_par)
     Ok_par.setError(0.7)
     if self.varyOk: l.append(Ok_par)
     return l
コード例 #11
0
    def updateParams(self, pars):
        ok = LCDMCosmology.updateParams(self, pars)
        if not ok:
            return False
        for p in pars:
            if p.name == "philam":
                self.ilam = p.value
            elif p.name == "phialp":
                self.alpha = p.value
            elif p.name == "phibeta":
                self.beta = p.value
            elif p.name == "phimu":
                self.mu = p.value
            elif p.name == "Ok":
                self.Ok = p.value
                self.setCurvature(self.Ok)
                if (abs(self.Ok) > 1.0):
                    return False

        self.set_ini()
        """ Testing
        import matplotlib.pyplot as plt
        dataHz = np.loadtxt('data/Hz_all.dat')
        redshifts, obs, errors = [dataHz[:,i] for i in [0,1,2]]
        plt.errorbar(redshifts, obs, errors, xerr=None,
                     color='purple', marker='o', ls='None',
                     elinewidth =2, capsize=5, capthick = 1, label='$Datos$')
        plt.xlabel(r'$z$')
        plt.ylabel(r'$H(z) [km/s Mpc^{-1}]$')
        plt.plot(self.zvals, [67.4*np.sqrt(self.RHSquared_a(1./(1+z))) for z in self.zvals])
        #plt.plot(self.zvals, [67.4*np.sqrt(self.hubble(1./(1+z))) for z in self.zvals])
        plt.title('mquin %f'%(self.alpha))
        plt.show()
        """
        return True
コード例 #12
0
 def __init__(self):
     obh2 = 0.0224
     Om = 0.274
     h = 0.7
     mnu = 0
     fidTheory = LCDMCosmology(obh2, Om, h, mnu)
     GaussBAODVLikelihood.__init__(self, "DR11LOWZ", 0.32, 1264.0, 25.0,
                                   fidTheory)
コード例 #13
0
 def __init__(self):
     obh2 = 0.0227
     Om = 0.27
     h = 0.7
     mnu = 0  # ;# rd=149.77
     fidTheory = LCDMCosmology(obh2, Om, h, mnu)
     TabulatedBAOLikelihood.__init__(self, "DR11LyaCross",
                                     'simplemc/data/lyabaocross.scan', 2,
                                     fidTheory, 2.36)
コード例 #14
0
 def freeParameters(self):
     l = LCDMCosmology.freeParameters(self)
     if (self.varyw): l.append(w_par)
     if (self.varywa): l.append(wa_par)
     if (self.varyOk): l.append(Ok_par)
     if (self.varyq0): l.append(q0)
     if (self.varyj0): l.append(j0)
     if (self.varyOmega0): l.append(Omega0)
     return l
コード例 #15
0
    def freeParameters(self):
        l = LCDMCosmology.freeParameters(self)
        if (self.varyOk): l.append(Ok_par)
        if (self.varymu): l.append(phimu_par)
        if (self.varyilam): l.append(philam_par)
        if (self.varybeta): l.append(phibeta_par)
        if (self.varyalpha): l.append(phialp_par)

        return l
コード例 #16
0
 def __init__(self):
     obh2 = 0.021547
     Om = 0.31
     h = 0.67
     mnu = 0
     fidTheory = LCDMCosmology(obh2, Om, h, mnu)
     TabulatedBAODVLikelihood.__init__(
         self, "MGS", "simplemc/data/chidavexi8stavePk5staverec.dat",
         fidTheory, 0.15)
コード例 #17
0
 def __init__(self):
     obh2 = 0.022
     Om = 0.31
     h = 0.676
     mnu = 0.06
     fidTheory = LCDMCosmology(obh2, Om, h, mnu)
     ConsensusBAOLikelihood.__init__(
         self, "BAODR12", "simplemc/data/sdss_DR12Consensus_bao.dat",
         "simplemc/data/BAO_consensus_covtot_dM_Hz.txt", fidTheory)
コード例 #18
0
    def updateParams(self, pars):
        ok = LCDMCosmology.updateParams(self, pars)
        if not ok:
            return False
        for p in pars:
            if p.name == "alpha":
                self.alpha = p.value

        self.start()
        return True
コード例 #19
0
 def __init__(self):
     # fiducial cosmology for LOWZ/CMASS data.
     # see Anderson et al, page 28
     obh2 = 0.0224
     Om = 0.274
     h = 0.7
     mnu = 0  # rd=149.28
     fidTheory = LCDMCosmology(obh2, Om, h, mnu)
     # negative col means the cols is probability and not chi2
     TabulatedBAOLikelihood.__init__(
         self, "DR11CMASS", 'simplemc/data/sdss_DR11CMASS_consensus.dat',
         -2, fidTheory, 0.57)
コード例 #20
0
 def __init__(self):
     obh2 = 0.022
     Om = 0.31
     h = 0.676
     mnu = 0.06
     fidTheory = LCDMCosmology(obh2, Om, h, mnu)
     GaussBAODVLikelihood.__init__(self,
                                   "eBOSS",
                                   1.52,
                                   3843.0,
                                   17.0,
                                   fidTheory,
                                   maxchi2=4)
コード例 #21
0
 def __init__(self):
     obh2 = 0.02227
     Om = 0.27
     h = 0.7
     mnu = 0
     fidTheory = LCDMCosmology(obh2, Om, h, mnu)
     GaussBAODVLikelihood.__init__(self,
                                   "SixdFGS",
                                   0.106,
                                   456.0,
                                   27.0,
                                   fidTheory,
                                   maxchi2=4)
コード例 #22
0
 def updateParams(self, pars):
     ok = LCDMCosmology.updateParams(self, pars)
     if not ok:
         return False
     for p in pars:
         if p.name == "dw":
             self.dw0 = p.value
         elif p.name == "Ok":
             self.Ok = p.value
             self.setCurvature(self.Ok)
             if (abs(self.Ok) > 1.0):
                 return False
     return True
コード例 #23
0
    def __init__(self):
        # fiducial cosmology for Lya data.
        # see e.g. Busca's email on 12/3/13

        obh2 = 0.0227
        Om = 0.27
        h = 0.7
        mnu = 0.06  # ;# rd=149.77
        fidTheory = LCDMCosmology(obh2, Om, h, mnu)
        # File from 5/16 from Nicolas.
        TabulatedBAOLikelihood.__init__(
            self, "DR11LyaAuto",
            'simplemc/data/chi2_surface_dr11_baseline_fit.txt', 4, fidTheory,
            2.34)
コード例 #24
0
 def __init__(self):
     # fiducial cosmology for Lya data.
     # Taken from https://github.com/igmhub/picca/blob/master/data/deSainteAgatheetal2019/auto_alone_stdFit/auto_alone_stdFit..ap.at.scan.dat
     # fiducial model -- see Table 2 of Victoria's paper
     obh2 = 0.02222
     h = 0.6731
     Om = 0.1426 / h**2
     mnu = 0.06  # rd=147.33
     fidTheory = LCDMCosmology(obh2, Om, h, mnu)
     TabulatedBAOLikelihood.__init__(
         self,
         "DR14LyaAuto",
         'simplemc/data/deSainteAgatheetal2019_ap_at_scan.dat',
         2,
         fidTheory,
         2.34,
         aperp_col=1,
         apar_col=0,
         skiprows=1)
コード例 #25
0
 def __init__(self):
     # fiducial cosmology for Lya data.
     # Taken from  https://github.com/igmhub/picca/tree/master/data/Blomqvistetal2019/cross_alone_stdFit
     # fiducial model -- double check
     obh2 = 0.02222
     h = 0.6731
     Om = 0.1426 / h**2
     mnu = 0.06  # rd=147.33
     fidTheory = LCDMCosmology(obh2, Om, h, mnu)
     # File from 5/16 from Nicolas.
     TabulatedBAOLikelihood.__init__(
         self,
         "DR14LyaCross",
         'simplemc/data/Blomqvistetal2019_ap_at_scan.dat',
         2,
         fidTheory,
         2.34,
         aperp_col=1,
         apar_col=0,
         skiprows=1)
コード例 #26
0
 def updateParams(self, pars):
     ok = LCDMCosmology.updateParams(self, pars)
     if not ok:
         return False
     for p in pars:
         if p.name == "Ok":
             self.Ok = p.value
             # se comments to BaseCosmology class
             # in short, WE hold the Ok parameter
             # (maybe you want to parameterize it differently),
             # but the BaseCosmology class needs to know about Ok in order
             # to get Da and its sin/sinhs right.
             self.setCurvature(self.Ok)
             if (abs(self.Ok) > 1.0):
                 return False
     if self.zeroDE:
         # set curvature so that Ode=0
         self.Ok = 1 - self.Om
         self.setCurvature(self.Ok)
     return True
コード例 #27
0
 def updateParams(self, pars):
     ok = LCDMCosmology.updateParams(self, pars)
     if not ok:
         return False
     for p in pars:
         if p.name == "w":
             self.w0 = p.value
         elif p.name == "wa":
             self.wa = p.value
         elif p.name == "Ok":
             self.Ok = p.value
             self.setCurvature(self.Ok)
             if (abs(self.Ok) > 1.0):
                 return False
         elif p.name == "q0":
             self.q0 = p.value
         elif p.name == "j0":
             self.j0 = p.value
         elif p.name == "Omega0":
             self.Omega0 = p.value
     return True
コード例 #28
0
 def freeParameters(self):
     l = LCDMCosmology.freeParameters(self)
     if (self.varyw): l.append(dw_par)
     if (self.varyOk): l.append(Ok_par)
     return l
コード例 #29
0
 def prior_loglike(self):
     return (-self.Ok**2 /
             (2 * self.Ok_prior**2
              )  # A 0.1 prior in Ok as discussed at the telecon
             + LCDMCosmology.prior_loglike(self))
コード例 #30
0
 def freeParameters(self):
     l = LCDMCosmology.freeParameters(self)
     if (self.varyalpha): l.append(alpha_par)
     return l