niswbkgspect - estimate NICER Space Weather background spectrum


niswbkgspect infile outfile mkfile selfile


The niswbkgspect task estimates a background file for a NICER spectrum using the "space weather" model that is usable within XSPEC. This background file is estimated using a set of NICER background events (derived from observations of "blank" fields) based on the distribution of the KP solar activity index, the cut-off rigidity (COR_SAX) and the SUN_ANGLE appropriate to a given observation.

This task produces a constant background file containing an estimate of the NICER background. This background file can be subtracted from the NICER target spectrum within XSPEC.


The required inputs to the task are

Please note that this task requires a filter file which has been generated by niprefilter2 version 2.0 or higher. It is possible to run nicerl2 to generate a revised filter file without disturbing your event file by running nicerl2 with the option tasks=MKF.

The task assumes you have access to NICER's Calibration Database (CALDB) in order to access various background calibration files. The NICER CALDB can be installed on a locally mounted disk, or accessed at the HEASARC over the internet.


The outputs of the task is an output background pha file that can be loaded as a background file within XSPEC. This is a standard OGIP "type I" spectrum file.

Using the Space Weather Background Spectrum in XSPEC

When run to completion, niswbkgspect produces an output pha file as specified by the outfile parameter. You can use this file as a background file in XSPEC using the XSPEC background command in the standard way:

    data 1:1 myfile.pha
    back 1 myfile-bkg.pha
    resp 1:1 myfile.rmf
    arf 1:1  myfile.arf
(assuming the target spectrum is myfile.pha, with an associated RMF file and associated ARF file, and the output spectrum is myfile-bkg.pha).


infile [filename]
Input spectrum file name for which the background model is to be estimated. If updatepha=YES, this file must be writable.
outfile [filename]
Name of output estimated background file.
mkfile [filename]
Name of the filter file (.mkf file).
selfile [filename]
Name of the file containing FPM Selection information. This should either be the cleaned event list (recommended), although the filter file can also be specified if necessary, with the limitations described above.
(gtifile="$INFILE[GTI]") [string]
File name[extension] containing the Good Time Interval used to create the input spectrum file. The patterns $INFILE and $OUTFILE are replaced by the infile and outfile parameters. Therefore, the default setting of "$INFILE[GTI]" will look for the GTI extension of the input file.
(auxilfile = NICER_AUXIL/30nov18targskc_enhanced.evt) [string]
Name of background event file.
(gti_min = 0).
Minimum gti duration to use, in seconds.
(selcol = INDEF) [string]
FPM Selection column name (or INDEF)
(updatepha="YES") [boolean]
If yes, then modify the input file's BACKFILE keyword to be background file output by this task.
(cleanup="YES") [boolean]
If yes, then clean up temporary files. If no, temporary files remain. This is typically for debugging.
(clobber = NO) [boolean]
If the output file already exists, then setting "clobber = yes" will cause it to be overwritten.
(chatter = 2) [integer, 0 - 5]
Controls the amount of informative text written to standard output. Setting chatter = 4 or higher will produce detailed diagnostic output; chatter = 1 prints out a basic diagnostic message. The default is to produce a brief summary on output.
(history = YES) [boolean]
If history = YES, then a set of HISTORY keywords will be written to the header of the specified HDU in the output file to record the value of all the niswbkgspect task parameters that were used to produce the output file.


Run niswbkgspect for myspectrum.pha, using the spectrum's GTI, for all pre-launch operating detectors. The filter file is ni1234567890.mkf and the cleaned event file with FPM Selection information is in ni1234567890_0mpu7_cl.evt.

   niswbkgspect myspectrum.pha myspectrum-bkg.pha \
     ni1234567890.mkf ni1234567890_0mpu7_cl.evt \
     myspectrum_sky.arf myspectrm.rmf 

Note that the output is stored in myspectrum-bkg.pha.










Sep 2022