Beispiel #1
0
    def testNonFlatW0(self):
        """
        Test the evolution of H and Omega_i as a function of redshift for non-flat
        models with constant w
        """

        H0 = 60.0

        for Om0 in np.arange(start=0.15, stop=0.76, step=0.3):
            for Ok0 in np.arange(start=0.1, stop=0.11, step=0.2):
                for w0 in np.arange(start=-1.1, stop=-0.89, step=0.2):

                    universe = CosmologyObject(H0=H0, Om0=Om0, Ok0=Ok0, w0=w0)

                    Og0 = universe.OmegaPhotons(redshift=0.0)
                    Onu0 = universe.OmegaNeutrinos(redshift=0.0)

                    self.assertAlmostEqual(universe.OmegaMatter(redshift=0.0),
                                           Om0, 10)
                    self.assertAlmostEqual(
                        Ok0, universe.OmegaCurvature(redshift=0.0), 10)
                    self.assertAlmostEqual(
                        1.0 - Om0 - Ok0 -
                        universe.OmegaDarkEnergy(redshift=0.0), Og0 + Onu0, 10)

                    self.assertAlmostEqual(universe.H(redshift=0.0), H0, 10)

                    Om0 = universe.OmegaMatter(redshift=0.0)
                    Ode0 = universe.OmegaDarkEnergy(redshift=0.0)

                    for zz in np.arange(start=0.0, stop=4.0, step=2.0):

                        self.assertAlmostEqual(w0, universe.w(redshift=zz), 6)

                        Hcontrol, OmControl, OdeControl, OgControl, OnuControl, \
                        OkControl = cosmologicalOmega(zz, H0, Om0, Og0=Og0, Onu0=Onu0,
                                                      w0=w0, wa=0.0, Ode0=Ode0)

                        self.assertAlmostEqual(
                            OmControl, universe.OmegaMatter(redshift=zz), 6)
                        self.assertAlmostEqual(
                            OdeControl, universe.OmegaDarkEnergy(redshift=zz),
                            6)
                        self.assertAlmostEqual(
                            OgControl, universe.OmegaPhotons(redshift=zz), 6)
                        self.assertAlmostEqual(
                            OnuControl, universe.OmegaNeutrinos(redshift=zz),
                            6)
                        self.assertAlmostEqual(
                            OkControl, universe.OmegaCurvature(redshift=zz), 6)
                        self.assertAlmostEqual(Hcontrol,
                                               universe.H(redshift=zz), 6)

                    del universe
    def testFlatW0Wa(self):
        """
        Test the evolution of H and Omega_i as a function of redshift for
        flat models with w = w0 + wa * z / (1 + z)
        """

        H0 = 96.0
        for Om0 in numpy.arange(start=0.1, stop=0.95, step=0.4):
            for w0 in numpy.arange(start=-1.1, stop=-0.89, step=0.2):
                for wa in numpy.arange(start=-0.1, stop=0.11, step=0.2):

                    universe = CosmologyObject(H0=H0, Om0=Om0, w0=w0, wa=wa)

                    Og0 = universe.OmegaPhotons(redshift=0.0)
                    Onu0 = universe.OmegaNeutrinos(redshift=0.0)

                    self.assertAlmostEqual(universe.OmegaMatter(redshift=0.0),
                                           Om0, 10)
                    self.assertAlmostEqual(
                        1.0 - Om0 - universe.OmegaDarkEnergy(redshift=0.0),
                        Og0 + Onu0, 6)
                    self.assertAlmostEqual(universe.H(redshift=0.0), H0, 10)
                    self.assertEqual(universe.OmegaCurvature(), 0.0)

                    Om0 = universe.OmegaMatter(redshift=0.0)
                    Ode0 = universe.OmegaDarkEnergy(redshift=0.0)

                    for zz in numpy.arange(start=0.0, stop=4.1, step=2.0):

                        wControl = w0 + wa * (1.0 - 1.0 / (1.0 + zz))
                        self.assertAlmostEqual(wControl,
                                               universe.w(redshift=zz), 6)

                        Hcontrol, OmControl, OdeControl, OgControl, OnuControl, \
                            OkControl = cosmologicalOmega(zz, H0, Om0, Og0=Og0, Onu0=Onu0,
                                                     w0=w0, wa=wa)

                        self.assertAlmostEqual(
                            OmControl, universe.OmegaMatter(redshift=zz), 6)
                        self.assertAlmostEqual(
                            OdeControl, universe.OmegaDarkEnergy(redshift=zz),
                            6)
                        self.assertAlmostEqual(
                            OgControl, universe.OmegaPhotons(redshift=zz), 6)
                        self.assertAlmostEqual(
                            OnuControl, universe.OmegaNeutrinos(redshift=zz),
                            6)
                        self.assertAlmostEqual(Hcontrol,
                                               universe.H(redshift=zz), 6)

                    del universe
