The ae_standard_extraction tool is run for each observation, as shown in Figure 8, to ``extract'' data corresponding to each of the apertures constructed by ae_make_catalog. A spectrum and light curve are constructed from the events within the aperture. A set of nearby events is carefully chosen to form an estimate of the background spectrum that contaminates the aperture; three strategies for choosing a sample of background events are described in the following sections.
When your sources are crowded, the background in an extraction aperture has multiple components. First, it has the usual flat component, i.e. instrumental and sky background that has a relatively flat spatial distribution. Any background region that is nearby should, after appropriate scaling, model this component. However the crowded source will, by definition, also have significant background components that arise from the PSF wings of one or multiple neighboring sources. Even a distant source can produce a background component if it has a strong ACIS readout streak.
We desire a background spectrum that models all these background components. The tool ae_better_backgrounds (§E.6) seeks to construct a single background region plus a background scaling that simultaneously models all the background components. The background region is constructed iteratively. At each iteration a number of possible expansions of the region are judged and the best one is adopted. This style of background extraction is selected by supplying the parameter BETTER_BACKGROUNDS=1 to ae_standard_extraction.
Judging the quality of a proposed background region consists of evaluating how well it is expected to model each of the background components corrupting our source. For the flat component, one preference we should have is that the region be reasonably compact, i.e. local to the source. In this tool we define a compactness metric which we seek to minimize. We can also judge a background region with respect to each background component that arises from the PSF wing of a neighboring source by considering its expected bias, i.e. the difference between the power we expect to find from that neighbor in our extraction and background regions (after scaling). An ideal background region would have zero bias for each neighbor, i.e. it would sample just enough power from each neighbor to account for the contamination from that neighbor. In this tool we compute these biases by integrating spatial models of each neighbor over the two regions. These models are simply PSF images, including any bright ACIS readout streaks, scaled using rough photometry provided by a previous AE extraction.
The goal of zero expected bias for each neighbor is useful because neighbors may have very different spectra. However, perhaps the most important goal is to have zero overall bias in the background subtraction, which one might refer to as avoiding ``photometric bias''. We attempt to achieve this by careful selection of the scaling that is applied to the background region (see Appendix C).
The compactness metric and background component biases are combined to form a scalar metric which drives the iterative construction of a background region. The algorithm for choosing a background region consists of the following "search phases".
After phase #1, the algorithm will keep track of which bkg region, dubbed our ``reserve region'', achieved the best (smallest) background imbalance metric.
The best way to review the background regions constructed by the better backgrounds algorithm is the SHOW stage of AE (§7.10), where the background region (which is a set of pixels, not any sort of geometric region that DS9 can understand) is depicted by blue plus signs. Also, the BETTER_BACKGROUNDS code prints a little table for each source showing how many counts from each neighbor are expected in the source aperture and in the scaled background region.
For some sources, the background region turns out to be very small, containing very few (even zero) counts. A typical source suffering this problem has a weak neighbor very nearby. The algorithm attempts to build a region that is expected to sample an appropriate amount of power from this neighbor, but quickly ``runs out of signal'' when the region has completely covered the neighbor. Adding further area to the region would simply dilute the power from this neighbor, taking the background spectrum even further from being a fair sample of all the background components. Essentially, the algorithm is faced with the impossible task of satisfying two competing goals:
The right way to deal with crowding is to simultaneously fit spatio-spectral models to groups of sources that interact, along with some kind of flat background spectrum thought to be free of point source power, calculating during the fitting process how much power from each source spills over into the other source apertures. Sherpa can probably do this, but that's way beyond my abilities.
If your source list has no crowding--no source suffers significant background from the wings of a neighbor--then you may ask ae_standard_extraction to generate local background spectra extracted from simple circular regions around each extraction aperture (§E.5). The ae_standard_extraction tool ``removes'' all the point sources from the event list before performing this background extraction, using circular masks around each source that are sized to exclude virtually all the point source events. The ae_standard_extraction tool applies the same masks to the exposure map that is used in the background extraction, so that the ``area'' of the background region is accurately calculated. This style of background extraction is selected by supplying the parameter BETTER_BACKGROUNDS=0 to ae_standard_extraction.
The CONSTRUCT_REGIONS Stage (§E.1) creates a region file for each extraction that contains a generous circular mask region. The ae_standard_extraction tool gathers these circular regions to produce a mask region file for the entire catalog.
printf "# Region file format: \DSnine\ version 3.0 \nfield()\n" > ../obs1875/mask.reg
grep -h background */1875/extract.reg | awk '{print "-",$1}' >> ../obs1875/mask.reg
It then applies the mask to the exposure map.
dmcopy "../obs1875/obs.emap[sky=region(../obs1875/mask.reg)][opt full,update=no]" \
../obs1875/background.emap
Events that lie within exposure map pixels that are zero are then discarded.
dmimgpick "../obs1875/spectral.evt[cols time,ccd_id,chip,det,sky,pi,energy]" \
../obs1875/background.emap temp.evt method=closest
dmcopy "temp.evt[#8>1]" ../obs1875/background.evt
The simple masking described in §7.6.2 is not optimal since masks for weak sources are excessively large, and the masks are circular rather than shaped like the PSF. An observer concerned about preserving as much diffuse emission as possible, or concerned about keeping source background spectra as ``local'' as possible can construct a far better masked background using the source models described in §7.6.1. The ae_standard_extraction tool can then extract that masked background data within circular background regions (§E.5).
The masking has to be done explicitly by the observer, using the ae_better_masking tool, which is desribed below and is shown in our AE diffuse recipe (§7.1). The ae_standard_extraction tool should then be called with the parameters REUSE_MASKING=1 and BETTER_BACKGROUNDS=0.
The goal of the ae_better_masking tool is to use large masks for bright sources and small masks for dim sources. The general method is to estimate, at each pixel location in the emap, the number of counts expected from the point sources in the catalog (saved as star_counts.img) and the number of background counts expected (saved as bkg_counts.img). Pixels are masked when
.
There is no statistical theory behind this algorithm; it just seems like a reasonable approach to us.
If you have additional masking you want to do you can supply your own region file (in celestial coordinates) via the keyword EXTRA_MASKFILE. The remaining unmasked pixels are sorted by star_counts, and then processed in order of brightness. For each pixel, a local background is estimated (excluding of course any pixels already masked), the
ratio is computed, and the pixel is masked if necessary.
Note that both star_counts and bkg_counts are computed only under the footprints of source PSFs. Outside of those, star_counts is assumed to be zero, and bkg_counts is irrelevant. If the resulting background event list is later used for extraction of diffuse emission, the masked star_counts image provides at least some estimate of the contamination of the diffuse spectra arising from the incomplete masking of known point sources.
We recommend an exposure map pixel size of 1 sky pixel or smaller if ae_better_masking is to be used. Note however that ae_better_masking may require considerable time to execute for exposure maps with many pixels.
EXAMPLE:
idl
tee ae_better_masking_1875.log
ae_better_masking, '1875'
This tool builds models for all the sources in the catalog using single-observation photometry calculated by the MERGE_OBSERVATIONS stage of AE, then constructs a mask for each source.
as described above; the default value is 0.5.