Last modified: 13 Sep 2022


Analysing the ACIS Background with the "Blank-Sky" Files

CIAO 4.16 Science Threads



The ACIS calibration team has completed a detailed study of the ACIS background and produced a set of "blank-sky" datasets. These files can be used, for instance, if you are analyzing an ACIS imaging observation and the source is so large that you can not estimate the background from your dataset.

Missing blank sky background files?

Due to their size, the ACIS blank sky background files are not installed with the default (quick) version of ciao-install. Users who need to use the blank sky files must either select them in the Custom Installation ciao-install page, or must download and install them separately from the CALDB download page.


To create ACIS background spectra tailored to a specific observation for spectral fitting or images for spatial analysis.

Related Links:

Last Update: 13 Sep 2022 - Added note about background scaling for spectral analysis.


Get Started

Download the sample data: 1838 (ACIS-S, G21.5-09)

The data have been reprocessed with the chandra_repro script. In these examples, we shall restrict attention to the ACIS-S3 chip and the 0.5 to 7 keV energy range:

unix% dmcopy "acisf01838_repro_evt2.fits[energy=500:7000,ccd_id=7]" 1838_c7.fits

Remove Background Flares from the Event File

As discussed in the ACIS background page, the background datasets were created for quiescent-background periods. It is therefore important that you filter your dataset to remove periods of background flares.

Follow the thread to remove any background flares. The filtered event file created in that thread - 1838_c7_clean.fits - is used in this analysis.

Using blanksky and blanksky_image scripts

The CIAO 4.8.4 contributed scripts release included a pair of scripts which automates the creation of the background files: blanksky and blanksky_image.

Using blanksky script

The blanksky script automatically locates the correct blanksky background files, reprojects them to match the observation, and and determines the proper scaling. The input event file should not be filtered on energy but should include any time filters.

unix% pset blanksky evtfile="acisf01838_repro_evt2.fits[ccd_id=7][@1838_c7_bg_deflare.gti]"
unix% pset blanksky outfile=1838_blank.evt
unix% pset blanksky tmpdir=./
unix% blanksky mode=h
Running blanksky
Version: 25 June 2020

Aspect solution file pcadf01838_000N001_asol1.fits found.

ACIS background file /data/chandra_caldb/ciao4.12/data/chandra/acis/bkgrnd/acis7sD2000-01-29bkgrnd_ctiN0002.fits found.

Calculated scale factor for 'weight_method=particle':
    ACIS-7: 0.05511728 written to the 'BKGSCAL7' header keyword.

The output 1838_blank.evt file is the background file to use for spectral and imaging analysis.

Extracting spectra from "blanksky" results

While the blanksky script will calculate scaling factors for each chip, which are stored by the BKGSCALn header keywords, what is extracted by dmextract/specextract is the unscaled background spectrum.

Since spectral analysis packages such as Sherpa and XSpec have no knowledge of these BKGSCALn keywords, the usual approach is to apply the scaling factor to either the EXPOSURE keyword or the AREASCAL keyword in the background spectrum file. It's one of the other. When the scaling is applied to the keyword, XSpec and Sherpa will automatically pick up the scaling factor and apply it to background model to be fitted so that the appropriate scaling can be accounted for while using the unscaled extracted background data.

If you intend to subtract the background from the source, then packages such as Sherpa and XSpec will automatically scale the background by exposure time (and a term that accounts for extraction region area), nominally by a factor of \(\frac{\mathtt{EXPOSURE}_{\mathrm{src}} \times \mathtt{BACKSCAL}_{\mathrm{src}}}{\mathtt{EXPOSURE}_{\mathrm{bkg}} \times \mathtt{BACKSCAL}_{\mathrm{bkg}}}\), before subtracting it from the source. The underlying software actually scales the background by \(\mathtt{AREASCAL}_{\mathrm{bkg}} \times \frac{\mathtt{EXPOSURE}_{\mathrm{src}} \times \mathtt{BACKSCAL}_{\mathrm{src}}}{\mathtt{EXPOSURE}_{\mathrm{bkg}} \times \mathtt{BACKSCAL}_{\mathrm{bkg}}}\), this scaling is also automatically applied to the defined background model. Standard extracted Chandra data products do not make use of the AREASCAL keyword, but since the OGIP format standard for PHA/PI files requires the inclusion of the keyword, it is just set to unity by the DM tools.

