diff options
author | Aaron LI <aly@aaronly.me> | 2018-09-27 20:01:23 +0800 |
---|---|---|
committer | Aaron LI <aly@aaronly.me> | 2018-09-27 20:01:23 +0800 |
commit | aed34134d43db48d94be34b0bb88806c28eeede1 (patch) | |
tree | 0c12ab43a59cf06e0780209dce4f272882c35280 | |
parent | ada75e660fdac92ad620c4eb951e83fbdca1ccbe (diff) | |
download | atoolbox-aed34134d43db48d94be34b0bb88806c28eeede1.tar.bz2 |
astro/calc_psd.py: Simplify psd2d invocation and make a copy
-rwxr-xr-x | astro/calc_psd.py | 5 |
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) |