Last modified: 8 Feb 2022

URL: https://cxc.cfa.harvard.edu/ciao/threads/srcextent/

Measuring Source Extent

CIAO 4.15 Science Threads


Overview

Synopsis:

The srcextent tool calculates the sizes and associated errors of a photon-count source image or list of source images using the Mexican Hat Optimization (MHO) algorithm (Houck 2007). The uncertainty from a 90% confidence estimate derived from Monte Carlo trials using MARX simulated data is also reported.

Purpose:

To measure the size of a source and to estimate if a source may be extended.

Related Links:

Last Update: 8 Feb 2022 - Review for CIAO 4.14. Changed OBSID used in the thread.


Contents


Get Started

Download the sample data: 4425 (GRB030226)

unix% download_chandra_obsid 4425 evt2

The PSF and source data may be provided either as event files or images. Event data are preferred, and are used in this thread. If using a PSF image, the source centroid must be at the center of the image to ensure the appropriate estimates are correct.

Simulate a PSF (optional)

A PSF may be used in runnning srcextent. The tool fits the PSF first, if it is present, and uses the result as an initial guess to guide fitting on the source image.

The Chandra HRMA PSF can be simulated with ChaRT and the instrument effects, including detector pixelization, can be simulated with MARX. Instructions on how to run ChaRT and MARX to create a PSF FITS file are available in the ChaRT threads.


Creating the Source Region File

We need to define a source region to use as input to the tool. To do this, first display the image:

unix% ds9 acisf04425_repro_evt2.fits &

In this example, we chose a source on ACIS-I1 (ccd_id=1), as shown in Figure 1.

Figure 1: Source region on the event file

[Thumbnail image: The region is a green circle around a source on ACIS-I1.]

[Version: full-size]

[Print media version: The region is a green circle around a source on ACIS-I1.]

Figure 1: Source region on the event file

To save the regions, follow these steps:

  1. Region → Save Regions... → Save As "src.reg".
  2. After choosing "OK" in the region filename dialog, a format dialog is opened. Set the format to "CIAO" and the coordinate system to "Physical".

    Only CIAO format regions are currently supported.

The resulting region file looks like:

unix% more src.reg
# Region file format: CIAO version 1.0
circle(4061.5965,4036.5219,10)

Run srcextent

The event file, PSF file, and region are the only inputs necessary to run srcextent. However, users need to pre-filter the event file before running srcextent as it does not recognize datamodel filters:

unix% dmcopy "acisf04425_repro_evt2.fits[energy=500:7000]" broad.evt clob+

unix% punlearn srcextent
unix% pset srcextent srcfile=broad.evt
unix% pset srcextent outfile=extent.fits
unix% pset srcextent psffile=psf.fits
unix% pset srcextent regfile=src.reg
unix% pset srcextent srcsize=5 x0=4061.6 y0=4026.5

Running the tool with verbose=3 prints the results to the screen:

unix% srcextent verbose=3
Source file, FITS image or FITS events list (acisf04425_repro_evt2.fits):
PSF file, FITS image or FITS events list (optional) (psf.fits):
Region File, ellipse or circle, in FITS or ASCII (required for events list) (src.reg):
Output file, FITS table (extent.fits):
Results for Source 1

Source Observed Size: 0.45 " @ PA 42.46 deg at pixel coords 4061.7, 4036.6
    90% Confidence intervals: (0.41 -- 0.48) @ (INDEF -- INDEF)

PSF Observed Size:    0.40 " @ PA 45.73 deg at pixel coords 4061.6, 4036.5
    90% Confidence intervals: (0.40 -- 0.40) @ (INDEF -- INDEF)

Estimated Intrinsic Size: 0.19 " @ PA 0.00 deg
    90% Confidence intervals: (0.13 -- 0.26) @ (INDEF -- INDEF)

Source is not extended at 90% confidence

An estimated intrinsic size of 0 " means that there is no evidence of extent given the errors, i.e. the source is pointlike. As the screen output reports, this source is not extended within a 90% confidence interval. Note that "PA" stands for "position angle."

The "@ (INDEF -- INDEF)" portion of the output represents the confidence limits on the position angle. The tool currently does not calculate these limits, so they will always be INDEF.

The contents of the parameter file may be checked with plist srcextent.


Run srcextent without a PSF

To compare how the output changes, srcextent run again, without the PSF file:

unix% pset srcextent psffile=""
unix% pset srcextent outfile=extent_nopsf.fits

