Next: Converting FITS into XML: Methods and Advantages
Up: Software Applications
Previous: The FITS Embedded Function Format
Table of Contents - Subject Index - Author Index - Search - PS reprint - PDF reprint

Freeman, P. E., Doe, S., & Siemiginowska, A. 2001, in ASP Conf. Ser., Vol. 238, Astronomical Data Analysis Software and Systems X, eds. F. R. Harnden, Jr., F. A. Primini, & H. E. Payne (San Francisco: ASP), 483

New Elements of Sherpa, CIAO's Modeling and Fitting Tool

P. E. Freeman, S. Doe, A. Siemiginowska
Harvard-Smithsonian Center for Astrophysics MS-81, 60 Garden Street, Cambridge, MA 02138


We describe enhancements made to Sherpa for the CIAO 2.0 release, concentrating upon those that enable a user to: (1) analyze Chandra X-ray Observatory grating data with wavelength- or energy-space models; (2) simultaneously fit background and source datasets; and (3) estimate and visualize confidence intervals and regions. We also list enhancements that we plan to make to Sherpa for future CIAO releases.

1. Introduction

Sherpa is the modeling and fitting tool of the Chandra Interactive Analysis of Observations (CIAO) software package (Doe et al. 1998 and references therein). We have developed it with the primary goal that a user should be able to take full advantage of Chandra's unprecedented observational capabilities and be able to analyze data in up to four dimensions (energy $E$ or wavelength $\lambda$, time $t$, and spatial location $[x,y]$) with a wide variety of models, optimization methods, and fit statistics. The enhancements that we have made to Sherpa for the CIAO 2.0 release, described below, represent major steps towards this goal.

2. Enhancements to Sherpa

2.1. Grating Analysis

Data Analysis in Wavelength and Energy Space.

Chandra grating data are most naturally analyzed in wavelength space, while XSPEC line models such as xsraymond are defined in energy space.1 Sherpa now allows one to define models in either space, while using either grating Ancillary Response Files (gARFs) or Response Matrix Files (gRMFs) or both. The ANALYSIS command allows one to switch between spaces.2One can also now apply filters defined in wavelength or energy space to single datasets, groups of datasets, or to allsets. See Figure 1.

Figure 1: Best-fit of a normalized Gaussian function to an emission line observed in four first-order HEG and MEG Chandra grating spectra of Capella. The amplitude, full-width at half-maximum, and position values are linked between datasets. The identify function of GUIDE indicates that line is most likely due to the Si XIII 2$\rightarrow $1 transition at 6.7403 Å.

Data Analysis with Two Background Spectra.

Standard processing of Chandra grating data includes the extraction of background spectra, dubbed ``up" and ``down," from either side of the source extraction region. One can either fit both spectra simultaneously with the source spectrum (see below), or SUBTRACT both from the source spectrum.

The Grating User Interactive Data Extension (GUIDE).

This S-lang-based extension to Sherpa assists the fitting of atomic lines and differential emission measure (DEM). For more information, see Doe, Noble, & Smith (2001) and

Saving Analysis Results.

One can save and restore a Sherpa session using a Model Descriptor List (MDL) file, which records information about input datasets, and filter and model definitions. One example of its usefulness is in DEM fitting, where the input data are MDL-stored line fluxes and flux errors.3

2.2. Simultaneous Analysis of Background and Source Data

Previous versions of Sherpa allowed the user to input background data with the commands BACK or READ BACK, but these data could only be subtracted from the source data. Sherpa now allows the simultaneous analysis of one (or two) background dataset(s) for every source dataset that is read in. A background model is fit directly to the background data, and is also extrapolated to the source region, where it is added to the source model before convolution. Rescaling for different extraction region sizes is done using the values of the BACKSCAL keyword, set in the header of the PHA files containing source and background data, using the commands SETDATA and SETBACK.

2.3. Estimation of Confidence Intervals and Regions

Sherpa contains many new methods that one can use to estimate confidence intervals or visualize confidence regions for best-fit model parameters. Note that these methods are strictly valid, i.e., provide 1$\sigma $ confidence intervals that actually contain 68.3% of the integrated probability, when (1) the $\chi^2$ or ${\log}{\cal{L}}$ (log-likelihood) surface in parameter space is approximately shaped like a multi-dimensional paraboloid, and (2) the best-fit point is sufficiently far from parameter space boundaries.


The confidence interval is determined for each parameter in turn by varying its value while holding the values of all other parameters at their best-fit values. While fast, UNCERTAINTY will underestimate a parameter's interval if it is correlated with other parameters. One can visualize spaces with INTERVAL-UNCERTAINTY and REGION-UNCERTAINTY.

Figure 2: Examples of parameter space visualization. Left: A plot showing the Cash statistic as a function of power-law slope, generated using INTERVAL-PROJECTION. Right: contour plot showing 1, 2, and 3$\sigma $ confidence regions for the power-law amplitude and slope, generated using REGION-PROJECTION. The central cross indicates the best-fit point.


The confidence interval is determined for each parameter in turn while allowing the values of all other parameters to float to new best-fit values. One can visualize spaces with INTERVAL-PROJECTION and REGION-PROJECTION (see Figure 2).


The confidence interval for each parameter is determined using the diagonal terms of the covariance matrix. While fast, it cannot be used to visualize parameter spaces.

2.4. Other Enhancements

Below we list other enhancements to Sherpa made for the CIAO 2.0 release.

3. Selected Future Enhancements to Sherpa

Spectral Fitting.

Sherpa does not yet treat photon ``pile-up," which can markedly affect the fitting of energy spectra of strong sources observed by either Chandra or XMM. Another Chandra-specific enhancement would be the ability to convolve data with analytic functions specified in Fits Embedded Function (FEF) files (Rots et al. 2001), rather than a response matrix, which could markedly decrease the time needed to analyze grating spectra.

Spatial Analysis.

Currently, Sherpa cannot apply exposure maps in spatial analysis, nor can it calculate the fluxes in two dimensions. Also, the current Sherpa requirement that a one-to-one mapping exist between each background bin and source bin must be waived so that, e.g., one can define differently sized source and background regions in an image.


Enhancements to be made include adding model comparison tests, correlation analysis and non-parametric fitting, and support for Bayesian analyses (e.g., specification of the prior and credible interval/region estimation).


This project is supported by the Chandra X-ray Center under NASA contract NAS8-39073.


Doe, S., Noble, M., & Smith, R. 2001, this volume, 310

Doe, S., Ljungberg, M., Siemiginowska, A., & Joye, W. 1998, in ASP Conf. Ser., Vol. 145, Astronomical Data Analysis Software and Systems VII, ed. R. Albrecht, R. N. Hook, & H. A. Bushouse (San Francisco: ASP), 157

Rots, A., McDowell, J., Wise, M., He, H., & Freeman, P. 2001, this volume, 479


... space.1
Models in the XSPEC v.10 library are available to users of CIAO 2.0, while the v.11 library will be available starting with CIAO 2.1.
... spaces.2
The reader will find more information about ANALYSIS, as well as all other Sherpa commands, at
... errors.3
Flux errors are easily estimated for three Sherpa models for which the amplitude is equal to the flux: the normalized Gaussian ( ngauss); the delta function ( delta); and the Lorentzian ( lorentz).

© Copyright 2001 Astronomical Society of the Pacific, 390 Ashton Avenue, San Francisco, California 94112, USA
Next: Converting FITS into XML: Methods and Advantages
Up: Software Applications
Previous: The FITS Embedded Function Format
Table of Contents - Subject Index - Author Index - Search - PS reprint - PDF reprint