Manually Applying Quality Flags

Overview

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 NICER QUALITY flags to an existing spectrum, so that "bad" bins are automatically ignored by analysis tools like XSPEC.

Read this thread if you want to: Apply QUALITY flags to a NICER spectrum.

Last update: 2022-10-26

Introduction

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 flag known "bad" spectral bins. This can be achieved using the standard QUALITY column. The QUALITY 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, spectral bins whose QUALITY value are zero are considered good. A non-zero value indicates "bad" data. For NICER, there is a standard task niphaquality to do this operation. The user specifies the desired channel range(s). This thread describes how to use niphaquality.

Prerequisites

Here is what is needed:

  • NICER spectrum
  • Desired "good" channel range, typically 22-1501 (0.22-15.01 keV)

Apply Quality Flags

Apply quality flags with the following command:

niphaquality infile=myspectrum.pha noticerange=22:1501

where

  • infile is the NICER spectrum (here myspectrum.pha)
  • noticerange is the range of "good" spectral channels (here 22-1501)

Upon completion, niphaquality will modify the spectrum in place, adding a QUALITY column if needed, and setting the QUALITY flag to "good" for the good channels and "bad" for the bad channels.

Verifying QUALITY Flags

To verify the QUALITY flag setting has occurred, 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[QUALITY] QUALITY Lists of rows[-] Device: /XWindow, /XTerm, /TK, /PS, etc[/xs] /xs Any legal PLT command[ ] PLT> scr white PLT> p And the result looks like the following.

One can see that QUALITY is 1 for spectral channels 0-21, and 0 for the remaining channels 22-1501. (channel 1501 is the top channel for NICER spectra)

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

Modifications

  • 2022-10-20 - initial draft