Creating ARF using sxtARFModule and sxtEEFModule tools

This tool takes the recent versions of ARFs as input and scales this as per the observation specific parameters like the area of the source extraction region and the distance of source centriod from the bore-sight/optical axis (causing Vignetting), and write a new ARF file which can directly be used in XSPEC.

Installing sxtARFModule and sxtEEFModule

$ mkdir /path_to_home_diectory/sxt_arf_tools
$ cp  SXTEEFModule.tar.gz /path_to_home_diectory/sxt_arf_tools
$ cd sxt_arf_tools
$ tar xzvf SXTEEFModule.tar.gz
$ cd SXTEEFModule
$ chmod u+x install_sxtEEFModule.sh
$ ./install_sxtEEFModule.sh    
$ source ~/.bashrc
$ chmod u+x install_sxtEEFModule.csh
$ ./install_sxtEEFModule.csh        
$ source ~/.cshrc
$ sxtARFModule -h
=========================================================================
 Running Task: /home/user_name/auxpyscrpt/sxt_ARFModule_v02.py
    Version: 0.02 Release Date: 2019-07-03
   Developed By : Sunil Chandra,
    CSR, North-West University, South Africa
    Last Updated on 04, July, 2019
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The estimations provided by this script is based on actual SXT observations. The profiles used here are corrected for background counts. This script is best suited for point sources. You may expect ~5 % uncertainity in flux estimations while extracting ARFs for sources with fluxes ~ 1 Crab or brighter...
The parametric way of estimating the factor uses  kings's profile as functional form [with best fit archived parameters].
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
=========================================================================

Usage: sxt_ARFModule_v02.py [options]

