diff options
author | Aaron LI <aly@aaronly.me> | 2017-10-04 12:07:15 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-10-04 12:07:15 +0800 |
commit | ae1ffdaa01cf072e5e1aa69228ea7514ae8db23c (patch) | |
tree | 0e9e6710c4b10e781dd627b296756341e97b328b | |
parent | 353b06efc5a1e17a278ccc882c10c5545564fd69 (diff) | |
download | fg21sim-ae1ffdaa01cf072e5e1aa69228ea7514ae8db23c.tar.bz2 |
utils/cosmology: Add scalar spectral index "ns"
-rw-r--r-- | fg21sim/configs/00-general.conf.spec | 2 | ||||
-rw-r--r-- | 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) |