summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-04-28 14:29:55 +0800
committerAaron LI <aaronly.me@outlook.com>2016-04-28 14:29:55 +0800
commitc9c7d43e0f92bb69ea79b20650143f9080f51d2a (patch)
tree603ae8743f513266200e372bc5f2d07a68d201eb
parenta833f0ffef45704f0a0052e01a0e85fbc2ff9a22 (diff)
downloadcexcess-c9c7d43e0f92bb69ea79b20650143f9080f51d2a.tar.bz2
ciao_expcorr.sh: new; generate exposure map with existing "instmap_weights.txt"
-rwxr-xr-xciao_expcorr.sh55
1 files changed, 55 insertions, 0 deletions
diff --git a/ciao_expcorr.sh b/ciao_expcorr.sh
new file mode 100755
index 0000000..4d6140c
--- /dev/null
+++ b/ciao_expcorr.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+#
+# Generate the exposure map and apply exposure correction
+# using CIAO `fluximage`.
+#
+# NOTE:
+# The existing "instmap_weights.txt" is ued for exposure map generation.
+#
+# Aaron LI
+# Created: 2016-04-28
+# Updated: 2016-04-28
+#
+
+case "$1" in
+ -[hH]*)
+ echo "Usage:"
+ echo " `basename $0` <evt_e> <img> [ instmap_weights.txt ]"
+ exit 1
+ ;;
+esac
+
+EVT_E="$1"
+IMG="$2"
+SPEC_WGT="${3:-instmap_weights.txt}"
+
+REPRO_DIR=".."
+ASOLIS=`\ls ${REPRO_DIR}/acisf*asol?.lis`
+BPIX=`\ls ${REPRO_DIR}/acisf*repro_bpix?.fits`
+MSK=`\ls ${REPRO_DIR}/acisf*msk?.fits`
+
+ROOTNAME=`echo "${EVT_E%.fits}" | sed -e 's/^evt2_//'`
+
+## get `xygrid' for image
+punlearn get_sky_limits
+get_sky_limits image="${IMG}" verbose=0
+XYGRID=`pget get_sky_limits xygrid`
+echo "xygrid: ${XYGRID}"
+
+punlearn ardlib
+
+echo "invoking fluximage to generate expmap and apply correction ..."
+punlearn fluximage
+fluximage infile="${EVT_E}" outroot="${ROOTNAME}" \
+ binsize=1 bands="${SPEC_WGT}" xygrid="${XYGRID}" \
+ asol="@${ASOLIS}" badpixfile="${BPIX}" \
+ maskfile="${MSK}" clobber=yes
+
+# make symbolic links
+# clipped counts image
+ln -svf ${ROOTNAME}*band*thresh.img img_${ROOTNAME}_thresh.fits
+# clipped exposure map
+ln -svf ${ROOTNAME}*band*thresh.expmap expmap_${ROOTNAME}.fits
+# exposure-corrected image
+ln -svf ${ROOTNAME}*band*flux.img img_expcorr_${ROOTNAME}.fits
+