From ae1ffdaa01cf072e5e1aa69228ea7514ae8db23c Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 4 Oct 2017 12:07:15 +0800 Subject: utils/cosmology: Add scalar spectral index "ns" --- fg21sim/configs/00-general.conf.spec | 2 ++ fg21sim/utils/cosmology.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fg21sim/configs/00-general.conf.spec b/fg21sim/configs/00-general.conf.spec index ecf1d17..fd75450 100644 --- a/fg21sim/configs/00-general.conf.spec +++ b/fg21sim/configs/00-general.conf.spec @@ -116,6 +116,8 @@ OmegaM0 = float(default=0.27, min=0.0, max=1.0) Omegab0 = float(default=0.046, min=0.0, max=1.0) # 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) # Configurations for initialization/reconfiguration of the `logging` module diff --git a/fg21sim/utils/cosmology.py b/fg21sim/utils/cosmology.py index ab9637d..0ec8f8f 100644 --- a/fg21sim/utils/cosmology.py +++ b/fg21sim/utils/cosmology.py @@ -63,7 +63,9 @@ class Cosmology: Ode0 : float Density parameter of dark energy at present day sigma8 : float - Present-day rms density fluctuation on a scale of 8 h^-1 [Mpc]. + Present-day rms density fluctuation on a scale of 8 h^-1 [Mpc] + ns : float + Scalar spectral index Internal attributes ------------------- @@ -75,15 +77,15 @@ 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): - self.setup(H0=H0, Om0=Om0, Ob0=Ob0, sigma8=sigma8) + 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 setup(self, **kwargs): """ Setup/update the parameters of the cosmology model. """ for key, value in kwargs.items(): - if key in ["H0", "Om0", "Ob0", "sigma8"]: + if key in ["H0", "Om0", "Ob0", "sigma8", "ns"]: setattr(self, key, value) else: raise ValueError("unknown parameter: %s" % key) -- cgit v1.2.2