RXTE Helpdesk/FAQ RXTE What's New HEASARC Site Map

Using the Latest Pcabackest
Recipes from the RXTE Cook Book

What's New with the Background Models?

July 9, 2002: FTOOLS 5.2 was released June 25, 2002 and includes updated tools for background estimation using the recently released improved PCA background models (March 2002). New bright and faint model files, with separate model components combined into a single file, can be downloaded from the PCA Digest page, which also includes a short discussion of the updated tools as well as the improvements over the old models.

Detailed practical advice for users of the new RXTE PCA background models can be found on Craig Markwardt's documentation page. Craig includes a helpful discussion of how to handle PCU0 background estimation, but the current version of his page was written before the latest FTOOLS release.


Pcabackest is an ftool that produces synthetic background data by matching the background conditions of your observation with those in various model files. These model files contain actual background observations sorted by quantities such as the position of the spacecraft with respect to the South Atlantic Anomaly.

The output of pcabackest is in the form of data files very similar in structure to Standard2 data files. They can be put through saextrct to produce background light curves and spectra. Though the background data are in Standard2 format, the count rates apply to the observation, not to that mode. This recipes uses an example where the background will be subtracted from event mode data.

Pcabackest is very much a work in progress: both the program and its models are being continually revised. The current version (v3.0) was released with FTOOLS version 5.2. To find the appropriate models for your data, please see the PCA Digest page.