Beispiel #3
0
    def testNonFlatW0Wa(self):
        """
        Test the evolution of H and Omega_i as a function of redshift for non-flat
        models with w = w0 + wa * z / (1+z)
        """

        H0 = 60.0

        for Om0 in np.arange(start=0.15, stop=0.76, step=0.3):
            for Ok0 in np.arange(start=-0.1, stop=0.11, step=0.2):
                for w0 in np.arange(start=-1.1, stop=-0.89, step=0.2):
                    for wa in np.arange(start=-0.1, stop=0.15, step=0.2):

                        universe = CosmologyObject(H0=H0, Om0=Om0, Ok0=Ok0, w0=w0, wa=wa)

                        Og0 = universe.OmegaPhotons(redshift=0.0)
                        Onu0 = universe.OmegaNeutrinos(redshift=0.0)

                        self.assertAlmostEqual(universe.OmegaMatter(redshift=0.0), Om0, 10)
                        self.assertAlmostEqual(Ok0, universe.OmegaCurvature(redshift=0.0), 10)
                        self.assertAlmostEqual(1.0 - Om0 - Ok0 - universe.OmegaDarkEnergy(redshift=0.0),
                                               Og0 + Onu0, 10)
                        self.assertAlmostEqual(universe.H(redshift=0.0), H0, 10)

                        Om0 = universe.OmegaMatter(redshift=0.0)
                        Ode0 = universe.OmegaDarkEnergy(redshift=0.0)

                        for zz in np.arange(start=0.0, stop=4.0, step=2.0):

                            wControl = w0 + wa*(1.0 - 1.0/(1.0+zz))
                            self.assertAlmostEqual(wControl, universe.w(redshift=zz), 6)

                            Hcontrol, OmControl, OdeControl, OgControl, OnuControl, \
                            OkControl = cosmologicalOmega(zz, H0, Om0, Og0=Og0, Onu0=Onu0,
                                                          w0=w0, wa=wa, Ode0=Ode0)

                            self.assertAlmostEqual(OmControl, universe.OmegaMatter(redshift=zz), 6)
                            self.assertAlmostEqual(OdeControl, universe.OmegaDarkEnergy(redshift=zz), 6)
                            self.assertAlmostEqual(OgControl, universe.OmegaPhotons(redshift=zz), 6)
                            self.assertAlmostEqual(OnuControl, universe.OmegaNeutrinos(redshift=zz), 6)
                            self.assertAlmostEqual(OkControl, universe.OmegaCurvature(redshift=zz), 6)
                            self.assertAlmostEqual(Hcontrol, universe.H(redshift=zz), 6)

                        del universe
    def testFlatW0(self):
        """
        Test the evolution of H and Omega_i as a function of redshift for flat
        models with constant w
        """

        H0 = 96.0
        for Om0 in numpy.arange(start=0.1, stop=0.95, step=0.4):
            for w0 in numpy.arange(start=-1.5, stop=-0.49, step=1.0):

                universe = CosmologyObject(H0=H0, Om0=Om0, w0=w0)

                Og0 = universe.OmegaPhotons(redshift=0.0)
                Onu0 = universe.OmegaNeutrinos(redshift=0.0)

                self.assertAlmostEqual(universe.OmegaMatter(redshift=0.0), Om0, 10)
                self.assertAlmostEqual(1.0 - Om0 - universe.OmegaDarkEnergy(redshift=0.0), Og0+Onu0, 6)
                self.assertAlmostEqual(universe.H(redshift=0.0),H0,10)
                self.assertEqual(universe.OmegaCurvature(),0.0)

                Om0 = universe.OmegaMatter(redshift=0.0)
                Ode0 = universe.OmegaDarkEnergy(redshift=0.0)

                for zz in numpy.arange(start=0.0, stop=4.1, step=2.0):

                   self.assertAlmostEqual(w0, universe.w(redshift=zz), 6)

                   Hcontrol, OmControl, OdeControl, OgControl, OnuControl, \
                       OkControl = cosmologicalOmega(zz, H0, Om0, Og0=Og0, Onu0=Onu0,
                                                w0=w0, wa=0.0)

                   self.assertAlmostEqual(OmControl, universe.OmegaMatter(redshift=zz), 6)
                   self.assertAlmostEqual(OdeControl, universe.OmegaDarkEnergy(redshift=zz), 6)
                   self.assertAlmostEqual(OgControl, universe.OmegaPhotons(redshift=zz), 6)
                   self.assertAlmostEqual(OnuControl, universe.OmegaNeutrinos(redshift=zz), 6)
                   self.assertAlmostEqual(Hcontrol, universe.H(redshift=zz), 6)

                del universe