Starting with the CIAO contributed scripts package 4.13.1, BKGSCALn (n being the chip that your source falls on, or where the majority of the extraction region falls on) is copied over to the background spectrum's AREASCAL keyword by specextract so that the background model will be automatically scaled to match the extracted spectrum when read in by XSpec/Sherpa (although plotted background spectra may be displayed incorrectly scaled, for example with Sherpa's plot_bkg function), but this also means that if background subtraction is performed with the AREASCAL modified background spectrum, there will be a severe over-subtraction from the source spectrum. This can be resolved by resetting AREASCAL back to 1.0 in the background spectrum or interactively within Sherpa using the set_areascal function.

Another approach to obtain a scaled background spectrum—without the need to consider the header keywords or the need to scale the background model—is to extract a spectrum from the results of the blanksky_sample script, which takes a random sample of events from the unscaled blanksky background file to match the total number of events based on the calculated background scaling factor suitable for your observed data set. However, since there's a reduced number of background events in this sampled event file, you would lose the good statistics (i.e. smaller uncertainties) that come from having a large sample from the original tailored background files generated by 'blanksky'.

Using blanksky_image script

The blanksky_image scripts can be used to take the blank sky background event file created by blanksky and using the information stored in the header, to create a properly scaled blank sky image with matching WCS, dimensions, and using the same energies as are used in the input image file. The script also creates a background subtracted image.

unix% pset blanksky_image bkgfile=1838_blank.evt
unix% pset blanksky_image outroot=1838_blank
unix% pset blanksky_image imgfile=1838_c7_broad_thresh.img
unix% pset blanksky_image tmpdir=./
unix% blanksky_image mode=h clob+
Running blanksky_image
Version: 13 November 2019

The output images are named based on the background scaling method that was used. In this example the default particle method was used so the output images are the ones highlighted:

unix% ls -1 1838_blank*

The bgnd.img is the background image scaled to match the observation. The bkgsub.img is the background subtracted, net counts image.

This is the end of this thread. Users may want to review the Caveats (below). The rest of this thread shows the step-by-step instructions for creating the blank sky files that are used by blanksky and blanksky_image.

Step by Step

The following commands show the step-by-step commands used to create the ACIS blank sky event files and images. If you have already run the blanksky and blanksky_image scripts then you do not need to run these commands.

Naming scheme

The ACIS background datasets are stored in the CALDB at $CALDB/data/chandra/acis/bkgrnd/.

They are indexed by focal plane temperatures, aimpoint (i.e. ACIS-I or ACIS-S), and chip number:

unix% ls -1 $CALDB/data/chandra/acis/bkgrnd/

The naming scheme for CTI-corrected data is:


For uncorrected data, the naming is:


The files which have "bgstow" in place of "bkgrnd" in the file name are particle-only background files created from data taken when the HRC was in the focal plane (e.g. ACIS was "stowed"). There is no ACIS-S/ACIS-I distinction for these data, so an "<aimpoint>" is not included in the filename.

Using acis_bkgrnd_lookup

The acis_bkgrnd_lookup script makes it easy to find an ACIS background file that matches your data. The script takes an input event file and returns a list of background files for all the ACIS chips in the file that have events on them:

unix% acis_bkgrnd_lookup 1838_c7_clean.fits

This file only has data on ACIS-7 (ACIS-S3), so a single file is returned. The path reflects where the CALDB is installed on your system; here, $CALDB is set to /soft/ciao/CALDB.

In addition to being printed to the screen, the list of background files is also stored in the outfile parameter:

