geff.utility.cosmo
This module defines constants and functions which are often times encountered in cosmology. These are primarily used in GEFF.tools.gw
1r""" 2This module defines constants and functions which are often times encountered in cosmology. These are primarily used in `GEFF.tools.gw` 3""" 4import natpy as nat 5import numpy as np 6import pandas as pd 7import os 8 9basepath = os.path.dirname(os.path.abspath(__file__)) 10 11nat.set_active_units("HEP") 12 13#constants 14G : float = 6.67430e-11 * nat.convert(nat.m**3 * nat.kg**(-1) * nat.s**(-2), nat.GeV**(-2)) 15"""Newtons constant in GeV.""" 16M_pl : float = (8*np.pi*G)**(-1/2) # reduced Planck mass in GeV 17"""The reduced Planck mass in GeV.""" 18 19#Conversions 20gev_to_hz : float = nat.convert(nat.GeV, nat.Hz) 21"""The conversion factor between Hz and GeV.""" 22 23#Planck results 24T_0 : float = 2.7255 * nat.convert(nat.K, nat.GeV) 25"""The temperatur of CMB photons today (in GeV).""" 26h : float = 0.674 27"""The reduced Hubble parameter $h$ (from [Planck 2018](https://arxiv.org/abs/1807.06209)).""" 28H0 : float = h*100*nat.convert(nat.km * nat.s**(-1) * nat.Mpc**(-1), nat.GeV) 29"""The Hubble rate today (in GeV).""" 30 31gtab = pd.read_table(os.path.join(basepath, "../data/eff_dof.dat"), sep=" ", comment="#").values.T 32gdic = {"T":gtab[0,:],"f":gtab[1,:],"grho":gtab[2,:], "gs":gtab[3,:]} 33 34def g_rho(T : float) -> float: 35 """ 36 Effective number of relativistic degrees of freedom as a function of temperature, $g_{*}(T)$. 37 38 Data is taken from [2005.03544](https://arxiv.org/abs/2005.03544). 39 """ 40 return np.interp(T, gdic["T"], gdic["grho"]) 41 42def g_s(T : float) -> float: 43 """ 44 Effective number of entropic degrees of freedom as a function of temperature, $g_{*,S}(T)$. 45 46 Data is taken from [2005.03544](https://arxiv.org/abs/2005.03544). 47 """ 48 return np.interp(T, gdic["T"], gdic["gs"]) 49 50def g_rho_freq(f : float) -> float: 51 """ 52 Effective number of relativistic degrees of freedom as a function of frequency, $g_{*}(T(f))$. 53 54 Data is taken from [2005.03544](https://arxiv.org/abs/2005.03544). 55 """ 56 return np.interp(f, gdic["f"], gdic["grho"]) 57 58def g_s_freq(f : float) -> float: 59 """ 60 Effective number of entropic degrees of freedom as a function of frequency, $g_{*,S}(T(f))$. 61 62 Data is taken from [2005.03544](https://arxiv.org/abs/2005.03544). 63 """ 64 return np.interp(f, gdic["f"], gdic["gs"]) 65 66 67 68g_rho_0 : float = g_rho(T_0) 69"""The effective number of relativistic degrees of freedom today, $g_{*}(T_0)$.""" 70g_s_0 : float = g_s(T_0) 71"""The effective number of entropic degrees of freedom today, $g_{*,S}(T_0)$.""" 72omega_r : float = np.pi**2*g_rho_0/(90*M_pl**2*H0**2)*T_0**4 73"""The density parameter for radiation today, $\Omega_r$.""" 74 75feq = 2.1e-17 76"""Frequency corresponding to mattter-radiation equality"""
Newtons constant in GeV.
The reduced Planck mass in GeV.
The conversion factor between Hz and GeV.
The temperatur of CMB photons today (in GeV).
The reduced Hubble parameter $h$ (from Planck 2018).
The Hubble rate today (in GeV).
35def g_rho(T : float) -> float: 36 """ 37 Effective number of relativistic degrees of freedom as a function of temperature, $g_{*}(T)$. 38 39 Data is taken from [2005.03544](https://arxiv.org/abs/2005.03544). 40 """ 41 return np.interp(T, gdic["T"], gdic["grho"])
Effective number of relativistic degrees of freedom as a function of temperature, $g_{*}(T)$.
Data is taken from 2005.03544.
43def g_s(T : float) -> float: 44 """ 45 Effective number of entropic degrees of freedom as a function of temperature, $g_{*,S}(T)$. 46 47 Data is taken from [2005.03544](https://arxiv.org/abs/2005.03544). 48 """ 49 return np.interp(T, gdic["T"], gdic["gs"])
Effective number of entropic degrees of freedom as a function of temperature, $g_{*,S}(T)$.
Data is taken from 2005.03544.
51def g_rho_freq(f : float) -> float: 52 """ 53 Effective number of relativistic degrees of freedom as a function of frequency, $g_{*}(T(f))$. 54 55 Data is taken from [2005.03544](https://arxiv.org/abs/2005.03544). 56 """ 57 return np.interp(f, gdic["f"], gdic["grho"])
Effective number of relativistic degrees of freedom as a function of frequency, $g_{*}(T(f))$.
Data is taken from 2005.03544.
59def g_s_freq(f : float) -> float: 60 """ 61 Effective number of entropic degrees of freedom as a function of frequency, $g_{*,S}(T(f))$. 62 63 Data is taken from [2005.03544](https://arxiv.org/abs/2005.03544). 64 """ 65 return np.interp(f, gdic["f"], gdic["gs"])
Effective number of entropic degrees of freedom as a function of frequency, $g_{*,S}(T(f))$.
Data is taken from 2005.03544.
The effective number of relativistic degrees of freedom today, $g_{*}(T_0)$.
The effective number of entropic degrees of freedom today, $g_{*,S}(T_0)$.
The density parameter for radiation today, $\Omega_r$.
Frequency corresponding to mattter-radiation equality