Simulating a NICER Spectrum

Overview

It is often useful to simulate a NICER data set. The software program XSPEC easily accomplishes this. This document describes how to create a simulated spectrum in XSPEC using NICER calibration files.

Read this thread if you want to: Simulate a NICER spectrum.

Introduction

A simulated NICER data set is useful, especially when submitting a proposal. If you know what type of object you wish to show, you can use the typical properties of that object to create a spectrum. A simulated NICER spectrum can easily be created in XSPEC, a software program included in the Heasoft package.

The key components for analysis are:

Prerequisites

Here is what is needed:

  • XSPEC software package. See NICER setup for details on installing the Heasoft software, which includes XSPEC.
  • NICER response file(s). See NICER ARFs and RMFs for details on the response files.
  • The basic properties of the object you wish to simulate: the spectral shape, the flux.
  • Your computer should have enough free storage (disk space) for software, calibration and NICER data. Typically 2 GB is a minimum
  • Generally you should be able to use the Unix command-line, such as bash or tcsh. NICER analysis is not graphical.

Simulating the Spectrum

Load a Model

In order to create a simulated spectrum in XSPEC, start by loading a model that best represents the spectrum you wish to simulate. A common spectral shape is an absorbed power law, similar to the Crab Nebula. Your parameters will change depending on what exactly you are trying to simulate. The column density nH parameter is entered in units of 10^22 atoms cm^-2. The column density of the Crab is around 1/3 in those units; choosing a value of .5 is a good starting point. A photon index of 1.5 or 2 is also a good choice.

XSPEC12>mo tbabs*pow Input parameter value, delta, min, bot, top, and max values for ... 1 0.001( 0.01) 0 0 100000 1e+06 1:TBabs:nH>.5 1 0.01( 0.01) -3 -2 9 10 2:powerlaw:PhoIndex>1.5 1 0.01( 0.01) 0 0 1e+20 1e+24 3:powerlaw:norm> ... ======================================================================== Model TBabs<1>*powerlaw<2> Source No.: 1 Active/Off Model Model Component Parameter Unit Value par comp 1 1 TBabs nH 10^22 0.500000 +/- 0.0 2 2 powerlaw PhoIndex 1.50000 +/- 0.0 3 2 powerlaw norm 1.00000 +/- 0.0 ________________________________________________________________________

You may add more model components with the addc command. The full model can be shown with the show command; the model parameters shown with show par.

The NICER energy range is .25-10keV. Enter the energy band you are interested in modelling. If, for example, you would like 1000 bins between half a keV and 2 keV, enter:

XSPEC12>energies 0.5 2 1000 Models will now use energy array created from: 0.5 - 2 1000 linear bins

You should have an idea of the expected flux for the type of object you would like to simulate. To find the correct normalization, first see what flux is calculated with this energy band at unity normalization:

XSPEC12>flux 0.5 2 Model Flux 0.4046 photons (8.8424e-10 ergs/cm^2/s) range (0.50000 - 2.0000 keV)

If that flux is not what you expect, adjust the norm parameter to give the desired flux. For example, suppose you know your desired target gives a flux of 1e-13 ergs/cm^2/s. The flux above, with unity normalization, is approximately 1e-9 ergs/cm^2/s. To give the required flux, set the normalization to 1e-4. This is done with the newpar command, to change the third parameter. Then check the flux again.

XSPEC12>newpar 3 1e-4 XSPEC12>flux Model Flux 4.046e-05 photons (8.8424e-14 ergs/cm^2/s) range (0.50000 - 2.0000 keV)

And we see that the given flux is now approximately 1e-13 ergs/cm^2/s.

This process is more complicated if you use a multi-component model.

Generate the Data

Now that we have created the model with the desired energies and flux, we can simulate the data for NICER. The simulation is done with the XSPEC fakeit command and the spectral XTI calibration files from the CALDB.

If you would like the model to be calculated on the entire energy range of the response, first reset the energies:

XSPEC12>energies reset

In response to the fakeit command, XSPEC will prompt for the response file(s), counting statistics, new fake file name, exposure time, correction norm, and background exposure time. NICER offers a Redistribution Matrix File (the RMF) and an Ancillary (or Auxiliary) Response File (the ARF). More details about these file formats can be found in OGIP Calibration Memo CAL/GEN/92-002. If you combine these two files into an RSP response file, for example with ftmarfrmf, then you only need to provide that single RSP file when XSpec asks for the response file. You do want counting statistics. Name the output file whatever you wish. Enter your expected time; if you are asking for 10ksec, enter 10000. The defaults are sufficient for norm and background.

You may enter fakeit none if you are not concerned about the background, for example if you are modelling a bright source. The background is more of a concern for faint sources, and you may use the given NICER background file. XSPEC will still generate a background file when given one. Information on creating NICER background files may be found here and here.

Bright Source

XSPEC12>fakeit none For fake spectrum #1 response file is needed: nixtiref20170601v002.rmf ...and ancillary file: nixtiaveonaxis20170601v004.arf Use counting statistics in creating fake data? (y): Input optional fake file prefix: Fake data file name (nixtiref20170601v002.fak): nixti.fak Exposure time, correction norm, bkg exposure time (1.00000, 1.00000, 1.00000): 10000 No background will be applied to fake spectrum #1 1 spectrum in use Fit statistic : Chi-Squared 189.46 using 1501 bins. ***Warning: Chi-square may not be valid due to bins with zero variance in spectrum number: 1 Test statistic : Chi-Squared 189.46 using 1501 bins. ***Warning: Chi-square may not be valid due to bins with zero variance in spectrum number(s): 1 Null hypothesis probability of 1.00e+00 with 1498 degrees of freedom Current data and model not fit yet.

Faint Source

fakeit nixtiback20190807.pi For fake spectrum #1 response file is needed: nixtiref20170601v002.rmf ...and ancillary file: nixtiaveonaxis20170601v004.arf Use counting statistics in creating fake data? (y): Input optional fake file prefix: Fake data file name (nixtiref20170601v002.fak): nixti-2.fak Exposure time, correction norm, bkg exposure time (1.00000e+06, 1.00000, 1.00000e+06): 1 spectrum in use Fit statistic : Chi-Squared 1382.35 using 1501 bins. ***Warning: Chi-square may not be valid due to bins with zero variance in spectrum number: 1 Test statistic : Chi-Squared 1382.35 using 1501 bins. ***Warning: Chi-square may not be valid due to bins with zero variance in spectrum number(s): 1 Null hypothesis probability of 9.85e-01 with 1498 degrees of freedom Current data and model not fit yet.

Load the Data

The spectrum is now ready to be loaded into XSPEC, just like any other spectrum you work with. The names of the corresponding calibration files are stored in the FITS headers of the fake data file, and are automatically read in when the data file is loaded.

Summary

Once you have completed these steps, you should have a spectrum of a simulated data set from NICER.

Next Steps

The nicerl2 thread provides a standard way to analyze any NICER observation.

Modifications

  • 2020-09-15 - initial draft
  • 2021-04-16 - add navigation bar