From a70d36928d0a8d510210e79a21a1ae06bf412963 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 4 Oct 2017 15:54:00 +0800 Subject: utils/cosmology.py: Add parameter Tcmb0 [K] --- fg21sim/configs/00-general.conf.spec | 6 ++++-- fg21sim/utils/cosmology.py | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/fg21sim/configs/00-general.conf.spec b/fg21sim/configs/00-general.conf.spec index 8e4ac59..8bd79de 100644 --- a/fg21sim/configs/00-general.conf.spec +++ b/fg21sim/configs/00-general.conf.spec @@ -108,13 +108,15 @@ manifest = string(default=None) # Cosmological parameters # References: Komatsu et al. 2011, ApJS, 192, 18; Tab.(1) [cosmology] -# Hubble constant at z=0 [ km/s/Mpc ] +# Hubble constant at z=0; [km/s/Mpc] H0 = float(default=71.0, min=0.0) # Density of non-relativistic matter in units of the critical density at z=0 OmegaM0 = float(default=0.27, min=0.0, max=1.0) # Density of the baryon at present day Omegab0 = float(default=0.046, min=0.0, max=1.0) -# Present-day rms density fluctuations on a scale of 8 h^-1 Mpc +# Present-day CMB temperature; [K] +Tcmb0 = float(default=2.725) +# Present-day rms density fluctuations on a scale of 8 h^-1 [Mpc] sigma8 = float(default=0.81, min=0.0) # Scalar spectral index ns = float(default=0.96, min=0.0) diff --git a/fg21sim/utils/cosmology.py b/fg21sim/utils/cosmology.py index 0ec8f8f..21db450 100644 --- a/fg21sim/utils/cosmology.py +++ b/fg21sim/utils/cosmology.py @@ -62,6 +62,9 @@ class Cosmology: Density parameter of baryon at present day Ode0 : float Density parameter of dark energy at present day + Tcmb0 : float + Present-day CMB temperature + Unit: [K] sigma8 : float Present-day rms density fluctuation on a scale of 8 h^-1 [Mpc] ns : float @@ -77,21 +80,23 @@ class Cosmology: # Present day (z=0) growth factor _growth_factor0 = None - def __init__(self, H0=71.0, Om0=0.27, Ob0=0.046, sigma8=0.81, ns=0.96): - self.setup(H0=H0, Om0=Om0, Ob0=Ob0, sigma8=sigma8, ns=ns) + def __init__(self, H0=71.0, Om0=0.27, Ob0=0.046, + Tcmb0=2.725, sigma8=0.81, ns=0.96): + self.setup(H0=H0, Om0=Om0, Ob0=Ob0, Tcmb0=Tcmb0, sigma8=sigma8, ns=ns) def setup(self, **kwargs): """ Setup/update the parameters of the cosmology model. """ for key, value in kwargs.items(): - if key in ["H0", "Om0", "Ob0", "sigma8", "ns"]: + if key in ["H0", "Om0", "Ob0", "Tcmb0", "sigma8", "ns"]: setattr(self, key, value) else: raise ValueError("unknown parameter: %s" % key) self.Ode0 = 1.0 - self.Om0 - self._cosmo = FlatLambdaCDM(H0=self.H0, Om0=self.Om0, Ob0=self.Ob0) + self._cosmo = FlatLambdaCDM(H0=self.H0, Om0=self.Om0, Ob0=self.Ob0, + Tcmb0=self.Tcmb0) self._growth_factor0 = None logger.info("Setup cosmology with: {0}".format(kwargs)) -- cgit v1.2.2