From ca6b5f0a9e667f07d0f126090fef627ec63b511d Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 12 Jul 2016 14:57:41 +0800 Subject: info.py: add functions "get_name()" and "get_obsid()" --- info.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/info.py b/info.py index 4c50026..1c4454e 100644 --- a/info.py +++ b/info.py @@ -1,9 +1,11 @@ # # Aaron LI # Created: 2016-05-04 -# Updated: 2016-07-11 +# Updated: 2016-07-12 # # Change logs: +# 2016-07-12: +# * Add functions "get_name()" and "get_obsid()" # 2016-07-11: # * Add functions "get_redshift()" and "get_nh()" # * Add function "get_owner()" @@ -44,6 +46,29 @@ def get_owner(info): return "LWT" +def get_name(info): + """ + Get the source name from the INFO json file. + """ + info = load_info(info) + name = info["Source Name"] + uname = info.get("Unified Name") + results = { + "name": name, + "uname": uname, + } + return results + + +def get_obsid(info): + """ + Get the Chandra observation ID from the INFO json file. + """ + info = load_info(info) + obsid = int(info["Obs. ID"]) + return obsid + + def get_r500(info): """ Get the R500 value (in unit pixel and kpc), as well as its errors. -- cgit v1.2.2