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

Reprojecting Images: Making an Exposure-corrected Mosaic

[CIAO 3.4 Science Threads]



Overview

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

Synopsis:

The CIAO 3.3 software release included two new tools for reprojecting images to different WCS coordinates: reproject_image and reproject_image_grid. reproject_image maps an image in one WCS reference frame to the WCS in another image. If you do not have a reference image available, reproject_image_grid can reproject the image to a user-defined WCS grid instead.

Purpose:

To create an exposure-corrected mosaic image from multiple observations of SN1006.

Read this thread if:

you are interested in reprojecting image files.

Related Links:

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




Contents



Get Started

Sample ObsIDs used: 3838; 4385; 4386; 4387; 4388; 4389; 4390; 4391; 4392; 4393; 4394

File types needed: evt2; asol1; msk1

All of these data are ACIS-I observations of SN1006, a supernova remnant.

Only the level 2 event file (evt2) is required to create the images which will be reprojected. The additional files are necessary if you intend to create exposure maps for the images as well.

In this thread, we assume that all relevant files are in the same working directory.



Create an Image of Each Observation (dmcopy)

The first step is to create an image of each event file with dmcopy. We choose to block the images by a factor of 2; see ahelp dmbinning for more information on creating images.

In this example, we filter out the ACIS-S3 chip (ccd_id=7) from the images. Since the back-illuminated chips (ACIS-S1 and S3) have different background than the front-illuminated chips, eliminating S3 will reduce the chip-to-chip variations in the final image. If you choose to filter out a chip from your image, make sure that doing so does not remove important features from the data.

unix% dmcopy "acisf03838N001_evt2.fits[ccd_id=0:3][bin sky=2]" 3838_bin2.img

unix% dmcopy "acisf04385N001_evt2.fits[ccd_id=0:3][bin sky=2]" 4385_bin2.img

unix% dmcopy "acisf04386N001_evt2.fits[ccd_id=0:3][bin sky=2]" 4386_bin2.img

unix% dmcopy "acisf04387N001_evt2.fits[ccd_id=0:3][bin sky=2]" 4387_bin2.img

unix% dmcopy "acisf04388N001_evt2.fits[ccd_id=0:3][bin sky=2]" 4388_bin2.img

unix% dmcopy "acisf04389N001_evt2.fits[ccd_id=0:3][bin sky=2]" 4389_bin2.img

unix% dmcopy "acisf04390N001_evt2.fits[ccd_id=0:3][bin sky=2]" 4390_bin2.img

unix% dmcopy "acisf04391N001_evt2.fits[ccd_id=0:3][bin sky=2]" 4391_bin2.img

unix% dmcopy "acisf04392N002_evt2.fits[ccd_id=0:3][bin sky=2]" 4392_bin2.img

unix% dmcopy "acisf04393N001_evt2.fits[ccd_id=0:3][bin sky=2]" 4393_bin2.img

unix% dmcopy "acisf04394N001_evt2.fits[ccd_id=0:3][bin sky=2]" 4394_bin2.img

Figure 1 [Link to Image 1: Images of each observation] shows the eleven individual images.



Reproject the Images to a Common Tangent Point (reproject_image_grid)

reproject_image_grid maps an image - or many images - from the current WCS to a specified grid. This tool is used to reproject all the images of SN1006 to a common frame of reference, creating a mosaic of the object from the individual observations.

The filenames are input to reproject_image_grid as a stack file, images.lis:

unix% cat images.lis
3838_bin2.img
4385_bin2.img
4386_bin2.img
4387_bin2.img
4388_bin2.img
4389_bin2.img
4390_bin2.img
4391_bin2.img
4392_bin2.img
4393_bin2.img
4394_bin2.img

The parameters are set to create a 1500 square pixel image, centered at (225.7, -41.9). Each sky pixel will correspond to 2"; read the caveat about defining a pixel size in arcseconds before running reproject_image_grid.

