Manually Applying Spectral Systematic Errors


Once a spectrum has been extracted, it often may need to be adjusted or enhanced by later post-processing steps. This thread describes how to apply the NICER standard systematic error vector, so that individual channels with low calibration uncertainty are appropriately deweighted.

Read this thread if you want to: Apply systematic error to a NICER spectrum.

Last update: 2022-12-08


Spectroscopy is a fundamental pillar of most X-ray data analysis projects An X-ray spectrum provides information about the X-ray target that usually cannot be found by any other means. Thus, generating a quality spectrum is an important task that all NICER users will need to do.

One of the steps to establishing proper quality is to understand and apply an appropriate level of systematic errors. As described on the Plot Ratio (systematic error) analysis thread, NICER spectra often systematics-dominated both for bright and for faint sources. Without an appropriate understanding and application of systematic errors, spectral bins with poor calibration certainty may dominate and bias the scientist's fit.

Applying a systematic error can be achieved in a number of ways. In XSPEC, one can use the "systematic" command which will apply the same systematic uncertainty to each channel of the spectrum. In NICER's case, the calibration uncertainties are dominant in certain portions of the spectrum, so a constant systematic error is not optimal.

Another technique is to use the standard SYS_ERR column of the spectrum file. The SYS_ERR column as well as all other aspects of standard spectral files can be found in the The OGIP Spectral File Format calibration memo, available from HEASARC.

Essentially, the SYS_ERR value is treated as a fractional value, in each spectral bin, the fraction is multiplied by the expected counts according to the current spectral model, and that value is added in quadrature with the other statistical errors when evaluating goodness of fit.

For NICER, there is a standard task niphasyserr to do this operation. Typically the user will apply a standard NICER systematic error vector obtained from the Calibration Database (CALDB).

Please note that nicerl3-spect applies the systematic error using niphasyserr automatically. Running this task manually is not required if you use the nicerl3-spect pipeline.


Here is what is needed:

  • NICER spectrum

Apply Sysetmatic Error to Spectrum

Apply systematic error error to a spectrum with the following command:

niphasyserr infile=myspectrum.pha syserrfile=CALDB


  • infile is the NICER spectrum (here myspectrum.pha)
  • syserrfile is the standard systematic error vector (here CALDB to use the standard vector, which is recommended)

Upon completion, niphasyserr will modify the spectrum in place, adding a SYS_ERR column if needed, and setting the SYS_ERR value to the corresponding standard value from the syserrfile.

Verifying SYS_ERR Values

To verify the SYS_ERR values have been set, we can plot this column from the FITS file. Here is an example plotting session: $ fplot myspectrum.pha Name of X Axis Parameter[error][CHANNEL] CHANNEL Name of Y Axis Parameter[error] up to 8 allowed[SYS_ERR] SYS_ERR Lists of rows[-] Device: /XWindow, /XTerm, /TK, /PS, etc[/xs] /xs Any legal PLT command[ ] PLT> scr white PLT> r y 0 0.04 And the result looks like the following.

One can see that the sysetmatic error is ~1.5% for most of the energy range (channels 30-1000 which is 0.3-10 keV), but outside that range, the error value increases to ~40%.

Next Steps

Although we have presented this step here, please consider using the nicerl3-spect high level spectral pipeline task, which does all NICER-recommended steps.

In addition to extracting a spectrum, one will have to consider response generation, background generation; and applying systematic error, quality flags and bin grouping


  • 2022-10-20 - initial draft