Here is a script based on CIAO dmlist contributed by A. Ptak for extracting
a 10"x10" region around each source from a wavdetect run. It reads the wavdetect
source list FITS file, runs awk and sed (stream editor) to extract (x,y) coordinates,
constructs a shell script with repeated dmcopy commands. It may be desirable
to add "#!/bin/csh" and "source ~/.cxcds.csh" to the top of the test.sh output
file.
dmlist Region_wav_srclst.fits data | awk 'NR>12 {print $6,","$1}' | sed
s/\(// | sed s/\)// | awk -F, '{print "dmcopy \"../../../evt_files/MergeI0-3.fits\[events\]\[x="$1-10":"$1+10",y="$2-10":"$2+10"]\"
Region_"$3".evt"}' > test.sh
If you can make an ASCII table containing the X/Y coordinates of sources, the
desired extraction radius for each source, and an optional source name, then
you can use this Perl script
to run a series of dmcopy commands to extract a circular region around each
source. A ds9-compatible region file showing the circular extraction regions
is produced.
All the events that do NOT fall within any of the circular extraction regions
are optionally saved as an "background" event list which of course looks like
the original dataset with a bunch of "holes" in it. It might be useful
to smooth such a background file to look for diffuse structures.
If you increase the values in the "radius" column of your ASCII source table,
change the names in the "name" column, and run the script on the background
event list, you'll extract a set of background annuli around your sources.
For a crowded field the advantage of this approach over an explicit annular
extraction done on the original event list is that the background image has
fewer sources that could contaminate the background extractions. The disadvantage
is that the background image has lots of holes which might intersect your background
annuli, leaking to underestimation of the backgrounds.
The script will also optionally generate ARFs for each source position. It attempts to handle sources which fall on multiple CCD's by computing an ARF for each CCD, then summing the ARFs. It attempts to handle the fact that the integration time may vary strongly within the extraction region for sources near chip gaps by computing ARFs at several locations across the extraction region, then averaging the ARFs.
Here is an alternative procedure based on IDL developed by G. Chartas for extracting sources from one or more event files. 4274.1 4116.9 0 20 20 30 srcname1
4338.1 4252.0 0 20 20 30 srcname2