def distmod_constant_curve(Om, Ok, h0, z): """ Distance modulus for a curved universe with a cosmological constant :param Om: matter content :param Ok: curvature :param h0: hubble constant :param z: redshift :return: theano array of dist. mods. """ # Hubble distance dh = sol * 1.e-3 / h0 # Comoving distance dc = dh * gauss_kronrod(integrand_constant_curve, z, parameters=[Om, Ok]) # Pre-compute the sqrt sqrtOk = T.sqrt(T.abs_(Ok)) # Theno does not have exhaustive # control flow, so we have to compute them all # Start here dl = ifelse(T.eq(Ok,0.), (1+z) * dc, 0. * (1+z) * dc) # The above statement is zero if the # condition fails, so we add on to it dl += ifelse(T.gt(Ok,0), (1+z) * dh / sqrtOk * T.sinh(sqrtOk * dc / dh), 0. * (1+z) * dc) # same idea as above dl += ifelse(T.lt(Ok,0), (1+z) * dh / sqrtOk * T.sin(sqrtOk * dc / dh), 0. * (1+z) * dc) return 5. * T.log10(dl) + 25. # dist mod
def distmod_constant_flat(Om, h0, z): """ Distance modulus for a flat universe with a cosmological constant :param Om: matter content :param h0: hubble constant :param z: redshift :return: theano array of dist. mods. """ # Hubble distance dh = sol * 1.e-3 / h0 # comoving distance dc = dh * gauss_kronrod(integrand_constant_flat, z, parameters=[Om]) # luminosity distance dl = (1 + z) * dc return 5. * T.log10(dl) + 25. # dist mod.
def distmod_constant_flat(Om, h0, z): """ Distance modulus for a flat universe with a cosmological constant :param Om: matter content :param h0: hubble constant :param z: redshift :return: theano array of dist. mods. """ # Hubble distance dh = sol * 1.0e-3 / h0 # comoving distance dc = dh * gauss_kronrod(integrand_constant_flat, z, parameters=[Om]) # luminosity distance dl = (1 + z) * dc return 5.0 * T.log10(dl) + 25.0 # dist mod.
def distmod_constant_curve(Om, Ok, h0, z): """ Distance modulus for a curved universe with a cosmological constant :param Om: matter content :param Ok: curvature :param h0: hubble constant :param z: redshift :return: theano array of dist. mods. """ # Hubble distance dh = sol * 1.0e-3 / h0 # Comoving distance dc = dh * gauss_kronrod(integrand_constant_curve, z, parameters=[Om, Ok]) # Pre-compute the sqrt sqrtOk = T.sqrt(T.abs_(Ok)) # Theno does not have exhaustive # control flow, so we have to compute them all # Start here dl = ifelse(T.eq(Ok, 0.0), (1 + z) * dc, 0.0 * (1 + z) * dc) # The above statement is zero if the # condition fails, so we add on to it dl += ifelse(T.gt(Ok, 0), (1 + z) * dh / sqrtOk * T.sinh(sqrtOk * dc / dh), 0.0 * (1 + z) * dc) # same idea as above dl += ifelse(T.lt(Ok, 0), (1 + z) * dh / sqrtOk * T.sin(sqrtOk * dc / dh), 0.0 * (1 + z) * dc) return 5.0 * T.log10(dl) + 25.0 # dist mod