unix% pget acis_bkgrnd_lookup outfile

The input file can include a Data Model filter as long as the resulting file is still a table with a ccd_id column, such as "acisf01838_repro_evt2.fits[ccd_id=7]". In this example, we use a spatial region to filter the original event file. The resulting background file(s) will be chosen to match the CCDs that are covered by the circle:

unix% acis_bkgrnd_lookup "acisf01838_repro_evt2.fits[sky=circle(6072.5,4632.5,320)]"

Two files are returned, so the outfile parameter contains a comma-separated list:

unix% pget acis_bkgrnd_lookup outfile

No matching file and identical lookup cases

There are a number of known cases where acis_bkgrnd_lookup cannot find a background file for the dataset and exits with this error:

# acis_bkgrnd_lookup: ERROR: Unable to find an ACIS background file for:

There are no background files for:

  • non-CTI-corrected data on ACIS-1

  • any data on ACIS-4

  • CTI-corrected data on ACIS-9

  • ACIS-0 data, when ACIS-S is in the focal plane (a SIM_Z limit is exceeded)

There are also a few cases that result in identical lookup results:

  • For the front-illuminated (FI) chips, there is no difference between:


    since the parallel CTI-correction is applied to all FI chips either way.

  • For the back-illuminated (BI) chips, there is no difference between any of these:

    • CTI_CORR = YES
    • CTI_CORR = NO

    since no CTI correction is applied to BI chips for any of those configurations.

Make a Local Copy of the Background File

The background file for the 1838_c7_clean.fits dataset is $CALDB/data/chandra/acis/bkgrnd/acis7sD2000-01-29bkgrnd_ctiN0002.fits. Make a local copy of the file:

unix% cp \
      $CALDB/data/chandra/acis/bkgrnd/acis7sD2000-01-29bkgrnd_ctiN0002.fits \

The tailor the background file to your dataset section explains what data processing is required in order to use the background in the analysis.

Tailor the background file to your dataset

Working with VFAINT data

When working with observations performed in very faint (VFAINT) mode which have had the ACIS background cleaning performed, a similarly-filtered blank-sky background file may be used.

The period D background files are composed of VFAINT mode observations and have the "potential background event" status bit set to 1 (status bit 23). As no other status bits are set in the background files, it is simple to filter out these events:

unix% dmkeypar evt2_clean.fits DATAMODE echo+

unix% dmcopy "bg.fits[status=0]" bg_cleaned.fits

OsbID 1838 was taken in FAINT mode, so this step is not necessary:

unix% dmkeypar 1838_c7_clean.fits DATAMODE echo+

Analysing datasets with multiple chips

The background data files are divided so that there is one chip per file. This is so that a unique background file is returned for each chip that contains data in the event file.

In order to make a background event file that contains more than one chip, it is necessary to run dmmerge to combine the files. For example:

unix% dmmerge \
      "acis6sD2000-01-29bkgrnd_ctiN0005.fits,acis7sD2000-01-29bkgrnd_ctiN0002.fits,acis8sD2000-01-29bkgrnd_ctiN0002.fits" \

Then continue with the Matching calibration to the event data step.

Matching calibration to the event data

The background files were generated using a gain file that may not match the one used for your observation or may not be up to date. The GAINFILE keyword in the header of the background files should match that of your source file:

unix% dmkeypar 1838_c7_clean.fits GAINFILE echo+

unix% dmkeypar bgevt2_c7.fits GAINFILE echo+

The two gain files should have the same date and version number in the filename. If they do not match, reprocess the background file with acis_process_events, specifying the exact gainfile that was used on the data.

N0007 vs. N0006

All of the early blank sky background files were created with the N0006 version of the detector gain calibration file. A new version of this file, N0007, was released in CALDB 4.6.9; however only the data for ACIS-5 (aka ACIS-S1) were updated.

The N0007 and N0006 files are otherwise identical and equivalent. There is no need to process the blank sky files through acis_process_events.