Using Pcabackest

  1. Create a new filter file

    (following the directions under fhelp xtefilt or in the recipe for creating XTE filter files). This will calculate several new quantities used to create and evaluate the background model.

  2. Using pcabackest -- an example to apply to event mode data:

    This recipe will run through an example of using pcabackest to estimate a background to be applied to E_62us_64M_0_1s_L1R1 mode data. Assuming a light curve and spectrum have already been extracted from these data files (following the recipe for event mode spectra), we now go back to XDF and find the Standard2 data files which are always present, whatever other modes you may have requested. For each Standard2 data file, you can run pcabackest to produce a corresponding background data file from which you can then extract lightcurves and spectra. This can be done one file at a time with pcabackest or all at once using the script runpcabackest; the inputs are almost all the same, with the exception of a few output options in the latter:

    % runpcabackest
    This perl script will take a series of input files via @filename
    and run pcabackest multiple times, creating multiple files with the same
    name as the input file with _$outsuffix appended to the input name ready 
    to be input into saextrct for farther analysis.
    Running RUNPCABACKEST  version 4.0   
    List of Standard mode 2 Science array FITS files (@filename):[]@std2.xdf
    Output file which will contain the LIST of output files?:[]bkg.xdf
    Suffix appended to the output background files (after underscore _):[]bkg
    Here, simply input the list of Standard2 files rather than each individual file. The script then asks for the name of the list of output files, each of which will have the same name as the corresponding Standard2 file followed by a suffix you specify.

    XTE Filter file:[]obs1.xfl
    The filter file must cover the time range in the input Standard2 data files, so if using the script runpcabackest and giving a list of files which spans more than one Obs. Id., you must us a merged filter file which covers all of the time. (Remember to use "fmerge lastkey=TSTOP" to combine filter files.)

    PCA Background model file:[] pca_bkgd_cmfaintl7_eMv20020201.mdl
    We no longer recommend the CALDB option for this parameter. The Q6 models which were in CALDB are the oldest models and have since been made obsolete for most data sets. The currently recommended models can be found in the anonymous ftp area at https://heasarc.gsfc.nasa.gov/FTP/xte/calib_data/pca_bkgd/. Information about which models to use for which data is posted on our PCA Digest page. Note that the newly available CM model-files allow you to download one single file that contains within it the separate components of the model. Mission-long bright and faint combined model files, i.e., pca_bkgd_cmfaintl7_eMv20020201.mdl, and pca_bkgd_cmbrightvle_eMv20020201.mdl are also accepted by the latest pcabackest.

    To use the combined mission-long faint model, for instance, get the following modelfile:


    and enter the name of this file at the pcabackest "modelfile" prompt.

    Seconds between successive estimates:[]16
    The background estimator uses count rates found in the Standard2 data files and therefore has at best 16 second resolution. If you want to subtract a light curve at less than 16 second binning, you can still do so using lcmath. This tool will take a total light curve binned finer than 16 seconds and subtract the corresponding value of the coarser-binned background.

    Include individual xenon layer spectra? (Yes, No):[]yes
    If you will wish to select by layer in the extractor, you must tell pcabackest to include individual xenon layer spectra. This will produce a column for each anode, just as is found in Standard2, which can then be extracted separately in saextrct. Otherwise, each PCU will have only one column. In this example, we want to apply the background to an event mode which only includes layer 1, so we will have to select the appropriate columns when we saextrct the background files. So we must answer yes to this prompt.

    Correct for PCU Xenon gain variations? (Yes, No):[no]yes
    EDS gain correction file (CALDB) :[]caldb
    Correct for PCU Xenon gain variations? (Yes, No):[]no
    Expand xenon layer spectra to 256 channels? (Yes, No):[]yes
    If you will use the background to analyze Standard1, Standard2, or Good Xenon modes, you should not apply the gain correction. For other modes, the gain correction is applied to the data on board the satellite, because data from the various PCU's are combined before being sent down. This function of pcabackest is to adjust the background in the same way only if it is to be compared to data from modes where the correction has already been applied, e.g. binned or event modes. For this example applied to an event mode, answer "yes" to apply the gain correction, and enter "CALDB" for the EDS gain correction file.

    If you will be using the background spectra on anything but Standard2 binned data, as in this case with event mode data, you will have to expand the background spectra to the full 256 channels. Then the extracted spectra can be rebinned using rbnpha with the binfile from rddescr. If you apply the EDS Gain Correction, then the spectra will automatically be expanded to 256 channels, so this prompt does not appear.

    PCA SAA passage history file:[none] pca_saa_history
    This does not apply if you are using the bright source model in Epoch 1 or Epoch 2. ALL other users must include the appropriate file pca_saa_history; this file will be updated approximately daily and is found on the ftp site.

    Compute systematic error estimate? (Yes, No):[]no
    For this version, answer "no" to compute the systematic error estimate. This is under development and not currently useful.

    You will then see the script call pcabackest with the first of the data files in the list you gave runpcabackest. It will go to CALDB and find the model files and apply each to every good xenon column in the Standard2 file. When it is done, it will tell you what it output and ask:

    Update Parameter file for PCABACKEST? (Yes, No):yes
    PCABACKEST parameter file updated.
    which will update the parameter file for pcabackest with the inputs you just used.

  3. Use SAEXTRCT to extract estimated background spectra that correspond to your sources.

    We now run saextrct on the background data files to extract the spectra and lightcurves corresponding to those extracted from the data. Whether the data are Standard2, event, or another mode, you should extract the background using the same selection and binning criteria, i.e. the same GTIAND file, the same number of detectors and layers, the same time or channel filters, etc.

    In this case, we want to apply a background to the event mode E_62us_64M_0_1s_L1R1; this has 62 us timing, 64M_0 channel binning, and layer one only. It is the last which forces us to run saextrct from the command line. We need a column list corresponding to only the layer 1 anodes of the PCU that were on during the observation. Suppose we have checked the filter file and plotted the columns PCU0_ON, PCU1_ON, etc., and determined that PCU3 had been off for the entire observation; then our column list looks like:

    We then input this list (preceded by '@') for the columns to be accumulated.

    You will also want to only extract those channels which are included in your event mode. If you "fkeyprint TDDES2", you'll see that this 64M_0 binning has only channels 0-249, so this is the channel range you want to give the extractor.

  4. Applying and checking the background:

    In our example, the resulting spectrum will have the full 256 channel binning (though in this case, the last five will be empty), so you will have to rebin it according to the binning in your data file. Take the spectrum extracted from the event data, use pcarsp to create the appropriate response matrix (in the process, this script will set the gain in the header of the pha), and then use rddescr to read the PHA header and create a file containing the binning information, "chan.txt" for instance. Then you can use this channel information file with the hidden parameter "binfile" in the tool rbnpha:

    	% rbnpha binfile=chan.txt
    	Please enter PHA filename:[]bkg.pha 
    	Please enter output filename:[] bkg_rbn.pha
    	 ** rbnpha 2.1.0
    	 ** rbnpha 2.1.0 completed successfully
    Now you have the correct background PHA file and light curve to apply to your data.

    A quick and qualitative way to check your background is to compare the spectrum to that of the data at the higher PCA energies. Above 20-30 keV, the spectrum is dominated by the background. Enter the two spectra into XSPEC as two data series, with the same response entered for both, and plot them together. You should see that above 30 keV, they lie right on top of one another. If there is an offset, then there is something mismatched in the way the two spectra were extracted, and you should check that you selected the appropriate detectors and anodes, channels, time intervals, etc.

    Note: while pcabackest does not currently compute systematic errors, you may want to apply a value yourself using fparkey to change the SYS_ERR keyword in the PHA file. You can use one percent as a simple estimate or make your own determination. If your source is weak and not especially hard, for instance, you do not expect any counts below 10 keV in the third layer. Extracting only this layer and comparing the background to the data will give you an idea of how large the errors are.

Problems and Remedies

If your background spectrum appears to be slightly overestimating or underestimating (apparent in the highest energy band where there are no source counts), it is most likely due to uncertainties in the activation model. (A large offset is probably just due to extracting the wrong number of anodes or detectors.) Immediately after SAA passage, the activation in the PCA is falling rapidly, but the rate of this fall is not modeled with great precision. You may see variations in the net light curve which are due solely to the activation component of the background estimation, and this may correspond to a total over- or under-estimation of background counts which is apparent when you plot the two spectra (data and background estimation) on top of one another. Until the activation model improves, there are two work-arounds for this problem.