aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-02-18 13:56:03 +0800
committerAaron LI <aaronly.me@outlook.com>2017-02-18 13:56:03 +0800
commitf211643467185246769a9efc1240c2c7153bb3a5 (patch)
tree705b7f26210209da364c38ca48c3eafbd468dde1 /scripts
parent250f9a9acadfc9e8ae1db45bf63dfc443053c53f (diff)
downloadchandra-acis-analysis-f211643467185246769a9efc1240c2c7153bb3a5.tar.bz2
Remove chandra_update_xpeak.sh & chandra_xpeak_coord.sh
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/chandra_update_xpeak.sh334
-rwxr-xr-xscripts/chandra_xpeak_coord.sh236
2 files changed, 0 insertions, 570 deletions
diff --git a/scripts/chandra_update_xpeak.sh b/scripts/chandra_update_xpeak.sh
deleted file mode 100755
index 080c4a9..0000000
--- a/scripts/chandra_update_xpeak.sh
+++ /dev/null
@@ -1,334 +0,0 @@
-#!/bin/sh
-#
-unalias -a
-export LC_COLLATE=C
-##
-## Take the `X-ray centroid' coordinate from region `sbprofile.reg'
-## as the start location, then search for X-ray peak in a circle region
-## of radius ${SEARCH_RADIUS} pixels centered on the X-ray centroid.
-## After that the found X-ray peak is convert from physical coordinate to
-## WCS coordinate and added/updated to the INFO json file.
-##
-## Note: The image on which the X-ray peak is to be searched is generated
-## as following:
-## (1) original event file (c7, c0-3)
-## (2) filter flares (deflare)
-## (3) filter energy (${E_RANGE})
-## (4) smooth with aconvolve
-##
-## Based on `chandra_update_xcentroid.sh'
-##
-## Weitian LI <liweitianux@gmail.com>
-## Created: 2015-11-08
-##
-VERSION="v1.3"
-UPDATED="2015-11-22"
-##
-## ChangeLogs:
-## 2015-11-08:
-## * Also add offset to info json
-## * Default to use aconvolve
-## * Change Gaussian kernel from gaus(2,5,1,10,10) to gaus(2,3,1,3,3)
-## 2015-11-20:
-## * Re-arrange default parameters
-## * Use previously generated image
-##
-
-## error code {{{
-ERR_USG=1
-ERR_DIR=11
-ERR_EVT=12
-ERR_BKG=13
-ERR_REG=14
-ERR_INFO=15
-ERR_ASOL=21
-ERR_BPIX=22
-ERR_PBK=23
-ERR_MSK=24
-ERR_BKGTY=31
-ERR_SPEC=32
-ERR_DET=41
-ERR_ENG=42
-ERR_CIAO=100
-## error code }}}
-
-## usage, help {{{
-case "$1" in
- -[hH]*|--[hH]*)
- printf "usage:\n"
- printf " `basename $0` evt=<evt_file> reg=<sbp_reg> basedir=<base_dir> info=<INFO.json> conv=<YES|no> update=<YES|no>\n"
- printf "\nversion:\n"
- printf "${VERSION}, ${UPDATED}\n"
- exit ${ERR_USG}
- ;;
-esac
-## usage, help }}}
-
-## default parameters {{{
-# default circle radius within which to search the X-ray peak
-SEARCH_RADIUS=100
-# critical offset (in pixel)
-OFFSET_CRIC=20
-
-# energy range: 700-2000 eV
-E_RANGE="700:2000"
-# default `event file' which used to match `blanksky' files
-DFT_EVT="`\ls evt2*c7*_clean.fits evt2*c0-3*_clean.fits 2> /dev/null`"
-# default dir which contains `asols, asol.lis, ...' files
-DFT_BASEDIR=".."
-# default `radial region file' to extract surface brightness
-DFT_SBP_REG="`\ls sbprofile.reg rspec.reg 2> /dev/null | head -n 1`"
-
-## howto find files in `basedir'
-# default `asol.lis pattern'
-DFT_ASOLIS_PAT="acis*asol?.lis"
-# default INFO.json pattern
-DFT_INFO_PAT="*_INFO.json"
-
-# aconvolve parameters
-ACONV_KERNELSPEC="lib:gaus(2,3,1,3,3)"
-ACONV_METHOD="fft"
-## default parameters }}}
-
-## functions {{{
-# process commandline arguments
-# cmdline arg format: `KEY=VALUE'
-getopt_keyval() {
- until [ -z "$1" ]
- do
- key=${1%%=*} # extract key
- val=${1#*=} # extract value
- keyval="${key}=\"${val}\""
- echo "## getopt: eval '${keyval}'"
- eval ${keyval}
- shift # shift, process next one
- done
-}
-## functions }}}
-
-## check CIAO init {{{
-if [ -z "${ASCDS_INSTALL}" ]; then
- printf "ERROR: CIAO NOT initialized\n"
- exit ${ERR_CIAO}
-fi
-
-## XXX: heasoft's `pget' etc. tools conflict with some CIAO tools
-printf "set \$PATH to avoid conflicts between HEAsoft and CIAO\n"
-export PATH="${ASCDS_BIN}:${ASCDS_CONTRIB}:${PATH}"
-## check CIAO }}}
-
-## parameters {{{
-# process cmdline args using `getopt_keyval'
-getopt_keyval "$@"
-
-# check given parameters
-# check evt file
-if [ -r "${evt}" ]; then
- EVT=${evt}
-elif [ -r "${DFT_EVT}" ]; then
- EVT=${DFT_EVT}
-else
- read -p "clean evt2 file: " EVT
- if [ ! -r "${EVT}" ]; then
- printf "ERROR: cannot access given \`${EVT}' evt file\n"
- exit ${ERR_EVT}
- fi
-fi
-printf "## use evt file: \`${EVT}'\n" | ${TOLOG}
-# check given region file(s)
-if [ -r "${reg}" ]; then
- SBP_REG="${reg}"
-elif [ -r "${DFT_SBP_REG}" ]; then
- SBP_REG=${DFT_SBP_REG}
-else
- read -p "> surface brighness radial region file: " SBP_REG
- if [ ! -r "${SBP_REG}" ]; then
- printf "ERROR: cannot access given \`${SBP_REG}' region file\n"
- exit ${ERR_REG}
- fi
-fi
-printf "## use reg file(s): \`${SBP_REG}'\n" | ${TOLOG}
-# check given dir
-if [ -d "${basedir}" ]; then
- BASEDIR=${basedir}
-elif [ -d "${DFT_BASEDIR}" ]; then
- BASEDIR=${DFT_BASEDIR}
-else
- read -p "> basedir (contains asol files): " BASEDIR
- if [ ! -d "${BASEDIR}" ]; then
- printf "ERROR: given \`${BASEDIR}' NOT a directory\n"
- exit ${ERR_DIR}
- fi
-fi
-# remove the trailing '/'
-BASEDIR=`echo ${BASEDIR} | sed 's/\/*$//'`
-printf "## use basedir: \`${BASEDIR}'\n" | ${TOLOG}
-# check INFO.json file
-if [ ! -z "${info}" ] && [ -r "${BASEDIR}/${info}" ]; then
- INFO_JSON="${info}"
-elif [ "`\ls ${BASEDIR}/${DFT_INFO_PAT} | wc -l`" -eq 1 ]; then
- INFO_JSON=`( cd ${BASEDIR} && \ls ${DFT_INFO_PAT} )`
-else
- read -p "> info json file: " INFO_JSON
- if ! [ -r "${BASEDIR}/${INFO_JSON}" ]; then
- printf "ERROR: cannot access given \`${BASEDIR}/${INFO_JSON}' file\n"
- exit ${ERR_INFO}
- fi
-fi
-INFO_JSON=`readlink -f ${BASEDIR}/${INFO_JSON}`
-printf "## use info json file: \`${INFO_JSON}'\n"
-# update flag: whether to update xcentroid in the info.json file
-if [ ! -z "${update}" ]; then
- case "${update}" in
- [nN][oO]|[fF]*)
- F_UPDATE="NO"
- ;;
- *)
- F_UPDATE="YES"
- ;;
- esac
-else
- F_UPDATE="YES"
-fi
-
-# convolve (optional)
-if [ -z "${conv}" ]; then
- CONV="YES"
-else
- case "${conv}" in
- [nN]*)
- CONV="NO"
- printf "## Do NOT apply \`aconvolve' !\n"
- ;;
- *)
- CONV="YES"
- printf "## apply \`aconvolve'\n"
- ;;
- esac
-fi
-## parameters }}}
-
-## prepare parameter files (pfiles) {{{
-CIAO_TOOLS="dmcopy dmstat aconvolve dmcoords"
-
-# Copy necessary pfiles for localized usage
-for tool in ${CIAO_TOOLS}; do
- pfile=`paccess ${tool}`
- [ -n "${pfile}" ] && punlearn ${tool} && cp -Lvf ${pfile} .
-done
-
-# Modify environment variable 'PFILES' to use local pfiles first
-export PFILES="./:${PFILES}"
-## pfiles }}}
-
-## main process {{{
-CUR_DIR=`pwd -P`
-
-# Generate the defalred event file (without filtering out the point sources)
-EVT_DIR=$(dirname $(readlink ${EVT}))
-cd ${EVT_DIR}
-EVT_ORIG="`\ls evt*c7*_orig.fits evt2*c0-3*_orig.fits 2>/dev/null`"
-GTI="`\ls *bkg*.gti | head -n 1`"
-printf "make a deflared evt (without filtering out point sources) ...\n"
-EVT_DEFLARE="${EVT_ORIG%_orig.fits}_deflare.fits"
-punlearn dmcopy
-dmcopy infile="${EVT_ORIG}[@${GTI}]" outfile="${EVT_DEFLARE}" clobber=yes
-
-cd ${CUR_DIR}
-ln -svf ${EVT_DIR}/${EVT_DEFLARE} .
-
-# Use previously generated `skyfov'
-SKYFOV=`\ls *skyfov*.fits 2>/dev/null | head -n 1`
-
-# Extract chip(s) from evt filename
-CHIP=`echo "${EVT}" | sed 's/^.*_c\(7\|0-3\)_.*$/\1/' | tr '-' ':'`
-
-# generate image
-IMG="img_c`echo ${CHIP} | tr ':' '-'`_e`echo ${E_RANGE} | tr ':' '-'`_deflare.fits"
-if [ -r "${IMG}" ]; then
- printf "use previously generated image: \`${IMG}'\n"
-else
- printf "generate image: \`${IMG}' ...\n"
- punlearn dmcopy
- dmcopy infile="${EVT_DEFLARE}[sky=region(${SKYFOV}[ccd_id=${CHIP}])][energy=${E_RANGE}][bin sky=::1]" outfile="${IMG}" clobber=yes
-fi
-
-# aconvolve
-if [ "${CONV}" = "YES" ]; then
- IMG_ACONV="${IMG%.fits}_aconv.fits"
- #if [ -r "${IMG_ACONV}" ]; then
- # printf "use previously convolved image: \`${IMG_ACONV}'\n"
- #else
- printf "\`aconvolve' to smooth img: \`${IMG_ACONV}' ...\n"
- printf "## aconvolve: kernelspec=\"${ACONV_KERNELSPEC}\" method=\"${ACONV_METHOD}\"\n"
- punlearn aconvolve
- aconvolve infile="${IMG}" outfile="${IMG_ACONV}" kernelspec="${ACONV_KERNELSPEC}" method="${ACONV_METHOD}" clobber=yes
- #fi
-else
- IMG_ACONV=${IMG}
-fi
-
-# Get X-ray centroid coordinate from sbp region
-printf "get (x,y) from ${SBP_REG}\n"
-CNTRD_X=`\grep -iE '(pie|annulus)' ${SBP_REG} | head -n 1 | awk -F',' '{ print $1 }' | tr -d 'a-zA-Z() '`
-CNTRD_Y=`\grep -iE '(pie|annulus)' ${SBP_REG} | head -n 1 | awk -F',' '{ print $2 }' | tr -d 'a-zA-Z() '`
-
-SEARCH_REGION="circle(${CNTRD_X},${CNTRD_Y},${SEARCH_RADIUS})"
-# dmstat to find the maximum location
-printf "\`dmstat' to find the peak ...\n"
-punlearn dmstat
-dmstat infile="${IMG_ACONV}[sky=${SEARCH_REGION}]" verbose=0
-PEAK_X=`pget dmstat out_max_loc | cut -d',' -f1`
-PEAK_Y=`pget dmstat out_max_loc | cut -d',' -f2`
-
-# asolis
-ASOLIS=`( cd ${BASEDIR} && \ls ${DFT_ASOLIS_PAT} 2> /dev/null )`
-
-# Use "dmcoords" to convert (x,y) to (ra,dec)
-printf "\`dmcoords' to convert (x,y) to (ra,dec) ...\n"
-punlearn dmcoords
-dmcoords infile="${EVT}" asolfile="@${BASEDIR}/${ASOLIS}" option=sky x=${PEAK_X} y=${PEAK_Y}
-PEAK_RA=`pget dmcoords ra`
-PEAK_DEC=`pget dmcoords dec`
-
-# Calculate the offset between peak and centroid coordinate
-OFFSET=`echo "scale=5; sqrt((${PEAK_X}-${CNTRD_X})^2 + (${PEAK_Y}-${CNTRD_Y})^2)" | bc -l`
-
-printf "## X-ray centroid (x,y): (${CNTRD_X},${CNTRD_Y})\n"
-printf "## X-ray peak (x,y): (${PEAK_X},${PEAK_Y})\n"
-printf "## X-ray peak (ra,dec): (${PEAK_RA},${PEAK_DEC})\n"
-printf "## Offset (pixel): ${OFFSET}\n"
-if [ `echo "${OFFSET} > ${OFFSET_CRIC}" | bc -l` -eq 1 ]; then
- printf "*** WARNING: large offset (> ${OFFSET_CRIC}) ***\n"
-fi
-
-# Output X-ray peak coordinate to a region file
-PEAK_PHY_REG="peak_phy.reg"
-[ -e "${PEAK_PHY_REG}" ] && mv -f ${PEAK_PHY_REG} ${PEAK_PHY_REG}_bak
-echo "point(${PEAK_X},${PEAK_Y})" > ${PEAK_PHY_REG}
-PEAK_WCS_REG="peak_wcs.reg"
-[ -e "${PEAK_WCS_REG}" ] && mv -f ${PEAK_WCS_REG} ${PEAK_WCS_REG}_bak
-echo "point(${PEAK_RA},${PEAK_DEC})" > ${PEAK_WCS_REG}
-
-if [ "${F_UPDATE}" = "YES" ]; then
- cp -f ${INFO_JSON} ${INFO_JSON}_bak
- printf "update/add X-ray peak coordinate to info.json ...\n"
- if \grep -qE 'XPEAK_(RA|DEC)' ${INFO_JSON}; then
- printf "update ...\n"
- sed -i'' "s/XPEAK_RA.*$/XPEAK_RA\":\ \"${PEAK_RA}\",/" ${INFO_JSON}
- sed -i'' "s/XPEAK_DEC.*$/XPEAK_DEC\":\ \"${PEAK_DEC}\",/" ${INFO_JSON}
- sed -i'' "s/XPEAK_XCNTRD_dist.*$/XPEAK_XCNTRD_dist\ (pix)\":\ \"${OFFSET}\",/" ${INFO_JSON}
- else
- printf "add ...\n"
- sed -i'' "/\"Dec\.\"/ a\
-\ \ \ \ \"XPEAK_XCNTRD_dist\ (pix)\": \"${OFFSET}\"," ${INFO_JSON}
- sed -i'' "/\"Dec\.\"/ a\
-\ \ \ \ \"XPEAK_DEC\": \"${PEAK_DEC}\"," ${INFO_JSON}
- sed -i'' "/\"Dec\.\"/ a\
-\ \ \ \ \"XPEAK_RA\": \"${PEAK_RA}\"," ${INFO_JSON}
- fi
-fi
-## main }}}
-
-exit 0
-
diff --git a/scripts/chandra_xpeak_coord.sh b/scripts/chandra_xpeak_coord.sh
deleted file mode 100755
index beb2698..0000000
--- a/scripts/chandra_xpeak_coord.sh
+++ /dev/null
@@ -1,236 +0,0 @@
-#!/bin/sh
-#
-###########################################################
-## get the coord of the X-ray peak in given evt file ##
-## 1) given `evt_clean' file ##
-## 2) `aconvolve' and then `dmstat' ##
-## 3) `dmcoords' convert `sky x, y' to `ra, dec' ##
-## ##
-## NOTES: ##
-## support ACIS-I(chip: 0-3) and ACIS-S(chip: 7) ##
-## determine by check `DETNAM' for chip number ##
-## if `DETNAM' has `0123', then `ACIS-I' ##
-## if `DETNAM' has `7', then `ACIS-S' ##
-## ##
-## Weitian LI <liweitianux@gmail.com> ##
-## 2012/11/08 ##
-###########################################################
-##
-VERSION="v2.0"
-UPDATED="2015/06/03"
-##
-## ChangeLogs:
-## v2.0, 2015/06/03, Aaron LI
-## * Copy needed pfiles to current working directory, and
-## set environment variable $PFILES to use these first.
-## * Replace 'grep' with '\grep', 'ls' with '\ls'
-## v1.1, 2012/11/08, Weitian LI
-## get x-ray peak coord from given region file
-##
-
-## error code {{{
-ERR_USG=1
-ERR_DIR=11
-ERR_EVT=12
-ERR_BKG=13
-ERR_REG=14
-ERR_ASOL=21
-ERR_BPIX=22
-ERR_PBK=23
-ERR_MSK=24
-ERR_BKGTY=31
-ERR_SPEC=32
-ERR_DET=41
-## error code }}}
-
-## usage, help {{{
-case "$1" in
- -[hH]*|--[hH]*)
- printf "usage:\n"
- printf " `basename $0` evt=<evt_cl> asol=<asol> [ reg=<reg> chip=<chip> ]\n"
- printf "\nversion:\n"
- printf "${VERSION}, ${UPDATED}\n"
- exit ${ERR_USG}
- ;;
-esac
-## usage, help }}}
-
-## default parameters {{{
-# default `evt clean file'
-DFT_EVT="`\ls evt*clean.fits *clean*evt*.fits 2> /dev/null | head -n 1`"
-# default `asol file'
-DFT_ASOL="`\ls ../pcadf*_asol1.fits pcadf*_asol1.fits 2> /dev/null | head -n 1`"
-# default region file
-DFT_REG="`\ls sbprofile.reg rspec.reg 2> /dev/null | head -n 1`"
-## default parameters }}}
-
-## functions {{{
-# process commandline arguments
-# cmdline arg format: `KEY=VALUE'
-getopt_keyval() {
- until [ -z "$1" ]
- do
- key=${1%%=*} # extract key
- val=${1#*=} # extract value
- keyval="${key}=\"${val}\""
- echo "## getopt: eval '${keyval}'"
- eval ${keyval}
- shift # shift, process next one
- done
-}
-## functions }}}
-
-## parameters {{{
-# process cmdline args using `getopt_keyval'
-getopt_keyval "$@"
-
-## check given parameters
-# check evt file
-if [ -r "${evt}" ]; then
- EVT=${evt}
-elif [ -r "${DFT_EVT}" ]; then
- EVT=${DFT_EVT}
-else
- read -p "evt clean file: " EVT
- if ! [ -r "${EVT}" ]; then
- printf "ERROR: cannot access given \`${EVT}' evt file\n"
- exit ${ERR_EVT}
- fi
-fi
-printf "## use evt file: \`${EVT}'\n"
-
-# asol
-if [ ! -z "${asol}" ]; then
- ASOL=${asol}
-elif [ -r "${DFT_ASOL}" ]; then
- ASOL=${DFT_ASOL}
-else
- read -p "asol file: " ASOL
- if ! [ -r "${ASOL}" ]; then
- printf "ERROR: cannot access given \`${ASOL}' asol file\n"
- exit ${ERR_ASOL}
- fi
-fi
-printf "## use asol file: \`${ASOL}'\n"
-
-# region file (optional)
-if [ ! -z "${reg}" ]; then
- REG=${reg}
-else
- REG=${DFT_REG}
-fi
-printf "## use reg file: \`${REG}'\n"
-
-# determine chip
-if [ ! -z "${chip}" ]; then
- CHIP="${chip}"
- printf "## use chip: \`${CHIP}'\n"
-else
- # determine chip by ACIS type
- punlearn dmkeypar
- DETNAM=`dmkeypar ${EVT} DETNAM echo=yes`
- if echo ${DETNAM} | \grep -q 'ACIS-0123'; then
- printf "## \`DETNAM' (${DETNAM}) has chips 0123\n"
- printf "## ACIS-I\n"
- ACIS_TYPE="ACIS-I"
- CHIP="0:3"
- elif echo ${DETNAM} | \grep -q 'ACIS-[0-6]*7'; then
- printf "## \`DETNAM' (${DETNAM}) has chip 7\n"
- printf "## ACIS-S\n"
- ACIS_TYPE="ACIS-S"
- CHIP="7"
- else
- printf "ERROR: unknown detector type: ${DETNAM}\n"
- exit ${ERR_DET}
- fi
-fi
-## parameters }}}
-
-## prepare parameter files (pfiles) {{{
-CIAO_TOOLS="dmkeypar dmcopy dmstat dmcoords skyfov aconvolve"
-
-# Copy necessary pfiles for localized usage
-for tool in ${CIAO_TOOLS}; do
- pfile=`paccess ${tool}`
- [ -n "${pfile}" ] && punlearn ${tool} && cp -Lvf ${pfile} .
-done
-
-# Modify environment variable 'PFILES' to use local pfiles first
-export PFILES="./:${PFILES}"
-## pfiles }}}
-
-## main part {{{
-# generate `skyfov'
-SKYFOV="_skyfov.fits"
-printf "generate skyfov: \`${SKYFOV}' ...\n"
-punlearn skyfov
-skyfov infile="${EVT}" outfile="${SKYFOV}" clobber=yes
-
-# generate image
-# energy range: 500-7000 eV
-E_RANGE="500:7000"
-IMG="img_c`echo ${CHIP} | tr ':' '-'`_e`echo ${E_RANGE} | tr ':' '-'`.fits"
-printf "generate image: \`${IMG}' ...\n"
-punlearn dmcopy
-dmcopy infile="${EVT}[sky=region(${SKYFOV}[ccd_id=${CHIP}])][energy=${E_RANGE}][bin sky=::1]" outfile="${IMG}" clobber=yes
-
-# aconvolve
-IMG_ACONV="${IMG%.fits}_aconv.fits"
-KERNELSPEC="lib:gaus(2,5,1,10,10)"
-METHOD="fft"
-printf "\`aconvolve' to smooth img: \`${IMG_ACONV}' ...\n"
-printf "## aconvolve: kernelspec=\"${KERNELSPEC}\" method=\"${METHOD}\"\n"
-punlearn aconvolve
-aconvolve infile="${IMG}" outfile="${IMG_ACONV}" kernelspec="${KERNELSPEC}" method="${METHOD}" clobber=yes
-
-# dmstat
-printf "\`dmstat' to analyze the img ...\n"
-punlearn dmstat
-dmstat infile="${IMG_ACONV}"
-MAX_X=`pget dmstat out_max_loc | cut -d',' -f1`
-MAX_Y=`pget dmstat out_max_loc | cut -d',' -f2`
-# dmcoords to convert (x,y) to (ra,dec)
-printf "\`dmcoords' to convert (x,y) to (ra,dec) ...\n"
-punlearn dmcoords
-dmcoords infile="${EVT}" asolfile="${ASOL}" option=sky x=${MAX_X} y=${MAX_Y}
-MAX_RA=`pget dmcoords ra`
-MAX_DEC=`pget dmcoords dec`
-
-# output results
-PHY_REG="peak_phy.reg"
-WCS_REG="peak_wcs.reg"
-[ -e "${PHY_REG}" ] && mv -f ${PHY_REG} ${PHY_REG}_bak
-[ -e "${WCS_REG}" ] && mv -f ${WCS_REG} ${WCS_REG}_bak
-echo "point(${MAX_X},${MAX_Y})" > ${PHY_REG}
-echo "point(${MAX_RA},${MAX_DEC})" > ${WCS_REG}
-
-printf "\n"
-printf "++++++++++++++++++++++++++++++++++++++++++++\n"
-printf "X-ray peak coordinates:\n"
-printf "via dmstat:\n"
-printf " (X,Y): (${MAX_X},${MAX_Y})\n"
-printf " (RA,DEC): (${MAX_RA},${MAX_DEC})\n"
-
-## region file based {{{
-if [ -r "${REG}" ]; then
- MAX_X2=`\grep -iE '(pie|annulus)' ${REG} | head -n 1 | tr -d 'a-zA-Z()' | awk -F',' '{ print $1 }'`
- MAX_Y2=`\grep -iE '(pie|annulus)' ${REG} | head -n 1 | tr -d 'a-zA-Z()' | awk -F',' '{ print $2 }'`
- punlearn dmcoords
- dmcoords infile="${EVT}" asolfile="${ASOL}" option=sky x=${MAX_X2} y=${MAX_Y2}
- MAX_RA2=`pget dmcoords ra`
- MAX_DEC2=`pget dmcoords dec`
- # calc offset
- OFFSET=`echo "scale=5; sqrt((${MAX_X}-${MAX_X2})^2 + (${MAX_Y}-${MAX_Y2})^2)" | bc -l`
-
- printf "via region:\n"
- printf " (X2,Y2): (${MAX_X2},${MAX_Y2})\n"
- printf " (RA2,DEC2): (${MAX_RA2},${MAX_DEC2})\n"
- printf "offset (unit pixel):\n"
- printf " offset: ${OFFSET}\n"
-fi
-## region file }}}
-printf "++++++++++++++++++++++++++++++++++++++++++++\n"
-## main }}}
-
-exit 0
-