6. celldetect Theory

6.1 Algorithm Overview

The CXC celldetect tool utilizes a "sliding cell'' search for source candidates in an event list or an image. The tool is based on the programs from the PROS DETECT package, which was based on techniques used in the standard processing of EINSTEIN Observatory IPC and HRI data and in the Level 1 processing of Rosat HRI data.

The core of the tool is scanning an x-ray image with a square "detect cell.'' At each location on the image the signal-to-noise ratio (S/N) of a source assumed to be centered in the detect cell is calculated, with background estimated from a box containing the detect cell (unless a separate background image or a global background value is provided, in which case the background is estimated from the same detect cell).

If the S/N is higher than a user-defined threshold, the tool identifies the cell as the location of a source candidate.

6.2 Algorithm Details

Borrowing from the algebra derived for the EINSTEIN IPC Rev. 1 LDETECT programs (Harnden et al. 1984), we define:

$ S$ = Expected total source counts
$ B$ = Expected background counts in the detect cell
$ C$ = Total counts in a square detect cell of size $ d$
$ T$ = Total counts in the detect cell plus surrounding background frame (a $ b \times b$ box)
$ Q$ = $ T - C$
$ \alpha$ = Integral of the point spread function (PSF) over the detect cell
$ \beta$ = Integral of the PSF over the detect cell and surrounding background frame

There are three cases that need to be considered here:

  1. Background is estimated from the background frame

  2. Background is estimated from the background map or background value and background uncertainty is known

  3. Background is estimated from the background map or background value and background uncertainty is negligible

We will consider these three cases in order.

6.2.1 Background Estimated from the Background Frame

We have:

$\displaystyle C$ $\displaystyle =$ $\displaystyle \alpha S + B$ (6.1)
$\displaystyle T$ $\displaystyle =$ $\displaystyle \beta S + \left(\frac{b}{d}\right)^2 B.$ (6.2)

Solving for $ B$, we get:

$\displaystyle B$ $\displaystyle =$ $\displaystyle \frac{(\alpha-\beta) C + \alpha Q}{\alpha b^2 d^{-2} - \beta}$ (6.3)
$\displaystyle \sigma_B^2$ $\displaystyle =$ $\displaystyle \frac{(\alpha-\beta)^2 \sigma_C^2 + \alpha \sigma_Q^2} {(\alpha b^2 d^{-2} - \beta)^2}$ (6.4)

Solving for $ S$, we get:

$\displaystyle S$ $\displaystyle =$ $\displaystyle \frac{C (b^2-d^2) d^{-2} - Q}{\alpha b^2 d^{-2} - \beta}$ (6.5)
$\displaystyle \sigma_S^2$ $\displaystyle =$ $\displaystyle \frac{\sigma_C^2 (b^2-d^2)^2 d^{-4} + \sigma_Q^2} {(\alpha b^2 d^{-2} - \beta)^2}$ (6.6)

S/N is then:

$\displaystyle {\rm S/N} = \frac{S}{\sigma_S} = \frac{C (b^2-d^2) d^{-2} - Q} {\sqrt{\sigma_C^2 (b^2-d^2)^2 d^{-4} + \sigma_Q^2}}$ (6.7)

Note that the estimate for S/N in Eq. (6.7) is independent of $ \alpha$ and $ \beta$.

The Gehrels' (1986) formula for uncertainty is used:

$\displaystyle \mbox{$\sigma_N = 1+\sqrt{N+0.75}$}$$\displaystyle ,$ (6.8)

where $ N$ can be either $ C$ or $ Q$. This simple formula gives excellent approximation for uncertainty (better than 1.5% for small $ N$ and better than a fraction of a percent for large $ N$). In this case, we have:

$\displaystyle {\rm S/N} = \frac{C (b^2-d^2) d^{-2} - Q} {\sqrt{(1+\sqrt{C+0.75})^2 (b^2-d^2)^2 d^{-4} + (1+\sqrt{Q+0.75})^2}}$ (6.9)

6.2.2 Estimating Background with Known Uncertainty

$ B$ and $ \sigma_B$ are directly calculated from either the background value $ b$:

$\displaystyle B = d^2 b \hspace{2cm} \sigma_B = d^2 \sigma_b

or from the background map:

$\displaystyle B = \sum b_{ij} \hspace{2cm} \sigma_B^2 = \sum \sigma_{b_{ij}}^2

where summing is done over the detect cell, and $ b_{ij}$ and $ \sigma_{b_{ij}}$ are the values in the $ (i,j)$ pixel of the background map and background error map, respectively.

The equation for S/N becomes:

$\displaystyle {\rm S/N} = \frac{C-B}{\sqrt{\sigma_C^2 + \sigma_B^2}} = \frac{C-B}{\sqrt{(1+\sqrt{C+0.75})^2 + \sigma_B^2}}$ (6.10)

6.2.3 Estimating Background with Negligible Uncertainty

The equation for source counts reduces to:

$\displaystyle S$ $\displaystyle =$ $\displaystyle \frac{C - B}{\alpha}$ (6.11)
$\displaystyle \sigma_S$ $\displaystyle =$ $\displaystyle \frac{\sigma_C}{\alpha}$ (6.12)

S/N is equal to:

$\displaystyle {\rm S/N} = \frac{C-B}{\sigma_C}$ (6.13)

or, using Eq. (6.8):

