next up previous contents pdf.png
Next: 7.7 Adjust BACKSCAL Stage Up: 7 Using ACIS Extract Previous: 7.5 The ae_make_catalog Tool

Subsections



7.6 The ae_standard_extraction Tool

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.


7.6.1 Model-based Background Regions

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_backgroundsE.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".

  1. The bkg region will grow until two conditions are met: The MIN_NUM_CTS requirement is to avoid background estimates that have huge statistical uncertainty, which inflates Pb and can cause a source to be pruned. The pathological case is a source with an uncrowded on-axis observation and a crowded far off-axis observation. The off-axis observation needs to keep BACKSCAL small in order to fairly sample his crowded neighbor, but that small BACKSCAL leaves the on-axis observation with very few (perhaps zero) counts. If the MERGE then chooses to ignore the off-axis observation, then we're left with a composite extraction with a very uncertain background estimate, and an inflated Pb value. Aaarg!

    After phase #1, the algorithm will keep track of which bkg region, dubbed our ``reserve region'', achieved the best (smallest) background imbalance metric.

  2. After #1 is achieved, we add ONE more pixel to the bkg region before considering any stopping criteria. This tweak is designed to address a special case--where BKSCL_LO=BKSCL_GL, and the current extraction is responsible for that value (via a VOTE_LO from the previous run of this tool). In such a situation, we want to proceed past the last acceptable region to determine if our previous VOTE_LO still applies. If we simply stop at BKSCL_LO=BKSCL_GL, and cast no VOTE_LO, then another ObsID can drag the scaling range upward; on the next pass this ObsID will again find that range to be unacceptable, and will recast a VOTE_LO. This leads to a never-ending cycle: - this ObsID casts a VOTE_LO - the range is adjusted to satisfy that vote - this ObsID abstains from voting - the range is adjusted upward, beyond what this ObsID can tolerate - this ObsID casts a VOTE_LO

  3. After #2 is achieved, growth of the bkg region will continue until BKSCL_GL <= BACKSCAL (the region reaches the goal specified for all ObsIds, BKSCL_GL, which is stored in source.stats).

  4. After #3 is achieved, growth of the bkg region will stop when

  5. Since condition 4B stopped the search (no acceptable region was found), we rebuild and then adopt the reserve region.

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:

  1. Build a region that, after scaling, is a good model of the contamination in our aperture arising from that close neighbor's wings.

  2. Build a large region that has plenty of counts to get a precise estimate of the flat component of the background (i.e. instrumental background and the smooth X-ray sky).

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.


7.6.2 Circular Background Regions with Circular Masking

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


7.6.3 Circular Background Regions with Model-based Masking

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 $(star\_counts/bkg\_counts) > THRESHOLD$. 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 $(star\_counts/bkg\_counts)$ 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.

7.6.3.1 Usage and Inputs

This tool requires the standardized directory structure and file naming convention used in §3. This tool must estimate source photometry; thus prior to running this tool you must extract source spectral and rough background spectra (e.g. backgrounds derived from simple mask regions as described in the previous section).

ae_better_masking, obsname, EVTFILE_BASENAME=name, EMAP_BASENAME=name, EXTRACTION_NAME=name, MIN_NUM_CTS=value, EXTRA_MASKFILE=filepath, THRESHOLD=value, /REUSE_MODELS, /SKIP_EXTRACT_BACKGROUNDS


EXAMPLE:
idl $\vert\&$ 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.

7.6.3.2 Data Products

The following files are produced:
../obs{obsname}/polymask.reg:
a region file containing all the extraction polygons.

../obs{obsname}/polymask.img:
a copy of the exposure map with the extraction polygons masked.

../obs{obsname}/star_flux.img:
a FITS image showing a model of the flux from all the point sources.

../obs{obsname}/star_counts.img:
a FITS image showing the estimated star counts remaining after masking.

../obs{obsname}/bkg_counts.img:
a FITS image showing the background estimated by the algorithm. Background values are computed only where the source models is non-zero.

../obs{obsname}/background.emap:
the final masked exposure map.

../obs{obsname}/background.evt:
the final masked event list.


next up previous contents pdf.png
Next: 7.7 Adjust BACKSCAL Stage Up: 7 Using ACIS Extract Previous: 7.5 The ae_make_catalog Tool
Patrick Broos
Penn State Department of Astronomy
2013-05-09