## Methods in Sky Matching

The purpose of this example is to show the sky matching feature which is part of DrizzlePac 2.0. We create a mosaic using ACS/WFC observations of M51 obtained with filter F555W. As can be seen in Figure 1 on the right, the observations cover most of NGC 5195 and the NE part of NGC 5194. The red lines represent the ACS/WFC footprints of the images used in this example. These tiles have been selected due to the different nature of the sources and the distinctive different sky, which makes them a perfect case to test the sky matching algorithms.

### Observations

We use a set of observations of the NGC 5194 NGC 5195 interactive pair obtained as part of the HST proposal 10452 (PI: Steven Beckwith). The images have been processed by the HST ACS pipeline using CALACS version used 8.2.0 (13 aug 2013), which includes bias subtraction, dark current correction, flatfielding as well as pixel-based CTE correction.

The images have been aligned using the DrizzlePac task TweakReg to better than 0.1 pixel precision. Then the WCS information in the header of the FLC files was updated with the help of the tweakback task. See other examples to learn how to complete these tasks on your own.

We provide the aligned FLC files upon request to show how to perform the matching of the sky between two tiles, each composed of four ACS/WFC FLC images.

### Procedure

Step 3 in the astrodrizzling process measures, subtracts and/or equalizes the sky from each input images and records the subtracted value in the image header. DrizzlePac 2.0 provides four algorithms for sky computation. In this example we ran all of them and compare the results.

skymethod = localmin

This method is similiar to the original "skysub" algorithm used in previous versions of astrodrizzle. We first create a list (imlist.dat) containing the names of the eight images to drizzle. The command that we use to drizzle the images looks like this :

>>> astrodrizzle.AstroDrizzle('@imlist.dat',\           #   name of input file
output='f555w_localmin',\         #  name of output file
driz_sep_bits='2048,256,64,32',\
driz_cr_corr=yes,\
final_bits='2048,256,64,32',\
final_wht_type='EXP',\
final_wcs=yes,\
final_kernel='gaussian',\
final_pixfrac=1.0,\
final_scale=0.049,\             # ACS/WFC native pixel size
final_rot=0.0,\                  # rotate drizzled product
final_ra=202.5076,\            # arbitrary value to center image
final_dec=47.2437,\            # arbitrary value to center image
skysub=yes,\                    # turn on sky subtraction
skymethod='localmin')      # parameter to define the sky subtraction method

The output image is given in units of electrons/second. Figure 2 (left) shows the output image with the 'localmin' sky matching method applied. A clear horizontal border is seen between the two tiles. In order to display the final drizzled images and compare results, a hyperbolic sine stretch has been used.

skymethod = match

This method computes differences in sky values between images in common sky regions. In this case computed sky values will be relative to the sky computed in one of the input images whose sky value will be set to 0. This setting will “equalize” sky values between the images in large mosaics. For this test, we ran the same code except with the line skymethod= 'match' . Figure 2 shows this output image at the same linear stretch as with the 'localmin' case.

skymethod = globalmin

This method computes sky values for each chip/image extension in all input images, finds the minimum sky value, and then it subtracts the same minimum sky value from all chips in all images. For this test, we ran the same code except with the line skymethod= 'globalmin'. Figure 2 shows the result of this drizzle experiment at the same linear stretch and the transition between tiles has dissapeared.

skymethod = globalmin+match

This method finds a minimum “global” sky value in all input images and then uses the ‘match’ method to equalize sky values between images. For this test, we ran the same code except with the line skymethod= 'globalmin+match'. The final drizzled images is shown below.

MDRIZSKY keyword

The 'sky' function in the DrizzlePac package updates the MDRIZSKY keyword in the headers of the input files, and provides a final value in the drizzled product. The table below shows the sky values computed by AstroDrizzle for the output images in this example.

SKYMETHOD              MDRIZSKY (electrons)
localmin               31.29
globalmin              25.08
globalmin+match        24.96
match                  0.58

### Recommended Uses

The 'sky' function in the DrizzlePac package provides four methods to match the sky between tiles. The 'localmin' method is recommended for images with sparse fields (few astronomical sources) and the 'match' algorithm is recommended for images with complicated backgrounds such as nebulae, and large host galaxies.