Chandra X-Ray Observatory (CXC)
Skip to the navigation links
Last modified: 3 Dec 2012

URL: http://cxc.harvard.edu/ciao/threads/acisbackground/thread.html

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

CIAO 4.5 Science Threads


Overview

Synopsis:

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.

Purpose:

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

Related Links:

Last Update: 3 Dec 2012 - Review for CIAO 4.5; removed workaround for 2005 series of files.


Contents


Get Started

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

unix% download_chandra_obsid 1838 evt2,asol

The observation has been reprocessed to apply the newest gain and CTI calibration. 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.


Finding the Correct File

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/
acis0D2000-12-01bgstow_ctiN0004.fits
acis0iD1999-09-16bkgrndN0002.fits
acis0iD2000-01-29bkgrnd_ctiN0005.fits
acis0iD2000-01-29bkgrndN0003.fits
acis0iD2000-12-01bkgrnd_ctiN0004.fits
acis0iD2000-12-01bkgrndN0002.fits
acis1D2000-12-01bgstow_ctiN0004.fits
acis1iD1999-09-16bkgrndN0002.fits
acis1iD2000-01-29bkgrnd_ctiN0005.fits
...

The naming scheme for CTI-corrected data is:

acis<chip><aimpoint>D<date>bkgrnd_ctiN<version>.fits

For uncorrected data, the naming is:

acis<chip><aimpoint>D<date>bkgrndN<version>.fits

The files which have "bgstow" in place of "bkgrnd" in the filename 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
/soft/ciao/CALDB/data/chandra/acis/bkgrnd/acis7sD2000-01-29bkgrnd_ctiN0001.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
/soft/ciao/CALDB/data/chandra/acis/bkgrnd/acis7sD2000-01-29bkgrnd_ctiN0001.fits

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)]"
/soft/ciao/CALDB/data/chandra/acis/bkgrnd/acis1sD2000-01-29bkgrnd_ctiN0005.fits
/soft/ciao/CALDB/data/chandra/acis/bkgrnd/acis3sD2000-01-29bkgrnd_ctiN0005.fits

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

unix% pget acis_bkgrnd_lookup outfile
/soft/ciao/CALDB/data/chandra/acis/bkgrnd/acis1sD2000-01-29bkgrnd_ctiN0005.fits,
/soft/ciao/CALDB/data/chandra/acis/bkgrnd/acis3sD2000-01-29bkgrnd_ctiN0005.fits

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:
infile=<filename>
CCD_ID=<N> 

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:

    • CTI_APP = PPPPPNPNPP
    • CTI_APP = PPPPPBPBPP

    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_APP = NNNNNNNNNN
    • CTI_APP = PPPPPNPNPP
    • 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 \
      bgevt2_c7.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+
VFAINT

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

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

unix% rory-ciao44: dmkeypar 1838_c7_clean.fits DATAMODE echo+
FAINT

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" \
      merge_bg.fits 

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.

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+
acisD2000-01-29gain_ctiN0006.fits

unix% dmkeypar bgevt2_c7.fits GAINFILE echo+
acisD2000-01-29gain_ctiN0006.fits

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. 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 \
      eventdef="{s:ccd_id,s:node_id,i:expno,s:chip,s:tdet,f:det,f:sky,s:phas,l:pha,l:pha_ro,f:energy,l:pi,s:fltgrade,s:grade,x:status}"

unix% dmkeypar bgevt2_c7_newgain.fits GAINFILE echo+
acisD2000-01-29gain_ctiN0006.fits

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.


Add the PNT 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.

To avoid this problem later in the analysis, the PNT 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 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% cat event_pnt.par
ra_pnt,r,h,278.38657206626,,,"Pointing RA"
dec_pnt,r,h,-10.589269915682,,,"Pointing Dec"
roll_pnt,r,h,266.80752046013,,,"Pointing Roll"

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


Caveats

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.

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)              
    

History

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; lc_clean.sl 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: lc_clean.sl has been replaced by lightcurves.sl; 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.

Return to Threads Page: Top | All | Data Prep | Imag | Imag Spec

Last modified: 3 Dec 2012
CXC logo

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