aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-08-25 15:08:39 +0800
committerAaron LI <aly@aaronly.me>2017-08-25 15:08:39 +0800
commit736a79c66f463a3186cb93a1abfa71adee9f72f1 (patch)
tree40f2af51869b7a93367d3c54cee4eb4abc7f928f
parent6cc07a4fbd535820b55305c38ee2e13fc568f0aa (diff)
downloadatoolbox-736a79c66f463a3186cb93a1abfa71adee9f72f1.tar.bz2
ps2d.py: Add helper properties for PS calculation
-rwxr-xr-xastro/ps2d.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/astro/ps2d.py b/astro/ps2d.py
index 2522920..bf967de 100755
--- a/astro/ps2d.py
+++ b/astro/ps2d.py
@@ -204,6 +204,68 @@ class PS2D:
logger.info("Wrote 2D power spectrum to file: %s" % outfile)
@property
+ def Nx(self):
+ """
+ Number of cells/pixels along the X axis.
+ Cube shape/dimensions: [Z, Y, X]
+ """
+ return self.cube.shape[2]
+
+ @property
+ def Ny(self):
+ return self.cube.shape[1]
+
+ @property
+ def Nz(self):
+ return self.cube.shape[0]
+
+ @property
+ def d_xy(self):
+ """
+ The sampling interval along the (X, Y) spatial dimensions,
+ translated from the pixel size.
+ Unit: [Mpc]
+
+ Reference: Ref.[liu2014].Eq.(A7)
+ """
+ pixelsize = self.pixelsize / 3600 # [arcsec] -> [deg]
+ d_xy = self.DMz * np.deg2rad(pixelsize)
+ return d_xy
+
+ @property
+ def d_z(self):
+ """
+ The sampling interval along the Z line-of-sight dimension,
+ translated from the frequency channel width.
+ Unit: [Mpc]
+
+ Reference: Ref.[liu2014].Eq.(A9)
+ """
+ dfreq = self.dfreq # [MHz]
+ c = ac.c.si.value # [m/s]
+ Ez = cosmo.efunc(self.zc)
+ Hz = Ez * H0 * 1000.0 # [m/s/Mpc]
+ d_z = c * (1+self.zc)**2 * dfreq / Hz / freq21cm
+ return d_z
+
+ @property
+ def fs_xy(self):
+ """
+ The sampling frequency along the (X, Y) spatial dimensions:
+ Fs = 1/T (inverse of interval)
+ Unit: [Mpc^-1]
+ """
+ return 1/self.d_xy
+
+ @property
+ def fs_z(self):
+ """
+ The sampling frequency along the Z line-of-sight dimension.
+ Unit: [Mpc^-1]
+ """
+ return 1/self.d_z
+
+ @property
def k_xy(self):
__, ny, nx = self.cube.shape
dxy = self.DMz * np.deg2rad(self.pixelsize / 3600.0) # [Mpc]