aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-09-27 20:01:23 +0800
committerAaron LI <aly@aaronly.me>2018-09-27 20:01:23 +0800
commitaed34134d43db48d94be34b0bb88806c28eeede1 (patch)
tree0c12ab43a59cf06e0780209dce4f272882c35280
parentada75e660fdac92ad620c4eb951e83fbdca1ccbe (diff)
downloadatoolbox-aed34134d43db48d94be34b0bb88806c28eeede1.tar.bz2
astro/calc_psd.py: Simplify psd2d invocation and make a copy
-rwxr-xr-xastro/calc_psd.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/astro/calc_psd.py b/astro/calc_psd.py
index db64586..100df42 100755
--- a/astro/calc_psd.py
+++ b/astro/calc_psd.py
@@ -161,8 +161,7 @@ class PSD:
----------
psd1d
"""
- if not hasattr(self, "ps2d") or self.psd2d is None:
- self.calc_psd2d()
+ psd2d = np.array(self.calc_psd2d())
print("Azimuthally averaging 2D power spectral density ... ",
end="", flush=True)
@@ -191,7 +190,7 @@ class PSD:
print("%.1f%% ... " % percent, end="", flush=True)
ii, jj = (rho <= r).nonzero()
rho[ii, jj] = np.inf
- cells = self.psd2d[ii, jj]
+ cells = psd2d[ii, jj]
psd1d[i, 3] = len(cells)
if self.meanstd:
psd1d[i, 1] = np.mean(cells)