**SPIdata**

The SPIdata procedure, which when installed can be treated as an XSPEC command, greatly facilitates the data initialization step. For example, the command

XSPEC12> SPIdata ./MyData/Dir/rev0044_crab.pha 475 det Y

Opens the Crab observation spectral data file, reads the 475 spectra into memory, grouping them by detector. The ``Y'' then indicates that, yes, I wish to ignore the spectral data channels corresponding to the known detector-electronic noise contamination (this is the default). Instead of ``det'' as the grouping option I could have selected ``time'' to group by time (quantized into dither-pointing intervals). A ``-'' lead to the data being initialzed into a single group. The command:

XSPEC12> SPIdata ./MyData/Dir/rev0044_crab.pha 475

Reads the 475 spectra into a single data group, and ignores the undesirable channels. If you forget all this, the command

XSPEC12> SPIdata -h

will remind you. The scripts SPIuntie, and SPIfreeze have similar command-line syntax.

**SPIuntie and SPIfreeze**

XSPEC12> SPIuntie bkg 475 19 -1

The SPIuntie command script will accomplish the same result as the sequence of ``untie'' commands in the INTEGRAL/SPI example presented in this document. In that case, we had loaded 475 spectra associated with a single -dither pattern centered on the Crab nebula. The spectra were grouped by detector, which is a common approach to SPI analysis given the known detector-to-detector variations in the background rates. Suppose after an initial fitting pass, for which we assumed a single background spectrum, we know wish to untie the individual data group (i.e. detector) background models. This can be accomplished by issuing 25 ``untie'' commands as previously noted, or in a single command line using the SPIuntie command:

XSPEC12> SPIuntie bkg 475 19 -1 untie bkg:52 Chi-Squared = 1.2030200E+04 using 1615 PHA bins. Reduced chi-squared = 7.5852458E+00 for 1586 degrees of freedom Null hypothesis probability = 0.0000000E+00 untie bkg:78 Chi-Squared = 1.2030200E+04 using 1615 PHA bins. Reduced chi-squared = 7.5900314E+00 for 1585 degrees of freedom Null hypothesis probability = 0.0000000E+00 untie bkg:104 renorm: no renormalization necessary Chi-Squared = 1.2030200E+04 using 1615 PHA bins. Reduced chi-squared = 7.5948231E+00 for 1584 degrees of freedom Null hypothesis probability = 0.0000000E+00 ...

One might then make a second pass at fitting the data, hopefully leading to improved statistics. Subsequently, additional background model parameters could be untied using the SPIuntie procedure as well. For example, to untie three additional parameters over the full data set, the command syntax is:

XSPEC12> SPIuntie bkg 475 19 1 3 ...

This will untie the first 3 parameters of the background model identified by ``bkg'', i.e. equivalent to issuing individual untie commands. Note that you can always be reminded of the command-line argument definitions by typing ``SPIuntie -h'' at the XSPEC prompt.

Suppose now that you are satisfied with the relative background normalization terms, and wish to freeze them at their current values for subsequent fitting passes. This could be accomplished using the SPIfreeze command script:

XSPEC12> SPIfreeze bkg 475 -1 XSPEC12>SPIfreeze bkg 19 1 -1 freeze bkg:52 1 Chi-Squared = 6.6232600E+05 using 1805 PHA bins. Reduced chi-squared = 3.7589444E+02 for 1762 degrees of freedom Null hypothesis probability = 0.0000000E+00 freeze bkg:78 Chi-Squared = 6.5791894E+05 using 1805 PHA bins. Reduced chi-squared = 3.7318148E+02 for 1763 degrees of freedom Null hypothesis probability = 0.0000000E+00 ...

As with the SPIuntie command script, typing ``SPIfreeze -h'' at the XSPEC prompt will scroll the command-line definitions to your screen.

Note that the current SPI background models, which are documented elsewhere, are designed so that the parameter list is hierarchically ordered in terms of decreasing criticality. Thus, freeing the first parameter is likely to have the most significant impact on the statistics, the second parameter, the next most significant, and so on.