You will also need to create a custom event definition that does not contain a time definition (e.g. take the standard eventdef and remove "d:time"). If the time specification is left in, acis_process_events will create a column where every event has a time equal to TSTART; this will cause problems later in the analysis.

unix% acis_process_events infile=bgevt2_c7.fits outfile=bgevt2_c7_newgain.fits \
      acaofffile=NONE stop="none" doevtgrade=no apply_cti=yes apply_tgain=no \
      calculate_pi=yes pix_adj=NONE \
      gainfile=$CALDB/data/chandra/acis/det_gain/acisD2000-01-29gain_ctiN0008.fits \

unix% dmkeypar bgevt2_c7_newgain.fits GAINFILE echo+

acis_process_events will print several warnings that may be ignored. Read the acis_process_events ahelp file for more details on using this tool.

CTI and TGAIN Calibration Files

The calibration files used to apply the CTI and time-dependent gain corrections should also match in the event and background data. In practice, though, it is not currently possible to apply newer CTI and TGAIN correction the background files in the CALDB; they lack some columns required by acis_process_events.

The error introduced by this mismatched calibration should not be very significant for the faint, extended objects for which people use these backgrounds.

Reproject the background data

The reproject_events tool can handle the special case of reprojecting a file which does not have an input time column, such as the ACIS background file. The tool takes the time range covered by the aspect solution of the observation and intersects it with the GTIs from the match file (1838_c7_clean.fits), which means that the output file will only contain events for those chips contained in the match file.

ObsID 1838 has only one aspect solution file, which we assume to be in the current working directory. It is possible to use multiple asol files by using a stack for the aspect parameter; see this FAQ for more information. The random=0 parameter setting tells the tool to apply a random aspect solution to each background event, thus sampling the dither of the observation.

unix% punlearn reproject_events
unix% pset reproject_events infile=bgevt2_c7.fits
unix% pset reproject_events outfile=bgevt2_c7_reproj.fits
unix% pset reproject_events aspect=pcadf01838_000N001_asol1.fits
unix% pset reproject_events match=1838_c7_clean.fits
unix% pset reproject_events random=0
unix% reproject_events
Input dataset/block specification (bgevt2_c7.fits):
Output dataset/block specification (bgevt2_c7_reproj.fits):
Match file (1838_c7_clean.fits):

You can check the parameter file that was used with plist reproject_events. Note that:

  • A random time within the range of the background data was selected and assigned to the event for the reprojection. The time is used only for the reprojection; the output file does not have a TIME column in it.

  • reproject_events does not alter the duration of the background file in any way in this process. The time-related header keywords (e.g. TSTART, TSTOP) are identical in the input and output files. This preserves the original background count rate, regardless of what observation is matched.


Scaling the exposure time

Once you have created a background spectrum or image, you may wish to use the high energy data (above 10 keV) to see how the particle background normalization differs between your observation and the background. Absolute measurement of the unresolved cosmic X-ray background in the 0.5-8 keV band with Chandra by Hickox & Markevitch shows how to use the ACIS-stowed background for analysis of background-critical objects, including calculating a scaling factor based on high-energy flux measurements.

The ACIS background page includes a discussion of the time dependence of the background and how it affects spectra and spatial structure.

Subarray data

Some ACIS data are taken in subarray mode where only part of each CCD is used. For these observations, the fraction of the CCD used should be included when scaling the blank sky background. Users can check the number of rows used in the observations by examinging the NROWS header keyword:

unix% dmkeypar acisf01838_repro_evt2.fits NROWS echo+

A value of 1024 indicates that the full CCD was readout. For values less than 1024, the background counts should be scaled by the ratio NROWS/1024.

Imaging Analysis

If you have an exposure-corrected image, e.g. created by running fluximage, you also need to exposure-correct the background file for use in the analysis. After calculating the correct scaling factor based on the high-energy flux - e.g. see Hickox & Markevitch - or whatever other method you choose, then:

