diff options
author | Aaron LI <aly@aaronly.me> | 2017-06-23 20:38:39 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2017-06-23 20:38:39 +0800 |
commit | 745cc1b0001236242eb4790e71a3b60c0388eb4f (patch) | |
tree | 56f993c55838db94683fa56a18192134bdc154c6 /fg21sim | |
parent | 4de4dac9f909d6cbc7af1021eb403524983a436d (diff) | |
download | fg21sim-745cc1b0001236242eb4790e71a3b60c0388eb4f.tar.bz2 |
cosmology: Use default parameters from configurations
Also add configuration option "cosmology/Omegab0".
Diffstat (limited to 'fg21sim')
-rw-r--r-- | fg21sim/configs/00-general.conf.spec | 2 | ||||
-rw-r--r-- | fg21sim/utils/cosmology.py | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/fg21sim/configs/00-general.conf.spec b/fg21sim/configs/00-general.conf.spec index 1914a1b..b5bfd3f 100644 --- a/fg21sim/configs/00-general.conf.spec +++ b/fg21sim/configs/00-general.conf.spec @@ -120,6 +120,8 @@ manifest = string(default="products_manifest.json") 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 sigma8 = float(default=0.834, min=0.0) diff --git a/fg21sim/utils/cosmology.py b/fg21sim/utils/cosmology.py index 906f7d8..c5a5119 100644 --- a/fg21sim/utils/cosmology.py +++ b/fg21sim/utils/cosmology.py @@ -9,6 +9,7 @@ import numpy as np from scipy import integrate from astropy.cosmology import FlatLambdaCDM +from ..configs import configs from .units import (UnitConversions as AUC, Constants as AC) @@ -37,7 +38,10 @@ class Cosmology: http://adsabs.harvard.edu/abs/2002ApJ...577..579R Sec.(2) """ - def __init__(self, H0=71.0, Om0=0.27, Ob0=0.046, sigma8=0.834): + def __init__(self, H0=configs.getn("cosmology/H0"), + Om0=configs.getn("cosmology/OmegaM0"), + Ob0=configs.getn("cosmology/Omegab0"), + sigma8=configs.getn("cosmology/sigma8")): self.H0 = H0 # [km/s/Mpc] self.Om0 = Om0 self.Ob0 = Ob0 |