Multiple Models: a Background Modeling Example

In the previous section we showed how to fit the same model to multiple datasets. We now demonstrate how to fit multiple models, each with their own response, to the same dataset. There are several reasons why this may be useful, for instance:

  • We are using data from a coded aperture mask. If there are multiple sources in the field they will all contribute to the spectrum from each detector. However, each source may have a different response due to its position.
  • it We are observing an extended source using a telescope whose PSF is large enough that the signal from different regions are mixed together. In this case we will want to analyze spectra from all regions of the source simultaneously with each spectrum having a contribution from the model in other regions.
  • We wish to model the background spectrum that includes a particle component. The particle background will have a different response from the X-ray background because the particles come from all directions, not just down the telescope.

We will demonstrate the third example here, using example file names; replace with your own file names. Suppose we have a model for the background spectrum that requires a different response to that for the source spectrum. Read in the source and background spectra as separate files:

XSPEC12>data 1:1 source.pha 2:2 back.pha

The source and background files have their own response matrices:

XSPEC12>response 1 source.rsp 2 back.rsp

Set up the model for the source. Here we will take the simple case of an absorbed power-law:

XSPEC12>model phabs(pow)
 
Input parameter value, delta, min, bot, top, and max values for ...
1      0.001(      0.01)          0          0     100000      1e+06
1:data group 1::phabs:nH>
              1       0.01(      0.01)         -3         -2          9         10
2:data group 1::powerlaw:PhoIndex>
              1       0.01(      0.01)          0          0      1e+24      1e+24
3:data group 1::powerlaw:norm>

Input parameter value, delta, min, bot, top, and max values for ...
              1      0.001(      0.01)          0          0     100000      1e+06
4:data group 2::phabs:nH>
              1       0.01(      0.01)         -3         -2          9         10
5:data group 2::powerlaw:PhoIndex>
              1       0.01(      0.01)          0          0      1e+24      1e+24
6:data group 2::powerlaw:norm>0 0

Note that we have fixed the normalization of the source model for the background dataset at zero so it doesn't contribute. Now we need to set up the background model for both datasets with the appropriate response matrices.

XSPEC12>response 2:1 source.rsp 2:2 back.rsp

This tells XSPEC that both these datasets have a second model which must be multiplied by the source.rsp response matrix for its contribution to the source region and back.rsp for its contribution to the background region. This is likely to be the case for a standard imaging data where the response will only depend on the extraction region. Note that for a coded-aperture mask the situation may be more complicated with a different response for the source and the background even if they are extracted from the same region of the detector. We now define the background model to be used. In this case take the simple example of a single power-law

XSPEC12>model 2:myback pow  

Input parameter value, delta, min, bot, top, and max values for ...
              1       0.01(      0.01)         -3         -2          9         10
1:myback:data group 1::powerlaw:PhoIndex>
              1       0.01(      0.01)          0          0      1e+24      1e+24
2:myback:data group 1::powerlaw:norm>

Input parameter value, delta, min, bot, top, and max values for ...
              1       0.01(      0.01)         -3         -2          9         10
3:myback:data group 2::powerlaw:PhoIndex>
              1       0.01(      0.01)          0          0      1e+24      1e+24
4:myback:data group 2::powerlaw:norm>

We have now set up XSPEC so that the source data is compared to a source model multiplied by the source response plus a background model multiplied by the background response and the background data is compared to the background model multiplied by the background response. The background models fitted to the source and background data are constrained to be the same.

XSPEC12>show param
Parameters defined:
========================================================================
Model phabs<1>*powerlaw<2> Source No.: 1   Active/On
Model Model Component  Parameter  Unit     Value
 par  comp
Data group: 1
   1    1   phabs      nH         10^22    1.00000      +/-  0.0          
   2    2   powerlaw   PhoIndex            1.00000      +/-  0.0          
   3    2   powerlaw   norm                1.00000      +/-  0.0          
                           Data group: 2
   4    1   phabs      nH         10^22    1.00000      = 1
   5    2   powerlaw   PhoIndex            1.00000      = 2
   6    2   powerlaw   norm                0.00000      frozen
________________________________________________________________________

========================================================================
Model myback:powerlaw<1> Source No.: 2   Active/On
Model Model Component  Parameter  Unit     Value
 par  comp
                           Data group: 1
   1    1   powerlaw   PhoIndex            1.00000      +/-  0.0          
   2    1   powerlaw   norm                1.00000      +/-  0.0          
                           Data group: 2
   3    1   powerlaw   PhoIndex            1.00000      = myback:1
   4    1   powerlaw   norm                1.00000      = myback:2
________________________________________________________________________

It is often the case that the response information is split into an RMF and ARF, where the RMF describes the instrument response and the ARF the telescope effective area. The particle background can then be included by using the RMF but not the ARF:

XSPEC12>data 1:1 source.pha 2:2 back.pha 
XSPEC12>response 1 source.rmf 2 source.rmf 
XSPEC12>arf 1 source.arf 
XSPEC12>response 2:1 source.rmf 2:2 source.rmf


HEASARC Home | Observatories | Archive | Calibration | Software | Tools | Students/Teachers/Public

Last modified: Friday, 23-Aug-2024 13:20:40 EDT

HEASARC Staff Scientist Position - Applications are now being accepted for a Staff Scientist with significant experience and interest in the technical aspects of astrophysics research, to work in the High Energy Astrophysics Science Archive Research Center (HEASARC) at NASA Goddard Space Flight Center (GSFC) in Greenbelt, MD. Refer to the AAS Job register for full details.