Maintenance will be performed on git.ligo.org, chat.ligo.org, containers.ligo.org, and docs.ligo.org on Tuesday 26 May 2020 starting at approximately 10am CDT. It is expected to take around 30 minutes and will involve a short period of downtime, around 5 minutes, towards the end of the maintenance period. Please address any questions, comments, or concerns to uwm-help@cgca.uwm.edu.

Commit bd951ba5 authored by Leo Pound Singer's avatar Leo Pound Singer

Add cosmological prior docstrings

parent 14b291a7
Pipeline #49553 failed with stages
in 9 minutes and 30 seconds
Cosmology (`ligo.skymap.postprocess.cosmology`)
===============================================
.. automodule:: ligo.skymap.postprocess.cosmology
:members:
:show-inheritance:
......@@ -7,6 +7,7 @@ Sky Map Postprocessing (`ligo.skymap.postprocess`)
:maxdepth: 1
contour
cosmology
ellipse
find_injection
util
......@@ -16,6 +16,11 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
"""
Cosmology-related utilities.
All functions in this module use the WMAP9 cosmological parameters.
"""
import numpy as np
import astropy.cosmology
......@@ -26,8 +31,23 @@ cosmo = astropy.cosmology.default_cosmology.get_cosmology_from_string(
def dVC_dVL_for_z(z):
"""Ratio between the comoving volume element dVC and a
DL**2 prior at redshift z."""
r'''Ratio, :math:`\mathrm{d}V_C / \mathrm{d}V_L`, between the comoving
volume element and a naively Euclidean volume element in luminosity
distance space; given as a function of redshift.
Given the differential comoving volume per unit redshift,
:math:`\mathrm{d}V_C / \mathrm{d}z`, and the derivative of luminosity
distance in terms of redshift, :math:`\mathrm{d}D_L / \mathrm{d}z`, this is
expressed as:
.. math::
\frac{\mathrm{d}V_C}{\mathrm{d}V_L} =
\frac{\mathrm{d}V_C}{\mathrm{d}z}
\left(
{D_L}^2 \frac{\mathrm{d}D_L}{\mathrm{d}z}
\right)^{-1}.
'''
Ok0 = cosmo.Ok0
DH = cosmo.hubble_distance
DM_by_DH = (cosmo.comoving_transverse_distance(z) / DH).value
......@@ -47,9 +67,12 @@ def dVC_dVL_for_z(z):
@np.vectorize
def z_for_DL(DL):
"""Redshift as a function of luminosity distance in Mpc."""
return astropy.cosmology.z_at_value(
cosmo.luminosity_distance, DL * u.Mpc)
def dVC_dVL_for_DL(DL):
"""Same as :meth:`dVC_dVL_for_z`, but as a function of luminosity
distance."""
return dVC_dVL_for_z(z_for_DL(DL))
......@@ -16,7 +16,26 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
"""
Generate Chebyshev coefficients for BAYESTAR uniform-in-comoving-volume prior.
This is a lookup table for the BAYESTAR uniform-in-comoving-volume prior. The
BAYESTAR posterior distribution has a builtin prior that is uniform in naively
Euclidean luminosity distance space (proportional to DL^2). When we want to
switch to a prior that is uniform in comoving volume, we have to multiply by
the factor dVC/dVL, the differential comoving volume per unit Euclidean
luminosity volume.
The lookup table is in terms of the *natural logarithm* of the luminosity
distance and provides the *natural logarithm* of dVC/dVL. It consists of the
following constants:
dVC_dVL_tmin, dVC_dVL_tmax, dVC_dVL_dt
Minimum, maximum, and step size for a uniform grid in t = log(DL),
such that t[i] = dVC_dVL_tmin + i * dVC_dVL_dt.
dVC_dVL_data
Tabulated values of y = f(t) = log(dVC/dVL), such that y[i] = f(t[i]).
dVC_dVL_high_z_slope, dVC_dVL_high_z_intercept
Linear fit for extrapolating f(t) for t>dVC_dVL_tmax.
"""
import argparse
import os
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment