Manual Background Estimation

Overview

NICER is subject to a varying charged particle environment at the high-inclination ISS orbit, which traverses regions of trapped charged particles near the South Atlantic Anomaly and the regions near the north and south poles (the ``polar horns''). Charged particle background is most noticeable at high energies. At low energies NICER background is dominated by optical light contamination at low sun angles and an instrumental noise peak which produces excess events at energies of <0.4 keV. This thread discusses the steps needed to estimate background manually.

Read this thread if you want to: Estimate Background for a NICER Observation Manually

Last update: 2024-07-19

Introduction

Please note that this page discusses generating background manually using various NICER tools. The NICER team recommends using the nicerl3-spect tool to generate background automatically for any of the three listed background model types.

The ISS orbit takes NICER through a wide range of geomagnetic latitudes each with its own background characteristics. At high latitudes, the background is dependent on space weather and the variability of the Sun. Individual observations thus have different background levels that must be understood to maximize the science return.

To calibrate the background, NICER observes blank sky background fields used which were used by RXTE (Jahoda et al. 2006) and also a few select locations near some of NICER's long term and faint MSPs. These data form a database for two different and independently developed background modeling tools.

NICER includes three background modeling tools within the NICERDAS software system. The background models included are:

  • SCORPEON. SCORPEON provides the ability to perform very high quality background modeling in a range of conditions. Unlike other models which produce a background file which is subtracted from the source spectrum, in its more sensitive form SCORPEON produces a background model which can be modeled in XSPEC along with the source parameters. Please see the SCORPEON Overview Page for more detailed information.
  • 3C50. The Remillard et al. 3C50 model, as implemented in the nibackgen3c50 tool, is now part of NICERDAS. This tool was previously a separate download and is now integrated into HEASoft and requires no separate downloads.
  • Space Weather. The Gendreau & Corcoran Space Weather background tool is also a part of this NICERDAS release. Like 3C50, the Space Weather model previously required separate downloads and now does not.

Prerequisites

Before you begin this thread, you must have a complete NICERDAS and calibration environment installed. Please use the Settting Up a NICER Analysis Environment thread if you need further help.

Please note that as of HEASoft 6.31, all three background models and auxiliary files are included within NICERDAS and NICER's CALDB. There is no need for any separate downloads or installations. Instructions for legacy installations are included at the bottom of this thread.

The nibackgen3C50 Model: Initial Steps

For this example we'll use the NICER observation with OBSID 2010100101. We'll assume you have downloaded these data to /path/to/mynicerdata/2010100101.

Manually Extracting 3C50 Background

To estimate a 3C50 background spectrum for this observation using nibackgen3C50, do the following: nibackgen3C50 rootdir='/path/to/mynicerdata' obsid='2010100101' \ bkgidxdir=CALDB bkglibdir=CALDB gainepoch=AUTO

The obsid parameter is used as the observation directory name, which should be located in rootdir.

The gainepoch parameter specifies the gain used to generate the background model. When it is set to AUTO, it is determined automatically from your data. The bkgidxdir and bkglibdir parameters are set to CALDB to refer to NICER Calibration Database.

nibackgen3C50 will then extract a gross (source+background) spectrum from the specified OBSID, and create a background spectrum. By default these files are created in the current working directory. The created files have default names:

  • nibackgen3C50_tot.pi - the "total" (source+background) spectrum extracted from the clean data. This is the "data" spectrum to use within XSPEC. Note that nibackgen3C50 may censor additional portions of your clean event file if they fall outside of the background library range.
  • nibackgen3C50_bkg.pi - the estimated background spectrum corresponding to the total spectrum. This is the "background" spectrum to use within XSPEC.
  • nibackgen3C50_bkg_ngt.pi and nibackgen3C50_bkg_day.pi - the estimated "night" and "day" background spectru, for reference only.

Alternate Output File Names

The names of the output files can be adjusted using the totspec and bkgspect parameters. For example to place the files in /path/to/my/nicerdata/2010100101 with the names ni2010100101_*.pi, use: nibackgen3C50 rootdir='/path/to/mynicerdata' obsid='2010100101' \ bkgidxdir=CALDB bkglibdir=CALDB gainepoch=AUTO \ totspec=/path/to/mynicerdata/ni2010100101_tot \ bkgspec=/path/to/mynicerdata/ni2010100101_bkg Note that nibackgen3C50 automatically adds the .pi suffix.

Explicit Input Event Files

By default nibackgen3C50 uses the NICER standard observation directory layout to find the cleaned event file ("CL" file) and the unfiltered event file ("UFA" file) as inputs to the task. This can be convenient if you have used the standard processing, but inconvenient if you have created NICER event files in a different manner, or with different file names. To use non-standard event files as inputs, use the ufafile and clfile parameters.

For example, if your event files are kept in /results/ni2010100101_ufa.evt and /results/ni2010100101_cl.evt, you can use the following command line: nibackgen3C50 NONE NONE CALDB CALDB AUTO \ calevtdir=NONE \ ufafile=/results/ni2010100101_ufa.evt \ clfile=/results/ni2010100101_cl.evt

OBSOLETE: Running nibackgen3C50 Standalone

The 3C50 model is included in HEASoft 6.31 and NICER CALDB. You can still download and install the tool separately, but this method is now OBSOLETE. Please beware that the standalone tool will not necessarily be updated in the future.

Download the nibackgen3C50 file from the Background Estimator Tools page and install it by following the installation instructions

After standalone installation, the 3C50 auxiliary files will be installed in a separate reference directory location. We will refer to this location as /path/to/3c50referencefiles.

An example of running the standalone-downloaded tool: nibackgen3C50 rootdir='/path/to/mynicerdata' obsid='2010100101' \ bkgidxdir='/path/to/3c50referencefiles' \ bkglibdir='/path/to/3c50referencefiles' gainepoch='2019'

Manually Extracting Space Weather Background

Again we will assume you have your NICER environment already set up. The Space Weather background model is now included in NICERDAS 10 (HEASoft 6.31 and higher). If not, please see the Settting Up a NICER Analysis Environment thread if you need further help.

The Space Weather also requires that the geomagnetic Kp value be included in the filter file, which the default if you use HEASoft 6.31 or higher.

Again for this example we'll use the NICER observation with OBSID 2010100101. We'll assume you have downloaded these data to /path/to/mynicerdata/2010100101.

We'll assume you've created this spectrum and written it to disk at /path/to/mynicerdata/spectra/ni2010100101.pha. If you need help extracting a spectrum, please see the Complete Spectral Product (nicerl3-spect) thread. You will also need your filter file and cleaned event list.

To estimate a background spectrum for this observation using the Space Weather model, do the following. niswbkgspect infile=ni2010100101.pha \ outfile=ni2010100101_bkg.pha mkfile=ni2010100101.mkf \ selfile=ni2010100101_0mpu7_cl.evt clobber=YES where

  • infile is the source+background spectrum extracted from a cleaned NICER event list outfile is the output background estimate file name mkfile is the filter file name
  • selfile is the source of FPM selection information, typically the cleaned event list
niswbkgspect will estimate the background and place it in the file designated by outfile. As of HEASoft 6.31, the normalization of the estimate is corrected approximately for the number of enabled detectors.

Alternate usage (nibkgestimator)

When the Space Weather model was published as a separate download, a Python tool named nibkgestimator was available. This tool is still available for legacy applications and is run the same way. Here is an example: nibkgestimator /path/to/mynicerdata/spectra/ni2010100101.pha \ /path/to/mynicerdata/2010100101/auxil/ni12010100101.mkf where

  • /path/to/mynicerdata/spectra/ni2010100101.pha is the path to your spectrum
  • /path/to/mynicerdata/2010100101/auxil/ni12010100101.mkf is the path to your filter file, with KP column added.
nibkgestimator will then create an estimated background spectrum called /path/to/mynicerdata/spectra/ni2010100101_bkg.pha. This estimate is not adjusted based on number of enabled detectors.

Please see the detailed instructions on the Background Estimator Tools page for additional usage examples.

Manually Extracting a SCORPEON Background Estimate

The SCORPEON model is a background model for NICER data. The model is unique in that it embodies contributions from many physically-motivated components. These include sky-related components such as the cosmic X-ray background (CXB), local hot bubble (LHB) and galactic halo; and also non X-ray background components such as cosmic rays (COR), South Atlantic Anomaly (SAA), trapped electrons (TREL), precipitating electrons (PREL), low energy storm-related electrons (LEEL), and so on.

The two SCORPEON software tasks available are,

  • niscorpspectmod - generate a SCORPEON background model
  • niscorpspect - generate a SCORPEON background file
For most sensitive analysis, users wishing to perform manual background modeling should use niscorpspectmod.

All of the required tools and auxiliary files to use SCORPEON are included within NICERDAS 10 (HEASoft 6.31 or higher).

We will again assume the user is processing observation 2010100101. It is best to change into the product directory when running SCORPEON: cd /path/to/mynicerdata/2010100101/xti/event_cl If you have placed your products in a different directory, then it is recommended to change to that working directory.

We'll assume you've created a spectrum and written it to disk at ni2010100101.pha. If you need help extracting a spectrum, please see the Complete Spectral Product (nicerl3-spect) thread. You will also need your filter file and cleaned event list.

To estimate a SCORPEON background model for this spectrum, do the following, niscorpspectmod infile=ni2010100101.pha \ outfile=ni2010100101_bkg.xcm mkfile=ni2010100101.mkf \ selfile=ni2010100101_0mpu7_cl.evt \ skyarffile=ni2010100101_sky.arf \ specrespfile=ni2010100101_det.rmf clobber=YES where

  • infile is the source+background spectrum extracted from a cleaned NICER event list
  • outfile is the output background estimate script file name
  • mkfile is the filter file name
  • selfile is the source of FPM selection information, typically the cleaned event list
  • skyarffile is the name of the output ARF response file to be used for diffuse sky backgrounds (not your source)
  • specrespfile is the name of the output RMF response file to be used for particle backgrounds (not your source)

niscorpspectmod will produce an estimated background model script. Please note that the output is an XSPEC script and not a background file. This script will be used within XSPEC.

Load SCORPEON Background Model Into XSPEC

Since the default SCORPEON output is a background model usable within XSPEC, you need to load this model.

First, you need to start XSPEC xspec

Next, load your data like you normally would within XSPEC. data 1:1 ni2010100101.pha arf 1:1 ni2010100101.arf resp 1:1 ni2010100101.rmf Here, the PHA is the source+background spectrum, and the ARF and RMF responses are for the science target. (They are not the "Sky ARF" or background RMF produced by niscorpspectmod).

Now, activate the SCORPEON background model for this spectrum with the following statements: set nicer_bkgspect 1 @ni2010100101_bkg.xcm where ni2010100101_bkg.xcm is the output file produced by niscorpspectmod. The "Sky ARF" and background RMF are loaded automatically by this script. Please note that XSPEC does not handle subdirectories very well: you will need to run XSPEC from the same current working directory as you ran niscorpspectmod from.

At this point you can define the model for your source. The background model will appear as a separate trace. For example, if you use the plot ldata command, the result will look like this:

Figure 1. Sample SCORPEON spectrum using XSPEC "plot ldata" command.

As an example you can define your model as, model tbabs*powerlaw and this model will be applied to the target. A definition such as this will not interfere with SCORPEON background model components, which are defined with different source names/numbers.

Extracting a SCORPEON Background File (not Model)

While a background model provides the analyst with maximum flexibility, in some cases a background file is required. SCORPEON supports this option as well.

A "file" output will product a static background file that most XSPEC users are accustomed to, but it will not be adjustable. This is most suitable for users that can't adapt to the complexity of the fully fittable SCORPEON model, or need to exchange data with other non-XSPEC users. Settings "bkgmodeltype=scorpeon bkgformat=file" (for more details see niscorpeon).

To estimate a SCORPEON background file for this spectrum, do the following, niscorpspect infile=ni2010100101.pha \ outfile=ni2010100101_bkg.pha mkfile=ni2010100101.mkf \ selfile=ni2010100101_0mpu7_cl.evt \ skyarffile=ni2010100101_sky.arf \ specrespfile=ni2010100101_det.rmf clobber=YES where

  • infile is the source+background spectrum extracted from a cleaned NICER event list outfile is the output background estimate file name mkfile is the filter file name
  • selfile is the source of FPM selection information, typically the cleaned event list
  • skyarffile is the name of the output ARF response file to be used for diffuse sky backgrounds (not your source)
  • specrespfile is the name of the output RMF response file to be used for particle backgrounds (not your source)

In this case outfile is a background file, and not spectrum.

To use the resulting file within XSPEC, you can use the following commands. data 1:1 ni2010100101.pha arf 1:1 ni2010100101.arf resp 1:1 ni2010100101.rmf back 1 ni2010100101_bkg.pha

Other SCORPEON Topics

The SCORPEON model has other capabilities, such as writing its scripts in Python. For more information, please see the Complete Spectral Product (nicerl3-spect), SCORPEON Overview, and niscorpeon pages.

Related Topics

OBSOLETE: Installing 3C50 and Space Weather

Both the 3C50 and Space Weather background models were originally provided as separate downloads. Both the software and the auxiliary files were to be downloaded and installed separately.

The NICER team no longer recommends the separate-download option for either 3C50 or Space Weather. Use the versions included within NICERDAS / HEASoft 6.31 instead.

For legacy purposes please refer to the Background Estimator Tools for installation information.

Modifications

  • 2020-10-03 - initial draft
  • 2021-04-16 - add navigation bar
  • 2022-11-23 - change title
  • 2022-11-30 - include SCORPEON and update all for HEASoft 6.31
  • 2023-07-27 - fix command line when using explicit event files