Note also that the method parameter is set to sum; this means that the output image will contain the sum of the counts for each pixel from the input images, not the average value. The reproject_image_grid bug page discusses this in more detail.

unix% punlearn reproject_image_grid 
unix% pset reproject_image_grid infile=@images.lis 
unix% pset reproject_image_grid outfile=sn1006_image.fits 
unix% pset reproject_image_grid xsize=1500 ysize=1500 
unix% pset reproject_image_grid xcenter="225.7" ycenter="-41.9" 
unix% pset reproject_image_grid theta="0"
unix% pset reproject_image_grid method=sum

unix% reproject_image_grid pixelsize='2"' 
Input image file name (@images.lis): 
Output file name (sn1006_image.fits): 
X-Size of output image in image pixels (1:) (1500): 
Y-Size of output image in image pixels (1:) (1500): 
X-Center of image in cood_sys (225.7): 
Y-Center of image in cood_sys (-41.9): 
Angle between woord coord north and output y axis (0:360) (0): 

omit - DEC_NOM values different more than 0.000300
warning: DS_IDENT has different value...Merged...
warning: OBS_ID has different value...Merged...
omit - RA_NOM values different more than 0.000300

The messages are related to how the tool merges the header information in the input files. The merging_rules ahelp file explains the rules and how they affect the output file header.

Figure 2 [Link to Image 2: Input images reprojected to the same WCS grid] shows the output image. The contents of the parameter file may be checked with plist reproject_image_grid.



Creating and Combining the Exposure Maps (reproject_image)

In order to exposure-correct the images, it is necessary to create multi-chip exposure maps for each of the observations. This was done by following the Compute Exposure Map section of the Multiple Chip ACIS Exposure Map thread.

We need to combine the exposure map images into a single file that has the same resolution and WCS as the mosaic image. reproject_image maps an image - or many images - in one WCS reference frame to the WCS in a match image. The tool is used here to reproject the exposure maps to match the mosaic image.

Since four chips (ccd_id=0,1,2,3) were used for each of the eleven observations, we have forty-four exposure maps to combine. The filenames are input to reproject_image as a stack file, expmaps.lis:

unix% cat expmaps.lis
3838_0_expmap.fits
3838_1_expmap.fits
3838_2_expmap.fits
3838_3_expmap.fits
4385_0_expmap.fits
...
4394_2_expmap.fits
4394_3_expmap.fits

It is important to note that the method parameter is set to average; this is because we want the average exposure value for each pixel in the combined image, not the sum of all of them. The reproject_image bug page discusses this in more detail.

unix% punlearn reproject_image
unix% pset reproject_image infile=@expmaps.lis
unix% pset reproject_image matchfile=sn1006_image.fits
unix% pset reproject_image outfile=sn1006_expmap.fits 
unix% pset reproject_image method=average

unix% reproject_image
Input image file name (@expmaps.lis): 
Reference image (sn1006_image.fits): 
Output file name (sn1006_expmap.fits): 

omit - DEC_NOM values different more than 0.000300
warning: DETNAM has different value...Merged...
warning: DS_IDENT has different value...Merged...
warning: OBS_ID has different value...Merged...
omit - RA_NOM values different more than 0.000300

The messages are related to how the tool merges the header information in the input files. The merging_rules ahelp file explains the rules and how they affect the output file header.

The reprojected exposure maps are shown in Figure 3 [Link to Image 3: Reprojected exposure maps]. The contents of the parameter file may be checked with plist reproject_image.



Exposure-correct the Image Mosaic (dmimgcalc)

Finally, we use dmimgcalc to divide the image by the exposure map:

unix% punlearn dmimgcalc 
unix% pset dmimgcalc infile=sn1006_image.fits
unix% pset dmimgcalc infile2=sn1006_expmap.fits 
unix% pset dmimgcalc outfile=sn1006_fluxed.fits
unix% pset dmimgcalc operation=div

