Chandra X-Ray Observatory
Skip to the navigation links
Last modified: 21 Feb 2017


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

CIAO 4.9 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 section of the ciao-install page, or must download and install them separately from the CALDB download page.

Issues with 'Period G' 6i, 2s, and 5s files

[New] (28 Jul 2017) Errors in the background dataset, acis6iD2012-01-01bkgrnd_ctiN0001.fits, have been identified, where the exposure time is only half as long as the other ACIS-I chips while having nearly the same number of events, implying double the background count rate for ACIS-6. Subsequent review has found artificial "hot spots" in the dataset from a bug in one of the algorithms used to generate the background files. This bug has also affected the files:

  • acis2sD2012-01-01bkgrnd_ctiN0001.fits
  • acis5sD2012-01-01bkgrnd_ctiN0001.fits

but to a lesser degree. USERS SHOULD AVOID USING THESE FILES. Replacement files will be available in the next CalDB update, expected in mid-August.


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

Related Links:

Last Update: 21 Feb 2017 - The _AVG set of keywords are also copied from the input event file to the blank sky background file.


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

[New] (20 Dec 2016) The CIAO 4.8.4 contributed software 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% blanksy mode=h
Running blanksky
Version: 05 October 2016

Aspect solution file pcadf084244404N003_asol1.fits found.

ACIS background file /soft/ciao/CALDB/data/chandra/acis/bkgrnd/acis7sD2000-01-29bkgrnd_ctiN0001.fits found.

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

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

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: 30 September 2016

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_ctiN0001.fits. Make a local copy of the file:

unix% cp \
      $CALDB/data/chandra/acis/bkgrnd/acis7sD2000-01-29bkgrnd_ctiN0001.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_ctiN0001.fits,acis8sD2000-01-29bkgrnd_ctiN0001.fits" \

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

Matching calibration to the event data

Under Review

This section of the thread is currently under review.

All of the CALDB blank sky background files were created with the N0006 version of the ACIS Gain file which is identical to the N0007 gain file, execpt for small changes to ACIS-5 (ACIS-S1).

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, as shown here. 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 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_ctiN0006.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.

Data on ACIS-5 (aka ACIS-S1)

A bug introduced in acis_process_events in CIAO 4.8 requires the input file contain a TIME and EXPNO columns, even if they are not used. Since the blank sky files contain neither of these columns, acis_process_events now errors out the following message:

# acis_process_events (CIAO): ERROR: Column or Keyword 'TIME' not found in infile 'bgevt2_c7.fits'

acis_process_events only needs to be run for background files for ACIS-5 (S1), since the N0006 and N0007 files are otherwise identical. To work around this problem, we can use dmtcalc to create dummy columns before running acis_process_events as shown here

unix% dmtcalc bgevt2_c5.fits bgevt2_c5_mod.fits expression="time=#nan;expno=0"
unix% acis_process_events infile=bgevt2_c5_mod.fits outfile=bgevt2_c5_newgain.fits \
 ...same as above...

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.

Add the PNT and AVG header keywords

The pointing (PNT) header keyword values in the background files are set to zero:

unix% dmlist bgevt2_c7.fits header |grep PNT
0058 RA_PNT                                  0           Real8        Pointing RA
0059 DEC_PNT                                 0           Real8        Pointing Dec
0060 ROLL_PNT                                0 [deg]     Real8        Roll (fake)

These values indicate where the optical axis was during the observation. Having zero-values will cause the CIAO tool dmcoords to produce incorrect results when run with the background file.

In addition, this file is missing the average SIM offset keywords DY_AVG, DZ_AVG, DTH_AVG.

To avoid this problem later in the analysis, the PNT and AVG values from the event file are copied into the background file header. This is done by creating a file of the event file header keywords with dmmakepar, extracting the PNT and AVG values, then adding them to the background file header with dmreadpar:

unix% dmmakepar 1838_c7_clean.fits event_header.par

unix% grep _pnt event_header.par > event_pnt.par
unix% grep _avg event_header.par >> event_pnt.par

unix% cat event_pnt.par
ra_pnt,r,h,278.38657206626,,,"Pointing RA [deg]"
dec_pnt,r,h,-10.589269915683,,,"Pointing Dec [deg]"
roll_pnt,r,h,266.80752046013,,,"Pointing Roll [deg]"
dy_avg,r,h,0.094093196106,,,"Mean DY during observation [mm]"
dz_avg,r,h,0.23995890484,,,"Mean DZ during observation [mm]"
dth_avg,r,h,-0.0047718649694,,,"Mean DTHETA during observation [deg]"

unix% chmod +w bgevt2_c7.fits
unix% dmreadpar event_pnt.par "bgevt2_c7.fits[events]" clobber+

It is necessary to specify the "[events]" extension of the background file, or the keywords will be added to the NULL block header. The "clobber+" setting tells dmreadpar to overwrite the existing (zero) header PNT values.

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=pcadf084244404N003_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 = pcadf084244404N001_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.

Last modified: 21 Feb 2017
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2017. All rights reserved.