$\displaystyle {\rm S/N} = \frac{C-B}{1+\sqrt{C+0.75}}$ (6.14)

6.3 Cell Size

The Chandra PSF varies strongly with the off-axis angle and photon energy. Therefore, different detect cell sizes are appropriate for different spatial regions and energies.

The user specifies the basis for the calculation of the cell size by providing the reference energy band and desired encircled energy to be encompassed in the detect cell. At each position, celldetect calculates the radius in pixels at which PSF reaches this encircled energy for a given combination of telescope, detector and grating, and then rounds the "diameter'' (i.e. radius times 2) up to the nearest multiple of 3 pixels. The rounding is done because the search for detections moves in steps of 1/3 of a detect cell.

Experience with the EINSTEIN and Rosat detection software indicates that the optimum cell size is approximately 3.6 times the sigma of the PSF (Harnden et al. 1984). For a Gaussian PSF, that corresponds to an encircled energy seting of 0.80.

Figure 6.1: Cell Size in Pixels as a Function of Off-axis Angle for HRC-I.
\epsfxsize =0.75\textwidth

Figure 6.1 shows growth of the cell size as a function of off-axis angle for the HRC-I detector.

6.4 Background Frame

If the local background option is used, the background counts are estimated from a frame surrounding the detect cell. The background frame size is selected to give the area of the background frame roughly twice the size of the detect cell. This makes the detect cell and the background "annulus'' similar in size. The parity of the background cell size is the same as of the detect cell size, so that the background frame and detect cell are centered on the same pixel and there are no asymmetries.

6.5 Output Options

The user provides the S/N threshold value ( $ {\rm S/N}_{\rm thr}$). The tool moves across the data in steps of 1/3 of the local detect cell size searching for locations in which:

$\displaystyle {\rm S/N} \geq {\rm S/N}_{\rm thr}$ (6.15)

The tool gives three options for detection output: all detections, local S/N peaks, and centroids of events in detect cells.

6.5.1 All Detections

celldetect can output all detect cells in which the condition from Eq. (6.15) is fulfilled. In this case, the output information should not be taken literally as a list of sources, since a single source will in all likelihood be reported several times. This option is, however, very useful if external background information is provided and the presence of extended sources is suspected, since it enables the user to identify regions in which there is an excess of events over the background.

6.5.2 Local S/N Peaks

celldetect can output detect cells which fulfill the condition from Eq. (6.15) and which are local S/N peaks, i.e. all their neighboring detect cells have lower S/N. Two cells are considered neighbors if the distance between their centers is not greater than 1/3 of the size of the smaller of the cells.

6.5.3 Centroid of Events in Detect Cells

This option is useful for isolated point sources, since the centroid gives a very accurate estimate of the position of the source. The centroids are calculated by finding the center of gravity for events in the detect cell:

$\displaystyle \bar{x} = \frac{\sum x_i}{C} \hspace{1in} \bar{y} = \frac{\sum y_i}{C}$ (6.16)

where $ x_i$, $ y_i$ are coordinates of events in the detect cell, $ C$ is the total count of events in the cell, and summation is performed over the spatial extent of the cell.

In this case, the tool calculates centroid uncertainties, as well as the principal axes of the event distribution in the detect cell and the position angle of the major axis. These quantities are calculated utilizing the fact that the square of the principal axes of the distribution of events is mathematically equivalent to the principal moments of inertia for an ensemble of unit mass points.

Let us define:

$\displaystyle \sigma_x = \sqrt{\frac{\sum\left(x_i-\bar{x}\right)^2}{C-1}} \hsp...
...{\frac{\sum\left[\left(x_i-\bar{x}\right)\left(y_i-\bar{y}\right)\right]}{C-1}}$ (6.17)

Centroid uncertainties are:

$\displaystyle \sigma_{\bar{x}} = \frac{\sigma_x}{\sqrt{C}} \hspace{1in} \sigma_{\bar{y}} = \frac{\sigma_y}{\sqrt{C}}$ (6.18)

The details of the procedure for calculating the principal axes and the position angle of the major axis can be found in any book on classical dynamics (e.g. Marion 1970). Here we will only list the final formulae for the major and minor axes - $ A_{\rm maj}$ and $ A_{\rm
min}$, respectively - and the position angle $ \theta$ of the major axis.

$\displaystyle A_{\rm min}$ $\displaystyle =$ $\displaystyle \sqrt{\frac{\sigma_x^2+\sigma_y^2
-4 \left(\sigma_x^2 \sigma_y^2 - \sigma_{xy}^4
\right)}}{2}}$ (6.19)
$\displaystyle A_{\rm maj}$ $\displaystyle =$ $\displaystyle \sqrt{\frac{\sigma_x^2+\sigma_y^2
-4 \left(\sigma_x^2 \sigma_y^2 - \sigma_{xy}^4
}}{2}}$ (6.20)
$\displaystyle \theta$ $\displaystyle =$ \begin{displaymath}\left\{
\arctan\left(\frac{\sigma_x^2-A_{\r... 0$} \\
& \\
90^\circ & \mbox{otherwise}
\end{array}\right.\end{displaymath} (6.21)

6.6 References

Gehrels, N. 1996 ApJ, 303, 336

Harnden, F. R., Fabricant, D. G., Harris, D. E., & Schwartz, J. 1984, SAO Report No. 393

Marion, J. B. 1970, Classical Dynamics of Particles and Systems, Academic Press, New York