From 745cc1b0001236242eb4790e71a3b60c0388eb4f Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 23 Jun 2017 20:38:39 +0800 Subject: cosmology: Use default parameters from configurations Also add configuration option "cosmology/Omegab0". --- fg21sim/configs/00-general.conf.spec | 2 ++ fg21sim/utils/cosmology.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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 -- cgit v1.2.2