About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: 1 Dec 2006
Hardcopy (PDF): A4 | Letter

Using an Exposure Map in Fitting Image Data



Overview

Last Update: 1 Dec 2006 - reviewed for CIAO 3.4: no changes

Synopsis:

This thread shows how to use an exposure map when fitting 2-D spatial data. The exposure map file is input to Sherpa through the file-based exposure map model (FEXPMAP).

Proceed to the HTML or hardcopy (PDF: A4 | letter) version of the thread.




Contents



Getting Started

Please follow the "Sherpa Threads: Getting Started" thread.

Reading and Plotting 2-D FITS Data

We are using 2-D spatial data from the FITS datafile img.fits. This dataset is input into Sherpa with the DATA command:

sherpa> DATA img.fits

The dataset may be viewed as a contour plot, surface plot or an image. Here we show the surface plot method, creating a postscript file of the output as well:

sherpa> SPLOT DATA
sherpa> PRINT POSTFILE splot.ps

This creates Figure 1 [Link to Image 1: Surface plot of the data].



Setting the Exposure Map

The following is similar to the process of defining responses for spectral data, where a 1-D instrument model (RSP) is defined and set as the instrument.

We define the exposure map model:

sherpa> FEXPMAP[emap]
emap.file parameter value ["none"] expmap.fits
emap.norm parameter value [1] 
sherpa> INSTRUMENT = emap

To display the status of the model emap, use the SHOW command. Note that FEXPMAP is an alternate name for FARF2D; Sherpa identifies it by the latter:

sherpa> SHOW emap
farf2d[emap]
    Param   Type      Value        Min        Max                 Units
    -----   ----      -----        ---        ---                 -----
 1   file string: "expmap.fits"
 2   norm frozen          1          0       1000                      

The normalization (norm) is frozen at 1, since the exposure map is normalized to the exposure time of the image; this is how all exposure maps are generated in the CIAO exposure map threads.



Defining and Fitting the Source

One can now define a model to be used as a source model. After viewing Figure 1 [Link to Image 1: Surface plot of the data], the BETA2D model is found to be a promising candidate for the source. Since we want to set the initial values, we leave on the parameter prompting:

sherpa> BETA2D[bm]     
bm.r0 parameter value [80] 30
bm.xpos parameter value [36.5] 40
bm.ypos parameter value [41.5] 40
bm.ellip parameter value [0] 0.3
bm.theta parameter value [0] 5
bm.ampl parameter value [1.51294] 3.0
bm.alpha parameter value [1] 1.5

sherpa> THAW bm.ellip bm.theta

The BETA2D model is defined for the source, then the data is fit:

sherpa> SOURCE = bm
sherpa> FIT
 LVMQT: V2.0
 LVMQT: initial statistic value = 4.88095e+06
 LVMQT: final statistic value = 3255.75 at iteration 11
            bm.r0  12.4624     
            bm.xpos  39.5139     
            bm.ypos  40.8959     
            bm.ellip  0.0259204     
            bm.theta  4.72828     
            bm.ampl  1.31312     
            bm.alpha  1.66641     

To display the fit and residuals of the plot, we again use SPLOT:

sherpa> SPLOT 2 SOURCE RESIDUALS

where RESIDUALS refers to the absolute residuals, calculated as (data - model). This creates Figure 2 [Link to Image 2: Fit and absolute residuals].

Alternately, use DELCHI, the sigma residuals of the fit; these are calculated as ((data - model)/error):

sherpa> SPLOT 2 SOURCE DELCHI

as shown in Figure 3 [Link to Image 3: Fit and sigma residuals].



Saving a Sherpa Session

To save the Sherpa session:

sherpa> SAVE ALL expmap.shp

where expmap.shp is the output ASCII file. The information is written in the form of a Sherpa script. The USE command will restore the session when desired.

The source (unconvolved model amplitudes), model (convolved model amplitudes), and residuals may all be written out in FITS format with the WRITE command:

sherpa> WRITE SOURCE expmap_source.fits
Write X-Axes: (Bin,Bin)  Y-Axis: Amplitude (Photons/bin)

sherpa> WRITE MODEL expmap_model.fits
Write X-Axes: (Bin,Bin)  Y-Axis: Counts

sherpa> WRITE RESIDUALS expmap_residuals.fits
Write X-Axes: (Bin,Bin)  Y-Axis: Counts

The output may be examined as any standard FITS file, e.g. with prism, ds9, or dmlist.




Summary

This thread is complete, so we can exit the Sherpa session:

sherpa> EXIT
Goodbye.


History

14 Jan 2005 reviewed for CIAO 3.2: no changes
21 Dec 2005 reviewed for CIAO 3.3: no changes
01 Dec 2006 reviewed for CIAO 3.4: no changes

Return to Threads Page: Top | All | Fitting
Hardcopy (PDF): A4 | Letter
Last modified: 1 Dec 2006


The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.