Skip to the navigation links
Last modified: 9 Feb 2010
Where are the PDFs?

Reprojecting Images: Making an Exposure-corrected Mosaic

CIAO 4.2 Science Threads



Overview

Last Update: 9 Feb 2010 - reviewed for CIAO 4.2: no changes

Synopsis:

The reproject_image tool 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.

Related Links:




Contents



Get Started

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

File types needed: evt2; asol1; msk1; pbk0

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 "acisf03838N002_evt2.fits[ccd_id=0:3][bin sky=2]" 3838_bin2.img

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

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

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

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

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

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

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

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

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

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

Figure 1 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 world coord north and output y axis (0:360) (0): 

BTIMDRFT values are different...FAIL...
BTIMNULL values are different...FAIL...
BTIMRATE values are different...FAIL...
omit - DEC_NOM values different more than 0.000300
omit - DEC_PNT 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
omit - RA_PNT 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 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): 
BTIMDRFT values are different...FAIL...
BTIMNULL values are different...FAIL...
BTIMRATE values are different...FAIL...
omit - DEC_NOM values different more than 0.000300
omit - DEC_PNT 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
omit - RA_PNT 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. The contents of the parameter file may be checked with plist reproject_image.



Exposure-correct the Image Mosaic (dmimgthresh & dmimgcalc)

The strongly variable exposure near the edge of a dithered field may produce "hot" pixels when divided into an image. While technically proper, these hot pixels can be an eyesore, drawing attention to a noisy, uninteresting portion of the image. The dmimgthresh tool is used to make a "threshold cut" before dividing the image by the exposure map, thus removing the hot pixels:

unix% punlearn dmimgthresh
unix% pset dmimgthresh infile=sn1006_image.fits
unix% pset dmimgthresh outfile=sn1006_image_clean.fits
unix% pset dmimgthresh expfile=sn1006_expmap.fits
unix% pset dmimgthresh cut=1.5%
unix% pset dmimgthresh value=0.0
unix% dmimgthresh
Input dataset/block specification (sn1006_image.fits):
Output dataset/block specification (sn1006_image_clean.fits):

Here we set our threshold at 1.5% of the maximum value of the exposure map. All image pixels with values of exposure less than this value will be set to 0.0 in the output file. You may want to adjust these values for your own observation.

You can check the parameter file that was used with plist dmimgthresh.

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

unix% punlearn dmimgcalc 
unix% pset dmimgcalc infile=sn1006_image_clean.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_clean.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.



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 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 (S-Lang or Python) to compensate for the different chip exposures.

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 True Color Images 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 world 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)           Coordinate 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.fits Output file name
   (resolution = 1)               Number of point per side to evalute
       (method = average)         Average value
    (coord_sys = world)           Coordinate 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/dmimgthresh.par


        infile = sn1006_image.fits Input dataset/block specification
       outfile = sn1006_image_clean.fits Output dataset/block specification
      (expfile = sn1006_expmap.fits) Exposure map file
          (cut = 1.5%)            Threshold value
        (value = 0)               Replacement value
      (verbose = 0)               Debug Level(0-5)
      (clobber = no)              Clobber existing file
         (mode = ql)
    


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


        infile = sn1006_image_clean.fits Input file #1
       infile2 = sn1006_expmap.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
25 Jan 2008 updated for CIAO 4.0: typos fixed in parameter files
17 Feb 2009 updated for CIAO 4.1: images are inline; event files are version N002 or N003; run dmimgthresh before dmimgcalc in Exposure-correct the Image Mosaic section
09 Feb 2010 reviewed for CIAO 4.2: no changes

Return to Threads Page: Top | All | Imag

Where are the PDFs?
Last modified: 9 Feb 2010