STScI Logo

Hubble Space Telescope
DrizzlePac: Photometry Demonstration

AstroDrizzle: Aperture Photometry Accuracy

Creating a combined image with AstroDrizzle

All the necessary information for successfully combining the input data is at hand at this point. The header WCS of each image has been updated and this information provides the corrections to the alignment of the images to allow AstroDrizzle to correctly identify and remove cosmic rays. AstroDrizzle is a wrapper of several algorithms that will produce the final aligned and cosmic-ray-cleaned image. It is organized in seven steps which may be turned on or off by the user depending on your needs.

Because the default AstroDrizzle parameters may not provide optimal data products for all HST instruments, the user is strongly advised to inspect the quality of the cosmic ray rejection and to experiment with different parameter values.

In the following sections we present an example that requires a parameter value change.

AstroDrizzle: first run

We begin by running all the steps in AstroDrizzle except the last one, checking out the output and verifying the correct alignment. We reset the task astrodrizzle and look at the parameters using the TEAL interface:

--> unlearn astrodrizzle
--> epar astrodrizzle

We modify the following parameters:

input = @list_f814w
output = f814w
driz_combine = no

In the TEAL toolbar (found below the menu bar) we click the Execute button. This will use the current parameters and run the task. The parameter values are saved to the configuration file listed at the top of the window. The task should take execute the first six steps in less than 10 minutes.

By setting

static = yes

AD creates a static bad-pixel mask from the data.

skysub = yes

means that AD will subtract the sky from each drizzled image. Sky subtraction is recommended for effective cosmic ray flagging and removal, but only if sufficient blank sky is available to perform an accurate determination. The sky value is calculated independently for each of the two ACS chips, and the lowest value is taken to represent the true value for both chips.

median = yes

means that AD will create a median image from the separate drizzled input images, allowing for a variety of combination and rejection algorithms. The default value

combine_type = minmed

is designed to perform optimally in the case of combining only a few images like in our current example.

blot = yes

means that the median image is transformed back to the reference frame of each original input image. AD will compare the original and blotted median images to identify cosmic rays in the next step.

By setting

driz_cr = yes

AD uses the original input images, the blotted median image, and the derivative of the blotted image to create a cosmic ray mask for each input image. It is a good practice to blink the science FITS files (*_flt.fits) with their corresponding cosmic ray masks (*_sc1_crmask.fits and *_sc2_crmask.fits) in order to verify that visible cosmic rays are actually being masked.

AstroDrizzle: second run

Now that the cosmic ray masks have been computed, we can create the final mosaic by running step 7 only and turning off all intermediate processing steps.

--> unlearn astrodrizzle
--> epar astrodrizzle

In the TEAL interface, we modify the following parameters:

input = @list_f814w
output = f814w
static = no
skysub = no
driz_separate = no
median = no
blot = no
driz_cr = no
driz_combine = yes
final_units = counts

Note that the sky is not removed in this second run because we will perform aperture photometry on the final product and we will compare the photometry with the one obtained using the original FLT images which contain the original sky. Also note that the units of the final drizzled image will be in electrons. We achieve this by setting final units to counts.

By setting

driz_combine = yes

AD takes the original input FLT images, together with the final masks, and drizzles them onto a single output image called f814w_drz_sci.fits. By default, the scale of the output ACS/WFC image is 0.05"/pixel. This image contains the science which has been corrected for distortion and represents the combination of the three input FLT images. Each pixel covers an equal area on the sky. Figure 2 shows the output image f814w_drz_sci.fits.

Figure 2: (Left) The F814W astrodrizzled science image output. (Right) The corresponding weight image.

The second important AD product is the file f814w_drz_wht.fits which is shown in Figure 2. The chip gaps are clearly visible as are column defects and cosmic ray features. It is important to examine the weight image, specially the centers of stars that will be subject to aperture photometry. This may be achieved by blinking the science product and the weight image together. For example, with SAOImage DS9, we can display both images in two frames, and activate the pixel table from the menu:

Analysis-> Pixel Table...

Zoom into a small field, match the two frames and blink them. If an imprint of the sources is observed in the weight image, this means that a problem with the cosmic ray rejection has occurred and this problem will translate into an apparent loss of flux and a wrongful estimation of the magnitudes. This effect can be very subtle but with devastating consequences to the final photometry. This is also useful to identify sources that may have been hit by a cosmic ray or that fall on a bad column. We need to avoid those sources for the final photometry.

Figure 3: Cartoon of a single star (left) and a detail of the central pixels (right) that have been given a low weight. This problem is cased by using very strict cosmic ray rejection parameters. See text on how to avoid this problem.

Figure 3 shows a cartoon of a star that presents flagged central pixels. The left plot shows the actual pixel map of the star in the final science drizzled image. The plot at the right represents the central 7x7 pixel map of the weight image. The numbers represent the integer value of the weight. Note that some of the central pixels have a lower weight value that the rest. This is an undesirable effect that needs to be avoided and it was caused by a very conservative cosmic ray rejection algorithm.

In the first AD run we used the default values

driz_cr_scale = 1.2 0.7

which are too stringent and causes in this case some pixels to be flagged in the centre of some stars of interest. This is causing the final image to be degraded, and we may improve it by relaxing this parameter to

driz_cr_scale = 1.7 0.7

AstroDrizzle: third run

We start all over again. We erase the current files and recover the tweakreged images that we had saved in a different folder and we run AD on them once again

--> unlearn astrodrizzle
--> epar astrodrizzle

In the TEAL interface, we modify the following parameters:

input = @list_f814w
output = f814w
driz_cr_scale = 1.7 0.7
driz_combine = no

This process will create more relaxed cosmic ray masks for our images.

AstroDrizzle: fourth run

In the final stage, we run step 7 in AD, turn off sky subtraction and set the image units to electrons:

--> unlearn astrodrizzle
--> epar astrodrizzle

In the TEAL interface, we modify the following parameters:

input = @list_f814w
output = f814w
static = no
skysub = no
driz_separate = no
median = no
blot = no
driz_cr = no
driz_combine = yes
final_units = counts

This time, with a more relaxed cosmic ray rejection, the weight image has improved. This means that the newly generated science image is now ready for photometry.