1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """
17 Cosmography based on Hogg 1998 (astro-ph/9905116)
18 Cosmological parameters taken from WMAP 7 year BAO + H0 ML value (arXiv:1001.4538)
19 """
20
21 from numpy import pi, sinh, arcsinh
22 from scipy.integrate import quad
23 from scipy.optimize import newton
24
25 from lal import PC_SI as LAL_PC_SI
26 from lal import C_SI as LAL_C_SI
27
28 h0 = 0.703
29 H0_SI = h0 * 100000 / (1000000 * LAL_PC_SI)
30 DH_SI = LAL_C_SI / H0_SI
31 OmegaL = 0.729
32 OmegaM = 0.271
33 OmegaR = 0
34
36 """
37 Integrand used in many cosmography integrals. 1 / E(z) in Hogg's notation.
38 """
39 return (OmegaM * (1 + z)**3 + OmegaR * (1 + z)**2 + OmegaL)**-0.5
40
42 """
43 Comoving distance (transverse) at z. Hard-coded for OmegaR = 0.
44 """
45 return DH_SI * quad(Einv, 0, z)[0]
46
48 """
49 Luminosity distance
50 """
51 return DM(z) * (1 + z)
52
54 """
55 Compute the redshift from a luminosity distance.
56 Use the Newton-Raphson refinement method on a first-order guess.
57 """
58 return newton(lambda z: DL(z) - DL0, DL0 / DH_SI)
59
61 """
62 Different volume element per unit redshift. Hard-coded for OmegaR = 0.
63 """
64 return DH_SI * DM(z)**2 * Einv(z) * 4 * pi
65
67 """
68 Analytical integration of dVdz. Hard-coded for OmegaR = 0.
69 Double precision craps out below about 100 kpc (z=2.3e-6).
70 """
71 tmpDM = DM(z)
72 return 4 * pi / 3 * tmpDM * tmpDM * tmpDM
73
75 """
76 Analytical integration of dVdz. Hard-coded for OmegaR = 0.
77 Sped up for the case that you have D rather than (or in addition to) z.
78 Double precision craps out below about 100 kpc (z=2.3e-6).
79 """
80 tmpDM = D / (1 + (z or compute_redshift(D)))
81 return 4 * pi / 3 * tmpDM * tmpDM * tmpDM
82