1. A Tour of Detect

1.1 Introduction

The detection of significant features in 2-D images is at the heart of much of astronomy. X-ray astronomy poses some special challenges (e.g. large sparse arrays, Poisson statistics) that mandate specially-developed methods for source detection. Moreover, while the extremely small beam area of the Chandra mission can resolve tight clusters of sources, it also means that more diffuse sources will be resolved, making those clusters more difficult to detect.

The CXC has responded to these needs by providing a suite of Detect tools within the Chandra Interactive Analysis of Observations (CIAO ) software package: celldetect , vtpdetect , and wavdetect . These tools comprise three types of algorithms, each tailored to address the different source detection problems that the user of Chandra data may encounter. Table 1.1 gives a concise listing of and introduction to the Detect tools.

Table 1.1: Introduction to Detect Tools
Method Strengths Weaknesses
celldetect 1. Long heritage (EINSTEIN , Rosat ); well understood. 1. Requires fine tuning of parameters for extended sources.
  2. Good for faint point sources outside crowded fields. 2. Divides extended sources into multiple point sources.
    3. Has difficulty separating closely-spaced point sources.
vtpdetect 1. Finds faint features with low surface brightness. 1. Combines closely-spaced point sources.
  2. Extended sources found as single source in visually "correct" way, regardless of their actual shape. 2. Combines diffuse emission with embedded point sources.
    3. Slow for more than $ \approx~10^{5}$ photons.
wavdetect 1. Separates closely-spaced point sources. 1. Slower than celldetect.
  2. Finds extended sources well.  

In this section, we provide a brief description of each tool and information on how to obtain and use the CIAO software.

1.1.1 celldetect

The best known detection algorithm for X-ray images is the "sliding cell" method developed for use with the EINSTEIN Observatory images and also employed by the standard processing of Rosat data. celldetect searches for sources by summing counts in square "detect" cells in the dataset, and comparing the summed counts to those of "background" frames. At each point where a cell is placed, a signal-to-noise (S/N) ratio of source counts to background counts is computed. If this ratio is above the detection threshold, a candidate source is recorded.

This method was tailored to optimize the detection of unresolved sources and had two variants, "local detect" and "map detect". In the former, the background is estimated in a frame around the detect cell; the latter requires a background map. The observed data may be cleaned of strong sources to generate the background map or a background map may be constructed from a collection of other data. Each of these variants has limitations, the most obvious perhaps is the difficulty of detecting resolved sources and estimating their parameters (e.g. size, intensity). celldetect is good at detecting unresolved sources for a wide variety of data, such as images that are oversampled, those with dominating background levels, and those covering a very large area compared to the size of the resolution element.

The CXC version of this method is based on the EINSTEIN and Rosat codes, but contains enhancements to improve performance for Chandra data. For example, at any given position the size of the detect cell may be determined by the size of the point spread function (PSF) at that point and the encircled energy percentage specified by the user. So for Chandra data, the cells are small in the center of the field, and become larger as you go off-axis. In addition, one or more exposure maps may be supplied in order to minimize spurious detections along detector edges.

Chapter 6 contains further information about celldetect theory.

1.1.2 vtpdetect

A quite different approach is used by vtpdetect , which is based on the Voronoi Tessellation and Percolation (VTP) method. Tessellation is the process of dividing the total area of the image into Voronoi cells by constructing a cell about each event position. The area of each cell is a measure of the density of events. Percolation follows by creating bonds between the cells that are above the noise level and which are not farther away from each other than a given distance. This "friends-of-friends" algorithm establishes the group of cells which comprise a source detection.

The advantage of vtpdetect is that no assumptions are made about the geometrical properties of the sources. Also, very extended sources are detected as significant without a single pixel in the image needing to feature a photon count significantly different from the background. Therefore, vtpdetect is particularly well suited for resolved sources of low surface brightness and potentially irregular shape. The main disadvantage of the algorithm is that it tends to produce blended detections when run with a low flux threshold on a crowded field.

Chapter 9 contains further information about vtpdetect theory.

1.1.3 wavdetect

