Last modified: December 2022

AHELP for CIAO 4.16


Context: Tools::Gratings


Creates a PHA background file for use in XSPEC


tg_bkg input_pha2.fits [output_bkg_pha2.fits]


tg_bkg makes a background file that is compatible with XSPEC. Sherpa will be able to use it, but that application can already read the arrays directly from the PHA file. The script sums the BACKGROUND_UP and BACKGROUND_DOWN columns and adjusts the scale factor keyword (BACKSCAL) accordingly. Since it is designed to keep the same format as the PHA file, i.e. the rows in both files correspond to one another, it is a more convenient way of inspecting the background.

Note that since the script updates the BACKFILE keyword, the input file must have write permission. If an output file name is not specified, the script uses the input file name with "_bkg" appended.

It is important to note that these are estimates to the background. Since they are binned adjacent to the spectrum source region, they will have a contribution from the wings of the PSF. They also have a contribution from signal aliased in chipy during the frame shift at the level of (usually) 41 ms frame shift / 3200 ms integration / 1024 rows, or 1.25e-5 times the source rate (HEG+MEG or LEG, all orders). The source count rate at that diffraction angle gets smeared during the frame shift.


Example 1

tg_bkg acisf0145N003_pha2.fits acisf0145N003_bkg_pha2.fits

Create a background file for ObsID 145.

Example 2

tg_bkg acisf00459N002_pha2.fits

Create a background file for ObsID 459. Since an output filename is not given, tg_bkg creates "acisf00459N002_pha2.fits_bkg".

About Contributed Software

This script is not an official part of the CIAO release but is made available as "contributed" software via the CIAO scripts page. Please see this page for installation instructions.


There are no known bugs for this tool.

See Also

detilt, dewiggle, symmetrize, tg_choose_method, tg_create_mask, tg_findzo, tg_resolve_events, tgdetect, tgdetect2, tgextract, tgextract2, tgidselectsrc, tgmask2reg, tgmatchsrc, tgsplit