diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-07-15 12:03:41 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-07-15 12:03:41 +0800 |
commit | c8f44aabfa2edbb3b99cfdeffa89900389a9c8ac (patch) | |
tree | 84a002bfca3c8f904a01f385d6da3bbf6ade41c6 /deproject_sbp.py | |
parent | 90700c438a46d931c133d5e60f6a4d9f17fa7c16 (diff) | |
download | cexcess-c8f44aabfa2edbb3b99cfdeffa89900389a9c8ac.tar.bz2 |
deproject_sbp.py: do not repeat the electron number density calculation
Diffstat (limited to 'deproject_sbp.py')
-rwxr-xr-x | deproject_sbp.py | 13 |
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": |