next up previous contents pdf.png
Next: A. Running Multiple Instances Up: 7 Using ACIS Extract Previous: 7.13 Caveats

Subsections



7.14 Accessory Tools


7.14.1 Verify the astrometric alignment of individual ObsIDs

The ae_interObsID_astrometry tool helps the observer verify the astrometric alignment of individual ObsIDs after an AE extraction has been performed. The astrometric offset (with uncertainty) between each pair of ObsIDs is estimated using the set of reliable (PROB_NO_SOURCE$<0.003$) sources that are extracted on-axis (THETA$< 5$') and are uncrowded (PSF_FRAC$>0.85$) in both ObsIDs.

If a reference catalog (such as 2MASS) has been converted into the format used by our match_xy tool, then the offset between it and each ObsID is also estimated.

Usage and Inputs
ae_interObsID_astrometry, obsname_list, ASTROMETRY=fits_astrometry, REF_CATALOG=ref_cat


EXAMPLE (assuming the standard directory structure (§3):

  setenv OBS_LIST ""
  foreach dir (../obs*)
    if (! -d $dir) continue
    set obs=`basename $dir | sed -e "s/obs//"`
    setenv OBS_LIST "$OBS_LIST $obs"
    end
  echo $OBS_LIST  

  idl
   .run ae
    ; Without a reference catalog
    ae_interObsID_astrometry, strtrim(strsplit(getenv('OBS_LIST'), /EXTRACT), 2)
    
    ; With a reference catalog
    .run match_xy
    event2wcs_astr = get_astrometry_from_eventlist('../../tangentplane_reference.evt')

    twomass_cat    = build_FITS_cat('2mass_highqual.fits', event2wcs_astr, RA_EXPRESSION='tb.RAJ2000', DEC_EXPRESSION='tb.DEJ2000', RA_ERROR_EXPRESSION='(tb.errmaj+tb.errmin)/2', DEC_ERROR_EXPRESSION='(tb.errmaj+tb.errmin)/2', NAME='TWOMASS')

    ae_interObsID_astrometry, strtrim(strsplit(getenv('OBS_LIST'), /EXTRACT), 2), ASTROMETRY=event2wcs_astr, REF_CATALOG=twomass_cat

7.14.2 Convert source labels to source names

The ae_make_catalog tool (§7.5) assigns a LABEL property to each source for use in several contexts as a shorter source identifier than the source name. Given a source name, one can easily find its LABEL by examining its source.stats FITS file. Given a source LABEL, to find the source name one must consult a table that lists LABELs and names for the entire catalog.

The collated FITS table itself can be searched for a list of LABELs using the tool ae_label2name.

Usage and Inputs
ae_label2name, labels, collated_filename, catalog_names, indexes


EXAMPLE:
.run ae


ae_label2name, ['101','202','303'], 'all.collated' ae_label2name, 3, 'all.collated' The parameter labels can either be a string array, or an integer. If an integer is supplied, then the tool prompts for you to enter the specified number labels.

Alternatively, such a table can be constructed in ASCII form using the LABEL_FILENAME option to the Collate Stage (§7.12), and then searched for a specific LABEL either manually or with grep. For example, if the Collate Stage has produced the ASCII table label.txt then this shell alias would change directories to the source with the specified label:

alias asl 'setenv LINE `grep -i "(\!:1)" label.txt`; echo $LINE; if ( "$LINE" != "" ) pushd `echo $LINE | cut -c 1-18`;'


7.14.3 Constructing Exposure Maps

Exposure maps can be conveniently constructed using the tool ae_make_emap.

Usage and Inputs
ae_make_emap, obsdata_fn, scene_name, CCD_LIST=value, ARDLIB_FILENAME=filepath, ASPECT_FN=filepath, PBKFILE=filepath, MASKFILE=filepath, MONOENERGY=value, SPECTRUM_FN=filepath, MATCHFILE=filepath, /ONLYTIME, /REUSE_ASPHIST, /REUSE_INSTMAP


EXAMPLE:
; Create an emap at 1 keV named 'fullfield_1' using six CCDs and an emap named 'iarray_1' using only ACIS-I.
.run ae


ae_make_emap, 'acis.evts', ['fullfield_1','iarray_1'], CCD_LIST=['012367','0123'], ARDLIB_FILENAME='./ardlib.par', ASPECT_FN='acis.asol1', PBKFILE='acis.pbk0', MASKFILE='acis.msk1', MONOENERGY=1.0

  • A sub-directory asphist is created to hold aspect histogram and instrument map files.

  • A pixel size of 1 sky pixel is normally used in the exposure maps. We recommend using the CIAO tool reproject_image to resample this high-resolution emap when you need an emap to match a specific field of view and binning scheme used in an image. However if you wish to directly compute an emap on a specific pixel grid, then supply a template image via the MATCHFILE parameter.

  • Any event list containing exposure-related FITS keywords and the DETNAM keyword can be supplied as obsdata_fn.

  • The name(s) of the exposure maps desired are supplied via the string scalar or vector scene_name.

  • The list of CCDs to be used in each emap are supplied via the string scalar or vector keyword CCD_LIST. If omitted all CCDs are used.

  • The ardlib.par file (configured for your observation), aspect file, parameter block file, and mask file required by the CIAO tools mkinstmap and mkexpmap are supplied via the keywords ARDLIB_FILENAME, ASPECT_FN, PBKFILE, and MASKFILE.

  • For a mono-energy emap supply MONOENERGY (in keV) or let it default to 1.0. Alternatively you can pass a spectrum to mkinstmap via the keyword SPECTRUM_FN.

  • If /ONLYTIME is specified then mkexpmap is told to model the HRMA and ACIS with a perfect QE, resulting in an exposure map the represents only the geometric effects of dithered chip edges and bad pixels.

  • If /REUSE_ASPHIST is specified then any aspect histograms found from a previous run of the tool are re-used.
  • If /REUSE_INSTMAP is specified then any instrument maps found from a previous run of the tool are re-used.

7.14.4 Grouping

AE's spectral grouping algorithm (§5.7) is available as a tool (ae_group_spectrum) that can be used to manually group a spectrum. The parameters of this routine are shown below:
Usage and Inputs
ae_group_spectrum, src_spectrum_fn, bkg_spectrum_fn, grouped_spectrum_fn, CHANNEL_RANGE=[value,value], SNR_RANGE=[value,value], NUM_GROUPS_RANGE=[value,value]


EXAMPLE:
.run ae


ae_group_spectrum, '182029.89-161044.4.pi', '182029.89-161044.4_bkg.pi', '', SNR_RANGE=[5,10]

  • The input (ungrouped) spectrum file name is specified as src_spectrum_fn.

  • If you want group significance calculations to use the background, supply the background file name via bkg_spectrum_fn; otherwise supply the empty string.

  • The output (grouped) spectrum file name is specified as grouped_spectrum_fn; set to the empty string to use an auto-generated name.

  • The optional CHANNEL_RANGE, SNR_RANGE, and NUM_GROUPS_RANGE parameters are described in §7.11.

7.14.5 Time-resolved extractions

Time-resolved extractions can be performed with the tool ae_timerange_extract. The parameters of this tool are shown below:
Usage and Inputs
ae_timerange_extract, sourcename, obsname, time_filter, extraction_name, EVTFILE_BASENAME='spectral.evt'


EXAMPLE:
.run ae
ae_timerange_extract, '182029.80-161045.5', '6420', '270786808.58:270854668.99', '6420.1', EVTFILE='spectral.evt'
ae_timerange_extract, '182029.80-161045.5', '6420', '270854678.71:270897521.73', '6420.2', EVTFILE='spectral.evt'
ae_timerange_extract, '182029.80-161045.5', '6420', '270897531.45:270938175.77', '6420.3', EVTFILE='spectral.evt'

  • The time_filter input should be a single string or string array of CIAO time specifications of the form ``tstart:tstop''.

  • The extraction_name input should be a corresponding single string or string array of names for the extractions. These names are used to create subdirectories for the extractions (via the parameter EXTRACTION_NAME passed to ae_standard_extraction and the parameter MERGE_NAME passed the the /MERGE stage of AE).

  • The EVTFILE_BASENAME parameter is passed to ae_standard_extraction to specify the filename for the event list (in ../obsXXXX/) from which you wish to extract spectra.


7.14.6 Comparing event data with a PSF model

Many observers want to know if their Chandra source is ``extended''. This task is inherently difficult for a variety of reasons.
  • If the PSF model and the event data are not well aligned (i.e. the estimated source position is incorrect) then data that are truly consistent with a point source may be found to be inconsistent with the PSF model.

  • Bright sources are particularly problematic. In principle they give you nice signal to detect deviations from the PSF. However, even moderate pileup will invalidate the PSF model. Also, the requirements for accuracy in the PSF model rise as the number of observed counts rises.

  • Since the Chandra PSF is strongly energy-dependent, a PSF model constructed assuming a spectrum different from the spectrum of the event data may produce a spurious finding of inconsistency. Note that AE produces only mono-energy PSF models.

  • There are many other ways in which a PSF model can be flawed, e.g.
    • The model of the HRMA may not match the actual HRMA. See, for example, the scary ``jet'' (containing 5% of the PSF power) recently discovered in the HRMA PSF.

    • The blurring applied to the HRMA rays to model ACIS pixelization, aspect reconstruction, and sub-pixel positioning effects may not be accurate.

    • Most PSF models (including AE's) do not account for background events. Thus, sources with a large fraction of background events are likely to produce a spurious finding of inconsistency with the PSF. Background events that are concentrated at the edge of the extraction aperture (e.g. the wings of a nearby source) are particularly inconsistent with the PSF.

CIAO provides a tool named srcextent that may be helpful to you. AE provides a very simple tool named ae_radial_profile that can quickly scan every AE source for signs that a source might be inconsistent with the PSF. The tool compares the merged event data with the merged PSF. The basic call is shown below. The 2011mar16 or later version of our TARA package is required.

.run ae
ae_radial_profile, report, SRCLIST='all.srclist'


If you ran AE's MERGE stage with a MERGE_NAME option, then supply that same option above.

The output data structure (``report'' above) is an array of structures Each source reports K-S probabilities quantifying the similarity between the event data and PSF model within a circular aperture defined by SRC_RADIUS, in three ways:

  1. radial distance from the source position declared in source.stats
  2. X-offset from the source position
  3. Y-offset from the source position
K-S probability is the fraction of true point sources that would produce observations that would show a deviation from the PSF model larger than what you actually observed, assuming of course that the model is correct. Thus, a very small K-S probability is evidence that your source is NOT consistent with the PSF. The inconsistency could be in either sense--the data are too tightly bunched (e.g. from afterglow events) or are too loosely bunched (e.g. from an extended object).

From this report, you can make a list of sources that claim inconsistency with the PSF (low K-S values) using forprint, e.g.

forprint, report.SOURCENAME, SUBSET=where(report.PROB_KS_DISTANCE LT 0.01), $
/NOCOM, TEXTOUT='/tmp/low_ks.txt'


Then, you can run ae_radial_profile a second time on this shorter source list, using the PLOT option to produce three interactive plots for the source showing cumulative distributions of radial distance, X-offset, and Y-offset; press the ``next source'' to move to the next source.

ae_radial_profile, report, SRCLIST='/tmp/low_ks.txt' , /PLOT


The tool takes an optional ENERGY_RANGE parameter that specifies the event energy band on which you want to compare to the PSF The default is [0.5,8] keV, which may be too broad for your taste or not appropriate for the PSF energy you have used.

Although the plots look reasonable, I certainly cannot guarantee that there are no mistakes in this tool. In such code it's easy to be off-by-one-pixel in a calculation, or to confuse PSF pixels and sky pixels, or to make any number of other mistakes. For any source that this tool claims is ``extended'', you should try to verify that conclusion by other means.

The ae_radial_profile code is fairly well commented. You should be able to read it without too much difficulty if you want to understand what it is doing.


7.14.7 PSF ``Hook'' Feature

In October 2010 the Chandra X-ray Center announced the discovery of a hook-shaped feature in the Chandra PSF that extends ${\sim}$0.8" from the main peak and contains ${\sim}$5% of the flux. Its location depends upon the roll angle of the observation; given its limited spatial extent, the hook is not discernable for sources observed substantially off-axis. At this time, its energy dependence (either spatially or as a fraction of the total power) is not well-characterized. No revised PSF models incorporating the hook-shaped feature are currently available.

Since this feature is not represented in the available PSF models, image reconstructions may generate spurious candidate point sources near bright sources (e.g. those with $>$100 counts obtained with a single roll angle and located ${\sim}<$ 4' off-axis), where enough counts might be distributed along the hook that it could be reconstructed into what appears to be one or more independent, faint point sources.

Until a model for this feature is available, observers are encouraged to review the regions around all bright sources expected to be significantly contaminated by the hook feature to identify detections that are spatially coincident with the hook feature. Such sources should be considered suspicious, unless they contain substantially more than 5% of the flux of their neighboring bright source.

The tool ae_make_psf_hook_regions will construct a region file marking the hook region (for each ObsID) around sources that have more than a specified number of counts expected in the hook and lie within a specified off-axis angle. For example:

.run ae
ae_make_psf_hook_regions, COLLATED_FILENAME='all.collated', $
HOOK_CNTS_THRESHOLD=4, THETA_THRESHOLD=5


Once a list of suspicious detections is identified, their individual extractions can be examined with the hook regions displayed via the SHOW stage, e.g.

acis_extract, COLLATED_FILENAME='all.collated', SRCLIST_FILENAME='near_psf_hook.srclist', /SHOW_REGIONS, REGION_FILENAME='psf_hook.reg'

7.14.8 Interface to ChaRT

I don't wish to speculate whether ChaRT-generated PSFs are significantly better than MARX-generated PSFs. One problem with ChaRT is that the number of rays you can obtain in one session is rather limited whereas MARX can easily provide a very large number of rays. A second problem arises from the fact that when ChaRT rays are fed through MARX one is forced to use MARX's internal dither model rather than your observation's actual aspect file (because ChaRT rays have no time tags). Although the celestial coordinates on the two results are the same, the detector coordinates are generally not the same (i.e. the source dithers over a different part of ACIS under the two simulations). The important effect seems to be non-zero values of dy and dz in the aspect file which (I think) represent motion of the SIM with respect to the HRMA. When the source is far from the edges of CCDs none of this matters, but when the actual source dithers across edges then it's vital that the simulated source dither the same way, something that the ChaRT work flow cannot reproduce.

Running ChaRT is not easy, but we've written a tool (ae_chart_interface) that calculates the ChaRT parameters you need, downloads the rays, and processes them into an AE-compatible set of PSF images. The ChaRT PSF is blurred by the same method used in AE (§5.1.2). For example, to create ChaRT PSFs for observation ``4495'' at the location of the source ``104357.47-593251.3'':

  .run ae         
  ae_chart_interface, '104357.47-593251.3', '4495'
Supply the optional parameter /PIPELINE_RANDOMIZATION, described in §E.1, as appropriate.

Then, cd to the source's observation directory and create a symbolic link that will cause the ChaRT PSFs to be used by AE:

cd 104357.47-593251.3/4495
mv source.psf AE_source.psf
ln -s chart_source.psf source.psf.

7.14.9 Printing spectra

The AE package includes a little Perl program plot_spectra.pl (originally developed by Franz Bauer) to print PostScript spectra produced by the AE fitting scripts, laid out 12 to a page.


EXAMPLE:
plot_spectra.pl 18*/nogrp_tbabs_vapec/ldata.ps

7.14.10 Reviewing spectral fits

The IDL program ae_spectra_viewer provides a graphical user interface to help the observer conduct a source-by-source review of multiple spectral models produced by multiple sessions of the FIT_SPECTRA stage. The observer is shown the fits results (parameter values, luminosities, and spectral plots) for all the models available for a given source, and the observer is able to designate the preferred model. That preference is stored in a FITS keyword (BEST_MDL) in the file holding the spectral models (source.spectra) and a symbolic link pointing to the preferred model is created; the preferred models can then be referenced in the COLLATED_FILENAME stage (§7.12).

This tool is a re-implementation of the Perl tool spectra_viewer.pl developed by Konstantin Getman. The X Windows program gv is used to display the Postscript spectra produced by XSPEC. You must have the GNU implementation of gv (version 3.6.1 or higher) in your Unix path.

Usage and Inputs
ae_default_model_preference, srclist_filename, hduname, /FORCE
ae_spectra_viewer, srclist_filename


EXAMPLE:
.run ae


; Set the default ``best model'' to ``nogrp_tbabs_vapec'' for all sources.
; Use /FORCE keyword to override any existing BEST_MDL values.
ae_default_model_preference, 'all.srclist', 'nogrp_tbabs_vapec'


; Interactively review each source.
ae_spectra_viewer, 'all.srclist', HDUNAME='*'


; Collate the ``best model'' results.
acis_extract, 'all.srclist', COLLATED_FILENAME='best_model.collated', HDUNAME='BEST_MDL'

By careful construction of the source list passed to ae_spectra_viewer the observer can review the sources in whatever order is most convenient, or review only a subset of the catalog. For example you might collate (§7.12) the fit results from a standard model for the whole catalog, and then make a list of the sources with suspicious fit results for interactive review.

7.14.11 Catalog matching

The TARA package includes a tool (match_xy.pro) to match catalogs using positional uncertainties for individual sources and a match significance threshold, rather than using a fixed matching radius as is commonly employed. This tool can be used to match catalogs from different observatories, or can be used to find the intersection of Chandra source lists obtained from multiple source detection runs. (See §10.1 of the TARA User's Guide)

7.14.12 Adding source properties

The little program ae_poke_source_property (in acis_extract_tools.pro) will ``poke'' a FITS keyword into the source.stats or obs.stats file for each source in the srclist. (Obviously this could be done with CIAO or HEASOFT tools as well.) Some observers might use such keywords to carry ancillary information about sources.

7.14.13 Performing a spectral fit using an existing script

The code the AE fitting stage uses to spawn XSPEC and manage the data products produced has been pulled out into a separate routine ae_perform_fit which can be used to execute an existing XSPEC script created by the fitting stage. This might be useful if you have hand-edited the script for some reason.


EXAMPLE:
.run ae
ae_perform_fit, '181948.82-160624.2', 'nogrp_tbabs_vapec'

  • The first input is the name of an AE source.
  • The second input is the name of the XSPEC script (without the .xcm extension), assumed to be in <source>/spectral_models/.

7.14.14 Scanning for Residual Afterglow Events

An example of using the tool ae_afterglow_report is shown in our AE recipes (§7.1).


7.14.15 Table generation

The COLLATE stage of AE produces a FITS table with vector columns, in order to record source properties over many energy bands. The tool ae_flatten_collation transforms the AE collation into a more convenient and scientifically useful FITS table.

  • Results are retained for only the three energy bands we typically care about. Those quantities are stored in independent columns, eliminating all vector columns.

  • The unfriendly column names used by AE are replaced with more meaningful names.

  • The CIAO tool aprates is used to estimate confidence intervals on NET_CNTS, replacing the less accurate AE photometry confidence intervals.

  • The observed energy flux is very simply estimated by multiplying AE's photon flux by the median observed event energy.

  • The confidence intervals on spectral model parameters produced by XSPEC are formatted into LATEX strings, ready for use in a LATEX table of fitting results (either the ones we provide with AE, or custom tables produced by the observer).

  • XSPEC confidence intervals on model normalizations are converted to emission measures and formatted into LATEX strings. XSPEC fluxes are converted to luminosities.


EXAMPLE:
.run ae
ae_flatten_collation, COLLATED_FILENAME='photometry.collation', FLAT_TABLE_FILENAME='xray_properties.fits', SORT=0

The tool hmsfr_tables (in acis_extract_tools.pro) converts the FITS table produced by ae_flatten_collation into several LATEX tables of AE results that we find useful in our star formation research. Stubs of these are shown in Figures 12, and 3. Several IDL ``.sav'' files holding various source parameters are also produced. This program has not yet been adequately documented, although the code comments give some information and it is used in our example recipe (§7.1).


next up previous contents pdf.png
Next: A. Running Multiple Instances Up: 7 Using ACIS Extract Previous: 7.13 Caveats
Patrick Broos
Penn State Department of Astronomy
2013-05-09