From c8f44aabfa2edbb3b99cfdeffa89900389a9c8ac Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 15 Jul 2016 12:03:41 +0800 Subject: deproject_sbp.py: do not repeat the electron number density calculation --- deproject_sbp.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/deproject_sbp.py b/deproject_sbp.py index 432ede6..5abb593 100755 --- a/deproject_sbp.py +++ b/deproject_sbp.py @@ -2,9 +2,11 @@ # # Aaron LI # Created: 2016-06-10 -# Updated: 2016-07-11 +# Updated: 2016-07-15 # # Change logs: +# 2016-07-15: +# * Do not repeat electron number density calculation # 2016-07-11: # * Use a default config to allow a minimal user config # 2016-07-10: @@ -540,10 +542,11 @@ class BrightnessProfile: unit: [ g cm^-3 ] if the units converted for input data """ - ne = self.calc_electron_density() - rho = ne * AstroParams.mu_e * AstroParams.m_atom - self.rho_gas = rho - return rho + if self.ne is None: + self.calc_electron_density() + rho_gas = self.ne * AstroParams.mu_e * AstroParams.m_atom + self.rho_gas = rho_gas + return rho_gas def save(self, density_type, outfile): if density_type == "electron": -- cgit v1.2.2