From aed34134d43db48d94be34b0bb88806c28eeede1 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Thu, 27 Sep 2018 20:01:23 +0800 Subject: astro/calc_psd.py: Simplify psd2d invocation and make a copy --- astro/calc_psd.py | 5 ++--- 1 file 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) -- cgit v1.2.2