Options:
 -h, --help            show this help message and exit
 -m MODE, --mode=MODE  Mode for extraction;   Two options a) using table and
                       b) using fit parameters   Default is b)   Input
                       options are ['a', 'tbl', 'tab', 't', 'table'] for a)
                       and one of ['b', 'par', 'param', 'fit', 'fitpar'] for
                       b)
 -r RADIUS, --radius=RADIUS
                       Source Region Size in arcmin.. Always use for cicular
                       regions...  Multiple radii (r1, r2, r3) can be entered
                       in format or 'r1nr2nr3' or 'r1ANDr2ANDr3' or
                       'r1ORr2ORr3'  Default is 15 arcm
 --sxtarf=SXTARF       The Full Path of Base ARF provided by SXT Team...
                       For Example 'sxt_pc_excl00_v04.arf'
 -e EVTFILE, --evtfile=EVTFILE
                       The Events file in case you are entering source
                       postion in sky pixels instead of detector
                       coordinates.....Default = None
 --sxtpha=SXTPHA       The Name of the input SXT spectrum [needed to fetch
                       source region related information]...   For Example
                       'sxt_pc_mytarget_src.pha'  Default is None..[This
                       means source coordinates should be entered manually]
 -x XPIX, --xpix=XPIX   X coordinate (RA) of the source position [sky/RAW
                       pixels] ...  Default is None [If None you should
                       provide spectrum as input file
 -y YPIX, --ypix=YPIX   Y coordinate (DEC) of the source position [sky/RAW
                       pixels] ...  Default is None [If None you should
                       provide spectrum as input file
 -o OUTSTEM, --outstem=OUTSTEM
                        Stem for output ARF File...
 --coordtyp=COORDTYP   Input Coordinate Type, .i.e., Detector Coordinates or
                       Sky Coordinates...Default is Sky   The input options
                       are ['Sky', 'sky', 'SKY', 's', 'S', 1, True] and/or
                       ['RAW', 'raw', 'Raw', 'R', 'r', 0]   Default is 'RAW'
 --vigcorrflag=VIGCORRFLAG
                       The flag for Vignetting Correction for off-axis SXT
                       observations, if needed...  Accepted options are [1.,
                       True, 'yes', 'YES', 'y', 'Y']   Default is 'no'
 --pltflag=PLTFLAG     The flag used for making the ARF diagnostics plot to
                       display various versions...  Accepted options are [1.,
                       True, 'yes', 'YES', 'y', 'Y']   Default is 'no'
 --onlyceoff=ONLYCEOFF
                       The flag to print only the coefficients for the input
                       radii..No ARF files will be generated.....  Accepted
                       options are [1., True, 'yes', 'YES', 'y', 'Y']
                       Default is 'no'
$ sxtEEFmaker -h
=========================================================================
   Running 'SXT EEF Maker' Tool
    Task: /home/user_name/auxpyscrpt/make_sxt_EEF_v02_py2.py
    Version: 02 Release Date: 2018-11-14
   Originally Developed By :
     Sunil Chandra,
   TIFR, Mumbai, 15 January, 2017
   Updated on 08 July, 2019
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Description: This tool makes Encirled Energy Fraction (EEF) profile for sources by using merged clean events files as input. The profile is shown to have radii containing 90% and 60% of total incoming photons. This version provides an option to correct profiles for background [Default].
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
=========================================================================

Usage: make_sxt_EEF_v02_py2.py [options]

Options:
  -h, --help            show this help message and exit
  -e EVTFILE, --evtfile=EVTFILE
                        Input Events file Name;   The most important input of
                        script give with full path if not in same directory
  -r RA, --ra=RA        Input RA in Sky pixels   Note that open your events
                        file with ds9 and note the position of centriod for
                        the source in pixels
  -d DEC, --dec=DEC     Input DEC in Sky pixels
  -o OUTFILE, --outfile=OUTFILE
                        Stem for output files
  -x MINR, --min=MINR   Radius of inner circle for annulii (in Sky pixel);
                        Default value is 8 pix (~0.5 arcm)
  -y MAXR, --max=MAXR   Radius of outer circle for annulii (in Sky pixel);
                        Default value is 328 pix (~22.5 arcm)
  -s STEPS, --steps=STEPS
                        Steps size to decide number of data points in outpur
                        profile [N = int((r_out - r_in)/stepsize)];  default
                        is 8 pixel
  -p PROCESS, --process=PROCESS
                        Plot type: 'plot' or 'both'; Whether you wish to make
                        plot only or make tables as well; You may use any of
                        ["BOTH", "AUTO", "B", "A", "PROCESS"] for default way
                        [making profile and plot] and any of ["PLOT", "PL",
                        "P"] for plot-only option if you already have tables
                        with you
  --estring=ESTRING     String for energy selection; the acceptable input
                        format is 0p3to7p0 (for 0.3-7.0 keV)   Default is
                        0.3-7.0 keV
  -g GRADE, --grade=GRADE
                        String for grade selections in the format 0-12
                        Default is all grades 0-12
  -t SIMEEF, --simeef=SIMEEF
                        Filename with full path for EEF from simulation;
                        Needed only for POC releted bussiness, you make ignore
                        it, Default is None, which mean no
  -l IPACFILE, --ipacfile=IPACFILE
                        IPAC file name with data; needed for 'plot' option for
                        process, Default = None
  --coordtyp=COORDTYP   Input Coordinate Type, .i.e., Detector Coordinates or
                        Sky Coordinates...Default is Sky   The input options
                        are ['Sky', 'sky', 'SKY', 's', 'S', 1, True] and/or
                        ['RAW', 'raw', 'Raw', 'R', 'r', 0]   Default is 'RAW'
  --bkgcorr=BKGCORR     The flag for back-ground correction, Default options
                        is 'yes'
  --NrefStyl=NREFSTYL   The flag for using method to normalize the profile,
                        options are either use total counts from largest safe
                        radius of source extraction or the counts from a
                        source region of 20 arcm [extra-polated, in cases
                        20arcm is not possible] to use.   Input options =
                        ['extrapolate', 'ff', 'full', '20arcm', 'auto', 1] for
                        using 20arcm anything else except ['both', 'BOTH',
                        'debug', 2] will result in using largest possible safe
                        radius for normalization of profiles; You may also
                        chose for any of ['kings', 'fit', 'model', 0]
  --normradius=NORMRADIUS
                        The radius [in arcm] what script should use in case
                        user is confident with source PSF
  --logfile=LOGFILE     The Name of logfile ..Default is
                        'LogFile_DateTimeFormat.log'
  --usepoly3flag=USEPOLY3FLAG
                        The Flag whether polynomial of order 3 should be used
                        for fitting or not.. Default = 'no'

To estimate the correction factor and generate the corrected ARF.

The correction factor (f) can be utilized to correct normalization/flux [effectively over 0.3-7.0 keV band] is following way :

corrected Norm. (Flux ) = (2-f) * Norm (Flux)

The important input options for this step are radius ® or radii (in the format of R1nR2nR3 or R1ANDR2ANDR3 or R1ORR2ORR3 ), onlycoeff=yes ; a flag to confirm that we want only coefficients no ARF generations, Mode of estimation [optional]: you may either choose a pre-calculated table (A) or pre-estimated Kings profile (B), Name of events file with full path if not in current directory , Name of spectrum file (.pha file) to extract information about source regions, Name of reference SXT ARF file.

Estimating factors with no ARF outputs.

The radius input here is for multiple radii in one run of the script. Users, however, can give a single radius as input same way (i.e., --radius=15 or -r 15 for a circular region of 15 arcm radius).

 $ sxtARFModule --radius=20n15n10n5 --onlyceoff=yes --outstem=ARFTESTS1 --mode=b
=========================================================================
        Running Task: /home/user_name/auxpyscrpt/sxt_ARFModule_v02.py
                 Version: 0.02 Release Date: 2019-07-03
                Developed By : Sunil Chandra,
                 CSR, North-West University, South Africa
                 Last Updated on 04, July, 2019
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The estimations provided by this script is based on actual SXT observations. The profiles used here are corrected for background counts. This script is best suited for point sources. You may expect ~5 % uncertainity in flux estimations while extracting ARFs for sources with fluxes ~ 1 Crab or brighter...
 The parametric way of estimating the factor uses  kings's profile as functional form [with best fit archived parameters].
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
=========================================================================
 
no
[20. 15. 10.  5.] 1 False
The Norm. EEF Coeff. for radius 20.0' = 1.0
The Norm. EEF Coeff. for radius 15.0' = 0.96
The Norm. EEF Coeff. for radius 10.0' = 0.827
The Norm. EEF Coeff. for radius 5.0' = 0.507
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 The radius for 60% containment of photons  : 6.15 arcmin
 The radius for 90% containment of photons  : 12.1 arcmin
 The radius for 95% containment of photons  : 14.35 arcmin
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

If you are using source regions other than circle please estimate the total area of that region and calculate the radius of a circle with the equal area and use this as input; i.e, circle equivalent of the used source region.

Estimating the factors and generating ARF for input spectra and based on input ARF.

Since you are providing spectra and events files for the reference of source region information and hence the radius input will not be used and --onlycoeff=no [–onlycoeff=0] is mandatory.

$ sxtARFModule --onlyceoff=0 --outstem=Arf_GRS_1915 --mode=b  --evtfile=/path_to_results_directory/GRS_1915_sxt_merged_cl.evt --sxtpha=/path_to_results_directory/sxt_spectra.pha --sxtarf=/path_to_results_directory/sxt_pc_excl00_v04_20190608.arf --vigcorrflag=yes
=========================================================================
  Running Task: /home/user_name/auxpyscrpt/sxt_ARFModule_v02.py
     Version: 0.02 Release Date: 2019-07-03
    Developed By : Sunil Chandra,
     CSR, North-West University, South Africa
     Last Updated on 04, July, 2019
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The estimations provided by this script is based on actual SXT observations. The profiles used here are corrected for background counts. This script is best suited for point sources. You may expect ~5 % uncertainity in flux estimations while extracting ARFs for sources with fluxes ~ 1 Crab or brighter...
 The parametric way of estimating the factor uses  kings's profile as functional form [with best fit archived parameters].
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
=========================================================================

yes
[12.] 0 True
ARF Correction for Off-Axis Angle : "yes"
 Input ARF File Name : Arf_GRS_1915_Rad12p0.arf
 Input Off-Axis Angle : 6.772923327521548
Plotting;;; [['/path_to_results_directory/sxt_pc_excl00_v04_20190608.arf', 'sxt_pc_excl00_v04_20190608.arf'], ['Arf_GRS_1915_Rad12p0_VigCorr.arf', 'Arf_GRS_1915_Rad12p0_VigCorr.arf']] True
/path_to_results_directory/sxt_pc_excl00_v04_20190608.arf
Arf_GRS_1915_Rad12p0_VigCorr.arf
The Norm. EEF Coeff. for radius 12.0' = 0.897
 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 The radius for 60% containment of photons  : 6.15 arcmin
 The radius for 90% containment of photons  : 12.1 arcmin
 The radius for 95% containment of photons  : 14.35 arcmin
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ARF File Arf_GRS_1915_Rad12p0.arf written successfully...
Resulting ARF File Arf_GRS_1915_Rad12p0_VigCorr.arf is corrected for Vig. Effect....

Here /path_to_results_directory/ is the path of results directory where event, ARF and spectra files are present. If you have set --vigcorrflag=yes then two output ARFs will be generated one with Vignetting correction and the other without it. Users are encouraged to use with proper Vignetting correction.