'ahbackscal' corrects the the BACKSCAL keyword in a spectrum file that has been extracted from XSELECT, using as input the extraction region file and an exposure map, which must be defined in the same coordinate system. The BACKSCAL keyword is used by XSPEC to properly scale the background spectrum before subtracting it from the source spectrum, since the extraction regions are usually different between source and background. XSELECT sets BACKSCAL according to the fraction of pixels contained in the extraction region compared to the number of pixels defined by the TLMIN and TLMAX of the event list coordinate columns. If this region contains bad pixels, bad columns, partially exposed pixels, regions outside of the field-of-view, the BACKSCAL keyword will be incorrect.
The task works in the following way:
1. Mask the exposure map with the region file so that parts outside the
region are set to zero.
2. Sum up the pixel values in the good region.
3. Normalize this sum by the maximum value in the exposure map ('norm=MAX'), by the spectrum file exposure time keyword ('norm=EXPOSURE'), or by some specified numerical value ('norm=value'). This third option makes the tool mission-independent, because some "exposure maps" are already normalized to unity.
4. Divide this value by the number of pixels in the coordinate system, since this is how BACKSCAL is defined.
In general, 'norm=MAX' should be used to properly scale the number of good pixels in the exposure map. Due to spacecraft attitude motion and therefore pixels with partial exposure in 'expfile', the total number of good pixels will not necessarily be an integer, and 'ahbackscal' takes this correctly in to account. It is important to note that 'ahbackscal' only corrects the scaling used to subtract the background spectrum in XSPEC; spectral modeling already accounts for all pixels that are bad, partially exposed, or out of the field-of-view by using properly constructed response files (RMF and ARF). There is no output file, instead the BACKSCAL keyword is updated in the input spectrum file.
This tool is designed to be mission-independent, and will work for any PHA spectrum extracted from XSELECT as long as the SAO region file 'regfile' and exposure map image 'expfile' are specified in the same coordinates (e.g. DET or SKY).
ahbackscal infile=ah100050010sxi_p0100004b0_cl_src.pi regfile=sxi_src_wcs.reg expfile=ah100050020sxi_p0100004b0_cl.expo ahbackscal infile=ah100050010sxi_p0100004b0_cl_bkg.pi regfile=sxi_bkg_wcs.reg expfile=ah100050020sxi_p0100004b0_cl.expo
ahbackscal infile=ah100050010sxi_p0100004b0_cl_src.pi regfile=sxi_src_wcs.reg expfile=ah100050020sxi_p0100004b0_cl.expo norm=EXPOSURE
ahbackscal infile=xis_src.pha regfile=xis_src_wcs.reg expfile=xis_src.expo norm=15549.23