def testComovingDistance(self): """ Test comoving distance calculation Note: this is comoving distance defined as X in the FRW metric ds^2 = -c^2 dt^2 + a^2 dX^2 + sin^2(X) dOmega^2 where spatial curvature is accounted for in the sin function """ H0 = 73.0 for Om0 in np.arange(start=0.15, stop=0.56, step=0.2): for Ok0 in np.arange(start=-0.1, stop=0.11, step=0.2): for w0 in np.arange(start=-1.1, stop=-0.85, step=0.2): for wa in np.arange(start=-0.1, stop=0.115, step=0.02): universe = CosmologyObject(H0=H0, Om0=Om0, Ok0=Ok0, w0=w0, wa=wa) Og0 = universe.OmegaPhotons() Onu0 = universe.OmegaNeutrinos() Ode0 = universe.OmegaDarkEnergy() for zz in np.arange(start=0.1, stop=4.2, step=2.0): comovingControl = universe.comovingDistance(redshift=zz) comovingTest = \ self.speedOfLight*scipy.integrate.quad(comovingDistanceIntegrand, 0.0, zz, args=(H0, Om0, Ode0, Og0, Onu0, w0, wa))[0] self.assertAlmostEqual(comovingControl/comovingTest, 1.0, 4)
def testComovingDistance(self): """ Test comoving distance calculation Note: this is comoving distance defined as X in the FRW metric ds^2 = -c^2 dt^2 + a^2 dX^2 + sin^2(X) dOmega^2 where spatial curvature is accounted for in the sin function """ H0 = 73.0 for Om0 in numpy.arange(start=0.15, stop=0.56, step=0.2): for Ok0 in numpy.arange(start=-0.1, stop=0.11, step=0.2): for w0 in numpy.arange(start=-1.1, stop=-0.85, step=0.2): for wa in numpy.arange(start=-0.1, stop=0.115, step=0.02): universe = CosmologyObject(H0=H0, Om0=Om0, Ok0=Ok0, w0=w0, wa=wa) Og0 = universe.OmegaPhotons() Onu0 = universe.OmegaNeutrinos() Ode0 = universe.OmegaDarkEnergy() for zz in numpy.arange(start=0.1, stop=4.2, step=2.0): comovingControl = universe.comovingDistance( redshift=zz) comovingTest = \ self.speedOfLight*scipy.integrate.quad(comovingDistanceIntegrand, 0.0, zz, args=(H0, Om0, Ode0, Og0, Onu0, w0, wa))[0] self.assertAlmostEqual( comovingControl / comovingTest, 1.0, 4)