unix% get_sky_limits 2.3_bin2.emap
unix% set dmf = `pget get_sky_limits dmfilter`

unix% dmcopy "bgevt2.fits[energy=500:7000][bin $dmf]" 0.5-7.0_bin2.bgimg

unix% dmimgcalc infile="0.5-7.0_bin2.img,0.5-7.0_bin2.bgimg,2.3_bin2.emap" \
infile2= out=foo.img expr="imgout=((img1-xxxxx*img2)/img3)"

where "xxxxx" is the scale factor to account for the different exposure lengths and any variability of the background flux.

Spectral Analysis

Since the blank-sky background file comes from a different observation than your source observation, the exposure time may differ from that of your source. The spectral fitting programs, such as Sherpa or XSpec, properly account for the exposure times (and spectral extract region areas) when the background is subtracted from the source.

For example, in order to determine how many of the blank-sky background counts contribute to your source counts, the count rate of the background would be multiplied by the exposure time of the source:

src_counts - bg_counts*(src_exposure*src_backscal)/(bg_exposure*bg_backscal) 

Creating response files

If you are just going to subtract the background spectrum (i.e. not fit it), then you do not need a separate RMF and ARF for the background spectrum. You may simply use dmextract to create the spectrum.

If you do need an RMF file for the background region:

mkacisrmf should be used to make the RMF for any dataset which meets the requirements listed in mkacisrmf why topic.

For all other data, use mkrmf. First run acis_fef_lookup to find the FEF file, giving it the source event file (not the background file) as the infile parameter. Find the coordinates of the source in chip coordinates (see the Step-by-Step Guide to Creating ACIS Spectra for Pointlike Sources thread for an example of how to do this). This filename should be used (including any DM filter) for the infile parameter of mkrmf.

The same FEF filename and filter should be used for the feffile parameter in mkwarf (i.e. instead of "CALDB").

Soft galactic flux and nH

The background datasets are constructed from a set of observations which are spread out across the sky. There is therefore no guarantee that the background at the position of your observation will match that in the background maps. An external check on the background can be made using the ROSAT All-Sky Survey R4-R5 band images. The Cookbook discusses these issues further.

Particle background normalization

You may use the high-energy event data (above 10 keV) to see how the particle background normalization differs between your observation and the background file.

Parameters for /home/username/cxcds_param/reproject_events.par

        infile = bgevt2_c7.fits Input dataset/block specification
       outfile = bgevt2_c7_reproj.fits Output dataset/block specification
         match = 1838_c7_clean.fits Match file
       (aspect = pcadf01838_000N001_asol1.fits) Aspect file
       (random = 0)               random seed (0 use time, -1 no randomize)
      (geompar = geom)            Parameter file for Pixlib Geometry files
      (verbose = 0)               Debug Level(0-5)
      (clobber = no)              Clobber existing file
         (mode = ql)              