unix% srcextent verbose=3
Source file, FITS image or FITS events list (acisf04425_repro_evt2.fits):
PSF file, FITS image or FITS events list (optional) ():
Region File, ellipse or circle, in FITS or ASCII (required for events list) (src.reg):
Output file, FITS table (extent_nopsf.fits):
Results for Source 1

Source Observed Size: 0.44 " @ PA 46.29 deg at pixel coords 4061.7, 4036.6
    90% Confidence intervals: (0.40 -- 0.47) @ (INDEF -- INDEF)

Since the PSF information was not available, a determination about the extent is not reported.

The contents of the parameter file may be checked with plist srcextent.


Examining the Output

In addition to being printed to the screen, the source extent information is saved in the output FITS file. Whether or not a source is extended is recorded as a boolean in the EXTENT_FLAG column of the output file, as are the ellipse parameters reported to the screen (e.g. major and minor axes and the confidence limits). This example uses the file from the first run of srcextent:

unix% dmlist extent.fits"[cols EXTENT_FLAG, X, Y, MAJOR_AXIS, MINOR_AXIS, POS_ANGLE]" data

--------------------------------------------------------------------------------
Data for Table Block TABLE
--------------------------------------------------------------------------------
 
ROW    EXTENT_FLAG X                    Y                    MAJOR_AXIS           MINOR_AXIS           POS_ANGLE
 
     1          0      4061.7292103953      4036.5945871674     0.19192230760850     0.19192230760850                    0

Recall that this source was determined to not be extended (EXTENT_FLAG=0), so the major and minor axis and the position angle are all 0.


Caveats

The srcextent tool is intended to provide a quick estimate for the size of the source. Users trying to determine unambiguously the point-like nature of their source or to trying to detect the presence of faint diffuse emission around a point source must perform a more rigorous evaluation of the data.

The quality of the srcextent estimate is strongly biased by the quality of the PSF used. Users should be concerned about:

  • The spectrum of the PSF must match the spectrum of the source.
  • srcextent does not take any detector effects into account. This include pileup, chip edges, bad columns/pixels, dither, etc. Users should be aware of the effects each of these has on the PSF and the data to determine if any possible extent could be related to the instrument.

Users should review the sherpa Accounting for PSF Effects in 2D Image Fitting thread to see how to do 2D modeling and fitting including a PSF.



Parameters for /home/username/cxcds_param/srcextent.par


       srcfile = broad.evt Source file, FITS image or FITS events list
       outfile = extent.fits      Output file, FITS table
       psffile = psf.fits         PSF file, FITS image or FITS events list (optional)
       regfile =                  Region File, ellipse or circle, in FITS or ASCII (required for events list)
        (shape = gaussian)        source shape [gaussian,disk]
           (x0 = INDEF)           estimate of x-position [sky]
           (y0 = INDEF)           estimate of y-position [sky]
      (srcsize = 0)               crude estimate of source size
      (imgsize = 0)               size of image
    (binfactor = 0)               image binning factor
    (mincounts = 15)              minimum counts threshold inside ellipse
    (minthresh = 6)               minimum counts threshold for source file
      (clobber = no)              clobber output file
      (verbose = 3)               verbosity setting
         (mode = ql)
    


Parameters for /home/username/cxcds_param/srcextent.par


       srcfile = broad.evt Source file, FITS image or FITS events list
       outfile = extent_nopsf.fits Output file, FITS table
       psffile =                  PSF file, FITS image or FITS events list (optional)
       regfile = src.reg          Region File, ellipse or circle, in FITS or ASCII (required for events list)
        (shape = gaussian)        source shape [gaussian,disk]
      (srcsize = 0)               crude estimate of source size
      (imgsize = 0)               size of image
    (binfactor = 0)               image binning factor
    (mincounts = 15)              minimum counts threshold inside ellipse
    (minthresh = 6)               minimum counts threshold for source file
      (clobber = no)              clobber output file
      (verbose = 3)               verbosity setting
         (mode = ql)
    

History

20 Apr 2009 New for CIAO 4.1.2
08 Feb 2010 updated for CIAO 4.2: changes to the ds9 region file format menu; minor changes to screen output
15 Dec 2010 updated for CIAO 4.3: added x0 and y0 to srcextent parameter file listing
04 Feb 2011 added note that only CIAO format regions are currently supported
10 Jan 2012 reviewed for CIAO 4.4: no changes
03 Dec 2012 Review for CIAO 4.5; input file version updates
11 Dec 2013 Review for CIAO 4.6; no changes.
22 Dec 2014 Review for CIAO 4.7; no changes.
21 Jun 2016 Clarified limited scope of use of tool and added a caveats section.
08 Feb 2022 Review for CIAO 4.14. Changed OBSID used in the thread.