next up previous contents pdf.png
Next: 7.19 COLLATED_FILENAME Stage Up: 7 Using ACIS Extract Previous: 7.17 CHECK_POSITIONS Stage

Subsections



7.18 FIT_SPECTRA Stage

This stage is run at least once after MERGE_OBSERVATIONS has been completed to perform automated spectra fitting using the XSPEC spectral fitting package by Keith Arnaud. A suitable XSPEC script, meeting specific AE interface requirements described below, must be provided. Several such scripts, implementing simple XSPEC models, are distributed with AE (§5.12).

An excellent introduction to the concept of fitting X-ray spectra can be found in one of Keith Arnaud's PowerPoint presentations.

7.18.1 Actions

7.18.2 Usage and Inputs

acis_extract, srclist_filename, /FIT_SPECTRA, CHANNEL_RANGE=[value,value], MODEL_FILENAME=filepath, MODEL_CHANGES_FILENAME=filepath, /CSTAT, SNR_RANGE=[value,value], NUM_GROUPS_RANGE=[value,value], /GROUP_WITHOUT_BACKGROUND, /INTERACTIVE, FIT_TIMEOUT=value


EXAMPLE:
idl $\vert\&$ tee fit_spectra.log


acis_extract, 'all.srclist', /FIT_SPECTRA, CHANNEL_RANGE=[35,548], MODEL_FILENAME='~/my_models/tbabs_vapec.xcm'


EXAMPLE:
idl $\vert\&$ tee fit_spectra.log


acis_extract, 'all.srclist', /FIT_SPECTRA, CHANNEL_RANGE=[35,548], MODEL_FILENAME='~/my_models/tbabs_vapec.xcm', MODEL_CHANGES_FILENAME='~/my_models/NH_frozen.xcm', /CSTAT


EXAMPLE:
idl $\vert\&$ tee fit_spectra.log


acis_extract, 'all.srclist', /FIT_SPECTRA, CHANNEL_RANGE=[35,548], MODEL_FILENAME='~/my_models/tbabs_vapec.xcm', /CSTAT, SNR_RANGE=[1,5], NUM_GROUPS_RANGE=[6,250]

AE's fitting scripts include a placeholder for loading a frozen observer-supplied model for background components that are not represented by the background observation that has been extracted. For example, when the ACIS ``stowed'' observations are extracted as the background spectrum for a diffuse source, then the observer will want to supply a model for the celestial background components (which are not present in the stowed data). You should ponder whether it is more appropriate for this celestial background model to be frozen or free:

7.18.3 Troubleshooting

If an XSPEC session encounters a problem it will often be able to notify AE that the fit was not completed successfully. AE will print an error message, and suggest that you look in the log file produced by the XSPEC run. That log file can be confusing to read, because the commands that are being run by the script are not (by default) echoed to the log file. Your best shot is to skip to the end of the log file and look for a message that gives a clue about the problem.

If the log file is no help, then your next debugging step should be to repeat the XSPEC run manually in a shell in order to reproduce the failure outside the context of AE. Although the unix command line that AE spawns to run XSPEC (shown in the IDL window) is complex at first glance, the heart of it is simply the normal syntax required to have XSPEC run a TCL script, for example:

    xspec  -  spectral_models/grp3.0_tbabs_pow.xcm
Although you can manually run the fitting script in that manner (supplying it as a parameter to XSPEC on the command line), you will often find that XSPEC will exit immediately after the problem is encountered, preventing you from exploring the state of the model, looking at the fit, etc. Thus, it is often better to start XSPEC and then load the script, for example:
    xspec
      @spectral_models/grp2.0_tbabs_pow.xcm

If the fitting script is running normally, but the spectral model parameters are running ``off into the weeds'', then you should first suspect that the problem is arising during execution of the ``error'' command. When a model parameter is poorly constrained, the ``error'' command can explore astrophysically extreme realms of parameter space while searching for a rise in the fit statistic commensurate with the specified uncertainty. Sometimes, a second and slightly better local maximum will be found during that search and will be adopted as the new best fit, even if its model parameters are astrophysically extreme (e.g. very high NH and very low kT in a thermal plasma). The best-fit XSPEC model that existed before estimation of parameter errors is saved in the file model_before_errors.xcm (see below). Estimation of parameter errors can be disabled by setting the skip_errors variable in the AE fitting script, a task most easily accomplished via the MODEL_CHANGES_FILENAME mechanism.

7.18.4 Data Products

Four data products will remain in the source directory:
{sourcename}_grp{significance}.pi:
the multi-ObsId source spectrum grouped with the indicated significance.

spectral_models/grp{significance}_{model_name}.xcm:
the script passed to XSPEC

spectral_models/grp{significance}_{model_name}:
a directory holding the following files which may have been written during the fitting session:
ldata.ps
A plot of the grouped spectrum with model.
icounts.ps
A plot of the cumulative ungrouped spectrum with model.
xspec.log
A text file showing the fit information.
summary.ps
Summary showing ldata.ps and xspec.log.
xspec_run.log
STDOUT from the XSPEC process.
model.xcm
The final best-fit XSPEC model that was written to the file source.spectra and was used to make plots.
model_before_errors.xcm
The best-fit XSPEC model that existed before the fitting script attempted estimation of parameter errors. This model will differ from that in model_before_errors.xcm in cases where the search for parameter errors revealed a better fit.

source.spectra:
a FITS file containing the fit results in an HDU named model_name.


next up previous contents pdf.png
Next: 7.19 COLLATED_FILENAME Stage Up: 7 Using ACIS Extract Previous: 7.17 CHECK_POSITIONS Stage
Patrick Broos
Penn State Department of Astronomy
2009-08-12