next up previous contents
Next: INTEGRAL Specific Command Line Up: Walks through XSPEC Previous: Markov Chain Monte Carlo

INTEGRAL/SPI: A Walk Through Example

Consider an observation of the Crab, for which a (standard) $5\times5$ dithering observation strategy was employed. Since the Crab (pulsar and nebular components are of course un-resolvable at INTEGRAL's spatial resolution) is by far the brightest source in it immediate region of the sky, and its position is precisely known, we can opt not to perform SPI or IBIS imaging analysis prior to XSPEC analysis. We thus run the standard INTEGRAL/SPI analysis chain on detectors 0-18 up to the SPIHIST level for (or BIN_I level in the terminology of the INTEGRAL documentation), selecting the ``PHA'' output option.

We then run SPIARF, providing the name of the PHA-II file just created, and selecting the ``update'' option in the spiarf.par parameter file (you should refer to the SPIARF documentation prior to this step if it is unfamiliar). The celestial coordinates for the Crab are provided in decimal degrees (RA,Dec = 83.63,22.01) interactively or by editing the parameter file. This may take a few minutes, depending on the speed of your computer and the length of your observation. Once completed, SPIARF must be run one more time, setting the ``bkg_resp'' option to ``y''; this creates the response matrices to be applied to the background model, and updates the PHA-II response database table accordingly. Then SPIRMF, which interpolates the template RMFs to the users desired spectral binning, also writes information to the PHA response database table to be used by XSPEC. Finally, you should run SPIBKG_INIT, which will construct a set of bbackground spectral templates to initialize the SPI background model currently installed in XSPEC (read the FTOOLS help for that utility carefully your first time). You are now ready to run XSPEC; a sample session might look like this (some repetitive output has been suppressed):

% xspec

                XSPEC version: 12.2.1
        Build Date/Time: Wed Nov 2 17:14:21 2005

XSPEC12>package require Integral 1.0
XSPEC12>data ./myDataDir/rev0044_crab.pha{1-19}

19 spectra  in use

RMF # 1
 Using Response (RMF) File            resp/comp1_100x100.rmf
RMF # 2
 Using Response (RMF) File            resp/comp2_100x100.rmf
RMF # 3
 Using Response (RMF) File            resp/comp3_100x100.rmf

Using Multiple Sources

For Source # 1
 Using Auxiliary Response (ARF) Files

For Source # 2
 Using Auxiliary Response (ARF) Files

Source File: ./myDataDir/rev0044_crab.pha{1}
Net count rate (cts/s) for Spectrum No. 1    3.7011e+01   +/- 1.2119e-01
 Assigned to Data Group No. : 1
 Assigned to Plot Group No. : 1

Source File: ./myDataDir/rev0044_crab.pha{2}
Net count rate (cts/s) for Spectrum No. 2    3.7309e+01   +/- 1.2167e-01
 Assigned to Data Group No. : 1
 Assigned to Plot Group No. : 2
Source File: ./myDataDir/rev0044_crab.pha{19}
Net count rate (cts/s) for Spectrum No. 19   3.6913e+01   +/- 1.2103e-01
 Assigned to Data Group No. : 1
 Assigned to Plot Group No. : 19

XSPEC12>mo 1:crab po

Input parameter value, delta, min, bot, top, and max values for ...
    1    PhoIndex              1.0000E+00         1.0000E-02     -3.0000E+00     -2.0000E+00      9.0000E+00      1.0000E+01
crab::powerlaw:PhoIndex>2.11 0.01 1.5 1.6 2.5 2.6
    2        norm              1.0000E+00         1.0000E-02      0.0000E+00      0.0000E+00      1.0000E+24      1.0000E+24
crab::powerlaw:norm>8. 0.1 1. 2. 18. 20.
 XSPEC12>mo 2:bkg spibkg5

Input parameter value, delta, min, bot, top, and max values for ...
    1       Par_1              0.0000E+00         1.0000E-02     -2.0000E-01     -1.5000E-01      1.5000E-01      2.0000E-01

XSPEC12>ign 1-19:68-80
XSPEC12>ign 1-19:90-100
Number of trials and critical delta: 10  1.0000000E-02
Model bkg:spibkg5 Source No.: 2   Active/On
Model Component Name:  spibkg5  Number:    1
  N          Name       Unit       Value                 Sigma
    1       Par_1              9.0650E-03       +/-     2.8651E-03
    2       Par_2              1.6174E-02       +/-     3.4778E-03
   25      Par_25             -1.9537E-02       +/-     6.1429E-03
   26        norm              9.7286E-01       +/-     1.3527E-03

Model crab:powerlaw Source No.: 1   Active/On
Model Component Name: powerlaw  Number:    1
  N          Name       Unit       Value                 Sigma
    1    PhoIndex              2.1163E+00       +/-     1.8946E-02
    2        norm              1.1390E+01       +/-     8.1414E-01

 Chi-Squared =  1.8993005E+03 using 1463 PHA bins.
 Reduced chi-squared =  1.3235544E+00 for   1435 degrees of freedom
 Null hypothesis probability =  1.5268098E-15

Note that the syntax used for the data statement (appended curly bracket, specifying use of spectra 1-19), and the separate model commands, which are indexed and named (in this case simply ``crab'' for the source of interest and ``bkg'' for the background model, ``spibkg_lo''. These commands are described in detail elsewhere in this document, as are the the spibkg_lo, spibkg_med and spibkg_hi models. In this case, 100 logarithmically-spaced energy bins spanning the nominal 20-8000 keV band of the SPI instrument were used.

In this example, only one dither-point was used to solve for the Crab spectrum, and the background. The simple assumption of a single background spectrum (i.e. no detector-to-detector variations) was assumed. In general, and particularly for fainter sources, a much larger number of spectra will be needed for a solution (and even for the Crab, the quality of the fit, and the accuracy of the inferred parameters can be improved). Also, detector-to-detector and/or time (i.e. pointing-to-pointing) variations will need to be considered. This can be accomplished using the data-grouping feature of XSPEC, which will be described subsequently. Also notice that channels between about 70 and 80 were ignored; this is because there are detector electronic effects contaminating the single-event data for energies from 1250-1400 keV (refer to the SPI data analysis manual for additional discussion), and that there are a lot of (scientifically uninteresting) background model parameters. Also, the highest energies were ignored, since the source flux becomes insignificant relative to the background.

Some results are illustrated below. These plots were generated with the sequence of commands:

XSPEC12> setplot group 1-19
XSPEC12> plot ldata res
XSPEC12> plot ufspec



Note that without the ``setplot group'' command, XSPEC would plot 19 sets of spectral data, models and residuals. The can become confusing, especially as the number of spectra included in an analysis becomes much larger than 19! On the other hand, it can be useful to divide the data into subsets for plotting purposes, e.g. setplot group 1-6 7-12 13-19, to get an idea of relative shadowing effects of the coded-mask. The left hand plot illustrates the source model, the background model, the total model (i.e. source + background), and the data (here in count rates per channel). The right hand plot illustrates the ``unfolded model'' (blue, power-law curve), the summed model, and the data as a photon flux. A possible source of confusion is the similarity of the background model curves plotted in theses two separate representations. The explanation is that the background, which is dominated by instrumental contributions, is modeled in detector count space (i.e. the background response matrix has unit effective area. Thus, to be strictly correct, the right-hand plot is a hybrid of the photon source model and the detector-rate background model. We further note that at the present time, XSPEC does not have the capability to plot (or store and manipulate) the background subtracted data. This is a feature under consideration for a future release.

If we had chosen a observation containing more than a single source, the procedure would have been similar, except that the sequence of model commands would be extended, e.g.

XSPEC12>data  ./MyDataDir/GCDE_aug_03.pha{1-475}
XSPEC12> model 1:1e1740 po 
XSPEC12> model 2:gx1_4 po 
XSPEC12> model 3:bkg spibkg_lo

Here data from the Galactic Center deep exposure campaign were loaded, and two sources are sought. In this case, a much larger number of spectra were loaded (475 spectra corresponds to one full $5\times5$ dither using all 19 detectors.

In this case, the simple approach of applying constant background (i.e. no detector-to-detector or pointing-to-pointing variation) to the full data set is likely to be a poor approximation. A more realistic approach would be to use the XSPEC grouping capability to handle such variations in the background solution. This can be accomplished in the usual manner (refer to the description of the grouping command in this document), however, it can become tedious in terms of the required command line inputs. For example, to establish a separate data group for each detector for a long (e.g. $5\times5$ dither) observations, a sequence of commands such as this would be required:

XSPEC12> data   1:1        ./MyDataDir/rev0044_Crab.pha.fits{1}
XSPEC12> data   2:2        ./MyDataDir/rev0044_Crab.pha.fits{2}
XSPEC12> data   3:3        ./MyDataDir/rev0044_Crab.pha.fits{3}
XSPEC12> data   19:19       ./MyDataDir/rev0044_Crab.pha.fits{19}
XSPEC12> data   1:20        ./MyDataDir/rev0044_Crab.pha.fits{20}
XSPEC12> data   2:21        ./MyDataDir/rev0044_Crab.pha.fits{21}
XSPEC12> data   3:22        ./MyDataDir/rev0044_Crab.pha.fits{22}
XSPEC12> data   19:38      ./MyDataDir/rev0044_Crab.pha.fits{38}
XSPEC12> data   1:39        /MyDataDir/rev0044_Crab.pha.fits{39}
XSPEC12> data   2:40        ./MyDataDir/rev0044_Crab.pha.fits{40}
XSPEC12> data   3:41        ./MyDataDir/rev0044_Crab.pha.fits{41}
XSPEC12> data   18:474       ./MyDataDir/rev0044_Crab.pha.fits{474}
XSPEC12> data   19:475       ./MyDataDir/rev0044_Crab.pha.fits{475}

One might then for example, make a first cut attempt by fitting a constant background. Then, as a next step, one might allow the normalization terms of the background model to vary over the groups (i.e. over the detector plane). This is accomplished with the ``untie'' command, using the following sequence:

XSPEC12>  untie   bkg:52
XSPEC12>  untie   bkg:78
XSPEC12>  untie   bkg:104
XSPEC12>  untie   bkg:130
XSPEC12>  untie   bkg:156
XSPEC12>  untie   bkg:182
XSPEC12>  untie   bkg:208
XSPEC12>  untie   bkg:234
XSPEC12>  untie   bkg:260
XSPEC12>  untie   bkg:286
XSPEC12>  untie   bkg:312
XSPEC12>  untie   bkg:338
XSPEC12>  untie   bkg:364
XSPEC12>  untie   bkg:390
XSPEC12>  untie   bkg:416
XSPEC12>  untie   bkg:442
XSPEC12>  untie   bkg:468
XSPEC12>  untie   bkg:487

Note that use of the ``bkg'' identifier, which associates the parameters index with the background model. The specific sequence of numbers use here requires some explanation; the particular background model employed has 25 parameters (which simply correspond in rank order to the 25 most variable individual bins), and a normalization term, i.e. parameter 26. Thus, the normalization for the second detector group is parameter 52, for the third parameter 78, and so on. Similar command sequences can be used to untie additional background model parameters. Supposing that we did this and refitted the data. We then might, for example wish to go back and freeze the individual normalization terms with the freeze command:

XSPEC12>  freeze  bkg:26
XSPEC12>  freeze  bkg:52
XSPEC12>  freeze  bkg:487

By now though, you probably get the idea that this all requires an unreasonable amount of command-line input. To circumvent this problem, a number of INTEGRAL/SPI specific ``tcl'' scripts are available which greatly streamline this process.

next up previous contents
Next: INTEGRAL Specific Command Line Up: Walks through XSPEC Previous: Markov Chain Monte Carlo