unix% dmimgcalc
Input file #1 (sn1006_image.fits): 
Input file #2 (sn1006_expmap.fits): 
output file  (sn1006_fluxed.fits): 
arithmetic operation (div): 
warning: CONTENT has 1 different values.
warning: DETNAM has different value...Merged...

The messages are related to how the tool merges the header information in the input files. The merging_rules ahelp file explains the rules and how they affect the output file header.

The exposure-corrected image is shown in Figure 4 [Link to Image 4: Exposure-corrected image].



Improving the Combined Image

There are several additional methods that may be used to improve the quality of the final image.

Background Subtraction

As discussed in the Create an Image of Each Observation section, we filtered out the ACIS-S3 chip to reduce the chip-to-chip exposure variations. Figure 5 [Link to Image 5: Comparing exposure-corrected images with and without S3 chip] compares this fluxed image to the results if the S3 chip is not removed. This is not an option for all observations, e.g. if there is significant data on the back-illuminated chips. If you must include both front- and back-illuminated chips, try using background subtraction to compensate for the different chip exposures. Also try using dmimgthresh to set a threshold for the image values.

Energy Filtering

This thread uses monochromatic exposure maps created for the full energy range of the data files. To more accurately represent the spectrum of the data, create three narrow-band fluxed images. Do so by running this thread three times, adding an energy filter to the dmcopy commands in the Create an Image of Each Observation section to produce images of soft, medium, and hard energy ranges. Then combine the three fluxed images with dmimg2jpg to create a three-color image; see the Create A True Color Image thread for details.

Smoothing

Adaptively smoothing the data with aconvolve will create a nice image for publication; see the ahelp file for examples. Note that care must be taken in the scientific interpretation of the smoothed image as it is highly processed.




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


        infile = @images.lis Input image file name
       outfile = sn1006_image.fits Output file name
         xsize = 1500             X-Size of output image in image pixels
         ysize = 1500             Y-Size of output image in image pixels
       xcenter = 225.7            X-Center of image in cood_sys
       ycenter = -41.9            Y-Center of image in cood_sys
         theta = 0                Angle between woord coord north and output y axis
     pixelsize = 2'               Pixel size
   (projection = tan)             Projection from world to physical
   (resolution = 1)               Number of point per side to evalute
       (method = sum)             Average value
    (coord_sys = world)           Coorindate system to match images in
    (lookupTab = ${ASCDS_CALIB}/dmmerge_header_lookup.txt -> /soft/ciao/data/dmmerge_header_lookup.txt) lookup table
      (clobber = no)              Clobber existing files
      (verbose = 0)               Tool verbosity
         (mode = ql)              
    


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


        infile = @expmaps.lis Input image file name
     matchfile = sn1006_image.fits Reference image
       outfile = sn1006_expmap_reproject.fits Output file name
   (resolution = 1)               Number of point per side to evalute
       (method = average)         Average value
    (coord_sys = world)           Coorindate system to match images in
    (lookupTab = ${ASCDS_CALIB}/dmmerge_header_lookup.txt -> /soft/ciao/data/dmmerge_header_lookup.txt) lookup table
      (clobber = no)              Clobber existing files
      (verbose = 0)               Tool verbosity
         (mode = ql)              
    


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


        infile = sn1006_image.fits Input file #1
       infile2 = sn1006_expmap_reproject.fits Input file #2
       outfile = sn1006_fluxed.fits output file 
     operation = div              arithmetic operation
       (weight = 1)               weight for first image
      (weight2 = 1)               weight for second image
    (lookupTab = ${ASCDS_CALIB}/dmmerge_header_lookup.txt -> /soft/ciao/data/dmmerge_header_lookup.txt) lookup table
      (clobber = no)              delete old output
      (verbose = 0)               output verbosity
         (mode = ql)              
    

History

04 Apr 2006 new for CIAO 3.3: original version
23 May 2006 revised to omit S3 chip (ccd_id=7), which results in a cleaner final image
01 Dec 2006 reviewed for CIAO 3.4: no changes

Return to Threads Page: Top | All | Imag
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.