From a432fc8608d499ee589f0216b6bf7e2b7a63de18 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 13 Jul 2016 21:07:50 +0800 Subject: Error on missing user config file --- calc_coolfunc.py | 9 +++++---- fit_tprofile.py | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/calc_coolfunc.py b/calc_coolfunc.py index c21e6b7..cf49afd 100755 --- a/calc_coolfunc.py +++ b/calc_coolfunc.py @@ -8,6 +8,7 @@ # # Change logs: # 2016-07-13: +# * Error on missing user config file # * Add check of the existence of t_profile # 2016-07-11: # * Use a default config to allow a minimal user config @@ -67,16 +68,16 @@ config_default = """ t_profile = t_profile.txt # average abundance (unit: solar) -abundance = -1 +abundance = # abundance table (default: grsa) abund_table = grsa # redshift of the object -redshift = -1 +redshift = # H column density (unit: 10^22 cm^-2) -nh = -1 +nh = # energy range within which to calculate the cooling function (unit: keV) energy_low = 0.7 @@ -186,7 +187,7 @@ def main(): args = parser.parse_args() config = ConfigObj(config_default.splitlines()) - config_user = ConfigObj(args.config) + config_user = ConfigObj(open(args.config)) config.merge(config_user) if not os.path.exists(config["t_profile"]): diff --git a/fit_tprofile.py b/fit_tprofile.py index e1ee9a9..73d7f21 100755 --- a/fit_tprofile.py +++ b/fit_tprofile.py @@ -6,6 +6,7 @@ # # Change logs: # 2016-07-13: +# * Error on missing user config file # * Force the input temperature data to be 2D # 2016-07-11: # * Use a default config to allow a minimal user config @@ -44,7 +45,7 @@ config_default = """ ## Configuration for `fit_tprofile.py` # redshift of the object (for pixel to distance conversion) -redshift = -1 +redshift = # input temperature profile data file t_profile_data = t_profile_data.txt @@ -225,7 +226,7 @@ def main(): args = parser.parse_args() config = ConfigObj(config_default.splitlines()) - config_user = ConfigObj(args.config) + config_user = ConfigObj(open(args.config)) config.merge(config_user) tprofile_data = np.loadtxt(config["t_profile_data"], ndmin=2) -- cgit v1.2.2