05 Jan 2005 updated for CIAO 3.2: updates for CALDB 3.0.0, added Download the Background Files section
12 Jul 2005 acis_bkgrnd_lookup updated to version 1.11. A bug has been fixed that prevented the script from storing the name of the selected ACIS background file, or files, in its parameter file.
20 Dec 2005 updated for CIAO 3.3: default value of dmextract error and bkgerror parameters is "gaussian"
16 Feb 2006 added using the background files with specextract caveat
01 Dec 2006 updated for CIAO 3.4: serial CTI released in CALDB 3.3.0 is not included in the CALDB background files; dmgti uses the value of the TIMEPIXR header keyword to adjust start and stop times (users may see a small shift in the time filter when compared to CIAO 3.3 because of this); kernel parameter removed from dmgti; CIAO version in errors and warnings; ChIPS version
01 May 2007 updated for CALDB 3.4.0: new ACIS background files; majority of thread rewritten to reflect the new background files
12 Jul 2007 acis_process_events command needs apply_cti=yes, to retain the CTI correction on the input file
14 Sep 2007 updated for CALDB 3.4.1: new ACIS background files
25 Jan 2008 updated for CIAO 4.0: acis_bkgrnd_lookup v1.12; v1.10 (plotting routines have been removed from the script until the ChIPS syntax is updated); slsh version 0.8.2-0/S-Lang version 2.1.3; screen output updated for reprocessed data; lightcurve extract uses GTI range, not header time range
06 May 2008 changed energy filter to 0.5 to 7 keV (500:7000)
24 Jun 2008 updated image display to place figures inline with text
15 Dec 2008 updated for CIAO 4.1: has been replaced by; added a Python version of the script; the method for specifying options to the command has changed; plotting capabilities have been restored; the location of the ACIS background files has changed
14 Jan 2009 acis_bkgrnd_lookup updated to version "CIAO 4.1 - 1.1" (additional functionality which does not affect how the script is used in this thread); updated error message when no matching file found
06 May 2009 check the version of the CIAO scripts package instead of the individual script
21 May 2009 added the Working with VFAINT data caveat
07 Jul 2009 updated for CALDB 4.1.3: correction to lookup of three background files.
20 Aug 2009 expanded the information on how the aspect solution is applied to the background file (Reproject the background data section)
27 Jan 2010 updated for CIAO 4.2: update the PNT header keywords in the background file header
05 Mar 2010 added information on using deflare script; updated script tarfile version to 05 Mar 2010
05 Apr 2010 updated for CALDB 4.2.1: calibration update - new ACIS blank-sky background files released
19 Apr 2010 updated for CALDB 4.2.2: calibration update - CALDB 4.2.1 contained one incorrect background file
28 Sep 2010 updated for CALDB 4.3.1: calibration update - updated files for ACIS-8
13 Jan 2011 updated for CIAO 4.3: removed old calibration updates; a new dmmerge merging rule was introduced in CIAO 4.3 which recalculates the time-related header keywords in the output file from the time subspace. This enhancement resolves>the caveat about the time keywords in merged headers.
28 Jan 2011 acis_process_events command needs pix_adj=NONE to run on background file.
04 Apr 2011 updated for 04 Apr scripts package release: the script prints the version at verbose > 0.
11 Apr 2011 changed title to "Analysing the ACIS Background with the "Blank-Sky" Files"
20 Jul 2011 required software updates are listed in Synopsis
24 Jan 2012 reviewed for CIAO 4.4: the Removing ACIS Background Flares information has been made into a separate thread
07 Sep 2012 Add workaround for crates bug that causes problems with specextract.
03 Dec 2012 Review for CIAO 4.5; removed workaround for 2005 series of files.
25 Nov 2013 Review for CIAO 4.6. No changes.
08 Sep 2014 Added a note that the blank sky files are not included in the default CIAO installation.
22 Oct 2014 Added a note that 2009 files have incorrect datatype for RA and DEC keywords
10 Dec 2014 Reviewed for CIAO 4.7. The 2009 files have been corrected in CALDB 4.6.5.
21 Dec 2015 Added a note about N0007 vs. N0006 gain files.
11 Jan 2016 Added a workaround for ACIS-5 (S1)
20 Dec 2016 Updated for CIAO 4.9. Added section showing blanksky script. Other minor edits.
21 Feb 2017 The _AVG set of keywords are also copied from the input event file to the blank sky background file.
30 Oct 2018 In CIAO 4.11, reproject_events automatically copies the *_AVG and *_PNT keywords from the match file into the blank sky files. Also the problem in acis_process_events requiring a TIME column has been corrected so the blank sky files can be recalibrated.
13 May 2021 Updated for Repro-5 file, CIAO 4.13, and CALDB 4.9.5.
13 Jan 2022 Reviewed for CIAO 4.14. No changes.
25 Apr 2022 Updated link to custom ciao-install page.
13 Sep 2022 Added note about background scaling for spectral analysis.