next up previous contents pdf.png
Next: 7.13 EXTRACT_BACKGROUNDS Stage Up: 7 Using ACIS Extract Previous: 7.11 TIMING Stage

Subsections



7.12 Masking Point Sources

If you wish to construct point source background spectra via the EXTRACT_BACKGROUNDS Stage (§7.13), or if you wish to study diffuse emission (§7.1.2), then you'll want to ``remove'' the point sources from your data by masking regions around each source. Masking is generally performed independently for each observation since the appropriate size of a source's mask depends on the off-axis angle at which it was observed.

All masking operations must be careful to preserve an accurate correspondence between the masked event list and the masked exposure map. One way to do this is to quantize the masking to the pixel grid of the exposure map, i.e. masking is done in quanta of exposure map pixels rather than over regions bounded by smooth geometric curves (e.g. circles).

7.12.1 Mask Regions

A simple way to mask point sources is to define CIAO/ds9 regions around each source and then use CIAO to exclude those regions from the exposure map and event list. The CONSTRUCT_REGIONS Stage (§7.6) provides generous circular mask regions. The tool ae_standard_extraction3, 7.1.1) constructs backgrounds using these circular masks. If you prefer to apply these masks (and run the EXTRACT_BACKGROUNDS Stage) manually then proceed as in the example below (where the observation name is assumed to be ``1875'':

First construct a mask region file for the entire catalog.

  printf "# Region file format: DS9 version 3.0 \nfield()\n"      >  ../obs1875/mask.reg 
  grep -h background */1875/extract.reg | awk '{print "-",$1}'    >> ../obs1875/mask.reg
Then apply the mask to your exposure map.
  dmcopy "../obs1875/obs.emap[sky=region(../obs1875/mask.reg)][opt full,update=no]" \
          ../obs1875/background.emap
The option update=no above suppresses modification of the output file's ``data subspace'' to reflect the masking regions. If you have a complex mask (i.e. many sources) and omit this option, then the resulting complex data subspace will cause subsequent CIAO commands run on the background files in EXTRACT_BACKGROUNDS stage to execute very slowly!

When your exposure maps is masked, discard events where the background exposure map is zero.

  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
Finally, since the event filter actually applied is a pixelized approximation to the circular masks you should review obs1875_background.evt to look for any unmasked source events, particularly on-axis where the mask circles are small.
  ds9 -tile ../obs1875/background.emap -regionfile ../obs1875/mask.reg \
            ../obs1875/background.evt  -regionfile ../obs1875/mask.reg &


7.12.2 Better Masking

The simple masking described above 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 mask using the program ae_better_masking, as shown in the example recipe.

The goal of this 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 (e.g. readout streaks) 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.12.2.1 Usage and Inputs

This tool requires the standardized directory structure and file naming convention used in §3 and in the example recipe. 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.12.2.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.13 EXTRACT_BACKGROUNDS Stage Up: 7 Using ACIS Extract Previous: 7.11 TIMING Stage
Patrick Broos
Penn State Department of Astronomy
2009-08-12