Detecting Sources in BAT Images
This thread describes how to perform blind source detection in BAT sky images using the batcelldetect task. It also describes how to measure the intensities of known sources.
Read this thread if you want to:
Find new and known sources in BAT sky images.
Last update: 2007-07-17
BAT sky images are very wide field, covering almost 1/8th of the sky at any one time with at least some partial coding. BAT images have noise properties which are different than most soft X-ray images. Mostly importantly, BAT images have a gaussian noise distribution. Furthermore, the noise level varies throughout the image. Image tools designed for soft X-ray astronomy, like XIMAGE, are not suited to handle BAT images.
The software task batcelldetect can be used to both detect new sources blindly, and to measure the intensities of sources at known positions. batcelldetect uses the sliding cell method to measure the local noise properties everywhere in the image, and to find local excesses. A similar, but simpler method is used by the BAT on-board computer to locate gamma-ray bursts.
In this section we will discuss two cases:
detecting a source blindly
detecting a source at a known position
We will practice the operation image data from on GRB 050713A (obsid 00145675 000).
Here is what is needed:
BAT sky image (say, preslew.img)
partial coding map (say, preslew.pcodeimg)
For example, we use the documentation on "Making BAT Sky Images" to create sky images and partial coding maps. These kinds of images can also be generated using the 'batgrbproduct' task, which creates a complete set of analysis products for a gamma-ray burst. The Swift Data Center also makes BAT sky images as a part of its standard processing.
4. Perform Blind Source Detection
batcelldetect operates on a sky image and partial coding map to produce a catalog of detected sources.
Issue the following command,
batcelldetect preslew.img preslew.cat 5 \ pcodefile=preslew.pcodeimg regionfile=preslew.reg \ clobber=YES
preslew.img is the sky image
preslew.cat is the output catalog produced by batcelldetect
"5" is the local signal to noise detection threshold in sigma units (this should always be at least 4)
pcodefile is the partial coding file
regionfile is a region file produced by batcelldetect which you can load into an image viewer like DS9
clobber=YES is usually recommended, since otherwise batcelldetect may attempt to append to an existing catalog file.
4.1. The Output
The output of the task should look something like this (for the prompt pre-slew emission of this particular GRB):
****************************************** # batcelldetect v1.60 ------------------------------------------ ... ------------------------------------------ Found 1 Images (and selected 1 images) Analyzing Image: 1 Detection Iteration 1 Found 21 cumulative pixels Detection Iteration 2 Found 21 cumulative pixels Detected 1 sources # RAcent DECcent POSerr Theta Phi Peak Cts SNR Name 320.5664 +77.0719 0.0069 33.0 114.3 5.0688 28.2 UNKNOWN ------------------------------------------
batcelldetect works in two passes. In the first pass, it scans for groups of pixels above the noise level. The "Found NN cumulative pixels" messages shows that batcelldetect found some strong excess pixels. In the second pass, batcelldetect fits a point spread function to each excess in order to refine the position and intensity. Finally, it prints a report of the detected sources.
In this particular case, batcelldetect found one source. The "RAcent,DECcent" columns give the best-fit position in celestial coordinates. Theta and Phi are the position in BAT instrumental coordinates. "Peak Cts" gives the best-fit peak intensity. The name is "UNKNOWN" because we performed a blind search with no input catalog.
SNR gives the local signal to noise ratio for that source. In this case the signal to noise ratio is 28.2, indicating a highly significant detection. Please note that the position centroid uncertainty depends systematically on the signal to noise ratio, as documented in the BAT calibration reports. In some cases, the formal statistical centroid error will be too small. Scientists should use the guidance in the calibration reports in order to determine a more conservative position error.
The region file, called preslew.reg in this example, can be loaded into an image viewer like DS9 to highly the detected sources. Highly significant sources are highlighted in green. Weak sources appear in blue.
4.2. The Output Catalog
While some simple diagnostic data is printed to the console, a much larger amount of information is saved in the output catalog. This file contains a detailed accounting of every image excess analyzed by batcelldetect. More information about the contents of this file can be found in the documentation for batcelldetect.
4.3. Lowering the Threshold?
The significance threshold in the example above was "5" meaning that an excess must be at least 5 sigma above the local noise level to be detected. Knowing that the single-trial probability of detecting a >5 sigma excess by chance is less than 10-6, users might be tempted to lower the threshold. However, users should bear in mind that there are of order 300000 independent pixels in a typical BAT sky image, which results in about 300000 trials. Thus, the true chance probability of getting a >5 sigma fluctuation somewhere in the image is 10-20%. This result also means that if you look at enough images (say 5-10 images), you will get a >5 sigma excess just by chance. Users should always carefully account for the number of trials appropriately in assessing the significance of a particular excess, and generally should never lower the threshold below 5 sigma.
5. Finding the Intensities of Known Sources
In addition to performing a blind search, batcelldetect can also measure the intensities of sources at known positions. No matter what the intensities are at those known positions, batcelldetect will report them (they can even be negative, since BAT images have gaussian statistics).
Let us suppose we are worried about whether the X-ray binary 4U 0114+65 is interfering with the measurement of the GRB. Generally speaking bright sources increase the overall noise level everywhere in the image by about 1% of the bright source's intensity. Thus, a very bright source can distort the intensity of another source. Since 4U 0114+65 is about 21 degrees from the GRB position, it is in the field of view. We can check the the intensities of both sources using batcelldetect.
Targeted searches are done by specifying an input catalog (or "analysis catalog"). batcelldetect expects the input catalog to be in a certain format which is easy to create from ASCII files using a tool like 'ftcreate'. The catalog must be a FITS file with at least these three columns: NAME, RA_OBJ, DEC_OBJ. As one might expect, these are the name and position of the source.
5.1. Creating a Catalog from Scratch
Here are some simple steps to create a catalog from scratch. Remember that we are interested in the flux at the position of 4U 0114+65, which has a known position. Let us first create a text file with the name and position of this source source and call it 'incat.dat':
# Name RA_OBJ DEC_OBJ '4U 0114+65' 19.5113 65.2918
Of course, it is straightforward to add more sources to the catalog by adding more lines to this file. In fact, you can use a large catalog of your favorite sources which might not even be in the field of view. batcelldetect automatically filters the input catalog to include only those sources which are in the field of view of the image.
We will use the task 'ftcreate' to convert this to a FITS file. ftcreate needs a 'column description' file. This is an ASCII file which we will call 'incat.col':
NAME 30A RA_OBJ E deg DEC_OBJ E deg
The three lines of the file correspond to the three columns of the FITS file.
Finally, we create the FITS catalog, 'incat.cat', with the following command,
ftcreate incat.col incat.dat incat.cat
5.2. Using the Input Catalog
We can use the input catalog in a call to batcelldetect. Issue the following modified command,
batcelldetect preslew.img preslew.cat 5 \ pcodefile=preslew.pcodeimg regionfile=preslew.reg \ incatalog=incat.cat \ clobber=YES
The command is the same as the previous one, with the addition of the input catalog that we created in the previous step.
5.3. The Output
The output list of sources has now changed.
# RAcent DECcent POSerr Theta Phi Peak Cts SNR Name 19.5113 +65.2918 0.0000 23.7 73.5 -0.0397 -0.3 4U 0114+65 320.5664 +77.0719 0.0069 33.0 114.3 5.0688 28.2 UNKNOWN
There are two sources listed instead of one. The first source is 4U 0114+65, the source we entered in the input catalog. It has a position error of 0 since it was assumed to be fixed at its known position. The second source is the GRB we already detected with the previous command.
It should be obvious that with a significance of -0.3 sigma, 4U 0114+65 is not detected, and therefore it is not interfering with the measurement of the GRB. Since 4U 0114+65 is quite weak, it will appear in DS9 as a blue circle instead of a green one.
6. Advanced Usage
batcelldetect is a complex tool with many options. Many users will be satisfied with the options described here. Users with more advanced needs can consult the batcelldetect documentation for more detailed information.
2007-07-17 - Initial draft