In its most general form, the method used by wavdetect correlates the data with a wavelet function that has limited spatial extent and zero overall normalization. Each pixel's correlation value is compared with the expected distribution of values (computed from the estimate of the background); if the value is an extreme outlier within this distribution, the pixel is assumed to be associated with a source. A point source is most easily detected when a wavelet function of similar size to the PSF is used; since the PSF size varies markedly over the field of view, putative source lists are made at a number of scales, which are then combined to yield a final source list with estimated locations, count rates, etc. The implementation provided in wavdetect uses the so-called "Mexican Hat" function (see Chapter 13), which has a positively-valued quasi-Gaussian core surrounded by a negatively-valued annulus. This is a reasonable function for mirrors and detectors which are characterized by a quasi-Gaussian PSF, and will work effectively even for abnormal PSFs.

There are two parts to the wavdetect code. The first, wtransform , convolves the data with the wavelet function for however many scales are chosen. The resulting correlation maps are used by the second part, wrecon , to construct a final source list and estimate various parameters for each source. Each part may be run separately (see Chapter 12), but the recommended procedure is to use wavdetect , which runs them sequentially (see Chapter 11).

Chapter 13 contains further information about wavdetect theory.

1.2 Getting Started with CIAO

The CIAO software package, of which Detect is a part, is available for download from:

Once CIAO has been installed, the user may confirm that the Detect tools are available by doing:

unix% which celldetect

unix% which wavdetect

unix% which vtpdetect

1.3 Running the Detect Tools

The Detect tools are executed by typing the tool name at the UNIX command line within CIAO . For example, to run celldetect :

unix% celldetect
Input file (): events_img.fits
Output source list (): celldetect_out.fits

There are a number of CIAO threads which explain how to run the Detect tools:

1.3.1 The Detect Parameter Files

The Detect tools make use of parameter files, which are stored by default in the user's $HOME/cxcds_param subdirectory. For an introduction on working with CIAO parameter files, read the parameter interface help file (type "ahelp parameter'' within CIAO ). There is also a "Using Parameter Files" thread, which illustrates how to do many common tasks:

1.3.2 Autonaming

The CIAO autonaming feature can be used with many of the Detect tool parameters. If the parameter value is set to ".'' (dot), autonaming automatically determines the output file based upon the name of an input file. The output file name is typically of the form "<infile_root>_src", where the "src" extension changes depending on the data product being created. "ahelp autoname'' has more information on autonaming.

Not all parameters support autonaming. Check the help file for each tool to see when this option is available.

1.3.3 Data Model Filtering

The Detect tools are able to take advantage of the Data Model library, which enables data to be filtered dynamically when it is input to one of the tools. This allows the user to select regions of the data (spatial, temporal, etc. ) without having to create an intermediate file on disk. For example, to specify a box in sky(x,y) coordinates:

unix% celldetect infile="events_img.fits[x=4096.5:4213.5,y=4142.3:6120.1]"

For a detailed description of the DM syntax, see the help file ("ahelp dm'') or the "Introduction to the Data Model'' thread:

1.4 Displaying a Region File in ds9

The most straightforward way to examine the detections in a region file is to overlay it on the data used to create it. This is simple to do in ds9, the imager packaged with CIAO .

First, open the event file or image in ds9:

unix%  ds9 s3\_evt2.fits &

Then load the region file from the ds9 menu "Regions" -> "Load Regions...".

If the regions are stored in a FITS file, highlight the file and then add the extension to the filename before clicking the "Ok'' button, e.g. s3_src.fits[SRCLIST]. "[SRCLIST]'' indicates in which block of the file the region information is stored; the extension name is the same for all three detect tools.

No extension exists for for ASCII files; just select the filename and click "Ok''.

The regions will then be displayed on the data in the imager window. For more information on working with region files, see the "Using the Output of Detect Tools'' thread:

1.5 Online Help and Other Resources

The CIAO software package includes an extensive help system. Further information about this help system is available by typing:

unix% ahelp

To obtain help regarding a particular CIAO tool, type `ahelp <toolname>'. For example:

unix% ahelp celldetect

In addition, the CXC has prepared many processing recipes, called "threads". These documents are designed to teach users by leading, step-by-step, through a procedure that utilizes the CIAO software package. These are available from,
and include further information about CIAO , parameter manipulation, and Detect tools.