Cosmology¶
darksirens.cosmology.cosmo module¶
- class darksirens.cosmology.cosmo.Cosmology(params)¶
Bases:
object
- camb_basis(cosmopars)¶
Checks for \(h\) and \(\Omega_m\) in the parameters passed and replaces them with \(H_0\) and \(\Omega_ch^2\).
- Parameters
cosmopars (dictionary) – cosmological parameters passed by the user.
- Returns
The modified cosmopars dictionary.
- Return type
dictionary
- get_cosmo_funcs(inipars)¶
Gets cosmological functions using camb.
- Parameters
inipars (dictionary) – parameters passed to camb to get cosmological results.
- Returns
Dictionary of cosmological functions.
- Return type
dictionary
darksirens.cosmology.lensing module¶
- class darksirens.cosmology.lensing.Lensing(cosmo)¶
Bases:
object
This class manages the weak-lensing corrections to GW observations. It depends on the cosmology.
- draw_magnification(z, size=None)¶
Randomly draws the magnification mu of an event, according to a shifted log-normal distribution. In other words, the quantity \(X = \ln(\mu - \mu_{\rm min})\) follows a normal distribution. The parameters of the distribution are chosen so as to ensure that \(\langle\mu\rangle = 1\), in agreement with the magnification theorem; and \(\langle\mu^2\rangle - \langle\mu\rangle^2 = 4 \sigma_\kappa^2\).
- Parameters
z – the redshift of the event.
size – output shape of the distribution drawn from (np.random.normal())
- get_minimal_magnification(cosmo, z_max=100, n_sample=1000)¶
Generates the minimal magnification up to \(z_{\rm max}\) by interpolating a sample of \(n_{\rm sample}\) elements.
- Parameters
cosmo – instance of the Cosmology class.
z_max (float) – maximum redshift for the magnification.
n_sample (integer) – number of elements in the sample to be interpolated.
- Returns
The minimal magnification.
- Return type
interp1d
- pdf_magnification(mu, z)¶
Empirical PDF for the magnification at redshift \(z\). This is only for testing purposes.
- Parameters
mu (float) – the magnification.
z (float) – the redshift of the event.
- std_dev_convergence(z)¶
Standard deviation of the weak-lensing convergence. The expression is an empirical fit to the weak-lensing prediction, in the flat sky and Limber’s approximation, and with a cosmology such that \(h=0.674\), \(\Omega_m=0.315\) and \(\Omega_b=0.05\).
Warning: To be changed depending on the cosmology. Run the notebook “variance_convergence” with the cosmology of your choice and replace the best-fit parameters a, b, c, d hereafter.
- Parameters
z (float) – the redshift of the event.