summaryrefslogtreecommitdiffstats
path: root/ciao_calc_csb.py
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-06-07 13:58:02 +0800
committerAaron LI <aaronly.me@outlook.com>2016-06-07 13:58:02 +0800
commit68c808ea0d7e8be46797cb3f805d2a595c185136 (patch)
tree48a365371fe2f983d7871f2d1889fb4e70ab4722 /ciao_calc_csb.py
parente074f733d3fa9b60aaea91bc4bc551fce5e37d48 (diff)
downloadcexcess-68c808ea0d7e8be46797cb3f805d2a595c185136.tar.bz2
ciao_calc_csb.py: minor update to function calc_csb()
Diffstat (limited to 'ciao_calc_csb.py')
-rwxr-xr-xciao_calc_csb.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/ciao_calc_csb.py b/ciao_calc_csb.py
index b3c2688..13149ad 100755
--- a/ciao_calc_csb.py
+++ b/ciao_calc_csb.py
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
#
# Calculate the surface brightness concentration (i.e., C_{SB}), which
# is an index/indicator of the cool core, and may be defined as:
@@ -11,9 +10,11 @@
#
# Aaron LI
# Created: 2016-04-28
-# Updated: 2016-05-16
+# Updated: 2016-06-07
#
# Change log:
+# 2016-06-07:
+# * Update function `calc_csb()`
# 2016-05-16:
# * Add some background subtraction support
# * Use `subprocess.run` instead of `subprocess.call`
@@ -55,7 +56,7 @@ def make_csb_region(regfile, center, r1, r2):
open(regfile, "w").write("\n".join(regions) + "\n")
-def calc_csb(evt, expmap, regfile, r1, r2, bkg=None):
+def calc_csb(infile, expmap, regfile, r1, r2, bkg=None):
"""
Calculate the C_SB
@@ -65,7 +66,7 @@ def calc_csb(evt, expmap, regfile, r1, r2, bkg=None):
csbfile = os.path.splitext(regfile)[0] + ".fits"
cmd_args = [
"dmextract",
- "infile=%s[bin sky=@%s]" % (evt, regfile),
+ "infile=%s[bin sky=@%s]" % (infile, regfile),
"outfile=%s" % csbfile,
"exp=%s" % expmap,
"opt=generic", "clobber=yes"
@@ -73,7 +74,7 @@ def calc_csb(evt, expmap, regfile, r1, r2, bkg=None):
if bkg is not None:
# consider background subtraction
subprocess.run(["punlearn", "dmkeypar"])
- ret = subprocess.run(args=["dmkeypar", evt, "EXPOSURE", "echo=yes"],
+ ret = subprocess.run(args=["dmkeypar", infile, "EXPOSURE", "echo=yes"],
check=True, stdout=subprocess.PIPE)
exposure_evt = float(ret.stdout.decode("utf-8"))
ret = subprocess.run(args=["dmkeypar", bkg, "EXPOSURE", "echo=yes"],
@@ -81,7 +82,7 @@ def calc_csb(evt, expmap, regfile, r1, r2, bkg=None):
exposure_bkg = float(ret.stdout.decode("utf-8"))
bkg_norm = exposure_evt / exposure_bkg
cmd_args += [
- "bkg=%s[energy=700:7000][bin sky=@%s]" % (bkg, regfile),
+ "bkg=%s[bin sky=@%s]" % (bkg, regfile),
"bkgnorm=%s" % bkg_norm,
"bkgexp=)exp"
]
@@ -133,12 +134,11 @@ def main():
help="region from which to extract the center " +
"coordinate (default: sbprofile.reg)")
parser.add_argument("-i", "--infile", dest="infile", required=True,
- help="input energy-filtered EVT2 used to " +
- "calculate the C_SB")
+ help="binned image used to calculate the C_SB")
parser.add_argument("-e", "--expmap", dest="expmap", required=True,
help="exposure map of the input image")
parser.add_argument("-b", "--bkg", dest="bkg", default=None,
- help="background corresponding to the input evt2")
+ help="background image with respect to the input file")
parser.add_argument("-o", "--outfile", dest="outfile", required=True,
help="output json file to store the C_SB results")
#