aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/utils
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-10-04 12:07:15 +0800
committerAaron LI <aly@aaronly.me>2017-10-04 12:07:15 +0800
commitae1ffdaa01cf072e5e1aa69228ea7514ae8db23c (patch)
tree0e9e6710c4b10e781dd627b296756341e97b328b /fg21sim/utils
parent353b06efc5a1e17a278ccc882c10c5545564fd69 (diff)
downloadfg21sim-ae1ffdaa01cf072e5e1aa69228ea7514ae8db23c.tar.bz2
utils/cosmology: Add scalar spectral index "ns"
Diffstat (limited to 'fg21sim/utils')
-rw-r--r--fg21sim/utils/cosmology.py10
1 files changed, 6 insertions, 4 deletions
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)