summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-07-11 21:23:39 +0800
committerAaron LI <aaronly.me@outlook.com>2016-07-11 21:23:39 +0800
commit3ca792c09e6c0f9a193f85d1ac74a6ad9c692a09 (patch)
treeb117d7fa88f22281a2ef90a4a584ca21cf000219
parent81588bed8a575844e922b79b7d4296249f0207ca (diff)
downloadcexcess-3ca792c09e6c0f9a193f85d1ac74a6ad9c692a09.tar.bz2
calc_mass_potential.py: Allow disable the calculation of potential profile
-rwxr-xr-xcalc_mass_potential.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/calc_mass_potential.py b/calc_mass_potential.py
index e61645b..3254648 100755
--- a/calc_mass_potential.py
+++ b/calc_mass_potential.py
@@ -6,6 +6,7 @@
#
# Change logs:
# 2016-07-10:
+# * Allow disable the calculation of potential profile
# * Use class 'SmoothSpline' from module 'spline.py'
# 2016-07-04:
# * Remove unnecessary configuration options
@@ -142,6 +143,7 @@ rho_total_profile = rho_total_profile.txt
rho_total_profile_image = rho_total_profile.png
# output gravitational potential profile
+# NOTE: to disable potential calculation, do not specified the output files
potential_profile = potential_profile.txt
potential_profile_image = potential_profile.png
------------------------------------------------------------
@@ -646,14 +648,16 @@ def main():
density_profile.plot(profile="rho_total", ax=ax, fig=fig)
fig.savefig(config["rho_total_profile_image"], dpi=150)
- density_profile.calc_potential(verbose=True)
- density_profile.save(profile="potential",
- outfile=config["potential_profile"])
- fig = Figure(figsize=(10, 8))
- FigureCanvas(fig)
- ax = fig.add_subplot(1, 1, 1)
- density_profile.plot(profile="potential", ax=ax, fig=fig)
- fig.savefig(config["potential_profile_image"], dpi=150)
+ outfile_potential = config["potential_profile"]
+ if outfile_potential != "":
+ density_profile.calc_potential(verbose=True)
+ density_profile.save(profile="potential",
+ outfile=outfile_potential)
+ fig = Figure(figsize=(10, 8))
+ FigureCanvas(fig)
+ ax = fig.add_subplot(1, 1, 1)
+ density_profile.plot(profile="potential", ax=ax, fig=fig)
+ fig.savefig(config["potential_profile_image"], dpi=150)
if __name__ == "__main__":