aboutsummaryrefslogtreecommitdiffstats
path: root/astro/ps2d.py
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-25 15:06:24 +0800
committerAaron LI <aly@aaronly.me>2017-08-25 15:06:24 +0800
commit6cc07a4fbd535820b55305c38ee2e13fc568f0aa (patch)
treefcf88032206160074cad06d7afefbf35390597e8 /astro/ps2d.py
parent00f6ff698db47c4ab658effd3ba9fc9de42326f6 (diff)
downloadatoolbox-6cc07a4fbd535820b55305c38ee2e13fc568f0aa.tar.bz2
ps2d.py: Clean up cosmology usage
Diffstat (limited to 'astro/ps2d.py')
-rwxr-xr-xastro/ps2d.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/astro/ps2d.py b/astro/ps2d.py
index 3241107..2522920 100755
--- a/astro/ps2d.py
+++ b/astro/ps2d.py
@@ -49,12 +49,12 @@ logging.basicConfig(level=logging.INFO,
logger = logging.getLogger(os.path.basename(sys.argv[0]))
-# present Hubble parameter
-H0 = 71.0 # [km/s/Mpc]
-# present density parameter of matter
-OmegaM0 = 0.27
# HI line frequency
freq21cm = 1420.405751 # [MHz]
+# Adopted cosmology
+H0 = 71.0 # [km/s/Mpc]
+OmegaM0 = 0.27
+cosmo = FlatLambdaCDM(H0=H0, Om0=OmegaM0)
def freq2z(freq):
@@ -97,9 +97,8 @@ class PS2D:
self.zc = freq2z(self.freqc)
logger.info("Central frequency %.2f [MHz] <-> redshift %.4f" %
(self.freqc, self.zc))
- self.cosmo = FlatLambdaCDM(H0=H0, Om0=OmegaM0)
# Transverse comoving distance at zc; unit: [Mpc]
- self.DMz = self.cosmo.comoving_transverse_distance(self.zc).value
+ self.DMz = cosmo.comoving_transverse_distance(self.zc).value
self.window_name = window_name
self.window_width = window_width
self.window = self.gen_window(name=window_name, width=window_width)
@@ -219,7 +218,7 @@ class PS2D:
c = ac.c.si.value # [m/s]
h = H0 * 1000.0 # [m/s/Mpc]
f21cm = freq21cm * 1e6 # [Hz]
- denom = c * (1+self.zc)**2 / h / f21cm / self.cosmo.efunc(self.zc)
+ denom = c * (1+self.zc)**2 / h / f21cm / cosmo.efunc(self.zc)
kz = 2*np.pi * eta / denom
return kz # [Mpc^-1]