summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-07-15 12:03:41 +0800
committerAaron LI <aaronly.me@outlook.com>2016-07-15 12:03:41 +0800
commitc8f44aabfa2edbb3b99cfdeffa89900389a9c8ac (patch)
tree84a002bfca3c8f904a01f385d6da3bbf6ade41c6
parent90700c438a46d931c133d5e60f6a4d9f17fa7c16 (diff)
downloadcexcess-c8f44aabfa2edbb3b99cfdeffa89900389a9c8ac.tar.bz2
deproject_sbp.py: do not repeat the electron number density calculation
-rwxr-xr-xdeproject_sbp.py13
1 files 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":